summaryrefslogtreecommitdiff
path: root/patches/test
diff options
context:
space:
mode:
Diffstat (limited to 'patches/test')
-rw-r--r--patches/test/README119
-rw-r--r--patches/test/binutils-bdirect.diff648
-rw-r--r--patches/test/binutils-dynsort.diff1086
-rw-r--r--patches/test/binutils-noundef.diff25
-rw-r--r--patches/test/binutils-objprel.diff190
-rw-r--r--patches/test/binutils-pltabs.diff177
-rw-r--r--patches/test/binutils-suse-bdirect.diff579
-rw-r--r--patches/test/binutils-suse-dynsort.diff1067
-rw-r--r--patches/test/binutils-suse-hashvals.diff168
-rw-r--r--patches/test/binutils-vt-copy-2.diff1574
-rw-r--r--patches/test/binutils-vt-copy-3.diff83
-rw-r--r--patches/test/binutils-vt-copy.diff1537
-rw-r--r--patches/test/boxclipping.diff3358
-rw-r--r--patches/test/built-in-unit-test-sc.diff213
-rw-r--r--patches/test/built-in-unit-test.diff211
-rw-r--r--patches/test/calc-autofilter-multistring-offapi.diff843
-rw-r--r--patches/test/calc-autofilter-multistring-sc.diff2551
-rw-r--r--patches/test/calc-autofilter-multistring-xmloff.diff32
-rw-r--r--patches/test/calc-csv-import-as-text.diff40
-rw-r--r--patches/test/calc-csv-import-quoted-text.diff89
-rw-r--r--patches/test/calc-external-defined-names-offapi-before-merge.diff435
-rw-r--r--patches/test/calc-external-defined-names-sc-before-merge.diff9415
-rw-r--r--patches/test/calc-external-names-additional-fixes-before-merge.diff164
-rw-r--r--patches/test/calc-selection-cursor-position.diff632
-rw-r--r--patches/test/calc-xls-import-formula-cache.diff205
-rw-r--r--patches/test/canvas-gradient-fixes.diff3787
-rw-r--r--patches/test/chart-stacked-category-labels-chart2.diff386
-rw-r--r--patches/test/chart-stacked-category-labels-sc.diff95
-rw-r--r--patches/test/chartapisnappshot.tarbin53048 -> 0 bytes
-rw-r--r--patches/test/clipstate.diff1416
-rw-r--r--patches/test/configmgr-lesslock.diff86
-rw-r--r--patches/test/configmgr-profile.diff316
-rw-r--r--patches/test/configmgr-refactor.diff9060
-rw-r--r--patches/test/dbbe.diff84
-rw-r--r--patches/test/dir.reader.cxx494
-rw-r--r--patches/test/font-debug.diff256
-rw-r--r--patches/test/gcc-pltabs.diff63
-rw-r--r--patches/test/gcc-stubhack.diff182
-rw-r--r--patches/test/gcc-vt-copy-2.diff887
-rw-r--r--patches/test/gcc-vt-copy-3.diff929
-rw-r--r--patches/test/gcc-vt-copy-4-0.diff864
-rw-r--r--patches/test/gcc-vt-copy-4.diff820
-rw-r--r--patches/test/gcc-vt-copy.diff719
-rw-r--r--patches/test/gcc-ztvd.diff302
-rw-r--r--patches/test/glibc-bdirect.diff361
-rw-r--r--patches/test/glibc-suse-bdirect.diff341
-rw-r--r--patches/test/glibc-suse-hashvals.diff163
-rw-r--r--patches/test/glibc-vt-reloc-3.diff239
-rw-r--r--patches/test/glibc-vt-reloc.diff223
-rw-r--r--patches/test/gui-control-layout.diff177
-rw-r--r--patches/test/gui-disable-spellcheck-all-langs.diff103
-rw-r--r--patches/test/gui-window-layout.diff35
-rw-r--r--patches/test/layout-ids.diff67
-rw-r--r--patches/test/layout-rsc.diff221
-rw-r--r--patches/test/layout-test.diff143
-rw-r--r--patches/test/layout-vcl-layout.diff521
-rw-r--r--patches/test/layout-vcl-window.diff219
-rw-r--r--patches/test/link-vt-reloc.diff15
-rw-r--r--patches/test/lwp-filter-component.diff804
-rw-r--r--patches/test/macbuild.diff116
-rw-r--r--patches/test/mono-testtools.diff163
-rw-r--r--patches/test/ms-interoperability-email-attachment-as-doc-xls-ppt-m99-v2.diff602
-rw-r--r--patches/test/myspell-shrink.diff406
-rw-r--r--patches/test/odf-filter-hash-token-map-xmloff.diff120
-rw-r--r--patches/test/ooo-build-qatesttool.diff116
-rw-r--r--patches/test/opengl-canvas.diff5650
-rw-r--r--patches/test/pagein-idle133
-rw-r--r--patches/test/pagein-idle.diff469
-rw-r--r--patches/test/psprint-enable-artificial-ItalicBold-printing.diff62
-rw-r--r--patches/test/quick-diagramming.diff10445
-rw-r--r--patches/test/sal-constfoo.diff461
-rw-r--r--patches/test/sal-instrument.diff38
-rw-r--r--patches/test/sal-relaxed-maxpath.diff165
-rw-r--r--patches/test/sal-string-instrument.diff327
-rw-r--r--patches/test/sc-dp-debug.diff29
-rw-r--r--patches/test/sc-dp-speed.diff438
-rw-r--r--patches/test/sc-ecma-filter.diff100
-rw-r--r--patches/test/sc-highlight-current-row.diff157
-rw-r--r--patches/test/sc-postit.diff2351
-rw-r--r--patches/test/sc-sheet-name-disallow-dos-chars.diff40
-rw-r--r--patches/test/sc-source-filter-ecma-ecma-cxx.diff318
-rw-r--r--patches/test/sc-source-filter-ecma-parsebase-cxx.diff113
-rw-r--r--patches/test/sc-source-filter-ecma-parsebase-hxx.diff50
-rw-r--r--patches/test/sc-vba-worksheet-changed-event-by-fong.diff201
-rw-r--r--patches/test/sc-vba-worksheet-changed.diff246
-rw-r--r--patches/test/sd-export-html-thumbnails.diff148
-rw-r--r--patches/test/service-log.diff57
-rw-r--r--patches/test/sfx-broadcaster-hashset-svtools.diff886
-rw-r--r--patches/test/sfx2-test-kde-systray-stuff.diff455
-rw-r--r--patches/test/size-intern.diff180
-rw-r--r--patches/test/size-sound-framework.diff117
-rw-r--r--patches/test/size-sound-sc.diff32
-rw-r--r--patches/test/size-sound-sd.diff249
-rw-r--r--patches/test/size-sound-svx.diff71
-rw-r--r--patches/test/size-sound-sw.diff32
-rw-r--r--patches/test/size-sound-vcl.diff640
-rw-r--r--patches/test/slideshow-primitives.diff2234
-rw-r--r--patches/test/slideshow-unittests.diff60
-rw-r--r--patches/test/slidesorter-demo-pngperf.svtools.diff234
-rw-r--r--patches/test/slidesorter-demo-pngperf.vcl.diff3192
-rw-r--r--patches/test/slidesorter-demo-sd.diff89
-rw-r--r--patches/test/slidesorter-demo-svtools.diff25
-rw-r--r--patches/test/slidesorter-demo-vcl.diff95
-rw-r--r--patches/test/speed-except-codemaker.diff501
-rw-r--r--patches/test/speed-except.diff553
-rw-r--r--patches/test/speed-image-refactor.diff437
-rw-r--r--patches/test/speed-image.diff1628
-rw-r--r--patches/test/speed-ld-flags.diff89
-rw-r--r--patches/test/store-v2-fileformat.diff3410
-rw-r--r--patches/test/suse-vtrelocs-binutils.diff82
-rw-r--r--patches/test/suse-vtrelocs-gcc.diff874
-rw-r--r--patches/test/suse-vtrelocs-glibc.diff239
-rw-r--r--patches/test/svg-import-rsvg.diff180
-rw-r--r--patches/test/sw-dump-layout-tree.diff232
-rw-r--r--patches/test/template-management-ui.diff208
-rw-r--r--patches/test/vba-basic-macrochoose-dialog.diff309
-rw-r--r--patches/test/vba-directlocalvaraccess.diff598
-rw-r--r--patches/test/vba-export-dir.diff1622
-rw-r--r--patches/test/vba-export.diff1092
-rw-r--r--patches/test/vba-workbook-worksheet-events.diff626
-rw-r--r--patches/test/vba/HackyImageControlWithNonLinkedImages.diff1158
-rw-r--r--patches/test/vba/ModuleInfo.diff2066
-rw-r--r--patches/test/vba/ObjectModule.diff2954
-rw-r--r--patches/test/vba/ObjectModule.txt12
-rw-r--r--patches/test/vba/ObjectModuleUITest.txt69
-rw-r--r--patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff840
-rw-r--r--patches/test/vba/dialog-vba-fake-events.diff366
-rw-r--r--patches/test/vba/formradiobuttongroup.diff327
-rw-r--r--patches/test/vba/native-format-things-todo.txt41
-rw-r--r--patches/test/vba/vba-intersection-union.diff436
-rw-r--r--patches/test/vba/vbaevents-services-sources.diff1896
-rw-r--r--patches/test/vba/vbaevents.diff2550
-rw-r--r--patches/test/vcl-add-simle-qteventloop.diff27
-rw-r--r--patches/test/vcl-bmp-correctness.diff566
-rw-r--r--patches/test/vcl-font-hinting.diff157
-rw-r--r--patches/test/win32-crosscompilation.diff898
-rw-r--r--patches/test/wmf-clipperf.diff439
-rw-r--r--patches/test/word-read-custom-toolbar-filter.diff2332
-rw-r--r--patches/test/xmlsearch-xerces.diff243
139 files changed, 0 insertions, 111988 deletions
diff --git a/patches/test/README b/patches/test/README
deleted file mode 100644
index e6cce7a36..000000000
--- a/patches/test/README
+++ /dev/null
@@ -1,119 +0,0 @@
-Some prototype / useful patches:
-
-[ SlideSorterDemo ]
-SectionOwner => rodo
-
-slidesorter-demo-pngperf.svtools.diff, rodo, i#55174
-slidesorter-demo-pngperf.vcl.diff, rodo, i#55174
-slidesorter-demo-sd.diff, rodo, i#55174
-slidesorter-demo-svtools.diff, rodo, i#55174
-slidesorter-demo-vcl.diff, rodo, i#55174
-
-# Testbed for layout work
-
-gui-window-layout.diff
-gui-control-layout.diff
-layout-ids.diff
-layout-rsc.diff
-layout-vcl-layout.diff
-layout-vcl-window.diff
-layout-test.diff
-
-# Improve impress slide-show / HTML export
-sd-export-html-thumbnails.diff
-
-# Export VBA macros
-# - needs more work done inside calc
-vba-export.diff
-vba-export-dir.diff
-
-# Unfinished ODMA work
-# Enable ODMA support in the build
-win32-odma-build.diff
-# Scott Clayton's fixes for recent G/W development #32741
-win32-odma-gw-fix.diff
-
-# Unfinished (?) dict. read efficiency fix of Dan's
-gui-disable-spellcheck-all-langs.diff
-
-# dictionary space improvement ... i#50842
-myspell-shrink.diff
-
-# pagein speedsup - have an idle / background reading of all
-# files we're going to touch on startup - and
-pagein-idle.diff - the patch
-pagein-idle - the file to use
-# add pagein -i @pagein-idle to soffice to test.
-
-# artificial italic-bold, italic & bold support for font families that don't
-# provide such fonts. Very import for CJK users
-ArtificialBoldItalic.diff:
- basic support, creates artificial fonts in the fontmanager, transforming code for glyphs etc.
-psprint-enable-artificial-ItalicBold-printing.diff:
- enables artificial bold and italic support to be picked up by ps print stuff.
-
- Notes:
- pdf print doesn't work, guess this needs a similar patch in
-source/gdi/pdfwriter_impl.cxx. The likely spots are around line 4975 for bold and 4944. Look for "artificial bold necessary " & "perform artificial italics". Of course these patches should not be necessary, it would be rightous to be able to detect artificial bold or italic from ImplFontSelectData or some such class.
- Also worth saying that with these patches I've seen a spurious crash on
-startup, not clear whether its a problem with the patch or a build problem. I'd
-suspect the patch.
-
-# hack to keep openStorageElement from checking if a URL is both
-# a file and a directory
-# also rely on lower-level exceptions to make sure create is done
-fsstorage.diff
-
-# Log all UNO service activation as it happens
-service-log.diff
-
-# Unfinished free java xmlhelp work
-# replace com.sun.foo-using xml code with xerces-using code
-# needs one more change in xmlsearch and all of xmlhelp.
-xmlsearch-xerces.diff
-
-#
-# I don't know where to put this patch at the moment ( qatesttool is not )
-# built in ooo-build. Theses patches necessary to run the testtool built
-# under ooo-build
-#
-ooo-build-qatesttool.diff
-
-# Test-bed for removing old / nasty VCL sound crud
-# we need new interfaces for this when we do the GStreamer work
-size-sound-vcl.diff
-size-sound-svx.diff
-size-sound-framework.diff
-size-sound-sw.diff
-size-sound-sc.diff
-size-sound-sd.diff
-
-#
-# chartapisnappshot.tar ok this is a snapshot of the chart api stuff implemented
-# for the OOoCon 2006 demo
-# Will serve as a good start for someone who wants to expand on this ( its a
-# bit too hacky at the moment
-# Note: This is a snapshot of the files ( ok, they are generated as diffs )
-# so I would recomend when applying the diffs to back up the current
-# source and do a comparison to see whats changed
-#
-
-
-# On-going effort to add multi-string filter type to Calc. Pathces generated
-# from the upstream CWS autofilter01.
-
-calc-autofilter-multistring-offapi.diff
-calc-autofilter-multistring-sc.diff
-calc-autofilter-multistring-xmloff.diff
-
-# On-going work toward importing & exporting Excel's sheet and workbook password
-# in addition to supporting sheet protection options like Excel does.
-
-sc-book-n-sheet-protection-test.diff, kohei
-
-# An attempt to relax the stupid 260 character limit on W32/OS2 path
-# names. At least removes the limit from those functions not relying
-# on Win32 API
-
-sal-relaxed-maxpath.diff, thorsten
-
diff --git a/patches/test/binutils-bdirect.diff b/patches/test/binutils-bdirect.diff
deleted file mode 100644
index ae6c37845..000000000
--- a/patches/test/binutils-bdirect.diff
+++ /dev/null
@@ -1,648 +0,0 @@
---- error - this patch is deprecated; cf. binutils-suse-bdirect.diff
-
-
-Only in binutils.current/bfd/doc: chew
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elf-bfd.h binutils.current/bfd/elf-bfd.h
---- binutils-2.16/bfd/elf-bfd.h 2005-03-03 20:52:31.000000000 +0000
-+++ binutils.current/bfd/elf-bfd.h 2005-11-23 11:04:04.000000000 +0000
-@@ -170,6 +170,14 @@
- matters. */
- unsigned int pointer_equality_needed : 1;
-
-+ /* FIXME: these 2 bits consume another 4 bytes */
-+ /* Symbol is concrete, ie. non-vague if we can detect that, from the
-+ .direct section */
-+ unsigned int concrete_ref : 1;
-+ /* Symbol is certainly vague (if we can detect that), from the
-+ .direct section */
-+ unsigned int vague_ref : 1;
-+
- /* String table index in .dynstr if this is a dynamic symbol. */
- unsigned long dynstr_index;
-
-@@ -396,6 +404,9 @@
- asection *tls_sec;
- bfd_size_type tls_size;
-
-+ /* Direct linkage output section */
-+ asection *direct_sec;
-+
- /* A linked list of BFD's loaded in the link. */
- struct elf_link_loaded_list *loaded;
-
-@@ -1238,6 +1249,7 @@
- name actually used, which will be the DT_SONAME entry if there is
- one. */
- const char *dt_name;
-+ int dt_needed_idx;
-
- /* Records the result of `get_program_header_size'. */
- bfd_size_type program_header_size;
-@@ -1338,6 +1350,7 @@
- #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
- #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
- #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
-+#define elf_dt_needed_idx(bfd) (elf_tdata(bfd) -> dt_needed_idx)
- #define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
- #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
- #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
-Only in binutils.current/bfd: elf-bfd.h~
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elf.c binutils.current/bfd/elf.c
---- binutils-2.16/bfd/elf.c 2005-03-06 02:02:15.000000000 +0000
-+++ binutils.current/bfd/elf.c 2005-11-18 17:08:51.000000000 +0000
-@@ -1145,6 +1145,7 @@
- case DT_RELCOUNT: name = "RELCOUNT"; break;
- case DT_FLAGS_1: name = "FLAGS_1"; break;
- case DT_VERSYM: name = "VERSYM"; break;
-+ case DT_DIRECT: name = "DIRECT"; break;
- case DT_VERDEF: name = "VERDEF"; break;
- case DT_VERDEFNUM: name = "VERDEFNUM"; break;
- case DT_VERNEED: name = "VERNEED"; break;
-@@ -1495,6 +1496,7 @@
- table->runpath = NULL;
- table->tls_sec = NULL;
- table->tls_size = 0;
-+ table->direct_sec = NULL;
- table->loaded = NULL;
- table->is_relocatable_executable = FALSE;
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elflink.c binutils.current/bfd/elflink.c
---- binutils-2.16/bfd/elflink.c 2005-04-29 14:40:22.000000000 +0100
-+++ binutils.current/bfd/elflink.c 2005-11-30 15:07:38.000000000 +0000
-@@ -172,6 +172,16 @@
- elf_hash_table (info)->eh_info.hdr_sec = s;
- }
-
-+ if ( info->direct && !info->executable )
-+ {
-+ s = bfd_make_section (abfd, ".direct");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+ elf_hash_table (info)->direct_sec = s;
-+ }
-+
- /* Create sections to hold version informations. These are removed
- if they are not needed. */
- s = bfd_make_section (abfd, ".gnu.version_d");
-@@ -2193,7 +2203,9 @@
-
- return TRUE;
- }
-+
-
-+
- /* Fix up the flags for a symbol. This handles various cases which
- can only be fixed after all the input files are seen. This is
- currently called by both adjust_dynamic_symbol and
-@@ -2848,6 +2860,9 @@
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
- return -1;
-+ elf_dt_needed_idx (abfd) = ++(info->dt_needed_index);
-+/* fprintf (stderr, "Set soname '%s' as index %d\n",
-+ soname, info->dt_needed_index); */
- }
- else
- /* We were just checking for existence of the tag. */
-@@ -3143,6 +3158,8 @@
- bfd_boolean add_needed;
- struct elf_link_hash_table * hash_table;
- bfd_size_type amt;
-+ asection *direct_sec;
-+ unsigned char *direct_data;
-
- hash_table = elf_hash_table (info);
-
-@@ -3150,6 +3167,9 @@
- add_symbol_hook = bed->elf_add_symbol_hook;
- collect = bed->collect;
-
-+ direct_sec = NULL;
-+ direct_data = NULL;
-+
- if ((abfd->flags & DYNAMIC) == 0)
- dynamic = FALSE;
- else
-@@ -3169,6 +3189,14 @@
- bfd_set_error (bfd_error_wrong_format);
- goto error_return;
- }
-+ if (info->direct &&
-+ (direct_sec = bfd_get_section_by_name (abfd, ".direct")))
-+ {
-+ direct_data = bfd_alloc (abfd, direct_sec->size);
-+ if (direct_data == NULL ||
-+ ! bfd_get_section_contents (abfd, direct_sec, direct_data, 0, direct_sec->size))
-+ goto error_return;
-+ }
- }
-
- /* As a GNU extension, any input sections which are named
-@@ -3817,6 +3845,37 @@
- && vernum > 1
- && definition)
- h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
-+
-+ if (direct_sec)
-+ {
-+ unsigned long d_idx = isym - isymbuf;
-+ /* FIXME: does bfd_elf_get_elf_syms read dynsym or the symbol
-+ table ? */
-+ d_idx += extsymoff;
-+ d_idx *= 2;
-+ if (d_idx > bfd_get_section_size (direct_sec))
-+ fprintf (stderr, "Warning - strange error on '%s': 0x%x 0x%x\n",
-+ h->root.root.string, (int)d_idx,
-+ (int)bfd_get_section_size (direct_sec));
-+ else
-+ {
-+ unsigned int direct_entry;
-+ direct_entry = bfd_get_16 (abfd, direct_data + d_idx);
-+ if ((direct_entry & DT_DIRECT_VAGUE))
-+ h->vague_ref = 1;
-+ if (!h->vague_ref &&
-+ (direct_entry & DT_DIRECT_MASK) != DT_DIRECT_UNKNOWN)
-+ h->concrete_ref = 1;
-+#if 0
-+ fprintf (stderr, "symbol '%s': %s direct entry 0x%x (index %d) section '%s' : '%s'\n",
-+ h->root.root.string,
-+ h->vague_ref ? "vague " : h->concrete_ref ? "concrete" : "unknown",
-+ direct_entry, (int)d_idx/2,
-+ new_sec ? new_sec->name : "<nosec>",
-+ new_sec && new_sec->owner ? new_sec->owner->filename : "<noownername>");
-+#endif
-+ }
-+ }
- }
-
- if (! (_bfd_generic_link_add_one_symbol
-@@ -3830,6 +3889,8 @@
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- *sym_hash = h;
-
-+ /* FIXME: move direct bits here ? - seem fine where they are ... */
-+
- new_weakdef = FALSE;
- if (dynamic
- && definition
-@@ -4450,6 +4511,8 @@
- if (isymbuf != NULL)
- free (isymbuf);
- error_return:
-+ if (direct_data != NULL)
-+ free (direct_data);
- return FALSE;
- }
-
-@@ -5671,6 +5734,24 @@
- return FALSE;
- }
-
-+ /* Create the direct bindings section - 1 entry per dynsym */
-+ s = bfd_get_section_by_name (dynobj, ".direct");
-+ if (s)
-+ {
-+ if (dynsymcount == 0)
-+ _bfd_strip_section_from_output (info, s);
-+ else
-+ {
-+ s->size = dynsymcount * sizeof (Elf_External_Direct);
-+ s->contents = bfd_zalloc (output_bfd, s->size);
-+ if (s->contents == NULL)
-+ return FALSE;
-+ memset (s->contents, 0xff, s->size);
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_DIRECT, 0))
-+ return FALSE;
-+ }
-+ }
-+
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols in elf_link_add_object_symbols.
- We will build the contents of .dynsym and .hash when we build
-@@ -5749,6 +5830,8 @@
- asection *hash_sec;
- /* symbol version section (.gnu.version). */
- asection *symver_sec;
-+ /* .direct linkage section */
-+ asection *direct_sec;
- /* Buffer large enough to hold contents of any section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any section. */
-@@ -6603,6 +6704,64 @@
- eversym += h->dynindx;
- _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
- }
-+
-+ if (finfo->direct_sec)
-+ {
-+ bfd_vma offset = 2 * h->dynindx;
-+ if (offset > finfo->direct_sec->size)
-+ fprintf (stderr, "Out of bounds direct section index %d\n",
-+ (int) offset);
-+ else
-+ {
-+ int dt_index = DT_DIRECT_UNKNOWN;
-+
-+#if 0
-+ fprintf (stderr, "Symbol '%s' type %d\n",
-+ h->root.root.string, h->root.type);
-+#endif
-+ if ((h->root.type == bfd_link_hash_defined
-+ || h->root.type == bfd_link_hash_defweak) &&
-+ h->root.u.def.section != NULL &&
-+ h->root.u.def.section->owner != NULL)
-+
-+ {
-+ asection *sec = h->root.u.def.section;
-+
-+ dt_index = elf_dt_needed_idx (sec->owner);
-+
-+ if (!(sec->owner->flags & DYNAMIC))
-+ {
-+ if (!sec->name ||
-+ !strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1))
-+ dt_index |= DT_DIRECT_VAGUE;
-+
-+ /* app -> library data references get turned into copy
-+ relocs, so objects can migrate unpredictably into the
-+ application itself. */
-+ else if (h->type == STT_OBJECT)
-+ dt_index |= DT_DIRECT_VAGUE;
-+ }
-+ else if (h->vague_ref)
-+ dt_index |= DT_DIRECT_VAGUE;
-+
-+ else if (!h->concrete_ref)
-+ dt_index = DT_DIRECT_UNKNOWN;
-+
-+#if 0
-+ fprintf (stderr, "Sym '%s' (type %d) [type %d] section %s [%s] owner '%s' [%d] offset %d resolves '%s'\n",
-+ h->root.root.string, h->root.type, h->type,
-+ sec->name ? sec->name : "<null>",
-+ sec->owner->flags & DYNAMIC ? "dynamic" : "static",
-+ sec->owner ? sec->owner->filename : "<noowner?>",
-+ dt_index, (int) offset,
-+ dt_index & DT_DIRECT_VAGUE ? "<vague>" : "concrete");
-+#endif
-+ }
-+ bfd_put_16 (finfo->output_bfd,
-+ dt_index,
-+ finfo->direct_sec->contents + offset);
-+ }
-+ }
- }
-
- /* If we're stripping it, then it was just a dynamic symbol, and
-@@ -7732,6 +7891,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.direct_sec = NULL;
- }
- else
- {
-@@ -7740,6 +7900,7 @@
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
- /* Note that it is OK if symver_sec is NULL. */
-+ finfo.direct_sec = bfd_get_section_by_name (dynobj, ".direct");
- }
-
- finfo.contents = NULL;
-@@ -8492,6 +8653,9 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_DIRECT:
-+ name = ".direct";
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-Only in binutils.current/bfd: elflink.c~
-Files binutils-2.16/bfd/libbfd.a and binutils.current/bfd/libbfd.a differ
-Files binutils-2.16/bfd/.libs/libbfd.a and binutils.current/bfd/.libs/libbfd.a differ
-Files binutils-2.16/binutils/addr2line and binutils.current/binutils/addr2line differ
-Files binutils-2.16/binutils/ar and binutils.current/binutils/ar differ
-Files binutils-2.16/binutils/cxxfilt and binutils.current/binutils/cxxfilt differ
-Files binutils-2.16/binutils/nm-new and binutils.current/binutils/nm-new differ
-Files binutils-2.16/binutils/objcopy and binutils.current/binutils/objcopy differ
-Files binutils-2.16/binutils/objdump and binutils.current/binutils/objdump differ
-Files binutils-2.16/binutils/ranlib and binutils.current/binutils/ranlib differ
-Files binutils-2.16/binutils/readelf and binutils.current/binutils/readelf differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/binutils/readelf.c binutils.current/binutils/readelf.c
---- binutils-2.16/binutils/readelf.c 2005-04-20 19:43:36.000000000 +0100
-+++ binutils.current/binutils/readelf.c 2005-11-23 11:10:06.000000000 +0000
-@@ -143,6 +143,7 @@
- int do_dynamic;
- int do_syms;
- int do_reloc;
-+int do_direct;
- int do_sections;
- int do_section_groups;
- int do_segments;
-@@ -1519,6 +1520,7 @@
- case DT_SYMINFO: return "SYMINFO"; /* aka ADDRRNGHI */
-
- case DT_VERSYM: return "VERSYM";
-+ case DT_DIRECT: return "DIRECT";
-
- case DT_RELACOUNT: return "RELACOUNT";
- case DT_RELCOUNT: return "RELCOUNT";
-@@ -2590,6 +2592,7 @@
- {"symbols", no_argument, 0, 's'},
- {"syms", no_argument, 0, 's'},
- {"relocs", no_argument, 0, 'r'},
-+ {"direct", no_argument, 0, 'y'},
- {"notes", no_argument, 0, 'n'},
- {"dynamic", no_argument, 0, 'd'},
- {"arch-specific", no_argument, 0, 'A'},
-@@ -2626,6 +2629,7 @@
- --symbols An alias for --syms\n\
- -n --notes Display the core notes (if present)\n\
- -r --relocs Display the relocations (if present)\n\
-+ -y --direct Display direct linkage table (if present)\n\
- -u --unwind Display the unwind info (if present)\n\
- -d --dynamic Display the dynamic section (if present)\n\
- -V --version-info Display the version sections (if present)\n\
-@@ -2693,7 +2697,7 @@
- usage ();
-
- while ((c = getopt_long
-- (argc, argv, "ersuahnldSDAIgw::x:i:vVWH", options, NULL)) != EOF)
-+ (argc, argv, "erysuahnldSDAIgw::x:i:vVWH", options, NULL)) != EOF)
- {
- char *cp;
- int section;
-@@ -2710,6 +2714,7 @@
- case 'a':
- do_syms++;
- do_reloc++;
-+ do_direct++;
- do_unwind++;
- do_dynamic++;
- do_header++;
-@@ -2738,6 +2743,9 @@
- case 'r':
- do_reloc++;
- break;
-+ case 'y':
-+ do_direct++;
-+ break;
- case 'u':
- do_unwind++;
- break;
-@@ -2943,7 +2951,7 @@
- }
- }
-
-- if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections
-+ if (!do_dynamic && !do_syms && !do_reloc && !do_direct && !do_unwind && !do_sections
- && !do_segments && !do_header && !do_dump && !do_version
- && !do_histogram && !do_debugging && !do_arch && !do_notes
- && !do_section_groups)
-@@ -4328,6 +4336,132 @@
- return 1;
- }
-
-+static void
-+print_dt_needed_name (int idx)
-+{
-+ const char *name = NULL;
-+ Elf_Internal_Dyn *entry;
-+
-+ idx &= DT_DIRECT_MASK;
-+
-+ switch (idx)
-+ {
-+ case 0:
-+ name = _("<self>");
-+ break;
-+ case DT_DIRECT_UNKNOWN:
-+ name = _("<unknown>");
-+ break;
-+ default:
-+ idx--;
-+
-+ for (entry = dynamic_section;
-+ entry < dynamic_section + dynamic_nent && idx > 0;
-+ entry++)
-+ if (entry->d_tag == DT_NEEDED)
-+ idx--;
-+
-+ if (idx == 0)
-+ {
-+ if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
-+ name = GET_DYNAMIC_NAME (entry->d_un.d_val);
-+ else
-+ name = NULL;
-+ }
-+ break;
-+ }
-+
-+ if (!name)
-+ name = _("<out-of-range>");
-+ if (do_wide)
-+ printf ("%s", name);
-+ else
-+ printf ("%-25s", name);
-+}
-+
-+static int
-+process_direct (FILE *file)
-+{
-+ unsigned int i;
-+ unsigned int si;
-+ char *strtab;
-+ unsigned char *directtab;
-+ Elf_Internal_Sym *symtab = NULL;
-+ Elf_Internal_Sym *psym;
-+ Elf_Internal_Shdr *direct = NULL;
-+ Elf_Internal_Shdr *dynsym = NULL;
-+ Elf_Internal_Shdr *section;
-+
-+ if (!do_direct)
-+ return 1;
-+ if (!dynamic_symbols || !dynamic_section || !dynamic_strings)
-+ return 1;
-+
-+ for (i = 0, section = section_headers;
-+ i < elf_header.e_shnum;
-+ i++, section++)
-+ {
-+ if (section->sh_type == SHT_DYNSYM)
-+ dynsym = section;
-+ if (!strcmp (SECTION_NAME (section), ".direct"))
-+ direct = section;
-+ }
-+ if (!dynsym || !direct)
-+ return 1;
-+
-+ symtab = GET_ELF_SYMBOLS (file, dynsym);
-+ if (!symtab)
-+ return 1;
-+
-+ directtab = get_data (NULL, file, direct->sh_offset,
-+ direct->sh_size, _("direct linkage table"));
-+ if (!symtab)
-+ {
-+ free (symtab);
-+ return 1;
-+ }
-+
-+ if (dynsym->sh_link == elf_header.e_shstrndx)
-+ strtab = string_table;
-+ else
-+ {
-+ Elf_Internal_Shdr *string_sec;
-+
-+ string_sec = SECTION_HEADER (dynsym->sh_link);
-+
-+ strtab = get_data (NULL, file, string_sec->sh_offset,
-+ string_sec->sh_size, _("string table"));
-+ }
-+
-+ assert (strtab != NULL);
-+
-+ printf (_("\nDirect relocations for image:\n"));
-+ printf (_(" Num: Index Vague Binding Symbol\n"));
-+ for (si = 0, psym = symtab;
-+ si < dynsym->sh_size / dynsym->sh_entsize;
-+ si++, psym++)
-+ {
-+ unsigned int field;
-+ printf ("%6d: ", si);
-+ field = byte_get (directtab + (si * 2), 2);
-+ printf ("[0x%.4x] ", field);
-+ printf ("%s", (field & DT_DIRECT_VAGUE) ? "Vague" : " ");
-+ printf (" ");
-+ print_dt_needed_name (field);
-+ printf (" ");
-+ print_symbol (25, strtab + psym->st_name);
-+ printf ("\n");
-+ }
-+
-+
-+ free (symtab);
-+ if (strtab != string_table)
-+ free (strtab);
-+
-+ return 1;
-+}
-+
-+
- /* Process the unwind section. */
-
- #include "unwind-ia64.h"
-@@ -11784,6 +11918,8 @@
-
- process_relocs (file);
-
-+ process_direct (file);
-+
- process_unwind (file);
-
- process_symbol_table (file);
-Only in binutils.current/binutils: readelf.c~
-Files binutils-2.16/binutils/size and binutils.current/binutils/size differ
-Files binutils-2.16/binutils/strings and binutils.current/binutils/strings differ
-Files binutils-2.16/binutils/strip-new and binutils.current/binutils/strip-new differ
-Files binutils-2.16/gas/as-new and binutils.current/gas/as-new differ
-Files binutils-2.16/gprof/gprof and binutils.current/gprof/gprof differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/bfdlink.h binutils.current/include/bfdlink.h
---- binutils-2.16/include/bfdlink.h 2005-03-03 11:58:00.000000000 +0000
-+++ binutils.current/include/bfdlink.h 2005-11-23 10:31:37.000000000 +0000
-@@ -244,6 +244,9 @@
- /* TRUE if BFD should pre-bind symbols in a shared object. */
- unsigned int symbolic: 1;
-
-+ /* TRUE if BFD should bind symbols directly to resolved at link time. */
-+ unsigned int direct: 1;
-+
- /* TRUE if BFD should export all symbols in the dynamic symbol table
- of an executable, rather than only those used. */
- unsigned int export_dynamic: 1;
-@@ -416,6 +419,9 @@
-
- /* Start and end of RELRO region. */
- bfd_vma relro_start, relro_end;
-+
-+ /* current max dtinfo section number */
-+ int dt_needed_index;
- };
-
- /* This structures holds a set of callback functions. These are
-Only in binutils.current/include: bfdlink.h~
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/elf/common.h binutils.current/include/elf/common.h
---- binutils-2.16/include/elf/common.h 2004-10-08 14:55:08.000000000 +0100
-+++ binutils.current/include/elf/common.h 2005-11-22 14:12:53.000000000 +0000
-@@ -586,6 +586,7 @@
-
- /* This tag is a GNU extension to the Solaris version scheme. */
- #define DT_VERSYM 0x6ffffff0
-+#define DT_DIRECT 0x6ffffff1 /* FIXME - how are these allocated ? */
-
- #define DT_LOPROC 0x70000000
- #define DT_HIPROC 0x7fffffff
-@@ -635,6 +636,11 @@
- #define DF_BIND_NOW (1 << 3)
- #define DF_STATIC_TLS (1 << 4)
-
-+/* Constants for the DT_DIRECT entries. */
-+#define DT_DIRECT_VAGUE (1<<15)
-+#define DT_DIRECT_MASK 0x3ff
-+#define DT_DIRECT_UNKNOWN DT_DIRECT_MASK
-+
- /* These constants are used for the version number of a Elf32_Verdef
- structure. */
-
-Only in binutils.current/include/elf: common.h~
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/elf/external.h binutils.current/include/elf/external.h
---- binutils-2.16/include/elf/external.h 2005-03-03 11:58:05.000000000 +0000
-+++ binutils.current/include/elf/external.h 2005-11-18 17:08:51.000000000 +0000
-@@ -213,6 +213,10 @@
- unsigned char vd_next[4];
- } Elf_External_Verdef;
-
-+typedef struct {
-+ unsigned char dir_libidx[2];
-+} Elf_External_Direct;
-+
- /* This structure appears in a SHT_GNU_verdef section. */
-
- typedef struct {
-Files binutils-2.16/ld/ld-new and binutils.current/ld/ld-new differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/ld/lexsup.c binutils.current/ld/lexsup.c
---- binutils-2.16/ld/lexsup.c 2005-03-03 11:52:00.000000000 +0000
-+++ binutils.current/ld/lexsup.c 2005-11-23 10:32:20.000000000 +0000
-@@ -70,6 +70,7 @@
- OPTION_CREF,
- OPTION_DEFSYM,
- OPTION_DEMANGLE,
-+ OPTION_DIRECT,
- OPTION_DYNAMIC_LINKER,
- OPTION_SYSROOT,
- OPTION_EB,
-@@ -341,6 +342,8 @@
- '\0', NULL, NULL, ONE_DASH },
- { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
- '\0', NULL, N_("Bind global references locally"), ONE_DASH },
-+ { {"Bdirect", no_argument, NULL, OPTION_DIRECT},
-+ '\0', NULL, N_("Direct-linkage the the shared libraries"), ONE_DASH },
- { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
- '\0', NULL, N_("Check section addresses for overlaps (default)"),
- TWO_DASHES },
-@@ -746,6 +749,9 @@
- cplus_demangle_set_style (style);
- }
- break;
-+ case OPTION_DIRECT:
-+ link_info.direct = TRUE;
-+ break;
- case 'I': /* Used on Solaris. */
- case OPTION_DYNAMIC_LINKER:
- command_line.interpreter = optarg;
-Only in binutils.current/ld: lexsup.c~
-Files binutils-2.16/libiberty/libiberty.a and binutils.current/libiberty/libiberty.a differ
diff --git a/patches/test/binutils-dynsort.diff b/patches/test/binutils-dynsort.diff
deleted file mode 100644
index c37fe3a59..000000000
--- a/patches/test/binutils-dynsort.diff
+++ /dev/null
@@ -1,1086 +0,0 @@
---- error - this patch is deprecated; cf. binutils-suse-dynsort.diff
-
-
---- binutils-2.16.91.0.4/bfd/ChangeLog 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/ChangeLog 2006-01-18 17:33:24.000000000 +0000
-@@ -1,3 +1,40 @@
-+2006-01-18 Michael Meeks <michael.meeks@novell.com>
-+
-+ * bfdsort.c: import qsort.c from glibc-2.3 and re-work to
-+ provide missing closure argument, for more elegant sorting.
-+
-+ * elf-strtab.c (_bfd_elf_strtab_init, _bfd_elf_strtab_free):
-+ manage the sorted array.
-+ (_bfd_elf_strtab_emit): emit .dynstr in sorted order.
-+ (_bfd_elf_strtab_finalize, hash_compare): sort .dynstr
-+ primarily by elf bucket index.
-+
-+ * elflink.c (elf_finalize_dynstr): pass bucket count to
-+ strtab_finalize.
-+ (_bfd_elf_ver_hash): split for re-use from
-+ (elf_collect_hash_codes): here.
-+ (_bfd_elf_link_hash_traverse): new traversal function:
-+ walks sorted array if sorted, else walks the hash as before.
-+ (elf_sort_dynsym_hash): qsort method to sort dynsyms
-+ (elf_sort_collect_dynsyms): hash walker to collect symbols
-+ (_bfd_elf_sort_dynsyms): method - sorts .dynsym section.
-+ (bfd_elf_size_dynsym_hash_dynstr): do the .dynsym sort.
-+ (elf_link_sort_relocs, elf_link_sort_cmp2): sort relocs
-+ primarily by elf bucket index.
-+ (bfd_elf_final_link): update reloc sort call.
-+
-+ * elf.c (_bfd_elf_link_hash_table_init),
-+ (_bfd_elf_link_hash_table_free): init & free sorted array.
-+ (assign_section_numbers): upd. strtab_finalize call.
-+
-+ * elf32-m68hc1x.c (m68hc11_elf_bfd_link_hash_table_free),
-+ * elf-m10300.c (elf32_mn10300_link_hash_table_free),
-+ * elf32-hppa.c (elf32_hppa_link_hash_table_free),
-+ * elf64-ppc.c (ppc64_elf_link_hash_table_free),
-+ * elf.c (_bfd_elf_link_hash_table_free),
-+ * elfxx-target.h: implement elf specific hash free
-+ method & re-direct callers to it.
-+
- 2005-11-11 Nick Clifton <nickc@redhat.com>
-
- PR 1150
-
---- binutils-2.16.91.0.4/bfd/bfd.h 2005-12-23 17:03:29.000000000 +0000
-+++ binutils.current/bfd/bfd.h 2006-01-18 15:48:46.000000000 +0000
-@@ -639,6 +639,9 @@
- DYN_NO_NEEDED = 8
- };
-
-+typedef int(*bfd_qsort_closure_func)(const void *, const void *, const void *);
-+extern void bfd_qsort (void *base, bfd_size_type nmemb, bfd_size_type size,
-+ bfd_qsort_closure_func cmp, void *closure);
- extern bfd_boolean bfd_elf_record_link_assignment
- (struct bfd_link_info *, const char *, bfd_boolean);
- extern struct bfd_link_needed_list *bfd_elf_get_needed_list
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/ChangeLog binutils.current/bfd/ChangeLog
-Files binutils-2.16.91.0.4/bfd/doc/chew and binutils.current/bfd/doc/chew differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf32-hppa.c binutils.current/bfd/elf32-hppa.c
---- binutils-2.16.91.0.4/bfd/elf32-hppa.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf32-hppa.c 2005-12-23 14:06:31.000000000 +0000
-@@ -435,7 +435,7 @@
- = (struct elf32_hppa_link_hash_table *) btab;
-
- bfd_hash_table_free (&htab->bstab);
-- _bfd_generic_link_hash_table_free (btab);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- /* Build a name for an entry in the stub hash table. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf32-m68hc1x.c binutils.current/bfd/elf32-m68hc1x.c
---- binutils-2.16.91.0.4/bfd/elf32-m68hc1x.c 2005-06-22 21:53:34.000000000 +0100
-+++ binutils.current/bfd/elf32-m68hc1x.c 2005-12-23 14:07:21.000000000 +0000
-@@ -106,7 +106,7 @@
-
- bfd_hash_table_free (ret->stub_hash_table);
- free (ret->stub_hash_table);
-- _bfd_generic_link_hash_table_free (hash);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- /* Assorted hash table functions. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf32-target.h binutils.current/bfd/elf32-target.h
---- binutils-2.16.91.0.4/bfd/elf32-target.h 2005-12-23 17:12:23.000000000 +0000
-+++ binutils.current/bfd/elf32-target.h 2005-12-23 14:51:28.000000000 +0000
-@@ -205,7 +205,7 @@
- #endif
-
- #ifndef bfd_elf32_bfd_link_hash_table_free
--#define bfd_elf32_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-+#define bfd_elf32_bfd_link_hash_table_free _bfd_elf_link_hash_table_free
- #endif
-
- #ifdef elf_backend_relocate_section
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf64-ppc.c binutils.current/bfd/elf64-ppc.c
---- binutils-2.16.91.0.4/bfd/elf64-ppc.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf64-ppc.c 2005-12-23 14:04:07.000000000 +0000
-@@ -3502,7 +3502,7 @@
-
- bfd_hash_table_free (&ret->stub_hash_table);
- bfd_hash_table_free (&ret->branch_hash_table);
-- _bfd_generic_link_hash_table_free (hash);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- /* Satisfy the ELF linker by filling in some fields in our fake bfd. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-bfd.h binutils.current/bfd/elf-bfd.h
---- binutils-2.16.91.0.4/bfd/elf-bfd.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elf-bfd.h 2005-12-23 14:59:54.000000000 +0000
-@@ -340,6 +340,10 @@
- {
- struct bfd_link_hash_table root;
-
-+ /* Symbol sort order for final traversal at output */
-+ unsigned int sorted_size;
-+ struct elf_link_hash_entry **sorted;
-+
- /* Whether we have created the special dynamic sections required
- when linking against or generating a shared object. */
- bfd_boolean dynamic_sections_created;
-@@ -418,11 +422,16 @@
- /* Traverse an ELF linker hash table. */
-
- #define elf_link_hash_traverse(table, func, info) \
-- (bfd_link_hash_traverse \
-- (&(table)->root, \
-- (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
-+ (_bfd_elf_link_hash_traverse \
-+ ((table), \
-+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
- (info)))
-
-+void _bfd_elf_link_hash_traverse
-+ (struct elf_link_hash_table *table,
-+ bfd_boolean (*func) (struct elf_link_hash_entry *, void *),
-+ void *info);
-+
- /* Get the ELF linker hash table from a link_info structure. */
-
- #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
-@@ -1446,6 +1455,8 @@
-
- extern unsigned long bfd_elf_hash
- (const char *);
-+extern unsigned long _bfd_elf_ver_hash
-+ (const char *);
-
- extern bfd_reloc_status_type bfd_elf_generic_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-@@ -1463,6 +1474,7 @@
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
- (bfd *);
-+extern void _bfd_elf_link_hash_table_free (struct bfd_link_hash_table *);
- extern void _bfd_elf_link_hash_copy_indirect
- (struct bfd_link_info *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *);
-@@ -1593,7 +1605,7 @@
- extern bfd_boolean _bfd_elf_strtab_emit
- (bfd *, struct elf_strtab_hash *);
- extern void _bfd_elf_strtab_finalize
-- (struct elf_strtab_hash *);
-+ (struct elf_strtab_hash *, size_t);
-
- extern bfd_boolean _bfd_elf_discard_section_eh_frame
- (bfd *, struct bfd_link_info *, asection *,
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf.c binutils.current/bfd/elf.c
---- binutils-2.16.91.0.4/bfd/elf.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elf.c 2005-12-23 14:04:18.000000000 +0000
-@@ -1560,6 +1560,8 @@
- table->tls_size = 0;
- table->loaded = NULL;
- table->is_relocatable_executable = FALSE;
-+ table->sorted = NULL;
-+ table->sorted_size = 0;
-
- ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc);
- table->root.type = bfd_link_elf_hash_table;
-@@ -1588,6 +1590,15 @@
- return &ret->root;
- }
-
-+void
-+_bfd_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
-+{
-+ struct elf_link_hash_table *table = (struct elf_link_hash_table *) hash;
-+ if (table->sorted)
-+ free (table->sorted);
-+ _bfd_generic_link_hash_table_free (hash);
-+}
-+
- /* This is a hook for the ELF emulation code in the generic linker to
- tell the backend linker what file name to use for the DT_NEEDED
- entry for a dynamic object. */
-@@ -2983,7 +2994,7 @@
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name);
- }
-
-- _bfd_elf_strtab_finalize (elf_shstrtab (abfd));
-+ _bfd_elf_strtab_finalize (elf_shstrtab (abfd), 0);
- t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
-
- elf_numsections (abfd) = section_number;
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elflink.c binutils.current/bfd/elflink.c
---- binutils-2.16.91.0.4/bfd/elflink.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elflink.c 2006-01-18 16:36:45.000000000 +0000
-@@ -3007,7 +3007,8 @@
- const struct elf_backend_data *bed;
- bfd_byte *extdyn;
-
-- _bfd_elf_strtab_finalize (dynstr);
-+ _bfd_elf_strtab_finalize (dynstr, info->dynsort ?
-+ elf_hash_table (info)->bucketcount : 0);
- size = _bfd_elf_strtab_size (dynstr);
-
- bed = get_elf_backend_data (dynobj);
-@@ -4715,27 +4716,17 @@
- return FALSE;
- }
- }
--
--/* This function will be called though elf_link_hash_traverse to store
-- all hash value of the exported symbols in an array. */
-
--static bfd_boolean
--elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
-+/*
-+ * Compute the elf hash value of the name ignoring the version.
-+ */
-+unsigned long
-+_bfd_elf_ver_hash (const char *name)
- {
-- unsigned long **valuep = data;
-- const char *name;
- char *p;
- unsigned long ha;
- char *alc = NULL;
-
-- if (h->root.type == bfd_link_hash_warning)
-- h = (struct elf_link_hash_entry *) h->root.u.i.link;
--
-- /* Ignore indirect symbols. These are added by the versioning code. */
-- if (h->dynindx == -1)
-- return TRUE;
--
-- name = h->root.root.string;
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL)
- {
-@@ -4748,6 +4739,31 @@
- /* Compute the hash value. */
- ha = bfd_elf_hash (name);
-
-+ if (alc != NULL)
-+ free (alc);
-+
-+ return ha;
-+}
-+
-+
-+/* This function will be called though elf_link_hash_traverse to store
-+ all hash value of the exported symbols in an array. */
-+
-+static bfd_boolean
-+elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
-+{
-+ unsigned long **valuep = data;
-+ unsigned long ha;
-+
-+ if (h->root.type == bfd_link_hash_warning)
-+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
-+
-+ /* Ignore indirect symbols. These are added by the versioning code. */
-+ if (h->dynindx == -1)
-+ return TRUE;
-+
-+ ha = _bfd_elf_ver_hash (h->root.root.string);
-+
- /* Store the found hash value in the array given as the argument. */
- *(*valuep)++ = ha;
-
-@@ -4755,9 +4771,6 @@
- later. */
- h->u.elf_hash_value = ha;
-
-- if (alc != NULL)
-- free (alc);
--
- return TRUE;
- }
-
-@@ -4920,6 +4933,123 @@
- return best_size;
- }
-
-+void _bfd_elf_link_hash_traverse
-+ (struct elf_link_hash_table *table,
-+ bfd_boolean (*func) (struct elf_link_hash_entry *, void *),
-+ void *info)
-+{
-+ if (!table->sorted)
-+ bfd_link_hash_traverse \
-+ (&(table)->root, \
-+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
-+ (info));
-+ else
-+ {
-+ unsigned int i;
-+ for (i = 0; i < table->sorted_size; i++)
-+ {
-+ if (! func (table->sorted[i], info))
-+ return;
-+ }
-+ }
-+}
-+
-+/* Sort by elf hash value % buckets */
-+static int
-+elf_sort_dynsym_hash (const void *arg1, const void *arg2, const void *closure)
-+{
-+ size_t h1_bucket, h2_bucket;
-+ const struct elf_link_hash_entry *h1;
-+ const struct elf_link_hash_entry *h2;
-+ const bfd_size_type *bucketcount;
-+
-+ h1 = *(const struct elf_link_hash_entry **) arg1;
-+ h2 = *(const struct elf_link_hash_entry **) arg2;
-+ bucketcount = closure;
-+
-+ h1_bucket = h1->u.elf_hash_value % *bucketcount;
-+ h2_bucket = h2->u.elf_hash_value % *bucketcount;
-+
-+ if (h1_bucket > h2_bucket)
-+ return 1;
-+ if (h1_bucket < h2_bucket)
-+ return -1;
-+
-+ return 0;
-+}
-+
-+struct elf_dynsym_sort_info
-+{
-+ bfd_boolean do_dynsym;
-+ unsigned int alloc_size;
-+ unsigned int sorted_size;
-+ struct elf_link_hash_entry **sorted_syms;
-+};
-+
-+/* collect sym entries into an array for later sorting */
-+static bfd_boolean
-+elf_sort_collect_dynsyms (struct elf_link_hash_entry *h, void *data)
-+{
-+ struct elf_dynsym_sort_info *sinfo = data;
-+
-+ if ((sinfo->do_dynsym && h->dynindx < 0) ||
-+ (!sinfo->do_dynsym && h->dynindx >= 0))
-+ return TRUE;
-+
-+ if (sinfo->sorted_size >= sinfo->alloc_size)
-+ {
-+ sinfo->alloc_size *= 2;
-+ /* FIXME: need to free this data too ... */
-+ sinfo->sorted_syms = bfd_realloc (sinfo->sorted_syms,
-+ sizeof (struct elf_link_hash_entry *) *
-+ sinfo->alloc_size);
-+ }
-+ sinfo->sorted_syms [sinfo->sorted_size++] = h;
-+
-+ return TRUE;
-+}
-+
-+/*
-+ * Sort the exported elf symbols by elf_hash % bucketcount to
-+ * improve run-time linker cache behavior. Subsequent
-+ * elf_link_hash_traverse calls will reflect this new order.
-+ */
-+static bfd_boolean
-+_bfd_elf_sort_dynsyms (struct bfd_link_info *info)
-+{
-+ bfd_size_type bucketcount;
-+ struct elf_dynsym_sort_info sinfo;
-+
-+ sinfo.alloc_size = 8;
-+ sinfo.sorted_syms = bfd_malloc (sizeof (struct elf_link_hash_entry *) *
-+ sinfo.alloc_size);
-+ if (!sinfo.sorted_syms)
-+ return FALSE;
-+
-+ sinfo.sorted_size = 0;
-+
-+ /* append dynsyms for sorting */
-+ sinfo.do_dynsym = TRUE;
-+ elf_link_hash_traverse (elf_hash_table (info), elf_sort_collect_dynsyms, &sinfo);
-+
-+ /* sort them ... */
-+ bucketcount = elf_hash_table (info)->bucketcount;
-+ bfd_qsort (sinfo.sorted_syms, sinfo.sorted_size,
-+ sizeof (struct elf_link_hash_entry *),
-+ elf_sort_dynsym_hash,
-+ &bucketcount);
-+
-+ /* append everything else */
-+ sinfo.do_dynsym = FALSE;
-+ elf_link_hash_traverse (elf_hash_table (info), elf_sort_collect_dynsyms, &sinfo);
-+
-+ /* freed in _bfd_elf_link_hash_table_free */
-+ elf_hash_table (info)->sorted = sinfo.sorted_syms;
-+ elf_hash_table (info)->sorted_size = sinfo.sorted_size;
-+
-+ return TRUE;
-+}
-+
- /* Set up the sizes and contents of the ELF dynamic sections. This is
- called by the ELF linker emulation before_allocation routine. We
- must set the sizes of the sections before the linker sets the
-@@ -5686,6 +5816,7 @@
- section symbol for each output section, which come first.
- Next come all of the back-end allocated local dynamic syms,
- followed by the rest of the global symbols. */
-+ /* To sort these optimally we need the correct bucketcount */
-
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
- &section_sym_count);
-@@ -5756,6 +5887,17 @@
- for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
- if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
- return FALSE;
-+
-+ /* Sort .dynsym to accelerate runtime linking */
-+ if (info->dynsort)
-+ {
-+ if (!_bfd_elf_sort_dynsyms (info))
-+ return FALSE;
-+
-+ /* renumber to reflect the new sorting order */
-+ _bfd_elf_link_renumber_dynsyms (output_bfd, info,
-+ &section_sym_count);
-+ }
- }
-
- return TRUE;
-@@ -5892,6 +6034,7 @@
- bfd_vma sym_mask;
- } u;
- enum elf_reloc_type_class type;
-+ unsigned long elf_bucket;
- /* We use this as an array of size int_rels_per_ext_rel. */
- Elf_Internal_Rela rela[1];
- };
-@@ -5928,6 +6071,10 @@
- const struct elf_link_sort_rela *b = B;
- int copya, copyb;
-
-+ if (a->elf_bucket < b->elf_bucket)
-+ return -1;
-+ if (a->elf_bucket > b->elf_bucket)
-+ return 1;
- if (a->u.offset < b->u.offset)
- return -1;
- if (a->u.offset > b->u.offset)
-@@ -5946,8 +6093,9 @@
- }
-
- static size_t
--elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
-+elf_link_sort_relocs (bfd *abfd, struct elf_final_link_info *finfo, asection **psec)
- {
-+ struct bfd_link_info *info = finfo->info;
- asection *reldyn;
- bfd_size_type count, size;
- size_t i, ret, sort_elt, ext_size;
-@@ -5959,6 +6107,7 @@
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- struct bfd_link_order *lo;
- bfd_vma r_sym_mask;
-+ int r_sym_shift;
-
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->size == 0)
-@@ -6000,15 +6149,29 @@
- }
-
- if (bed->s->arch_size == 32)
-- r_sym_mask = ~(bfd_vma) 0xff;
-+ {
-+ r_sym_mask = ~(bfd_vma) 0xff;
-+ r_sym_shift = 8;
-+ }
- else
-- r_sym_mask = ~(bfd_vma) 0xffffffff;
-+ {
-+ r_sym_mask = ~(bfd_vma) 0xffffffff;
-+ r_sym_shift = 32;
-+ }
-
- for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next)
- if (lo->type == bfd_indirect_link_order)
- {
- bfd_byte *erel, *erelend;
- asection *o = lo->u.indirect.section;
-+ int base_offset = -1;
-+ int base_max = 0;
-+
-+ if (elf_hash_table (info)->sorted_size > 0)
-+ {
-+ base_offset = elf_hash_table (info)->sorted[0]->dynindx;
-+ base_max = base_offset + elf_hash_table (info)->sorted_size;
-+ }
-
- if (o->contents == NULL && o->size != 0)
- {
-@@ -6023,10 +6186,24 @@
- p = sort + o->output_offset / ext_size * sort_elt;
- while (erel < erelend)
- {
-+ long dyn_idx;
-+ size_t bucketcount = elf_hash_table (info)->bucketcount;
- struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_in) (abfd, erel, s->rela);
- s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
- s->u.sym_mask = r_sym_mask;
-+
-+ if (s->type != reloc_class_relative)
-+ dyn_idx = s->rela->r_info >> r_sym_shift;
-+ else
-+ dyn_idx = -1;
-+
-+ if (info->dynsort && base_offset >= 0 &&
-+ dyn_idx < base_max && dyn_idx >= base_offset)
-+ s->elf_bucket = elf_hash_table (info)->sorted [dyn_idx - base_offset]->u.elf_hash_value % bucketcount;
-+ else
-+ s->elf_bucket = 0;
-+
- p += sort_elt;
- erel += ext_size;
- }
-@@ -8426,7 +8612,7 @@
- }
-
- if (dynamic && info->combreloc && dynobj != NULL)
-- relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
-+ relativecount = elf_link_sort_relocs (abfd, &finfo, &reldyn);
-
- /* If we are linking against a dynamic object, or generating a
- shared library, finish up the dynamic linking information. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-m10300.c binutils.current/bfd/elf-m10300.c
---- binutils-2.16.91.0.4/bfd/elf-m10300.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf-m10300.c 2005-12-23 14:06:10.000000000 +0000
-@@ -3729,8 +3729,7 @@
-
- _bfd_generic_link_hash_table_free
- ((struct bfd_link_hash_table *) ret->static_hash_table);
-- _bfd_generic_link_hash_table_free
-- ((struct bfd_link_hash_table *) ret);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- static unsigned long
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-strtab.c binutils.current/bfd/elf-strtab.c
---- binutils-2.16.91.0.4/bfd/elf-strtab.c 2005-05-10 23:46:41.000000000 +0100
-+++ binutils.current/bfd/elf-strtab.c 2006-01-18 16:37:04.000000000 +0000
-@@ -39,6 +39,7 @@
- /* Entry this is a suffix of (if len < 0). */
- struct elf_strtab_hash_entry *suffix;
- } u;
-+ long hash_bucket;
- };
-
- /* The strtab hash table. */
-@@ -54,6 +55,8 @@
- bfd_size_type sec_size;
- /* Array of pointers to strtab entries. */
- struct elf_strtab_hash_entry **array;
-+ /* Array of pointers to strtab entries. */
-+ struct elf_strtab_hash_entry **array_sorted;
- };
-
- /* Routine to create an entry in a section merge hashtab. */
-@@ -117,6 +120,7 @@
- }
-
- table->array[0] = NULL;
-+ table->array_sorted = NULL;
-
- return table;
- }
-@@ -128,6 +132,8 @@
- {
- bfd_hash_table_free (&tab->table);
- free (tab->array);
-+ if (tab->array_sorted)
-+ free (tab->array_sorted);
- free (tab);
- }
-
-@@ -229,6 +235,12 @@
- _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
- {
- bfd_size_type off = 1, i;
-+ struct elf_strtab_hash_entry **array;
-+
-+ if (tab->array_sorted != NULL)
-+ array = tab->array_sorted;
-+ else
-+ array = tab->array;
-
- if (bfd_bwrite ("", 1, abfd) != 1)
- return FALSE;
-@@ -238,12 +250,12 @@
- register const char *str;
- register unsigned int len;
-
-- BFD_ASSERT (tab->array[i]->refcount == 0);
-- len = tab->array[i]->len;
-+ BFD_ASSERT (array[i]->refcount == 0);
-+ len = array[i]->len;
- if ((int) len < 0)
- continue;
-
-- str = tab->array[i]->root.string;
-+ str = array[i]->root.string;
- if (bfd_bwrite (str, len, abfd) != len)
- return FALSE;
-
-@@ -278,6 +290,26 @@
- return lenA - lenB;
- }
-
-+/* sort by hash bucket position */
-+static int
-+hash_compare (const void *a, const void *b)
-+{
-+ struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a;
-+ struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
-+
-+ if (A->hash_bucket > B->hash_bucket)
-+ return 1;
-+ if (A->hash_bucket < B->hash_bucket)
-+ return -1;
-+
-+ /* Make qsort faster for lots of identical empty symbols */
-+ if (a > b)
-+ return 1;
-+ if (a < b)
-+ return -1;
-+ return 0;
-+}
-+
- static inline int
- is_suffix (const struct elf_strtab_hash_entry *A,
- const struct elf_strtab_hash_entry *B)
-@@ -293,9 +325,8 @@
-
- /* This function assigns final string table offsets for used strings,
- merging strings matching suffixes of longer strings if possible. */
--
- void
--_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
-+_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab, size_t bucket_count)
- {
- struct elf_strtab_hash_entry **array, **a, *e;
- bfd_size_type size, amt;
-@@ -361,15 +392,37 @@
- }
- }
-
--alloc_failure:
-- if (array)
-- free (array);
-+ if (bucket_count != 0)
-+ {
-+ array[0] = NULL;
-+ for (i = 1; i < tab->size; ++i)
-+ {
-+ e = tab->array[i];
-+ array[i] = e;
-+
-+ if (e->len > 0)
-+ {
-+ e->hash_bucket = _bfd_elf_ver_hash (e->root.string);
-+ e->hash_bucket %= bucket_count;
-+ }
-+ else
-+ e->hash_bucket = 0;
-+ }
-+ qsort (array + 1, tab->size - 1, sizeof (struct elf_strtab_hash_entry *), hash_compare);
-+ tab->array_sorted = array;
-+ }
-+ else
-+ {
-+ free (array);
-+ alloc_failure:
-+ array = tab->array;
-+ }
-
- /* Assign positions to the strings we want to keep. */
- size = 1;
- for (i = 1; i < tab->size; ++i)
- {
-- e = tab->array[i];
-+ e = array[i];
- if (e->refcount && e->len > 0)
- {
- e->u.index = size;
-@@ -382,7 +435,7 @@
- /* Adjust the rest. */
- for (i = 1; i < tab->size; ++i)
- {
-- e = tab->array[i];
-+ e = array[i];
- if (e->refcount && e->len < 0)
- e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len);
- }
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elfxx-target.h binutils.current/bfd/elfxx-target.h
---- binutils-2.16.91.0.4/bfd/elfxx-target.h 2005-08-22 20:27:41.000000000 +0100
-+++ binutils.current/bfd/elfxx-target.h 2005-12-23 14:06:51.000000000 +0000
-@@ -205,7 +205,7 @@
- #endif
-
- #ifndef bfd_elfNN_bfd_link_hash_table_free
--#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-+#define bfd_elfNN_bfd_link_hash_table_free _bfd_elf_link_hash_table_free
- #endif
-
- #ifdef elf_backend_relocate_section
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/include/bfdlink.h binutils.current/include/bfdlink.h
---- binutils-2.16.91.0.4/include/bfdlink.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/include/bfdlink.h 2006-01-18 16:19:19.000000000 +0000
-@@ -327,6 +327,9 @@
- /* TRUE if unreferenced sections should be removed. */
- unsigned int gc_sections: 1;
-
-+ /* TRUE if dynsym/dynstr/relocs should be sorted */
-+ unsigned int dynsort : 1;
-+
- /* What to do with unresolved symbols in an object file.
- When producing executables the default is GENERATE_ERROR.
- When producing shared libraries the default is IGNORE. The
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/eelf_i386.c binutils.current/ld/eelf_i386.c
---- binutils-2.16.91.0.4/ld/eelf_i386.c 2005-12-23 17:21:49.000000000 +0000
-+++ binutils.current/ld/eelf_i386.c 2006-01-18 17:21:10.000000000 +0000
-@@ -3949,6 +3949,10 @@
- link_info.relro = TRUE;
- else if (strcmp (optarg, "norelro") == 0)
- link_info.relro = FALSE;
-+ else if (strcmp (optarg, "dynsort") == 0)
-+ link_info.dynsort = TRUE;
-+ else if (strcmp (optarg, "nodynsort") == 0)
-+ link_info.dynsort = FALSE;
- /* What about the other Solaris -z options? FIXME. */
- break;
- }
-@@ -3966,6 +3970,7 @@
- fprintf (file, _(" --eh-frame-hdr\tCreate .eh_frame_hdr section\n"));
- fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n"));
- fprintf (file, _(" -z defs\t\tReport unresolved symbols in object files.\n"));
-+ fprintf (file, _(" -z dynsort\t\tSort dynamic link sections\n"));
- fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n"));
- fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
- fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n"));
-@@ -3977,6 +3982,7 @@
- fprintf (file, _(" -z nodelete\t\tMark DSO non-deletable at runtime\n"));
- fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n"));
- fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n"));
-+ fprintf (file, _(" -z nodynsort\t\tDon't sort dynamic link sections\n"));
- fprintf (file, _(" -z noexecstack\tMark executable as not requiring executable stack\n"));
- fprintf (file, _(" -z norelro\t\tDon't create RELRO program header\n"));
- fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n"));
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/ldmain.c binutils.current/ld/ldmain.c
---- binutils-2.16.91.0.4/ld/ldmain.c 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/ld/ldmain.c 2006-01-18 16:19:56.000000000 +0000
-@@ -316,6 +316,7 @@
- link_info.need_relax_finalize = FALSE;
- link_info.warn_shared_textrel = FALSE;
- link_info.gc_sections = FALSE;
-+ link_info.dynsort = FALSE;
-
- ldfile_add_arch ("");
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/ld.texinfo binutils.current/ld/ld.texinfo
---- binutils-2.16.91.0.4/ld/ld.texinfo 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/ld/ld.texinfo 2006-01-18 16:29:15.000000000 +0000
-@@ -928,6 +928,9 @@
- Disallows undefined symbols in object files. Undefined symbols in
- shared libraries are still allowed.
-
-+@item dynsort
-+Sorts dynamic link sections, to reduce cache misses during linking.
-+
- @item execstack
- Marks the object as requiring executable stack.
-
-@@ -969,7 +972,10 @@
- @item nodump
- Marks the object can not be dumped by @code{dldump}.
-
-+@item nodynsort
-+Disables dynamic link section sorting.
-+
- @item noexecstack
- Marks the object as not requiring executable stack.
-
-
-
-New module: bfdsort.c:
-
---- binutils-2.16.91.0.4/bfd/Makefile.am 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/bfd/Makefile.am 2006-01-18 15:50:23.000000000 +0000
-@@ -32,7 +32,7 @@
- # need two copies of the executable, one to download and one for the
- # debugger).
- BFD32_LIBS = \
-- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
-+ archive.lo archures.lo bfd.lo bfdio.lo bfdsort.lo bfdwin.lo \
- cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
-@@ -42,7 +42,7 @@
- BFD64_LIBS = archive64.lo
-
- BFD32_LIBS_CFILES = \
-- archive.c archures.c bfd.c bfdio.c bfdwin.c \
-+ archive.c archures.c bfd.c bfdio.c bfdsort.c bfdwin.c \
- cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
-
---- /dev/null 2006-01-18 11:12:51.092369250 +0000
-+++ binutils.current/bfd/bfdsort.c 2006-01-18 15:55:17.000000000 +0000
-@@ -0,0 +1,253 @@
-+/*
-+ * This module copied from glibc/stdlib/qsort.c & adapted,
-+ * in order to add support for a closure argument.
-+ */
-+
-+/* Copyright (C) 1991,1992,1996,1997,1999,2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Douglas C. Schmidt (schmidt@ics.uci.edu).
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* If you consider tuning this algorithm, you should consult first:
-+ Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
-+ Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */
-+
-+#include "bfd.h"
-+#include "sysdep.h"
-+
-+/* Byte-wise swap two items of size SIZE. */
-+#define SWAP(a, b, size) \
-+ do \
-+ { \
-+ register bfd_size_type __size = (size); \
-+ register char *__a = (a), *__b = (b); \
-+ do \
-+ { \
-+ char __tmp = *__a; \
-+ *__a++ = *__b; \
-+ *__b++ = __tmp; \
-+ } while (--__size > 0); \
-+ } while (0)
-+
-+/* Discontinue quicksort algorithm when partition gets below this size.
-+ This particular magic number was chosen to work best on a Sun 4/260. */
-+#define MAX_THRESH 4
-+
-+/* Stack node declarations used to store unfulfilled partition obligations. */
-+typedef struct
-+ {
-+ char *lo;
-+ char *hi;
-+ } stack_node;
-+
-+/* The next 4 #defines implement a very fast in-line stack abstraction. */
-+/* The stack needs log (total_elements) entries (we could even subtract
-+ log(MAX_THRESH)). Since total_elements has type size_t, we get as
-+ upper bound for log (total_elements):
-+ bits per byte (CHAR_BIT) * sizeof(size_t). */
-+#define STACK_SIZE (8 * sizeof(bfd_size_type))
-+#define PUSH(low, high) do { top->lo = (low); top->hi = (high); ++top; } while (0)
-+#define POP(low, high) do { --top; low = top->lo; high = top->hi; } while (0)
-+#define STACK_NOT_EMPTY (stack < top)
-+
-+
-+/* Order size using quicksort. This implementation incorporates
-+ four optimizations discussed in Sedgewick:
-+
-+ 1. Non-recursive, using an explicit stack of pointer that store the
-+ next array partition to sort. To save time, this maximum amount
-+ of space required to store an array of SIZE_MAX is allocated on the
-+ stack. Assuming a 32-bit (64 bit) integer for size_t, this needs
-+ only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
-+ Pretty cheap, actually.
-+
-+ 2. Chose the pivot element using a median-of-three decision tree.
-+ This reduces the probability of selecting a bad pivot value and
-+ eliminates certain extraneous comparisons.
-+
-+ 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
-+ insertion sort to order the MAX_THRESH items within each partition.
-+ This is a big win, since insertion sort is faster for small, mostly
-+ sorted array segments.
-+
-+ 4. The larger of the two sub-partitions is always pushed onto the
-+ stack first, with the algorithm then concentrating on the
-+ smaller partition. This *guarantees* no more than log (total_elems)
-+ stack size is needed (actually O(1) in this case)! */
-+
-+void
-+bfd_qsort (void *pbase, bfd_size_type total_elems, bfd_size_type size,
-+ bfd_qsort_closure_func cmp, void *closure)
-+{
-+ register char *base_ptr = (char *) pbase;
-+
-+ const bfd_size_type max_thresh = MAX_THRESH * size;
-+
-+ if (total_elems == 0)
-+ /* Avoid lossage with unsigned arithmetic below. */
-+ return;
-+
-+ if (total_elems > MAX_THRESH)
-+ {
-+ char *lo = base_ptr;
-+ char *hi = &lo[size * (total_elems - 1)];
-+ stack_node stack[STACK_SIZE];
-+ stack_node *top = stack;
-+
-+ PUSH (NULL, NULL);
-+
-+ while (STACK_NOT_EMPTY)
-+ {
-+ char *left_ptr;
-+ char *right_ptr;
-+
-+ /* Select median value from among LO, MID, and HI. Rearrange
-+ LO and HI so the three values are sorted. This lowers the
-+ probability of picking a pathological pivot value and
-+ skips a comparison for both the LEFT_PTR and RIGHT_PTR in
-+ the while loops. */
-+
-+ char *mid = lo + size * ((hi - lo) / size >> 1);
-+
-+ if ((*cmp) ((void *) mid, (void *) lo, closure) < 0)
-+ SWAP (mid, lo, size);
-+ if ((*cmp) ((void *) hi, (void *) mid, closure) < 0)
-+ SWAP (mid, hi, size);
-+ else
-+ goto jump_over;
-+ if ((*cmp) ((void *) mid, (void *) lo, closure) < 0)
-+ SWAP (mid, lo, size);
-+ jump_over:;
-+
-+ left_ptr = lo + size;
-+ right_ptr = hi - size;
-+
-+ /* Here's the famous ``collapse the walls'' section of quicksort.
-+ Gotta like those tight inner loops! They are the main reason
-+ that this algorithm runs much faster than others. */
-+ do
-+ {
-+ while ((*cmp) ((void *) left_ptr, (void *) mid, closure) < 0)
-+ left_ptr += size;
-+
-+ while ((*cmp) ((void *) mid, (void *) right_ptr, closure) < 0)
-+ right_ptr -= size;
-+
-+ if (left_ptr < right_ptr)
-+ {
-+ SWAP (left_ptr, right_ptr, size);
-+ if (mid == left_ptr)
-+ mid = right_ptr;
-+ else if (mid == right_ptr)
-+ mid = left_ptr;
-+ left_ptr += size;
-+ right_ptr -= size;
-+ }
-+ else if (left_ptr == right_ptr)
-+ {
-+ left_ptr += size;
-+ right_ptr -= size;
-+ break;
-+ }
-+ }
-+ while (left_ptr <= right_ptr);
-+
-+ /* Set up pointers for next iteration. First determine whether
-+ left and right partitions are below the threshold size. If so,
-+ ignore one or both. Otherwise, push the larger partition's
-+ bounds on the stack and continue sorting the smaller one. */
-+
-+ if ((bfd_size_type) (right_ptr - lo) <= max_thresh)
-+ {
-+ if ((bfd_size_type) (hi - left_ptr) <= max_thresh)
-+ /* Ignore both small partitions. */
-+ POP (lo, hi);
-+ else
-+ /* Ignore small left partition. */
-+ lo = left_ptr;
-+ }
-+ else if ((bfd_size_type) (hi - left_ptr) <= max_thresh)
-+ /* Ignore small right partition. */
-+ hi = right_ptr;
-+ else if ((right_ptr - lo) > (hi - left_ptr))
-+ {
-+ /* Push larger left partition indices. */
-+ PUSH (lo, right_ptr);
-+ lo = left_ptr;
-+ }
-+ else
-+ {
-+ /* Push larger right partition indices. */
-+ PUSH (left_ptr, hi);
-+ hi = right_ptr;
-+ }
-+ }
-+ }
-+
-+ /* Once the BASE_PTR array is partially sorted by quicksort the rest
-+ is completely sorted using insertion sort, since this is efficient
-+ for partitions below MAX_THRESH size. BASE_PTR points to the beginning
-+ of the array to sort, and END_PTR points at the very last element in
-+ the array (*not* one beyond it!). */
-+
-+#define min(x, y) ((x) < (y) ? (x) : (y))
-+
-+ {
-+ char *const end_ptr = &base_ptr[size * (total_elems - 1)];
-+ char *tmp_ptr = base_ptr;
-+ char *thresh = min(end_ptr, base_ptr + max_thresh);
-+ register char *run_ptr;
-+
-+ /* Find smallest element in first threshold and place it at the
-+ array's beginning. This is the smallest array element,
-+ and the operation speeds up insertion sort's inner loop. */
-+
-+ for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
-+ if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, closure) < 0)
-+ tmp_ptr = run_ptr;
-+
-+ if (tmp_ptr != base_ptr)
-+ SWAP (tmp_ptr, base_ptr, size);
-+
-+ /* Insertion sort, running from left-hand-side up to right-hand-side. */
-+
-+ run_ptr = base_ptr + size;
-+ while ((run_ptr += size) <= end_ptr)
-+ {
-+ tmp_ptr = run_ptr - size;
-+ while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, closure) < 0)
-+ tmp_ptr -= size;
-+
-+ tmp_ptr += size;
-+ if (tmp_ptr != run_ptr)
-+ {
-+ char *trav;
-+
-+ trav = run_ptr + size;
-+ while (--trav >= run_ptr)
-+ {
-+ char c = *trav;
-+ char *hi, *lo;
-+
-+ for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
-+ *hi = *lo;
-+ *hi = c;
-+ }
-+ }
-+ }
-+ }
-+}
diff --git a/patches/test/binutils-noundef.diff b/patches/test/binutils-noundef.diff
deleted file mode 100644
index 6524263f5..000000000
--- a/patches/test/binutils-noundef.diff
+++ /dev/null
@@ -1,25 +0,0 @@
---- ./binutils-2.16.91.0.4/bfd/elflink.c 2005-12-22 10:42:52.000000000 +0000
-+++ ./binutils.current/bfd/elflink.c 2006-01-18 16:36:45.000000000 +0000
-@@ -6602,6 +6779,14 @@
- esym = finfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym;
- bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
-
-+ if (sym.st_shndx == SHN_UNDEF && getenv ("SAVE_SLOTS"))
-+ {
-+ static int saved_count = 0;
-+ if (!(saved_count++ % 10))
-+ fprintf (stderr, "Saved %d slots\n", saved_count);
-+ }
-+ else
-+ {
- bucketcount = elf_hash_table (finfo->info)->bucketcount;
- bucket = h->u.elf_hash_value % bucketcount;
- hash_entry_size
-@@ -6613,6 +6798,7 @@
- bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
- ((bfd_byte *) finfo->hash_sec->contents
- + (bucketcount + 2 + h->dynindx) * hash_entry_size));
-+ }
-
- if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
- {
diff --git a/patches/test/binutils-objprel.diff b/patches/test/binutils-objprel.diff
deleted file mode 100644
index b715bf272..000000000
--- a/patches/test/binutils-objprel.diff
+++ /dev/null
@@ -1,190 +0,0 @@
---- binutils-2.16/bfd/elf32-i386.c 2005-02-06 18:11:29.000000000 +0000
-+++ binutils.current/bfd/elf32-i386.c 2005-08-17 11:33:49.000000000 +0100
-@@ -24,6 +24,9 @@
- #include "libbfd.h"
- #include "elf-bfd.h"
-
-+/* define for old behavior */
-+#undef SANE_PLT
-+
- /* 386 uses REL relocations instead of RELA. */
- #define USE_REL 1
-
-@@ -495,6 +498,36 @@
- 0, 0, 0, 0 /* replaced with offset to start of .plt. */
- };
-
-+
-+#ifndef SANE_PLT
-+/*
-+ PLT0: pushl GOT+4
-+ jmp *GOT+8
-+ ....
-+ PLTi: jmp *GOT+offset_of_got_entry
-+ pushl $relocation_record_for_got_entry
-+ jmp PLT0
-+*/
-+
-+static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] =
-+{
-+ 0x68, 0, 0, 0, 0, /* pushl $junk */
-+ 0x68, 0, 0, 0, 0, /* pushl $junk */
-+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 /* pad out to 16 bytes. */
-+};
-+
-+/* Subsequent entries in a PIC procedure linkage table look like this. */
-+
-+static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] =
-+{
-+ 0xe9, 0xfc, 0xff, 0xff, 0xff, /* jmp xxx@PC */
-+ 0x68, 0, 0, 0, 0, /* push $junk */
-+ 0xe9, /* jmp relative */
-+ 0, 0, 0, 0 /* replaced with offset to start of .plt. */
-+};
-+
-+#else /* SANE_PLT */
-+
- /* The first entry in a PIC procedure linkage table look like this. */
-
- static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] =
-@@ -515,6 +548,7 @@
- 0xe9, /* jmp relative */
- 0, 0, 0, 0 /* replaced with offset to start of .plt. */
- };
-+#endif
-
- /* The i386 linker needs to keep track of the number of relocs that it
- decides to copy as dynamic relocs in check_relocs for each symbol.
-@@ -552,7 +586,7 @@
- #define GOT_TLS_IE_POS 5
- #define GOT_TLS_IE_NEG 6
- #define GOT_TLS_IE_BOTH 7
-- unsigned char tls_type;
-+ unsigned char tls_type : 7;
- };
-
- #define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent))
-@@ -1524,6 +1558,10 @@
- will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
-
-+#ifndef SANE_PLT
-+ htab->srelgot->size += 2 * sizeof (Elf32_External_Rel);
-+#endif
-+
- /* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rel);
- }
-@@ -2324,6 +2362,9 @@
- break;
- }
-
-+ /* FIXME: foo - this is where we go wrong ! - we need to
-+ emit a R_386_RELATIVE reloc - for this point ... PLUS
-+ an absolute ref [as currently] to the plt ... */
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
-@@ -3034,21 +3075,46 @@
- {
- memcpy (htab->splt->contents + h->plt.offset, elf_i386_pic_plt_entry,
- PLT_ENTRY_SIZE);
-+#ifndef SANE_PLT
-+ /* Abs address of the plt slot */
-+ bfd_put_32 (output_bfd,
-+ (htab->sgotplt->output_section->vma
-+ + htab->sgotplt->output_offset
-+ + got_offset),
-+ htab->splt->contents + h->plt.offset + 1);
-+#else
- bfd_put_32 (output_bfd, got_offset,
- htab->splt->contents + h->plt.offset + 2);
-+#endif
- }
-
- bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rel),
-- htab->splt->contents + h->plt.offset + 7);
-+ htab->splt->contents + h->plt.offset
-+#ifndef SANE_PLT
-+ + 6
-+#else
-+ + 7
-+#endif
-+ );
- bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE),
-- htab->splt->contents + h->plt.offset + 12);
--
-+ htab->splt->contents + h->plt.offset
-+#ifndef SANE_PLT
-+ + 11
-+#else
-+ + 12
-+#endif
-+ );
- /* Fill in the entry in the global offset table. */
- bfd_put_32 (output_bfd,
- (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset
-- + 6),
-+#ifndef SANE_PLT
-+ + 6
-+#else
-+ + 5
-+#endif
-+ ),
- htab->sgotplt->contents + got_offset);
-
- /* Fill in the entry in the .rel.plt section. */
-@@ -3059,6 +3125,28 @@
- loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel);
- bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
-
-+#ifndef SANE_PLT
-+{ // whack it randomly in srelgot
-+ asection *s;
-+ bfd_byte *loc;
-+
-+ s = htab->srelgot;
-+ if (s == NULL)
-+ abort ();
-+
-+ rel.r_offset = (htab->splt->output_section->vma
-+ + htab->splt->output_offset
-+ + h->plt.offset + 1);
-+ rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
-+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel);
-+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
-+
-+ rel.r_offset += 5;
-+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel);
-+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
-+}
-+#endif
-+
- if (!h->def_regular)
- {
- /* Mark the symbol as undefined, rather than as defined in
-@@ -3248,8 +3336,22 @@
- if (htab->splt && htab->splt->size > 0)
- {
- if (info->shared)
-+ {
- memcpy (htab->splt->contents,
- elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
-+#ifndef SANE_PLT
-+ bfd_put_32 (output_bfd,
-+ (htab->sgotplt->output_section->vma
-+ + htab->sgotplt->output_offset
-+ + 4),
-+ htab->splt->contents + 1);
-+ bfd_put_32 (output_bfd,
-+ (htab->sgotplt->output_section->vma
-+ + htab->sgotplt->output_offset
-+ + 8),
-+ htab->splt->contents + 6);
-+#endif
-+ }
- else
- {
- memcpy (htab->splt->contents,
diff --git a/patches/test/binutils-pltabs.diff b/patches/test/binutils-pltabs.diff
deleted file mode 100644
index bc44242d9..000000000
--- a/patches/test/binutils-pltabs.diff
+++ /dev/null
@@ -1,177 +0,0 @@
-diff -x '*.info*' -u -r binutils-2.16/bfd/bfd-in2.h binutils-2.16.current/bfd/bfd-in2.h
---- binutils-2.16/bfd/bfd-in2.h 2005-03-02 21:23:20.000000000 +0000
-+++ binutils-2.16.current/bfd/bfd-in2.h 2005-07-18 17:00:00.000000000 +0100
-@@ -2476,6 +2476,7 @@
- /* i386/elf relocations */
- BFD_RELOC_386_GOT32,
- BFD_RELOC_386_PLT32,
-+ BFD_RELOC_386_PLT32ABS,
- BFD_RELOC_386_COPY,
- BFD_RELOC_386_GLOB_DAT,
- BFD_RELOC_386_JUMP_SLOT,
-
-diff -x '*.info*' -u -r binutils-2.16/bfd/elf32-i386.c binutils-2.16.current/bfd/elf32-i386.c
---- binutils-2.16/bfd/elf32-i386.c 2005-02-06 18:11:29.000000000 +0000
-+++ binutils-2.16.current/bfd/elf32-i386.c 2005-07-18 20:27:47.855822520 +0100
-@@ -158,9 +158,13 @@
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
-- FALSE) /* pcrel_offset */
-+ FALSE), /* pcrel_offset */
-
--#define R_386_vt (R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
-+ HOWTO(R_386_PLT32ABS, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
-+ bfd_elf_generic_reloc, "R_386_PLT32ABS",
-+ TRUE, 0xffffffff, 0xffffffff, FALSE)
-+
-+#define R_386_vt (R_386_GNU_VTENTRY + 2 - R_386_vt_offset)
-
- };
-
-@@ -299,6 +303,10 @@
- TRACE ("BFD_RELOC_VTABLE_ENTRY");
- return &elf_howto_table[R_386_GNU_VTENTRY - R_386_vt_offset];
-
-+ case BFD_RELOC_386_PLT32ABS:
-+ TRACE ("BFD_RELOC_386_PLT32ABS");
-+ return &elf_howto_table[R_386_PLT32ABS - R_386_vt_offset];
-+
- default:
- break;
- }
-@@ -882,6 +890,7 @@
- goto create_got;
-
- case R_386_PLT32:
-+ case R_386_PLT32ABS:
- /* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
-@@ -1295,6 +1304,7 @@
- /* Fall through */
-
- case R_386_PLT32:
-+ case R_386_PLT32ABS:
- if (h != NULL)
- {
- if (h->plt.refcount > 0)
-@@ -2037,7 +2047,10 @@
- && ((indx = r_type - R_386_ext_offset) - R_386_standard
- >= R_386_ext - R_386_standard)
- && ((indx = r_type - R_386_tls_offset) - R_386_ext
-- >= R_386_tls - R_386_ext))
-+ >= R_386_tls - R_386_ext)
-+ && (indx = r_type - R_386_vt_offset) - R_386_tls
-+ >= R_386_vt - R_386_tls
-+ )
- {
- (*_bfd_error_handler)
- (_("%B: unrecognized relocation (0x%x) in section `%A'"),
-@@ -2307,6 +2320,7 @@
- break;
-
- case R_386_PLT32:
-+ case R_386_PLT32ABS:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
-
-@@ -2481,7 +2495,8 @@
- contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
-- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
-+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32 ||
-+ ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32ABS);
- roff = rel->r_offset + 5;
- val = bfd_get_8 (input_bfd,
- contents + rel->r_offset - 1);
-@@ -2755,7 +2770,8 @@
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
-- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
-+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32 ||
-+ ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32ABS);
- roff = rel->r_offset - 3;
- val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- if (type == 0x04)
-@@ -2827,7 +2843,8 @@
- BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
- == 0xe8);
- BFD_ASSERT (rel + 1 < relend);
-- BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
-+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32 ||
-+ ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32ABS);
- memcpy (contents + rel->r_offset - 2,
- "\x65\xa1\0\0\0\0\x90\x8d\x74\x26", 11);
- /* Skip R_386_PLT32. */
-diff -x '*.info*' -u -r binutils-2.16/bfd/libbfd.h binutils-2.16.current/bfd/libbfd.h
---- binutils-2.16/bfd/libbfd.h 2005-03-02 21:23:21.000000000 +0000
-+++ binutils-2.16.current/bfd/libbfd.h 2005-07-18 17:00:00.000000000 +0100
-@@ -993,6 +993,7 @@
-
- "BFD_RELOC_386_GOT32",
- "BFD_RELOC_386_PLT32",
-+ "BFD_RELOC_386_PLT32ABS",
- "BFD_RELOC_386_COPY",
- "BFD_RELOC_386_GLOB_DAT",
- "BFD_RELOC_386_JUMP_SLOT",
-diff -x '*.info*' -u -r binutils-2.16/bfd/reloc.c binutils-2.16.current/bfd/reloc.c
---- binutils-2.16/bfd/reloc.c 2005-03-02 21:23:21.000000000 +0000
-+++ binutils-2.16.current/bfd/reloc.c 2005-07-18 17:00:00.000000000 +0100
-@@ -2279,6 +2279,8 @@
- ENUMX
- BFD_RELOC_386_PLT32
- ENUMX
-+ BFD_RELOC_386_PLT32ABS
-+ENUMX
- BFD_RELOC_386_COPY
- ENUMX
- BFD_RELOC_386_GLOB_DAT
-diff -x '*.info*' -u -r binutils-2.16/gas/config/tc-i386.c binutils-2.16.current/gas/config/tc-i386.c
---- binutils-2.16/gas/config/tc-i386.c 2005-04-13 18:58:42.000000000 +0100
-+++ binutils-2.16.current/gas/config/tc-i386.c 2005-07-18 20:13:12.320924056 +0100
-@@ -1276,6 +1276,7 @@
- /* adjust_reloc_syms doesn't know about the GOT. */
- if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF
- || fixP->fx_r_type == BFD_RELOC_386_PLT32
-+ || fixP->fx_r_type == BFD_RELOC_386_PLT32ABS
- || fixP->fx_r_type == BFD_RELOC_386_GOT32
- || fixP->fx_r_type == BFD_RELOC_386_TLS_GD
- || fixP->fx_r_type == BFD_RELOC_386_TLS_LDM
-@@ -3682,6 +3683,7 @@
- const char *str;
- const enum bfd_reloc_code_real rel[NUM_FLAG_CODE];
- } gotrel[] = {
-+ { "PLTABS", { BFD_RELOC_386_PLT32ABS, 0, BFD_RELOC_X86_64_PLT32 } },
- { "PLT", { BFD_RELOC_386_PLT32, 0, BFD_RELOC_X86_64_PLT32 } },
- { "GOTOFF", { BFD_RELOC_386_GOTOFF, 0, 0 } },
- { "GOTPCREL", { 0, 0, BFD_RELOC_X86_64_GOTPCREL } },
-@@ -4860,6 +4862,7 @@
- switch (fixP->fx_r_type)
- {
- case BFD_RELOC_386_PLT32:
-+ case BFD_RELOC_386_PLT32ABS:
- case BFD_RELOC_X86_64_PLT32:
- /* Make the jump instruction point to the address of the operand. At
- runtime we merely add the offset to the actual PLT entry. */
-@@ -5345,6 +5348,7 @@
- case BFD_RELOC_X86_64_GOT32:
- case BFD_RELOC_X86_64_GOTPCREL:
- case BFD_RELOC_386_PLT32:
-+ case BFD_RELOC_386_PLT32ABS:
- case BFD_RELOC_386_GOT32:
- case BFD_RELOC_386_GOTOFF:
- case BFD_RELOC_386_GOTPC:
-diff -x '*.info*' -u -r binutils-2.16/include/elf/i386.h binutils-2.16.current/include/elf/i386.h
---- binutils-2.16/include/elf/i386.h 2005-03-03 11:58:06.000000000 +0000
-+++ binutils-2.16.current/include/elf/i386.h 2005-07-18 17:28:10.000000000 +0100
-@@ -68,6 +68,7 @@
- /* These are GNU extensions to enable C++ vtable garbage collection. */
- RELOC_NUMBER (R_386_GNU_VTINHERIT, 250)
- RELOC_NUMBER (R_386_GNU_VTENTRY, 251)
-+ RELOC_NUMBER (R_386_PLT32ABS, 252)
- END_RELOC_NUMBERS (R_386_max)
-
- #endif
diff --git a/patches/test/binutils-suse-bdirect.diff b/patches/test/binutils-suse-bdirect.diff
deleted file mode 100644
index 6ba356638..000000000
--- a/patches/test/binutils-suse-bdirect.diff
+++ /dev/null
@@ -1,579 +0,0 @@
-This patch omits the DT_SUSE_DIRECT define and hence depends
-on binutils-suse-hashvals.diff - it should be applied in conjunction
-with that patch.
-
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elf-bfd.h binutils.current/bfd/elf-bfd.h
---- binutils-2.16/bfd/elf-bfd.h 2005-03-03 20:52:31.000000000 +0000
-+++ binutils.current/bfd/elf-bfd.h 2005-11-23 11:04:04.000000000 +0000
-@@ -170,6 +170,14 @@
- matters. */
- unsigned int pointer_equality_needed : 1;
-
-+ /* FIXME: these 2 bits consume another 4 bytes. */
-+ /* Symbol is concrete, ie. non-vague if we can detect that, from the
-+ .direct section. */
-+ unsigned int concrete_ref : 1;
-+ /* Symbol is certainly vague (if we can detect that), from the
-+ .direct section. */
-+ unsigned int vague_ref : 1;
-+
- /* String table index in .dynstr if this is a dynamic symbol. */
- unsigned long dynstr_index;
-
-@@ -396,6 +404,9 @@
- asection *tls_sec;
- bfd_size_type tls_size;
-
-+ /* Direct linkage output section. */
-+ asection *direct_sec;
-+
- /* A linked list of BFD's loaded in the link. */
- struct elf_link_loaded_list *loaded;
-
-@@ -1238,6 +1249,7 @@
- name actually used, which will be the DT_SONAME entry if there is
- one. */
- const char *dt_name;
-+ int dt_needed_idx;
-
- /* Records the result of `get_program_header_size'. */
- bfd_size_type program_header_size;
-@@ -1338,6 +1350,7 @@
- #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
- #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
- #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
-+#define elf_dt_needed_idx(bfd) (elf_tdata(bfd) -> dt_needed_idx)
- #define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
- #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
- #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
-Only in binutils.current/bfd: elf-bfd.h~
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elf.c binutils.current/bfd/elf.c
---- binutils-2.16/bfd/elf.c 2005-03-06 02:02:15.000000000 +0000
-+++ binutils.current/bfd/elf.c 2005-11-18 17:08:51.000000000 +0000
-@@ -1145,6 +1145,7 @@
- case DT_RELCOUNT: name = "RELCOUNT"; break;
- case DT_FLAGS_1: name = "FLAGS_1"; break;
- case DT_VERSYM: name = "VERSYM"; break;
-+ case DT_SUSE_DIRECT: name = "SUSE_DIRECT"; break;
- case DT_VERDEF: name = "VERDEF"; break;
- case DT_VERDEFNUM: name = "VERDEFNUM"; break;
- case DT_VERNEED: name = "VERNEED"; break;
-@@ -1495,6 +1496,7 @@
- table->runpath = NULL;
- table->tls_sec = NULL;
- table->tls_size = 0;
-+ table->direct_sec = NULL;
- table->loaded = NULL;
- table->is_relocatable_executable = FALSE;
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/bfd/elflink.c binutils.current/bfd/elflink.c
---- binutils-2.16/bfd/elflink.c 2005-04-29 14:40:22.000000000 +0100
-+++ binutils.current/bfd/elflink.c 2005-11-30 15:07:38.000000000 +0000
-@@ -172,6 +172,16 @@
- elf_hash_table (info)->eh_info.hdr_sec = s;
- }
-
-+ if ( info->direct && !info->executable )
-+ {
-+ s = bfd_make_section (abfd, ".suse.direct");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+ elf_hash_table (info)->direct_sec = s;
-+ }
-+
- /* Create sections to hold version informations. These are removed
- if they are not needed. */
- s = bfd_make_section (abfd, ".gnu.version_d");
-@@ -2848,6 +2860,7 @@
-
- if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
- return -1;
-+ elf_dt_needed_idx (abfd) = ++(info->dt_needed_index);
- }
- else
- /* We were just checking for existence of the tag. */
-@@ -3143,6 +3158,8 @@
- bfd_boolean add_needed;
- struct elf_link_hash_table * hash_table;
- bfd_size_type amt;
-+ asection *direct_sec;
-+ unsigned char *direct_data;
-
- hash_table = elf_hash_table (info);
-
-@@ -3150,6 +3167,9 @@
- add_symbol_hook = bed->elf_add_symbol_hook;
- collect = bed->collect;
-
-+ direct_sec = NULL;
-+ direct_data = NULL;
-+
- if ((abfd->flags & DYNAMIC) == 0)
- dynamic = FALSE;
- else
-@@ -3169,6 +3189,16 @@
- bfd_set_error (bfd_error_wrong_format);
- goto error_return;
- }
-+ if (info->direct)
-+ direct_sec = bfd_get_section_by_name (abfd, ".suse.direct");
-+ if (direct_sec != NULL)
-+ {
-+ direct_data = bfd_alloc (abfd, direct_sec->size);
-+ if (direct_data == NULL
-+ || ! bfd_get_section_contents (abfd, direct_sec,
-+ direct_data, 0, direct_sec->size))
-+ goto error_return;
-+ }
- }
-
- /* As a GNU extension, any input sections which are named
-@@ -3817,6 +3845,22 @@
- && vernum > 1
- && definition)
- h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
-+
-+ if (direct_sec != NULL)
-+ {
-+ unsigned long d_idx = isym - isymbuf;
-+ unsigned long direct_entry;
-+ d_idx += extsymoff;
-+ d_idx *= 2;
-+ BFD_ASSERT (d_idx <= bfd_get_section_size (direct_sec));
-+ direct_entry = bfd_get_16 (abfd, direct_data + d_idx);
-+ if ((direct_entry & DT_SUSE_DIRECT_VAGUE) != 0)
-+ h->vague_ref = 1;
-+ if (!h->vague_ref
-+ && (direct_entry & DT_SUSE_DIRECT_MASK) !=
-+ DT_SUSE_DIRECT_UNKNOWN)
-+ h->concrete_ref = 1;
-+ }
- }
-
- if (! (_bfd_generic_link_add_one_symbol
-@@ -4450,6 +4511,8 @@
- if (isymbuf != NULL)
- free (isymbuf);
- error_return:
-+ if (direct_data != NULL)
-+ free (direct_data);
- return FALSE;
- }
-
-@@ -5671,6 +5734,24 @@
- return FALSE;
- }
-
-+ /* Create the direct bindings section - 1 entry per dynsym. */
-+ s = bfd_get_section_by_name (dynobj, ".suse.direct");
-+ if (s != NULL)
-+ {
-+ if (dynsymcount == 0)
-+ s->flags |= SEC_EXCLUDE;
-+ else
-+ {
-+ s->size = dynsymcount * sizeof (Elf_External_Direct);
-+ s->contents = bfd_zalloc (output_bfd, s->size);
-+ if (s->contents == NULL)
-+ return FALSE;
-+ memset (s->contents, 0xff, s->size);
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_DIRECT, 0))
-+ return FALSE;
-+ }
-+ }
-+
- /* Set the size of the .dynsym and .hash sections. We counted
- the number of dynamic symbols in elf_link_add_object_symbols.
- We will build the contents of .dynsym and .hash when we build
-@@ -5749,6 +5830,8 @@
- asection *hash_sec;
- /* symbol version section (.gnu.version). */
- asection *symver_sec;
-+ /* .direct linkage section. */
-+ asection *direct_sec;
- /* Buffer large enough to hold contents of any section. */
- bfd_byte *contents;
- /* Buffer large enough to hold external relocs of any section. */
-@@ -6603,6 +6704,46 @@
- eversym += h->dynindx;
- _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
- }
-+
-+ if (finfo->direct_sec != NULL)
-+ {
-+ int dt_index = DT_SUSE_DIRECT_UNKNOWN;
-+ bfd_vma offset = 2 * h->dynindx;
-+ BFD_ASSERT (offset <= finfo->direct_sec->size);
-+
-+ if ((h->root.type == bfd_link_hash_defined
-+ || h->root.type == bfd_link_hash_defweak)
-+ && h->root.u.def.section != NULL
-+ && h->root.u.def.section->owner != NULL)
-+ {
-+ asection *sec = h->root.u.def.section;
-+
-+ dt_index = elf_dt_needed_idx (sec->owner);
-+
-+ if ((sec->owner->flags & DYNAMIC) == 0)
-+ {
-+ if (sec->name == NULL
-+ || strncmp (sec->name, ".gnu.linkonce",
-+ sizeof ".gnu.linkonce" - 1) == 0)
-+ dt_index |= DT_SUSE_DIRECT_VAGUE;
-+
-+ /* app -> library data references get turned into copy
-+ relocs, so objects can migrate unpredictably into the
-+ application itself. */
-+ else if (h->type == STT_OBJECT)
-+ dt_index |= DT_SUSE_DIRECT_VAGUE;
-+ }
-+ else if (h->vague_ref)
-+ dt_index |= DT_SUSE_DIRECT_VAGUE;
-+
-+ else if (!h->concrete_ref)
-+ dt_index = DT_SUSE_DIRECT_UNKNOWN;
-+
-+ }
-+ bfd_put_16 (finfo->output_bfd,
-+ dt_index,
-+ finfo->direct_sec->contents + offset);
-+ }
- }
-
- /* If we're stripping it, then it was just a dynamic symbol, and
-@@ -7732,6 +7891,7 @@
-
- if (! dynamic)
- {
-+ finfo.direct_sec = NULL;
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-@@ -7740,6 +7900,7 @@
- }
- else
- {
-+ finfo.direct_sec = bfd_get_section_by_name (dynobj, ".suse.direct");
- finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
-@@ -8492,6 +8653,9 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_SUSE_DIRECT:
-+ name = ".suse.direct";
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/binutils/readelf.c binutils.current/binutils/readelf.c
---- binutils-2.16/binutils/readelf.c 2005-04-20 19:43:36.000000000 +0100
-+++ binutils.current/binutils/readelf.c 2005-11-23 11:10:06.000000000 +0000
-@@ -143,6 +143,7 @@
- static int do_dynamic;
- static int do_syms;
- static int do_reloc;
-+static int do_direct;
- static int do_sections;
- static int do_section_groups;
- static int do_section_details;
-@@ -1519,6 +1520,7 @@
- case DT_SYMINFO: return "SYMINFO"; /* aka ADDRRNGHI */
-
- case DT_VERSYM: return "VERSYM";
-+ case DT_SUSE_DIRECT: return "SUSE_DIRECT";
-
- case DT_RELACOUNT: return "RELACOUNT";
- case DT_RELCOUNT: return "RELCOUNT";
-@@ -2590,6 +2592,7 @@
- {"symbols", no_argument, 0, 's'},
- {"syms", no_argument, 0, 's'},
- {"relocs", no_argument, 0, 'r'},
-+ {"direct", no_argument, 0, 'y'},
- {"notes", no_argument, 0, 'n'},
- {"dynamic", no_argument, 0, 'd'},
- {"arch-specific", no_argument, 0, 'A'},
-@@ -2626,6 +2629,7 @@
- --symbols An alias for --syms\n\
- -n --notes Display the core notes (if present)\n\
- -r --relocs Display the relocations (if present)\n\
-+ -y --direct Display direct linkage table (if present)\n\
- -u --unwind Display the unwind info (if present)\n\
- -d --dynamic Display the dynamic section (if present)\n\
- -V --version-info Display the version sections (if present)\n\
-@@ -2693,7 +2697,7 @@
- usage ();
-
- while ((c = getopt_long
-- (argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
-+ (argc, argv, "erysuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
- {
- char *cp;
- int section;
-@@ -2710,6 +2714,7 @@
- case 'a':
- do_syms++;
- do_reloc++;
-+ do_direct++;
- do_unwind++;
- do_dynamic++;
- do_header++;
-@@ -2738,6 +2743,9 @@
- case 'r':
- do_reloc++;
- break;
-+ case 'y':
-+ do_direct++;
-+ break;
- case 'u':
- do_unwind++;
- break;
-@@ -2943,6 +2951,6 @@
- && !do_segments && !do_header && !do_dump && !do_version
- && !do_histogram && !do_debugging && !do_arch && !do_notes
-- && !do_section_groups)
-+ && !do_section_groups && !do_direct)
- usage ();
- else if (argc < 3)
- {
-@@ -4328,6 +4336,132 @@
- return 1;
- }
-
-+static void
-+print_dt_needed_name (int idx)
-+{
-+ const char *name = NULL;
-+ Elf_Internal_Dyn *entry;
-+
-+ idx &= DT_SUSE_DIRECT_MASK;
-+
-+ switch (idx)
-+ {
-+ case 0:
-+ name = _("<self>");
-+ break;
-+ case DT_SUSE_DIRECT_UNKNOWN:
-+ name = _("<unknown>");
-+ break;
-+ default:
-+ idx--;
-+
-+ for (entry = dynamic_section;
-+ entry < dynamic_section + dynamic_nent && idx > 0;
-+ entry++)
-+ if (entry->d_tag == DT_NEEDED)
-+ idx--;
-+
-+ if (idx == 0)
-+ {
-+ if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
-+ name = GET_DYNAMIC_NAME (entry->d_un.d_val);
-+ else
-+ name = NULL;
-+ }
-+ break;
-+ }
-+
-+ if (!name)
-+ name = _("<out-of-range>");
-+ if (do_wide)
-+ printf ("%s", name);
-+ else
-+ printf ("%-25s", name);
-+}
-+
-+static int
-+process_direct (FILE *file)
-+{
-+ unsigned int i;
-+ unsigned int si;
-+ char *strtab;
-+ unsigned char *directtab;
-+ Elf_Internal_Sym *symtab = NULL;
-+ Elf_Internal_Sym *psym;
-+ Elf_Internal_Shdr *direct = NULL;
-+ Elf_Internal_Shdr *dynsym = NULL;
-+ Elf_Internal_Shdr *section;
-+
-+ if (!do_direct)
-+ return 1;
-+ if (!dynamic_symbols || !dynamic_section || !dynamic_strings)
-+ return 1;
-+
-+ for (i = 0, section = section_headers;
-+ i < elf_header.e_shnum;
-+ i++, section++)
-+ {
-+ if (section->sh_type == SHT_DYNSYM)
-+ dynsym = section;
-+ if (!strcmp (SECTION_NAME (section), ".suse.direct"))
-+ direct = section;
-+ }
-+ if (!dynsym || !direct)
-+ return 1;
-+
-+ symtab = GET_ELF_SYMBOLS (file, dynsym);
-+ if (!symtab)
-+ return 1;
-+
-+ directtab = get_data (NULL, file, direct->sh_offset,
-+ direct->sh_size, 1, _("direct linkage table"));
-+ if (!symtab)
-+ {
-+ free (symtab);
-+ return 1;
-+ }
-+
-+ if (dynsym->sh_link == elf_header.e_shstrndx)
-+ strtab = string_table;
-+ else
-+ {
-+ Elf_Internal_Shdr *string_sec;
-+
-+ string_sec = SECTION_HEADER (dynsym->sh_link);
-+
-+ strtab = get_data (NULL, file, string_sec->sh_offset,
-+ string_sec->sh_size, 1, _("string table"));
-+ }
-+
-+ assert (strtab != NULL);
-+
-+ printf (_("\nDirect relocations for image:\n"));
-+ printf (_(" Num: Index Vague Binding Symbol\n"));
-+ for (si = 0, psym = symtab;
-+ si < dynsym->sh_size / dynsym->sh_entsize;
-+ si++, psym++)
-+ {
-+ unsigned int field;
-+ printf ("%6d: ", si);
-+ field = byte_get (directtab + (si * 2), 2);
-+ printf ("[0x%.4x] ", field);
-+ printf ("%s", (field & DT_SUSE_DIRECT_VAGUE) ? "Vague" : " ");
-+ printf (" ");
-+ print_dt_needed_name (field);
-+ printf (" ");
-+ print_symbol (25, strtab + psym->st_name);
-+ printf ("\n");
-+ }
-+
-+
-+ free (symtab);
-+ if (strtab != string_table)
-+ free (strtab);
-+
-+ return 1;
-+}
-+
-+
- /* Process the unwind section. */
-
- #include "unwind-ia64.h"
-@@ -11784,6 +11918,8 @@
-
- process_relocs (file);
-
-+ process_direct (file);
-+
- process_unwind (file);
-
- process_symbol_table (file);
-Only in binutils.current/binutils: readelf.c~
-Files binutils-2.16/binutils/size and binutils.current/binutils/size differ
-Files binutils-2.16/binutils/strings and binutils.current/binutils/strings differ
-Files binutils-2.16/binutils/strip-new and binutils.current/binutils/strip-new differ
-Files binutils-2.16/gas/as-new and binutils.current/gas/as-new differ
-Files binutils-2.16/gprof/gprof and binutils.current/gprof/gprof differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/bfdlink.h binutils.current/include/bfdlink.h
---- binutils-2.16/include/bfdlink.h 2005-03-03 11:58:00.000000000 +0000
-+++ binutils.current/include/bfdlink.h 2005-11-23 10:31:37.000000000 +0000
-@@ -244,6 +244,9 @@
- /* TRUE if BFD should pre-bind symbols in a shared object. */
- unsigned int symbolic: 1;
-
-+ /* TRUE if BFD should bind symbols directly to resolved at link time. */
-+ unsigned int direct: 1;
-+
- /* TRUE if BFD should export all symbols in the dynamic symbol table
- of an executable, rather than only those used. */
- unsigned int export_dynamic: 1;
-@@ -416,6 +419,9 @@
-
- /* Start and end of RELRO region. */
- bfd_vma relro_start, relro_end;
-+
-+ /* current max dtinfo section number. */
-+ int dt_needed_index;
- };
-
- /* This structures holds a set of callback functions. These are
-
-
-
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/elf/common.h binutils.current/include/elf/common.h
---- binutils-2.16/include/elf/common.h 2004-10-08 14:55:08.000000000 +0100
-+++ binutils.current/include/elf/common.h 2005-11-22 14:12:53.000000000 +0000
-@@ -635,6 +636,11 @@
- #define DF_BIND_NOW (1 << 3)
- #define DF_STATIC_TLS (1 << 4)
-
-+/* Constants for the DT_DIRECT entries. */
-+#define DT_SUSE_DIRECT_VAGUE (1<<15)
-+#define DT_SUSE_DIRECT_MASK 0xfff
-+#define DT_SUSE_DIRECT_UNKNOWN DT_SUSE_DIRECT_MASK
-+
- /* These constants are used for the version number of a Elf32_Verdef
- structure. */
-
-Only in binutils.current/include/elf: common.h~
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/include/elf/external.h binutils.current/include/elf/external.h
---- binutils-2.16/include/elf/external.h 2005-03-03 11:58:05.000000000 +0000
-+++ binutils.current/include/elf/external.h 2005-11-18 17:08:51.000000000 +0000
-@@ -213,6 +213,10 @@
- unsigned char vd_next[4];
- } Elf_External_Verdef;
-
-+typedef struct {
-+ unsigned char dir_libidx[2];
-+} Elf_External_Direct;
-+
- /* This structure appears in a SHT_GNU_verdef section. */
-
- typedef struct {
-Files binutils-2.16/ld/ld-new and binutils.current/ld/ld-new differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16/ld/lexsup.c binutils.current/ld/lexsup.c
---- binutils-2.16/ld/lexsup.c 2005-03-03 11:52:00.000000000 +0000
-+++ binutils.current/ld/lexsup.c 2005-11-23 10:32:20.000000000 +0000
-@@ -70,6 +70,7 @@
- OPTION_CREF,
- OPTION_DEFSYM,
- OPTION_DEMANGLE,
-+ OPTION_DIRECT,
- OPTION_DEMANGLER,
- OPTION_DYNAMIC_LINKER,
- OPTION_SYSROOT,
-@@ -341,6 +342,8 @@
- '\0', NULL, NULL, ONE_DASH },
- { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
- '\0', NULL, N_("Bind global references locally"), ONE_DASH },
-+ { {"Bdirect", no_argument, NULL, OPTION_DIRECT},
-+ '\0', NULL, N_("Direct-linkage the the shared libraries"), ONE_DASH },
- { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
- '\0', NULL, N_("Check section addresses for overlaps (default)"),
- TWO_DASHES },
-@@ -746,6 +749,9 @@
- cplus_demangle_set_style (style);
- }
- break;
-+ case OPTION_DIRECT:
-+ link_info.direct = TRUE;
-+ break;
- case 'I': /* Used on Solaris. */
- case OPTION_DYNAMIC_LINKER:
- command_line.interpreter = optarg;
diff --git a/patches/test/binutils-suse-dynsort.diff b/patches/test/binutils-suse-dynsort.diff
deleted file mode 100644
index 71802353b..000000000
--- a/patches/test/binutils-suse-dynsort.diff
+++ /dev/null
@@ -1,1067 +0,0 @@
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf32-hppa.c binutils.current/bfd/elf32-hppa.c
---- binutils-2.16.91.0.4/bfd/elf32-hppa.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf32-hppa.c 2005-12-23 14:06:31.000000000 +0000
-@@ -435,7 +435,7 @@
- = (struct elf32_hppa_link_hash_table *) btab;
-
- bfd_hash_table_free (&htab->bstab);
-- _bfd_generic_link_hash_table_free (btab);
-+ _bfd_elf_link_hash_table_free (btab);
- }
-
- /* Build a name for an entry in the stub hash table. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf32-m68hc1x.c binutils.current/bfd/elf32-m68hc1x.c
---- binutils-2.16.91.0.4/bfd/elf32-m68hc1x.c 2005-06-22 21:53:34.000000000 +0100
-+++ binutils.current/bfd/elf32-m68hc1x.c 2005-12-23 14:07:21.000000000 +0000
-@@ -106,7 +106,7 @@
-
- bfd_hash_table_free (ret->stub_hash_table);
- free (ret->stub_hash_table);
-- _bfd_generic_link_hash_table_free (hash);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- /* Assorted hash table functions. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf64-ppc.c binutils.current/bfd/elf64-ppc.c
---- binutils-2.16.91.0.4/bfd/elf64-ppc.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf64-ppc.c 2005-12-23 14:04:07.000000000 +0000
-@@ -3502,7 +3502,7 @@
-
- bfd_hash_table_free (&ret->stub_hash_table);
- bfd_hash_table_free (&ret->branch_hash_table);
-- _bfd_generic_link_hash_table_free (hash);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- /* Satisfy the ELF linker by filling in some fields in our fake bfd. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-bfd.h binutils.current/bfd/elf-bfd.h
---- binutils-2.16.91.0.4/bfd/elf-bfd.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elf-bfd.h 2005-12-23 14:59:54.000000000 +0000
-@@ -340,6 +340,10 @@
- {
- struct bfd_link_hash_table root;
-
-+ /* Symbol sort order for final traversal at output. */
-+ unsigned int sorted_size;
-+ struct elf_link_hash_entry **sorted;
-+
- /* Whether we have created the special dynamic sections required
- when linking against or generating a shared object. */
- bfd_boolean dynamic_sections_created;
-@@ -418,11 +422,16 @@
- /* Traverse an ELF linker hash table. */
-
- #define elf_link_hash_traverse(table, func, info) \
-- (bfd_link_hash_traverse \
-- (&(table)->root, \
-- (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
-+ (_bfd_elf_link_hash_traverse \
-+ ((table), \
-+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
- (info)))
-
-+void _bfd_elf_link_hash_traverse
-+ (struct elf_link_hash_table *table,
-+ bfd_boolean (*func) (struct elf_link_hash_entry *, void *),
-+ void *info);
-+
- /* Get the ELF linker hash table from a link_info structure. */
-
- #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
-@@ -1446,6 +1455,8 @@
-
- extern unsigned long bfd_elf_hash
- (const char *);
-+extern unsigned long _bfd_elf_ver_hash
-+ (const char *);
-
- extern bfd_reloc_status_type bfd_elf_generic_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-@@ -1463,6 +1474,7 @@
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
- (bfd *);
-+extern void _bfd_elf_link_hash_table_free (struct bfd_link_hash_table *);
- extern void _bfd_elf_link_hash_copy_indirect
- (struct bfd_link_info *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *);
-@@ -1593,7 +1605,7 @@
- extern bfd_boolean _bfd_elf_strtab_emit
- (bfd *, struct elf_strtab_hash *);
- extern void _bfd_elf_strtab_finalize
-- (struct elf_strtab_hash *);
-+ (struct elf_strtab_hash *, size_t);
-
- extern bfd_boolean _bfd_elf_discard_section_eh_frame
- (bfd *, struct bfd_link_info *, asection *,
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf.c binutils.current/bfd/elf.c
---- binutils-2.16.91.0.4/bfd/elf.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elf.c 2005-12-23 14:04:18.000000000 +0000
-@@ -1560,6 +1560,8 @@
- table->tls_size = 0;
- table->loaded = NULL;
- table->is_relocatable_executable = FALSE;
-+ table->sorted = NULL;
-+ table->sorted_size = 0;
-
- ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc);
- table->root.type = bfd_link_elf_hash_table;
-@@ -1588,6 +1590,15 @@
- return &ret->root;
- }
-
-+void
-+_bfd_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
-+{
-+ struct elf_link_hash_table *table = (struct elf_link_hash_table *) hash;
-+ if (table->sorted)
-+ free (table->sorted);
-+ _bfd_generic_link_hash_table_free (hash);
-+}
-+
- /* This is a hook for the ELF emulation code in the generic linker to
- tell the backend linker what file name to use for the DT_NEEDED
- entry for a dynamic object. */
-@@ -2983,7 +2994,7 @@
- _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name);
- }
-
-- _bfd_elf_strtab_finalize (elf_shstrtab (abfd));
-+ _bfd_elf_strtab_finalize (elf_shstrtab (abfd), 0);
- t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
-
- elf_numsections (abfd) = section_number;
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elflink.c binutils.current/bfd/elflink.c
---- binutils-2.16.91.0.4/bfd/elflink.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elflink.c 2006-01-18 16:36:45.000000000 +0000
-@@ -3007,7 +3007,8 @@
- const struct elf_backend_data *bed;
- bfd_byte *extdyn;
-
-- _bfd_elf_strtab_finalize (dynstr);
-+ _bfd_elf_strtab_finalize (dynstr, info->dynsort ?
-+ elf_hash_table (info)->bucketcount : 0);
- size = _bfd_elf_strtab_size (dynstr);
-
- bed = get_elf_backend_data (dynobj);
-@@ -4715,27 +4716,15 @@
- return FALSE;
- }
- }
--
--/* This function will be called though elf_link_hash_traverse to store
-- all hash value of the exported symbols in an array. */
-
--static bfd_boolean
--elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
-+/* Compute the elf hash value of the name ignoring the version. */
-+unsigned long
-+_bfd_elf_ver_hash (const char *name)
- {
-- unsigned long **valuep = data;
-- const char *name;
- char *p;
- unsigned long ha;
- char *alc = NULL;
-
-- if (h->root.type == bfd_link_hash_warning)
-- h = (struct elf_link_hash_entry *) h->root.u.i.link;
--
-- /* Ignore indirect symbols. These are added by the versioning code. */
-- if (h->dynindx == -1)
-- return TRUE;
--
-- name = h->root.root.string;
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL)
- {
-@@ -4748,6 +4739,31 @@
- /* Compute the hash value. */
- ha = bfd_elf_hash (name);
-
-+ if (alc != NULL)
-+ free (alc);
-+
-+ return ha;
-+}
-+
-+
-+/* This function will be called though elf_link_hash_traverse to store
-+ all hash value of the exported symbols in an array. */
-+
-+static bfd_boolean
-+elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
-+{
-+ unsigned long **valuep = data;
-+ unsigned long ha;
-+
-+ if (h->root.type == bfd_link_hash_warning)
-+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
-+
-+ /* Ignore indirect symbols. These are added by the versioning code. */
-+ if (h->dynindx == -1)
-+ return TRUE;
-+
-+ ha = _bfd_elf_ver_hash (h->root.root.string);
-+
- /* Store the found hash value in the array given as the argument. */
- *(*valuep)++ = ha;
-
-@@ -4755,9 +4771,6 @@
- later. */
- h->u.elf_hash_value = ha;
-
-- if (alc != NULL)
-- free (alc);
--
- return TRUE;
- }
-
-@@ -4920,6 +4933,127 @@
- return best_size;
- }
-
-+void _bfd_elf_link_hash_traverse
-+ (struct elf_link_hash_table *table,
-+ bfd_boolean (*func) (struct elf_link_hash_entry *, void *),
-+ void *info)
-+{
-+ if (!table->sorted)
-+ bfd_link_hash_traverse
-+ (&(table)->root,
-+ (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func),
-+ (info));
-+ else
-+ {
-+ unsigned int i;
-+ for (i = 0; i < table->sorted_size; i++)
-+ {
-+ if (! func (table->sorted[i], info))
-+ return;
-+ }
-+ }
-+}
-+
-+/* Sort by elf hash value % buckets. */
-+static int
-+elf_sort_dynsym_hash (const void *arg1, const void *arg2,
-+ const void *closure)
-+{
-+ size_t h1_bucket, h2_bucket;
-+ const struct elf_link_hash_entry *h1;
-+ const struct elf_link_hash_entry *h2;
-+ const bfd_size_type *bucketcount;
-+
-+ h1 = *(const struct elf_link_hash_entry **) arg1;
-+ h2 = *(const struct elf_link_hash_entry **) arg2;
-+ bucketcount = closure;
-+
-+ h1_bucket = h1->u.elf_hash_value % *bucketcount;
-+ h2_bucket = h2->u.elf_hash_value % *bucketcount;
-+
-+ if (h1_bucket > h2_bucket)
-+ return 1;
-+ if (h1_bucket < h2_bucket)
-+ return -1;
-+
-+ return 0;
-+}
-+
-+struct elf_dynsym_sort_info
-+{
-+ bfd_boolean do_dynsym;
-+ unsigned int alloc_size;
-+ unsigned int sorted_size;
-+ struct elf_link_hash_entry **sorted_syms;
-+};
-+
-+/* collect sym entries into an array for later sorting. */
-+static bfd_boolean
-+elf_sort_collect_dynsyms (struct elf_link_hash_entry *h, void *data)
-+{
-+ struct elf_dynsym_sort_info *sinfo = data;
-+
-+ if ((sinfo->do_dynsym && h->dynindx < 0)
-+ || (!sinfo->do_dynsym && h->dynindx >= 0))
-+ return TRUE;
-+
-+ if (sinfo->sorted_size >= sinfo->alloc_size)
-+ {
-+ sinfo->alloc_size *= 2;
-+ /* FIXME: need to free this data too ... */
-+ sinfo->sorted_syms = bfd_realloc
-+ (sinfo->sorted_syms,
-+ sizeof (struct elf_link_hash_entry *) *
-+ sinfo->alloc_size);
-+ }
-+ sinfo->sorted_syms [sinfo->sorted_size++] = h;
-+
-+ return TRUE;
-+}
-+
-+/*
-+ * Sort the exported elf symbols by elf_hash % bucketcount to
-+ * improve run-time linker cache behavior. Subsequent
-+ * elf_link_hash_traverse calls will reflect this new order.
-+ */
-+static bfd_boolean
-+_bfd_elf_sort_dynsyms (struct bfd_link_info *info)
-+{
-+ bfd_size_type bucketcount;
-+ struct elf_dynsym_sort_info sinfo;
-+
-+ sinfo.alloc_size = 8;
-+ sinfo.sorted_syms = bfd_malloc (sizeof (struct elf_link_hash_entry *) *
-+ sinfo.alloc_size);
-+ if (!sinfo.sorted_syms)
-+ return FALSE;
-+
-+ sinfo.sorted_size = 0;
-+
-+ /* append dynsyms for sorting. */
-+ sinfo.do_dynsym = TRUE;
-+ elf_link_hash_traverse (elf_hash_table (info),
-+ elf_sort_collect_dynsyms, &sinfo);
-+
-+ /* sort. */
-+ bucketcount = elf_hash_table (info)->bucketcount;
-+ bfd_qsort (sinfo.sorted_syms, sinfo.sorted_size,
-+ sizeof (struct elf_link_hash_entry *),
-+ elf_sort_dynsym_hash,
-+ &bucketcount);
-+
-+ /* append everything else. */
-+ sinfo.do_dynsym = FALSE;
-+ elf_link_hash_traverse (elf_hash_table (info),
-+ elf_sort_collect_dynsyms, &sinfo);
-+
-+ /* freed in _bfd_elf_link_hash_table_free. */
-+ elf_hash_table (info)->sorted = sinfo.sorted_syms;
-+ elf_hash_table (info)->sorted_size = sinfo.sorted_size;
-+
-+ return TRUE;
-+}
-+
- /* Set up the sizes and contents of the ELF dynamic sections. This is
- called by the ELF linker emulation before_allocation routine. We
- must set the sizes of the sections before the linker sets the
-@@ -5686,6 +5816,7 @@
- section symbol for each output section, which come first.
- Next come all of the back-end allocated local dynamic syms,
- followed by the rest of the global symbols. */
-+ /* To sort these optimally we need the correct bucketcount. */
-
- dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
- &section_sym_count);
-@@ -5756,6 +5887,17 @@
- for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
- if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
- return FALSE;
-+
-+ /* Sort .dynsym to accelerate runtime linking. */
-+ if (info->dynsort)
-+ {
-+ if (!_bfd_elf_sort_dynsyms (info))
-+ return FALSE;
-+
-+ /* renumber to reflect the new sorting order. */
-+ _bfd_elf_link_renumber_dynsyms (output_bfd, info,
-+ &section_sym_count);
-+ }
- }
-
- return TRUE;
-@@ -5892,6 +6034,7 @@
- bfd_vma sym_mask;
- } u;
- enum elf_reloc_type_class type;
-+ unsigned long elf_bucket;
- /* We use this as an array of size int_rels_per_ext_rel. */
- Elf_Internal_Rela rela[1];
- };
-@@ -5928,6 +6071,10 @@
- const struct elf_link_sort_rela *b = B;
- int copya, copyb;
-
-+ if (a->elf_bucket < b->elf_bucket)
-+ return -1;
-+ if (a->elf_bucket > b->elf_bucket)
-+ return 1;
- if (a->u.offset < b->u.offset)
- return -1;
- if (a->u.offset > b->u.offset)
-@@ -5946,8 +6093,10 @@
- }
-
- static size_t
--elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
-+elf_link_sort_relocs (bfd *abfd, struct elf_final_link_info *finfo,
-+ asection **psec)
- {
-+ struct bfd_link_info *info = finfo->info;
- asection *reldyn;
- bfd_size_type count, size;
- size_t i, ret, sort_elt, ext_size;
-@@ -5959,6 +6107,7 @@
- void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
- struct bfd_link_order *lo;
- bfd_vma r_sym_mask;
-+ int r_sym_shift;
-
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->size == 0)
-@@ -6000,15 +6149,29 @@
- }
-
- if (bed->s->arch_size == 32)
-- r_sym_mask = ~(bfd_vma) 0xff;
-+ {
-+ r_sym_mask = ~(bfd_vma) 0xff;
-+ r_sym_shift = 8;
-+ }
- else
-- r_sym_mask = ~(bfd_vma) 0xffffffff;
-+ {
-+ r_sym_mask = ~(bfd_vma) 0xffffffff;
-+ r_sym_shift = 32;
-+ }
-
- for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next)
- if (lo->type == bfd_indirect_link_order)
- {
- bfd_byte *erel, *erelend;
- asection *o = lo->u.indirect.section;
-+ int base_offset = -1;
-+ int base_max = 0;
-+
-+ if (elf_hash_table (info)->sorted_size > 0)
-+ {
-+ base_offset = elf_hash_table (info)->sorted[0]->dynindx;
-+ base_max = base_offset + elf_hash_table (info)->sorted_size;
-+ }
-
- if (o->contents == NULL && o->size != 0)
- {
-@@ -6023,10 +6186,28 @@
- p = sort + o->output_offset / ext_size * sort_elt;
- while (erel < erelend)
- {
-+ long dyn_idx;
-+ size_t bucketcount = elf_hash_table (info)->bucketcount;
- struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
- (*swap_in) (abfd, erel, s->rela);
- s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
- s->u.sym_mask = r_sym_mask;
-+
-+ if (s->type != reloc_class_relative)
-+ dyn_idx = s->rela->r_info >> r_sym_shift;
-+ else
-+ dyn_idx = -1;
-+
-+ if (info->dynsort && base_offset >= 0
-+ && dyn_idx < base_max && dyn_idx >= base_offset)
-+ {
-+ struct elf_link_hash_entry *ent;
-+ ent = elf_hash_table (info)->sorted [dyn_idx - base_offset];
-+ s->elf_bucket = ent->u.elf_hash_value % bucketcount;
-+ }
-+ else
-+ s->elf_bucket = 0;
-+
- p += sort_elt;
- erel += ext_size;
- }
-@@ -8426,7 +8612,7 @@
- }
-
- if (dynamic && info->combreloc && dynobj != NULL)
-- relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
-+ relativecount = elf_link_sort_relocs (abfd, &finfo, &reldyn);
-
- /* If we are linking against a dynamic object, or generating a
- shared library, finish up the dynamic linking information. */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-m10300.c binutils.current/bfd/elf-m10300.c
---- binutils-2.16.91.0.4/bfd/elf-m10300.c 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/elf-m10300.c 2005-12-23 14:06:10.000000000 +0000
-@@ -3729,8 +3729,7 @@
-
- _bfd_generic_link_hash_table_free
- ((struct bfd_link_hash_table *) ret->static_hash_table);
-- _bfd_generic_link_hash_table_free
-- ((struct bfd_link_hash_table *) ret);
-+ _bfd_elf_link_hash_table_free (hash);
- }
-
- static unsigned long
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf-strtab.c binutils.current/bfd/elf-strtab.c
---- binutils-2.16.91.0.4/bfd/elf-strtab.c 2005-05-10 23:46:41.000000000 +0100
-+++ binutils.current/bfd/elf-strtab.c 2006-01-18 16:37:04.000000000 +0000
-@@ -39,6 +39,7 @@
- /* Entry this is a suffix of (if len < 0). */
- struct elf_strtab_hash_entry *suffix;
- } u;
-+ long hash_bucket;
- };
-
- /* The strtab hash table. */
-@@ -54,6 +55,8 @@
- bfd_size_type sec_size;
- /* Array of pointers to strtab entries. */
- struct elf_strtab_hash_entry **array;
-+ /* Array of pointers to strtab entries. */
-+ struct elf_strtab_hash_entry **array_sorted;
- };
-
- /* Routine to create an entry in a section merge hashtab. */
-@@ -117,6 +120,7 @@
- }
-
- table->array[0] = NULL;
-+ table->array_sorted = NULL;
-
- return table;
- }
-@@ -128,6 +132,8 @@
- {
- bfd_hash_table_free (&tab->table);
- free (tab->array);
-+ if (tab->array_sorted)
-+ free (tab->array_sorted);
- free (tab);
- }
-
-@@ -229,6 +235,12 @@
- _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
- {
- bfd_size_type off = 1, i;
-+ struct elf_strtab_hash_entry **array;
-+
-+ if (tab->array_sorted != NULL)
-+ array = tab->array_sorted;
-+ else
-+ array = tab->array;
-
- if (bfd_bwrite ("", 1, abfd) != 1)
- return FALSE;
-@@ -238,12 +250,12 @@
- register const char *str;
- register unsigned int len;
-
-- BFD_ASSERT (tab->array[i]->refcount == 0);
-- len = tab->array[i]->len;
-+ BFD_ASSERT (array[i]->refcount == 0);
-+ len = array[i]->len;
- if ((int) len < 0)
- continue;
-
-- str = tab->array[i]->root.string;
-+ str = array[i]->root.string;
- if (bfd_bwrite (str, len, abfd) != len)
- return FALSE;
-
-@@ -278,6 +290,26 @@
- return lenA - lenB;
- }
-
-+/* sort by hash bucket position. */
-+static int
-+hash_compare (const void *a, const void *b)
-+{
-+ struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a;
-+ struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
-+
-+ if (A->hash_bucket > B->hash_bucket)
-+ return 1;
-+ if (A->hash_bucket < B->hash_bucket)
-+ return -1;
-+
-+ /* Make qsort faster for lots of identical empty symbols. */
-+ if (a > b)
-+ return 1;
-+ if (a < b)
-+ return -1;
-+ return 0;
-+}
-+
- static inline int
- is_suffix (const struct elf_strtab_hash_entry *A,
- const struct elf_strtab_hash_entry *B)
-@@ -293,9 +325,8 @@
-
- /* This function assigns final string table offsets for used strings,
- merging strings matching suffixes of longer strings if possible. */
--
- void
--_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
-+_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab, size_t bucket_count)
- {
- struct elf_strtab_hash_entry **array, **a, *e;
- bfd_size_type size, amt;
-@@ -361,15 +392,38 @@
- }
- }
-
--alloc_failure:
-- if (array)
-- free (array);
-+ if (bucket_count != 0)
-+ {
-+ array[0] = NULL;
-+ for (i = 1; i < tab->size; ++i)
-+ {
-+ e = tab->array[i];
-+ array[i] = e;
-+
-+ if (e->len > 0)
-+ {
-+ e->hash_bucket = _bfd_elf_ver_hash (e->root.string);
-+ e->hash_bucket %= bucket_count;
-+ }
-+ else
-+ e->hash_bucket = 0;
-+ }
-+ qsort (array + 1, tab->size - 1, sizeof (struct elf_strtab_hash_entry *),
-+ hash_compare);
-+ tab->array_sorted = array;
-+ }
-+ else
-+ {
-+ free (array);
-+ alloc_failure:
-+ array = tab->array;
-+ }
-
- /* Assign positions to the strings we want to keep. */
- size = 1;
- for (i = 1; i < tab->size; ++i)
- {
-- e = tab->array[i];
-+ e = array[i];
- if (e->refcount && e->len > 0)
- {
- e->u.index = size;
-@@ -382,7 +435,7 @@
- /* Adjust the rest. */
- for (i = 1; i < tab->size; ++i)
- {
-- e = tab->array[i];
-+ e = array[i];
- if (e->refcount && e->len < 0)
- e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len);
- }
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elfxx-target.h binutils.current/bfd/elfxx-target.h
---- binutils-2.16.91.0.4/bfd/elfxx-target.h 2005-08-22 20:27:41.000000000 +0100
-+++ binutils.current/bfd/elfxx-target.h 2005-12-23 14:06:51.000000000 +0000
-@@ -205,7 +205,7 @@
- #endif
-
- #ifndef bfd_elfNN_bfd_link_hash_table_free
--#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-+#define bfd_elfNN_bfd_link_hash_table_free _bfd_elf_link_hash_table_free
- #endif
-
- #ifdef elf_backend_relocate_section
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/include/bfdlink.h binutils.current/include/bfdlink.h
---- binutils-2.16.91.0.4/include/bfdlink.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/include/bfdlink.h 2006-01-18 16:19:19.000000000 +0000
-@@ -327,6 +327,9 @@
- /* TRUE if unreferenced sections should be removed. */
- unsigned int gc_sections: 1;
-
-+ /* TRUE if dynsym/dynstr/relocs should be sorted. */
-+ unsigned int dynsort : 1;
-+
- /* What to do with unresolved symbols in an object file.
- When producing executables the default is GENERATE_ERROR.
- When producing shared libraries the default is IGNORE. The
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/emultempl/ld/elf32.em binutils.current/emultempl/ld/elf32.em
---- binutils-2.16.91.0.4/ld/emultempl/elf32.em
-+++ binutils.current/ld/emultempl/elf32.em
-@@ -3949,6 +3949,10 @@
- link_info.relro = TRUE;
- else if (strcmp (optarg, "norelro") == 0)
- link_info.relro = FALSE;
-+ else if (strcmp (optarg, "dynsort") == 0)
-+ link_info.dynsort = TRUE;
-+ else if (strcmp (optarg, "nodynsort") == 0)
-+ link_info.dynsort = FALSE;
- /* What about the other Solaris -z options? FIXME. */
- break;
- }
-@@ -3966,6 +3970,7 @@
- fprintf (file, _(" --eh-frame-hdr\tCreate .eh_frame_hdr section\n"));
- fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n"));
- fprintf (file, _(" -z defs\t\tReport unresolved symbols in object files.\n"));
-+ fprintf (file, _(" -z dynsort\t\tSort dynamic link sections\n"));
- fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n"));
- fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
- fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n"));
-@@ -3977,6 +3982,7 @@
- fprintf (file, _(" -z nodelete\t\tMark DSO non-deletable at runtime\n"));
- fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n"));
- fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n"));
-+ fprintf (file, _(" -z nodynsort\t\tDon't sort dynamic link sections\n"));
- fprintf (file, _(" -z noexecstack\tMark executable as not requiring executable stack\n"));
- fprintf (file, _(" -z norelro\t\tDon't create RELRO program header\n"));
- fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n"));
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/ldmain.c binutils.current/ld/ldmain.c
---- binutils-2.16.91.0.4/ld/ldmain.c 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/ld/ldmain.c 2006-01-18 16:19:56.000000000 +0000
-@@ -316,6 +316,7 @@
- link_info.need_relax_finalize = FALSE;
- link_info.warn_shared_textrel = FALSE;
- link_info.gc_sections = FALSE;
-+ link_info.dynsort = FALSE;
-
- ldfile_add_arch ("");
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/ld.texinfo binutils.current/ld/ld.texinfo
---- binutils-2.16.91.0.4/ld/ld.texinfo 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/ld/ld.texinfo 2006-01-18 16:29:15.000000000 +0000
-@@ -928,6 +928,9 @@
- Disallows undefined symbols in object files. Undefined symbols in
- shared libraries are still allowed.
-
-+@item dynsort
-+Sorts dynamic link sections, to reduce cache misses during linking.
-+
- @item execstack
- Marks the object as requiring executable stack.
-
-@@ -969,7 +972,10 @@
- @item nodump
- Marks the object can not be dumped by @code{dldump}.
-
-+@item nodynsort
-+Disables dynamic link section sorting.
-+
- @item noexecstack
- Marks the object as not requiring executable stack.
-
-
-
---- /dev/null 2006-01-18 11:12:51.092369250 +0000
-+++ binutils.current/bfd/bfdsort.c 2006-01-18 15:55:17.000000000 +0000
-@@ -0,0 +1,255 @@
-+/*
-+ * This module copied from glibc/stdlib/qsort.c & adapted,
-+ * in order to add support for a closure argument.
-+ */
-+
-+/* Copyright (C) 1991,1992,1996,1997,1999,2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Douglas C. Schmidt (schmidt@ics.uci.edu).
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* If you consider tuning this algorithm, you should consult first:
-+ Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
-+ Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */
-+
-+#include "bfd.h"
-+#include "sysdep.h"
-+
-+/* Byte-wise swap two items of size SIZE. */
-+#define SWAP(a, b, size) \
-+ do \
-+ { \
-+ register bfd_size_type __size = (size); \
-+ register char *__a = (a), *__b = (b); \
-+ do \
-+ { \
-+ char __tmp = *__a; \
-+ *__a++ = *__b; \
-+ *__b++ = __tmp; \
-+ } while (--__size > 0); \
-+ } while (0)
-+
-+/* Discontinue quicksort algorithm when partition gets below this size.
-+ This particular magic number was chosen to work best on a Sun 4/260. */
-+#define MAX_THRESH 4
-+
-+/* Stack node declarations used to store unfulfilled partition obligations. */
-+typedef struct
-+ {
-+ char *lo;
-+ char *hi;
-+ } stack_node;
-+
-+/* The next 4 #defines implement a very fast in-line stack abstraction. */
-+/* The stack needs log (total_elements) entries (we could even subtract
-+ log(MAX_THRESH)). Since total_elements has type size_t, we get as
-+ upper bound for log (total_elements):
-+ bits per byte (CHAR_BIT) * sizeof(size_t). */
-+#define STACK_SIZE (8 * sizeof(bfd_size_type))
-+#define PUSH(low, high) do { top->lo = (low); top->hi = (high); \
-+ ++top; } while (0)
-+#define POP(low, high) do { --top; low = top->lo; \
-+ high = top->hi; } while (0)
-+#define STACK_NOT_EMPTY (stack < top)
-+
-+
-+/* Order size using quicksort. This implementation incorporates
-+ four optimizations discussed in Sedgewick:
-+
-+ 1. Non-recursive, using an explicit stack of pointer that store the
-+ next array partition to sort. To save time, this maximum amount
-+ of space required to store an array of SIZE_MAX is allocated on the
-+ stack. Assuming a 32-bit (64 bit) integer for size_t, this needs
-+ only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
-+ Pretty cheap, actually.
-+
-+ 2. Chose the pivot element using a median-of-three decision tree.
-+ This reduces the probability of selecting a bad pivot value and
-+ eliminates certain extraneous comparisons.
-+
-+ 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
-+ insertion sort to order the MAX_THRESH items within each partition.
-+ This is a big win, since insertion sort is faster for small, mostly
-+ sorted array segments.
-+
-+ 4. The larger of the two sub-partitions is always pushed onto the
-+ stack first, with the algorithm then concentrating on the
-+ smaller partition. This *guarantees* no more than log (total_elems)
-+ stack size is needed (actually O(1) in this case)! */
-+
-+void
-+bfd_qsort (void *pbase, bfd_size_type total_elems, bfd_size_type size,
-+ bfd_qsort_closure_func cmp, void *closure)
-+{
-+ register char *base_ptr = (char *) pbase;
-+
-+ const bfd_size_type max_thresh = MAX_THRESH * size;
-+
-+ if (total_elems == 0)
-+ /* Avoid lossage with unsigned arithmetic below. */
-+ return;
-+
-+ if (total_elems > MAX_THRESH)
-+ {
-+ char *lo = base_ptr;
-+ char *hi = &lo[size * (total_elems - 1)];
-+ stack_node stack[STACK_SIZE];
-+ stack_node *top = stack;
-+
-+ PUSH (NULL, NULL);
-+
-+ while (STACK_NOT_EMPTY)
-+ {
-+ char *left_ptr;
-+ char *right_ptr;
-+
-+ /* Select median value from among LO, MID, and HI. Rearrange
-+ LO and HI so the three values are sorted. This lowers the
-+ probability of picking a pathological pivot value and
-+ skips a comparison for both the LEFT_PTR and RIGHT_PTR in
-+ the while loops. */
-+
-+ char *mid = lo + size * ((hi - lo) / size >> 1);
-+
-+ if ((*cmp) ((void *) mid, (void *) lo, closure) < 0)
-+ SWAP (mid, lo, size);
-+ if ((*cmp) ((void *) hi, (void *) mid, closure) < 0)
-+ SWAP (mid, hi, size);
-+ else
-+ goto jump_over;
-+ if ((*cmp) ((void *) mid, (void *) lo, closure) < 0)
-+ SWAP (mid, lo, size);
-+ jump_over:;
-+
-+ left_ptr = lo + size;
-+ right_ptr = hi - size;
-+
-+ /* Here's the famous ``collapse the walls'' section of quicksort.
-+ Gotta like those tight inner loops! They are the main reason
-+ that this algorithm runs much faster than others. */
-+ do
-+ {
-+ while ((*cmp) ((void *) left_ptr, (void *) mid, closure) < 0)
-+ left_ptr += size;
-+
-+ while ((*cmp) ((void *) mid, (void *) right_ptr, closure) < 0)
-+ right_ptr -= size;
-+
-+ if (left_ptr < right_ptr)
-+ {
-+ SWAP (left_ptr, right_ptr, size);
-+ if (mid == left_ptr)
-+ mid = right_ptr;
-+ else if (mid == right_ptr)
-+ mid = left_ptr;
-+ left_ptr += size;
-+ right_ptr -= size;
-+ }
-+ else if (left_ptr == right_ptr)
-+ {
-+ left_ptr += size;
-+ right_ptr -= size;
-+ break;
-+ }
-+ }
-+ while (left_ptr <= right_ptr);
-+
-+ /* Set up pointers for next iteration. First determine whether
-+ left and right partitions are below the threshold size. If so,
-+ ignore one or both. Otherwise, push the larger partition's
-+ bounds on the stack and continue sorting the smaller one. */
-+
-+ if ((bfd_size_type) (right_ptr - lo) <= max_thresh)
-+ {
-+ if ((bfd_size_type) (hi - left_ptr) <= max_thresh)
-+ /* Ignore both small partitions. */
-+ POP (lo, hi);
-+ else
-+ /* Ignore small left partition. */
-+ lo = left_ptr;
-+ }
-+ else if ((bfd_size_type) (hi - left_ptr) <= max_thresh)
-+ /* Ignore small right partition. */
-+ hi = right_ptr;
-+ else if ((right_ptr - lo) > (hi - left_ptr))
-+ {
-+ /* Push larger left partition indices. */
-+ PUSH (lo, right_ptr);
-+ lo = left_ptr;
-+ }
-+ else
-+ {
-+ /* Push larger right partition indices. */
-+ PUSH (left_ptr, hi);
-+ hi = right_ptr;
-+ }
-+ }
-+ }
-+
-+ /* Once the BASE_PTR array is partially sorted by quicksort the rest
-+ is completely sorted using insertion sort, since this is efficient
-+ for partitions below MAX_THRESH size. BASE_PTR points to the beginning
-+ of the array to sort, and END_PTR points at the very last element in
-+ the array (*not* one beyond it!). */
-+
-+#define min(x, y) ((x) < (y) ? (x) : (y))
-+
-+ {
-+ char *const end_ptr = &base_ptr[size * (total_elems - 1)];
-+ char *tmp_ptr = base_ptr;
-+ char *thresh = min(end_ptr, base_ptr + max_thresh);
-+ register char *run_ptr;
-+
-+ /* Find smallest element in first threshold and place it at the
-+ array's beginning. This is the smallest array element,
-+ and the operation speeds up insertion sort's inner loop. */
-+
-+ for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
-+ if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, closure) < 0)
-+ tmp_ptr = run_ptr;
-+
-+ if (tmp_ptr != base_ptr)
-+ SWAP (tmp_ptr, base_ptr, size);
-+
-+ /* Insertion sort, running from left-hand-side up to right-hand-side. */
-+
-+ run_ptr = base_ptr + size;
-+ while ((run_ptr += size) <= end_ptr)
-+ {
-+ tmp_ptr = run_ptr - size;
-+ while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, closure) < 0)
-+ tmp_ptr -= size;
-+
-+ tmp_ptr += size;
-+ if (tmp_ptr != run_ptr)
-+ {
-+ char *trav;
-+
-+ trav = run_ptr + size;
-+ while (--trav >= run_ptr)
-+ {
-+ char c = *trav;
-+ char *hi, *lo;
-+
-+ for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
-+ *hi = *lo;
-+ *hi = c;
-+ }
-+ }
-+ }
-+ }
-+}
-
---- binutils-2.16.91.0.4/bfd/bfd-in.h 2005-11-13 17:16:34.000000000 +0000
-+++ binutils.current/bfd/bfd-in.h 2006-01-27 14:57:53.000000000 +0000
-@@ -161,6 +161,10 @@
-
- typedef unsigned int flagword; /* 32 bits of flags */
- typedef unsigned char bfd_byte;
-+
-+typedef int (*bfd_qsort_closure_func) (const void *, const void *, const void *);
-+extern void bfd_qsort (void *base, bfd_size_type nmemb, bfd_size_type size,
-+ bfd_qsort_closure_func cmp, void *closure);
-
- /* File formats. */
-
-
-
---- binutils-2.16.91.0.4/bfd/Makefile.am 2005-12-07 10:42:37.000000000 +0000
-+++ binutils.current/bfd/Makefile.am 2006-01-18 15:50:23.000000000 +0000
-@@ -32,7 +32,7 @@
- # need two copies of the executable, one to download and one for the
- # debugger).
- BFD32_LIBS = \
-- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
-+ archive.lo archures.lo bfd.lo bfdio.lo bfdsort.lo bfdwin.lo \
- cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
-@@ -42,7 +42,7 @@
- BFD64_LIBS = archive64.lo
-
- BFD32_LIBS_CFILES = \
-- archive.c archures.c bfd.c bfdio.c bfdwin.c \
-+ archive.c archures.c bfd.c bfdio.c bfdsort.c bfdwin.c \
- cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
-
-
---- binutils-2.16.91.0.4/bfd/Makefile.in 2006-01-27 15:59:50.000000000 +0000
-+++ binutils.current/bfd/Makefile.in 2006-01-27 16:03:06.000000000 +0000
-@@ -77,7 +77,7 @@
- cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo \
- opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \
- linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \
-- stab-syms.lo merge.lo dwarf2.lo simple.lo
-+ stab-syms.lo merge.lo dwarf2.lo simple.lo bfdsort.lo
- am__objects_2 = archive64.lo
- am_libbfd_la_OBJECTS = $(am__objects_1) $(am__objects_2)
- libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
-@@ -268,7 +268,7 @@
- # need two copies of the executable, one to download and one for the
- # debugger).
- BFD32_LIBS = \
-- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
-+ archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo bfdsort.lo \
- cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
-@@ -277,7 +277,7 @@
-
- BFD64_LIBS = archive64.lo
- BFD32_LIBS_CFILES = \
-- archive.c archures.c bfd.c bfdio.c bfdwin.c \
-+ archive.c archures.c bfd.c bfdio.c bfdwin.c bfdsort.lo \
- cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
diff --git a/patches/test/binutils-suse-hashvals.diff b/patches/test/binutils-suse-hashvals.diff
deleted file mode 100644
index b4e2ba761..000000000
--- a/patches/test/binutils-suse-hashvals.diff
+++ /dev/null
@@ -1,168 +0,0 @@
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elf.c binutils.current/bfd/elf.c
---- binutils-2.16.91.0.4/bfd/elf.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elf.c 2006-01-20 14:35:28.000000000 +0000
-@@ -1212,6 +1212,7 @@
- case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break;
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
-+ case DT_SUSE_HASHVALS: name = "SUSE_HASHVALS"; break;
- }
-
- fprintf (f, " %-11s ", name);
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/bfd/elflink.c binutils.current/bfd/elflink.c
---- binutils-2.16.91.0.4/bfd/elflink.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/bfd/elflink.c 2006-01-20 15:03:00.000000000 +0000
-@@ -174,6 +174,15 @@
-
- flags = bed->dynamic_sec_flags;
-
-+ if (info->hashvals)
-+ {
-+ s = bfd_make_section (abfd, ".suse.hashvals");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+ }
-+
- /* A dynamically linked executable has a .interp section, but a
- shared library does not. */
- if (info->executable)
-@@ -5728,6 +5737,24 @@
- memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
- }
-
-+ /* Create the direct bindings section - 1 entry per dynsym. */
-+ s = bfd_get_section_by_name (dynobj, ".suse.hashvals");
-+ if (s != NULL)
-+ {
-+ if (dynsymcount == 0)
-+ s->flags |= SEC_EXCLUDE;
-+ else
-+ {
-+ s->size = dynsymcount * bed->s->sizeof_hash_entry;
-+ s->contents = bfd_zalloc (output_bfd, s->size);
-+ if (s->contents == NULL)
-+ return FALSE;
-+ memset (s->contents, 0xfe, s->size);
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_HASHVALS, 0))
-+ return FALSE;
-+ }
-+ }
-+
- /* Compute the size of the hashing table. As a side effect this
- computes the hash values for all the names we export. */
- bucketcount = compute_bucket_count (info);
-@@ -5799,6 +5828,8 @@
- /* Array large enough to hold a section pointer for each local
- symbol of any input BFD. */
- asection **sections;
-+ /* .suse.hashvals section. */
-+ asection *hashvals_sec;
- /* Buffer to hold swapped out symbols. */
- bfd_byte *symbuf;
- /* And one for symbol section indices. */
-@@ -6614,6 +6645,15 @@
- ((bfd_byte *) finfo->hash_sec->contents
- + (bucketcount + 2 + h->dynindx) * hash_entry_size));
-
-+ if (finfo->hashvals_sec != NULL)
-+ {
-+ bfd_vma offset = hash_entry_size * h->dynindx;
-+ BFD_ASSERT (offset <= finfo->hashvals_sec->size);
-+ bfd_put (8 * hash_entry_size, finfo->output_bfd,
-+ h->u.elf_hash_value,
-+ finfo->hashvals_sec->contents + offset);
-+ }
-+
- if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
- {
- Elf_Internal_Versym iversym;
-@@ -7786,6 +7829,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.hashvals_sec = NULL;
- }
- else
- {
-@@ -7794,6 +7838,7 @@
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
- /* Note that it is OK if symver_sec is NULL. */
-+ finfo.hashvals_sec = bfd_get_section_by_name (dynobj, ".suse.hashvals");
- }
-
- finfo.contents = NULL;
-@@ -8533,6 +8578,9 @@
- case DT_HASH:
- name = ".hash";
- goto get_vma;
-+ case DT_SUSE_HASHVALS:
-+ name = ".suse.hashvals";
-+ goto get_vma;
- case DT_STRTAB:
- name = ".dynstr";
- goto get_vma;
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/include/bfdlink.h binutils.current/include/bfdlink.h
---- binutils-2.16.91.0.4/include/bfdlink.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/include/bfdlink.h 2006-01-20 14:19:46.000000000 +0000
-@@ -261,6 +261,10 @@
- need much more time and therefore must be explicitly selected. */
- unsigned int optimize: 1;
-
-+ /* TRUE if we want to produced a section containing pre-computed
-+ hash values. This consumes more space. */
-+ unsigned int hashvals: 1;
-+
- /* TRUE if ok to have multiple definition. */
- unsigned int allow_multiple_definition: 1;
-
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/include/elf/common.h binutils.current/include/elf/common.h
---- binutils-2.16.91.0.4/include/elf/common.h 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/include/elf/common.h 2006-01-20 14:34:18.000000000 +0000
-@@ -604,6 +604,12 @@
- #define DT_FILTER 0x7fffffff
-
-
-+/* Selected at random. */
-+#define DT_SUSE_LO 0x6cbdd030
-+#define DT_SUSE_HASHVALS DT_SUSE_LO
-+#define DT_SUSE_DIRECT DT_SUSE_LO + 1
-+#define DT_SUSE_HI 0x6cbdd040
-+
- /* Values used in DT_FEATURE .dynamic entry. */
- #define DTF_1_PARINIT 0x00000001
- /* From
-Files binutils-2.16.91.0.4/ld/ld-new and binutils.current/ld/ld-new differ
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' binutils-2.16.91.0.4/ld/lexsup.c binutils.current/ld/lexsup.c
---- binutils-2.16.91.0.4/ld/lexsup.c 2005-12-22 10:42:52.000000000 +0000
-+++ binutils.current/ld/lexsup.c 2006-01-20 14:31:21.000000000 +0000
-@@ -78,6 +78,7 @@
- OPTION_EL,
- OPTION_EMBEDDED_RELOCS,
- OPTION_EXPORT_DYNAMIC,
-+ OPTION_HASHVALS,
- OPTION_HELP,
- OPTION_IGNORE,
- OPTION_MAP,
-@@ -341,6 +342,8 @@
- '\0', NULL, NULL, ONE_DASH },
- { {"static", no_argument, NULL, OPTION_NON_SHARED},
- '\0', NULL, NULL, ONE_DASH },
-+ { {"hashvals", no_argument, NULL, OPTION_HASHVALS},
-+ '\0', NULL, N_("Store pre-computed elf hash codes"), ONE_DASH },
- { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
- '\0', NULL, N_("Bind global references locally"), ONE_DASH },
- { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
-@@ -1111,6 +1114,9 @@
- case OPTION_SYMBOLIC:
- link_info.symbolic = TRUE;
- break;
-+ case OPTION_HASHVALS:
-+ link_info.hashvals = TRUE;
-+ break;
- case 't':
- trace_files = TRUE;
- break;
diff --git a/patches/test/binutils-vt-copy-2.diff b/patches/test/binutils-vt-copy-2.diff
deleted file mode 100644
index 143d409a2..000000000
--- a/patches/test/binutils-vt-copy-2.diff
+++ /dev/null
@@ -1,1574 +0,0 @@
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf-bfd.h binutils-2.17.50/bfd/elf-bfd.h
---- pristine-binutils-2.17.50/bfd/elf-bfd.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf-bfd.h 2008-01-09 17:04:17.000000000 +0000
-@@ -1787,6 +1787,12 @@
- extern void _bfd_elf_init_2_index_sections
- (bfd *, struct bfd_link_info *);
-
-+/* elf-vtreloc */
-+extern bfd_boolean _bfd_elf_vtreloc_accumulate
-+ (bfd *, struct bfd_link_info *);
-+extern bfd_boolean _bfd_elf_vtreloc_fill
-+ (bfd *, struct bfd_link_info *);
-+
- extern bfd_boolean _bfd_elfcore_make_pseudosection
- (bfd *, char *, size_t, ufile_ptr);
- extern char *_bfd_elfcore_strndup
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf-vtreloc.c binutils-2.17.50/bfd/elf-vtreloc.c
---- pristine-binutils-2.17.50/bfd/elf-vtreloc.c 2008-01-09 16:54:44.000000000 +0000
-+++ binutils-2.17.50/bfd/elf-vtreloc.c 2008-01-15 15:40:27.000000000 +0000
-@@ -0,0 +1,596 @@
-+#include "sysdep.h"
-+#include "bfd.h"
-+#include "sysdep.h"
-+#include "bfdlink.h"
-+#include "libbfd.h"
-+#define ARCH_SIZE 0
-+#include "elf-bfd.h"
-+#include "safe-ctype.h"
-+#include "libiberty.h"
-+
-+typedef struct _CopyEntry CopyEntry;
-+
-+typedef struct {
-+ bfd *abfd;
-+ CopyEntry *sorted;
-+ CopyEntry *unsorted;
-+} VtRelocs;
-+
-+struct _CopyEntry {
-+ struct elf_link_hash_entry *src;
-+ bfd_vma src_offset;
-+ struct elf_link_hash_entry *dest;
-+ bfd_vma dest_offset;
-+ bfd_vma bitmask;
-+
-+ /* chain */
-+ CopyEntry *next;
-+};
-+
-+static void
-+prepend (CopyEntry **list, CopyEntry *p)
-+{
-+ p->next = *list;
-+ *list = p;
-+}
-+
-+static int
-+copy_entry_equal (const CopyEntry *a, const CopyEntry *b)
-+{
-+ return (a->src == b->src &&
-+ a->src_offset == b->src_offset &&
-+ a->dest == b->dest &&
-+ a->dest_offset == b->dest_offset &&
-+ a->bitmask == b->bitmask);
-+}
-+
-+/*
-+ * FIXME - should be a hash lookup / something fast.
-+ */
-+static CopyEntry *
-+find_with_dest (CopyEntry *list,
-+ struct elf_link_hash_entry *e)
-+{
-+ while (list)
-+ {
-+ if (list->dest == e)
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+static CopyEntry *
-+find_equal_entry (CopyEntry *list, CopyEntry *e)
-+{
-+ while (list)
-+ {
-+ if (copy_entry_equal (list, e))
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+/*
-+ * Transfer from unsorted -> sorted.
-+ * NB. simple-minded algorithm, N^3 with degenerate case
-+ */
-+static void
-+sort_relocs (VtRelocs *vtr)
-+{
-+ CopyEntry *p;
-+ CopyEntry *pending;
-+ CopyEntry *next;
-+
-+ fprintf (stderr, "Sorting ...");
-+ do
-+ {
-+ pending = NULL;
-+
-+ for (p = vtr->unsorted; p; p = next)
-+ {
-+ next = p->next;
-+ if (!find_with_dest (vtr->unsorted, p->src))
-+ {
-+ /* FIXME: sorting by offset, to ensure as
-+ good as possible contiguous access will
-+ require a more complex node structure:
-+ with aggregation per 'dest', and
-+ internal sorting within that */
-+ prepend (&vtr->sorted, p);
-+ }
-+ else
-+ prepend (&pending, p);
-+ }
-+ vtr->unsorted = pending;
-+ }
-+ while (pending);
-+ fprintf (stderr, " done\n");
-+}
-+
-+static void
-+check_reloc (Elf_Internal_Rela *rel, int type_mask)
-+{
-+ if ((rel->r_info & type_mask) != STT_OBJECT)
-+ fprintf (stderr, "broken vtreloc type\n");
-+ if (rel->r_addend != 0)
-+ fprintf (stderr, "unexpected reloc addend\n");
-+}
-+
-+static void
-+print_rel (const char *type,
-+ struct elf_link_hash_entry *target)
-+{
-+ fprintf (stderr, "%s '%s' %d %d %d %d i:%ld\n",
-+ type, target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+}
-+
-+static void
-+add_reloc (VtRelocs *vtr,
-+ bfd *inputobj,
-+ Elf_Internal_Rela *src_rel,
-+ Elf_Internal_Rela *dest_rel,
-+ unsigned char *data)
-+{
-+ unsigned r_sym_shift;
-+ unsigned r_type_mask;
-+ unsigned incr;
-+ unsigned symidx;
-+ const struct elf_backend_data *bed;
-+ struct elf_link_hash_entry *dest, *src;
-+ Elf_Internal_Shdr *hdr;
-+ CopyEntry *e;
-+
-+ hdr = &elf_tdata (inputobj)->symtab_hdr;
-+ bed = get_elf_backend_data (inputobj);
-+ if (bed->s->arch_size == 32)
-+ {
-+ r_type_mask = 0xff;
-+ r_sym_shift = 8;
-+ incr = 4;
-+ }
-+ else
-+ {
-+ r_type_mask = 0xffffffff;
-+ r_sym_shift = 32;
-+ incr = 8;
-+ }
-+
-+ check_reloc (src_rel, r_type_mask);
-+ check_reloc (dest_rel, r_type_mask);
-+
-+/*
-+#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
-+#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
-+ Elf
-+ cf. RELOC_FOR_GLOBAL_SYMBOL ...
-+*/
-+
-+ symidx = (dest_rel->r_info >> r_sym_shift);
-+ fprintf (stderr, "symidx %d (-%d)!\n", symidx, hdr->sh_info);
-+
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local dest symbol !");
-+ return;
-+ }
-+
-+ symidx -= hdr->sh_info;
-+ dest = elf_sym_hashes (inputobj) [symidx];
-+ if (!dest) {
-+ fprintf (stderr, "no rel %d!\n", symidx);
-+ return;
-+ }
-+
-+ /* Eliminate relocs to no longer present internal vtables. */
-+ if (!dest->def_regular)
-+ {
-+ print_rel ("Abandoning dest", dest);
-+ fprintf (stderr, "Ref count %ld %ld dynindx %d\n",
-+ dest->got.refcount, dest->plt.refcount,
-+ (int) dest->dynindx);
-+ /* unref the symbol somehow (!?) */
-+ return;
-+ }
-+
-+ // FIXME: do we need something like this for indirect / warnings !?
-+/* while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link; */
-+ fprintf (stderr, "dest link type %d\n", dest->root.type);
-+ if (dest->root.type == bfd_link_hash_undefined ||
-+ dest->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined dest sym '%s'\n", dest->root.root.string);
-+ return;
-+ }
-+
-+ /* Consider: should we eliminate all internal -> internal
-+ copies ? it's possible we are more space / time
-+ efficient - so no for now. */
-+
-+ symidx = (src_rel->r_info >> r_sym_shift);
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local src symbol !");
-+ return;
-+ }
-+ symidx -= hdr->sh_info;
-+ src = elf_sym_hashes (inputobj) [symidx];
-+ if (src->root.type == bfd_link_hash_undefined ||
-+ src->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined src sym '%s'\n", src->root.root.string);
-+ return;
-+ }
-+
-+ print_rel ("Src", src);
-+ print_rel ("Dst", dest);
-+
-+ e = bfd_zalloc (vtr->abfd, sizeof (CopyEntry));
-+
-+ e->src = src;
-+ e->dest = dest;
-+
-+ if (dest_rel->r_offset - src_rel->r_offset != bed->s->arch_size / 8)
-+ fprintf (stderr, "Mis-paired vtrelocs\n");
-+
-+ e->src_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->dest_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->bitmask = bfd_get (bed->s->arch_size, inputobj, data);
-+
-+ /* Simple minded dupliates elision */
-+ if (find_equal_entry (vtr->unsorted, e))
-+ bfd_release (vtr->abfd, e);
-+ else
-+ {
-+ prepend (&vtr->unsorted, e);
-+
-+ fprintf (stderr, "Copy: '%s'+%d -> '%s'+%d (0x%x)\n",
-+ e->src->root.root.string,
-+ (int)e->src_offset,
-+ e->dest->root.root.string,
-+ (int)e->dest_offset,
-+ (int)e->bitmask);
-+ }
-+}
-+
-+static VtRelocs *global_vtr;
-+
-+bfd_boolean _bfd_elf_vtreloc_accumulate (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+ if (info->vtreloc)
-+ { // .vtrelocs
-+ bfd_size_type sec_size = 0;
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+ bfd *inputobj;
-+ VtRelocs *vtr;
-+ Elf_Internal_Rela last_rela;
-+ bfd_size_type num_relocs;
-+
-+ vtr = bfd_zalloc (output_bfd, sizeof (VtRelocs));
-+ vtr->abfd = output_bfd;
-+ global_vtr = vtr;
-+
-+ /* FIXME: we need to elide relocs that turn out
-+ to be purely internal:
-+ eg. internal -> internal copy src / dest,
-+ others are less troublesome - though removing
-+ empty ones would be nice (?).
-+ We want to trap every -named- reloc ...
-+ */
-+ for (inputobj = info->input_bfds;
-+ inputobj;
-+ inputobj = inputobj->link_next)
-+ {
-+ asection *s;
-+ struct bfd_elf_section_data *es; /* elf-bfd.h */
-+ unsigned i;
-+ Elf_Internal_Rela *relocs, *p;
-+ unsigned char *sec_data;
-+ long storage_needed;
-+ asymbol **symtab;
-+ long number_of_symbols;
-+ const struct elf_backend_data *bed = get_elf_backend_data (inputobj);
-+
-+ if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
-+ continue;
-+ s = bfd_get_section_by_name (inputobj, ".vtrelocs");
-+ if (!s)
-+ continue;
-+ /* XXX Hmm, this seems to generate many NONE relocs, probably from
-+ the original relocs to this section. Perhaps discard them
-+ earlier. */
-+ /* FIXME: we really don't want to keep these around, quick hack
-+ *** due to having relocs pointing to these sections */
-+ /* s->flags |= SEC_EXCLUDE; */
-+ es = elf_section_data (s);
-+ if (!es)
-+ continue;
-+
-+ if (!s->reloc_count)
-+ continue;
-+
-+ fprintf (stderr, "Relocs: size %d, count %d contents %p\n",
-+ (int)es->rel_hdr.sh_size, es->rel_count,
-+ s->contents);
-+
-+
-+ /* Can't find this info anywhere else for some reason: */
-+ p = relocs = _bfd_elf_link_read_relocs (inputobj, s, NULL, NULL,
-+ info->keep_memory);
-+
-+ /* Experimental stuff to get at the BFD relocs (translated back
-+ from the real ELF relocs. */
-+ storage_needed = bfd_get_symtab_upper_bound (inputobj);
-+ if (storage_needed <= 0)
-+ return FALSE;
-+ symtab = xmalloc (storage_needed);
-+ number_of_symbols = bfd_canonicalize_symtab (inputobj, symtab);
-+ if (number_of_symbols < 0)
-+ return FALSE;
-+
-+ if (! bed->s->slurp_reloc_table (inputobj, s, symtab, FALSE))
-+ return FALSE;
-+
-+ /* Now inputobj->relocation will contain BFD relocs. */
-+
-+ sec_data = bfd_malloc (es->this_hdr.sh_size);
-+
-+ /* Slurp the data */
-+ if (bfd_seek (inputobj, es->this_hdr.sh_offset, SEEK_SET) != 0)
-+ return FALSE;
-+ if (bfd_bread (sec_data, es->this_hdr.sh_size, inputobj) != es->this_hdr.sh_size)
-+ return FALSE;
-+
-+ if (es->this_hdr.sh_size % s->reloc_count != 0)
-+ fprintf (stderr, "ERROR: mismatching vtreloc sec & reloc count "
-+ "0x%x, 0x%x -> %d\n",
-+ (int)es->this_hdr.sh_size, (int)s->reloc_count,
-+ (int)es->this_hdr.sh_size % s->reloc_count);
-+
-+ /* Assumes an even number of relocs sorted by address ... */
-+ for (i = 0; i < s->reloc_count / 2; i++)
-+ {
-+ unsigned int entry_size;
-+ entry_size = (get_elf_backend_data (inputobj)->s->arch_size / 8) * 3;
-+
-+ last_rela = *p;
-+ add_reloc (vtr, inputobj, p, p + 1,
-+ sec_data + i * entry_size);
-+ p+=2;
-+ }
-+ free (sec_data);
-+ if (es->relocs != relocs)
-+ free (relocs);
-+ }
-+
-+ /* So - we need to sort these guys as we work out the sizes */
-+ /* We need to generate an internal list of XYZ type
-+ + eliminate all external -> external work ...
-+ + add all external -> internal copies to 'sorted' list
-+ + [ fool-proof GC roots ]
-+ + add other symbols to 'pending' list.
-+ + read / generate src: [symbol + offset, dest: sym + offset, bitmask data]
-+ */
-+ sort_relocs (vtr);
-+ num_relocs = 0;
-+ sec_size = 0;
-+ {
-+ CopyEntry *e;
-+ for (e = vtr->sorted; e; e = e->next)
-+ {
-+ sec_size += 3; /* Word entries. */
-+ num_relocs += 2;
-+ }
-+ }
-+ /*
-+ Finally:
-+ + build new custom section
-+ + emit new relocations for it ...
-+ */
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ bfd_size_type rel_size;
-+ bfd_size_type size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+
-+ {
-+ unsigned int entry_size;
-+ entry_size = (bed->s->arch_size / 8);
-+ /* + 1 for null termination */
-+ vtreloc_sec->size = (sec_size + 1) * entry_size;
-+ vtreloc_sec->contents = bfd_zalloc (dynobj, vtreloc_sec->size);
-+// if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+// return FALSE;
-+ }
-+
-+ rel_size = bed->s->sizeof_rel;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ }
-+
-+ size = rel_size * num_relocs;
-+ fprintf (stderr, "Need %ld bytes of relocs rel-size %ld\n",
-+ size, rel_size);
-+ vtrelrel->size = size;
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".vtrelocs");
-+/* FIXME - foo !
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE; */
-+ }
-+ return TRUE;
-+}
-+
-+static void
-+generate_reloc (bfd *dynobj,
-+ struct elf_link_hash_entry *target,
-+ asection *vtreloc_sec,
-+ asection *vtrelrel,
-+ bfd_vma num_entry,
-+ int is_dest,
-+ bfd_size_type *adjust_relative)
-+{
-+ bfd_size_type sym_idx, rel_size;
-+ reloc_howto_type *howto;
-+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-+ bfd_byte *loc;
-+ Elf_Internal_Rela outrel;
-+ const struct elf_backend_data *bed;
-+
-+ bed = get_elf_backend_data (dynobj);
-+
-+ rel_size = bed->s->sizeof_rel;
-+ swap_out = bed->s->swap_reloc_out;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ swap_out = bed->s->swap_reloca_out;
-+ }
-+
-+ /* XXX: unwind this goodness etc. */
-+ while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link;
-+
-+ fprintf (stderr, "Reloc '%s' %d %d %d %d i:%ld ",
-+ target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ fprintf (stderr, "'%s' vma 0x%lx offset %ld output off %ld\n",
-+ target->root.u.def.section->name,
-+ target->root.u.def.section->output_section->vma,
-+ target->root.u.def.value,
-+ target->root.u.def.section->output_offset);
-+ else
-+ fprintf (stderr, "\n");
-+
-+ /* XXX: RELOC64 too */
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ { /* do a relative reloc ... */
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_386_RELATIVE);
-+ sym_idx = 0;
-+ BFD_ASSERT (target->root.type == bfd_link_hash_defweak);
-+ *adjust_relative = (target->root.u.def.section->output_section->vma +
-+ target->root.u.def.section->output_offset);
-+ }
-+ else
-+ {
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_32);
-+ sym_idx = target->dynindx;
-+ *adjust_relative = 0;
-+ }
-+
-+ /* generate relocation */
-+ outrel.r_offset = vtreloc_sec->output_section->vma;
-+ outrel.r_offset += num_entry * 3 * 4; // XXX: 4 ?
-+ if (is_dest) outrel.r_offset += 4; // XXX: 4
-+ outrel.r_info = ELF32_R_INFO (sym_idx, howto->type);
-+ outrel.r_addend = 0;
-+
-+ loc = vtrelrel->contents + (vtrelrel->reloc_count++ * rel_size);
-+ swap_out (dynobj, &outrel, loc);
-+}
-+
-+bfd_boolean _bfd_elf_vtreloc_fill (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+
-+ fprintf (stderr, "Foo: generate .suse.vtrelocs relocs\n");
-+
-+ if (info->vtreloc)
-+ {
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ CopyEntry *e;
-+ bfd_size_type entries, adjust_relative, entry_size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ bfd_byte *data;
-+
-+ entry_size = (bed->s->arch_size / 8);
-+
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+ if (!vtrelrel->contents)
-+ {
-+ fprintf (stderr, "Nothing allocated for relocs\n");
-+ return FALSE;
-+ }
-+
-+ BFD_ASSERT (vtreloc_sec->output_offset == 0);
-+ entries = 0;
-+ vtrelrel->reloc_count = 0;
-+ data = vtreloc_sec->contents;
-+ for (e = global_vtr->sorted; e; e = e->next)
-+ {
-+ /* Source */
-+ generate_reloc (output_bfd, e->src, vtreloc_sec, vtrelrel,
-+ entries, FALSE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->src_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ /* Dest */
-+ generate_reloc (output_bfd, e->dest, vtreloc_sec, vtrelrel,
-+ entries, TRUE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->dest_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ bfd_put(bed->s->arch_size, dynobj, e->bitmask, data);
-+ data += entry_size;
-+
-+ entries++;
-+ }
-+ BFD_ASSERT (vtrelrel->reloc_count * (bed->default_use_rela_p ? bed->s->sizeof_rela : bed->s->sizeof_rel)
-+ == vtrelrel->size);
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ fprintf (stderr, "TESTME: exclude .vtrelocs if none present\n");
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ }
-+ return TRUE;
-+}
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf.c binutils-2.17.50/bfd/elf.c
---- pristine-binutils-2.17.50/bfd/elf.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf.c 2008-01-09 17:04:17.000000000 +0000
-@@ -1240,6 +1240,7 @@
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
- case DT_GNU_HASH: name = "GNU_HASH"; break;
-+ case DT_SUSE_VTRELOC: name = "SUSE_VTRELOC"; break;
- }
-
- fprintf (f, " %-11s ", name);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c binutils-2.17.50/bfd/elflink.c
---- pristine-binutils-2.17.50/bfd/elflink.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c 2008-01-15 15:50:27.000000000 +0000
-@@ -148,6 +148,34 @@
- return TRUE;
- }
-
-+static int
-+_bfd_elf_create_vtreloc_sections (struct bfd_link_info *info)
-+{
-+ bfd *abfd;
-+ asection *s;
-+ flagword flags;
-+ const struct elf_backend_data *bed;
-+
-+ abfd = elf_hash_table (info)->dynobj;
-+ bed = get_elf_backend_data (abfd);
-+ flags = bed->dynamic_sec_flags;
-+
-+ s = bfd_make_section (abfd, ".suse.vtrelocs");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+ s = bfd_make_section (abfd, ".rel.suse.vtrelocs");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY
-+ | SEC_HAS_CONTENTS
-+ | SEC_IN_MEMORY | SEC_LINKER_CREATED)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+
-+ return TRUE;
-+}
-+
- /* Create some sections which will be filled in with dynamic linking
- information. ABFD is an input file which requires dynamic sections
- to be created. The dynamic sections take up virtual memory space
-@@ -2266,6 +2294,7 @@
- return FALSE;
-
- elf_section_data (o)->rel_hashes = p;
-+ fprintf (stderr, "allocated rel_hashes for asec %p\n", o);
- }
-
- return TRUE;
-@@ -3291,7 +3320,25 @@
- bed = get_elf_backend_data (abfd);
-
- if ((abfd->flags & DYNAMIC) == 0)
-+ {
-+ asection *vtrel_sec;
-+
- dynamic = FALSE;
-+
-+ vtrel_sec = bfd_get_section_by_name (abfd, ".vtrelocs");
-+ if (vtrel_sec)
-+ {
-+ fprintf (stderr, "Has vtrelocs ! %d\n", (int)vtrel_sec->size);
-+ if (!info->vtreloc)
-+ {
-+ info->vtreloc = 1;
-+ if (!_bfd_elf_create_vtreloc_sections (info))
-+ goto error_return;
-+ }
-+/* FIXME: quick hack here ...
-+ vtrel_sec->flags |= SEC_EXCLUDE; */
-+ }
-+ }
- else
- {
- dynamic = TRUE;
-@@ -3603,6 +3650,7 @@
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
-+/* FIXME: cut/paste this ! ....*/
- symcount = hdr->sh_size / bed->s->sizeof_sym;
-
- /* The sh_info field of the symtab header tells us where the
-@@ -4978,8 +5026,14 @@
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
-+ fprintf (stderr, "add_symbols from %s object '%s'\n",
-+ abfd->flags & DYNAMIC ? "dynamic" : "static",
-+ abfd->filename);
-+ // from an .o or .so file ...
- return elf_link_add_object_symbols (abfd, info);
- case bfd_archive:
-+ fprintf (stderr, "add_symbols from archive '%s'\n", abfd->filename);
-+ // from a .a file ...
- return elf_link_add_archive_symbols (abfd, info);
- default:
- bfd_set_error (bfd_error_wrong_format);
-@@ -5372,6 +5426,8 @@
- }
- }
-
-+ _bfd_elf_vtreloc_accumulate (output_bfd, info);
-+
- /* Any syms created from now on start with -1 in
- got.refcount/offset and plt.refcount/offset. */
- elf_hash_table (info)->init_got_refcount
-@@ -5652,6 +5708,13 @@
- return FALSE;
- }
-
-+ s = bfd_get_section_by_name (output_bfd, ".suse.vtrelocs");
-+ if (s != NULL)
-+ {
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+ return FALSE;
-+ }
-+
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
-@@ -7159,6 +7222,8 @@
- size_t symbuf_size;
- /* And same for symshndxbuf. */
- size_t shndxbuf_size;
-+ /* .suse.vtreloc section. */
-+ asection *vtreloc_sec;
- };
-
- /* This struct is used to pass information to elf_link_output_extsym. */
-@@ -7902,6 +7967,8 @@
- bfd_vma r_type_mask;
- int r_sym_shift;
-
-+ fprintf (stderr, "elf_link_adjust_relocs ... %p\n", rel_hash);
-+
- if (rel_hdr->sh_entsize == bed->s->sizeof_rel)
- {
- swap_in = bed->s->swap_reloc_in;
-@@ -10038,6 +10105,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.vtreloc_sec = NULL;
- }
- else
- {
-@@ -10045,6 +10113,7 @@
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
-+ finfo.vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
-@@ -10104,6 +10173,10 @@
- max_sym_count = 0;
- max_sym_shndx_count = 0;
- merged = FALSE;
-+
-+ if (dynobj && !info->relocatable)
-+ _bfd_elf_vtreloc_fill (finfo.output_bfd, info);
-+
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct bfd_elf_section_data *esdo = elf_section_data (o);
-@@ -10732,6 +10805,10 @@
- if ((o->flags & SEC_RELOC) == 0)
- continue;
-
-+ fprintf (stderr, "rel_hashes for asec %p is %d, %p\n", o,
-+ (int)elf_section_data (o)->rel_count,
-+ elf_section_data (o)->rel_hashes);
-+
- elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
- elf_section_data (o)->rel_count,
- elf_section_data (o)->rel_hashes);
-@@ -10869,6 +10946,11 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_SUSE_VTRELOC:
-+ name = ".suse.vtrelocs";
-+ o = bfd_get_section_by_name (abfd, name);
-+ fprintf (stderr, "got section vma at 0x%x\n", o->vma);
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-@@ -11129,6 +11211,8 @@
- bfd_boolean is_eh;
- asection *group_sec;
-
-+/* #warning "Do we want to ignore relocs inside .suse.vtreloc ?" */
-+
- sec->gc_mark = 1;
-
- /* Mark all the sections in the group. */
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c~ binutils-2.17.50/bfd/elflink.c~
---- pristine-binutils-2.17.50/bfd/elflink.c~ 2008-01-09 12:42:12.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c~ 2008-01-14 14:28:26.000000000 +0000
-@@ -5707,6 +5707,13 @@
- return FALSE;
- }
-
-+ s = bfd_get_section_by_name (output_bfd, ".suse.vtrelocs");
-+ if (s != NULL)
-+ {
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+ return FALSE;
-+ }
-+
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
-@@ -10097,6 +10104,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.vtreloc_sec = NULL;
- }
- else
- {
-@@ -10104,6 +10112,7 @@
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
-+ finfo.vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
-@@ -10937,7 +10946,9 @@
- name = ".gnu.version_r";
- goto get_vma;
- case DT_SUSE_VTRELOC:
-- name = ".suse.vtreloc";
-+ name = ".suse.vtrelocs";
-+ o = bfd_get_section_by_name (abfd, name);
-+ fprintf (stderr, "got section vma at 0x%x\n", o->vma);
- goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/bfdlink.h binutils-2.17.50/include/bfdlink.h
---- pristine-binutils-2.17.50/include/bfdlink.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/bfdlink.h 2008-01-09 17:04:17.000000000 +0000
-@@ -293,6 +293,10 @@
- /* TRUE if the new ELF dynamic tags are enabled. */
- unsigned int new_dtags: 1;
-
-+ /* TRUE if we want to produce copy-based vtable relocation
-+ data. This saves both space and time. */
-+ unsigned int vtreloc: 1;
-+
- /* TRUE if non-PLT relocs should be merged into one reloc section
- and sorted so that relocs against the same symbol come together. */
- unsigned int combreloc: 1;
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/elf/common.h binutils-2.17.50/include/elf/common.h
---- pristine-binutils-2.17.50/include/elf/common.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/elf/common.h 2008-01-09 17:04:17.000000000 +0000
-@@ -624,6 +624,13 @@
- #define DT_USED 0x7ffffffe
- #define DT_FILTER 0x7fffffff
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-
- /* Values used in DT_FEATURE .dynamic entry. */
- #define DTF_1_PARINIT 0x00000001
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/ldmain.c binutils-2.17.50/ld/ldmain.c
---- pristine-binutils-2.17.50/ld/ldmain.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/ldmain.c 2008-01-09 17:04:17.000000000 +0000
-@@ -1105,6 +1105,7 @@
- asection *section,
- bfd_vma value)
- {
-+ fprintf (stderr, "add_to_set '%s'\n", h->root.string);
- if (config.warn_constructors)
- einfo (_("%P: warning: global constructor %s used\n"),
- h->root.string);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/lexsup.c binutils-2.17.50/ld/lexsup.c
---- pristine-binutils-2.17.50/ld/lexsup.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/lexsup.c 2008-01-09 17:04:17.000000000 +0000
-@@ -157,6 +157,7 @@
- OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
- OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
- OPTION_PIE,
-+ OPTION_VTRELOC,
- OPTION_UNRESOLVED_SYMBOLS,
- OPTION_WARN_UNRESOLVED_SYMBOLS,
- OPTION_ERROR_UNRESOLVED_SYMBOLS,
-@@ -409,6 +410,8 @@
- { {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED},
- '\0', NULL, N_("Do not allow unresolved references in object files"),
- TWO_DASHES },
-+ { {"vtreloc", no_argument, NULL, OPTION_VTRELOC},
-+ '\0', NULL, N_("Build vtable copy reloc data"), TWO_DASHES },
- { {"allow-shlib-undefined", no_argument, NULL, OPTION_ALLOW_SHLIB_UNDEFINED},
- '\0', NULL, N_("Allow unresolved references in shared libaries"),
- TWO_DASHES },
-@@ -1171,6 +1174,9 @@
- case OPTION_DEFAULT_SCRIPT:
- command_line.default_script = optarg;
- break;
-+ case OPTION_VTRELOC:
-+ link_info.vtreloc = TRUE;
-+ break;
- case OPTION_SECTION_START:
- {
- char *optarg2;
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/scripttempl/elf.sc binutils-2.17.50/ld/scripttempl/elf.sc
---- pristine-binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-15 15:42:22.000000000 +0000
-@@ -285,6 +285,7 @@
- eval $COMBRELOCCAT <<EOF
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
-+ .rel.suse.vtrelocs ${RELOCATING-0} : { *(.rel.suse.vtrelocs) }
- .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
- .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
-@@ -321,7 +322,7 @@
- {
- EOF
- sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
--cat <<EOF
-+cat <<EOF
- }
- .rela.dyn ${RELOCATING-0} :
- {
-@@ -410,6 +411,16 @@
- ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
- .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
-
-+ /* Virtual table copy relocation tables */
-+ __vtrelocs = .;
-+ .suse.vtrelocs :
-+ {
-+ KEEP (*(.suse.vtrelocs))
-+ /* FIXME: hack to avoid getting hurt by tmp.
-+ relocs into these sections */
-+ KEEP (*(.vtrelocs))
-+ }
-+
- ${RELOCATING+${DATARELRO}}
- ${OTHER_RELRO_SECTIONS}
- ${TEXT_DYNAMIC-${DYNAMIC}}
---- /dev/null 2007-09-21 22:50:58.000000000 +0100
-+++ binutils-2.17.50/bfd/elf-vtreloc.c 2008-01-15 15:40:27.000000000 +0000
-@@ -0,0 +1,596 @@
-+#include "sysdep.h"
-+#include "bfd.h"
-+#include "sysdep.h"
-+#include "bfdlink.h"
-+#include "libbfd.h"
-+#define ARCH_SIZE 0
-+#include "elf-bfd.h"
-+#include "safe-ctype.h"
-+#include "libiberty.h"
-+
-+typedef struct _CopyEntry CopyEntry;
-+
-+typedef struct {
-+ bfd *abfd;
-+ CopyEntry *sorted;
-+ CopyEntry *unsorted;
-+} VtRelocs;
-+
-+struct _CopyEntry {
-+ struct elf_link_hash_entry *src;
-+ bfd_vma src_offset;
-+ struct elf_link_hash_entry *dest;
-+ bfd_vma dest_offset;
-+ bfd_vma bitmask;
-+
-+ /* chain */
-+ CopyEntry *next;
-+};
-+
-+static void
-+prepend (CopyEntry **list, CopyEntry *p)
-+{
-+ p->next = *list;
-+ *list = p;
-+}
-+
-+static int
-+copy_entry_equal (const CopyEntry *a, const CopyEntry *b)
-+{
-+ return (a->src == b->src &&
-+ a->src_offset == b->src_offset &&
-+ a->dest == b->dest &&
-+ a->dest_offset == b->dest_offset &&
-+ a->bitmask == b->bitmask);
-+}
-+
-+/*
-+ * FIXME - should be a hash lookup / something fast.
-+ */
-+static CopyEntry *
-+find_with_dest (CopyEntry *list,
-+ struct elf_link_hash_entry *e)
-+{
-+ while (list)
-+ {
-+ if (list->dest == e)
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+static CopyEntry *
-+find_equal_entry (CopyEntry *list, CopyEntry *e)
-+{
-+ while (list)
-+ {
-+ if (copy_entry_equal (list, e))
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+/*
-+ * Transfer from unsorted -> sorted.
-+ * NB. simple-minded algorithm, N^3 with degenerate case
-+ */
-+static void
-+sort_relocs (VtRelocs *vtr)
-+{
-+ CopyEntry *p;
-+ CopyEntry *pending;
-+ CopyEntry *next;
-+
-+ fprintf (stderr, "Sorting ...");
-+ do
-+ {
-+ pending = NULL;
-+
-+ for (p = vtr->unsorted; p; p = next)
-+ {
-+ next = p->next;
-+ if (!find_with_dest (vtr->unsorted, p->src))
-+ {
-+ /* FIXME: sorting by offset, to ensure as
-+ good as possible contiguous access will
-+ require a more complex node structure:
-+ with aggregation per 'dest', and
-+ internal sorting within that */
-+ prepend (&vtr->sorted, p);
-+ }
-+ else
-+ prepend (&pending, p);
-+ }
-+ vtr->unsorted = pending;
-+ }
-+ while (pending);
-+ fprintf (stderr, " done\n");
-+}
-+
-+static void
-+check_reloc (Elf_Internal_Rela *rel, int type_mask)
-+{
-+ if ((rel->r_info & type_mask) != STT_OBJECT)
-+ fprintf (stderr, "broken vtreloc type\n");
-+ if (rel->r_addend != 0)
-+ fprintf (stderr, "unexpected reloc addend\n");
-+}
-+
-+static void
-+print_rel (const char *type,
-+ struct elf_link_hash_entry *target)
-+{
-+ fprintf (stderr, "%s '%s' %d %d %d %d i:%ld\n",
-+ type, target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+}
-+
-+static void
-+add_reloc (VtRelocs *vtr,
-+ bfd *inputobj,
-+ Elf_Internal_Rela *src_rel,
-+ Elf_Internal_Rela *dest_rel,
-+ unsigned char *data)
-+{
-+ unsigned r_sym_shift;
-+ unsigned r_type_mask;
-+ unsigned incr;
-+ unsigned symidx;
-+ const struct elf_backend_data *bed;
-+ struct elf_link_hash_entry *dest, *src;
-+ Elf_Internal_Shdr *hdr;
-+ CopyEntry *e;
-+
-+ hdr = &elf_tdata (inputobj)->symtab_hdr;
-+ bed = get_elf_backend_data (inputobj);
-+ if (bed->s->arch_size == 32)
-+ {
-+ r_type_mask = 0xff;
-+ r_sym_shift = 8;
-+ incr = 4;
-+ }
-+ else
-+ {
-+ r_type_mask = 0xffffffff;
-+ r_sym_shift = 32;
-+ incr = 8;
-+ }
-+
-+ check_reloc (src_rel, r_type_mask);
-+ check_reloc (dest_rel, r_type_mask);
-+
-+/*
-+#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
-+#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
-+ Elf
-+ cf. RELOC_FOR_GLOBAL_SYMBOL ...
-+*/
-+
-+ symidx = (dest_rel->r_info >> r_sym_shift);
-+ fprintf (stderr, "symidx %d (-%d)!\n", symidx, hdr->sh_info);
-+
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local dest symbol !");
-+ return;
-+ }
-+
-+ symidx -= hdr->sh_info;
-+ dest = elf_sym_hashes (inputobj) [symidx];
-+ if (!dest) {
-+ fprintf (stderr, "no rel %d!\n", symidx);
-+ return;
-+ }
-+
-+ /* Eliminate relocs to no longer present internal vtables. */
-+ if (!dest->def_regular)
-+ {
-+ print_rel ("Abandoning dest", dest);
-+ fprintf (stderr, "Ref count %ld %ld dynindx %d\n",
-+ dest->got.refcount, dest->plt.refcount,
-+ (int) dest->dynindx);
-+ /* unref the symbol somehow (!?) */
-+ return;
-+ }
-+
-+ // FIXME: do we need something like this for indirect / warnings !?
-+/* while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link; */
-+ fprintf (stderr, "dest link type %d\n", dest->root.type);
-+ if (dest->root.type == bfd_link_hash_undefined ||
-+ dest->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined dest sym '%s'\n", dest->root.root.string);
-+ return;
-+ }
-+
-+ /* Consider: should we eliminate all internal -> internal
-+ copies ? it's possible we are more space / time
-+ efficient - so no for now. */
-+
-+ symidx = (src_rel->r_info >> r_sym_shift);
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local src symbol !");
-+ return;
-+ }
-+ symidx -= hdr->sh_info;
-+ src = elf_sym_hashes (inputobj) [symidx];
-+ if (src->root.type == bfd_link_hash_undefined ||
-+ src->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined src sym '%s'\n", src->root.root.string);
-+ return;
-+ }
-+
-+ print_rel ("Src", src);
-+ print_rel ("Dst", dest);
-+
-+ e = bfd_zalloc (vtr->abfd, sizeof (CopyEntry));
-+
-+ e->src = src;
-+ e->dest = dest;
-+
-+ if (dest_rel->r_offset - src_rel->r_offset != bed->s->arch_size / 8)
-+ fprintf (stderr, "Mis-paired vtrelocs\n");
-+
-+ e->src_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->dest_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->bitmask = bfd_get (bed->s->arch_size, inputobj, data);
-+
-+ /* Simple minded dupliates elision */
-+ if (find_equal_entry (vtr->unsorted, e))
-+ bfd_release (vtr->abfd, e);
-+ else
-+ {
-+ prepend (&vtr->unsorted, e);
-+
-+ fprintf (stderr, "Copy: '%s'+%d -> '%s'+%d (0x%x)\n",
-+ e->src->root.root.string,
-+ (int)e->src_offset,
-+ e->dest->root.root.string,
-+ (int)e->dest_offset,
-+ (int)e->bitmask);
-+ }
-+}
-+
-+static VtRelocs *global_vtr;
-+
-+bfd_boolean _bfd_elf_vtreloc_accumulate (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+ if (info->vtreloc)
-+ { // .vtrelocs
-+ bfd_size_type sec_size = 0;
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+ bfd *inputobj;
-+ VtRelocs *vtr;
-+ Elf_Internal_Rela last_rela;
-+ bfd_size_type num_relocs;
-+
-+ vtr = bfd_zalloc (output_bfd, sizeof (VtRelocs));
-+ vtr->abfd = output_bfd;
-+ global_vtr = vtr;
-+
-+ /* FIXME: we need to elide relocs that turn out
-+ to be purely internal:
-+ eg. internal -> internal copy src / dest,
-+ others are less troublesome - though removing
-+ empty ones would be nice (?).
-+ We want to trap every -named- reloc ...
-+ */
-+ for (inputobj = info->input_bfds;
-+ inputobj;
-+ inputobj = inputobj->link_next)
-+ {
-+ asection *s;
-+ struct bfd_elf_section_data *es; /* elf-bfd.h */
-+ unsigned i;
-+ Elf_Internal_Rela *relocs, *p;
-+ unsigned char *sec_data;
-+ long storage_needed;
-+ asymbol **symtab;
-+ long number_of_symbols;
-+ const struct elf_backend_data *bed = get_elf_backend_data (inputobj);
-+
-+ if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
-+ continue;
-+ s = bfd_get_section_by_name (inputobj, ".vtrelocs");
-+ if (!s)
-+ continue;
-+ /* XXX Hmm, this seems to generate many NONE relocs, probably from
-+ the original relocs to this section. Perhaps discard them
-+ earlier. */
-+ /* FIXME: we really don't want to keep these around, quick hack
-+ *** due to having relocs pointing to these sections */
-+ /* s->flags |= SEC_EXCLUDE; */
-+ es = elf_section_data (s);
-+ if (!es)
-+ continue;
-+
-+ if (!s->reloc_count)
-+ continue;
-+
-+ fprintf (stderr, "Relocs: size %d, count %d contents %p\n",
-+ (int)es->rel_hdr.sh_size, es->rel_count,
-+ s->contents);
-+
-+
-+ /* Can't find this info anywhere else for some reason: */
-+ p = relocs = _bfd_elf_link_read_relocs (inputobj, s, NULL, NULL,
-+ info->keep_memory);
-+
-+ /* Experimental stuff to get at the BFD relocs (translated back
-+ from the real ELF relocs. */
-+ storage_needed = bfd_get_symtab_upper_bound (inputobj);
-+ if (storage_needed <= 0)
-+ return FALSE;
-+ symtab = xmalloc (storage_needed);
-+ number_of_symbols = bfd_canonicalize_symtab (inputobj, symtab);
-+ if (number_of_symbols < 0)
-+ return FALSE;
-+
-+ if (! bed->s->slurp_reloc_table (inputobj, s, symtab, FALSE))
-+ return FALSE;
-+
-+ /* Now inputobj->relocation will contain BFD relocs. */
-+
-+ sec_data = bfd_malloc (es->this_hdr.sh_size);
-+
-+ /* Slurp the data */
-+ if (bfd_seek (inputobj, es->this_hdr.sh_offset, SEEK_SET) != 0)
-+ return FALSE;
-+ if (bfd_bread (sec_data, es->this_hdr.sh_size, inputobj) != es->this_hdr.sh_size)
-+ return FALSE;
-+
-+ if (es->this_hdr.sh_size % s->reloc_count != 0)
-+ fprintf (stderr, "ERROR: mismatching vtreloc sec & reloc count "
-+ "0x%x, 0x%x -> %d\n",
-+ (int)es->this_hdr.sh_size, (int)s->reloc_count,
-+ (int)es->this_hdr.sh_size % s->reloc_count);
-+
-+ /* Assumes an even number of relocs sorted by address ... */
-+ for (i = 0; i < s->reloc_count / 2; i++)
-+ {
-+ unsigned int entry_size;
-+ entry_size = (get_elf_backend_data (inputobj)->s->arch_size / 8) * 3;
-+
-+ last_rela = *p;
-+ add_reloc (vtr, inputobj, p, p + 1,
-+ sec_data + i * entry_size);
-+ p+=2;
-+ }
-+ free (sec_data);
-+ if (es->relocs != relocs)
-+ free (relocs);
-+ }
-+
-+ /* So - we need to sort these guys as we work out the sizes */
-+ /* We need to generate an internal list of XYZ type
-+ + eliminate all external -> external work ...
-+ + add all external -> internal copies to 'sorted' list
-+ + [ fool-proof GC roots ]
-+ + add other symbols to 'pending' list.
-+ + read / generate src: [symbol + offset, dest: sym + offset, bitmask data]
-+ */
-+ sort_relocs (vtr);
-+ num_relocs = 0;
-+ sec_size = 0;
-+ {
-+ CopyEntry *e;
-+ for (e = vtr->sorted; e; e = e->next)
-+ {
-+ sec_size += 3; /* Word entries. */
-+ num_relocs += 2;
-+ }
-+ }
-+ /*
-+ Finally:
-+ + build new custom section
-+ + emit new relocations for it ...
-+ */
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ bfd_size_type rel_size;
-+ bfd_size_type size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+
-+ {
-+ unsigned int entry_size;
-+ entry_size = (bed->s->arch_size / 8);
-+ /* + 1 for null termination */
-+ vtreloc_sec->size = (sec_size + 1) * entry_size;
-+ vtreloc_sec->contents = bfd_zalloc (dynobj, vtreloc_sec->size);
-+// if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+// return FALSE;
-+ }
-+
-+ rel_size = bed->s->sizeof_rel;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ }
-+
-+ size = rel_size * num_relocs;
-+ fprintf (stderr, "Need %ld bytes of relocs rel-size %ld\n",
-+ size, rel_size);
-+ vtrelrel->size = size;
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".vtrelocs");
-+/* FIXME - foo !
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE; */
-+ }
-+ return TRUE;
-+}
-+
-+static void
-+generate_reloc (bfd *dynobj,
-+ struct elf_link_hash_entry *target,
-+ asection *vtreloc_sec,
-+ asection *vtrelrel,
-+ bfd_vma num_entry,
-+ int is_dest,
-+ bfd_size_type *adjust_relative)
-+{
-+ bfd_size_type sym_idx, rel_size;
-+ reloc_howto_type *howto;
-+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-+ bfd_byte *loc;
-+ Elf_Internal_Rela outrel;
-+ const struct elf_backend_data *bed;
-+
-+ bed = get_elf_backend_data (dynobj);
-+
-+ rel_size = bed->s->sizeof_rel;
-+ swap_out = bed->s->swap_reloc_out;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ swap_out = bed->s->swap_reloca_out;
-+ }
-+
-+ /* XXX: unwind this goodness etc. */
-+ while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link;
-+
-+ fprintf (stderr, "Reloc '%s' %d %d %d %d i:%ld ",
-+ target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ fprintf (stderr, "'%s' vma 0x%lx offset %ld output off %ld\n",
-+ target->root.u.def.section->name,
-+ target->root.u.def.section->output_section->vma,
-+ target->root.u.def.value,
-+ target->root.u.def.section->output_offset);
-+ else
-+ fprintf (stderr, "\n");
-+
-+ /* XXX: RELOC64 too */
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ { /* do a relative reloc ... */
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_386_RELATIVE);
-+ sym_idx = 0;
-+ BFD_ASSERT (target->root.type == bfd_link_hash_defweak);
-+ *adjust_relative = (target->root.u.def.section->output_section->vma +
-+ target->root.u.def.section->output_offset);
-+ }
-+ else
-+ {
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_32);
-+ sym_idx = target->dynindx;
-+ *adjust_relative = 0;
-+ }
-+
-+ /* generate relocation */
-+ outrel.r_offset = vtreloc_sec->output_section->vma;
-+ outrel.r_offset += num_entry * 3 * 4; // XXX: 4 ?
-+ if (is_dest) outrel.r_offset += 4; // XXX: 4
-+ outrel.r_info = ELF32_R_INFO (sym_idx, howto->type);
-+ outrel.r_addend = 0;
-+
-+ loc = vtrelrel->contents + (vtrelrel->reloc_count++ * rel_size);
-+ swap_out (dynobj, &outrel, loc);
-+}
-+
-+bfd_boolean _bfd_elf_vtreloc_fill (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+
-+ fprintf (stderr, "Foo: generate .suse.vtrelocs relocs\n");
-+
-+ if (info->vtreloc)
-+ {
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ CopyEntry *e;
-+ bfd_size_type entries, adjust_relative, entry_size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ bfd_byte *data;
-+
-+ entry_size = (bed->s->arch_size / 8);
-+
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+ if (!vtrelrel->contents)
-+ {
-+ fprintf (stderr, "Nothing allocated for relocs\n");
-+ return FALSE;
-+ }
-+
-+ BFD_ASSERT (vtreloc_sec->output_offset == 0);
-+ entries = 0;
-+ vtrelrel->reloc_count = 0;
-+ data = vtreloc_sec->contents;
-+ for (e = global_vtr->sorted; e; e = e->next)
-+ {
-+ /* Source */
-+ generate_reloc (output_bfd, e->src, vtreloc_sec, vtrelrel,
-+ entries, FALSE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->src_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ /* Dest */
-+ generate_reloc (output_bfd, e->dest, vtreloc_sec, vtrelrel,
-+ entries, TRUE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->dest_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ bfd_put(bed->s->arch_size, dynobj, e->bitmask, data);
-+ data += entry_size;
-+
-+ entries++;
-+ }
-+ BFD_ASSERT (vtrelrel->reloc_count * (bed->default_use_rela_p ? bed->s->sizeof_rela : bed->s->sizeof_rel)
-+ == vtrelrel->size);
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ fprintf (stderr, "TESTME: exclude .vtrelocs if none present\n");
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ }
-+ return TRUE;
-+}
diff --git a/patches/test/binutils-vt-copy-3.diff b/patches/test/binutils-vt-copy-3.diff
deleted file mode 100644
index 972f10e03..000000000
--- a/patches/test/binutils-vt-copy-3.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf.c binutils-2.17.50/bfd/elf.c
---- pristine-binutils-2.17.50/bfd/elf.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf.c 2008-01-23 16:48:45.000000000 +0000
-@@ -1240,6 +1240,7 @@
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
- case DT_GNU_HASH: name = "GNU_HASH"; break;
-+ case DT_SUSE_VTRELOC: name = "SUSE_VTRELOC"; break;
- }
-
- fprintf (f, " %-11s ", name);
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c binutils-2.17.50/bfd/elflink.c
---- pristine-binutils-2.17.50/bfd/elflink.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c 2008-01-23 16:50:07.000000000 +0000
-@@ -5652,6 +5652,13 @@
- return FALSE;
- }
-
-+ s = bfd_get_section_by_name (output_bfd, ".suse.vtrelocs");
-+ if (s != NULL)
-+ {
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+ return FALSE;
-+ }
-+
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
-@@ -10869,6 +10876,10 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_SUSE_VTRELOC:
-+ name = ".suse.vtrelocs";
-+ o = bfd_get_section_by_name (abfd, name);
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/elf/common.h binutils-2.17.50/include/elf/common.h
---- pristine-binutils-2.17.50/include/elf/common.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/elf/common.h 2008-01-23 16:40:38.000000000 +0000
-@@ -624,6 +624,13 @@
- #define DT_USED 0x7ffffffe
- #define DT_FILTER 0x7fffffff
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-
- /* Values used in DT_FEATURE .dynamic entry. */
- #define DTF_1_PARINIT 0x00000001
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/scripttempl/elf.sc binutils-2.17.50/ld/scripttempl/elf.sc
---- pristine-binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-23 16:48:46.000000000 +0000
-@@ -285,6 +285,7 @@
- eval $COMBRELOCCAT <<EOF
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
-+ .rel.suse.vtrelocs ${RELOCATING-0} : { *(.rel.suse.vtrelocs) }
- .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
- .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
-@@ -410,6 +411,13 @@
- ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
- .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
-
-+ /* Virtual table copy relocation tables */
-+ .suse.vtrelocs :
-+ {
-+ KEEP (*(SORT(.vtrelocs.*)))
-+ QUAD(0)
-+ }
-+
- ${RELOCATING+${DATARELRO}}
- ${OTHER_RELRO_SECTIONS}
- ${TEXT_DYNAMIC-${DYNAMIC}}
diff --git a/patches/test/binutils-vt-copy.diff b/patches/test/binutils-vt-copy.diff
deleted file mode 100644
index 2160404c9..000000000
--- a/patches/test/binutils-vt-copy.diff
+++ /dev/null
@@ -1,1537 +0,0 @@
-0a1,593
-> #include "sysdep.h"
-> #include "bfd.h"
-> #include "sysdep.h"
-> #include "bfdlink.h"
-> #include "libbfd.h"
-> #define ARCH_SIZE 0
-> #include "elf-bfd.h"
-> #include "safe-ctype.h"
-> #include "libiberty.h"
->
-> typedef struct _CopyEntry CopyEntry;
->
-> typedef struct {
-> bfd *abfd;
-> CopyEntry *sorted;
-> CopyEntry *unsorted;
-> } VtRelocs;
->
-> struct _CopyEntry {
-> struct elf_link_hash_entry *src;
-> bfd_vma src_offset;
-> struct elf_link_hash_entry *dest;
-> bfd_vma dest_offset;
-> bfd_vma bitmask;
->
-> /* chain */
-> CopyEntry *next;
-> };
->
-> static void
-> prepend (CopyEntry **list, CopyEntry *p)
-> {
-> p->next = *list;
-> *list = p;
-> }
->
-> static int
-> copy_entry_equal (const CopyEntry *a, const CopyEntry *b)
-> {
-> return (a->src == b->src &&
-> a->src_offset == b->src_offset &&
-> a->dest == b->dest &&
-> a->dest_offset == b->dest_offset &&
-> a->bitmask == b->bitmask);
-> }
->
-> /*
-> * FIXME - should be a hash lookup / something fast.
-> */
-> static CopyEntry *
-> find_with_dest (CopyEntry *list,
-> struct elf_link_hash_entry *e)
-> {
-> while (list)
-> {
-> if (list->dest == e)
-> break;
-> list = list->next;
-> }
-> return list;
-> }
->
-> static CopyEntry *
-> find_equal_entry (CopyEntry *list, CopyEntry *e)
-> {
-> while (list)
-> {
-> if (copy_entry_equal (list, e))
-> break;
-> list = list->next;
-> }
-> return list;
-> }
->
-> /*
-> * Transfer from unsorted -> sorted.
-> * NB. simple-minded algorithm, N^3 with degenerate case
-> */
-> static void
-> sort_relocs (VtRelocs *vtr)
-> {
-> CopyEntry *p;
-> CopyEntry *pending;
-> CopyEntry *next;
->
-> fprintf (stderr, "Sorting ...");
-> do
-> {
-> pending = NULL;
->
-> for (p = vtr->unsorted; p; p = next)
-> {
-> next = p->next;
-> if (!find_with_dest (vtr->unsorted, p->src))
-> {
-> /* FIXME: sorting by offset, to ensure as
-> good as possible contiguous access will
-> require a more complex node structure:
-> with aggregation per 'dest', and
-> internal sorting within that */
-> prepend (&vtr->sorted, p);
-> }
-> else
-> prepend (&pending, p);
-> }
-> vtr->unsorted = pending;
-> }
-> while (pending);
-> fprintf (stderr, " done\n");
-> }
->
-> static void
-> check_reloc (Elf_Internal_Rela *rel, int type_mask)
-> {
-> if ((rel->r_info & type_mask) != STT_OBJECT)
-> fprintf (stderr, "broken vtreloc type\n");
-> if (rel->r_addend != 0)
-> fprintf (stderr, "unexpected reloc addend\n");
-> }
->
-> static void
-> print_rel (const char *type,
-> struct elf_link_hash_entry *target)
-> {
-> fprintf (stderr, "%s '%s' %d %d %d %d i:%ld\n",
-> type, target->root.root.string,
-> target->ref_regular, target->def_regular,
-> target->ref_dynamic, target->def_dynamic,
-> target->dynindx);
-> }
->
-> static void
-> add_reloc (VtRelocs *vtr,
-> bfd *inputobj,
-> Elf_Internal_Rela *src_rel,
-> Elf_Internal_Rela *dest_rel,
-> unsigned char *data)
-> {
-> unsigned r_sym_shift;
-> unsigned r_type_mask;
-> unsigned incr;
-> unsigned symidx;
-> const struct elf_backend_data *bed;
-> struct elf_link_hash_entry *dest, *src;
-> Elf_Internal_Shdr *hdr;
-> CopyEntry *e;
->
-> hdr = &elf_tdata (inputobj)->symtab_hdr;
-> bed = get_elf_backend_data (inputobj);
-> if (bed->s->arch_size == 32)
-> {
-> r_type_mask = 0xff;
-> r_sym_shift = 8;
-> incr = 4;
-> }
-> else
-> {
-> r_type_mask = 0xffffffff;
-> r_sym_shift = 32;
-> incr = 8;
-> }
->
-> check_reloc (src_rel, r_type_mask);
-> check_reloc (dest_rel, r_type_mask);
->
-> /*
-> #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
-> #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
-> Elf
-> cf. RELOC_FOR_GLOBAL_SYMBOL ...
-> */
->
-> symidx = (dest_rel->r_info >> r_sym_shift);
-> fprintf (stderr, "symidx %d (-%d)!\n", symidx, hdr->sh_info);
->
-> if (symidx < hdr->sh_info) // local symbol ...
-> {
-> fprintf (stderr, "Error/FIXME: local dest symbol !");
-> return;
-> }
->
-> symidx -= hdr->sh_info;
-> dest = elf_sym_hashes (inputobj) [symidx];
-> if (!dest) {
-> fprintf (stderr, "no rel %d!\n", symidx);
-> return;
-> }
->
-> /* Eliminate relocs to no longer present internal vtables. */
-> if (!dest->def_regular)
-> {
-> print_rel ("Abandoning dest", dest);
-> fprintf (stderr, "Ref count %ld %ld dynindx %d\n",
-> dest->got.refcount, dest->plt.refcount,
-> (int) dest->dynindx);
-> /* unref the symbol somehow (!?) */
-> return;
-> }
->
-> // FIXME: do we need something like this for indirect / warnings !?
-> /* while (target->root.type == bfd_link_hash_indirect
-> || target->root.type == bfd_link_hash_warning)
-> target = (struct elf_link_hash_entry *) target->root.u.i.link; */
-> fprintf (stderr, "dest link type %d\n", dest->root.type);
-> if (dest->root.type == bfd_link_hash_undefined ||
-> dest->root.type == bfd_link_hash_undefweak)
-> {
-> fprintf (stderr, "undefined dest sym '%s'\n", dest->root.root.string);
-> return;
-> }
->
-> /* Consider: should we eliminate all internal -> internal
-> copies ? it's possible we are more space / time
-> efficient - so no for now. */
->
-> symidx = (src_rel->r_info >> r_sym_shift);
-> if (symidx < hdr->sh_info) // local symbol ...
-> {
-> fprintf (stderr, "Error/FIXME: local src symbol !");
-> return;
-> }
-> symidx -= hdr->sh_info;
-> src = elf_sym_hashes (inputobj) [symidx];
-> if (src->root.type == bfd_link_hash_undefined ||
-> src->root.type == bfd_link_hash_undefweak)
-> {
-> fprintf (stderr, "undefined src sym '%s'\n", src->root.root.string);
-> return;
-> }
->
-> print_rel ("Src", src);
-> print_rel ("Dst", dest);
->
-> e = bfd_zalloc (vtr->abfd, sizeof (CopyEntry));
->
-> e->src = src;
-> e->dest = dest;
->
-> if (dest_rel->r_offset - src_rel->r_offset != bed->s->arch_size / 8)
-> fprintf (stderr, "Mis-paired vtrelocs\n");
->
-> e->src_offset = bfd_get (bed->s->arch_size, inputobj, data);
-> data += incr;
-> e->dest_offset = bfd_get (bed->s->arch_size, inputobj, data);
-> data += incr;
-> e->bitmask = bfd_get (bed->s->arch_size, inputobj, data);
->
-> /* Simple minded dupliates elision */
-> if (find_equal_entry (vtr->unsorted, e))
-> bfd_release (vtr->abfd, e);
-> else
-> {
-> prepend (&vtr->unsorted, e);
->
-> fprintf (stderr, "Copy: '%s'+%d -> '%s'+%d (0x%x)\n",
-> e->src->root.root.string,
-> (int)e->src_offset,
-> e->dest->root.root.string,
-> (int)e->dest_offset,
-> (int)e->bitmask);
-> }
-> }
->
-> static VtRelocs *global_vtr;
->
-> bfd_boolean _bfd_elf_vtreloc_accumulate (bfd *output_bfd,
-> struct bfd_link_info *info)
-> {
-> bfd *dynobj;
-> dynobj = elf_hash_table (info)->dynobj;
-> if (info->vtreloc)
-> { // .vtrelocs
-> bfd_size_type sec_size = 0;
-> asection *vtreloc_sec;
-> asection *vtrelrel;
-> bfd *inputobj;
-> VtRelocs *vtr;
-> Elf_Internal_Rela last_rela;
-> bfd_size_type num_relocs;
->
-> vtr = bfd_zalloc (output_bfd, sizeof (VtRelocs));
-> vtr->abfd = output_bfd;
-> global_vtr = vtr;
->
-> /* FIXME: we need to elide relocs that turn out
-> to be purely internal:
-> eg. internal -> internal copy src / dest,
-> others are less troublesome - though removing
-> empty ones would be nice (?).
-> We want to trap every -named- reloc ...
-> */
-> for (inputobj = info->input_bfds;
-> inputobj;
-> inputobj = inputobj->link_next)
-> {
-> asection *s;
-> struct bfd_elf_section_data *es; /* elf-bfd.h */
-> unsigned i;
-> Elf_Internal_Rela *relocs, *p;
-> unsigned char *sec_data;
-> long storage_needed;
-> asymbol **symtab;
-> long number_of_symbols;
-> const struct elf_backend_data *bed = get_elf_backend_data (inputobj);
->
-> if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
-> continue;
-> s = bfd_get_section_by_name (inputobj, ".vtrelocs");
-> if (!s)
-> continue;
-> /* XXX Hmm, this seems to generate many NONE relocs, probably from
-> the original relocs to this section. Perhaps discard them
-> earlier. */
-> s->flags |= SEC_EXCLUDE;
-> es = elf_section_data (s);
-> if (!es)
-> continue;
->
-> if (!s->reloc_count)
-> continue;
->
-> fprintf (stderr, "Relocs: size %d, count %d contents %p\n",
-> (int)es->rel_hdr.sh_size, es->rel_count,
-> s->contents);
->
->
-> /* Can't find this info anywhere else for some reason: */
-> p = relocs = _bfd_elf_link_read_relocs (inputobj, s, NULL, NULL,
-> info->keep_memory);
->
-> /* Experimental stuff to get at the BFD relocs (translated back
-> from the real ELF relocs. */
-> storage_needed = bfd_get_symtab_upper_bound (inputobj);
-> if (storage_needed <= 0)
-> return FALSE;
-> symtab = xmalloc (storage_needed);
-> number_of_symbols = bfd_canonicalize_symtab (inputobj, symtab);
-> if (number_of_symbols < 0)
-> return FALSE;
->
-> if (! bed->s->slurp_reloc_table (inputobj, s, symtab, FALSE))
-> return FALSE;
->
-> /* Now inputobj->relocation will contain BFD relocs. */
->
-> sec_data = bfd_malloc (es->this_hdr.sh_size);
->
-> /* Slurp the data */
-> if (bfd_seek (inputobj, es->this_hdr.sh_offset, SEEK_SET) != 0)
-> return FALSE;
-> if (bfd_bread (sec_data, es->this_hdr.sh_size, inputobj) != es->this_hdr.sh_size)
-> return FALSE;
->
-> if (es->this_hdr.sh_size % s->reloc_count != 0)
-> fprintf (stderr, "ERROR: mismatching vtreloc sec & reloc count "
-> "0x%x, 0x%x -> %d\n",
-> (int)es->this_hdr.sh_size, (int)s->reloc_count,
-> (int)es->this_hdr.sh_size % s->reloc_count);
->
-> /* Assumes an even number of relocs sorted by address ... */
-> for (i = 0; i < s->reloc_count / 2; i++)
-> {
-> unsigned int entry_size;
-> entry_size = (get_elf_backend_data (inputobj)->s->arch_size / 8) * 3;
->
-> last_rela = *p;
-> add_reloc (vtr, inputobj, p, p + 1,
-> sec_data + i * entry_size);
-> p+=2;
-> }
-> free (sec_data);
-> if (es->relocs != relocs)
-> free (relocs);
-> }
->
-> /* So - we need to sort these guys as we work out the sizes */
-> /* We need to generate an internal list of XYZ type
-> + eliminate all external -> external work ...
-> + add all external -> internal copies to 'sorted' list
-> + [ fool-proof GC roots ]
-> + add other symbols to 'pending' list.
-> + read / generate src: [symbol + offset, dest: sym + offset, bitmask data]
-> */
-> sort_relocs (vtr);
-> num_relocs = 0;
-> sec_size = 0;
-> {
-> CopyEntry *e;
-> for (e = vtr->sorted; e; e = e->next)
-> {
-> sec_size += 3; /* Word entries. */
-> num_relocs += 2;
-> }
-> }
-> /*
-> Finally:
-> + build new custom section
-> + emit new relocations for it ...
-> */
->
-> vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-> if (vtreloc_sec)
-> {
-> bfd_size_type rel_size;
-> bfd_size_type size;
-> const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-> vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-> if (!vtrelrel)
-> return FALSE;
->
-> {
-> unsigned int entry_size;
-> entry_size = (bed->s->arch_size / 8);
-> /* + 1 for null termination */
-> vtreloc_sec->size = (sec_size + 1) * entry_size;
-> vtreloc_sec->contents = bfd_zalloc (dynobj, vtreloc_sec->size);
-> // if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-> // return FALSE;
-> }
->
-> rel_size = bed->s->sizeof_rel;
-> if (bed->default_use_rela_p)
-> {
-> rel_size = bed->s->sizeof_rela;
-> }
->
-> size = rel_size * num_relocs;
-> fprintf (stderr, "Need %ld bytes of relocs rel-size %ld\n",
-> size, rel_size);
-> vtrelrel->size = size;
-> }
-> else
-> fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
->
-> }
-> else
-> {
-> asection *vtreloc_sec;
-> vtreloc_sec = bfd_get_section_by_name (dynobj, ".vtrelocs");
-> if (vtreloc_sec)
-> vtreloc_sec->flags |= SEC_EXCLUDE;
-> }
-> return TRUE;
-> }
->
-> static void
-> generate_reloc (bfd *dynobj,
-> struct elf_link_hash_entry *target,
-> asection *vtreloc_sec,
-> asection *vtrelrel,
-> bfd_vma num_entry,
-> int is_dest,
-> bfd_size_type *adjust_relative)
-> {
-> bfd_size_type sym_idx, rel_size;
-> reloc_howto_type *howto;
-> void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-> bfd_byte *loc;
-> Elf_Internal_Rela outrel;
-> const struct elf_backend_data *bed;
->
-> bed = get_elf_backend_data (dynobj);
->
-> rel_size = bed->s->sizeof_rel;
-> swap_out = bed->s->swap_reloc_out;
-> if (bed->default_use_rela_p)
-> {
-> rel_size = bed->s->sizeof_rela;
-> swap_out = bed->s->swap_reloca_out;
-> }
->
-> /* XXX: unwind this goodness etc. */
-> while (target->root.type == bfd_link_hash_indirect
-> || target->root.type == bfd_link_hash_warning)
-> target = (struct elf_link_hash_entry *) target->root.u.i.link;
->
-> fprintf (stderr, "Reloc '%s' %d %d %d %d i:%ld ",
-> target->root.root.string,
-> target->ref_regular, target->def_regular,
-> target->ref_dynamic, target->def_dynamic,
-> target->dynindx);
-> if (is_dest /* force relative */ || target->dynindx <= 0)
-> fprintf (stderr, "'%s' vma 0x%lx offset %ld output off %ld\n",
-> target->root.u.def.section->name,
-> target->root.u.def.section->output_section->vma,
-> target->root.u.def.value,
-> target->root.u.def.section->output_offset);
-> else
-> fprintf (stderr, "\n");
->
-> /* XXX: RELOC64 too */
-> if (is_dest /* force relative */ || target->dynindx <= 0)
-> { /* do a relative reloc ... */
-> howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_386_RELATIVE);
-> sym_idx = 0;
-> BFD_ASSERT (target->root.type == bfd_link_hash_defweak);
-> *adjust_relative = (target->root.u.def.section->output_section->vma +
-> target->root.u.def.section->output_offset);
-> }
-> else
-> {
-> howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_32);
-> sym_idx = target->dynindx;
-> *adjust_relative = 0;
-> }
->
-> /* generate relocation */
-> outrel.r_offset = vtreloc_sec->output_section->vma;
-> outrel.r_offset += num_entry * 3 * 4; // XXX: 4 ?
-> if (is_dest) outrel.r_offset += 4; // XXX: 4
-> outrel.r_info = ELF32_R_INFO (sym_idx, howto->type);
-> outrel.r_addend = 0;
->
-> loc = vtrelrel->contents + (vtrelrel->reloc_count++ * rel_size);
-> swap_out (dynobj, &outrel, loc);
-> }
->
-> bfd_boolean _bfd_elf_vtreloc_fill (bfd *output_bfd,
-> struct bfd_link_info *info)
-> {
-> bfd *dynobj;
-> dynobj = elf_hash_table (info)->dynobj;
->
-> fprintf (stderr, "Foo: generate .suse.vtrelocs relocs\n");
->
-> if (info->vtreloc)
-> {
-> asection *vtreloc_sec;
-> asection *vtrelrel;
->
-> vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-> if (vtreloc_sec)
-> {
-> CopyEntry *e;
-> bfd_size_type entries, adjust_relative, entry_size;
-> const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-> bfd_byte *data;
->
-> entry_size = (bed->s->arch_size / 8);
->
-> vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-> if (!vtrelrel)
-> return FALSE;
-> if (!vtrelrel->contents)
-> {
-> fprintf (stderr, "Nothing allocated for relocs\n");
-> return FALSE;
-> }
->
-> BFD_ASSERT (vtreloc_sec->output_offset == 0);
-> entries = 0;
-> vtrelrel->reloc_count = 0;
-> data = vtreloc_sec->contents;
-> for (e = global_vtr->sorted; e; e = e->next)
-> {
-> /* Source */
-> generate_reloc (output_bfd, e->src, vtreloc_sec, vtrelrel,
-> entries, FALSE, &adjust_relative);
-> bfd_put(bed->s->arch_size, output_bfd,
-> e->src_offset + adjust_relative, data);
-> data += entry_size;
->
-> /* Dest */
-> generate_reloc (output_bfd, e->dest, vtreloc_sec, vtrelrel,
-> entries, TRUE, &adjust_relative);
-> bfd_put(bed->s->arch_size, output_bfd,
-> e->dest_offset + adjust_relative, data);
-> data += entry_size;
->
-> bfd_put(bed->s->arch_size, dynobj, e->bitmask, data);
-> data += entry_size;
->
-> entries++;
-> }
-> BFD_ASSERT (vtrelrel->reloc_count * (bed->default_use_rela_p ? bed->s->sizeof_rela : bed->s->sizeof_rel)
-> == vtrelrel->size);
-> }
-> else
-> fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-> }
-> else
-> {
-> asection *vtreloc_sec;
-> fprintf (stderr, "TESTME: exclude .vtrelocs if none present\n");
-> vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-> if (vtreloc_sec)
-> vtreloc_sec->flags |= SEC_EXCLUDE;
-> vtreloc_sec = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-> if (vtreloc_sec)
-> vtreloc_sec->flags |= SEC_EXCLUDE;
-> }
-> return TRUE;
-> }
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf-bfd.h binutils-2.17.50/bfd/elf-bfd.h
---- pristine-binutils-2.17.50/bfd/elf-bfd.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf-bfd.h 2008-01-09 17:04:17.000000000 +0000
-@@ -1787,6 +1787,12 @@
- extern void _bfd_elf_init_2_index_sections
- (bfd *, struct bfd_link_info *);
-
-+/* elf-vtreloc */
-+extern bfd_boolean _bfd_elf_vtreloc_accumulate
-+ (bfd *, struct bfd_link_info *);
-+extern bfd_boolean _bfd_elf_vtreloc_fill
-+ (bfd *, struct bfd_link_info *);
-+
- extern bfd_boolean _bfd_elfcore_make_pseudosection
- (bfd *, char *, size_t, ufile_ptr);
- extern char *_bfd_elfcore_strndup
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf-vtreloc.c binutils-2.17.50/bfd/elf-vtreloc.c
---- pristine-binutils-2.17.50/bfd/elf-vtreloc.c 2008-01-09 16:54:44.000000000 +0000
-+++ binutils-2.17.50/bfd/elf-vtreloc.c 2008-01-14 15:07:15.000000000 +0000
-@@ -0,0 +1,593 @@
-+#include "sysdep.h"
-+#include "bfd.h"
-+#include "sysdep.h"
-+#include "bfdlink.h"
-+#include "libbfd.h"
-+#define ARCH_SIZE 0
-+#include "elf-bfd.h"
-+#include "safe-ctype.h"
-+#include "libiberty.h"
-+
-+typedef struct _CopyEntry CopyEntry;
-+
-+typedef struct {
-+ bfd *abfd;
-+ CopyEntry *sorted;
-+ CopyEntry *unsorted;
-+} VtRelocs;
-+
-+struct _CopyEntry {
-+ struct elf_link_hash_entry *src;
-+ bfd_vma src_offset;
-+ struct elf_link_hash_entry *dest;
-+ bfd_vma dest_offset;
-+ bfd_vma bitmask;
-+
-+ /* chain */
-+ CopyEntry *next;
-+};
-+
-+static void
-+prepend (CopyEntry **list, CopyEntry *p)
-+{
-+ p->next = *list;
-+ *list = p;
-+}
-+
-+static int
-+copy_entry_equal (const CopyEntry *a, const CopyEntry *b)
-+{
-+ return (a->src == b->src &&
-+ a->src_offset == b->src_offset &&
-+ a->dest == b->dest &&
-+ a->dest_offset == b->dest_offset &&
-+ a->bitmask == b->bitmask);
-+}
-+
-+/*
-+ * FIXME - should be a hash lookup / something fast.
-+ */
-+static CopyEntry *
-+find_with_dest (CopyEntry *list,
-+ struct elf_link_hash_entry *e)
-+{
-+ while (list)
-+ {
-+ if (list->dest == e)
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+static CopyEntry *
-+find_equal_entry (CopyEntry *list, CopyEntry *e)
-+{
-+ while (list)
-+ {
-+ if (copy_entry_equal (list, e))
-+ break;
-+ list = list->next;
-+ }
-+ return list;
-+}
-+
-+/*
-+ * Transfer from unsorted -> sorted.
-+ * NB. simple-minded algorithm, N^3 with degenerate case
-+ */
-+static void
-+sort_relocs (VtRelocs *vtr)
-+{
-+ CopyEntry *p;
-+ CopyEntry *pending;
-+ CopyEntry *next;
-+
-+ fprintf (stderr, "Sorting ...");
-+ do
-+ {
-+ pending = NULL;
-+
-+ for (p = vtr->unsorted; p; p = next)
-+ {
-+ next = p->next;
-+ if (!find_with_dest (vtr->unsorted, p->src))
-+ {
-+ /* FIXME: sorting by offset, to ensure as
-+ good as possible contiguous access will
-+ require a more complex node structure:
-+ with aggregation per 'dest', and
-+ internal sorting within that */
-+ prepend (&vtr->sorted, p);
-+ }
-+ else
-+ prepend (&pending, p);
-+ }
-+ vtr->unsorted = pending;
-+ }
-+ while (pending);
-+ fprintf (stderr, " done\n");
-+}
-+
-+static void
-+check_reloc (Elf_Internal_Rela *rel, int type_mask)
-+{
-+ if ((rel->r_info & type_mask) != STT_OBJECT)
-+ fprintf (stderr, "broken vtreloc type\n");
-+ if (rel->r_addend != 0)
-+ fprintf (stderr, "unexpected reloc addend\n");
-+}
-+
-+static void
-+print_rel (const char *type,
-+ struct elf_link_hash_entry *target)
-+{
-+ fprintf (stderr, "%s '%s' %d %d %d %d i:%ld\n",
-+ type, target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+}
-+
-+static void
-+add_reloc (VtRelocs *vtr,
-+ bfd *inputobj,
-+ Elf_Internal_Rela *src_rel,
-+ Elf_Internal_Rela *dest_rel,
-+ unsigned char *data)
-+{
-+ unsigned r_sym_shift;
-+ unsigned r_type_mask;
-+ unsigned incr;
-+ unsigned symidx;
-+ const struct elf_backend_data *bed;
-+ struct elf_link_hash_entry *dest, *src;
-+ Elf_Internal_Shdr *hdr;
-+ CopyEntry *e;
-+
-+ hdr = &elf_tdata (inputobj)->symtab_hdr;
-+ bed = get_elf_backend_data (inputobj);
-+ if (bed->s->arch_size == 32)
-+ {
-+ r_type_mask = 0xff;
-+ r_sym_shift = 8;
-+ incr = 4;
-+ }
-+ else
-+ {
-+ r_type_mask = 0xffffffff;
-+ r_sym_shift = 32;
-+ incr = 8;
-+ }
-+
-+ check_reloc (src_rel, r_type_mask);
-+ check_reloc (dest_rel, r_type_mask);
-+
-+/*
-+#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
-+#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
-+ Elf
-+ cf. RELOC_FOR_GLOBAL_SYMBOL ...
-+*/
-+
-+ symidx = (dest_rel->r_info >> r_sym_shift);
-+ fprintf (stderr, "symidx %d (-%d)!\n", symidx, hdr->sh_info);
-+
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local dest symbol !");
-+ return;
-+ }
-+
-+ symidx -= hdr->sh_info;
-+ dest = elf_sym_hashes (inputobj) [symidx];
-+ if (!dest) {
-+ fprintf (stderr, "no rel %d!\n", symidx);
-+ return;
-+ }
-+
-+ /* Eliminate relocs to no longer present internal vtables. */
-+ if (!dest->def_regular)
-+ {
-+ print_rel ("Abandoning dest", dest);
-+ fprintf (stderr, "Ref count %ld %ld dynindx %d\n",
-+ dest->got.refcount, dest->plt.refcount,
-+ (int) dest->dynindx);
-+ /* unref the symbol somehow (!?) */
-+ return;
-+ }
-+
-+ // FIXME: do we need something like this for indirect / warnings !?
-+/* while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link; */
-+ fprintf (stderr, "dest link type %d\n", dest->root.type);
-+ if (dest->root.type == bfd_link_hash_undefined ||
-+ dest->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined dest sym '%s'\n", dest->root.root.string);
-+ return;
-+ }
-+
-+ /* Consider: should we eliminate all internal -> internal
-+ copies ? it's possible we are more space / time
-+ efficient - so no for now. */
-+
-+ symidx = (src_rel->r_info >> r_sym_shift);
-+ if (symidx < hdr->sh_info) // local symbol ...
-+ {
-+ fprintf (stderr, "Error/FIXME: local src symbol !");
-+ return;
-+ }
-+ symidx -= hdr->sh_info;
-+ src = elf_sym_hashes (inputobj) [symidx];
-+ if (src->root.type == bfd_link_hash_undefined ||
-+ src->root.type == bfd_link_hash_undefweak)
-+ {
-+ fprintf (stderr, "undefined src sym '%s'\n", src->root.root.string);
-+ return;
-+ }
-+
-+ print_rel ("Src", src);
-+ print_rel ("Dst", dest);
-+
-+ e = bfd_zalloc (vtr->abfd, sizeof (CopyEntry));
-+
-+ e->src = src;
-+ e->dest = dest;
-+
-+ if (dest_rel->r_offset - src_rel->r_offset != bed->s->arch_size / 8)
-+ fprintf (stderr, "Mis-paired vtrelocs\n");
-+
-+ e->src_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->dest_offset = bfd_get (bed->s->arch_size, inputobj, data);
-+ data += incr;
-+ e->bitmask = bfd_get (bed->s->arch_size, inputobj, data);
-+
-+ /* Simple minded dupliates elision */
-+ if (find_equal_entry (vtr->unsorted, e))
-+ bfd_release (vtr->abfd, e);
-+ else
-+ {
-+ prepend (&vtr->unsorted, e);
-+
-+ fprintf (stderr, "Copy: '%s'+%d -> '%s'+%d (0x%x)\n",
-+ e->src->root.root.string,
-+ (int)e->src_offset,
-+ e->dest->root.root.string,
-+ (int)e->dest_offset,
-+ (int)e->bitmask);
-+ }
-+}
-+
-+static VtRelocs *global_vtr;
-+
-+bfd_boolean _bfd_elf_vtreloc_accumulate (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+ if (info->vtreloc)
-+ { // .vtrelocs
-+ bfd_size_type sec_size = 0;
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+ bfd *inputobj;
-+ VtRelocs *vtr;
-+ Elf_Internal_Rela last_rela;
-+ bfd_size_type num_relocs;
-+
-+ vtr = bfd_zalloc (output_bfd, sizeof (VtRelocs));
-+ vtr->abfd = output_bfd;
-+ global_vtr = vtr;
-+
-+ /* FIXME: we need to elide relocs that turn out
-+ to be purely internal:
-+ eg. internal -> internal copy src / dest,
-+ others are less troublesome - though removing
-+ empty ones would be nice (?).
-+ We want to trap every -named- reloc ...
-+ */
-+ for (inputobj = info->input_bfds;
-+ inputobj;
-+ inputobj = inputobj->link_next)
-+ {
-+ asection *s;
-+ struct bfd_elf_section_data *es; /* elf-bfd.h */
-+ unsigned i;
-+ Elf_Internal_Rela *relocs, *p;
-+ unsigned char *sec_data;
-+ long storage_needed;
-+ asymbol **symtab;
-+ long number_of_symbols;
-+ const struct elf_backend_data *bed = get_elf_backend_data (inputobj);
-+
-+ if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED))
-+ continue;
-+ s = bfd_get_section_by_name (inputobj, ".vtrelocs");
-+ if (!s)
-+ continue;
-+ /* XXX Hmm, this seems to generate many NONE relocs, probably from
-+ the original relocs to this section. Perhaps discard them
-+ earlier. */
-+ s->flags |= SEC_EXCLUDE;
-+ es = elf_section_data (s);
-+ if (!es)
-+ continue;
-+
-+ if (!s->reloc_count)
-+ continue;
-+
-+ fprintf (stderr, "Relocs: size %d, count %d contents %p\n",
-+ (int)es->rel_hdr.sh_size, es->rel_count,
-+ s->contents);
-+
-+
-+ /* Can't find this info anywhere else for some reason: */
-+ p = relocs = _bfd_elf_link_read_relocs (inputobj, s, NULL, NULL,
-+ info->keep_memory);
-+
-+ /* Experimental stuff to get at the BFD relocs (translated back
-+ from the real ELF relocs. */
-+ storage_needed = bfd_get_symtab_upper_bound (inputobj);
-+ if (storage_needed <= 0)
-+ return FALSE;
-+ symtab = xmalloc (storage_needed);
-+ number_of_symbols = bfd_canonicalize_symtab (inputobj, symtab);
-+ if (number_of_symbols < 0)
-+ return FALSE;
-+
-+ if (! bed->s->slurp_reloc_table (inputobj, s, symtab, FALSE))
-+ return FALSE;
-+
-+ /* Now inputobj->relocation will contain BFD relocs. */
-+
-+ sec_data = bfd_malloc (es->this_hdr.sh_size);
-+
-+ /* Slurp the data */
-+ if (bfd_seek (inputobj, es->this_hdr.sh_offset, SEEK_SET) != 0)
-+ return FALSE;
-+ if (bfd_bread (sec_data, es->this_hdr.sh_size, inputobj) != es->this_hdr.sh_size)
-+ return FALSE;
-+
-+ if (es->this_hdr.sh_size % s->reloc_count != 0)
-+ fprintf (stderr, "ERROR: mismatching vtreloc sec & reloc count "
-+ "0x%x, 0x%x -> %d\n",
-+ (int)es->this_hdr.sh_size, (int)s->reloc_count,
-+ (int)es->this_hdr.sh_size % s->reloc_count);
-+
-+ /* Assumes an even number of relocs sorted by address ... */
-+ for (i = 0; i < s->reloc_count / 2; i++)
-+ {
-+ unsigned int entry_size;
-+ entry_size = (get_elf_backend_data (inputobj)->s->arch_size / 8) * 3;
-+
-+ last_rela = *p;
-+ add_reloc (vtr, inputobj, p, p + 1,
-+ sec_data + i * entry_size);
-+ p+=2;
-+ }
-+ free (sec_data);
-+ if (es->relocs != relocs)
-+ free (relocs);
-+ }
-+
-+ /* So - we need to sort these guys as we work out the sizes */
-+ /* We need to generate an internal list of XYZ type
-+ + eliminate all external -> external work ...
-+ + add all external -> internal copies to 'sorted' list
-+ + [ fool-proof GC roots ]
-+ + add other symbols to 'pending' list.
-+ + read / generate src: [symbol + offset, dest: sym + offset, bitmask data]
-+ */
-+ sort_relocs (vtr);
-+ num_relocs = 0;
-+ sec_size = 0;
-+ {
-+ CopyEntry *e;
-+ for (e = vtr->sorted; e; e = e->next)
-+ {
-+ sec_size += 3; /* Word entries. */
-+ num_relocs += 2;
-+ }
-+ }
-+ /*
-+ Finally:
-+ + build new custom section
-+ + emit new relocations for it ...
-+ */
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ bfd_size_type rel_size;
-+ bfd_size_type size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+
-+ {
-+ unsigned int entry_size;
-+ entry_size = (bed->s->arch_size / 8);
-+ /* + 1 for null termination */
-+ vtreloc_sec->size = (sec_size + 1) * entry_size;
-+ vtreloc_sec->contents = bfd_zalloc (dynobj, vtreloc_sec->size);
-+// if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+// return FALSE;
-+ }
-+
-+ rel_size = bed->s->sizeof_rel;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ }
-+
-+ size = rel_size * num_relocs;
-+ fprintf (stderr, "Need %ld bytes of relocs rel-size %ld\n",
-+ size, rel_size);
-+ vtrelrel->size = size;
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ }
-+ return TRUE;
-+}
-+
-+static void
-+generate_reloc (bfd *dynobj,
-+ struct elf_link_hash_entry *target,
-+ asection *vtreloc_sec,
-+ asection *vtrelrel,
-+ bfd_vma num_entry,
-+ int is_dest,
-+ bfd_size_type *adjust_relative)
-+{
-+ bfd_size_type sym_idx, rel_size;
-+ reloc_howto_type *howto;
-+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
-+ bfd_byte *loc;
-+ Elf_Internal_Rela outrel;
-+ const struct elf_backend_data *bed;
-+
-+ bed = get_elf_backend_data (dynobj);
-+
-+ rel_size = bed->s->sizeof_rel;
-+ swap_out = bed->s->swap_reloc_out;
-+ if (bed->default_use_rela_p)
-+ {
-+ rel_size = bed->s->sizeof_rela;
-+ swap_out = bed->s->swap_reloca_out;
-+ }
-+
-+ /* XXX: unwind this goodness etc. */
-+ while (target->root.type == bfd_link_hash_indirect
-+ || target->root.type == bfd_link_hash_warning)
-+ target = (struct elf_link_hash_entry *) target->root.u.i.link;
-+
-+ fprintf (stderr, "Reloc '%s' %d %d %d %d i:%ld ",
-+ target->root.root.string,
-+ target->ref_regular, target->def_regular,
-+ target->ref_dynamic, target->def_dynamic,
-+ target->dynindx);
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ fprintf (stderr, "'%s' vma 0x%lx offset %ld output off %ld\n",
-+ target->root.u.def.section->name,
-+ target->root.u.def.section->output_section->vma,
-+ target->root.u.def.value,
-+ target->root.u.def.section->output_offset);
-+ else
-+ fprintf (stderr, "\n");
-+
-+ /* XXX: RELOC64 too */
-+ if (is_dest /* force relative */ || target->dynindx <= 0)
-+ { /* do a relative reloc ... */
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_386_RELATIVE);
-+ sym_idx = 0;
-+ BFD_ASSERT (target->root.type == bfd_link_hash_defweak);
-+ *adjust_relative = (target->root.u.def.section->output_section->vma +
-+ target->root.u.def.section->output_offset);
-+ }
-+ else
-+ {
-+ howto = bfd_reloc_type_lookup (dynobj, BFD_RELOC_32);
-+ sym_idx = target->dynindx;
-+ *adjust_relative = 0;
-+ }
-+
-+ /* generate relocation */
-+ outrel.r_offset = vtreloc_sec->output_section->vma;
-+ outrel.r_offset += num_entry * 3 * 4; // XXX: 4 ?
-+ if (is_dest) outrel.r_offset += 4; // XXX: 4
-+ outrel.r_info = ELF32_R_INFO (sym_idx, howto->type);
-+ outrel.r_addend = 0;
-+
-+ loc = vtrelrel->contents + (vtrelrel->reloc_count++ * rel_size);
-+ swap_out (dynobj, &outrel, loc);
-+}
-+
-+bfd_boolean _bfd_elf_vtreloc_fill (bfd *output_bfd,
-+ struct bfd_link_info *info)
-+{
-+ bfd *dynobj;
-+ dynobj = elf_hash_table (info)->dynobj;
-+
-+ fprintf (stderr, "Foo: generate .suse.vtrelocs relocs\n");
-+
-+ if (info->vtreloc)
-+ {
-+ asection *vtreloc_sec;
-+ asection *vtrelrel;
-+
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ {
-+ CopyEntry *e;
-+ bfd_size_type entries, adjust_relative, entry_size;
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ bfd_byte *data;
-+
-+ entry_size = (bed->s->arch_size / 8);
-+
-+ vtrelrel = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (!vtrelrel)
-+ return FALSE;
-+ if (!vtrelrel->contents)
-+ {
-+ fprintf (stderr, "Nothing allocated for relocs\n");
-+ return FALSE;
-+ }
-+
-+ BFD_ASSERT (vtreloc_sec->output_offset == 0);
-+ entries = 0;
-+ vtrelrel->reloc_count = 0;
-+ data = vtreloc_sec->contents;
-+ for (e = global_vtr->sorted; e; e = e->next)
-+ {
-+ /* Source */
-+ generate_reloc (output_bfd, e->src, vtreloc_sec, vtrelrel,
-+ entries, FALSE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->src_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ /* Dest */
-+ generate_reloc (output_bfd, e->dest, vtreloc_sec, vtrelrel,
-+ entries, TRUE, &adjust_relative);
-+ bfd_put(bed->s->arch_size, output_bfd,
-+ e->dest_offset + adjust_relative, data);
-+ data += entry_size;
-+
-+ bfd_put(bed->s->arch_size, dynobj, e->bitmask, data);
-+ data += entry_size;
-+
-+ entries++;
-+ }
-+ BFD_ASSERT (vtrelrel->reloc_count * (bed->default_use_rela_p ? bed->s->sizeof_rela : bed->s->sizeof_rel)
-+ == vtrelrel->size);
-+ }
-+ else
-+ fprintf (stderr, "Horrendous error ! - no .suse.vtrelocs\n");
-+ }
-+ else
-+ {
-+ asection *vtreloc_sec;
-+ fprintf (stderr, "TESTME: exclude .vtrelocs if none present\n");
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ vtreloc_sec = bfd_get_section_by_name (dynobj, ".rel.suse.vtrelocs");
-+ if (vtreloc_sec)
-+ vtreloc_sec->flags |= SEC_EXCLUDE;
-+ }
-+ return TRUE;
-+}
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf.c binutils-2.17.50/bfd/elf.c
---- pristine-binutils-2.17.50/bfd/elf.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf.c 2008-01-09 17:04:17.000000000 +0000
-@@ -1240,6 +1240,7 @@
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
- case DT_GNU_HASH: name = "GNU_HASH"; break;
-+ case DT_SUSE_VTRELOC: name = "SUSE_VTRELOC"; break;
- }
-
- fprintf (f, " %-11s ", name);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c binutils-2.17.50/bfd/elflink.c
---- pristine-binutils-2.17.50/bfd/elflink.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c 2008-01-14 14:28:26.000000000 +0000
-@@ -148,6 +148,34 @@
- return TRUE;
- }
-
-+static int
-+_bfd_elf_create_vtreloc_sections (struct bfd_link_info *info)
-+{
-+ bfd *abfd;
-+ asection *s;
-+ flagword flags;
-+ const struct elf_backend_data *bed;
-+
-+ abfd = elf_hash_table (info)->dynobj;
-+ bed = get_elf_backend_data (abfd);
-+ flags = bed->dynamic_sec_flags;
-+
-+ s = bfd_make_section (abfd, ".suse.vtrelocs");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+ s = bfd_make_section (abfd, ".rel.suse.vtrelocs");
-+ if (s == NULL
-+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY
-+ | SEC_HAS_CONTENTS
-+ | SEC_IN_MEMORY | SEC_LINKER_CREATED)
-+ || ! bfd_set_section_alignment (abfd, s, 2))
-+ return FALSE;
-+
-+ return TRUE;
-+}
-+
- /* Create some sections which will be filled in with dynamic linking
- information. ABFD is an input file which requires dynamic sections
- to be created. The dynamic sections take up virtual memory space
-@@ -2266,6 +2294,7 @@
- return FALSE;
-
- elf_section_data (o)->rel_hashes = p;
-+ fprintf (stderr, "allocated rel_hashes for asec %p\n", o);
- }
-
- return TRUE;
-@@ -3291,7 +3320,24 @@
- bed = get_elf_backend_data (abfd);
-
- if ((abfd->flags & DYNAMIC) == 0)
-+ {
-+ asection *vtrel_sec;
-+
- dynamic = FALSE;
-+
-+ vtrel_sec = bfd_get_section_by_name (abfd, ".vtrelocs");
-+ if (vtrel_sec)
-+ {
-+ fprintf (stderr, "Has vtrelocs ! %d\n", (int)vtrel_sec->size);
-+ if (!info->vtreloc)
-+ {
-+ info->vtreloc = 1;
-+ if (!_bfd_elf_create_vtreloc_sections (info))
-+ goto error_return;
-+ }
-+ vtrel_sec->flags |= SEC_EXCLUDE;
-+ }
-+ }
- else
- {
- dynamic = TRUE;
-@@ -3603,6 +3649,7 @@
- else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
-
-+/* FIXME: cut/paste this ! ....*/
- symcount = hdr->sh_size / bed->s->sizeof_sym;
-
- /* The sh_info field of the symtab header tells us where the
-@@ -4978,8 +5025,14 @@
- switch (bfd_get_format (abfd))
- {
- case bfd_object:
-+ fprintf (stderr, "add_symbols from %s object '%s'\n",
-+ abfd->flags & DYNAMIC ? "dynamic" : "static",
-+ abfd->filename);
-+ // from an .o or .so file ...
- return elf_link_add_object_symbols (abfd, info);
- case bfd_archive:
-+ fprintf (stderr, "add_symbols from archive '%s'\n", abfd->filename);
-+ // from a .a file ...
- return elf_link_add_archive_symbols (abfd, info);
- default:
- bfd_set_error (bfd_error_wrong_format);
-@@ -5372,6 +5425,8 @@
- }
- }
-
-+ _bfd_elf_vtreloc_accumulate (output_bfd, info);
-+
- /* Any syms created from now on start with -1 in
- got.refcount/offset and plt.refcount/offset. */
- elf_hash_table (info)->init_got_refcount
-@@ -5652,6 +5707,13 @@
- return FALSE;
- }
-
-+ s = bfd_get_section_by_name (output_bfd, ".suse.vtrelocs");
-+ if (s != NULL)
-+ {
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+ return FALSE;
-+ }
-+
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
-@@ -7159,6 +7221,8 @@
- size_t symbuf_size;
- /* And same for symshndxbuf. */
- size_t shndxbuf_size;
-+ /* .suse.vtreloc section. */
-+ asection *vtreloc_sec;
- };
-
- /* This struct is used to pass information to elf_link_output_extsym. */
-@@ -7902,6 +7966,8 @@
- bfd_vma r_type_mask;
- int r_sym_shift;
-
-+ fprintf (stderr, "elf_link_adjust_relocs ... %p\n", rel_hash);
-+
- if (rel_hdr->sh_entsize == bed->s->sizeof_rel)
- {
- swap_in = bed->s->swap_reloc_in;
-@@ -10038,6 +10104,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.vtreloc_sec = NULL;
- }
- else
- {
-@@ -10045,6 +10112,7 @@
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
-+ finfo.vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
-@@ -10104,6 +10172,10 @@
- max_sym_count = 0;
- max_sym_shndx_count = 0;
- merged = FALSE;
-+
-+ if (dynobj && !info->relocatable)
-+ _bfd_elf_vtreloc_fill (finfo.output_bfd, info);
-+
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct bfd_elf_section_data *esdo = elf_section_data (o);
-@@ -10732,6 +10804,10 @@
- if ((o->flags & SEC_RELOC) == 0)
- continue;
-
-+ fprintf (stderr, "rel_hashes for asec %p is %d, %p\n", o,
-+ (int)elf_section_data (o)->rel_count,
-+ elf_section_data (o)->rel_hashes);
-+
- elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
- elf_section_data (o)->rel_count,
- elf_section_data (o)->rel_hashes);
-@@ -10869,6 +10945,11 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_SUSE_VTRELOC:
-+ name = ".suse.vtrelocs";
-+ o = bfd_get_section_by_name (abfd, name);
-+ fprintf (stderr, "got section vma at 0x%x\n", o->vma);
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-@@ -11129,6 +11210,8 @@
- bfd_boolean is_eh;
- asection *group_sec;
-
-+/* #warning "Do we want to ignore relocs inside .suse.vtreloc ?" */
-+
- sec->gc_mark = 1;
-
- /* Mark all the sections in the group. */
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c~ binutils-2.17.50/bfd/elflink.c~
---- pristine-binutils-2.17.50/bfd/elflink.c~ 2008-01-09 12:42:12.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c~ 2008-01-09 17:04:17.000000000 +0000
-@@ -10097,6 +10097,7 @@
- finfo.dynsym_sec = NULL;
- finfo.hash_sec = NULL;
- finfo.symver_sec = NULL;
-+ finfo.vtreloc_sec = NULL;
- }
- else
- {
-@@ -10104,6 +10105,7 @@
- finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL);
- finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
-+ finfo.vtreloc_sec = bfd_get_section_by_name (dynobj, ".suse.vtrelocs");
- /* Note that it is OK if symver_sec is NULL. */
- }
-
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/bfdlink.h binutils-2.17.50/include/bfdlink.h
---- pristine-binutils-2.17.50/include/bfdlink.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/bfdlink.h 2008-01-09 17:04:17.000000000 +0000
-@@ -293,6 +293,10 @@
- /* TRUE if the new ELF dynamic tags are enabled. */
- unsigned int new_dtags: 1;
-
-+ /* TRUE if we want to produce copy-based vtable relocation
-+ data. This saves both space and time. */
-+ unsigned int vtreloc: 1;
-+
- /* TRUE if non-PLT relocs should be merged into one reloc section
- and sorted so that relocs against the same symbol come together. */
- unsigned int combreloc: 1;
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/elf/common.h binutils-2.17.50/include/elf/common.h
---- pristine-binutils-2.17.50/include/elf/common.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/elf/common.h 2008-01-09 17:04:17.000000000 +0000
-@@ -624,6 +624,13 @@
- #define DT_USED 0x7ffffffe
- #define DT_FILTER 0x7fffffff
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-
- /* Values used in DT_FEATURE .dynamic entry. */
- #define DTF_1_PARINIT 0x00000001
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/ldmain.c binutils-2.17.50/ld/ldmain.c
---- pristine-binutils-2.17.50/ld/ldmain.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/ldmain.c 2008-01-09 17:04:17.000000000 +0000
-@@ -1105,6 +1105,7 @@
- asection *section,
- bfd_vma value)
- {
-+ fprintf (stderr, "add_to_set '%s'\n", h->root.string);
- if (config.warn_constructors)
- einfo (_("%P: warning: global constructor %s used\n"),
- h->root.string);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/lexsup.c binutils-2.17.50/ld/lexsup.c
---- pristine-binutils-2.17.50/ld/lexsup.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/lexsup.c 2008-01-09 17:04:17.000000000 +0000
-@@ -157,6 +157,7 @@
- OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
- OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
- OPTION_PIE,
-+ OPTION_VTRELOC,
- OPTION_UNRESOLVED_SYMBOLS,
- OPTION_WARN_UNRESOLVED_SYMBOLS,
- OPTION_ERROR_UNRESOLVED_SYMBOLS,
-@@ -409,6 +410,8 @@
- { {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED},
- '\0', NULL, N_("Do not allow unresolved references in object files"),
- TWO_DASHES },
-+ { {"vtreloc", no_argument, NULL, OPTION_VTRELOC},
-+ '\0', NULL, N_("Build vtable copy reloc data"), TWO_DASHES },
- { {"allow-shlib-undefined", no_argument, NULL, OPTION_ALLOW_SHLIB_UNDEFINED},
- '\0', NULL, N_("Allow unresolved references in shared libaries"),
- TWO_DASHES },
-@@ -1171,6 +1174,9 @@
- case OPTION_DEFAULT_SCRIPT:
- command_line.default_script = optarg;
- break;
-+ case OPTION_VTRELOC:
-+ link_info.vtreloc = TRUE;
-+ break;
- case OPTION_SECTION_START:
- {
- char *optarg2;
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/scripttempl/elf.sc binutils-2.17.50/ld/scripttempl/elf.sc
---- pristine-binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-09 17:04:17.000000000 +0000
-@@ -285,6 +285,7 @@
- eval $COMBRELOCCAT <<EOF
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
-+ .rel.suse.vtrelocs ${RELOCATING-0} : { *(.rel.suse.vtrelocs) }
- .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
- .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
-@@ -321,7 +322,7 @@
- {
- EOF
- sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC
--cat <<EOF
-+cat <<EOF
- }
- .rela.dyn ${RELOCATING-0} :
- {
-@@ -410,6 +411,13 @@
- ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
- .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
-
-+ /* Virtual table copy relocation tables */
-+ __vtrelocs = .;
-+ .suse.vtrelocs :
-+ {
-+ KEEP (*(.suse.vtrelocs))
-+ }
-+
- ${RELOCATING+${DATARELRO}}
- ${OTHER_RELRO_SECTIONS}
- ${TEXT_DYNAMIC-${DYNAMIC}}
diff --git a/patches/test/boxclipping.diff b/patches/test/boxclipping.diff
deleted file mode 100644
index ea9f26a4e..000000000
--- a/patches/test/boxclipping.diff
+++ /dev/null
@@ -1,3358 +0,0 @@
-A clipper implementation specialized for boxes
-
-From: Thorsten Behrens <thb@openoffice.org>
-
----
-
- basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 10
- basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx | 6
- basegfx/inc/basegfx/range/b2dmultirange.hxx | 117 ---
- basegfx/inc/basegfx/range/b2dpolyrange.hxx | 139 ++++
- basegfx/inc/basegfx/range/b2drangeclipper.hxx | 53 +
- basegfx/qa/mkpolygons.pl | 344 +++++++++
- basegfx/source/polygon/b2dpolygon.cxx | 102 ++-
- basegfx/source/polygon/b2dpolypolygon.cxx | 40 +
- basegfx/source/range/b2dmultirange.cxx | 282 -------
- basegfx/source/range/b2dpolyrange.cxx | 371 +++++++++
- basegfx/source/range/b2drangeclipper.cxx | 950 ++++++++++++++++++++++++
- basegfx/source/range/makefile.mk | 3
- basegfx/test/basegfx2d.cxx | 248 +-----
- basegfx/test/boxclipper.cxx | 426 +++++++++++
- basegfx/test/makefile.mk | 5
- 15 files changed, 2457 insertions(+), 639 deletions(-)
- delete mode 100644 basegfx/inc/basegfx/range/b2dmultirange.hxx
- create mode 100644 basegfx/inc/basegfx/range/b2dpolyrange.hxx
- create mode 100644 basegfx/inc/basegfx/range/b2drangeclipper.hxx
- create mode 100644 basegfx/qa/mkpolygons.pl
- delete mode 100644 basegfx/source/range/b2dmultirange.cxx
- create mode 100644 basegfx/source/range/b2dpolyrange.cxx
- create mode 100644 basegfx/source/range/b2drangeclipper.cxx
- create mode 100644 basegfx/test/boxclipper.cxx
-
-
-diff --git basegfx/inc/basegfx/polygon/b2dpolygon.hxx basegfx/inc/basegfx/polygon/b2dpolygon.hxx
-index 067680e..e7f60c1 100644
---- basegfx/inc/basegfx/polygon/b2dpolygon.hxx
-+++ basegfx/inc/basegfx/polygon/b2dpolygon.hxx
-@@ -83,7 +83,7 @@ namespace basegfx
- sal_uInt32 count() const;
-
- /// Coordinate interface
-- basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
-+ const basegfx::B2DPoint& getB2DPoint(sal_uInt32 nIndex) const;
- void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
-
- /// Coordinate insert/append
-@@ -201,7 +201,7 @@ namespace basegfx
- @return
- The outer range of the bezier curve/polygon
- */
-- B2DRange getB2DRange() const;
-+ const B2DRange& getB2DRange() const;
-
- /** insert other 2D polygons
-
-@@ -261,6 +261,12 @@ namespace basegfx
-
- /// apply transformation given in matrix form
- void transform(const basegfx::B2DHomMatrix& rMatrix);
-+
-+ // point iterators
-+ const B2DPoint* begin() const;
-+ const B2DPoint* end() const;
-+ B2DPoint* begin();
-+ B2DPoint* end();
- };
- } // end of namespace basegfx
-
-diff --git basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
-index 38048f8..1b8ba65 100644
---- basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
-+++ basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
-@@ -128,6 +128,12 @@ namespace basegfx
-
- // apply transformation given in matrix form to the polygon
- void transform(const basegfx::B2DHomMatrix& rMatrix);
-+
-+ // polygon iterators
-+ const B2DPolygon* begin() const;
-+ const B2DPolygon* end() const;
-+ B2DPolygon* begin();
-+ B2DPolygon* end();
- };
- } // end of namespace basegfx
-
-diff --git basegfx/inc/basegfx/range/b2dmultirange.hxx basegfx/inc/basegfx/range/b2dmultirange.hxx
-deleted file mode 100644
-index 447b0bf..0000000
---- basegfx/inc/basegfx/range/b2dmultirange.hxx
-+++ /dev/null
-@@ -1,117 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: b2dmultirange.hxx,v $
-- * $Revision: 1.6 $
-- *
-- * 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 _BGFX_RANGE_B2DMULTIRANGE_HXX
--#define _BGFX_RANGE_B2DMULTIRANGE_HXX
--
--#include <o3tl/cow_wrapper.hxx>
--#include <memory>
--
--
--namespace basegfx
--{
-- class B2DTuple;
-- class B2DRange;
-- class B2DPolyPolygon;
-- class ImplB2DMultiRange;
--
-- /** Multiple ranges in one object.
--
-- This class combines multiple ranges in one object, providing a
-- total, enclosing range for it.
--
-- You can use this class e.g. when updating views containing
-- rectangular objects. Add each modified object to a
-- B2DMultiRange, then test each viewable object against
-- intersection with the multi range.
-- */
-- class B2DMultiRange
-- {
-- public:
-- B2DMultiRange();
-- ~B2DMultiRange();
--
-- /** Create a multi range with exactly one containing range
-- */
-- explicit B2DMultiRange( const B2DRange& rRange );
--
-- B2DMultiRange( const B2DMultiRange& );
-- B2DMultiRange& operator=( const B2DMultiRange& );
--
-- /** Check whether range is empty.
--
-- @return true, if this object either contains no ranges at
-- all, or all contained ranges are empty.
-- */
-- bool isEmpty() const;
--
-- /** Reset to empty.
--
-- After this call, the object will not contain any ranges,
-- and isEmpty() will return true.
-- */
-- void reset();
--
-- /** Test whether given tuple is inside one or more of the
-- included ranges.
-- */
-- bool isInside( const B2DTuple& rTuple ) const;
--
-- /** Test whether given range is inside one or more of the
-- included ranges.
-- */
-- bool isInside( const B2DRange& rRange ) const;
--
-- /** Test whether given range overlaps one or more of the
-- included ranges.
-- */
-- bool overlaps( const B2DRange& rRange ) const;
--
-- /** Add given range to the number of contained ranges.
-- */
-- void addRange( const B2DRange& rRange );
--
-- /** Get overall bound rect for all included ranges.
-- */
-- B2DRange getBounds() const;
--
-- /** Request poly-polygon representing the added ranges.
--
-- This method creates a poly-polygon, consisting exactly out
-- of the contained ranges.
-- */
-- B2DPolyPolygon getPolyPolygon() const;
--
-- private:
-- o3tl::cow_wrapper< ImplB2DMultiRange > mpImpl;
-- };
--}
--
--#endif /* _BGFX_RANGE_B2DMULTIRANGE_HXX */
-diff --git basegfx/inc/basegfx/range/b2dpolyrange.hxx basegfx/inc/basegfx/range/b2dpolyrange.hxx
-new file mode 100644
-index 0000000..0c07dc2
---- /dev/null
-+++ basegfx/inc/basegfx/range/b2dpolyrange.hxx
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dmultirange.hxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 _BGFX_RANGE_B2DPOLYRANGE_HXX
-+#define _BGFX_RANGE_B2DPOLYRANGE_HXX
-+
-+#include <o3tl/cow_wrapper.hxx>
-+#include <boost/tuple/tuple.hpp>
-+#include <basegfx/vector/b2enums.hxx>
-+
-+namespace basegfx
-+{
-+ class B2DTuple;
-+ class B2DRange;
-+ class B2DPolyPolygon;
-+ class ImplB2DPolyRange;
-+
-+ /** Multiple ranges in one object.
-+
-+ This class combines multiple ranges in one object, providing a
-+ total, enclosing range for it.
-+
-+ You can use this class e.g. when updating views containing
-+ rectangular objects. Add each modified object to a
-+ B2DMultiRange, then test each viewable object against
-+ intersection with the multi range.
-+
-+ Similar in spirit to the poly-polygon vs. polygon relationship.
-+
-+ Note that comparable to polygons, a poly-range can also
-+ contain 'holes' - this is encoded via polygon orientation at
-+ the poly-polygon, and via explicit flags for the poly-range.
-+ */
-+ class B2DPolyRange
-+ {
-+ public:
-+ typedef boost::tuple<B2DRange,B2VectorOrientation> ElementType ;
-+
-+ B2DPolyRange();
-+ ~B2DPolyRange();
-+
-+ /** Create a multi range with exactly one containing range
-+ */
-+ explicit B2DPolyRange( const ElementType& rElement );
-+ B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient );
-+ B2DPolyRange( const B2DPolyRange& );
-+ B2DPolyRange& operator=( const B2DPolyRange& );
-+
-+ /// unshare this poly-range with all internally shared instances
-+ void makeUnique();
-+
-+ bool operator==(const B2DPolyRange&) const;
-+ bool operator!=(const B2DPolyRange&) const;
-+
-+ /// Number of included ranges
-+ sal_uInt32 count() const;
-+
-+ ElementType getElement(sal_uInt32 nIndex) const;
-+ void setElement(sal_uInt32 nIndex, const ElementType& rElement );
-+ void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient );
-+
-+ // insert/append a single range
-+ void insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount = 1);
-+ void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
-+ void appendElement(const ElementType& rElement, sal_uInt32 nCount = 1);
-+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
-+
-+ // insert/append multiple ranges
-+ void insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange&);
-+ void appendPolyRange(const B2DPolyRange&);
-+
-+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
-+ void clear();
-+
-+ // flip range orientations - converts holes to solids, and vice versa
-+ void flip();
-+
-+ /** Get overall range
-+
-+ @return
-+ The union range of all contained ranges
-+ */
-+ B2DRange getBounds() const;
-+
-+ /** Test whether given tuple is inside one or more of the
-+ included ranges. Does *not* use overall range, but checks
-+ individually.
-+ */
-+ bool isInside( const B2DTuple& rTuple ) const;
-+
-+ /** Test whether given range is inside one or more of the
-+ included ranges. Does *not* use overall range, but checks
-+ individually.
-+ */
-+ bool isInside( const B2DRange& rRange ) const;
-+
-+ /** Test whether given range overlaps one or more of the
-+ included ranges. Does *not* use overall range, but checks
-+ individually.
-+ */
-+ bool overlaps( const B2DRange& rRange ) const;
-+
-+ /** Request a poly-polygon with solved cross-overs
-+ */
-+ B2DPolyPolygon solveCrossovers() const;
-+
-+ private:
-+ o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
-+ };
-+}
-+
-+#endif /* _BGFX_RANGE_B2DPOLYRANGE_HXX */
-diff --git basegfx/inc/basegfx/range/b2drangeclipper.hxx basegfx/inc/basegfx/range/b2drangeclipper.hxx
-new file mode 100644
-index 0000000..1b08bbf
---- /dev/null
-+++ basegfx/inc/basegfx/range/b2drangeclipper.hxx
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dmultirange.hxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 _BGFX_RANGE_B2DRANGECLIPPER_HXX
-+#define _BGFX_RANGE_B2DRANGECLIPPER_HXX
-+
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <vector>
-+
-+namespace basegfx
-+{
-+ namespace tools
-+ {
-+ /** Extract poly-polygon w/o self-intersections from poly-range
-+
-+ Similar to the solveCrossovers(const B2DPolyPolygon&)
-+ method, this one calculates a self-intersection-free
-+ poly-polygon with the same topology, and encoding
-+ inside/outsidedness via polygon orientation and layering.
-+ */
-+ B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
-+ const std::vector<B2VectorOrientation>& rOrientations);
-+ }
-+}
-+
-+#endif /* _BGFX_RANGE_B2DRANGECLIPPER_HXX */
-diff --git basegfx/qa/mkpolygons.pl basegfx/qa/mkpolygons.pl
-new file mode 100644
-index 0000000..47ef7ba
---- /dev/null
-+++ basegfx/qa/mkpolygons.pl
-@@ -0,0 +1,344 @@
-+:
-+eval 'exec perl -wS $0 ${1+"$@"}'
-+ if 0;
-+
-+#
-+# 2009 Copyright Novell, Inc. & Sun Microsystems, Inc.
-+#
-+# 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.
-+#
-+
-+use IO::File;
-+use Cwd;
-+use File::Spec;
-+use File::Spec::Functions;
-+use File::Temp;
-+use File::Path;
-+
-+$TempDir = "";
-+
-+
-+# all the XML package generation is a blatant rip from AF's
-+# write-calc-doc.pl
-+
-+
-+###############################################################################
-+# Open a file with the given name.
-+# First it is checked if the temporary directory, in which all files for
-+# the document are gathered, is already present and create it if it is not.
-+# Then create the path to the file inside the temporary directory.
-+# Finally open the file and return a file handle to it.
-+#
-+sub open_file
-+{
-+ my $filename = pop @_;
-+
-+ # Create base directory of temporary directory tree if not alreay
-+ # present.
-+ if ($TempDir eq "")
-+ {
-+ $TempDir = File::Temp::tempdir (CLEANUP => 1);
-+ }
-+
-+ # Create the path to the file.
-+ my $fullname = File::Spec->catfile ($TempDir, $filename);
-+ my ($volume,$directories,$file) = File::Spec->splitpath ($fullname);
-+ mkpath (File::Spec->catpath ($volume,$directories,""));
-+
-+ # Open the file and return a file handle to it.
-+ return new IO::File ($fullname, "w");
-+}
-+
-+
-+###############################################################################
-+# Zip the files in the directory tree into the given file.
-+#
-+sub zip_dirtree
-+{
-+ my $filename = pop @_;
-+
-+ my $cwd = getcwd;
-+ my $zip_name = $filename;
-+
-+ # We are about to change the directory.
-+ # Therefore create an absolute pathname for the zip archive.
-+
-+ # First transfer the drive from $cwd to $zip_name. This is a
-+ # workaround for a bug in file_name_is_absolute which thinks
-+ # the the path \bla is an absolute path under DOS.
-+ my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name);
-+ my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd);
-+ $volume = $volume_cwd if ($volume eq "");
-+ $zip_name = File::Spec->catpath ($volume,$directories,$file);
-+
-+ # Add the current working directory to a relative path.
-+ if ( ! file_name_is_absolute ($zip_name))
-+ {
-+ $zip_name = File::Spec->catfile ($cwd, $zip_name);
-+
-+ # Try everything to clean up the name.
-+ $zip_name = File::Spec->rel2abs ($filename);
-+ $zip_name = File::Spec->canonpath ($zip_name);
-+
-+ # Remove .. directories from the middle of the path.
-+ while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//)
-+ {
-+ $zip_name = $` . "/" . $';
-+ }
-+ }
-+
-+ # Just in case the zip program gets confused by an existing file with the
-+ # same name as the one to be written that file is removed first.
-+ if ( -e $filename)
-+ {
-+ if (unlink ($filename) == 0)
-+ {
-+ print "Existing file $filename could not be deleted.\n";
-+ print "Please close the application that uses it, then try again.\n";
-+ return;
-+ }
-+ }
-+
-+ # Finally create the zip file. First change into the temporary directory
-+ # so that the resulting zip file contains only paths relative to it.
-+ print "zipping [$ZipCmd $ZipFlags $zip_name *]\n";
-+ chdir ($TempDir);
-+ system ("$ZipCmd $ZipFlags $zip_name *");
-+ chdir ($cwd);
-+}
-+
-+
-+sub writeHeader
-+{
-+ print $OUT qq~<?xml version="1.0" encoding="UTF-8"?>
-+
-+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
-+ <office:scripts/>
-+ <office:automatic-styles>
-+ <style:style style:name="dp1" style:family="drawing-page">
-+ <style:drawing-page-properties presentation:background-visible="true" presentation:background-objects-visible="true" presentation:display-footer="true" presentation:display-page-number="false" presentation:display-date-time="true"/>
-+ </style:style>
-+ <style:style style:name="gr1" style:family="graphic" style:parent-style-name="standard">
-+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:fill="none" draw:stroke="none" draw:textarea-vertical-align="middle"/>
-+ </style:style>
-+ <style:style style:name="gr2" style:family="graphic" style:parent-style-name="standard">
-+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle"/>
-+ </style:style>
-+ <style:style style:name="pr1" style:family="presentation" style:parent-style-name="Default-title">
-+ <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="3.508cm"/>
-+ </style:style>
-+ <style:style style:name="pr2" style:family="presentation" style:parent-style-name="Default-notes">
-+ <style:graphic-properties draw:fill-color="#ffffff" draw:auto-grow-height="true" fo:min-height="13.367cm"/>
-+ </style:style>
-+ <style:style style:name="P1" style:family="paragraph">
-+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm"/>
-+ </style:style>
-+ <style:style style:name="P2" style:family="paragraph">
-+ <style:paragraph-properties fo:margin-left="0.6cm" fo:margin-right="0cm" fo:text-indent="-0.6cm"/>
-+ </style:style>
-+ <text:list-style style:name="L1">
-+ <text:list-level-style-bullet text:level="1" text:bullet-char="â—">
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="2" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="3" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="4" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="5" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="6" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="7" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="8" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ <text:list-level-style-bullet text:level="9" text:bullet-char="â—">
-+ <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
-+ <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
-+ </text:list-level-style-bullet>
-+ </text:list-style>
-+ </office:automatic-styles>
-+ <office:body>
-+ <office:presentation>
-+~;
-+
-+}
-+
-+sub writeSlideHeader
-+{
-+ my $titleText = pop @_;
-+ my $slideNum = pop @_;
-+
-+ print $OUT " <draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n";
-+ print $OUT " <office:forms form:automatic-focus=\"false\" form:apply-design-mode=\"false\"/>\n";
-+ print $OUT " <draw:rect draw:style-name=\"gr1\" draw:text-style-name=\"P1\" draw:id=\"id$slideNum\" draw:layer=\"layout\" svg:width=\"17.5cm\" svg:height=\"6cm\" svg:x=\"5cm\" svg:y=\"4cm\">\n";
-+ print $OUT " <text:p text:style-name=\"P2\">Slide: $slideNum</text:p>\n";
-+ print $OUT " <text:p text:style-name=\"P2\">Path: $titleText</text:p>\n";
-+ print $OUT " </draw:rect>\n";
-+}
-+
-+
-+sub writeSlideFooter
-+{
-+ print $OUT " <presentation:notes draw:style-name=\"dp1\">\n";
-+ print $OUT " <draw:page-thumbnail draw:style-name=\"gr1\" draw:layer=\"layout\" svg:width=\"14.851cm\" svg:height=\"11.138cm\" svg:x=\"3.068cm\" svg:y=\"2.257cm\" draw:page-number=\"1\" presentation:class=\"page\"/>\n";
-+ print $OUT " <draw:frame presentation:style-name=\"pr3\" draw:layer=\"layout\" svg:width=\"16.79cm\" svg:height=\"13.116cm\" svg:x=\"2.098cm\" svg:y=\"14.109cm\" presentation:class=\"notes\" presentation:placeholder=\"true\">\n";
-+ print $OUT " <draw:text-box/>\n";
-+ print $OUT " </draw:frame>\n";
-+ print $OUT " </presentation:notes>\n";
-+ print $OUT " </draw:page>\n";
-+}
-+
-+sub writeFooter
-+{
-+ print $OUT qq~ <presentation:settings presentation:full-screen="false"/>
-+ </office:presentation>
-+ </office:body>
-+</office:document-content>
-+~;
-+
-+}
-+
-+sub writePath
-+{
-+ my $pathAry = pop @_;
-+ my $path = $pathAry->[1];
-+ my $viewBox = $pathAry->[0];
-+
-+ print $OUT " <draw:path draw:style-name=\"gr2\" draw:text-style-name=\"P1\" draw:layer=\"layout\" svg:width=\"10cm\" svg:height=\"10cm\" svg:x=\"5cm\" svg:y=\"5cm\" svg:viewBox=\"";
-+ print $OUT $viewBox;
-+ print $OUT "\" svg:d=\"";
-+ print $OUT $path;
-+ print $OUT "\">\n";
-+ print $OUT " <text:p/>\n";
-+ print $OUT " </draw:path>\n";
-+}
-+
-+sub writeManifest
-+{
-+ my $outFile = open_file("META-INF/manifest.xml");
-+
-+ print $outFile qq~<?xml version="1.0" encoding="UTF-8"?>
-+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
-+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
-+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.presentation" manifest:full-path="/"/>
-+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>
-+</manifest:manifest>
-+~;
-+
-+ $outFile->close;
-+}
-+
-+
-+###############################################################################
-+# Print usage information.
-+#
-+sub usage ()
-+{
-+ print <<END_OF_USAGE;
-+usage: $0 <option>* [<SvgD-values>]
-+
-+output-file-name defaults to polygons.odp.
-+
-+ -h Print this usage information.
-+ -o output-file-name
-+END_OF_USAGE
-+}
-+
-+###############################################################################
-+# Process the command line.
-+#
-+sub process_command_line
-+{
-+ foreach (@ARGV)
-+ {
-+ if (/^-h/)
-+ {
-+ usage;
-+ exit 0;
-+ }
-+ }
-+
-+ $global_output_name = "polygons.odp";
-+ my $j = 0, $noMoreOptions = 0;
-+ for (my $i=0; $i<$#ARGV; $i++)
-+ {
-+ if ( !$noMoreOptions and $ARGV[$i] eq "-o")
-+ {
-+ $i++;
-+ $global_output_name = $ARGV[$i];
-+ }
-+ elsif ( !$noMoreOptions and $ARGV[$i] eq "--")
-+ {
-+ $noMoreOptions = 1;
-+ }
-+ elsif ( !$noMoreOptions and $ARGV[$i] =~ /^-/)
-+ {
-+ print "Unknown option $ARGV[$i]\n";
-+ usage;
-+ exit 1;
-+ }
-+ else
-+ {
-+ push(@paths, [$ARGV[$i],$ARGV[$i+1]]);
-+ $i++;
-+ }
-+ }
-+
-+ print "output to $global_output_name\n";
-+}
-+
-+###############################################################################
-+# Main
-+###############################################################################
-+
-+$ZipCmd = $ENV{LOG_FILE_ZIP_CMD};
-+$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS};
-+# Provide default values for the zip command and it's flags.
-+if ( ! defined $ZipCmd)
-+{
-+ $ZipCmd = "zip" unless defined $ZipCmd;
-+ $ZipFlags = "-r -q" unless defined $ZipFlags;
-+}
-+
-+process_command_line();
-+
-+writeManifest();
-+
-+$OUT = open_file( "content.xml" );
-+
-+writeHeader();
-+
-+$pathNum=0;
-+foreach $path (@paths)
-+{
-+ writeSlideHeader($pathNum, $path->[1]);
-+ writePath($path);
-+ writeSlideFooter();
-+ $pathNum++;
-+}
-+
-+writeFooter();
-+
-+$OUT->close;
-+
-+zip_dirtree ($global_output_name);
-+
-diff --git basegfx/source/polygon/b2dpolygon.cxx basegfx/source/polygon/b2dpolygon.cxx
-index 02a25e6..c30d070 100644
---- basegfx/source/polygon/b2dpolygon.cxx
-+++ basegfx/source/polygon/b2dpolygon.cxx
-@@ -44,38 +44,24 @@
-
- //////////////////////////////////////////////////////////////////////////////
-
--class CoordinateData2D
-+struct CoordinateData2D : public basegfx::B2DPoint
- {
-- basegfx::B2DPoint maPoint;
--
- public:
-- CoordinateData2D()
-- : maPoint()
-- {}
--
-+ CoordinateData2D() {}
-+
- explicit CoordinateData2D(const basegfx::B2DPoint& rData)
-- : maPoint(rData)
-+ : B2DPoint(rData)
- {}
-
-- const basegfx::B2DPoint& getCoordinate() const
-- {
-- return maPoint;
-+ CoordinateData2D& operator=(const basegfx::B2DPoint& rData)
-+ {
-+ B2DPoint::operator=(rData);
-+ return *this;
- }
-
-- void setCoordinate(const basegfx::B2DPoint& rValue)
-- {
-- if(rValue != maPoint)
-- maPoint = rValue;
-- }
--
-- bool operator==(const CoordinateData2D& rData ) const
-- {
-- return (maPoint == rData.getCoordinate());
-- }
--
- void transform(const basegfx::B2DHomMatrix& rMatrix)
- {
-- maPoint *= rMatrix;
-+ *this *= rMatrix;
- }
- };
-
-@@ -115,12 +101,12 @@ public:
-
- const basegfx::B2DPoint& getCoordinate(sal_uInt32 nIndex) const
- {
-- return maVector[nIndex].getCoordinate();
-+ return maVector[nIndex];
- }
-
- void setCoordinate(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue)
- {
-- maVector[nIndex].setCoordinate(rValue);
-+ maVector[nIndex] = rValue;
- }
-
- void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount)
-@@ -221,6 +207,26 @@ public:
- aStart->transform(rMatrix);
- }
- }
-+
-+ const basegfx::B2DPoint* begin() const
-+ {
-+ return &maVector.front();
-+ }
-+
-+ const basegfx::B2DPoint* end() const
-+ {
-+ return &maVector[maVector.size()];
-+ }
-+
-+ basegfx::B2DPoint* begin()
-+ {
-+ return &maVector.front();
-+ }
-+
-+ basegfx::B2DPoint* end()
-+ {
-+ return &maVector[maVector.size()];
-+ }
- };
-
- //////////////////////////////////////////////////////////////////////////////
-@@ -1113,6 +1119,28 @@ public:
- maPoints.transform(rMatrix);
- }
- }
-+
-+ const basegfx::B2DPoint* begin() const
-+ {
-+ return maPoints.begin();
-+ }
-+
-+ const basegfx::B2DPoint* end() const
-+ {
-+ return maPoints.end();
-+ }
-+
-+ basegfx::B2DPoint* begin()
-+ {
-+ mpBufferedData.reset();
-+ return maPoints.begin();
-+ }
-+
-+ basegfx::B2DPoint* end()
-+ {
-+ mpBufferedData.reset();
-+ return maPoints.end();
-+ }
- };
-
- //////////////////////////////////////////////////////////////////////////////
-@@ -1173,7 +1201,7 @@ namespace basegfx
- return mpPolygon->count();
- }
-
-- B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
-+ const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
- {
- OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
-
-@@ -1432,7 +1460,7 @@ namespace basegfx
- return mpPolygon->getDefaultAdaptiveSubdivision(*this);
- }
-
-- B2DRange B2DPolygon::getB2DRange() const
-+ const B2DRange& B2DPolygon::getB2DRange() const
- {
- return mpPolygon->getB2DRange(*this);
- }
-@@ -1540,6 +1568,26 @@ namespace basegfx
- mpPolygon->transform(rMatrix);
- }
- }
-+
-+ const B2DPoint* B2DPolygon::begin() const
-+ {
-+ return mpPolygon->begin();
-+ }
-+
-+ const B2DPoint* B2DPolygon::end() const
-+ {
-+ return mpPolygon->end();
-+ }
-+
-+ B2DPoint* B2DPolygon::begin()
-+ {
-+ return mpPolygon->begin();
-+ }
-+
-+ B2DPoint* B2DPolygon::end()
-+ {
-+ return mpPolygon->end();
-+ }
- } // end of namespace basegfx
-
- //////////////////////////////////////////////////////////////////////////////
-diff --git basegfx/source/polygon/b2dpolypolygon.cxx basegfx/source/polygon/b2dpolypolygon.cxx
-index 67cd079..4be35f7 100644
---- basegfx/source/polygon/b2dpolypolygon.cxx
-+++ basegfx/source/polygon/b2dpolypolygon.cxx
-@@ -166,6 +166,26 @@ public:
- maPolygons.end(),
- std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
- }
-+
-+ const basegfx::B2DPolygon* begin() const
-+ {
-+ return &maPolygons.front();
-+ }
-+
-+ const basegfx::B2DPolygon* end() const
-+ {
-+ return &maPolygons[maPolygons.size()];
-+ }
-+
-+ basegfx::B2DPolygon* begin()
-+ {
-+ return &maPolygons.front();
-+ }
-+
-+ basegfx::B2DPolygon* end()
-+ {
-+ return &maPolygons[maPolygons.size()];
-+ }
- };
-
- //////////////////////////////////////////////////////////////////////////////
-@@ -378,6 +398,26 @@ namespace basegfx
- mpPolyPolygon->transform(rMatrix);
- }
- }
-+
-+ const B2DPolygon* B2DPolyPolygon::begin() const
-+ {
-+ return mpPolyPolygon->begin();
-+ }
-+
-+ const B2DPolygon* B2DPolyPolygon::end() const
-+ {
-+ return mpPolyPolygon->end();
-+ }
-+
-+ B2DPolygon* B2DPolyPolygon::begin()
-+ {
-+ return mpPolyPolygon->begin();
-+ }
-+
-+ B2DPolygon* B2DPolyPolygon::end()
-+ {
-+ return mpPolyPolygon->end();
-+ }
- } // end of namespace basegfx
-
- // eof
-diff --git basegfx/source/range/b2dmultirange.cxx basegfx/source/range/b2dmultirange.cxx
-deleted file mode 100644
-index 738c5d1..0000000
---- basegfx/source/range/b2dmultirange.cxx
-+++ /dev/null
-@@ -1,282 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: b2dmultirange.cxx,v $
-- * $Revision: 1.8 $
-- *
-- * 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.
-- *
-- ************************************************************************/
--
--// MARKER(update_precomp.py): autogen include statement, do not remove
--#include "precompiled_basegfx.hxx"
--#include <basegfx/range/b2drange.hxx>
--#include <basegfx/tuple/b2dtuple.hxx>
--#include <basegfx/polygon/b2dpolypolygon.hxx>
--#include <basegfx/range/b2dmultirange.hxx>
--#include <basegfx/polygon/b2dpolygontools.hxx>
--#include <basegfx/polygon/b2dpolypolygontools.hxx>
--#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
--#include <boost/bind.hpp>
--#include <boost/mem_fn.hpp>
--#include <algorithm>
--#include <vector>
--
--
--namespace basegfx
--{
-- class ImplB2DMultiRange
-- {
-- public:
-- ImplB2DMultiRange() :
-- maBounds(),
-- maRanges()
-- {
-- }
--
-- explicit ImplB2DMultiRange( const B2DRange& rRange ) :
-- maBounds(),
-- maRanges( 1, rRange )
-- {
-- }
--
-- bool isEmpty() const
-- {
-- // no ranges at all, or all ranges empty
-- return maRanges.empty() ||
-- ::std::count_if( maRanges.begin(),
-- maRanges.end(),
-- ::boost::mem_fn( &B2DRange::isEmpty ) )
-- == static_cast<VectorOfRanges::difference_type>(maRanges.size());
-- }
--
-- void reset()
-- {
-- // swap in empty vector
-- VectorOfRanges aTmp;
-- maRanges.swap( aTmp );
--
-- maBounds.reset();
-- }
--
-- template< typename ValueType > bool isInside( const ValueType& rValue ) const
-- {
-- if( !maBounds.isInside( rValue ) )
-- return false;
--
-- // cannot use ::boost::bind here, since isInside is overloaded.
-- // It is currently not possible to resolve the overload
-- // by considering one of the other template arguments.
-- VectorOfRanges::const_iterator aCurr( maRanges.begin() );
-- const VectorOfRanges::const_iterator aEnd ( maRanges.end() );
-- while( aCurr != aEnd )
-- if( aCurr->isInside( rValue ) )
-- return true;
--
-- return false;
-- }
--
-- bool overlaps( const B2DRange& rRange ) const
-- {
-- if( !maBounds.overlaps( rRange ) )
-- return false;
--
-- const VectorOfRanges::const_iterator aEnd( maRanges.end() );
-- return ::std::find_if( maRanges.begin(),
-- aEnd,
-- ::boost::bind<bool>( ::boost::mem_fn( &B2DRange::overlaps ),
-- _1,
-- rRange ) ) != aEnd;
-- }
--
-- void addRange( const B2DRange& rRange )
-- {
-- maRanges.push_back( rRange );
-- maBounds.expand( rRange );
-- }
--
-- B2DRange getBounds() const
-- {
-- return maBounds;
-- }
--
-- B2DPolyPolygon getPolyPolygon() const
-- {
-- B2DPolyPolygon aRes;
--
-- // Make range vector unique ( have to avoid duplicate
-- // rectangles. The polygon clipper will return an empty
-- // result in this case).
-- VectorOfRanges aUniqueRanges;
-- aUniqueRanges.reserve( maRanges.size() );
--
-- VectorOfRanges::const_iterator aCurr( maRanges.begin() );
-- const VectorOfRanges::const_iterator aEnd ( maRanges.end() );
-- while( aCurr != aEnd )
-- {
-- // TODO(F3): It's plain wasted resources to apply a
-- // general clipping algorithm to the problem at
-- // hand. Go for a dedicated, scan-line-based approach.
-- VectorOfRanges::const_iterator aCurrScan( aCurr+1 );
-- VectorOfRanges::const_iterator aFound( aEnd );
-- while( aCurrScan != aEnd )
-- {
-- if( aCurrScan->equal( *aCurr ) ||
-- aCurrScan->isInside( *aCurr ) )
-- {
-- // current probe is equal to aCurr, or
-- // completely contains aCurr. Thus, stop
-- // searching, because aCurr is definitely not
-- // a member of the unique rect list
-- aFound = aCurrScan;
-- break;
-- }
--
-- ++aCurrScan;
-- }
--
-- if( aFound == aEnd )
-- {
-- // check whether aCurr is fully contained in one
-- // of the already added rects. If yes, we can skip
-- // it.
-- bool bUnique( true );
-- VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() );
-- VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() );
-- while( aCurrUnique != aEndUnique )
-- {
-- if( aCurrUnique->isInside( *aCurr ) )
-- {
-- // fully contained, no need to add
-- bUnique = false;
-- break;
-- }
--
-- ++aCurrUnique;
-- }
--
-- if( bUnique )
-- aUniqueRanges.push_back( *aCurr );
-- }
--
-- ++aCurr;
-- }
--
-- VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() );
-- const VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() );
-- while( aCurrUnique != aEndUnique )
-- {
-- // simply merge all unique parts (OR)
-- aRes.append( tools::createPolygonFromRect( *aCurrUnique++ ) );
-- }
--
-- // remove redundant intersections. Note: since all added
-- // rectangles are positively oriented, this method cannot
-- // generate any holes.
-- aRes = basegfx::tools::solveCrossovers(aRes);
-- aRes = basegfx::tools::stripNeutralPolygons(aRes);
-- aRes = basegfx::tools::stripDispensablePolygons(aRes, false);
--
-- return aRes;
-- }
--
-- private:
-- typedef ::std::vector< B2DRange > VectorOfRanges;
--
-- B2DRange maBounds;
-- VectorOfRanges maRanges;
-- };
--
--
-- // ====================================================================
--
--
-- B2DMultiRange::B2DMultiRange() :
-- mpImpl()
-- {
-- }
--
-- B2DMultiRange::B2DMultiRange( const B2DRange& rRange ) :
-- mpImpl( ImplB2DMultiRange( rRange ) )
-- {
-- }
--
-- B2DMultiRange::~B2DMultiRange()
-- {
-- // otherwise, ImplB2DMultiRange would be an incomplete type
-- }
--
-- B2DMultiRange::B2DMultiRange( const B2DMultiRange& rSrc ) :
-- mpImpl( rSrc.mpImpl )
-- {
-- }
--
-- B2DMultiRange& B2DMultiRange::operator=( const B2DMultiRange& rSrc )
-- {
-- mpImpl = rSrc.mpImpl;
-- return *this;
-- }
--
-- bool B2DMultiRange::isEmpty() const
-- {
-- return mpImpl->isEmpty();
-- }
--
-- void B2DMultiRange::reset()
-- {
-- mpImpl->reset();
-- }
--
-- bool B2DMultiRange::isInside( const B2DTuple& rTuple ) const
-- {
-- return mpImpl->isInside( rTuple );
-- }
--
-- bool B2DMultiRange::isInside( const B2DRange& rRange ) const
-- {
-- return mpImpl->isInside( rRange );
-- }
--
-- bool B2DMultiRange::overlaps( const B2DRange& rRange ) const
-- {
-- return mpImpl->overlaps( rRange );
-- }
--
-- void B2DMultiRange::addRange( const B2DRange& rRange )
-- {
-- mpImpl->addRange( rRange );
-- }
--
-- B2DRange B2DMultiRange::getBounds() const
-- {
-- return mpImpl->getBounds();
-- }
--
-- B2DPolyPolygon B2DMultiRange::getPolyPolygon() const
-- {
-- return mpImpl->getPolyPolygon();
-- }
--
--} // end of namespace basegfx
--
--// eof
-diff --git basegfx/source/range/b2dpolyrange.cxx basegfx/source/range/b2dpolyrange.cxx
-new file mode 100644
-index 0000000..ae94f14
---- /dev/null
-+++ basegfx/source/range/b2dpolyrange.cxx
-@@ -0,0 +1,371 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dmultirange.cxx,v $
-+ * $Revision: 1.8 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+#include <basegfx/range/b2dpolyrange.hxx>
-+
-+#include <basegfx/range/b2drange.hxx>
-+#include <basegfx/range/b2drangeclipper.hxx>
-+#include <basegfx/tuple/b2dtuple.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+
-+#include <boost/bind.hpp>
-+#include <boost/tuple/tuple.hpp>
-+#include <algorithm>
-+#include <vector>
-+
-+static basegfx::B2VectorOrientation flipOrientation(
-+ basegfx::B2VectorOrientation eOrient)
-+{
-+ return eOrient == basegfx::ORIENTATION_POSITIVE ?
-+ basegfx::ORIENTATION_NEGATIVE : basegfx::ORIENTATION_POSITIVE;
-+}
-+
-+namespace basegfx
-+{
-+ class ImplB2DPolyRange
-+ {
-+ void updateBounds()
-+ {
-+ maBounds.reset();
-+ std::for_each(maRanges.begin(),
-+ maRanges.end(),
-+ boost::bind(
-+ (void (B2DRange::*)(const B2DRange&))(
-+ &B2DRange::expand),
-+ boost::ref(maBounds),
-+ _1));
-+ }
-+
-+ public:
-+ ImplB2DPolyRange() :
-+ maBounds(),
-+ maRanges(),
-+ maOrient()
-+ {}
-+
-+ explicit ImplB2DPolyRange( const B2DPolyRange::ElementType& rElem ) :
-+ maBounds( boost::get<0>(rElem) ),
-+ maRanges( 1, boost::get<0>(rElem) ),
-+ maOrient( 1, boost::get<1>(rElem) )
-+ {}
-+
-+ explicit ImplB2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) :
-+ maBounds( rRange ),
-+ maRanges( 1, rRange ),
-+ maOrient( 1, eOrient )
-+ {}
-+
-+ bool operator==(const ImplB2DPolyRange& rRHS) const
-+ {
-+ return maRanges == rRHS.maRanges && maOrient == rRHS.maOrient;
-+ }
-+
-+ sal_uInt32 count() const
-+ {
-+ return maRanges.size();
-+ }
-+
-+ B2DPolyRange::ElementType getElement(sal_uInt32 nIndex) const
-+ {
-+ return boost::make_tuple(maRanges[nIndex],
-+ maOrient[nIndex]);
-+ }
-+
-+ void setElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement )
-+ {
-+ maRanges[nIndex] = boost::get<0>(rElement);
-+ maOrient[nIndex] = boost::get<1>(rElement);
-+ updateBounds();
-+ }
-+
-+ void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient )
-+ {
-+ maRanges[nIndex] = rRange;
-+ maOrient[nIndex] = eOrient;
-+ updateBounds();
-+ }
-+
-+ void insertElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount)
-+ {
-+ maRanges.insert(maRanges.begin()+nIndex, nCount, boost::get<0>(rElement));
-+ maOrient.insert(maOrient.begin()+nIndex, nCount, boost::get<1>(rElement));
-+ maBounds.expand(boost::get<0>(rElement));
-+ }
-+
-+ void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
-+ {
-+ maRanges.insert(maRanges.begin()+nIndex, nCount, rRange);
-+ maOrient.insert(maOrient.begin()+nIndex, nCount, eOrient);
-+ maBounds.expand(rRange);
-+ }
-+
-+ void appendElement(const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount)
-+ {
-+ maRanges.insert(maRanges.end(), nCount, boost::get<0>(rElement));
-+ maOrient.insert(maOrient.end(), nCount, boost::get<1>(rElement));
-+ maBounds.expand(boost::get<0>(rElement));
-+ }
-+
-+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
-+ {
-+ maRanges.insert(maRanges.end(), nCount, rRange);
-+ maOrient.insert(maOrient.end(), nCount, eOrient);
-+ maBounds.expand(rRange);
-+ }
-+
-+ void insertPolyRange(sal_uInt32 nIndex, const ImplB2DPolyRange& rPolyRange)
-+ {
-+ maRanges.insert(maRanges.begin()+nIndex, rPolyRange.maRanges.begin(), rPolyRange.maRanges.end());
-+ maOrient.insert(maOrient.begin()+nIndex, rPolyRange.maOrient.begin(), rPolyRange.maOrient.end());
-+ updateBounds();
-+ }
-+
-+ void appendPolyRange(const ImplB2DPolyRange& rPolyRange)
-+ {
-+ maRanges.insert(maRanges.end(),
-+ rPolyRange.maRanges.begin(),
-+ rPolyRange.maRanges.end());
-+ maOrient.insert(maOrient.end(),
-+ rPolyRange.maOrient.begin(),
-+ rPolyRange.maOrient.end());
-+ updateBounds();
-+ }
-+
-+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
-+ {
-+ maRanges.erase(maRanges.begin()+nIndex,maRanges.begin()+nIndex+nCount);
-+ maOrient.erase(maOrient.begin()+nIndex,maOrient.begin()+nIndex+nCount);
-+ updateBounds();
-+ }
-+
-+ void clear()
-+ {
-+ std::vector<B2DRange> aTmpRanges;
-+ std::vector<B2VectorOrientation> aTmpOrient;
-+
-+ maRanges.swap(aTmpRanges);
-+ maOrient.swap(aTmpOrient);
-+
-+ maBounds.reset();
-+ }
-+
-+ void flip()
-+ {
-+ std::for_each(maOrient.begin(),
-+ maOrient.end(),
-+ boost::bind(
-+ &flipOrientation,
-+ _1));
-+ }
-+
-+ B2DRange getBounds() const
-+ {
-+ return maBounds;
-+ }
-+
-+ template< typename ValueType > bool isInside( const ValueType& rValue ) const
-+ {
-+ if( !maBounds.isInside( rValue ) )
-+ return false;
-+
-+ // cannot use boost::bind here, since isInside is overloaded.
-+ // It is currently not possible to resolve the overload
-+ // by considering one of the other template arguments.
-+ std::vector<B2DRange>::const_iterator aCurr( maRanges.begin() );
-+ const std::vector<B2DRange>::const_iterator aEnd ( maRanges.end() );
-+ while( aCurr != aEnd )
-+ if( aCurr->isInside( rValue ) )
-+ return true;
-+
-+ return false;
-+ }
-+
-+ bool overlaps( const B2DRange& rRange ) const
-+ {
-+ if( !maBounds.overlaps( rRange ) )
-+ return false;
-+
-+ const std::vector<B2DRange>::const_iterator aEnd( maRanges.end() );
-+ return std::find_if( maRanges.begin(),
-+ aEnd,
-+ boost::bind<bool>( boost::mem_fn( &B2DRange::overlaps ),
-+ _1,
-+ boost::cref(rRange) ) ) != aEnd;
-+ }
-+
-+ B2DPolyPolygon solveCrossovers() const
-+ {
-+ return tools::solveCrossovers(maRanges,maOrient);
-+ }
-+
-+ private:
-+ B2DRange maBounds;
-+ std::vector<B2DRange> maRanges;
-+ std::vector<B2VectorOrientation> maOrient;
-+ };
-+
-+ B2DPolyRange::B2DPolyRange() :
-+ mpImpl()
-+ {}
-+
-+ B2DPolyRange::~B2DPolyRange()
-+ {}
-+
-+ B2DPolyRange::B2DPolyRange( const ElementType& rElem ) :
-+ mpImpl( ImplB2DPolyRange( rElem ) )
-+ {}
-+
-+ B2DPolyRange::B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) :
-+ mpImpl( ImplB2DPolyRange( rRange, eOrient ) )
-+ {}
-+
-+ B2DPolyRange::B2DPolyRange( const B2DPolyRange& rRange ) :
-+ mpImpl( rRange.mpImpl )
-+ {}
-+
-+ B2DPolyRange& B2DPolyRange::operator=( const B2DPolyRange& rRange )
-+ {
-+ mpImpl = rRange.mpImpl;
-+ return *this;
-+ }
-+
-+ void B2DPolyRange::makeUnique()
-+ {
-+ mpImpl.make_unique();
-+ }
-+
-+ bool B2DPolyRange::operator==(const B2DPolyRange& rRange) const
-+ {
-+ if(mpImpl.same_object(rRange.mpImpl))
-+ return true;
-+
-+ return ((*mpImpl) == (*rRange.mpImpl));
-+ }
-+
-+ bool B2DPolyRange::operator!=(const B2DPolyRange& rRange) const
-+ {
-+ return !(*this == rRange);
-+ }
-+
-+ sal_uInt32 B2DPolyRange::count() const
-+ {
-+ return mpImpl->count();
-+ }
-+
-+ B2DPolyRange::ElementType B2DPolyRange::getElement(sal_uInt32 nIndex) const
-+ {
-+ return mpImpl->getElement(nIndex);
-+ }
-+
-+ void B2DPolyRange::setElement(sal_uInt32 nIndex, const ElementType& rElement )
-+ {
-+ mpImpl->setElement(nIndex, rElement);
-+ }
-+
-+ void B2DPolyRange::setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient )
-+ {
-+ mpImpl->setElement(nIndex, rRange, eOrient );
-+ }
-+
-+ void B2DPolyRange::insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount)
-+ {
-+ mpImpl->insertElement(nIndex, rElement, nCount );
-+ }
-+
-+ void B2DPolyRange::insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
-+ {
-+ mpImpl->insertElement(nIndex, rRange, eOrient, nCount );
-+ }
-+
-+ void B2DPolyRange::appendElement(const ElementType& rElement, sal_uInt32 nCount)
-+ {
-+ mpImpl->appendElement(rElement, nCount);
-+ }
-+
-+ void B2DPolyRange::appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount)
-+ {
-+ mpImpl->appendElement(rRange, eOrient, nCount );
-+ }
-+
-+ void B2DPolyRange::insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange& rRange)
-+ {
-+ mpImpl->insertPolyRange(nIndex, *rRange.mpImpl);
-+ }
-+
-+ void B2DPolyRange::appendPolyRange(const B2DPolyRange& rRange)
-+ {
-+ mpImpl->appendPolyRange(*rRange.mpImpl);
-+ }
-+
-+ void B2DPolyRange::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
-+ {
-+ mpImpl->remove(nIndex, nCount);
-+ }
-+
-+ void B2DPolyRange::clear()
-+ {
-+ mpImpl->clear();
-+ }
-+
-+ void B2DPolyRange::flip()
-+ {
-+ mpImpl->flip();
-+ }
-+
-+ B2DRange B2DPolyRange::getBounds() const
-+ {
-+ return mpImpl->getBounds();
-+ }
-+
-+ bool B2DPolyRange::isInside( const B2DTuple& rTuple ) const
-+ {
-+ return mpImpl->isInside(rTuple);
-+ }
-+
-+ bool B2DPolyRange::isInside( const B2DRange& rRange ) const
-+ {
-+ return mpImpl->isInside(rRange);
-+ }
-+
-+ bool B2DPolyRange::overlaps( const B2DRange& rRange ) const
-+ {
-+ return mpImpl->overlaps(rRange);
-+ }
-+
-+ B2DPolyPolygon B2DPolyRange::solveCrossovers() const
-+ {
-+ return mpImpl->solveCrossovers();
-+ }
-+
-+} // end of namespace basegfx
-+
-+// eof
-diff --git basegfx/source/range/b2drangeclipper.cxx basegfx/source/range/b2drangeclipper.cxx
-new file mode 100644
-index 0000000..de5c040
---- /dev/null
-+++ basegfx/source/range/b2drangeclipper.cxx
-@@ -0,0 +1,950 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dmultirange.cxx,v $
-+ * $Revision: 1.8 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+
-+#include <rtl/math.hxx>
-+
-+#include <basegfx/tuple/b2dtuple.hxx>
-+#include <basegfx/range/b2drange.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+
-+#include <o3tl/vector_pool.hxx>
-+#include <boost/bind.hpp>
-+#include <boost/utility.hpp>
-+
-+#include <algorithm>
-+#include <deque>
-+#include <list>
-+
-+
-+namespace basegfx
-+{
-+ namespace
-+ {
-+ // Generating a poly-polygon from a bunch of rectangles
-+ //
-+ // Helper functionality for sweep-line algorithm
-+ // ====================================================
-+
-+ typedef std::vector<B2DRange> VectorOfRanges;
-+
-+ class ImplPolygon;
-+ typedef o3tl::vector_pool<ImplPolygon> VectorOfPolygons;
-+
-+
-+ /** This class represents an active edge
-+
-+ As the sweep line traverses across the overall area,
-+ rectangle edges parallel to it generate events, and
-+ rectangle edges orthogonal to it generate active
-+ edges. This class represents the latter.
-+ */
-+ class ActiveEdge
-+ {
-+ public:
-+ /** The two possible active rectangle edges differ by one
-+ coordinate value - the upper edge has the lower, the
-+ lower edge the higher value.
-+ */
-+ enum EdgeType {
-+ /// edge with lower coordinate value
-+ UPPER=0,
-+ /// edge with higher coordinate value
-+ LOWER=1
-+ };
-+
-+ enum EdgeDirection {
-+ /// edge proceeds to the left
-+ PROCEED_LEFT=0,
-+ /// edge proceeds to the right
-+ PROCEED_RIGHT=1
-+ };
-+
-+ /** Create active edge
-+
-+ @param rRect
-+ Rectangle this edge is part of
-+
-+ @param fInvariantCoord
-+ The invariant ccordinate value of this edge
-+
-+ @param eEdgeType
-+ Is fInvariantCoord the lower or the higher value, for
-+ this rect?
-+ */
-+ ActiveEdge( const B2DRectangle& rRect,
-+ const double& fInvariantCoord,
-+ std::ptrdiff_t nPolyIdx,
-+ EdgeType eEdgeType,
-+ EdgeDirection eEdgeDirection ) :
-+ mfInvariantCoord(fInvariantCoord),
-+ mpAssociatedRect( &rRect ),
-+ mnPolygonIdx( nPolyIdx ),
-+ meEdgeType( eEdgeType ),
-+ meEdgeDirection( eEdgeDirection )
-+ {}
-+
-+ double getInvariantCoord() const { return mfInvariantCoord; }
-+ const B2DRectangle& getRect() const { return *mpAssociatedRect; }
-+ std::ptrdiff_t getTargetPolygonIndex() const { return mnPolygonIdx; }
-+ void setTargetPolygonIndex( std::ptrdiff_t nIdx ) { mnPolygonIdx = nIdx; }
-+ EdgeType getEdgeType() const { return meEdgeType; }
-+ EdgeDirection getEdgeDirection() const { return meEdgeDirection; }
-+
-+ /// For STL sort
-+ bool operator<( const ActiveEdge& rRHS ) const { return mfInvariantCoord < rRHS.mfInvariantCoord; }
-+
-+ private:
-+ /** The invariant coordinate value of this edge (e.g. the
-+ common y value, for a horizontal edge)
-+ */
-+ double mfInvariantCoord;
-+
-+ /** Associated rectangle
-+
-+ This on the one hand saves some storage space (the
-+ vector of rectangles is persistent, anyway), and on
-+ the other hand provides an identifier to match active
-+ edges and x events (see below)
-+
-+ Ptr because class needs to be assignable
-+ */
-+ const B2DRectangle* mpAssociatedRect;
-+
-+ /** Index of the polygon this edge is currently involved
-+ with.
-+
-+ Note that this can change for some kinds of edge
-+ intersection, as the algorithm tends to swap
-+ associated polygons there.
-+
-+ -1 denotes no assigned polygon
-+ */
-+ std::ptrdiff_t mnPolygonIdx;
-+
-+ /// 'upper' or 'lower' edge of original rectangle.
-+ EdgeType meEdgeType;
-+
-+ /// 'left' or 'right'
-+ EdgeDirection meEdgeDirection;
-+ };
-+
-+ // Needs to be list - various places hold ptrs to elements
-+ typedef std::list< ActiveEdge > ListOfEdges;
-+
-+
-+ /** Element of the sweep line event list
-+
-+ As the sweep line traverses across the overall area,
-+ rectangle edges parallel to it generate events, and
-+ rectangle edges orthogonal to it generate active
-+ edges. This class represents the former.
-+
-+ The class defines an element of the sweep line list. The
-+ sweep line's position jumps in steps defined by the
-+ coordinates of the sorted SweepLineEvent entries.
-+ */
-+ class SweepLineEvent
-+ {
-+ public:
-+ /** The two possible sweep line rectangle edges differ by
-+ one coordinate value - the starting edge has the
-+ lower, the finishing edge the higher value.
-+ */
-+ enum EdgeType {
-+ /// edge with lower coordinate value
-+ STARTING_EDGE=0,
-+ /// edge with higher coordinate value
-+ FINISHING_EDGE=1
-+ };
-+
-+ /** The two possible sweep line directions
-+ */
-+ enum EdgeDirection {
-+ PROCEED_UP=0,
-+ PROCEED_DOWN=1
-+ };
-+
-+ /** Create sweep line event
-+
-+ @param fPos
-+ Coordinate position of the event
-+
-+ @param rRect
-+ Rectangle this event is generated for.
-+
-+ @param eEdgeType
-+ Is fPos the lower or the higher value, for the
-+ rectangle this event is generated for?
-+ */
-+ SweepLineEvent( double fPos,
-+ const B2DRectangle& rRect,
-+ EdgeType eEdgeType,
-+ EdgeDirection eDirection) :
-+ mfPos( fPos ),
-+ mpAssociatedRect( &rRect ),
-+ meEdgeType( eEdgeType ),
-+ meEdgeDirection( eDirection )
-+ {}
-+
-+ double getPos() const { return mfPos; }
-+ const B2DRectangle& getRect() const { return *mpAssociatedRect; }
-+ EdgeType getEdgeType() const { return meEdgeType; }
-+ EdgeDirection getEdgeDirection() const { return meEdgeDirection; }
-+
-+ /// For STL sort
-+ bool operator<( const SweepLineEvent& rRHS ) const { return mfPos < rRHS.mfPos; }
-+
-+ private:
-+ /// position of the event, in the direction of the line sweep
-+ double mfPos;
-+
-+ /** Rectangle this event is generated for
-+
-+ This on the one hand saves some storage space (the
-+ vector of rectangles is persistent, anyway), and on
-+ the other hand provides an identifier to match active
-+ edges and events (see below)
-+
-+ Ptr because class needs to be assignable
-+ */
-+ const B2DRectangle* mpAssociatedRect;
-+
-+ /// 'upper' or 'lower' edge of original rectangle.
-+ EdgeType meEdgeType;
-+
-+ /// 'up' or 'down'
-+ EdgeDirection meEdgeDirection;
-+ };
-+
-+ typedef std::vector< SweepLineEvent > VectorOfEvents;
-+
-+
-+ /** Smart point container for B2DMultiRange::getPolyPolygon()
-+
-+ This class provides methods needed only here, and is used
-+ as a place to store some additional information per
-+ polygon. Also, most of the intersection logic is
-+ implemented here.
-+ */
-+ class ImplPolygon
-+ {
-+ public:
-+ /** Create polygon
-+ */
-+ ImplPolygon() :
-+ mpLeadingRightEdge(NULL),
-+ mnIdx(-1),
-+ maPoints(),
-+ mbIsFinished(false)
-+ {
-+ // completely ad-hoc. but what the hell.
-+ maPoints.reserve(11);
-+ }
-+
-+ void setPolygonPoolIndex( std::ptrdiff_t nIdx ) { mnIdx = nIdx; }
-+ bool isFinished() const { return mbIsFinished; }
-+
-+ /// Add point to the end of the existing points
-+ void append( const B2DPoint& rPoint )
-+ {
-+ OSL_PRECOND( maPoints.empty() ||
-+ maPoints.back().getX() == rPoint.getX() ||
-+ maPoints.back().getY() == rPoint.getY(),
-+ "ImplPolygon::append(): added point violates 90 degree line angle constraint!" );
-+
-+ if( maPoints.empty() ||
-+ maPoints.back() != rPoint )
-+ {
-+ // avoid duplicate points
-+ maPoints.push_back( rPoint );
-+ }
-+ }
-+
-+ /** Perform the intersection of this polygon with an
-+ active edge.
-+
-+ @param rEvent
-+ The vertical line event that generated the
-+ intersection
-+
-+ @param rActiveEdge
-+ The active edge that generated the intersection
-+
-+ @param rPolygonPool
-+ Polygon pool, we sometimes need to allocate a new one
-+
-+ @param bIsFinishingEdge
-+ True, when this is hitting the last edge of the
-+ vertical sweep - every vertical sweep starts and ends
-+ with upper and lower edge of the _same_ rectangle.
-+
-+ @return the new current polygon (that's the one
-+ processing must proceed with, when going through the
-+ list of upcoming active edges).
-+ */
-+ std::ptrdiff_t intersect( SweepLineEvent& rEvent,
-+ ActiveEdge& rActiveEdge,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes,
-+ bool isFinishingEdge )
-+ {
-+ OSL_PRECOND( !isFinished(),
-+ "ImplPolygon::intersect(): called on already finished polygon!" );
-+ OSL_PRECOND( !isFinishingEdge
-+ || (isFinishingEdge && &rEvent.getRect() == &rActiveEdge.getRect()),
-+ "ImplPolygon::intersect(): inconsistent ending!" );
-+
-+ const B2DPoint aIntersectionPoint( rEvent.getPos(),
-+ rActiveEdge.getInvariantCoord() );
-+
-+ // intersection point, goes to our polygon
-+ // unconditionally
-+ append(aIntersectionPoint);
-+
-+ const bool isSweepLineEnteringRect(
-+ rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE);
-+ if( isFinishingEdge )
-+ {
-+ if( isSweepLineEnteringRect )
-+ handleFinalOwnRightEdge(rActiveEdge);
-+ else
-+ handleFinalOwnLeftEdge(rActiveEdge,
-+ rPolygonPool,
-+ rRes);
-+
-+ // we're done with this rect & sweep line
-+ return -1;
-+ }
-+ else if( metOwnEdge(rEvent,rActiveEdge) )
-+ {
-+ handleInitialOwnEdge(rEvent, rActiveEdge);
-+
-+ // point already added, all init done, continue
-+ // with same poly
-+ return mnIdx;
-+ }
-+ else
-+ {
-+ OSL_ENSURE( rActiveEdge.getTargetPolygonIndex() != -1,
-+ "ImplPolygon::intersect(): non-trivial intersection hit empty polygon!" );
-+
-+ const bool isHittingLeftEdge(
-+ rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT);
-+
-+ if( isHittingLeftEdge )
-+ return handleComplexLeftEdge(rActiveEdge,
-+ aIntersectionPoint,
-+ rPolygonPool,
-+ rRes);
-+ else
-+ return handleComplexRightEdge(rActiveEdge,
-+ aIntersectionPoint,
-+ rPolygonPool);
-+ }
-+ }
-+
-+ private:
-+ std::ptrdiff_t getPolygonPoolIndex() const { return mnIdx; }
-+
-+ void handleInitialOwnEdge(SweepLineEvent& rEvent,
-+ ActiveEdge& rActiveEdge)
-+ {
-+ const bool isActiveEdgeProceedLeft(
-+ rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT);
-+ const bool isSweepLineEnteringRect(
-+ rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE);
-+ (void)isActiveEdgeProceedLeft;
-+ (void)isSweepLineEnteringRect;
-+
-+ OSL_ENSURE( isSweepLineEnteringRect == isActiveEdgeProceedLeft,
-+ "ImplPolygon::intersect(): sweep initial own edge hit: wrong polygon order" );
-+
-+ OSL_ENSURE( isSweepLineEnteringRect ||
-+ mpLeadingRightEdge == &rActiveEdge,
-+ "ImplPolygon::intersect(): sweep initial own edge hit: wrong leading edge" );
-+ }
-+
-+ void handleFinalOwnRightEdge(ActiveEdge& rActiveEdge)
-+ {
-+ OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_RIGHT,
-+ "ImplPolygon::handleInitialOwnRightEdge(): start edge wrong polygon order" );
-+
-+ rActiveEdge.setTargetPolygonIndex(mnIdx);
-+ mpLeadingRightEdge = &rActiveEdge;
-+ }
-+
-+ void handleFinalOwnLeftEdge(ActiveEdge& rActiveEdge,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes)
-+ {
-+ OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT,
-+ "ImplPolygon::handleFinalOwnLeftEdge(): end edge wrong polygon order" );
-+
-+ const bool isHittingOurTail(
-+ rActiveEdge.getTargetPolygonIndex() == mnIdx);
-+
-+ if( isHittingOurTail )
-+ finish(rRes); // just finish. no fuss.
-+ else
-+ {
-+ // temp poly hits final left edge
-+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
-+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
-+
-+ // active edge's polygon has points
-+ // already. ours need to go in front of them.
-+ maPoints.insert(maPoints.end(),
-+ rTmp.maPoints.begin(),
-+ rTmp.maPoints.end());
-+
-+ // adjust leading edges, we're switching the polygon
-+ ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge;
-+
-+ mpLeadingRightEdge = pFarEdge;
-+ pFarEdge->setTargetPolygonIndex(mnIdx);
-+
-+ // nTmpIdx is an empty shell, get rid of it
-+ rPolygonPool.free(nTmpIdx);
-+ }
-+ }
-+
-+ std::ptrdiff_t handleComplexLeftEdge(ActiveEdge& rActiveEdge,
-+ const B2DPoint& rIntersectionPoint,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes)
-+ {
-+ const bool isHittingOurTail(
-+ rActiveEdge.getTargetPolygonIndex() == mnIdx);
-+ if( isHittingOurTail )
-+ {
-+ finish(rRes);
-+
-+ // so "this" is done - need new polygon to collect
-+ // further points
-+ const std::ptrdiff_t nIdxNewPolygon=rPolygonPool.alloc();
-+ rPolygonPool.get(nIdxNewPolygon).setPolygonPoolIndex(nIdxNewPolygon);
-+ rPolygonPool.get(nIdxNewPolygon).append(rIntersectionPoint);
-+
-+ rActiveEdge.setTargetPolygonIndex(nIdxNewPolygon);
-+
-+ return nIdxNewPolygon;
-+ }
-+ else
-+ {
-+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
-+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
-+
-+ // active edge's polygon has points
-+ // already. ours need to go in front of them.
-+ maPoints.insert(maPoints.end(),
-+ rTmp.maPoints.begin(),
-+ rTmp.maPoints.end());
-+
-+ rTmp.maPoints.clear();
-+ rTmp.append(rIntersectionPoint);
-+
-+ // adjust leading edges, we're switching the polygon
-+ ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge;
-+ ActiveEdge* const pNearEdge=&rActiveEdge;
-+
-+ rTmp.mpLeadingRightEdge = NULL;
-+ pNearEdge->setTargetPolygonIndex(nTmpIdx);
-+
-+ mpLeadingRightEdge = pFarEdge;
-+ pFarEdge->setTargetPolygonIndex(mnIdx);
-+
-+ return nTmpIdx;
-+ }
-+ }
-+
-+ std::ptrdiff_t handleComplexRightEdge(ActiveEdge& rActiveEdge,
-+ const B2DPoint& rIntersectionPoint,
-+ VectorOfPolygons& rPolygonPool)
-+ {
-+ const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex();
-+ ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx);
-+
-+ rTmp.append(rIntersectionPoint);
-+
-+ rActiveEdge.setTargetPolygonIndex(mnIdx);
-+ mpLeadingRightEdge = &rActiveEdge;
-+
-+ rTmp.mpLeadingRightEdge = NULL;
-+
-+ return nTmpIdx;
-+ }
-+
-+ /// True when sweep line hits our own active edge
-+ bool metOwnEdge(const SweepLineEvent& rEvent,
-+ ActiveEdge& rActiveEdge)
-+ {
-+ const bool bHitOwnEdge=&rEvent.getRect() == &rActiveEdge.getRect();
-+ return bHitOwnEdge;
-+ }
-+
-+ /// Retrieve B2DPolygon from this object
-+ B2DPolygon getPolygon() const
-+ {
-+ B2DPolygon aRes;
-+ std::for_each( maPoints.begin(),
-+ maPoints.end(),
-+ boost::bind(
-+ &B2DPolygon::append,
-+ boost::ref(aRes),
-+ _1,
-+ 1 ) );
-+ aRes.setClosed( true );
-+ return aRes;
-+ }
-+
-+ /** Finish this polygon, push to result set.
-+ */
-+ void finish(B2DPolyPolygon& rRes)
-+ {
-+ OSL_PRECOND( maPoints.empty() ||
-+ maPoints.front().getX() == maPoints.back().getX() ||
-+ maPoints.front().getY() == maPoints.back().getY(),
-+ "ImplPolygon::finish(): first and last point violate 90 degree line angle constraint!" );
-+
-+ mbIsFinished = true;
-+ mpLeadingRightEdge = NULL;
-+
-+ rRes.append(getPolygon());
-+ }
-+
-+ /** Refers to the current leading edge element of this
-+ polygon, or NULL. The leading edge denotes the 'front'
-+ of the polygon vertex sequence, i.e. the coordinates
-+ at the polygon's leading edge are returned from
-+ maPoints.front()
-+ */
-+ ActiveEdge* mpLeadingRightEdge;
-+
-+ /// current index into vector pool
-+ std::ptrdiff_t mnIdx;
-+
-+ /// Container for the actual polygon points
-+ std::vector<B2DPoint> maPoints;
-+
-+ /// When true, this polygon is 'done', i.e. nothing must be added anymore.
-+ bool mbIsFinished;
-+ };
-+
-+ /** Init sweep line event list
-+
-+ This method fills the event list with the sweep line
-+ events generated from the input rectangles, and sorts them
-+ with increasing x.
-+ */
-+ void setupSweepLineEventListFromRanges( VectorOfEvents& o_rEventVector,
-+ const std::vector<B2DRange>& rRanges,
-+ const std::vector<B2VectorOrientation>& rOrientations )
-+ {
-+ // we need exactly 2*rectVec.size() events: one for the
-+ // left, and one for the right edge of each rectangle
-+ o_rEventVector.clear();
-+ o_rEventVector.reserve( 2*rRanges.size() );
-+
-+ // generate events
-+ // ===============
-+
-+ // first pass: add all left edges in increasing order
-+ std::vector<B2DRange>::const_iterator aCurrRect=rRanges.begin();
-+ std::vector<B2VectorOrientation>::const_iterator aCurrOrientation=rOrientations.begin();
-+ const std::vector<B2DRange>::const_iterator aEnd=rRanges.end();
-+ const std::vector<B2VectorOrientation>::const_iterator aEndOrientation=rOrientations.end();
-+ while( aCurrRect != aEnd && aCurrOrientation != aEndOrientation )
-+ {
-+ const B2DRectangle& rCurrRect( *aCurrRect++ );
-+
-+ o_rEventVector.push_back(
-+ SweepLineEvent( rCurrRect.getMinX(),
-+ rCurrRect,
-+ SweepLineEvent::STARTING_EDGE,
-+ (*aCurrOrientation++) == ORIENTATION_POSITIVE ?
-+ SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) );
-+ }
-+
-+ // second pass: add all right edges in reversed order
-+ std::vector<B2DRange>::const_reverse_iterator aCurrRectR=rRanges.rbegin();
-+ std::vector<B2VectorOrientation>::const_reverse_iterator aCurrOrientationR=rOrientations.rbegin();
-+ const std::vector<B2DRange>::const_reverse_iterator aEndR=rRanges.rend();
-+ const std::vector<B2VectorOrientation>::const_reverse_iterator aEndOrientationR=rOrientations.rend();
-+ while( aCurrRectR != aEndR )
-+ {
-+ const B2DRectangle& rCurrRect( *aCurrRectR++ );
-+
-+ o_rEventVector.push_back(
-+ SweepLineEvent( rCurrRect.getMaxX(),
-+ rCurrRect,
-+ SweepLineEvent::FINISHING_EDGE,
-+ (*aCurrOrientationR++) == ORIENTATION_POSITIVE ?
-+ SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) );
-+ }
-+
-+ // sort events
-+ // ===========
-+
-+ // since we use stable_sort, the order of events with the
-+ // same x value will not change. The elaborate two-pass
-+ // add above thus ensures, that for each two rectangles
-+ // with similar left and right x coordinates, the
-+ // rectangle whose left event comes first will have its
-+ // right event come last. This is advantageous for the
-+ // clip algorithm below, see handleRightEdgeCrossing().
-+
-+ // TODO(P3): Use radix sort (from
-+ // b2dpolypolygonrasterconverter, or have your own
-+ // templatized version).
-+ std::stable_sort( o_rEventVector.begin(),
-+ o_rEventVector.end() );
-+ }
-+
-+ /** Insert two active edge segments for the given rectangle.
-+
-+ This method creates two active edge segments from the
-+ given rect, and inserts them into the active edge list,
-+ such that this stays sorted (if it was before).
-+
-+ @param io_rEdgeList
-+ Active edge list to insert into
-+
-+ @param io_rPolygons
-+ Vector of polygons. Each rectangle added creates one
-+ tentative result polygon in this vector, and the edge list
-+ entries holds a reference to that polygon (this _requires_
-+ that the polygon vector does not reallocate, i.e. it must
-+ have at least the maximal number of rectangles reserved)
-+
-+ @param o_CurrentPolygon
-+ The then-current polygon when processing this sweep line
-+ event
-+
-+ @param rCurrEvent
-+ The actual event that caused this call
-+ */
-+ void createActiveEdgesFromStartEvent( ListOfEdges& io_rEdgeList,
-+ VectorOfPolygons& io_rPolygonPool,
-+ SweepLineEvent& rCurrEvent )
-+ {
-+ ListOfEdges aNewEdges;
-+ const B2DRectangle& rRect=rCurrEvent.getRect();
-+ const bool bGoesDown=rCurrEvent.getEdgeDirection() == SweepLineEvent::PROCEED_DOWN;
-+
-+ // start event - new rect starts here, needs polygon to
-+ // collect points into
-+ const std::ptrdiff_t nIdxPolygon=io_rPolygonPool.alloc();
-+ io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon);
-+
-+ // upper edge
-+ aNewEdges.push_back(
-+ ActiveEdge(
-+ rRect,
-+ rRect.getMinY(),
-+ bGoesDown ? nIdxPolygon : -1,
-+ ActiveEdge::UPPER,
-+ bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) );
-+ // lower edge
-+ aNewEdges.push_back(
-+ ActiveEdge(
-+ rRect,
-+ rRect.getMaxY(),
-+ bGoesDown ? -1 : nIdxPolygon,
-+ ActiveEdge::LOWER,
-+ bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT ) );
-+
-+ // furthermore, have to respect a special tie-breaking
-+ // rule here, for edges which share the same y value:
-+ // newly added upper edges must be inserted _before_ any
-+ // other edge with the same y value, and newly added lower
-+ // edges must be _after_ all other edges with the same
-+ // y. This ensures that the left vertical edge processing
-+ // below encounters the upper edge of the current rect
-+ // first, and the lower edge last, which automatically
-+ // starts and finishes this rect correctly (as only then,
-+ // the polygon will have their associated active edges
-+ // set).
-+ const double nMinY( rRect.getMinY() );
-+ const double nMaxY( rRect.getMaxY() );
-+ ListOfEdges::iterator aCurr( io_rEdgeList.begin() );
-+ const ListOfEdges::iterator aEnd ( io_rEdgeList.end() );
-+ while( aCurr != aEnd )
-+ {
-+ const double nCurrY( aCurr->getInvariantCoord() );
-+
-+ if( nCurrY >= nMinY &&
-+ aNewEdges.size() == 2 ) // only add, if not yet done.
-+ {
-+ // insert upper edge _before_ aCurr. Thus, it will
-+ // be the first entry for a range of equal y
-+ // values. Using splice here, since we hold
-+ // references to the moved list element!
-+ io_rEdgeList.splice( aCurr,
-+ aNewEdges,
-+ aNewEdges.begin() );
-+ }
-+
-+ if( nCurrY > nMaxY )
-+ {
-+ // insert lower edge _before_ aCurr. Thus, it will
-+ // be the last entry for a range of equal y values
-+ // (aCurr is the first entry strictly larger than
-+ // nMaxY). Using splice here, since we hold
-+ // references to the moved list element!
-+ io_rEdgeList.splice( aCurr,
-+ aNewEdges,
-+ aNewEdges.begin() );
-+ // done with insertion, can early-exit here.
-+ return;
-+ }
-+
-+ ++aCurr;
-+ }
-+
-+ // append remainder of aNewList (might still contain 2 or
-+ // 1 elements, depending of the contents of io_rEdgeList).
-+ io_rEdgeList.splice( aCurr,
-+ aNewEdges );
-+ }
-+
-+ inline bool isSameRect(ActiveEdge& rEdge,
-+ const basegfx::B2DRange& rRect)
-+ {
-+ return &rEdge.getRect() == &rRect;
-+ }
-+
-+ // wow what a hack. necessary because stl's list::erase does
-+ // not eat reverse_iterator
-+ template<typename Cont, typename Iter> Iter eraseFromList(Cont&, Iter);
-+ template<> inline ListOfEdges::iterator eraseFromList(
-+ ListOfEdges& rList, ListOfEdges::iterator aIter)
-+ {
-+ return rList.erase(aIter);
-+ }
-+ template<> inline ListOfEdges::reverse_iterator eraseFromList(
-+ ListOfEdges& rList, ListOfEdges::reverse_iterator aIter)
-+ {
-+ return ListOfEdges::reverse_iterator(
-+ rList.erase(boost::prior(aIter.base())));
-+ }
-+
-+ template<int bPerformErase,
-+ typename Iterator> inline void processActiveEdges(
-+ Iterator first,
-+ Iterator last,
-+ ListOfEdges& rActiveEdgeList,
-+ SweepLineEvent& rCurrEvent,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes )
-+ {
-+ const basegfx::B2DRange& rCurrRect=rCurrEvent.getRect();
-+
-+ // fast-forward to rCurrEvent's first active edge (holds
-+ // for both starting and finishing sweep line events, a
-+ // rect is regarded _outside_ any rects whose events have
-+ // started earlier
-+ first = std::find_if(first, last,
-+ boost::bind(
-+ &isSameRect,
-+ _1,
-+ boost::cref(rCurrRect)));
-+
-+ if(first == last)
-+ return;
-+
-+ int nCount=0;
-+ std::ptrdiff_t nCurrPolyIdx=-1;
-+ while(first != last)
-+ {
-+ if( nCurrPolyIdx == -1 )
-+ nCurrPolyIdx=first->getTargetPolygonIndex();
-+
-+ OSL_ASSERT(nCurrPolyIdx != -1);
-+
-+ // second encounter of my rect -> second edge
-+ // encountered, done
-+ const bool bExit=
-+ nCount &&
-+ isSameRect(*first,
-+ rCurrRect);
-+
-+ // deal with current active edge
-+ nCurrPolyIdx =
-+ rPolygonPool.get(nCurrPolyIdx).intersect(
-+ rCurrEvent,
-+ *first,
-+ rPolygonPool,
-+ rRes,
-+ bExit);
-+
-+ // prune upper & lower active edges, if requested
-+ if( bPerformErase && (bExit || !nCount) )
-+ first = eraseFromList(rActiveEdgeList,first);
-+ else
-+ ++first;
-+
-+ // delayed exit, had to prune first
-+ if( bExit )
-+ return;
-+
-+ ++nCount;
-+ }
-+ }
-+
-+ template<int bPerformErase> inline void processActiveEdgesTopDown(
-+ SweepLineEvent& rCurrEvent,
-+ ListOfEdges& rActiveEdgeList,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes )
-+ {
-+ processActiveEdges<bPerformErase>(
-+ rActiveEdgeList. begin(),
-+ rActiveEdgeList. end(),
-+ rActiveEdgeList,
-+ rCurrEvent,
-+ rPolygonPool,
-+ rRes);
-+ }
-+
-+ template<int bPerformErase> inline void processActiveEdgesBottomUp(
-+ SweepLineEvent& rCurrEvent,
-+ ListOfEdges& rActiveEdgeList,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes )
-+ {
-+ processActiveEdges<bPerformErase>(
-+ rActiveEdgeList. rbegin(),
-+ rActiveEdgeList. rend(),
-+ rActiveEdgeList,
-+ rCurrEvent,
-+ rPolygonPool,
-+ rRes);
-+ }
-+
-+ enum{ NoErase=0, PerformErase=1 };
-+
-+ void handleStartingEdge( SweepLineEvent& rCurrEvent,
-+ ListOfEdges& rActiveEdgeList,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes)
-+ {
-+ // inject two new active edges for rect
-+ createActiveEdgesFromStartEvent( rActiveEdgeList,
-+ rPolygonPool,
-+ rCurrEvent );
-+
-+ if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() )
-+ processActiveEdgesTopDown<NoErase>(
-+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
-+ else
-+ processActiveEdgesBottomUp<NoErase>(
-+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
-+ }
-+
-+ void handleFinishingEdge( SweepLineEvent& rCurrEvent,
-+ ListOfEdges& rActiveEdgeList,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes)
-+ {
-+ if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() )
-+ processActiveEdgesTopDown<PerformErase>(
-+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
-+ else
-+ processActiveEdgesBottomUp<PerformErase>(
-+ rCurrEvent, rActiveEdgeList, rPolygonPool, rRes);
-+ }
-+
-+ inline void handleSweepLineEvent( SweepLineEvent& rCurrEvent,
-+ ListOfEdges& rActiveEdgeList,
-+ VectorOfPolygons& rPolygonPool,
-+ B2DPolyPolygon& rRes)
-+ {
-+ if( SweepLineEvent::STARTING_EDGE == rCurrEvent.getEdgeType() )
-+ handleStartingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes);
-+ else
-+ handleFinishingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes);
-+ }
-+ }
-+
-+ namespace tools
-+ {
-+ B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
-+ const std::vector<B2VectorOrientation>& rOrientations)
-+ {
-+ // sweep-line algorithm to generate a poly-polygon
-+ // from a bunch of rectangles
-+ // ===============================================
-+ //
-+ // This algorithm uses the well-known sweep line
-+ // concept, explained in every good text book about
-+ // computational geometry.
-+ //
-+ // We start with creating two structures for every
-+ // rectangle, one representing the left x coordinate,
-+ // one representing the right x coordinate (and both
-+ // referencing the original rect). These structs are
-+ // sorted with increasing x coordinates.
-+ //
-+ // Then, we start processing the resulting list from
-+ // the beginning. Every entry in the list defines a
-+ // point in time of the line sweeping from left to
-+ // right across all rectangles.
-+ VectorOfEvents aSweepLineEvents;
-+ setupSweepLineEventListFromRanges( aSweepLineEvents,
-+ rRanges,
-+ rOrientations );
-+
-+ B2DPolyPolygon aRes;
-+ VectorOfPolygons aPolygonPool;
-+ ListOfEdges aActiveEdgeList;
-+
-+ // sometimes not enough, but a usable compromise
-+ aPolygonPool.reserve( rRanges.size() );
-+
-+ std::for_each( aSweepLineEvents.begin(),
-+ aSweepLineEvents.end(),
-+ boost::bind(
-+ &handleSweepLineEvent,
-+ _1,
-+ boost::ref(aActiveEdgeList),
-+ boost::ref(aPolygonPool),
-+ boost::ref(aRes)) );
-+
-+ return aRes;
-+ }
-+ }
-+}
-+
-diff --git basegfx/source/range/makefile.mk basegfx/source/range/makefile.mk
-index 678bb16..3dcf552 100644
---- basegfx/source/range/makefile.mk
-+++ basegfx/source/range/makefile.mk
-@@ -47,7 +47,8 @@ SLOFILES= \
- $(SLO)$/b1drange.obj \
- $(SLO)$/b2drange.obj \
- $(SLO)$/b2xrange.obj \
-- $(SLO)$/b2dmultirange.obj \
-+ $(SLO)$/b2dpolyrange.obj \
-+ $(SLO)$/b2drangeclipper.obj \
- $(SLO)$/b3drange.obj
-
- # --- Targets ----------------------------------
-diff --git basegfx/test/basegfx2d.cxx basegfx/test/basegfx2d.cxx
-index 660a19d..8b1d659 100644
---- basegfx/test/basegfx2d.cxx
-+++ basegfx/test/basegfx2d.cxx
-@@ -41,7 +41,9 @@
- #include <basegfx/curve/b2dcubicbezier.hxx>
- #include <basegfx/curve/b2dbeziertools.hxx>
- #include <basegfx/polygon/b2dpolypolygontools.hxx>
--#include <basegfx/range/b2dmultirange.hxx>
-+#include <basegfx/polygon/b2dpolygonclipper.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
- #include <basegfx/numeric/ftools.hxx>
-
- #include <basegfx/tools/debugplotter.hxx>
-@@ -54,214 +56,6 @@ using namespace ::basegfx;
-
- namespace basegfx2d
- {
--/// Gets a random ordinal [0,n)
--inline double getRandomOrdinal( const ::std::size_t n )
--{
-- return double(n) * rand() / (RAND_MAX + 1.0);
--}
--
--class b2dmultirange : public CppUnit::TestFixture
--{
--private:
-- B2DMultiRange aDisjunctRanges;
-- B2DMultiRange aEqualRanges;
-- B2DMultiRange aIntersectionN;
-- B2DMultiRange aIntersectionE;
-- B2DMultiRange aIntersectionS;
-- B2DMultiRange aIntersectionW;
-- B2DMultiRange aIntersectionNE;
-- B2DMultiRange aIntersectionSE;
-- B2DMultiRange aIntersectionSW;
-- B2DMultiRange aIntersectionNW;
-- B2DMultiRange aRingIntersection;
-- B2DMultiRange aComplexIntersections;
-- B2DMultiRange aRandomIntersections;
--
--public:
-- // initialise your test code values here.
-- void setUp()
-- {
-- B2DRange aCenter(1.0, 1.0, -1.0, -1.0);
-- B2DRange aOffside(9.0, 9.0, 11.0, 11.0);
-- B2DRange aNorth(1.0, 0.0, -1.0, -2.0);
-- B2DRange aSouth(1.0, 2.0, -1.0, 0.0);
-- B2DRange aEast(0.0, 1.0, 2.0, -1.0);
-- B2DRange aWest(-2.0, 1.0, 0.0, -1.0);
-- B2DRange aNorthEast(0.0, 0.0, 2.0, -2.0);
-- B2DRange aSouthEast(0.0, 0.0, 2.0, 2.0);
-- B2DRange aSouthWest(0.0, 0.0, -2.0, 2.0);
-- B2DRange aNorthWest(0.0, 0.0, -2.0, -2.0);
--
-- B2DRange aNorth2(-1.5, 0.5, 1.5, 3.5);
-- B2DRange aSouth2(-1.5, -0.5, 1.5, -3.5);
-- B2DRange aEast2 (0.5, -1.5, 3.5, 1.5);
-- B2DRange aWest2 (-0.5, -1.5,-3.5, 1.5);
--
-- ::std::ofstream output("multirange_testcases.gnuplot");
-- DebugPlotter aPlotter( "multirange testcases",
-- output );
--
-- aPlotter.plot( aCenter, "center" );
-- aPlotter.plot( aOffside, "offside" );
-- aPlotter.plot( aNorth, "north" );
-- aPlotter.plot( aSouth, "south" );
-- aPlotter.plot( aEast, "east" );
-- aPlotter.plot( aWest, "west" );
-- aPlotter.plot( aNorthEast, "northeast" );
-- aPlotter.plot( aSouthEast, "southeast" );
-- aPlotter.plot( aSouthWest, "southwest" );
-- aPlotter.plot( aNorthWest, "northwest" );
--
-- aDisjunctRanges.addRange( aCenter );
-- aDisjunctRanges.addRange( aOffside );
--
-- aEqualRanges.addRange( aCenter );
-- aEqualRanges.addRange( aCenter );
--
-- aIntersectionN.addRange( aCenter );
-- aIntersectionN.addRange( aNorth );
--
-- aIntersectionE.addRange( aCenter );
-- aIntersectionE.addRange( aEast );
--
-- aIntersectionS.addRange( aCenter );
-- aIntersectionS.addRange( aSouth );
--
-- aIntersectionW.addRange( aCenter );
-- aIntersectionW.addRange( aWest );
--
-- aIntersectionNE.addRange( aCenter );
-- aIntersectionNE.addRange( aNorthEast );
--
-- aIntersectionSE.addRange( aCenter );
-- aIntersectionSE.addRange( aSouthEast );
--
-- aIntersectionSW.addRange( aCenter );
-- aIntersectionSW.addRange( aSouthWest );
--
-- aIntersectionNW.addRange( aCenter );
-- aIntersectionNW.addRange( aNorthWest );
--
-- aRingIntersection.addRange( aNorth2 );
-- aRingIntersection.addRange( aEast2 );
-- aRingIntersection.addRange( aSouth2 );
-- aRingIntersection.addRange( aWest2 );
--
-- aComplexIntersections.addRange( aCenter );
-- aComplexIntersections.addRange( aOffside );
-- aComplexIntersections.addRange( aCenter );
-- aComplexIntersections.addRange( aNorth );
-- aComplexIntersections.addRange( aEast );
-- aComplexIntersections.addRange( aSouth );
-- aComplexIntersections.addRange( aWest );
-- aComplexIntersections.addRange( aNorthEast );
-- aComplexIntersections.addRange( aSouthEast );
-- aComplexIntersections.addRange( aSouthWest );
-- aComplexIntersections.addRange( aNorthWest );
--
--/*
-- for( int i=0; i<10; ++i )
-- {
-- B2DRange aRandomRange(
-- getRandomOrdinal( 10 ),
-- getRandomOrdinal( 10 ),
-- getRandomOrdinal( 10 ),
-- getRandomOrdinal( 10 ) );
--
-- aRandomIntersections.addRange( aRandomRange );
-- }
--*/
-- }
--
-- void tearDown()
-- {
-- }
--
-- ::basegfx::B2DPolyPolygon shiftPoly( int nCount,
-- const ::basegfx::B2DPolyPolygon& rPoly )
-- {
-- B2DHomMatrix aMatrix;
-- aMatrix.translate( nCount*4.0,
-- 10.0-nCount*2.0 );
--
-- ::basegfx::B2DPolyPolygon aRes( rPoly );
-- aRes.transform( aMatrix );
--
-- return aRes;
-- }
--
-- void getPolyPolygon()
-- {
-- ::std::ofstream output("multirange_getpolypolygon.gnuplot");
-- DebugPlotter aPlotter( "multirange getPolyPolygon",
-- output );
--
-- B2DPolyPolygon result;
--
-- aPlotter.plot( shiftPoly(
-- 0,
-- aDisjunctRanges.getPolyPolygon() ),
-- "disjunct" );
-- aPlotter.plot( shiftPoly(
-- 1,
-- aEqualRanges.getPolyPolygon() ),
-- "equal" );
-- aPlotter.plot( shiftPoly(
-- 2,
-- aIntersectionN.getPolyPolygon() ),
-- "intersectionN" );
-- aPlotter.plot( shiftPoly(
-- 3,
-- aIntersectionE.getPolyPolygon() ),
-- "intersectionE" );
-- aPlotter.plot( shiftPoly(
-- 4,
-- aIntersectionS.getPolyPolygon() ),
-- "intersectionS" );
-- aPlotter.plot( shiftPoly(
-- 5,
-- aIntersectionW.getPolyPolygon() ),
-- "intersectionW" );
-- aPlotter.plot( shiftPoly(
-- 6,
-- aIntersectionNE.getPolyPolygon() ),
-- "intersectionNE" );
-- aPlotter.plot( shiftPoly(
-- 7,
-- aIntersectionSE.getPolyPolygon() ),
-- "intersectionSE" );
-- aPlotter.plot( shiftPoly(
-- 8,
-- aIntersectionSW.getPolyPolygon() ),
-- "intersectionSW" );
-- aPlotter.plot( shiftPoly(
-- 9,
-- aIntersectionNW.getPolyPolygon() ),
-- "intersectionNW" );
-- aPlotter.plot( shiftPoly(
-- 10,
-- aRingIntersection.getPolyPolygon() ),
-- "intersection ring" );
-- aPlotter.plot( shiftPoly(
-- 11,
-- aComplexIntersections.getPolyPolygon() ),
-- "intersection complex" );
-- aPlotter.plot( shiftPoly(
-- 12,
-- aRandomIntersections.getPolyPolygon() ),
-- "intersection random" );
--
-- CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true );
-- }
--
-- // Change the following lines only, if you add, remove or rename
-- // member functions of the current class,
-- // because these macros are need by auto register mechanism.
--
-- CPPUNIT_TEST_SUITE(b2dmultirange);
-- CPPUNIT_TEST(getPolyPolygon);
-- CPPUNIT_TEST_SUITE_END();
--}; // class b2dmultirange
-
- class b2dsvgdimpex : public CppUnit::TestFixture
- {
-@@ -503,6 +297,39 @@ public:
- CPPUNIT_TEST_SUITE_END();
- }; // class b2dsvgdimpex
-
-+class b2dpolyrange : public CppUnit::TestFixture
-+{
-+private:
-+public:
-+ void setUp()
-+ {}
-+
-+ void tearDown()
-+ {}
-+
-+ void check()
-+ {
-+ B2DPolyRange aRange;
-+ aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE);
-+ aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE);
-+
-+ CPPUNIT_ASSERT_MESSAGE("simple poly range - count",
-+ aRange.count() == 2);
-+ CPPUNIT_ASSERT_MESSAGE("simple poly range - first element",
-+ aRange.getElement(0).head == B2DRange(0,0,1,1));
-+ CPPUNIT_ASSERT_MESSAGE("simple poly range - second element",
-+ aRange.getElement(1).head == B2DRange(2,2,3,3));
-+ }
-+
-+ // Change the following lines only, if you add, remove or rename
-+ // member functions of the current class,
-+ // because these macros are need by auto register mechanism.
-+
-+ CPPUNIT_TEST_SUITE(b2dpolyrange);
-+ CPPUNIT_TEST(check);
-+ CPPUNIT_TEST_SUITE_END();
-+};
-+
- class b2dbeziertools : public CppUnit::TestFixture
- {
- private:
-@@ -1444,8 +1271,9 @@ public:
- }; // class b2dvector
-
- // -----------------------------------------------------------------------------
--//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d");
-+
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d");
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolyrange, "basegfx2d");
- //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier, "basegfx2d");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix, "basegfx2d");
-diff --git basegfx/test/boxclipper.cxx basegfx/test/boxclipper.cxx
-new file mode 100644
-index 0000000..51f6c39
---- /dev/null
-+++ basegfx/test/boxclipper.cxx
-@@ -0,0 +1,426 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: basegfx2d.cxx,v $
-+ * $Revision: 1.14 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+// autogenerated file with codegen.pl
-+
-+#include <cppunit/simpleheader.hxx>
-+
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/curve/b2dcubicbezier.hxx>
-+#include <basegfx/curve/b2dbeziertools.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <basegfx/polygon/b2dpolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-+#include <basegfx/polygon/b2dpolygonclipper.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/numeric/ftools.hxx>
-+
-+#include <boost/bind.hpp>
-+
-+using namespace ::basegfx;
-+
-+
-+namespace basegfx2d
-+{
-+/// Gets a random ordinal [0,n)
-+inline double getRandomOrdinal( const ::std::size_t n )
-+{
-+ // use this one when displaying polygons in OOo, which still sucks
-+ // great rocks when trying to import non-integer svg:d attributes
-+ // return sal_Int64(double(n) * rand() / (RAND_MAX + 1.0));
-+ return double(n) * rand() / (RAND_MAX + 1.0);
-+}
-+
-+inline bool compare(const B2DPoint& left, const B2DPoint& right)
-+{
-+ return left.getX()<right.getX()
-+ || (left.getX()==right.getX() && left.getY()<right.getY());
-+}
-+
-+
-+class boxclipper : public CppUnit::TestFixture
-+{
-+private:
-+ B2DPolyRange aDisjunctRanges;
-+ B2DPolyRange aEqualRanges;
-+ B2DPolyRange aIntersectionN;
-+ B2DPolyRange aIntersectionE;
-+ B2DPolyRange aIntersectionS;
-+ B2DPolyRange aIntersectionW;
-+ B2DPolyRange aIntersectionNE;
-+ B2DPolyRange aIntersectionSE;
-+ B2DPolyRange aIntersectionSW;
-+ B2DPolyRange aIntersectionNW;
-+ B2DPolyRange aRingIntersection;
-+ B2DPolyRange aRingIntersection2;
-+ B2DPolyRange aRingIntersectExtraStrip;
-+ B2DPolyRange aComplexIntersections;
-+ B2DPolyRange aRandomIntersections;
-+
-+public:
-+ // initialise your test code values here.
-+ void setUp()
-+ {
-+ B2DRange aCenter(100, 100, -100, -100);
-+ B2DRange aOffside(800, 800, 1000, 1000);
-+ B2DRange aNorth(100, 0, -100, -200);
-+ B2DRange aSouth(100, 200, -100, 0);
-+ B2DRange aEast(0, 100, 200, -100);
-+ B2DRange aWest(-200, 100, 0, -100);
-+ B2DRange aNorthEast(0, 0, 200, -200);
-+ B2DRange aSouthEast(0, 0, 200, 200);
-+ B2DRange aSouthWest(0, 0, -200, 200);
-+ B2DRange aNorthWest(0, 0, -200, -200);
-+
-+ B2DRange aNorth2(-150, 50, 150, 350);
-+ B2DRange aSouth2(-150, -50, 150, -350);
-+ B2DRange aEast2 (50, -150, 350, 150);
-+ B2DRange aWest2 (-50, -150,-350, 150);
-+
-+ aDisjunctRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aDisjunctRanges.appendElement( aOffside, ORIENTATION_NEGATIVE );
-+
-+ aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionN.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionN.appendElement( aNorth, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionE.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionE.appendElement( aEast, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionS.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionS.appendElement( aSouth, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionW.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionW.appendElement( aWest, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionNE.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionNE.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionSE.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionSE.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionSW.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionSW.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
-+
-+ aIntersectionNW.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aIntersectionNW.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
-+
-+ aRingIntersection.appendElement( aNorth2, ORIENTATION_NEGATIVE );
-+ aRingIntersection.appendElement( aEast2, ORIENTATION_NEGATIVE );
-+ aRingIntersection.appendElement( aSouth2, ORIENTATION_NEGATIVE );
-+
-+ aRingIntersection2 = aRingIntersection;
-+ aRingIntersection2.appendElement( aWest2, ORIENTATION_NEGATIVE );
-+
-+ aRingIntersectExtraStrip = aRingIntersection2;
-+ aRingIntersectExtraStrip.appendElement( B2DRange(0, -25, 200, 25),
-+ ORIENTATION_NEGATIVE );
-+
-+ aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aOffside, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aNorth, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aEast, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aSouth, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aWest, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
-+ aComplexIntersections.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
-+
-+#ifdef GENERATE_RANDOM
-+ for( int i=0; i<800; ++i )
-+ {
-+ B2DRange aRandomRange(
-+ getRandomOrdinal( 1000 ),
-+ getRandomOrdinal( 1000 ),
-+ getRandomOrdinal( 1000 ),
-+ getRandomOrdinal( 1000 ) );
-+
-+ aRandomIntersections.appendElement( aRandomRange, ORIENTATION_NEGATIVE );
-+ }
-+#else
-+ const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z";
-+ B2DPolyPolygon randomPoly;
-+ tools::importFromSvgD(
-+ randomPoly,
-+ rtl::OUString::createFromAscii(randomSvg));
-+ std::for_each(randomPoly.begin(),
-+ randomPoly.end(),
-+ boost::bind(
-+ &B2DPolyRange::appendElement,
-+ boost::ref(aRandomIntersections),
-+ boost::bind(
-+ &B2DPolygon::getB2DRange,
-+ _1),
-+ ORIENTATION_NEGATIVE,
-+ 1));
-+#endif
-+ }
-+
-+ void tearDown()
-+ {
-+ }
-+
-+ B2DPolyPolygon normalizePoly( const B2DPolyPolygon& rPoly )
-+ {
-+ B2DPolyPolygon aRes;
-+ for( sal_uInt32 i=0; i<rPoly.count(); ++i )
-+ {
-+ B2DPolygon aTmp=rPoly.getB2DPolygon(i);
-+ if( ORIENTATION_NEGATIVE == tools::getOrientation(aTmp) )
-+ aTmp.flip();
-+
-+ aTmp=tools::removeNeutralPoints(aTmp);
-+
-+ B2DPoint* pSmallest=0;
-+ for(B2DPoint* pCurr=aTmp.begin(); pCurr!=aTmp.end(); ++pCurr)
-+ {
-+ if( ! pSmallest || compare(*pCurr, *pSmallest) )
-+ {
-+ pSmallest=pCurr;
-+ }
-+ }
-+
-+ if( pSmallest )
-+ std::rotate(aTmp.begin(),pSmallest,aTmp.end());
-+
-+ aRes.append(aTmp);
-+ }
-+
-+ // boxclipper & generic clipper disagree slightly on area-less
-+ // polygons (one or two points only)
-+ aRes = tools::stripNeutralPolygons(aRes);
-+
-+ // now, sort all polygons with increasing 0th point
-+ std::sort(aRes.begin(),
-+ aRes.end(),
-+ boost::bind(
-+ &compare,
-+ boost::bind(
-+ &B2DPolygon::getB2DPoint,
-+ _1,0),
-+ boost::bind(
-+ &B2DPolygon::getB2DPoint,
-+ _2,0)));
-+
-+ return aRes;
-+ }
-+
-+ void verifyPoly(const char* sName, const char* sSvg, const B2DPolyRange& toTest)
-+ {
-+ B2DPolyPolygon aTmp1;
-+ CPPUNIT_ASSERT_MESSAGE(sName,
-+ tools::importFromSvgD(
-+ aTmp1,
-+ rtl::OUString::createFromAscii(sSvg)));
-+
-+ const rtl::OUString aSvg=
-+ tools::exportToSvgD(toTest.solveCrossovers());
-+ B2DPolyPolygon aTmp2;
-+ CPPUNIT_ASSERT_MESSAGE(sName,
-+ tools::importFromSvgD(
-+ aTmp2,
-+ aSvg));
-+
-+ CPPUNIT_ASSERT_MESSAGE(
-+ sName,
-+ normalizePoly(aTmp2) == normalizePoly(aTmp1));
-+ }
-+
-+ void verifyPoly()
-+ {
-+ const char* disjunct="m100 100v-200h-200v200zm1100 900v-200h-200v200z";
-+ const char* equal="m100 100v-200h-200v200zm200 0v-200h-200v200h200z";
-+ const char* intersectionN="m100 0v-100h-200v100zm200 100v-200-100h-200v100 200z";
-+ const char* intersectionE="m100 100v-200h-100v200zm200 0v-200h-200-100v200h100z";
-+ const char* intersectionS="m100 100v-200h-200v200 100h200v-100zm0 0v-100h-200v100z";
-+ const char* intersectionW="m0 100v-200h-100v200zm200 0v-200h-200-100v200h100z";
-+ const char* intersectionNE="m100 0v-100h-100v100zm200 0v-200h-200v100h-100v200h200v-100z";
-+ const char* intersectionSE="m200 200v-200h-100v-100h-200v200h100v100zm100-100v-100h-100v100z";
-+ const char* intersectionSW="m0 100v-100h-100v100zm200 0v-200h-200v100h-100v200h200v-100z";
-+ const char* intersectionNW="m100 100v-200h-100v-100h-200v200h100v100zm100-100v-100h-100v100z";
-+ const char* ringIntersection="m150 150v-100h-100v100zm300 0v-300h-200v-200h-300v300h200v100h-200v300h300v-200zm0-200v-100h-100v100z";
-+ const char* ringIntersection2="m-50-50v-100h-100v100zm100 200v-100h-100v100zm500 0v-300h-200v-200h-300v200h-200v300h200v200h300v-200zm-200-100v-100h100v100zm100-100v-100h-100v100zm100 200v-100h-100v100z";
-+ const char* ringIntersectExtraStrip="m-50-50v-100h-100v100zm100 200v-100h-100v100zm500 0v-300h-200v-200h-300v200h-200v300h200v200h300v-200zm-200-100v-100h100v25h-50v50h50v25zm150-25v-50h-150v50zm100-75v-100h-100v100zm100 200v-100h-100v100z";
-+ // TODO: old clipper impl. debug difference
-+ //const char* complexIntersections="m100 0h-100v-100 100h-100 100v100-100zm0 0zm200 0h-100v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100zm0 0h-100v-100 100h-100 100v100-100h100zm0 0v-100h-100-100v100 100h100 100v-100zm100 0v-100h-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100zm-200 0zm100 0v-100h-100-100v100 100h100 100v-100zm100 100v-200-100h-200-100-100v100 200 100h100 100 200v-100zm-200-100zm1000 1000v-200h-200v200z";
-+ const char* complexIntersections="m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm-100 0v-100 100h-100 100v100-100h100zm0 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100h100zm-100-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100-100zm0 0v-100h-200-100-100v100 200 100h100 100 200v-100-200zm600 900v200h200v-200z";
-+ const char* randomIntersections="m63 457v-393h-43v393zm114 63v-8h-48v8zm-14 477v-127h-18v127zm693-923v-5h-119v5zm-260 457v-1h-14v1zm-220-375v-27h-8v27zm78 755v-22h-7v22zm203-774v-8h-158v8zm-108 375v-17h23v17zm813-19v-189h-21v-12h-26v-54h-17v-69h-25v-22h-62v-73h104v-5h-104-15v-17h-49v-1h-8v-16h-119v16h-386v18h-38-24v34h-23v26h-23v-26h-8v26h-18v27h18v339h8v-339h23v339h8v17h-8v13h8v5h-8v1h8v42h15v20h17v94h18 3v224h165v39h130v2h75v4h98v-4h153v-2h77v-20h4v-28h11v-218h-11v-27h3v-1h8v-17h-8v-63h8v-51h18v-32zm-581 32v-13h-14v13zm-78-78v-7h-32v7zm124 14v-21h-14v21zm595 32v-189h-26v-12h-4v-9h-13v-45h-13v-10h-12v-59h-62v-22h-26v-10h11v-63h15v-5h-15-49v-17h-8v-1h-119v1h-107v17h-279-38v34h-24v26h-23v27h23v284h-15v55h15v17h-15v13h15v5h-15v1h15v42h17v20h18v94h3 14v62h8v48h90v32h18v61h35v21h8v2h122v37h75v2h98v-2h153v-20h77v-28h4v-29h5v-40h-5v-149h-1v-27h1v-1h3v-17h-3v-46h3v-17-51h8v-32zm-563 2v-13h-14v13zm198 30v-13h-39v13zm204-43v-21h3v21zm-168-21v-21h-39v21zm306 0v-21h-5v21zm178 115v-272h-20v-12h-2v-54h-21v-164h1v-22h-27v-48h-743v47h-23v18h-71v24h-8v419h-39v19h60v156h66 32v202h-72v110h79v-88h11v39h3v48h621v-14h96v-82h35v-326zm-570-420v-4h-156v4zm63 481v-18h-11v18zm72 0v-25h-14v25zm465-112v-13h-5v13zm-46-43v-21h1v21zm-37-21v-21h-12v21zm-352 21v-21h23v21zm-23 30v-17h23v17zm-23 18v-5h23v5zm-23 82v-19h23v19zm272 75v-3h-35v3zm-76-192v-13h-39v13zm150 30v-13h-35v13zm-76 6v-1h-39v1zm11 106v-25h-11v25zm150 160v-14h-75v14zm318-304v-11h-13v-43h-2v-2h-10v-37h-4v37h-27v3h-31v-3-37h-5v37h-43v3h-2v21h2v21h-2v30h-1v-30h-8v-21h8v-21h-8v-3h-5v-62h5v-11h-5v-29h-8v-52h-15v-17-38h-15v-52h-89v16h-22v36h-175v55h-15v1h-25v51h-23v-41h-14v41h-2v105h-4v21h4v21h-4v13h4v17h-4-18v13h18v5h-18v1h18v42h4v11h2v9h14v-9h23v9h40v19h-40v25h40v2h82v2h75v43h-75v3h75 40v60h35v-60h23 34 12 15v-3h-15v-43h15v-48h10v-37h11v-31h1v1h45v30h5v-30h20v-1h11v1h8v30h19v20h3v-20h1v-30h10v-1h2v-32zm-146-329v-1h-2v1zm-117 211v-11 11zm-76 0v-11h-13v11zm13 65v-65h1v65zm-1 42v-21h1v16h35v5zm-36 30v-17h36v17zm-36 18v-5h36v5zm180-5v-13h-13v-17h5v-13h-5v-21h5v-21h-5v-3h-8v-62h8v-11h-8v-29h-9v-51h-6v-1-17h-15v-38h-54v-36h-35v36h-22v38h-67v17h-108v1h-15v51h-25v105h-23v-105h-14v105h-2v21h2v21h-2v13h2v17h-2-4v13h4v5h-4v1h4v42h2v11h14v-11h23v11h40v9h82v19h-82v25h82v2h75v2h40v43h-40v3h40 35 23v-3h-23v-43h23v-2h34v2h12v-2h6v-46h9v-20h8v-17h2v-26h-2v-5zm-127-64v-21 21zm89 51v-17h3v17zm-57-17v-13h-35v13zm58 61v-26h-19v-5h19v-13h-23v-17h23v-13h-23v-21h23v-21h-23v-65h23v-11h-23v-14h-35v-15 15h-22v14h-18v11h18v65h-18v21h18v16h22v5h-22v13h22v17h-22-18v13h18v5h-18v1h18v25h22v17h35v-17zm0-25v-1h-35v1zm-22-390v6h-175v5h-31v-15h228v4zm344 352v-189h-2v-12h-21v-54h-26v-164h26v-5h-26v-17h-119v-36h-562v35h-62v18h-23v34h-23v-10h-48v419h-8v8h8v5h71v5h-58v1h58v42h8v114h32 18v224h3v39h165v34h456v-32h77v-2h4v-20h11v-28h4v-218h-4v-28h36v-17h-36v-63h39v-83zm-50 0v-11h-1v-43h-3v-2h-6v-39h-4v-34h-13v-60h-12v-12h-31v72h-31v-72-9h-59v-17-38h-5v-59h-8v-5h8v-1h-8v-16h-2v16h-13v-11h-15v-5h-89v5h-22v11h-175v6h-15v7h-25v16h-43v36h-18v66h-54v-107h-32v107h-4v41h-8v105h-6v7h6v14h8v21h-8v13h8v17h-8-14v13h14v5h-14v1h14v42h8v20h90v19h-34v7h-15v68h26v-50h23v50h18 4v62h16v-62h15v110h8v10h3v22h119v11h75v50h75v-50h23v-11h34v11h48v-11h30v-22h21v-120h20v-3h11v3h30v-3h13-13v-27h13v-1h17v-17h-17v-46h17v-17h6v-51h3v-32zm-256-32v-21h-35v-65h35v-11h-35v-14 14h-22v11h22v65h-22v21h22v16-16zm89 69v-5h3v5zm-3 26v-26h-31v-5h31v-13h-31v-17h31v-13h-31v-21h31v-21h-31v-65h31v-11h-31v-14h-23v-15h-35v-51 51h-22v15h-18v14h-35v11h35v65h-35v21h35v16h18v5h-18v13h18v17h-18-36-39-61v13h61v5h-61v1h61v25h39v-25h36v25h18v17h22v11h35v-11h23v-17zm-19-25v-1h-4v-5h4v-13h-4-35-22v13h22v5h-22v1h22v25h35v-25zm23 252v-36h34v36zm-34-99v-43h34v43zm35-128v-26h-8v-5h8v-13h-8v-17h8v-13h-8v-21h8v-21h-8v-3h-9v-62h9v-11h-9v-29h-6v-51-1h-15v-17h-54v-38h-35v38h-22v11h-53v6h-14v1h-108v51h-15v105h-25v21h25v21h-25v13h25v17h-25-23-14-2v13h2v5h-2v1h2v42h14v-42h23v42h40v11h82v9h75v46h40v2h35v-2h23v-4h31v-42h3v46h12v-46h6v-20h9v-17zm-15-61v-13h-12v13zm12 30v-13h-12v13zm12 31v-26h-12v26zm12 131v-3h-12v3zm12 110v-14h-12v14zm27-241v-26h-9v-5h9v-13h-9v-17h9v-13h-9v-21h9v-21h-9v-3h-6v-62h6v-11h-6v-29-51h-15v-1h-54v-17h-35v11h-22v6h-53v1h-14v51h-108v105h-15v21h15v21h-15v13h15v17h-15-25v13h25v5h-25v1h25v25h15v17h21v6h61v5h75v9h18v42h22v4h35v-4h23v-42h31v-9h3v9h12v-9-11h6v-17zm0 0v-26h-6v-5h6v-13h-6v-17h6v-13h-6v-21h6v-21h-6v-3-62-11-29h-15v-51h-54v-1h-35v-6 6h-22v1h-53v51h-14v24h-87v81h-21v21h21v21h-21v13h21v17h-21-15v13h15v5h-15v1h15v25h21v17h61v6h39v-6h36v11h18v9h22v42h35v-42h23v-9h31v-11h3v11h12v-11-17zm0 0v-26-5-13-17-13-21-21-3h-12v3h-3v-65h15v-11h-15v-29h-54v-51h-35v-1 1h-22v51h-53v29h-1v-5h-13v5h-26v76h-61v21h61v21h-61v13h61v17h-61-21v13h21v5h-21v1h21v25h61v17h39v-17h36v17h18v11h22v9h35v-9h23v-11h31v-17h3v17h12v-17zm15-419v-12h-2v12zm186 356v-56h-8v-133h-4v-12h-13v-9h-13v-45h-12v-10h-62v-59-6h-26v-16h-33v-10h33v-12h-33v-22h-5v-29h49v-5h-49-8v-17h-119v17h-107-279v34h-38v26h-24v27h24v179h-7v105h-17v55h17v17h-17v13h17v5h-17v1h17v42h18v20h3v94h14 8v62h41v37h26v-37h23v48h18v32h35v61h8v21h122v2h75v37h98v-37h34v17h119v-57h11v29h66v-29h4v-40h-4v-26h3v-123h-3v-27h3v-1h1v-17h-1v-46h1v-17h3v-51-32zm0 0v-54h-4v-2h-3v-73h-10v-60h-13v-12h-12v-9h-31v9h-31v-9-55h-59v-59h-5v-5h5v-1h-5v-16h-8v-10h8v-12h-8v-22h-119v34h117v10h-28v-6h-89v6h-22v5h-175v11h-40v13h-147v11h-4v107h-8v41h-6v105h-22v21h28v21h-17v13h17v17h-14-3v13h3v5h-3v1h3v42h14v20h8v94h41 26 23 18v62h4v48h31v10h8v22h3v11h119v50h75v21h98v-71h34v71h48v-71h30v-11h21v-22h20v-120h11v120h43v-123h17-17v-27h17v-1h6v-17h-6v-46h6v-17h3v-51h1v-32zm-4 0v-11h-6v-43h-4v-2h-13v-39h-12v-34h-4v34h-27v2h-31v-2-34h-48v36h-2v37h-1v-73h-8v-29-52h-5v-17h-8v-38h-15v-59h-15v-6h-89v6h-22v7h-175v16h-15v36h-25v55h-39v11h-4v41h-18v105h-54v-105h-32v105h-4v7h4v14h86v21h-86v13h86v17h-86-4v13h4v5h-4v1h4v42h86v11h18v9h4v19h-4v25h4v50h16v-48h23v45h-8v3h8 122v96h-119v14h119v10h75v22h75v-22h23v-10h34v10h48v-24h-36v-36h15v-60h21v-3h-11v-43h2v15h9v-15h46v15h5v-15h20v-2h-20v-46h20v-37h11v37h8v46h-8v2h8v15h22v-15h1v-2h-1v-46h1v-17h12v-20h13v-31h4v-32zm-142 148v-2h-9v2zm9-2v-46h46v46zm-46 45v-28h46v28zm67-191v-11h-1v-42h-3v42h-19v11h19v32h3v-32zm-61 0v-11h-5v11zm96 0v-11h-4v-43h-13v-2h-2v-37h-10v-2h-4v2h-27v37h-31v-37-2h-5v2h-43v37h-2v3h-1v-3h-8v-62-11-29h-5v-52h-8v-17h-15v-38-52h-15v-7h-89v7h-22v16h-175v36h-15v55h-25v1h-37v10h-2v41h-4v105h-18v21h18v21h-18v13h18v17h-18-86v13h86v5h-86v1h86v42h18v11h4v9h2v19h-2v25h2v2h14v-2h23v2h40v2h82v43h-122v3h122 75v96h-75v14h75v10h75v-10h23v-14h-23v-36h23v-60h34v60h12v-60h15 10v-3h-10v-43h10v-48h11v-37h46v37h5v-37h20v-30h11v30h8v37h22v-17h1v-20h12v-31h13v-32zm-13 0v-11h-2v-43h-10v-2h-4v2h-19v1h-8v42h-31v-21-21-3h-5v3h-43v21h43v21h-43v11h43v19h-45v13h45v1h5v-1h20v-13h-20v-19h31v32h8v1h19v30h3v-30h1v-1h10v-32zm-72 148v-2h-5v2zm5 43h-5zm66-191v-11h-3v11zm-38 146v-46h11v46zm-11 45v-28h11v28zm-11 149v-4h11v4zm-11 40v-40h-8v40zm92-380v-54-2h-4v-133h-13v-12h-13v-9h-12v-45h-31v45h-31v-55-59h-59v-5h33v-1h-33v-16h-5v-10h5v-12h-5v-22h-8v-29h8v-5h-8-119-107v5h107v29h-386v26h-38v27h40v20h-4v11h-14v148h-22v105h-7v55h18v17h-18v13h18v5h-18v1h18v42h3v20h14v94h8 41v62h26v-62h23v62h18v48h4v10h31v22h8v61h122v21h75v2h98v-2h34v2h99v-84h20v-22h11v22h43v-22h23v-123h-6v-27h6v-1h3v-17h-3v-46h3v-17h1v-51h3v-32zm-43 148v-2h-22v2zm22 43h-30zm66 189v-40h-66v40zm41-380v-11h-10v-43h-4v1h-19v42h-8v11h8v32h19v1h3v-1h1v-32zm38 0v-11h-3v-43h-6v-2h-4v-39h-13v-34h-12v-60h-4v60h-27v34h-31v-34-72h-48v72h-3v-29h-8v-52-17h-5v-38h-8v-59h-15v-6h-15v-11h-89v11h-22v6h-175v7h-15v16h-25v36h-43v66h-18v41h-54v-41h-32v41h-4v105h-8v7h8v14h4v21h-4v13h4v17h-4-8v13h8v5h-8v1h8v42h4v11h86v9h18v19h-18v25h18v50h4 16 15 8v110h3v10h119v22h75v11h75v-11h23v-22h34v22h48v-22h30v-24h-30v-96h51v-3h20-20v-28h20v-15h11v15h8v1h22v-1h13v-17h-12v-46h12v-17h17v-51h6v-32z";
-+
-+ verifyPoly("disjunct", disjunct, aDisjunctRanges);
-+ verifyPoly("equal", equal, aEqualRanges);
-+ verifyPoly("intersectionN", intersectionN, aIntersectionN);
-+ verifyPoly("intersectionE", intersectionE, aIntersectionE);
-+ verifyPoly("intersectionS", intersectionS, aIntersectionS);
-+ verifyPoly("intersectionW", intersectionW, aIntersectionW);
-+ verifyPoly("intersectionNE", intersectionNE, aIntersectionNE);
-+ verifyPoly("intersectionSE", intersectionSE, aIntersectionSE);
-+ verifyPoly("intersectionSW", intersectionSW, aIntersectionSW);
-+ verifyPoly("intersectionNW", intersectionNW, aIntersectionNW);
-+ verifyPoly("ringIntersection", ringIntersection, aRingIntersection);
-+ verifyPoly("ringIntersection2", ringIntersection2, aRingIntersection2);
-+ verifyPoly("ringIntersectExtraStrip", ringIntersectExtraStrip, aRingIntersectExtraStrip);
-+ verifyPoly("complexIntersections", complexIntersections, aComplexIntersections);
-+ verifyPoly("randomIntersections", randomIntersections, aRandomIntersections);
-+ }
-+
-+ void dumpSvg(const char* pName,
-+ const ::basegfx::B2DPolyPolygon& rPoly)
-+ {
-+ (void)pName; (void)rPoly;
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(rPoly),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+ }
-+
-+ void getPolyPolygon()
-+ {
-+ dumpSvg("disjunct",aDisjunctRanges.solveCrossovers());
-+ dumpSvg("equal",aEqualRanges.solveCrossovers());
-+ dumpSvg("intersectionN",aIntersectionN.solveCrossovers());
-+ dumpSvg("intersectionE",aIntersectionE.solveCrossovers());
-+ dumpSvg("intersectionS",aIntersectionS.solveCrossovers());
-+ dumpSvg("intersectionW",aIntersectionW.solveCrossovers());
-+ dumpSvg("intersectionNE",aIntersectionNE.solveCrossovers());
-+ dumpSvg("intersectionSE",aIntersectionSE.solveCrossovers());
-+ dumpSvg("intersectionSW",aIntersectionSW.solveCrossovers());
-+ dumpSvg("intersectionNW",aIntersectionNW.solveCrossovers());
-+ dumpSvg("ringIntersection",aRingIntersection.solveCrossovers());
-+ dumpSvg("ringIntersection2",aRingIntersection2.solveCrossovers());
-+ dumpSvg("aRingIntersectExtraStrip",aRingIntersectExtraStrip.solveCrossovers());
-+ dumpSvg("complexIntersections",aComplexIntersections.solveCrossovers());
-+ dumpSvg("randomIntersections",aRandomIntersections.solveCrossovers());
-+
-+ CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true );
-+ }
-+
-+ void validatePoly( const char* pName, const B2DPolyRange& rRange )
-+ {
-+ B2DPolyPolygon genericClip;
-+ const sal_uInt32 nCount=rRange.count();
-+ for( sal_uInt32 i=0; i<nCount; ++i )
-+ {
-+ B2DPolygon aRect=tools::createPolygonFromRect(
-+ rRange.getElement(i).head);
-+ if( rRange.getElement(i).tail.head == ORIENTATION_NEGATIVE )
-+ aRect.flip();
-+
-+ genericClip.append(aRect);
-+ }
-+
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s input - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(
-+ genericClip),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ const B2DPolyPolygon boxClipResult=rRange.solveCrossovers();
-+ const rtl::OUString boxClipSvg(
-+ basegfx::tools::exportToSvgD(
-+ normalizePoly(
-+ boxClipResult)));
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ boxClipSvg,
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ genericClip = tools::solveCrossovers(genericClip);
-+ const rtl::OUString genericClipSvg(
-+ basegfx::tools::exportToSvgD(
-+ normalizePoly(
-+ genericClip)));
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ genericClipSvg,
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ CPPUNIT_ASSERT_MESSAGE(pName,
-+ genericClipSvg == boxClipSvg);
-+ }
-+
-+ void validatePoly()
-+ {
-+ validatePoly("disjunct", aDisjunctRanges);
-+ validatePoly("equal", aEqualRanges);
-+ validatePoly("intersectionN", aIntersectionN);
-+ validatePoly("intersectionE", aIntersectionE);
-+ validatePoly("intersectionS", aIntersectionS);
-+ validatePoly("intersectionW", aIntersectionW);
-+ validatePoly("intersectionNE", aIntersectionNE);
-+ validatePoly("intersectionSE", aIntersectionSE);
-+ validatePoly("intersectionSW", aIntersectionSW);
-+ validatePoly("intersectionNW", aIntersectionNW);
-+ validatePoly("ringIntersection", aRingIntersection);
-+ validatePoly("ringIntersection2", aRingIntersection2);
-+ validatePoly("ringIntersectExtraStrip", aRingIntersectExtraStrip);
-+ // generic clipper buggy here, likely
-+ //validatePoly("complexIntersections", aComplexIntersections);
-+ //validatePoly("randomIntersections", aRandomIntersections);
-+ }
-+
-+ // Change the following lines only, if you add, remove or rename
-+ // member functions of the current class,
-+ // because these macros are need by auto register mechanism.
-+
-+ CPPUNIT_TEST_SUITE(boxclipper);
-+ CPPUNIT_TEST(validatePoly);
-+ CPPUNIT_TEST(verifyPoly);
-+ CPPUNIT_TEST(getPolyPolygon);
-+ CPPUNIT_TEST_SUITE_END();
-+};
-+
-+// -----------------------------------------------------------------------------
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::boxclipper, "boxclipper");
-+} // namespace basegfx2d
-+
-+
-+// -----------------------------------------------------------------------------
-+
-+// this macro creates an empty function, which will called by the RegisterAllFunctions()
-+// to let the user the possibility to also register some functions by hand.
-+// NOADDITIONAL;
-+
-diff --git basegfx/test/makefile.mk basegfx/test/makefile.mk
-index 5bf0d8a..320bd0c 100644
---- basegfx/test/makefile.mk
-+++ basegfx/test/makefile.mk
-@@ -46,6 +46,7 @@ SHL1OBJS= \
- $(SLO)$/basegfx1d.obj \
- $(SLO)$/basegfx2d.obj \
- $(SLO)$/basegfx3d.obj \
-+ $(SLO)$/boxclipper.obj \
- $(SLO)$/testtools.obj
-
- # linking statically against basegfx parts
-@@ -83,6 +84,10 @@ SLOFILES=$(SHL1OBJS)
- .INCLUDE : target.mk
- .INCLUDE : _cppunit.mk
-
-+.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
-+CDEFS+= -DVERBOSE
-+.ENDIF
-+
- # --- Enable testshl2 execution in normal build ------------------------
-
- $(MISC)$/unittest_succeeded : $(SHL1TARGETN)
diff --git a/patches/test/built-in-unit-test-sc.diff b/patches/test/built-in-unit-test-sc.diff
deleted file mode 100644
index 3e4ec4dec..000000000
--- a/patches/test/built-in-unit-test-sc.diff
+++ /dev/null
@@ -1,213 +0,0 @@
---- /dev/null 2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/makefile.mk 2008-02-20 15:48:10.000000000 +0000
-@@ -0,0 +1,95 @@
-+#*************************************************************************
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.2 $
-+#
-+# last change: $Author: ihi $ $Date: 2007/11/23 13:58:12 $
-+#
-+# The Contents of this file are made available subject to
-+# the terms of GNU Lesser General Public License Version 2.1.
-+#
-+#
-+# GNU Lesser General Public License Version 2.1
-+# =============================================
-+# Copyright 2007 by Sun Microsystems, Inc.
-+# 901 San Antonio Road, Palo Alto, CA 94303, USA
-+#
-+# This library is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU Lesser General Public
-+# License version 2.1, as published by the Free Software Foundation.
-+#
-+# This library is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# Lesser General Public License for more details.
-+#
-+# You should have received a copy of the GNU Lesser General Public
-+# License along with this library; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+# MA 02111-1307 USA
-+#
-+#*************************************************************************
-+
-+PRJ := ..$/..
-+PRJNAME := configmgr
-+TARGET := qa_unit
-+
-+ENABLE_EXCEPTIONS := TRUE
-+
-+.INCLUDE: settings.mk
-+
-+DLLPRE = # no leading "lib" on .so files
-+
-+SHL1TARGET = $(TARGET)
-+SHL1OBJS = $(SLO)$/ucalc.obj $(SLO)$/ubootstrap.obj
-+SHL1STDLIBS= \
-+ $(BASICLIB) \
-+ $(SFXLIB) \
-+ $(SVTOOLLIB) \
-+ $(SVLLIB) \
-+ $(SVXLIB) \
-+ $(GOODIESLIB) \
-+ $(BASEGFXLIB) \
-+ $(VCLLIB) \
-+ $(CPPULIB) \
-+ $(CPPUHELPERLIB) \
-+ $(COMPHELPERLIB) \
-+ $(UCBHELPERLIB) \
-+ $(TKLIB) \
-+ $(VOSLIB) \
-+ $(SALLIB) \
-+ $(TOOLSLIB) \
-+ $(I18NUTILLIB) \
-+ $(I18NISOLANGLIB) \
-+ $(UNOTOOLSLIB) \
-+ $(SOTLIB) \
-+ $(XMLOFFLIB) \
-+ $(DBTOOLSLIB) \
-+ $(AVMEDIALIB) \
-+ $(CPPUNITLIB)
-+SHL1IMPLIB = i$(SHL1TARGET)
-+SHL1LIBS=$(SLB)$/scalc3.lib $(SLB)$/scalc3c.lib
-+SHL1VERSIONMAP = export.map
-+DEF1NAME = $(SHL1TARGET)
-+
-+.INCLUDE: target.mk
-+
-+ALLTAR: test
-+
-+USERDIR=$(OUT)$/unit
-+
-+$(USERDIR):
-+ $(RM) -rf $(USERDIR)
-+ $(COPY) $(COPYRECURSE) $(SOLARXMLDIR)$/unit-skel $(USERDIR)
-+
-+$(USERDIR)$/$(TARGET).rdb .ERRREMOVE: $(USERDIR)
-+ $(COPY) $(SOLARBINDIR)$/types.rdb $@
-+ regmerge $@ / $(SOLARLIBDIR)$/services.rdb
-+
-+test .PHONY: $(SHL1TARGETN) $(USERDIR)$/$(TARGET).rdb
-+ testshl2 $(SHL1TARGETN) -forward "$(USERDIR)$/$(TARGET).rdb#$(USERDIR)"
-+ $(RM) -rf $(USERDIR)
-+
---- /dev/null 2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/ucalc.cxx 2008-02-20 16:25:12.000000000 +0000
-@@ -0,0 +1,81 @@
-+// TODO ...
-+// officecfg: can we move this into our skeleton ?
-+// Solve the Setup.xcu problem pleasantly [ custom version ? ]
-+// Remove: Foo killed exception ! ...
-+// deliver.pl
-+// don't call regcomp if we don't have it.
-+// find & kill signalfile stuff (?)
-+// Consider - where to dump this code ?
-+// - surely there is some Uno module we can use... ?
-+// - 'unohelper' ?
-+
-+#include "sal/config.h"
-+#include "ubootstrap.hxx"
-+#include "vcl/svapp.hxx"
-+#include <scdll.hxx>
-+#include <document.hxx>
-+#include "cppunit/simpleheader.hxx"
-+
-+#define CATCH_FAIL(msg) \
-+ catch (const css::uno::Exception &e) { \
-+ t_print ("msg '%s'\n", rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr()); \
-+ CPPUNIT_FAIL( msg ); \
-+ throw; \
-+ }
-+
-+class Test: public CppUnit::TestFixture {
-+ UnitBootstrap *mpUnitBootstrap;
-+public:
-+ // init
-+ virtual void setUp();
-+ virtual void tearDown();
-+
-+ // tests
-+ void createDocument();
-+
-+ CPPUNIT_TEST_SUITE(Test);
-+ CPPUNIT_TEST(createDocument);
-+ CPPUNIT_TEST_SUITE_END();
-+
-+private:
-+};
-+
-+void Test::setUp()
-+{
-+ mpUnitBootstrap = new UnitBootstrap();
-+
-+ InitVCL (mpUnitBootstrap->getMSF());
-+
-+ ScDLL::Init();
-+}
-+
-+void Test::tearDown()
-+{
-+ DeInitVCL ();
-+
-+ delete mpUnitBootstrap;
-+}
-+
-+void Test::createDocument()
-+{
-+ ScDocument *doc = new ScDocument();
-+
-+ rtl::OUString aTabName = rtl::OUString::createFromAscii ("foo");
-+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
-+ doc->InsertTab (0, aTabName));
-+ double val = 1;
-+ doc->SetValue (0, 0, 0, val);
-+ doc->SetValue (0, 1, 0, val);
-+ doc->SetString (0, 2, 0, rtl::OUString::createFromAscii ("=SUM(A1:A2)"));
-+ doc->CalcAll();
-+ double result;
-+ doc->GetValue (0, 2, 0, result);
-+ fprintf (stderr, "one plus one = %g\n", result);
-+ CPPUNIT_ASSERT_MESSAGE ("calculation failed", result == 2.0);
-+
-+ delete doc;
-+}
-+
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
-+
-+NOADDITIONAL;
---- /dev/null 2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/ubootstrap.hxx 2008-02-20 16:20:46.000000000 +0000
-@@ -0,0 +1,18 @@
-+#ifndef UNIT_BOOTSTRAP_HXX
-+#define UNIT_BOOTSTRAP_HXX
-+
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/uno/XComponentContext.hpp"
-+
-+class UnitBootstrap
-+{
-+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
-+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
-+ public:
-+ UnitBootstrap();
-+ ~UnitBootstrap();
-+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
-+ getMSF() { return mxMSF; }
-+};
-+
-+#endif // UNIT_BOOTSTRAP_HXX
---- /dev/null 2007-09-21 22:50:58.000000000 +0100
-+++ sc/qa/unit/export.map 2007-11-23 13:57:51.000000000 +0000
-@@ -0,0 +1,7 @@
-+UDK_3.0 {
-+ global:
-+ registerAllTestFunction;
-+
-+ local:
-+ *;
-+};
diff --git a/patches/test/built-in-unit-test.diff b/patches/test/built-in-unit-test.diff
deleted file mode 100644
index 8f372e648..000000000
--- a/patches/test/built-in-unit-test.diff
+++ /dev/null
@@ -1,211 +0,0 @@
-Index: configmgr/source/backend/layermerge.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/backend/layermerge.cxx,v
-retrieving revision 1.26
-diff -u -p -u -r1.26 layermerge.cxx
---- configmgr/source/backend/layermerge.cxx 16 Sep 2006 15:05:04 -0000 1.26
-+++ configmgr/source/backend/layermerge.cxx 20 Feb 2008 11:50:31 -0000
-@@ -936,7 +936,12 @@ void SAL_CALL LayerMergeHandler::setProp
- m_pProperty->modifyState( node::isMerged );
- m_aContext.markCurrentMerged();
-
-- applyPropertyValue(aValue);
-+ try {
-+ applyPropertyValue(aValue);
-+ } catch (script::CannotConvertException &ex) {
-+ fprintf (stderr, "Foo - killed conversion exception!\n");
-+ // the solver's Setup.xcu's "${PRODUCTVERSION}" is not an double eg.
-+ }
- }
- // -----------------------------------------------------------------------------
-
-Index: solenv/bin/deliver.pl
-===================================================================
-RCS file: /cvs/tools/solenv/bin/deliver.pl,v
-retrieving revision 1.124
-diff -u -p -u -r1.124 deliver.pl
---- solenv/bin/deliver.pl 26 Nov 2007 19:00:17 -0000 1.124
-+++ solenv/bin/deliver.pl 20 Feb 2008 11:51:07 -0000
-@@ -40,6 +40,8 @@ eval 'exec perl -wS $0 ${1+"$@"}'
- # deliver.pl - copy from module output tree to solver
- #
-
-+use lib ("$ENV{SOLARENV}/bin/modules");
-+
- use Cwd;
- use File::Basename;
- use File::Copy;
-@@ -47,6 +49,9 @@ use File::DosGlob 'glob';
- use File::Path;
- use File::Spec;
-
-+# for component registration ...
-+use installer::globals;
-+
- #### script id #####
-
- ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
-@@ -695,12 +700,16 @@ sub glob_and_copy
- my $touch = shift;
-
- my @copy_files = @{glob_line($from, $to)};
-+ my @register = ();
-
- for (my $i = 0; $i <= $#copy_files; $i++) {
- next if filter_out($copy_files[$i][0]); # apply copy filter
-- copy_if_newer($copy_files[$i][0], $copy_files[$i][1], $touch)
-+ copy_if_newer($copy_files[$i][0], $copy_files[$i][1], $touch, \@register)
- ? $files_copied++ : $files_unchanged++;
- }
-+ for my $comp (@register) {
-+ register_component ($comp);
-+ }
- }
-
- sub is_unstripped {
-@@ -757,6 +766,119 @@ sub strip_target {
- return $rc;
- };
-
-+# start evil cut/paste from bin/modules/installer/servicesfile.pm ...
-+
-+################################################################
-+# Generating a file url from a path
-+################################################################
-+
-+sub remove_ending_pathseparator
-+{
-+ my ( $stringref ) = @_;
-+
-+ $$stringref =~ s/\Q$installer::globals::separator\E\s*$//;
-+}
-+
-+sub make_file_url
-+{
-+ my ( $path ) = @_;
-+
-+ my $fileurl = "";
-+
-+ # removing ending slash/backslash
-+
-+ remove_ending_pathseparator(\$path);
-+
-+ if ($installer::globals::iswin)
-+ {
-+ $path =~ s/\\/\//g;
-+ $fileurl = "file\:\/\/\/" . $path;
-+ }
-+ else
-+ {
-+ $fileurl = "file\:\/\/" . $path;
-+ }
-+
-+ return $fileurl;
-+}
-+
-+################################################################
-+# Helper routine to change cygwin (POSIX) path to DOS notation
-+# if needed
-+################################################################
-+sub fix_cygwin_path
-+{
-+ my ( $path ) = @_;
-+
-+ if ( $installer::globals::iswin eq 1 && $ENV{'USE_SHELL'} ne "4nt" && $installer::globals::wrapcmd eq "" )
-+ {
-+ $path = qx{cygpath -m "$path"};
-+ chomp($path);
-+ }
-+
-+ return $path;
-+}
-+
-+sub get_regcomp()
-+{
-+ my $searchname;
-+ if ($installer::globals::isunix) { $searchname = "regcomp"; }
-+ else { $searchname = "regcomp.exe"; }
-+ return $searchname;
-+}
-+
-+sub register_queue ($$)
-+{
-+ my $queue = shift;
-+ my $component = shift;
-+
-+ # Try to register all libraries
-+ $component =~ /\.(so|dylib|dll)/ || return;
-+ push @$queue, $component;
-+}
-+
-+sub register_component ($)
-+{
-+ my $component = shift;
-+
-+ my $solarlib = $ENV{SOLARVER}."/".$ENV{INPATH}."/lib";
-+ my $servicesfile = "$solarlib/services.rdb";
-+ my @regcompoutput = ();
-+ my $regcomp = get_regcomp();
-+
-+ my $filestring = make_file_url($component);
-+
-+ my $systemcall = "$installer::globals::wrapcmd $regcomp " .
-+ "-register -r ".fix_cygwin_path($servicesfile).
-+ " -c " . $installer::globals::quote . $filestring . $installer::globals::quote .
-+ " 2\>\&1 |";
-+
-+# " -wop=" . $installer::globals::quote . $allvariableshashref->{'NATIVESERVICESURLPREFIX'} . $installer::globals::quote .
-+
-+ open (REG, "$systemcall");
-+ while (<REG>) {push(@regcompoutput, $_); }
-+ close (REG);
-+
-+ my $returnvalue = $?; # $? contains the return value of the systemcall
-+
-+ # cf. cpputools/source/registercomponent/registercomponent.cxx
-+ if ($returnvalue == 256) {
-+ # has no component_ methods (?)
-+ print "non component: $component\n" if !$opt_silent;
-+# print "command: $systemcall";
-+# print "output: @regcompoutput";
-+ return;
-+ } elsif ($returnvalue == 0) {
-+ print "registered component: $component\n" if !$opt_silent;
-+ } elsif (!$opt_silent) {
-+ print "Warning: registration failed abnormally with code: $returnvalue\n";
-+ print "command: $systemcall";
-+ print "output: @regcompoutput";
-+ }
-+}
-+
-+# evil cut/paste from bin/modules/installer/servicesfile.pm ends ...
-+
- sub copy_if_newer
- {
- # return 0 if file is unchanged ( for whatever reason )
-@@ -764,6 +886,7 @@ sub copy_if_newer
- my $from = shift;
- my $to = shift;
- my $touch = shift;
-+ my $register = shift;
- my $from_stat_ref;
- my $rc = 0;
-
-@@ -841,6 +964,9 @@ sub copy_if_newer
- system("macosx-create-bundle", "$to=$from.app") if ( -d "$from.app" );
- system("ranlib", "$to" ) if ( $to =~ /\.a/ );
- }
-+
-+ # register each component as it is delivered into a tests .rdb
-+ register_queue ($register, $to);
- return 1;
- }
- else {
-@@ -854,6 +980,7 @@ sub copy_if_newer
- print_error("directory '$destdir' does not exist", 0);
- }
- }
-+
- unlink($temp_file);
- return 0;
- }
diff --git a/patches/test/calc-autofilter-multistring-offapi.diff b/patches/test/calc-autofilter-multistring-offapi.diff
deleted file mode 100644
index 1d2e3f5ca..000000000
--- a/patches/test/calc-autofilter-multistring-offapi.diff
+++ /dev/null
@@ -1,843 +0,0 @@
-Index: offapi/com/sun/star/sheet/DatabaseRange.idl
-===================================================================
-RCS file: /cvs/api/offapi/com/sun/star/sheet/DatabaseRange.idl,v
-retrieving revision 1.13
-retrieving revision 1.13.352.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.13 -r1.13.352.2
---- offapi/com/sun/star/sheet/DatabaseRange.idl 8 Sep 2005 04:37:50 -0000 1.13
-+++ offapi/com/sun/star/sheet/DatabaseRange.idl 13 Aug 2007 23:53:06 -0000 1.13.352.2
-@@ -154,6 +154,14 @@
-
- */
- [optional, property] boolean FromSelection;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /**
-+
-+ @since OOo 3.0.0
-+ */
-+ [optional, property] any SheetFilterFieldAccess;
- };
-
- //=============================================================================
-Index: offapi/com/sun/star/sheet/SheetFilterConnection.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterConnection.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterConnection.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterConnection.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterConnection.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterConnection_idl__
-+#define __com_sun_star_sheet_SheetFilterConnection_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** used to specify how two conditions in a filter descriptor are
-+ connected.
-+ */
-+constants SheetFilterConnection
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** both conditions have to be fulfilled.
-+ */
-+ const short AND = 0;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** at least one of the conditions has to be fulfilled.
-+ */
-+ const short OR = 1;
-+
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterDescriptor.idl
-===================================================================
-RCS file: /cvs/api/offapi/com/sun/star/sheet/SheetFilterDescriptor.idl,v
-retrieving revision 1.7
-retrieving revision 1.7.352.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.7 -r1.7.352.2
---- offapi/com/sun/star/sheet/SheetFilterDescriptor.idl 8 Sep 2005 04:49:59 -0000 1.7
-+++ offapi/com/sun/star/sheet/SheetFilterDescriptor.idl 10 Aug 2007 18:13:02 -0000 1.7.352.2
-@@ -74,6 +74,12 @@
-
- //-------------------------------------------------------------------------
-
-+ /** provides access to the collection of filter fields.
-+ */
-+// [optional] interface com::sun::star::sheet::XSheetFilterFieldAccess;
-+
-+ //-------------------------------------------------------------------------
-+
- //!published service PropertySet
- /** provides access to the properties.
- */
-@@ -145,7 +151,6 @@
- current implementation supports.</p>
- */
- [readonly, property] long MaxFieldCount;
--
- };
-
- //=============================================================================
-Index: offapi/com/sun/star/sheet/SheetFilterField.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterField.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterField.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterField.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,77 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterField.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterField_idl__
-+#define __com_sun_star_sheet_SheetFilterField_idl__
-+
-+#ifndef __com_sun_star_sheet_SheetFilterConnection_idl__
-+#include <com/sun/star/sheet/SheetFilterConnection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** serve as the base type for various types of filters used via <type
-+ scope="com::sun::star::sheet">XExtendedSheetFilterDescriptor</type>. This
-+ struct contains members that are common across all types of filters.
-+
-+ @see com::sun::star::sheet::XExtendedSheetFilterDescriptor
-+ */
-+struct SheetFilterField
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies how the condition is connected to the previous condition.
-+
-+ @see com::sun::star::sheet::SheetFilterConnection
-+ */
-+ short Connection;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies which field (column) is used for the condition.
-+ */
-+ long Field;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterFieldAccess.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterFieldAccess.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterFieldAccess.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterFieldAccess.idl 15 Aug 2007 19:23:44 -0000 1.1.2.2
-@@ -0,0 +1,131 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterFieldAccess.idl,v $
-+ *
-+ * $Revision: 1.1.2.2 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:23:44 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterFieldAccess_idl__
-+#define __com_sun_star_sheet_SheetFilterFieldAccess_idl__
-+
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.idl>
-+#include <com/sun/star/beans/XPropertySet.idl>
-+#include <com/sun/star/table/TableOrientation.idl>
-+#include <com/sun/star/table/CellAddress.idl>
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** enumerated type of filters.
-+ */
-+service SheetFilterFieldAccess
-+{
-+ interface com::sun::star::sheet::XSheetFilterFieldAccess;
-+
-+ interface com::sun::star::beans::XPropertySet;
-+
-+ //=========================================================================
-+
-+ /** specifies if the case of letters is important when comparing entries.
-+ */
-+ [property] boolean IsCaseSensitive;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if duplicate entries are left out of the result.
-+ */
-+ [property] boolean SkipDuplicates;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if the <member>TableFilterField::StringValue</member>
-+ strings are interpreted as regular expressions.
-+ */
-+ [property] boolean UseRegularExpressions;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if the <member>SheetFilterDescriptor::OutputPosition</member>
-+ position is saved for future calls.
-+
-+ <p>This is only used if
-+ <member>SheetFilterDescriptor::CopyOutputData</member> is <TRUE/>.</p>
-+ */
-+ [property] boolean SaveOutputPosition;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if columns or rows are filtered.
-+ */
-+ [property] com::sun::star::table::TableOrientation Orientation;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if the first row (or column) contains headers which should
-+ not be filtered.
-+ */
-+ [property] boolean ContainsHeader;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies if the filtered data should be copied to another position
-+ in the document.
-+ */
-+ [property] boolean CopyOutputData;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies the position where filtered data are to be copied.
-+
-+ <p>This is only used if
-+ <member>SheetFilterDescriptor::CopyOutputData</member> is <TRUE/>.</p>
-+ */
-+ [property] com::sun::star::table::CellAddress OutputPosition;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** returns the maximum number of filter fields in the descriptor.
-+
-+ <p>This read-only property indicates the maximum count of fields the
-+ current implementation supports.</p>
-+ */
-+ [readonly, property] long MaxFieldCount;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterFieldMultiString.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterFieldMultiString.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterFieldMultiString.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterFieldMultiString.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterFieldMultiString.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterFieldMultiString_idl__
-+#define __com_sun_star_sheet_SheetFilterFieldMultiString_idl__
-+
-+#ifndef __com_sun_star_sheet_SheetFilterField_idl__
-+#include <com/sun/star/sheet/SheetFilterField.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** describes a single condition in a filter descriptor that contains a set of
-+ multiple string values. When this struct is used instead of <type
-+ scope="com::sun::star::sheet">TableFilterFieldNormal</type>, the filter
-+ compares each cell content for textual equality against one of provided
-+ string values.
-+
-+ @see com::sun::star::sheet::XExtendedSheetFilterDescriptor
-+ */
-+struct SheetFilterFieldMultiString: SheetFilterField
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** contains a set of multiple string values to be used for filter evaluation.
-+ */
-+ sequence< string > StringSet;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterFieldType.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterFieldType.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterFieldType.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterFieldType.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterFieldType.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterFieldType_idl__
-+#define __com_sun_star_sheet_SheetFilterFieldType_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** enumerated type of filters.
-+ */
-+constants SheetFilterFieldType
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** no valid filter field. This type can be used to signal the end of
-+ iteration, uninitialized filter etc.
-+ */
-+ const short NONE = 0;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** normal filter field type.
-+ */
-+ const short VALUE = 1;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** multi-string filter field type.
-+ */
-+ const short MULTI_STRING = 2;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterFieldValue.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterFieldValue.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterFieldValue.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterFieldValue.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,84 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterFieldValue.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterFieldValue_idl__
-+#define __com_sun_star_sheet_SheetFilterFieldValue_idl__
-+
-+#ifndef __com_sun_star_sheet_SheetFilterField_idl__
-+#include <com/sun/star/sheet/SheetFilterField.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+struct SheetFilterFieldValue: SheetFilterField
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies the type of the condition.
-+
-+ @see com::sun::star::sheet::SheetFilterOperator
-+ */
-+ short Operator;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects whether the <member>TableFilterField::NumericValue</member>
-+ or the <member>TableFilterField::StringValue</member> is used.
-+ */
-+ boolean IsNumeric;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies a numeric value for the condition.
-+ */
-+ double NumericValue;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** specifies a string value for the condition.
-+ */
-+ string StringValue;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/SheetFilterOperator.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/SheetFilterOperator.idl
-diff -N offapi/com/sun/star/sheet/SheetFilterOperator.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/SheetFilterOperator.idl 10 Aug 2007 18:13:02 -0000 1.1.2.1
-@@ -0,0 +1,127 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: SheetFilterOperator.idl,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/10 18:13:02 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_SheetFilterOperator_idl__
-+#define __com_sun_star_sheet_SheetFilterOperator_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** specifies the type of a single condition in a filter descriptor.
-+ */
-+constants SheetFilterOperator
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** selects empty entries.
-+ */
-+ const short EMPTY = 0;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects non-empty entries.
-+ */
-+ const short NOT_EMPTY = 1;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value has to be equal to the specified value.
-+ */
-+ const short EQUAL = 2;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value must not be equal to the specified value.
-+ */
-+ const short NOT_EQUAL = 3;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value has to be greater than the specified value.
-+ */
-+ const short GREATER = 4;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value has to be greater than or equal to the specified value.
-+ */
-+ const short GREATER_EQUAL = 5;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value has to be less than the specified value.
-+ */
-+ const short LESS = 6;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** value has to be less than or equal to the specified value.
-+ */
-+ const short LESS_EQUAL = 7;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects a specified number of entries with the greatest values.
-+ */
-+ const short TOP_VALUES = 8;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects a specified percentage of entries with the greatest values.
-+ */
-+ const short TOP_PERCENT = 9;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects a specified number of entries with the lowest values.
-+ */
-+ const short BOTTOM_VALUES = 10;
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** selects a specified percentage of entries with the lowest values.
-+ */
-+ const short BOTTOM_PERCENT = 11;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/XSheetFilterFieldAccess.idl
-===================================================================
-RCS file: offapi/com/sun/star/sheet/XSheetFilterFieldAccess.idl
-diff -N offapi/com/sun/star/sheet/XSheetFilterFieldAccess.idl
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ offapi/com/sun/star/sheet/XSheetFilterFieldAccess.idl 15 Aug 2007 19:23:44 -0000 1.1.2.4
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XSheetFilterFieldAccess.idl,v $
-+ *
-+ * $Revision: 1.1.2.4 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:23:44 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_XSheetFilterFieldAccess_idl__
-+#define __com_sun_star_sheet_XSheetFilterFieldAccess_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** provides extended access to a collection of filter fields.
-+
-+ @see com::sun::star::sheet::SheetFilterDescriptor
-+ */
-+interface XSheetFilterFieldAccess: com::sun::star::uno::XInterface
-+{
-+ //-------------------------------------------------------------------------
-+
-+ void setFields( [in] sequence< any > aFields );
-+
-+ //-------------------------------------------------------------------------
-+
-+ sequence< any > getFields();
-+
-+ //-------------------------------------------------------------------------
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-+
-Index: offapi/com/sun/star/sheet/makefile.mk
-===================================================================
-RCS file: /cvs/api/offapi/com/sun/star/sheet/makefile.mk,v
-retrieving revision 1.24
-retrieving revision 1.24.86.3
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.24 -r1.24.86.3
---- offapi/com/sun/star/sheet/makefile.mk 22 May 2007 15:11:32 -0000 1.24
-+++ offapi/com/sun/star/sheet/makefile.mk 13 Aug 2007 23:53:07 -0000 1.24.86.3
-@@ -188,7 +188,14 @@
- SheetCellRange.idl\
- SheetCellRanges.idl\
- SheetCellRangesEnumeration.idl\
-+ SheetFilterConnection.idl\
- SheetFilterDescriptor.idl\
-+ SheetFilterField.idl\
-+ SheetFilterFieldAccess.idl\
-+ SheetFilterFieldMultiString.idl\
-+ SheetFilterFieldType.idl\
-+ SheetFilterFieldValue.idl\
-+ SheetFilterOperator.idl\
- SheetLink.idl\
- SheetLinkMode.idl\
- SheetLinks.idl\
-@@ -305,6 +312,7 @@
- XSheetFilterable.idl\
- XSheetFilterableEx.idl\
- XSheetFilterDescriptor.idl\
-+ XSheetFilterFieldAccess.idl\
- XSheetLinkable.idl\
- XSheetOperation.idl\
- XSheetOutline.idl\
diff --git a/patches/test/calc-autofilter-multistring-sc.diff b/patches/test/calc-autofilter-multistring-sc.diff
deleted file mode 100644
index 15409bf69..000000000
--- a/patches/test/calc-autofilter-multistring-sc.diff
+++ /dev/null
@@ -1,2551 +0,0 @@
-Index: sc/inc/datauno.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/datauno.hxx,v
-retrieving revision 1.7
-retrieving revision 1.7.114.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.7 -r1.7.114.2
---- sc/inc/datauno.hxx 27 Feb 2007 11:54:55 -0000 1.7
-+++ sc/inc/datauno.hxx 13 Aug 2007 23:48:19 -0000 1.7.114.2
-@@ -113,6 +113,7 @@
- #include <cppuhelper/implbase6.hxx>
- #endif
-
-+
- class ScDBData;
- class ScDocShell;
-
-@@ -476,7 +477,7 @@
- };
-
-
--// ScFilterDescriptor - dummer Container zur Benutzung mit XFilterable
-+// ScFilterDescriptor - stupid container for use with XFilterable
-
- class ScFilterDescriptor : public ScFilterDescriptorBase
- {
-@@ -497,7 +498,7 @@
- };
-
-
--// ScRangeFilterDescriptor - FilterDescriptor eines Datenbank-Bereichs
-+// ScRangeFilterDescriptor - FilterDescriptor of a data base range
-
- class ScRangeFilterDescriptor : public ScFilterDescriptorBase
- {
-@@ -584,8 +585,6 @@
- getSubTotalDescriptor() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
- getImportDescriptor() throw(::com::sun::star::uno::RuntimeException);
--// implemented for the XRefreshable Interface
--// virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException);
-
- // XRefreshable
- virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException);
-Index: sc/inc/dbcolect.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dbcolect.hxx,v
-retrieving revision 1.12
-retrieving revision 1.12.84.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.12 -r1.12.84.1
---- sc/inc/dbcolect.hxx 25 Apr 2007 15:56:28 -0000 1.12
-+++ sc/inc/dbcolect.hxx 25 Jul 2007 03:40:44 -0000 1.12.84.1
-@@ -113,6 +113,7 @@
- String* pQueryStr[MAXQUERY];
- double nQueryVal[MAXQUERY];
- ScQueryConnect eQueryConnect[MAXQUERY];
-+ ScHashOUStringSet aStrValues[MAXQUERY];
- BOOL bIsAdvanced; // TRUE if created by advanced filter
- ScRange aAdvSource; // source range
- // SubTotalParam
-Index: sc/inc/filterglobal.hxx
-===================================================================
-RCS file: sc/inc/filterglobal.hxx
-diff -N sc/inc/filterglobal.hxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/inc/filterglobal.hxx 15 Aug 2007 19:21:14 -0000 1.1.2.2
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: filterglobal.hxx,v $
-+ *
-+ * $Revision: 1.1.2.2 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:21:14 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_FILTERGLOBAL_HXX
-+#define SC_FILTERGLOBAL_HXX
-+
-+#include <sal/types.h>
-+#include <com/sun/star/uno/Any.h>
-+
-+#include <boost/shared_ptr.hpp>
-+
-+namespace com { namespace sun { namespace star { namespace sheet {
-+ struct SheetFilterField;
-+ struct SheetFilterFieldValue;
-+ struct SheetFilterFieldMultiString;
-+}}}}
-+
-+struct ScSheetFilterFieldItem
-+{
-+ typedef ::boost::shared_ptr< ::com::sun::star::sheet::SheetFilterField > SheetFilterFieldRef;
-+
-+ static const ::com::sun::star::uno::Type VALUE;
-+ static const ::com::sun::star::uno::Type MULTI_STRING;
-+
-+ sal_Int16 mnType;
-+ SheetFilterFieldRef mpField;
-+
-+ ::com::sun::star::sheet::SheetFilterFieldValue* getFieldValue() const;
-+ ::com::sun::star::sheet::SheetFilterFieldMultiString* getFieldMultiString() const;
-+
-+ ScSheetFilterFieldItem();
-+};
-+
-+#endif
-Index: sc/inc/global.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/global.hxx,v
-retrieving revision 1.50
-retrieving revision 1.49.12.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.50 -r1.49.12.2
---- sc/inc/global.hxx 24 Jul 2007 09:22:45 -0000 1.50
-+++ sc/inc/global.hxx 1 Oct 2007 15:29:08 -0000 1.49.12.2
-@@ -58,6 +58,8 @@
- #include "scdllapi.h"
- #endif
-
-+#include <hash_set>
-+
- class ImageList;
- class Bitmap;
- class SfxItemSet;
-@@ -887,6 +889,8 @@
- class TextSearch;
- }
-
-+typedef ::std::hash_set< ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to<rtl::OUString> > ScHashOUStringSet;
-+
- struct ScQueryEntry
- {
- BOOL bDoQuery;
-@@ -899,6 +903,8 @@
- utl::SearchParam* pSearchParam; // falls RegExp, nicht gespeichert
- utl::TextSearch* pSearchText; // falls RegExp, nicht gespeichert
-
-+ ScHashOUStringSet aStrValues;
-+
- ScQueryEntry();
- ScQueryEntry(const ScQueryEntry& r);
- ~ScQueryEntry();
-Index: sc/source/core/data/filterglobal.cxx
-===================================================================
-RCS file: sc/source/core/data/filterglobal.cxx
-diff -N sc/source/core/data/filterglobal.cxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/source/core/data/filterglobal.cxx 15 Aug 2007 19:21:14 -0000 1.1.2.2
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: filterglobal.cxx,v $
-+ *
-+ * $Revision: 1.1.2.2 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:21:14 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#include "filterglobal.hxx"
-+
-+#include <com/sun/star/sheet/SheetFilterField.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldType.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldValue.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldMultiString.hpp>
-+
-+using namespace ::com::sun::star;
-+
-+const uno::Type ScSheetFilterFieldItem::VALUE = getCppuType( static_cast<sheet::SheetFilterFieldValue*>(NULL) );
-+const uno::Type ScSheetFilterFieldItem::MULTI_STRING = getCppuType( static_cast<sheet::SheetFilterFieldMultiString*>(NULL) );
-+
-+sheet::SheetFilterFieldValue* ScSheetFilterFieldItem::getFieldValue() const
-+{
-+ sheet::SheetFilterFieldValue* p = static_cast<sheet::SheetFilterFieldValue*>(mpField.get());
-+ return p;
-+}
-+
-+sheet::SheetFilterFieldMultiString* ScSheetFilterFieldItem::getFieldMultiString() const
-+{
-+ sheet::SheetFilterFieldMultiString* p = static_cast<sheet::SheetFilterFieldMultiString*>(mpField.get());
-+ return p;
-+}
-+
-+ScSheetFilterFieldItem::ScSheetFilterFieldItem() :
-+ mnType(sheet::SheetFilterFieldType::NONE),
-+ mpField(static_cast<sheet::SheetFilterField*>(NULL))
-+{
-+}
-Index: sc/source/core/data/global2.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/global2.cxx,v
-retrieving revision 1.21
-retrieving revision 1.21.114.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.21 -r1.21.114.1
---- sc/source/core/data/global2.cxx 27 Feb 2007 12:06:31 -0000 1.21
-+++ sc/source/core/data/global2.cxx 25 Jul 2007 03:40:45 -0000 1.21.114.1
-@@ -176,6 +176,7 @@
- pStr = new String(*r.pStr);
- pSearchParam = NULL;
- pSearchText = NULL;
-+ aStrValues = r.aStrValues;
- }
-
- ScQueryEntry::~ScQueryEntry()
-@@ -205,6 +206,8 @@
- pSearchParam = NULL;
- pSearchText = NULL;
-
-+ aStrValues = r.aStrValues;
-+
- return *this;
- }
-
-@@ -224,6 +227,7 @@
- }
- pSearchParam = NULL;
- pSearchText = NULL;
-+ aStrValues.clear();
- }
-
- BOOL ScQueryEntry::operator==( const ScQueryEntry& r ) const
-@@ -234,7 +238,8 @@
- && eConnect == r.eConnect
- && nField == r.nField
- && nVal == r.nVal
-- && *pStr == *r.pStr;
-+ && *pStr == *r.pStr
-+ && aStrValues == r.aStrValues;
- //! pSearchParam und pSearchText nicht vergleichen
- }
-
-Index: sc/source/core/data/makefile.mk
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/makefile.mk,v
-retrieving revision 1.21
-retrieving revision 1.21.114.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.21 -r1.21.114.1
---- sc/source/core/data/makefile.mk 27 Feb 2007 12:06:42 -0000 1.21
-+++ sc/source/core/data/makefile.mk 14 Aug 2007 22:10:11 -0000 1.21.114.1
-@@ -90,6 +90,7 @@
- $(SLO)$/drawpage.obj \
- $(SLO)$/drwlayer.obj \
- $(SLO)$/fillinfo.obj \
-+ $(SLO)$/filterglobal.obj \
- $(SLO)$/global.obj \
- $(SLO)$/global2.obj \
- $(SLO)$/globalx.obj \
-Index: sc/source/core/data/table3.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/table3.cxx,v
-retrieving revision 1.29
-retrieving revision 1.28.104.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.29 -r1.28.104.2
---- sc/source/core/data/table3.cxx 21 Sep 2007 09:23:09 -0000 1.29
-+++ sc/source/core/data/table3.cxx 1 Oct 2007 15:29:18 -0000 1.28.104.2
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
--
-+#include <stdio.h>
-
- // INCLUDE ---------------------------------------------------------------
-
-@@ -1036,6 +1036,18 @@
- else
- GetInputString( static_cast<SCCOL>(rEntry.nField), nRow, aCellStr );
-
-+ if ( !rEntry.aStrValues.empty() )
-+ {
-+ // Filter by individual string values.
-+ rtl::OUString aCellStr2(aCellStr);
-+ ScHashOUStringSet::const_iterator pos = rEntry.aStrValues.find(aCellStr2);
-+ if (pos == rEntry.aStrValues.end())
-+ bOk = FALSE;
-+ else
-+ bOk = TRUE;
-+ }
-+ else
-+ {
- BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
- || (rEntry.eOp == SC_NOT_EQUAL)));
- BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp
-@@ -1113,6 +1125,7 @@
- }
- }
- }
-+ }
- else if (rParam.bMixedComparison)
- {
- if (rEntry.bQueryByString &&
-@@ -1304,7 +1317,11 @@
- ScQueryEntry& rEntry = rParam.GetEntry(i);
- if ( rEntry.bDoQuery )
- {
-- if ( rEntry.bQueryByString )
-+ if ( !rEntry.aStrValues.empty() )
-+ {
-+ // Do nothing.
-+ }
-+ else if ( rEntry.bQueryByString )
- {
- sal_uInt32 nIndex = 0;
- rEntry.bQueryByString = !( pDoc->GetFormatTable()->
-Index: sc/source/core/tool/dbcolect.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/tool/dbcolect.cxx,v
-retrieving revision 1.16
-retrieving revision 1.16.114.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.16 -r1.16.114.1
---- sc/source/core/tool/dbcolect.cxx 27 Feb 2007 12:14:19 -0000 1.16
-+++ sc/source/core/tool/dbcolect.cxx 25 Jul 2007 03:40:45 -0000 1.16.114.1
-@@ -544,6 +544,7 @@
- *pQueryStr[i] = *rData.pQueryStr[i];
- nQueryVal[i] = rData.nQueryVal[i];
- eQueryConnect[i] = rData.eQueryConnect[i];
-+ aStrValues[i] = rData.aStrValues[i];
- }
- for (i=0; i<MAXSUBTOTAL; i++)
- {
-@@ -812,6 +813,7 @@
- *rEntry.pStr = *pQueryStr[i];
- rEntry.nVal = nQueryVal[i];
- rEntry.eConnect = eQueryConnect[i];
-+ rEntry.aStrValues = aStrValues[i];
- }
- }
-
-@@ -843,6 +845,7 @@
- *pQueryStr[i] = *rEntry.pStr;
- nQueryVal[i] = rEntry.nVal;
- eQueryConnect[i] = rEntry.eConnect;
-+ aStrValues[i] = rEntry.aStrValues;
- }
- }
-
-Index: sc/source/filter/xml/XMLExportDatabaseRanges.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/XMLExportDatabaseRanges.cxx,v
-retrieving revision 1.22
-retrieving revision 1.22.74.6
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.22 -r1.22.74.6
---- sc/source/filter/xml/XMLExportDatabaseRanges.cxx 22 May 2007 20:02:49 -0000 1.22
-+++ sc/source/filter/xml/XMLExportDatabaseRanges.cxx 15 Aug 2007 23:14:50 -0000 1.22.74.6
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
--
-+#include <stdio.h>
-
- // INCLUDE ---------------------------------------------------------------
-
-@@ -85,6 +85,8 @@
- #include "rangeutl.hxx"
- #endif
-
-+#include "filterglobal.hxx"
-+
- #ifndef _COM_SUN_STAR_SHEET_DATAIMPORTMODE_HPP_
- #include <com/sun/star/sheet/DataImportMode.hpp>
- #endif
-@@ -107,6 +109,12 @@
- #include <com/sun/star/table/TableOrientation.hpp>
- #endif
-
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldValue.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldMultiString.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldType.hpp>
-+#include <com/sun/star/sheet/SheetFilterOperator.hpp>
-+
- #ifndef _TOOLS_DEBUG_HXX
- #include <tools/debug.hxx>
- #endif
-@@ -114,14 +122,27 @@
- #include <comphelper/extract.hxx>
- #endif
-
-+#include <boost/shared_ptr.hpp>
-+#include <vector>
-+
- //! not found in unonames.hxx
- #define SC_USERLIST "UserList"
- #define SC_SORTASCENDING "SortAscending"
- #define SC_ENABLEUSERSORTLIST "EnableUserSortList"
- #define SC_USERSORTLISTINDEX "UserSortListIndex"
-
-+#define CREATE_OUSTRING( ascii ) ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-+
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::Sequence;
-+using ::com::sun::star::uno::Any;
-+using ::com::sun::star::uno::Type;
-+using ::com::sun::star::sheet::SheetFilterFieldMultiString;
-+using ::com::sun::star::sheet::SheetFilterFieldValue;
-+
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::boost::shared_ptr;
-
- ScXMLExportDatabaseRanges::ScXMLExportDatabaseRanges(ScXMLExport& rTempExport)
- : rExport(rTempExport),
-@@ -259,43 +280,43 @@
- }
- }
-
--rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const
-+rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sal_Int16 nOperator, const sal_Bool bUseRegularExpressions) const
- {
-- switch (aFilterOperator)
-+ switch (nOperator)
- {
-- case sheet::FilterOperator_EQUAL :
-+ case sheet::SheetFilterOperator::EQUAL :
- {
- if (bUseRegularExpressions)
- return GetXMLToken(XML_MATCH);
- else
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
- }
-- case sheet::FilterOperator_NOT_EQUAL :
-+ case sheet::SheetFilterOperator::NOT_EQUAL :
- {
- if (bUseRegularExpressions)
- return GetXMLToken(XML_NOMATCH);
- else
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!="));
- }
-- case sheet::FilterOperator_BOTTOM_PERCENT :
-+ case sheet::SheetFilterOperator::BOTTOM_PERCENT :
- return GetXMLToken(XML_BOTTOM_PERCENT);
-- case sheet::FilterOperator_BOTTOM_VALUES :
-+ case sheet::SheetFilterOperator::BOTTOM_VALUES :
- return GetXMLToken(XML_BOTTOM_VALUES);
-- case sheet::FilterOperator_EMPTY :
-+ case sheet::SheetFilterOperator::EMPTY :
- return GetXMLToken(XML_EMPTY);
-- case sheet::FilterOperator_GREATER :
-+ case sheet::SheetFilterOperator::GREATER :
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">"));
-- case sheet::FilterOperator_GREATER_EQUAL :
-+ case sheet::SheetFilterOperator::GREATER_EQUAL :
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">="));
-- case sheet::FilterOperator_LESS :
-+ case sheet::SheetFilterOperator::LESS :
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<"));
-- case sheet::FilterOperator_LESS_EQUAL :
-+ case sheet::SheetFilterOperator::LESS_EQUAL :
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<="));
-- case sheet::FilterOperator_NOT_EMPTY :
-+ case sheet::SheetFilterOperator::NOT_EMPTY :
- return GetXMLToken(XML_NOEMPTY);
-- case sheet::FilterOperator_TOP_PERCENT :
-+ case sheet::SheetFilterOperator::TOP_PERCENT :
- return GetXMLToken(XML_TOP_PERCENT);
-- case sheet::FilterOperator_TOP_VALUES :
-+ case sheet::SheetFilterOperator::TOP_VALUES :
- return GetXMLToken(XML_TOP_VALUES);
- default:
- {
-@@ -305,6 +326,166 @@
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
- }
-
-+void ScXMLExportDatabaseRanges::WriteFilterCondition(const ScSheetFilterFieldItem& aFieldItem, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions)
-+{
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FIELD_NUMBER,
-+ rtl::OUString::valueOf(aFieldItem.mpField->Field));
-+
-+ if (bIsCaseSensitive)
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TRUE);
-+
-+ switch (aFieldItem.mnType)
-+ {
-+ case sheet::SheetFilterFieldType::VALUE:
-+ {
-+ SheetFilterFieldValue* pField = aFieldItem.getFieldValue();
-+
-+ if (pField->IsNumeric)
-+ {
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_NUMBER);
-+ rtl::OUStringBuffer sBuffer;
-+ rExport.GetMM100UnitConverter().convertDouble(sBuffer, pField->NumericValue);
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, sBuffer.makeStringAndClear());
-+ }
-+ else
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, pField->StringValue);
-+
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OPERATOR,
-+ getOperatorXML(pField->Operator, bUseRegularExpressions));
-+
-+ SvXMLElementExport aElem(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, true, true);
-+ }
-+ break;
-+ case sheet::SheetFilterFieldType::MULTI_STRING:
-+ {
-+ SheetFilterFieldMultiString* pField = aFieldItem.getFieldMultiString();
-+ size_t nSize = pField->StringSet.getLength();
-+ OSL_ENSURE(nSize > 0, "ScXMLExportDatabaseRanges::WriteFilterCondition: no string set items");
-+
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TEXT);
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, pField->StringSet[0]);
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OPERATOR, CREATE_OUSTRING("="));
-+ SvXMLElementExport aElem(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, true, true);
-+
-+ for ( size_t i = 0; i < nSize; ++i )
-+ {
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, pField->StringSet[i]);
-+ SvXMLElementExport aElemItem(rExport, XML_NAMESPACE_TABLE, XML_FILTER_SET_ITEM, true, true);
-+ }
-+ }
-+ break;
-+ default:
-+ OSL_ENSURE(false, "ScXMLExportDatabaseRanges::WriteCondition: unknown field type");
-+ }
-+}
-+
-+void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <sheet::XSheetFilterFieldAccess>& xFilterAccess,
-+ const rtl::OUString sDatabaseRangeName)
-+{
-+ typedef shared_ptr<SvXMLElementExport> SvXMLElementExportRef;
-+
-+ if ( !xFilterAccess.is() )
-+ {
-+ OSL_ENSURE(false, "ScXMLExportDatabaseRanges::WriteFilterDescriptor: extended filter descriptor is null.");
-+ return;
-+ }
-+
-+ Sequence<Any> aFields;
-+ aFields = xFilterAccess->getFields();
-+ sal_Int32 nFieldCount = aFields.getLength();
-+ fprintf(stdout, "ScXMLExportDatabaseRanges::WriteFilterDescriptor: count = %ld\n", nFieldCount);fflush(stdout);
-+ if (nFieldCount == 0)
-+ return;
-+
-+ uno::Reference <beans::XPropertySet> xPropertySet (xFilterAccess, uno::UNO_QUERY);
-+ if ( !xPropertySet.is() )
-+ {
-+ OSL_ENSURE(false, "ScXMLExportDatabaseRanges::WriteFilterDescriptor: property set is empty");
-+ return;
-+ }
-+
-+ // Advanced filter settings.
-+ ScDBCollection* pDBCollection = pDoc->GetDBCollection();
-+ sal_uInt16 nIndex;
-+ pDBCollection->SearchName(sDatabaseRangeName, nIndex);
-+ ScDBData* pDBData = (*pDBCollection)[nIndex];
-+ ScRange aAdvSource;
-+ if (pDBData->GetAdvancedQuerySource(aAdvSource))
-+ {
-+ rtl::OUString sOUCellAddress;
-+ ScRangeStringConverter::GetStringFromRange( sOUCellAddress, aAdvSource, pDoc );
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, sOUCellAddress);
-+ }
-+
-+ // Skip duplicates.
-+ if ( ::cppu::any2bool(xPropertySet->getPropertyValue( CREATE_OUSTRING(SC_UNONAME_SKIPDUP) )) )
-+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_FALSE);
-+
-+ // Case sensitivity
-+ sal_Bool bIsCaseSensitive = ::cppu::any2bool(
-+ xPropertySet->getPropertyValue( CREATE_OUSTRING(SC_UNONAME_ISCASE) ) );
-+ // Regular expression
-+ sal_Bool bUseRegularExpressions = ::cppu::any2bool(
-+ xPropertySet->getPropertyValue( CREATE_OUSTRING(SC_UNONAME_USEREGEX) ) );
-+
-+ // This 'table:filter' element will be the root for this filter sub-tree.
-+ SvXMLElementExport aElemFilter(rExport, XML_NAMESPACE_TABLE, XML_FILTER, sal_True, sal_True);
-+
-+ // Keep track of the stack of AND/OR elements. The filter-condition
-+ // elements always come below one of AND/OR elements.
-+ ::std::vector<SvXMLElementExportRef> aElementStack;
-+ aElementStack.reserve(10);
-+
-+ bool bFirstItem = true;
-+ ScSheetFilterFieldItem aLastField;
-+ for (sal_Int32 i = 0; i < nFieldCount; ++i)
-+ {
-+ sal_Int16 nType = sheet::SheetFilterFieldType::NONE;
-+ Type eUnoType = aFields[i].getValueType();
-+ ScSheetFilterFieldItem::SheetFilterFieldRef pField;
-+ if (eUnoType == ScSheetFilterFieldItem::VALUE)
-+ {
-+ pField.reset(new SheetFilterFieldValue);
-+ SheetFilterFieldValue* p = static_cast<SheetFilterFieldValue*>(pField.get());
-+ aFields[i] >>= *p;
-+ nType = sheet::SheetFilterFieldType::VALUE;
-+ }
-+ else if (eUnoType == ScSheetFilterFieldItem::MULTI_STRING)
-+ {
-+ pField.reset(new SheetFilterFieldMultiString);
-+ SheetFilterFieldMultiString* p = static_cast<SheetFilterFieldMultiString*>(pField.get());
-+ aFields[i] >>= *p;
-+ nType = sheet::SheetFilterFieldType::MULTI_STRING;
-+ }
-+
-+ if (!bFirstItem)
-+ {
-+ XMLTokenEnum eToken = pField->Connection == sheet::FilterConnection_OR ? XML_FILTER_OR : XML_FILTER_AND;
-+ SvXMLElementExportRef pElem(new SvXMLElementExport(rExport, XML_NAMESPACE_TABLE, eToken, true, true));
-+ aElementStack.push_back(pElem);
-+
-+ OSL_ENSURE(aLastField.mpField.get(), "ScXMLExportDatabaseRanges::WriteFilterDescriptor: last field is empty!");
-+ WriteFilterCondition(aLastField, bIsCaseSensitive, bUseRegularExpressions);
-+ }
-+ else
-+ bFirstItem = false;
-+
-+ // Store this field for insertion in the next iteration.
-+ aLastField.mnType = nType;
-+ aLastField.mpField = pField;
-+ }
-+
-+ // Don't forget to add the last item!
-+ OSL_ENSURE(!bFirstItem, "ScXMLExportDatabaseRanges::WriteFilterDescriptor: first item!?");
-+ OSL_ENSURE(aLastField.mpField.get(), "ScXMLExportDatabaseRanges::WriteFilterDescriptor: last field is empty!");
-+ WriteFilterCondition(aLastField, bIsCaseSensitive, bUseRegularExpressions);
-+
-+ // Pop all elements before exiting...
-+ size_t nSize = aElementStack.size();
-+ for ( size_t i = 0; i < nSize; ++i )
-+ aElementStack.pop_back();
-+}
-+
- void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions)
- {
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, rtl::OUString::valueOf(aFilterField.Field));
-@@ -323,7 +504,9 @@
- SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, sal_True, sal_True);
- }
-
--void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName)
-+#if 0
-+void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor,
-+ const rtl::OUString sDatabaseRangeName)
- {
- uno::Sequence <sheet::TableFilterField> aTableFilterFields(xSheetFilterDescriptor->getFilterFields());
- sal_Int32 nTableFilterFields = aTableFilterFields.getLength();
-@@ -334,14 +517,18 @@
- {
- if (::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_COPYOUT)))))
- {
-+ // CopyOutputData
- table::CellAddress aOutputPosition;
- if (xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS))) >>= aOutputPosition)
- {
-+ // OutputPosition
- rtl::OUString sOUCellAddress;
- ScRangeStringConverter::GetStringFromAddress( sOUCellAddress, aOutputPosition, pDoc );
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, sOUCellAddress);
- }
- }
-+
-+ // Advanced filter settings.
- ScDBCollection* pDBCollection = pDoc->GetDBCollection();
- sal_uInt16 nIndex;
- pDBCollection->SearchName(sDatabaseRangeName, nIndex);
-@@ -354,8 +541,11 @@
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, sOUCellAddress);
- }
-
-+ // SkipDuplicates
- if (::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SKIPDUP)))))
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_FALSE);
-+
-+ // Add table:filter element as a child of the current element (table:database-range).
- SvXMLElementExport aElemF(rExport, XML_NAMESPACE_TABLE, XML_FILTER, sal_True, sal_True);
- rExport.CheckAttrList();
- sal_Bool bIsCaseSensitive = ::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ISCASE))));
-@@ -396,6 +586,8 @@
- sheet::FilterConnection aConnection = aTableFilterFields[1].Connection;
- sal_Bool bOpenAndElement;
- rtl::OUString aName = rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND));
-+ fprintf(stdout, "ScXMLExportDatabaseRanges::WriteFilterDescriptor: aName = %s\n",
-+ OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
- if (aConnection == sheet::FilterConnection_AND)
- {
- rExport.StartElement( aName, sal_True);
-@@ -450,6 +642,7 @@
- }
- }
- }
-+#endif
-
- void ScXMLExportDatabaseRanges::WriteSortDescriptor(const uno::Sequence <beans::PropertyValue> aSortProperties)
- {
-@@ -688,11 +881,16 @@
- if (::cppu::any2bool(xPropertySetDatabaseRange->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_STRIPDAT)))))
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_FALSE);
- }
-- uno::Reference <sheet::XSheetFilterDescriptor> xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor());
-+
-+ Reference<beans::XPropertySet> xPropSet(xDatabaseRange, uno::UNO_QUERY);
-+ Any any = xPropSet->getPropertyValue( CREATE_OUSTRING("SheetFilterFieldAccess") );
-+ Reference<sheet::XSheetFilterFieldAccess> xFilterAccess;
-+ any >>= xFilterAccess;
-+
- uno::Sequence <beans::PropertyValue> aSortProperties(xDatabaseRange->getSortDescriptor());
-- if (xSheetFilterDescriptor.is())
-+ if (xFilterAccess.is())
- {
-- uno::Reference <beans::XPropertySet> xFilterProperties (xSheetFilterDescriptor, uno::UNO_QUERY);
-+ uno::Reference <beans::XPropertySet> xFilterProperties (xFilterAccess, uno::UNO_QUERY);
- if (xFilterProperties.is())
- {
- if (!::cppu::any2bool(xFilterProperties->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CONTHDR)))))
-@@ -731,8 +929,10 @@
- SvXMLElementExport aElemDR(rExport, XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, sal_True, sal_True);
- rExport.CheckAttrList();
- WriteImportDescriptor(xDatabaseRange->getImportDescriptor());
-- if (xSheetFilterDescriptor.is())
-- WriteFilterDescriptor(xSheetFilterDescriptor, sDatabaseRangeName);
-+
-+ if (xFilterAccess.is())
-+ WriteFilterDescriptor(xFilterAccess, sDatabaseRangeName);
-+
- WriteSortDescriptor(aSortProperties);
- WriteSubTotalDescriptor(xDatabaseRange->getSubTotalDescriptor(), sDatabaseRangeName);
- }
-Index: sc/source/filter/xml/XMLExportDatabaseRanges.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/XMLExportDatabaseRanges.hxx,v
-retrieving revision 1.2
-retrieving revision 1.2.484.4
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.2 -r1.2.484.4
---- sc/source/filter/xml/XMLExportDatabaseRanges.hxx 8 Sep 2005 19:55:16 -0000 1.2
-+++ sc/source/filter/xml/XMLExportDatabaseRanges.hxx 15 Aug 2007 19:21:14 -0000 1.2.484.4
-@@ -58,9 +58,12 @@
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #endif
-
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.hpp>
-+
- class ScXMLExport;
- class ScDocument;
- class ScMyEmptyDatabaseRangesContainer;
-+struct ScSheetFilterFieldItem;
-
- class ScXMLExportDatabaseRanges
- {
-@@ -68,9 +71,11 @@
- ScDocument* pDoc;
-
- void WriteImportDescriptor(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aImportDescriptor);
-- rtl::OUString getOperatorXML(const com::sun::star::sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const;
-+ rtl::OUString getOperatorXML(const sal_Int16 nOperator, const sal_Bool bUseRegularExpressions) const;
-+ void WriteFilterCondition(const ScSheetFilterFieldItem& aFieldItem, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions);
-+ void WriteFilterDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSheetFilterFieldAccess>& xFilterAccess, const rtl::OUString sDatabaseRangeName);
- void WriteCondition(const com::sun::star::sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions);
-- void WriteFilterDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName);
-+// void WriteFilterDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName);
- void WriteSortDescriptor(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortProperties);
- void WriteSubTotalDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSubTotalDescriptor> xSubTotalDescriptor, const rtl::OUString sDatabaseRangeName);
- public:
-Index: sc/source/filter/xml/makefile.mk
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/makefile.mk,v
-retrieving revision 1.32
-retrieving revision 1.32.484.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.32 -r1.32.484.2
-Index: sc/source/filter/xml/xmldrani.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmldrani.cxx,v
-retrieving revision 1.30
-retrieving revision 1.30.74.4
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.30 -r1.30.74.4
---- sc/source/filter/xml/xmldrani.cxx 22 May 2007 20:03:45 -0000 1.30
-+++ sc/source/filter/xml/xmldrani.cxx 15 Aug 2007 05:05:07 -0000 1.30.74.4
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
--
-+#include <stdio.h>
-
- // INCLUDE ---------------------------------------------------------------
-
-@@ -44,6 +44,7 @@
- #include "xmlimprt.hxx"
- #include "xmlfilti.hxx"
- #include "xmlsorti.hxx"
-+#include "filterglobal.hxx"
- #include "document.hxx"
- #include "globstr.hrc"
- #include "docuno.hxx"
-@@ -83,6 +84,10 @@
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/sheet/XDatabaseRanges.hpp>
- #include <com/sun/star/sheet/XDatabaseRange.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldType.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldValue.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldMultiString.hpp>
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
- #ifndef _COMPHELPER_EXTRACT_HXX_
- #include <comphelper/extract.hxx>
-@@ -94,13 +99,22 @@
- #include <com/sun/star/xml/sax/XLocator.hpp>
- #endif
-
-+
-+
- #define SC_ENABLEUSERSORTLIST "EnableUserSortList"
- #define SC_USERSORTLISTINDEX "UserSortListIndex"
- #define SC_USERLIST "UserList"
-
-+#define CREATE_OUSTRING( ascii ) ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-+
- using namespace com::sun::star;
- using namespace xmloff::token;
-
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::Any;
-+using ::com::sun::star::uno::Sequence;
-+
- //------------------------------------------------------------------
-
- ScXMLDatabaseRangesContext::ScXMLDatabaseRangesContext( ScXMLImport& rImport,
-@@ -147,6 +161,70 @@
- {
- }
-
-+// ----------------------------------------------------------------------------
-+
-+void ScXMLDatabaseRangeContext::WriteTableFilterFields(
-+ const Reference<sheet::XSheetFilterFieldAccess>& xFilterAccess, ScDBData* pDBData)
-+{
-+ using uno::makeAny;
-+
-+ if ( !xFilterAccess.is() )
-+ return;
-+
-+ Reference<beans::XPropertySet> xPS(xFilterAccess, UNO_QUERY);
-+ if ( !xPS.is() )
-+ {
-+ OSL_ENSURE(false, "ScXMLDatabaseRangeContext::WriteTableFilterFields: property set is null");
-+ return;
-+ }
-+
-+ // Write properties first.
-+ sal_Bool bOrientation = (table::TableOrientation_COLUMNS == eOrientation);
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_ORIENT), makeAny(bOrientation));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_CONTHDR), makeAny(bContainsHeader));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_COPYOUT), makeAny(bFilterCopyOutputData));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_ISCASE), makeAny(bFilterIsCaseSensitive));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_SKIPDUP), makeAny(bFilterSkipDuplicates));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_USEREGEX), makeAny(bFilterUseRegularExpressions));
-+ xPS->setPropertyValue(CREATE_OUSTRING(SC_UNONAME_OUTPOS), makeAny(aFilterOutputPosition));
-+
-+ // Write fields.
-+ sal_Int32 nSize = aFilterFieldItems.size();
-+ Sequence<Any> aAnyFields(nSize);
-+ Any any;
-+ for (sal_Int32 i = 0; i < nSize; ++i)
-+ {
-+ switch (aFilterFieldItems[i].mnType)
-+ {
-+ case com::sun::star::sheet::SheetFilterFieldType::VALUE:
-+ {
-+ sheet::SheetFilterFieldValue* p = aFilterFieldItems[i].getFieldValue();
-+ any <<= *p;
-+ aAnyFields[i] = any;
-+ }
-+ break;
-+ case com::sun::star::sheet::SheetFilterFieldType::MULTI_STRING:
-+ {
-+ sheet::SheetFilterFieldMultiString* p = aFilterFieldItems[i].getFieldMultiString();
-+ any <<= *p;
-+ aAnyFields[i] = any;
-+ }
-+ break;
-+ case com::sun::star::sheet::SheetFilterFieldType::NONE:
-+ default:
-+ OSL_ENSURE(false, "ScXMLDatabaseRangeContext::WriteTableFilterFields: unknown or unhandled filter type");
-+ }
-+ }
-+ xFilterAccess->setFields(aAnyFields);
-+
-+ if (bFilterConditionSourceRange)
-+ {
-+ ScRange aAdvSource;
-+ ScUnoConversion::FillScRange( aAdvSource, aFilterConditionSourceRangeAddress );
-+ pDBData->SetAdvancedQuerySource(&aAdvSource);
-+ }
-+}
-+
- ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport,
- USHORT nPrfx,
- const ::rtl::OUString& rLName,
-@@ -411,6 +489,14 @@
-
- pDBData->SetSortParam(aSortParam);
- }
-+#if 1
-+ Reference<beans::XPropertySet> xPropSet(xDatabaseRange, uno::UNO_QUERY);
-+ Any any = xPropSet->getPropertyValue( CREATE_OUSTRING("SheetFilterFieldAccess") );
-+ Reference<sheet::XSheetFilterFieldAccess> xFilterAccess;
-+ any >>= xFilterAccess;
-+
-+ WriteTableFilterFields(xFilterAccess, pDBData);
-+#else
- uno::Reference <sheet::XSheetFilterDescriptor> xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor());
- if (xSheetFilterDescriptor.is())
- {
-@@ -434,6 +520,7 @@
- pDBData->SetAdvancedQuerySource(&aAdvSource);
- }
- }
-+#endif
- if (bContainsSubTotal)
- {
- uno::Reference <sheet::XSubTotalDescriptor> xSubTotalDescriptor(xDatabaseRange->getSubTotalDescriptor());
-@@ -476,6 +563,11 @@
- }
- }
-
-+void ScXMLDatabaseRangeContext::AddFilterField(const ScSheetFilterFieldItem& aItem)
-+{
-+ aFilterFieldItems.push_back(aItem);
-+}
-+
- ScXMLSourceSQLContext::ScXMLSourceSQLContext( ScXMLImport& rImport,
- USHORT nPrfx,
- const ::rtl::OUString& rLName,
-Index: sc/source/filter/xml/xmldrani.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmldrani.hxx,v
-retrieving revision 1.11
-retrieving revision 1.11.484.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.11 -r1.11.484.2
---- sc/source/filter/xml/xmldrani.hxx 8 Sep 2005 20:07:09 -0000 1.11
-+++ sc/source/filter/xml/xmldrani.hxx 13 Aug 2007 23:48:20 -0000 1.11.484.2
-@@ -66,7 +66,19 @@
- #include <com/sun/star/table/TableOrientation.hpp>
- #endif
-
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.hpp>
-+
-+#include <vector>
-+
-+class ScDBData;
- class ScXMLImport;
-+struct ScSheetFilterFieldItem;
-+
-+namespace com { namespace sun { namespace star { namespace sheet {
-+ struct SheetFilterFieldValue;
-+ struct SheetFilterFieldMultiString;
-+ class XSheetFilterDescriptor;
-+}}}}
-
- class ScXMLDatabaseRangesContext : public SvXMLImportContext
- {
-@@ -104,7 +116,7 @@
- rtl::OUString sDatabaseName;
- rtl::OUString sSourceObject;
- com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
-- com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField> aFilterFields;
-+ ::std::vector<ScSheetFilterFieldItem> aFilterFieldItems;
- std::vector < ScSubTotalRule > aSubTotalRules;
- com::sun::star::table::CellAddress aFilterOutputPosition;
- com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
-@@ -137,6 +149,10 @@
- const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
- ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
-
-+ void WriteTableFilterFields(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterFieldAccess >& xFilterAccess,
-+ ScDBData* pDBData);
-+
- public:
-
- ScXMLDatabaseRangeContext( ScXMLImport& rImport, USHORT nPrfx,
-@@ -171,10 +187,11 @@
- void SetFilterIsCaseSensitive(const sal_Bool bTemp) { bFilterIsCaseSensitive = bTemp; }
- void SetFilterSkipDuplicates(const sal_Bool bTemp) { bFilterSkipDuplicates = bTemp; }
- void SetFilterUseRegularExpressions(const sal_Bool bTemp) { bFilterUseRegularExpressions = bTemp; }
-- void SetFilterFields(const com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField>& aTemp) { aFilterFields = aTemp; }
- void SetFilterOutputPosition(const com::sun::star::table::CellAddress& aTemp) { aFilterOutputPosition = aTemp; }
- void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
- bFilterConditionSourceRange = sal_True; }
-+
-+ void AddFilterField(const ScSheetFilterFieldItem& aItem);
- };
-
- class ScXMLSourceSQLContext : public SvXMLImportContext
-Index: sc/source/filter/xml/xmlfilti.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmlfilti.cxx,v
-retrieving revision 1.16
-retrieving revision 1.16.74.3
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.16 -r1.16.74.3
---- sc/source/filter/xml/xmlfilti.cxx 22 May 2007 20:04:07 -0000 1.16
-+++ sc/source/filter/xml/xmlfilti.cxx 14 Aug 2007 22:10:11 -0000 1.16.74.3
-@@ -36,11 +36,13 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
-+#include <stdio.h>
-
- // INCLUDE ---------------------------------------------------------------
-
- #include "xmlfilti.hxx"
- #include "xmlimprt.hxx"
-+#include "filterglobal.hxx"
- #include "docuno.hxx"
-
- #ifndef SC_CONVUNO_HXX
-@@ -59,6 +61,12 @@
- #include <xmloff/xmltoken.hxx>
- #endif
-
-+#include <com/sun/star/sheet/SheetFilterFieldValue.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldMultiString.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldType.hpp>
-+#include <com/sun/star/sheet/SheetFilterConnection.hpp>
-+#include <com/sun/star/sheet/SheetFilterOperator.hpp>
-+
- using namespace com::sun::star;
- using namespace xmloff::token;
-
-@@ -72,7 +80,6 @@
- ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
- SvXMLImportContext( rImport, nPrfx, rLName ),
- pDatabaseRangeContext(pTempDatabaseRangeContext),
-- aFilterFields(),
- bSkipDuplicates(sal_False),
- bCopyOutputData(sal_False),
- bUseRegularExpressions(sal_False),
-@@ -178,11 +185,17 @@
- pDatabaseRangeContext->SetFilterCopyOutputData(sal_False);
- pDatabaseRangeContext->SetFilterIsCaseSensitive(bIsCaseSensitive);
- pDatabaseRangeContext->SetFilterSkipDuplicates(bSkipDuplicates);
-- pDatabaseRangeContext->SetFilterFields(aFilterFields);
- if (bConditionSourceRange)
- pDatabaseRangeContext->SetFilterConditionSourceRangeAddress(aConditionSourceRangeAddress);
- }
-
-+void ScXMLFilterContext::AddFilterField(const ScSheetFilterFieldItem& aItem) const
-+{
-+ pDatabaseRangeContext->AddFilterField(aItem);
-+}
-+
-+// ----------------------------------------------------------------------------
-+
- ScXMLAndContext::ScXMLAndContext( ScXMLImport& rImport,
- USHORT nPrfx,
- const ::rtl::OUString& rLName,
-@@ -292,6 +305,7 @@
- ScXMLFilterContext* pTempFilterContext) :
- SvXMLImportContext( rImport, nPrfx, rLName ),
- pFilterContext(pTempFilterContext),
-+ nFieldType(sheet::SheetFilterFieldType::VALUE),
- bIsCaseSensitive(sal_False)
- {
- sDataType = GetXMLToken(XML_TEXT);
-@@ -325,7 +339,7 @@
- break;
- case XML_TOK_CONDITION_ATTR_VALUE :
- {
-- sConditionValue = sValue;
-+ aConditionValues.push_back(sValue);
- }
- break;
- case XML_TOK_CONDITION_ATTR_OPERATOR :
-@@ -341,79 +355,169 @@
- {
- }
-
--SvXMLImportContext *ScXMLConditionContext::CreateChildContext( USHORT nPrefix,
-- const ::rtl::OUString& rLName,
-- const ::com::sun::star::uno::Reference<
-- ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
-+SvXMLImportContext *ScXMLConditionContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLName,
-+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
- {
-+ const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-+ if ( rTokenMap.Get(nPrefix,rLName) == XML_TOK_FILTER_SET_ITEM )
-+ {
-+ // By virtue of presence of filter-set-item child context(s), declare this
-+ // filter condition as multi-string type.
-+ if ( nFieldType != sheet::SheetFilterFieldType::MULTI_STRING )
-+ {
-+ nFieldType = sheet::SheetFilterFieldType::MULTI_STRING;
-+ aConditionValues.clear();
-+ }
-+ return new ScXMLSetItemContext( GetScImport(), nPrefix, rLName, xAttrList, this );
-+ }
-+
- return new SvXMLImportContext( GetImport(), nPrefix, rLName );
- }
-
--void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const
-+void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, sal_Int16& rnFilterOperator, sal_Bool& bUseRegularExpressions) const
- {
- bUseRegularExpressions = sal_False;
- if (IsXMLToken(sTempOperator, XML_MATCH))
- {
- bUseRegularExpressions = sal_True;
-- aFilterOperator = sheet::FilterOperator_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::EQUAL;
- }
- else if (IsXMLToken(sTempOperator, XML_NOMATCH))
- {
- bUseRegularExpressions = sal_True;
-- aFilterOperator = sheet::FilterOperator_NOT_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::NOT_EQUAL;
- }
- else if (sTempOperator.compareToAscii("=") == 0)
-- aFilterOperator = sheet::FilterOperator_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::EQUAL;
- else if (sTempOperator.compareToAscii("!=") == 0)
-- aFilterOperator = sheet::FilterOperator_NOT_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::NOT_EQUAL;
- else if (IsXMLToken(sTempOperator, XML_BOTTOM_PERCENT))
-- aFilterOperator = sheet::FilterOperator_BOTTOM_PERCENT;
-+ rnFilterOperator = sheet::SheetFilterOperator::BOTTOM_PERCENT;
- else if (IsXMLToken(sTempOperator, XML_BOTTOM_VALUES))
-- aFilterOperator = sheet::FilterOperator_BOTTOM_VALUES;
-+ rnFilterOperator = sheet::SheetFilterOperator::BOTTOM_VALUES;
- else if (IsXMLToken(sTempOperator, XML_EMPTY))
-- aFilterOperator = sheet::FilterOperator_EMPTY;
-+ rnFilterOperator = sheet::SheetFilterOperator::EMPTY;
- else if (sTempOperator.compareToAscii(">") == 0)
-- aFilterOperator = sheet::FilterOperator_GREATER;
-+ rnFilterOperator = sheet::SheetFilterOperator::GREATER;
- else if (sTempOperator.compareToAscii(">=") == 0)
-- aFilterOperator = sheet::FilterOperator_GREATER_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::GREATER_EQUAL;
- else if (sTempOperator.compareToAscii("<") == 0)
-- aFilterOperator = sheet::FilterOperator_LESS;
-+ rnFilterOperator = sheet::SheetFilterOperator::LESS;
- else if (sTempOperator.compareToAscii("<=") == 0)
-- aFilterOperator = sheet::FilterOperator_LESS_EQUAL;
-+ rnFilterOperator = sheet::SheetFilterOperator::LESS_EQUAL;
- else if (IsXMLToken(sTempOperator, XML_NOEMPTY))
-- aFilterOperator = sheet::FilterOperator_NOT_EMPTY;
-+ rnFilterOperator = sheet::SheetFilterOperator::NOT_EMPTY;
- else if (IsXMLToken(sTempOperator, XML_TOP_PERCENT))
-- aFilterOperator = sheet::FilterOperator_TOP_PERCENT;
-+ rnFilterOperator = sheet::SheetFilterOperator::TOP_PERCENT;
- else if (IsXMLToken(sTempOperator, XML_TOP_VALUES))
-- aFilterOperator = sheet::FilterOperator_TOP_VALUES;
-+ rnFilterOperator = sheet::SheetFilterOperator::TOP_VALUES;
- }
-
- void ScXMLConditionContext::EndElement()
- {
-- sheet::TableFilterField aFilterField;
-- if (pFilterContext->GetConnection())
-- aFilterField.Connection = sheet::FilterConnection_OR;
-- else
-- aFilterField.Connection = sheet::FilterConnection_AND;
- pFilterContext->SetIsCaseSensitive(bIsCaseSensitive);
-+
-+ ScSheetFilterFieldItem aItem;
-+ aItem.mnType = nFieldType;
-+
-+ switch ( nFieldType )
-+ {
-+ case sheet::SheetFilterFieldType::VALUE:
-+ {
-+ if ( aConditionValues.empty() )
-+ return;
-+
-+ aItem.mpField.reset(new sheet::SheetFilterFieldValue);
-+ sheet::SheetFilterFieldValue* pField = aItem.getFieldValue();
-+
- sal_Bool bUseRegularExpressions;
-- getOperatorXML(sOperator, aFilterField.Operator, bUseRegularExpressions);
-+ getOperatorXML(sOperator, pField->Operator, bUseRegularExpressions);
- pFilterContext->SetUseRegularExpressions(bUseRegularExpressions);
-- aFilterField.Field = nField;
- if (IsXMLToken(sDataType, XML_NUMBER))
- {
-- aFilterField.NumericValue = sConditionValue.toDouble();
-- aFilterField.IsNumeric = sal_True;
-+ pField->NumericValue = aConditionValues[0].toDouble();
-+ pField->IsNumeric = sal_True;
- }
- else
- {
-- aFilterField.StringValue = sConditionValue;
-- aFilterField.IsNumeric = sal_False;
-+ pField->StringValue = aConditionValues[0];
-+ pField->IsNumeric = sal_False;
- }
-- pFilterContext->AddFilterField(aFilterField);
-+ }
-+ break;
-+ case sheet::SheetFilterFieldType::MULTI_STRING:
-+ {
-+ aItem.mpField.reset(new sheet::SheetFilterFieldMultiString);
-+ sheet::SheetFilterFieldMultiString* pField = aItem.getFieldMultiString();
-+
-+ size_t nSize = aConditionValues.size();
-+ uno::Sequence<rtl::OUString> aStrings(nSize);
-+ for ( size_t i = 0; i < nSize; ++i )
-+ aStrings[i] = aConditionValues[i];
-+ pField->StringSet = aStrings;
-+ }
-+ break;
-+ case sheet::SheetFilterFieldType::NONE:
-+ default:
-+ OSL_ENSURE(false, "ScXMLConditionContext::EndElement: unknown type");
-+ return;
-+ }
-+
-+ // Common fields.
-+ aItem.mpField->Connection = pFilterContext->GetConnection() ?
-+ sheet::SheetFilterConnection::OR : sheet::SheetFilterConnection::AND;
-+ aItem.mpField->Field = nField;
-+
-+ pFilterContext->AddFilterField(aItem);
-+}
-+
-+void ScXMLConditionContext::AddConditionValue(const rtl::OUString& sValue)
-+{
-+ aConditionValues.push_back(sValue);
-+}
-+
-+// ----------------------------------------------------------------------------
-+
-+ScXMLSetItemContext::ScXMLSetItemContext( ScXMLImport& rImport, USHORT nPrfx, const ::rtl::OUString& rLName,
-+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
-+ ScXMLConditionContext* pParentContext ) :
-+ SvXMLImportContext( rImport, nPrfx, rLName ),
-+ pConditionContext(pParentContext)
-+{
-+ sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-+ const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetFilterConditionAttrTokenMap());
-+ const SvXMLNamespaceMap& rNSMap = GetScImport().GetNamespaceMap();
-+
-+ for ( sal_Int16 i = 0; i < nAttrCount; ++i )
-+ {
-+ const rtl::OUString& sAttrName(xAttrList->getNameByIndex(i));
-+ rtl::OUString aKey;
-+ USHORT nPrefix = rNSMap.GetKeyByAttrName(sAttrName, &aKey);
-+
-+ if ( rAttrTokenMap.Get(nPrefix, aKey) == XML_TOK_CONDITION_ATTR_VALUE )
-+ {
-+ sConditionValue = xAttrList->getValueByIndex(i);
-+ }
-+ }
-+}
-+
-+ScXMLSetItemContext::~ScXMLSetItemContext()
-+{
-+}
-+
-+SvXMLImportContext* ScXMLSetItemContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLName,
-+ const uno::Reference<xml::sax::XAttributeList>& /*xAttrList*/ )
-+{
-+ // There should not be any child context.
-+ return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-+}
-+
-+void ScXMLSetItemContext::EndElement()
-+{
-+ pConditionContext->AddConditionValue(sConditionValue);
- }
-
--//==========================================================================
-+//=============================================================================
-
- ScXMLDPFilterContext::ScXMLDPFilterContext( ScXMLImport& rImport,
- USHORT nPrfx,
-Index: sc/source/filter/xml/xmlfilti.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmlfilti.hxx,v
-retrieving revision 1.6
-retrieving revision 1.6.484.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.6 -r1.6.484.2
---- sc/source/filter/xml/xmlfilti.hxx 8 Sep 2005 20:08:27 -0000 1.6
-+++ sc/source/filter/xml/xmlfilti.hxx 13 Aug 2007 23:48:20 -0000 1.6.484.2
-@@ -52,6 +52,7 @@
- #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD_HPP_
- #include <com/sun/star/sheet/TableFilterField.hpp>
- #endif
-+
- #ifndef _STACK_HXX
- #include <tools/stack.hxx>
- #endif
-@@ -59,13 +60,17 @@
- #include "xmldrani.hxx"
- #include "xmldpimp.hxx"
-
-+namespace com { namespace sun { namespace star { namespace sheet {
-+ struct SheetFilterField;
-+}}}}
-+
-+class ScSheetFilterFieldItem;
- class ScXMLImport;
-
- class ScXMLFilterContext : public SvXMLImportContext
- {
- ScXMLDatabaseRangeContext* pDatabaseRangeContext;
-
-- com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField> aFilterFields;
- com::sun::star::table::CellAddress aOutputPosition;
- com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress;
- sal_Int16 nUserListIndex;
-@@ -106,10 +111,12 @@
- aConnectionOrStack.Push(pTemp);}
- void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;}
- sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
-- void AddFilterField (const com::sun::star::sheet::TableFilterField aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1);
-- aFilterFields[aFilterFields.getLength() - 1] = aFilterField; }
-+
-+ void AddFilterField(const ScSheetFilterFieldItem& aItem) const;
- };
-
-+// ----------------------------------------------------------------------------
-+
- class ScXMLAndContext : public SvXMLImportContext
- {
- ScXMLFilterContext* pFilterContext;
-@@ -164,9 +171,10 @@
- {
- ScXMLFilterContext* pFilterContext;
-
-+ ::std::vector<rtl::OUString> aConditionValues;
- rtl::OUString sDataType;
-- rtl::OUString sConditionValue;
- rtl::OUString sOperator;
-+ sal_Int16 nFieldType;
- sal_Int32 nField;
- sal_Bool bIsCaseSensitive;
-
-@@ -188,7 +196,33 @@
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-
-- void getOperatorXML(const rtl::OUString sTempOperator, com::sun::star::sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const;
-+ void getOperatorXML(const rtl::OUString sTempOperator, sal_Int16& rnFilterOperator, sal_Bool& bUseRegularExpressions) const;
-+ virtual void EndElement();
-+
-+ void AddConditionValue(const rtl::OUString& sValue);
-+};
-+
-+class ScXMLSetItemContext : public SvXMLImportContext
-+{
-+ ScXMLConditionContext* pConditionContext;
-+ ::rtl::OUString sConditionValue;
-+
-+ const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
-+ ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
-+
-+public:
-+
-+ ScXMLSetItemContext( ScXMLImport& rImport, USHORT nPrfx, const ::rtl::OUString& rLName,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
-+ ScXMLConditionContext* pParentContext );
-+
-+ virtual ~ScXMLSetItemContext();
-+
-+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
-+ const ::rtl::OUString& rLocalName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-+
- virtual void EndElement();
- };
-
-Index: sc/source/filter/xml/xmlimprt.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmlimprt.cxx,v
-retrieving revision 1.127
-retrieving revision 1.127.12.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.127 -r1.127.12.1
---- sc/source/filter/xml/xmlimprt.cxx 6 Jul 2007 12:40:45 -0000 1.127
-+++ sc/source/filter/xml/xmlimprt.cxx 25 Jul 2007 03:40:45 -0000 1.127.12.1
-@@ -643,6 +643,7 @@
- { XML_NAMESPACE_TABLE, XML_FILTER_AND, XML_TOK_FILTER_AND },
- { XML_NAMESPACE_TABLE, XML_FILTER_OR, XML_TOK_FILTER_OR },
- { XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, XML_TOK_FILTER_CONDITION },
-+ { XML_NAMESPACE_TABLE, XML_FILTER_SET_ITEM, XML_TOK_FILTER_SET_ITEM },
- XML_TOKEN_MAP_END
- };
-
-Index: sc/source/filter/xml/xmlimprt.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/xml/xmlimprt.hxx,v
-retrieving revision 1.92
-retrieving revision 1.92.346.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.92 -r1.92.346.1
---- sc/source/filter/xml/xmlimprt.hxx 20 Apr 2006 13:26:00 -0000 1.92
-+++ sc/source/filter/xml/xmlimprt.hxx 25 Jul 2007 03:40:46 -0000 1.92.346.1
-@@ -423,7 +423,8 @@
- {
- XML_TOK_FILTER_AND,
- XML_TOK_FILTER_OR,
-- XML_TOK_FILTER_CONDITION
-+ XML_TOK_FILTER_CONDITION,
-+ XML_TOK_FILTER_SET_ITEM
- };
-
- enum ScXMLFilterAttrTokens
-Index: sc/source/ui/dbgui/filtdlg.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/dbgui/filtdlg.cxx,v
-retrieving revision 1.14
-retrieving revision 1.14.114.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.14 -r1.14.114.1
---- sc/source/ui/dbgui/filtdlg.cxx 27 Feb 2007 13:03:15 -0000 1.14
-+++ sc/source/ui/dbgui/filtdlg.cxx 25 Jul 2007 03:40:46 -0000 1.14.114.1
-@@ -586,6 +586,10 @@
- rEntry.nField = nField ? (theQueryData.nCol1 +
- static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
- rEntry.eOp = eOp;
-+
-+ // Disable multi-string matching until we have the UI implemented.
-+ // TODO: Implement it in the UI (kohei).
-+ rEntry.aStrValues.clear();
- }
- }
-
-Index: sc/source/ui/unoobj/datauno.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/unoobj/datauno.cxx,v
-retrieving revision 1.28
-retrieving revision 1.28.104.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.28 -r1.28.104.2
---- sc/source/ui/unoobj/datauno.cxx 5 Mar 2007 14:45:54 -0000 1.28
-+++ sc/source/ui/unoobj/datauno.cxx 13 Aug 2007 23:48:20 -0000 1.28.104.2
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
--
-+#include <stdio.h>
-
- #include <tools/debug.hxx>
- #include <svtools/smplhint.hxx>
-@@ -52,6 +52,7 @@
- #include <com/sun/star/sheet/DataImportMode.hpp>
-
- #include "datauno.hxx"
-+#include "sheetfilterfieldaccess.hxx"
- #include "dapiuno.hxx"
- #include "cellsuno.hxx"
- #include "miscuno.hxx"
-@@ -80,6 +81,8 @@
- #include <svx/dataaccessdescriptor.hxx>
- #endif
-
-+#include "sheetfilterfieldaccess.hxx"
-+
- using namespace com::sun::star;
-
- SV_IMPL_PTRARR( XDBRefreshListenerArr_Impl, XDBRefreshListenerPtr );
-@@ -2054,6 +2057,10 @@
- else if (aString.EqualsAscii( SC_UNONAME_CONRES ))
- {
- }
-+ else if (aString.EqualsAscii("SheetFilterFieldAccess"))
-+ {
-+ aRet <<= uno::Reference<sheet::XSheetFilterFieldAccess>( new ScSheetFilterFieldAccess(pDocShell, this) );
-+ }
- }
- return aRet;
- }
-Index: sc/source/ui/unoobj/extfilterdescriptor.cxx
-===================================================================
-RCS file: sc/source/ui/unoobj/extfilterdescriptor.cxx
-diff -N sc/source/ui/unoobj/extfilterdescriptor.cxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/source/ui/unoobj/extfilterdescriptor.cxx 25 Jul 2007 03:42:07 -0000 1.1.2.1
-@@ -0,0 +1,303 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: extfilterdescriptor.cxx,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/07/25 03:42:07 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#include "extfilterdescriptor.hxx"
-+
-+#include <com/sun/star/sheet/TableFilterFieldNormal.hpp>
-+#include <com/sun/star/sheet/TableFilterFieldMultiString.hpp>
-+#include <com/sun/star/sheet/FilterConnection.hpp>
-+#include <com/sun/star/sheet/FilterOperator.hpp>
-+
-+#include "document.hxx"
-+#include "datauno.hxx"
-+
-+#include <stdio.h>
-+
-+using namespace ::com::sun::star;
-+
-+ScExtendedFilterDescriptor::ScExtendedFilterDescriptor(ScFilterDescriptorBase* pParent, ScDocument& rDoc) :
-+ mpParent(pParent),
-+ mrDoc(rDoc)
-+{
-+}
-+
-+ScExtendedFilterDescriptor::~ScExtendedFilterDescriptor() throw()
-+{
-+}
-+
-+void lclTranslateOperator(ScQueryEntry& rEntry, const sheet::FilterOperator eOp)
-+{
-+ using namespace ::com::sun::star::sheet;
-+
-+ switch ( eOp )
-+ {
-+ case FilterOperator_EMPTY:
-+ rEntry.eOp = SC_EQUAL;
-+ rEntry.nVal = SC_EMPTYFIELDS;
-+ rEntry.bQueryByString = false;
-+ *rEntry.pStr = EMPTY_STRING;
-+ break;
-+ case FilterOperator_NOT_EMPTY:
-+ rEntry.eOp = SC_EQUAL;
-+ rEntry.nVal = SC_NONEMPTYFIELDS;
-+ rEntry.bQueryByString = FALSE;
-+ *rEntry.pStr = EMPTY_STRING;
-+ break;
-+ case FilterOperator_EQUAL:
-+ rEntry.eOp = SC_EQUAL;
-+ break;
-+ case FilterOperator_NOT_EQUAL:
-+ rEntry.eOp = SC_NOT_EQUAL;
-+ break;
-+ case FilterOperator_GREATER:
-+ rEntry.eOp = SC_GREATER;
-+ break;
-+ case FilterOperator_GREATER_EQUAL:
-+ rEntry.eOp = SC_GREATER_EQUAL;
-+ break;
-+ case FilterOperator_LESS:
-+ rEntry.eOp = SC_LESS;
-+ break;
-+ case FilterOperator_LESS_EQUAL:
-+ rEntry.eOp = SC_LESS_EQUAL;
-+ break;
-+ case FilterOperator_TOP_VALUES:
-+ rEntry.eOp = SC_TOPVAL;
-+ break;
-+ case FilterOperator_TOP_PERCENT:
-+ rEntry.eOp = SC_TOPPERC;
-+ break;
-+ case FilterOperator_BOTTOM_VALUES:
-+ rEntry.eOp = SC_BOTVAL;
-+ break;
-+ case FilterOperator_BOTTOM_PERCENT:
-+ rEntry.eOp = SC_BOTPERC;
-+ break;
-+ default:
-+ DBG_ERROR("lclTranslateOperator: unexpected enum value");
-+ rEntry.eOp = SC_EQUAL;
-+ }
-+}
-+
-+void ScExtendedFilterDescriptor::addFieldNormal( const sheet::TableFilterFieldNormal& aField )
-+{
-+ ScQueryEntry aEntry;
-+ aEntry.pStr = new String;
-+ aEntry.bDoQuery = true;
-+ aEntry.eConnect = (aField.Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
-+ aEntry.nField = aField.Field;
-+ aEntry.bQueryByString = !aField.IsNumeric;
-+ *aEntry.pStr = String( aField.StringValue );
-+ aEntry.nVal = aField.NumericValue;
-+
-+ if ( !aEntry.bQueryByString )
-+ mrDoc.GetFormatTable()->GetInputLineString(aEntry.nVal, 0, *aEntry.pStr);
-+
-+ lclTranslateOperator(aEntry, aField.Operator);
-+
-+ maParamList.push_back(aEntry);
-+}
-+
-+void ScExtendedFilterDescriptor::addFieldMultiString( const sheet::TableFilterFieldMultiString& aField )
-+{
-+ sal_Int32 nSize = aField.StringSet.getLength();
-+
-+ if ( !nSize )
-+ return;
-+
-+ ScQueryEntry aEntry;
-+ aEntry.pStr = new String;
-+ aEntry.bDoQuery = true;
-+ aEntry.eConnect = (aField.Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
-+ aEntry.nField = aField.Field;
-+ aEntry.bQueryByString = true;
-+ *aEntry.pStr = String( aField.StringSet[0] );
-+ aEntry.nVal = 0;
-+ aEntry.eOp = SC_EQUAL;
-+
-+ for ( sal_Int32 i = 0; i < nSize; ++i )
-+ aEntry.aStrValues.insert( aField.StringSet[i] );
-+
-+ maParamList.push_back(aEntry);
-+}
-+
-+void ScExtendedFilterDescriptor::commit()
-+{
-+ ScQueryParam aParam;
-+ mpParent->GetData(aParam);
-+ size_t nSize = maParamList.size();
-+ aParam.Resize(nSize);
-+ ::std::list<ScQueryEntry>::const_iterator itr = maParamList.begin(), itrEnd = maParamList.end();
-+ for ( size_t i = 0; i < MAXQUERY; ++i, ++itr )
-+ {
-+ if ( itr == itrEnd )
-+ break;
-+ aParam.GetEntry(i) = *itr;
-+ }
-+
-+ SCSIZE nParamCount = aParam.GetEntryCount();
-+ for ( size_t i = nSize; i < nParamCount; ++i )
-+ aParam.GetEntry(i).bDoQuery = false;
-+
-+ mpParent->PutData(aParam);
-+}
-+
-+//=============================================================================
-+
-+ScExtendedFilterIterator::ScExtendedFilterIterator(ScFilterDescriptorBase* pParent, ScDocument& rDoc) :
-+ mpParent(pParent),
-+ mrDoc(rDoc)
-+{
-+}
-+
-+ScExtendedFilterIterator::~ScExtendedFilterIterator() throw()
-+{
-+}
-+
-+sheet::TableFilterFieldType lclGetFilterType(const ScQueryEntry& rEntry)
-+{
-+ if ( rEntry.aStrValues.empty() )
-+ // normal filter type
-+ return sheet::TableFilterFieldType_NORMAL;
-+ else
-+ return sheet::TableFilterFieldType_MULTI_STRING;
-+}
-+
-+sheet::TableFilterFieldType ScExtendedFilterIterator::getFirstType()
-+{
-+ mpParent->GetData(mrParam);
-+ mnPos = 0;
-+ const ScQueryEntry& rEntry = mrParam.GetEntry(mnPos);
-+ if ( !rEntry.bDoQuery )
-+ return sheet::TableFilterFieldType_NONE;
-+
-+ return lclGetFilterType(rEntry);
-+}
-+
-+sheet::TableFilterFieldType ScExtendedFilterIterator::getNextType()
-+{
-+ if ( ++mnPos >= MAXQUERY )
-+ {
-+ mnPos = MAXQUERY;
-+ return sheet::TableFilterFieldType_NONE;
-+ }
-+
-+ const ScQueryEntry& rEntry = mrParam.GetEntry(mnPos);
-+ if ( !rEntry.bDoQuery )
-+ return sheet::TableFilterFieldType_NONE;
-+
-+ return lclGetFilterType(rEntry);
-+}
-+
-+bool ScExtendedFilterIterator::getFieldNormal( sheet::TableFilterFieldNormal& rField )
-+{
-+ const ScQueryEntry& rEntry = mrParam.GetEntry(mnPos);
-+ if ( !rEntry.bDoQuery )
-+ return false;
-+
-+ if ( !rEntry.aStrValues.empty() )
-+ return false;
-+
-+ rtl::OUString aStringValue;
-+ if (rEntry.pStr)
-+ aStringValue = *rEntry.pStr;
-+
-+ rField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND :
-+ sheet::FilterConnection_OR;
-+ rField.Field = rEntry.nField;
-+ rField.IsNumeric = !rEntry.bQueryByString;
-+ rField.StringValue = aStringValue;
-+ rField.NumericValue = rEntry.nVal;
-+
-+ switch (rEntry.eOp) // ScQueryOp
-+ {
-+ case SC_EQUAL:
-+ {
-+ rField.Operator = sheet::FilterOperator_EQUAL;
-+ if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
-+ {
-+ if (rEntry.nVal == SC_EMPTYFIELDS)
-+ {
-+ rField.Operator = sheet::FilterOperator_EMPTY;
-+ rField.NumericValue = 0;
-+ }
-+ else if (rEntry.nVal == SC_NONEMPTYFIELDS)
-+ {
-+ rField.Operator = sheet::FilterOperator_NOT_EMPTY;
-+ rField.NumericValue = 0;
-+ }
-+ }
-+ }
-+ break;
-+ case SC_LESS: rField.Operator = sheet::FilterOperator_LESS; break;
-+ case SC_GREATER: rField.Operator = sheet::FilterOperator_GREATER; break;
-+ case SC_LESS_EQUAL: rField.Operator = sheet::FilterOperator_LESS_EQUAL; break;
-+ case SC_GREATER_EQUAL: rField.Operator = sheet::FilterOperator_GREATER_EQUAL; break;
-+ case SC_NOT_EQUAL: rField.Operator = sheet::FilterOperator_NOT_EQUAL; break;
-+ case SC_TOPVAL: rField.Operator = sheet::FilterOperator_TOP_VALUES; break;
-+ case SC_BOTVAL: rField.Operator = sheet::FilterOperator_BOTTOM_VALUES; break;
-+ case SC_TOPPERC: rField.Operator = sheet::FilterOperator_TOP_PERCENT; break;
-+ case SC_BOTPERC: rField.Operator = sheet::FilterOperator_BOTTOM_PERCENT; break;
-+ default:
-+ DBG_ERROR("Falscher Filter-enum");
-+ rField.Operator = sheet::FilterOperator_EMPTY;
-+ }
-+ return true;
-+}
-+
-+bool ScExtendedFilterIterator::getFieldMultiString( sheet::TableFilterFieldMultiString& rField )
-+{
-+ const ScQueryEntry& rEntry = mrParam.GetEntry(mnPos);
-+ if ( !rEntry.bDoQuery )
-+ return false;
-+
-+ if ( rEntry.aStrValues.empty() )
-+ return false;
-+
-+ rField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND :
-+ sheet::FilterConnection_OR;
-+ rField.Field = rEntry.nField;
-+
-+ size_t nSize = rEntry.aStrValues.size();
-+ uno::Sequence<rtl::OUString> aList(nSize);
-+ ScHashOUStringSet::const_iterator itr = rEntry.aStrValues.begin(),
-+ itrEnd = rEntry.aStrValues.end();
-+
-+ for ( size_t i = 0; itr != itrEnd; ++itr, ++i )
-+ aList[i] = *itr;
-+ rField.StringSet = aList;
-+
-+ return true;
-+}
-Index: sc/source/ui/unoobj/extfilterdescriptor.hxx
-===================================================================
-RCS file: sc/source/ui/unoobj/extfilterdescriptor.hxx
-diff -N sc/source/ui/unoobj/extfilterdescriptor.hxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/source/ui/unoobj/extfilterdescriptor.hxx 25 Jul 2007 03:42:07 -0000 1.1.2.1
-@@ -0,0 +1,89 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: extfilterdescriptor.hxx,v $
-+ *
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/07/25 03:42:07 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_EXTFILTER_DESCRIPTOR_HXX
-+#define SC_EXTFILTER_DESCRIPTOR_HXX
-+
-+#include "global.hxx"
-+
-+#include <com/sun/star/sheet/TableFilterFieldType.hpp>
-+#include <list>
-+
-+namespace com { namespace sun { namespace star { namespace sheet {
-+ class TableFilterFieldNormal;
-+ class TableFilterFieldMultiString;
-+}}}}
-+
-+class ScDocument;
-+class ScFilterDescriptorBase;
-+
-+class ScExtendedFilterDescriptor
-+{
-+public:
-+ ScExtendedFilterDescriptor(ScFilterDescriptorBase* pParent, ScDocument& rDoc);
-+ ~ScExtendedFilterDescriptor() throw();
-+
-+ void addFieldNormal( const ::com::sun::star::sheet::TableFilterFieldNormal& aField );
-+ void addFieldMultiString( const ::com::sun::star::sheet::TableFilterFieldMultiString& aField );
-+ void commit();
-+
-+private:
-+ ScFilterDescriptorBase* mpParent;
-+ ScDocument& mrDoc;
-+ ::std::list<ScQueryEntry> maParamList;
-+};
-+
-+//=============================================================================
-+
-+class ScExtendedFilterIterator
-+{
-+public:
-+ ScExtendedFilterIterator(ScFilterDescriptorBase* pParent, ScDocument& rDoc);
-+ ~ScExtendedFilterIterator() throw();
-+
-+ ::com::sun::star::sheet::TableFilterFieldType getFirstType();
-+ ::com::sun::star::sheet::TableFilterFieldType getNextType();
-+
-+ bool getFieldNormal( ::com::sun::star::sheet::TableFilterFieldNormal& rField );
-+ bool getFieldMultiString( ::com::sun::star::sheet::TableFilterFieldMultiString& rField );
-+
-+private:
-+ ScFilterDescriptorBase* mpParent;
-+ ScDocument& mrDoc;
-+ ScQueryParam mrParam;
-+ SCSIZE mnPos;
-+};
-+
-+#endif
-Index: sc/source/ui/unoobj/makefile.mk
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/unoobj/makefile.mk,v
-retrieving revision 1.18
-retrieving revision 1.18.72.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.18 -r1.18.72.2
---- sc/source/ui/unoobj/makefile.mk 22 May 2007 20:11:40 -0000 1.18
-+++ sc/source/ui/unoobj/makefile.mk 13 Aug 2007 23:48:20 -0000 1.18.72.2
-@@ -97,6 +97,7 @@
- $(SLO)$/celllistsource.obj \
- $(SLO)$/warnpassword.obj \
- $(SLO)$/unoreflist.obj \
-+ $(SLO)$/sheetfilterfieldaccess.obj \
- $(SLO)$/ChartRangeSelectionListener.obj
-
- SLO2FILES = \
-Index: sc/source/ui/unoobj/sheetfilterfieldaccess.cxx
-===================================================================
-RCS file: sc/source/ui/unoobj/sheetfilterfieldaccess.cxx
-diff -N sc/source/ui/unoobj/sheetfilterfieldaccess.cxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/source/ui/unoobj/sheetfilterfieldaccess.cxx 15 Aug 2007 19:21:15 -0000 1.1.2.4
-@@ -0,0 +1,432 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: sheetfilterfieldaccess.cxx,v $
-+ *
-+ * $Revision: 1.1.2.4 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:21:15 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#include "sheetfilterfieldaccess.hxx"
-+#include "unoguard.hxx"
-+#include "docsh.hxx"
-+
-+#include <stdio.h>
-+
-+#include <com/sun/star/sheet/SheetFilterFieldValue.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldMultiString.hpp>
-+#include <com/sun/star/sheet/SheetFilterFieldType.hpp>
-+#include <com/sun/star/sheet/SheetFilterConnection.hpp>
-+#include <com/sun/star/sheet/SheetFilterOperator.hpp>
-+
-+using ::com::sun::star::sheet::SheetFilterFieldValue;
-+using ::com::sun::star::sheet::SheetFilterFieldMultiString;
-+using ::com::sun::star::uno::Sequence;
-+using ::com::sun::star::uno::Any;
-+
-+using ::rtl::OUString;
-+using ::std::vector;
-+
-+using namespace ::com::sun::star;
-+
-+#define CREATE_OUSTRING( ascii ) ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-+
-+// ----------------------------------------------------------------------------
-+
-+void lclTranslateOperator(ScQueryEntry& rEntry, const sal_Int16 nOp)
-+{
-+ using namespace ::com::sun::star::sheet;
-+
-+ switch ( nOp )
-+ {
-+ case SheetFilterOperator::EMPTY:
-+ rEntry.eOp = SC_EQUAL;
-+ rEntry.nVal = SC_EMPTYFIELDS;
-+ rEntry.bQueryByString = false;
-+ *rEntry.pStr = EMPTY_STRING;
-+ break;
-+ case SheetFilterOperator::NOT_EMPTY:
-+ rEntry.eOp = SC_EQUAL;
-+ rEntry.nVal = SC_NONEMPTYFIELDS;
-+ rEntry.bQueryByString = FALSE;
-+ *rEntry.pStr = EMPTY_STRING;
-+ break;
-+ case SheetFilterOperator::EQUAL:
-+ rEntry.eOp = SC_EQUAL;
-+ break;
-+ case SheetFilterOperator::NOT_EQUAL:
-+ rEntry.eOp = SC_NOT_EQUAL;
-+ break;
-+ case SheetFilterOperator::GREATER:
-+ rEntry.eOp = SC_GREATER;
-+ break;
-+ case SheetFilterOperator::GREATER_EQUAL:
-+ rEntry.eOp = SC_GREATER_EQUAL;
-+ break;
-+ case SheetFilterOperator::LESS:
-+ rEntry.eOp = SC_LESS;
-+ break;
-+ case SheetFilterOperator::LESS_EQUAL:
-+ rEntry.eOp = SC_LESS_EQUAL;
-+ break;
-+ case SheetFilterOperator::TOP_VALUES:
-+ rEntry.eOp = SC_TOPVAL;
-+ break;
-+ case SheetFilterOperator::TOP_PERCENT:
-+ rEntry.eOp = SC_TOPPERC;
-+ break;
-+ case SheetFilterOperator::BOTTOM_VALUES:
-+ rEntry.eOp = SC_BOTVAL;
-+ break;
-+ case SheetFilterOperator::BOTTOM_PERCENT:
-+ rEntry.eOp = SC_BOTPERC;
-+ break;
-+ default:
-+ DBG_ERROR("lclTranslateOperator: unexpected enum value");
-+ rEntry.eOp = SC_EQUAL;
-+ }
-+}
-+
-+// ----------------------------------------------------------------------------
-+
-+const sal_Int32 ScSheetFilterFieldAccess::MAX_FILTER_FIELD = MAXQUERY;
-+
-+const uno::Type ScSheetFilterFieldAccess::VALUE =
-+ getCppuType(static_cast<sheet::SheetFilterFieldValue*>(NULL));
-+const uno::Type ScSheetFilterFieldAccess::MULTI_STRING =
-+ getCppuType(static_cast<sheet::SheetFilterFieldMultiString*>(NULL));
-+
-+ScSheetFilterFieldAccess::ScSheetFilterFieldAccess(ScDocShell* pDocShell, ScDatabaseRangeObj* pParent) :
-+ mpFilterDescriptor(new ScRangeFilterDescriptor(pDocShell, pParent)),
-+ mnMaxIndex(0),
-+ mpDocShell(pDocShell),
-+ mpParent(pParent)
-+{
-+}
-+
-+ScSheetFilterFieldAccess::~ScSheetFilterFieldAccess()
-+{
-+}
-+
-+void SAL_CALL ScSheetFilterFieldAccess::setFields(const Sequence<Any>& aFields)
-+ throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSize = aFields.getLength();
-+
-+ ScQueryParam aParam;
-+ mpFilterDescriptor->GetData(aParam);
-+ aParam.Resize(nSize);
-+
-+ for (sal_Int32 i = 0; i < nSize; ++i)
-+ {
-+ const Any& rAny = aFields[i];
-+ uno::Type eType = rAny.getValueType();
-+
-+ ScQueryEntry& rEntry = aParam.GetEntry(i);
-+ rEntry.nField = static_cast<SCCOLROW>(i);
-+ if (eType == VALUE)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setFields: VALUE\n");fflush(stdout);
-+ SheetFilterFieldValue aField;
-+ rAny >>= aField;
-+ rEntry.bDoQuery = true;
-+ rEntry.eConnect = aField.Connection == sheet::SheetFilterConnection::AND ? SC_AND : SC_OR;
-+ rEntry.bQueryByString = aField.IsNumeric;
-+ rEntry.pStr = new String(aField.StringValue);
-+ rEntry.nVal = aField.NumericValue;
-+ lclTranslateOperator(rEntry, aField.Operator);
-+ if (!rEntry.bQueryByString && mpDocShell)
-+ mpDocShell->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
-+ }
-+ else if (eType == MULTI_STRING)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setFields: MULTI_STRING\n");fflush(stdout);
-+ SheetFilterFieldMultiString aField;
-+ rAny >>= aField;
-+ rEntry.bDoQuery = true;
-+ rEntry.eConnect = aField.Connection == sheet::SheetFilterConnection::AND ? SC_AND : SC_OR;
-+ sal_Int32 nStrLen = aField.StringSet.getLength();
-+ for (sal_Int32 j = 0; j < nStrLen; ++j)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::refresh: value = %s\n",
-+ OUStringToOString(aField.StringSet[j], RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+ rEntry.aStrValues.insert(aField.StringSet[j]);
-+ }
-+ }
-+ }
-+
-+ SCSIZE nParamCount = aParam.GetEntryCount();
-+ for (SCSIZE i = nSize; i < nParamCount; ++i)
-+ aParam.GetEntry(i).bDoQuery = false;
-+
-+ mpFilterDescriptor->PutData(aParam);
-+}
-+
-+Sequence<Any> SAL_CALL ScSheetFilterFieldAccess::getFields()
-+ throw (uno::RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ ScQueryParam aParam;
-+ mpFilterDescriptor->GetData(aParam);
-+
-+ SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
-+ SCSIZE nCount = 0; // aktive
-+
-+ while (nCount < nEntries && aParam.GetEntry(nCount).bDoQuery)
-+ ++nCount;
-+
-+ Sequence<Any> aSeq(static_cast<sal_Int32>(nCount));
-+ Any* pAny = aSeq.getArray();
-+ Any any;
-+ for (SCSIZE i = 0; i < nCount; ++i)
-+ {
-+ const ScQueryEntry& rEntry = aParam.GetEntry(i);
-+ if ( !rEntry.aStrValues.empty() )
-+ {
-+ // This is a multi-string filter.
-+ SheetFilterFieldMultiString aField;
-+ aField.Field = rEntry.nField;
-+ aField.Connection = (rEntry.eConnect == SC_AND) ?
-+ sheet::SheetFilterConnection::AND : sheet::SheetFilterConnection::OR;
-+
-+ size_t nSize = rEntry.aStrValues.size();
-+ Sequence<OUString> aList(nSize);
-+ ScHashOUStringSet::const_iterator itr = rEntry.aStrValues.begin(),
-+ itrEnd = rEntry.aStrValues.end();
-+
-+ for (size_t j = 0; itr != itrEnd; ++itr, ++j)
-+ aList[j] = *itr;
-+
-+ aField.StringSet = aList;
-+ any <<= aField;
-+ }
-+ else
-+ {
-+ SheetFilterFieldValue aField;
-+ OUString aStringValue;
-+ if (rEntry.pStr)
-+ aStringValue = *rEntry.pStr;
-+
-+ aField.Field = rEntry.nField;
-+ aField.Connection = (rEntry.eConnect == SC_AND) ?
-+ sheet::SheetFilterConnection::AND : sheet::SheetFilterConnection::OR;
-+ aField.IsNumeric = !rEntry.bQueryByString;
-+ aField.StringValue = aStringValue;
-+ aField.NumericValue = rEntry.nVal;
-+
-+ switch (rEntry.eOp) // ScQueryOp
-+ {
-+ case SC_EQUAL:
-+ {
-+ aField.Operator = sheet::SheetFilterOperator::EQUAL;
-+ if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
-+ {
-+ if (rEntry.nVal == SC_EMPTYFIELDS)
-+ {
-+ aField.Operator = sheet::SheetFilterOperator::EMPTY;
-+ aField.NumericValue = 0;
-+ }
-+ else if (rEntry.nVal == SC_NONEMPTYFIELDS)
-+ {
-+ aField.Operator = sheet::SheetFilterOperator::NOT_EMPTY;
-+ aField.NumericValue = 0;
-+ }
-+ }
-+ }
-+ break;
-+ case SC_LESS: aField.Operator = sheet::SheetFilterOperator::LESS; break;
-+ case SC_GREATER: aField.Operator = sheet::SheetFilterOperator::GREATER; break;
-+ case SC_LESS_EQUAL: aField.Operator = sheet::SheetFilterOperator::LESS_EQUAL; break;
-+ case SC_GREATER_EQUAL: aField.Operator = sheet::SheetFilterOperator::GREATER_EQUAL; break;
-+ case SC_NOT_EQUAL: aField.Operator = sheet::SheetFilterOperator::NOT_EQUAL; break;
-+ case SC_TOPVAL: aField.Operator = sheet::SheetFilterOperator::TOP_VALUES; break;
-+ case SC_BOTVAL: aField.Operator = sheet::SheetFilterOperator::BOTTOM_VALUES; break;
-+ case SC_TOPPERC: aField.Operator = sheet::SheetFilterOperator::TOP_PERCENT; break;
-+ case SC_BOTPERC: aField.Operator = sheet::SheetFilterOperator::BOTTOM_PERCENT; break;
-+ default:
-+ DBG_ERROR("Falscher Filter-enum");
-+ aField.Operator = sheet::FilterOperator_EMPTY;
-+ }
-+ any <<= aField;
-+ }
-+ pAny[i] = any;
-+ }
-+ return aSeq;
-+}
-+
-+#if 0
-+void SAL_CALL ScSheetFilterFieldAccess::setField(sal_Int32 nIndex, const uno::Any& aAnyField)
-+ throw (uno::RuntimeException)
-+{
-+ if (nIndex >= MAX_FILTER_FIELD)
-+ // TODO: throw an exception.
-+ return;
-+
-+ ScSheetFilterFieldItem& rField = maFieldList[nIndex];
-+
-+ uno::Type eType = aAnyField.getValueType();
-+ if (eType == VALUE)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setField: Value\n");fflush(stdout);
-+ rField.mpField.reset(new SheetFilterFieldValue);
-+ SheetFilterFieldValue* p = rField.getFieldValue();
-+ aAnyField >>= *p;
-+ rField.mnType = sheet::SheetFilterFieldType::VALUE;
-+ if (nIndex > mnMaxIndex)
-+ mnMaxIndex = nIndex;
-+ }
-+ else if (eType == MULTI_STRING)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setField: Multistring\n");fflush(stdout);
-+ rField.mpField.reset(new SheetFilterFieldMultiString);
-+ SheetFilterFieldMultiString* p = rField.getFieldMultiString();
-+ aAnyField >>= *p;
-+ rField.mnType = sheet::SheetFilterFieldType::MULTI_STRING;
-+ if (nIndex > mnMaxIndex)
-+ mnMaxIndex = nIndex;
-+ }
-+ else
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setField: unknown field type\n");fflush(stdout);
-+ }
-+}
-+
-+uno::Any SAL_CALL ScSheetFilterFieldAccess::getField(sal_Int32 nIndex)
-+ throw (uno::RuntimeException)
-+{
-+ fprintf(stdout, "ScSheetFilterFieldAccess::getField: \n");fflush(stdout);
-+ uno::Any any;
-+ if (nIndex >= MAX_FILTER_FIELD)
-+ // TODO: throw an exception.
-+ return any;
-+
-+ return any;
-+}
-+
-+sal_Int32 SAL_CALL ScSheetFilterFieldAccess::getMaxFieldCount()
-+ throw (uno::RuntimeException)
-+{
-+ return MAX_FILTER_FIELD;
-+}
-+
-+void SAL_CALL ScSheetFilterFieldAccess::refresh()
-+ throw (uno::RuntimeException)
-+{
-+ fprintf(stdout, "ScSheetFilterFieldAccess::refresh: max index = %ld\n",mnMaxIndex);fflush(stdout);
-+ ScQueryParam aParam;
-+ mpFilterDescriptor->GetData(aParam);
-+ aParam.Resize(mnMaxIndex+1);
-+
-+ for (sal_Int32 i = 0; i < mnMaxIndex+1; ++i)
-+ {
-+ ScSheetFilterFieldItem& rItem = maFieldList[i];
-+ ScQueryEntry& rEntry = aParam.GetEntry(i);
-+ rEntry.bDoQuery = !(rItem.mnType == sheet::SheetFilterFieldType::NONE);
-+ if (!rEntry.bDoQuery)
-+ continue;
-+
-+ rEntry.eConnect = rItem.mpField->Connection == sheet::SheetFilterConnection::AND ? SC_AND : SC_OR;
-+ rEntry.nField = static_cast<SCCOLROW>(i);
-+ switch (rItem.mnType)
-+ {
-+ case sheet::SheetFilterFieldType::VALUE:
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::refresh: VALUE\n");fflush(stdout);
-+ sheet::SheetFilterFieldValue* p = rItem.getFieldValue();
-+ rEntry.bQueryByString = !p->IsNumeric;
-+ rEntry.pStr = new String(p->StringValue);
-+ rEntry.nVal = p->NumericValue;
-+ lclTranslateOperator(rEntry, p->Operator);
-+ if (!rEntry.bQueryByString && mpDocShell)
-+ mpDocShell->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
-+ }
-+ break;
-+ case sheet::SheetFilterFieldType::MULTI_STRING:
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::refresh: MULTI_STRING\n");fflush(stdout);
-+ rEntry.bQueryByString = true;
-+ rEntry.pStr = new String(CREATE_OUSTRING("MULTISTRING"));
-+ rEntry.eOp = SC_EQUAL;
-+ sheet::SheetFilterFieldMultiString* p = rItem.getFieldMultiString();
-+ sal_Int32 nSize = p->StringSet.getLength();
-+ for (sal_Int32 j = 0; j < nSize; ++j)
-+ {
-+ fprintf(stdout, "ScSheetFilterFieldAccess::refresh: value = %s\n",
-+ OUStringToOString(p->StringSet[j], RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+ rEntry.aStrValues.insert(p->StringSet[j]);
-+ }
-+ }
-+ break;
-+ case sheet::SheetFilterFieldType::NONE:
-+ default:
-+ break;
-+ }
-+ }
-+
-+ SCSIZE nParamCount = aParam.GetEntryCount();
-+ for (SCSIZE i = mnMaxIndex+1; i < nParamCount; ++i)
-+ aParam.GetEntry(i).bDoQuery = false;
-+
-+ mpFilterDescriptor->PutData(aParam);
-+}
-+#endif
-+
-+uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSheetFilterFieldAccess::getPropertySetInfo()
-+ throw(uno::RuntimeException)
-+{
-+ return mpFilterDescriptor->getPropertySetInfo();
-+}
-+
-+void SAL_CALL ScSheetFilterFieldAccess::setPropertyValue(
-+ const rtl::OUString& aPropertyName, const uno::Any& aValue )
-+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
-+ lang::IllegalArgumentException, lang::WrappedTargetException,
-+ uno::RuntimeException)
-+{
-+ fprintf(stdout, "ScSheetFilterFieldAccess::setPropertyValue: name = %s\n",
-+ OUStringToOString(aPropertyName, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+
-+ mpFilterDescriptor->setPropertyValue(aPropertyName, aValue);
-+}
-+
-+uno::Any SAL_CALL ScSheetFilterFieldAccess::getPropertyValue( const rtl::OUString& aPropertyName )
-+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
-+ uno::RuntimeException)
-+{
-+ fprintf(stdout, "ScSheetFilterFieldAccess::getPropertyValue: name = %s\n",
-+ OUStringToOString(aPropertyName, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+
-+ return mpFilterDescriptor->getPropertyValue(aPropertyName);
-+}
-+
-+SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSheetFilterFieldAccess )
-+
-+SC_SIMPLE_SERVICE_INFO(ScSheetFilterFieldAccess, "ScSheetFilterFieldAccess",
-+ "com.sun.star.sheet.SheetFilterFieldAccess")
-+
-Index: sc/source/ui/unoobj/sheetfilterfieldaccess.hxx
-===================================================================
-RCS file: sc/source/ui/unoobj/sheetfilterfieldaccess.hxx
-diff -N sc/source/ui/unoobj/sheetfilterfieldaccess.hxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ sc/source/ui/unoobj/sheetfilterfieldaccess.hxx 15 Aug 2007 19:21:15 -0000 1.1.2.4
-@@ -0,0 +1,151 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: sheetfilterfieldaccess.hxx,v $
-+ *
-+ * $Revision: 1.1.2.4 $
-+ *
-+ * last change: $Author: kohei $ $Date: 2007/08/15 19:21:15 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_SHEET_FILTER_FIELD_ACCESS_HXX
-+#define SC_SHEET_FILTER_FIELD_ACCESS_HXX
-+
-+#include "global.hxx"
-+#include "filterglobal.hxx"
-+#include "miscuno.hxx"
-+#include "datauno.hxx"
-+
-+#include "cppuhelper/implbase3.hxx"
-+#include "svtools/itemprop.hxx"
-+
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/XPropertySetInfo.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/sheet/XSheetFilterFieldAccess.hpp>
-+#include <com/sun/star/sheet/SheetFilterField.hpp>
-+
-+#include <memory>
-+#include <boost/shared_ptr.hpp>
-+#include <vector>
-+
-+class ScDocShell;
-+
-+class ScSheetFilterFieldAccess : public cppu::WeakImplHelper3<
-+ ::com::sun::star::sheet::XSheetFilterFieldAccess,
-+ ::com::sun::star::beans::XPropertySet,
-+ ::com::sun::star::lang::XServiceInfo >
-+{
-+ typedef ::boost::shared_ptr< ::com::sun::star::sheet::SheetFilterField > SheetFilterFieldRef;
-+
-+ static const sal_Int32 MAX_FILTER_FIELD;
-+ static const ::com::sun::star::uno::Type VALUE;
-+ static const ::com::sun::star::uno::Type MULTI_STRING;
-+
-+public:
-+ ScSheetFilterFieldAccess(ScDocShell* pDocShell, ScDatabaseRangeObj* pParent);
-+ ~ScSheetFilterFieldAccess();
-+
-+ // XSheetFilterFieldAccess
-+ virtual void SAL_CALL setFields(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aFields)
-+ throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getFields()
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+#if 0
-+ virtual void SAL_CALL setField(sal_Int32 nIndex, const ::com::sun::star::uno::Any& aAnyField)
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Any SAL_CALL getField(sal_Int32 nIndex)
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual sal_Int32 SAL_CALL getMaxFieldCount()
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL refresh()
-+ throw (::com::sun::star::uno::RuntimeException);
-+#endif
-+
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
-+ SAL_CALL getPropertySetInfo()
-+ throw(::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
-+ const ::com::sun::star::uno::Any& aValue )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::beans::PropertyVetoException,
-+ ::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
-+ const ::rtl::OUString& PropertyName )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::beans::XPropertyChangeListener >& xListener )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::beans::XPropertyChangeListener >& aListener )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
-+ throw(::com::sun::star::beans::UnknownPropertyException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName()
-+ throw(::com::sun::star::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
-+ throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
-+ throw(::com::sun::star::uno::RuntimeException);
-+
-+private:
-+ ::std::auto_ptr<ScRangeFilterDescriptor> mpFilterDescriptor;
-+ sal_Int32 mnMaxIndex;
-+
-+ ScDocShell* mpDocShell;
-+ ScDatabaseRangeObj* mpParent;
-+};
-+
-+#endif
-Index: sc/source/ui/view/gridwin.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/view/gridwin.cxx,v
-retrieving revision 1.85
-retrieving revision 1.82.14.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.85 -r1.82.14.2
---- sc/source/ui/view/gridwin.cxx 27 Sep 2007 13:56:11 -0000 1.85
-+++ sc/source/ui/view/gridwin.cxx 1 Oct 2007 15:29:14 -0000 1.82.14.2
-@@ -1127,6 +1127,10 @@
- ScQueryParam aParam;
- pDBData->GetQueryParam( aParam ); // kann nur MAXQUERY Eintraege ergeben
-
-+ // Disable multi-string match flag until we implement it in the UI.
-+ for (SCSIZE i = 0; i < MAXQUERY; ++i)
-+ aParam.GetEntry(i).aStrValues.clear();
-+
- if (SC_AUTOFILTER_CUSTOM == nSel)
- {
- pViewData->GetView()->SetCursor(nCol,nRow); //! auch ueber Slot ??
diff --git a/patches/test/calc-autofilter-multistring-xmloff.diff b/patches/test/calc-autofilter-multistring-xmloff.diff
deleted file mode 100644
index e735b1955..000000000
--- a/patches/test/calc-autofilter-multistring-xmloff.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-Index: xmloff/inc/xmloff/xmltoken.hxx
-===================================================================
-RCS file: /cvs/xml/xmloff/inc/xmloff/xmltoken.hxx,v
-retrieving revision 1.9
-retrieving revision 1.6.14.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.9 -r1.6.14.2
---- xmloff/inc/xmloff/xmltoken.hxx 28 Aug 2007 13:49:45 -0000 1.9
-+++ xmloff/inc/xmloff/xmltoken.hxx 1 Oct 2007 15:28:50 -0000 1.6.14.2
-@@ -732,6 +732,7 @@
- XML_FILTER_NAME,
- XML_FILTER_OPTIONS,
- XML_FILTER_OR,
-+ XML_FILTER_SET_ITEM,
- XML_FIRST_DATE_TIME,
- XML_FIRST_PAGE,
- XML_FIRST_PAGE_NUMBER,
-Index: xmloff/source/core/xmltoken.cxx
-===================================================================
-RCS file: /cvs/xml/xmloff/source/core/xmltoken.cxx,v
-retrieving revision 1.112
-retrieving revision 1.109.14.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.112 -r1.109.14.2
---- xmloff/source/core/xmltoken.cxx 28 Aug 2007 13:34:08 -0000 1.112
-+++ xmloff/source/core/xmltoken.cxx 1 Oct 2007 15:28:56 -0000 1.109.14.2
-@@ -740,6 +740,7 @@
- TOKEN( "filter-name", XML_FILTER_NAME ),
- TOKEN( "filter-options", XML_FILTER_OPTIONS ),
- TOKEN( "filter-or", XML_FILTER_OR ),
-+ TOKEN( "filter-set-item", XML_FILTER_SET_ITEM ),
- TOKEN( "first-date-time", XML_FIRST_DATE_TIME ),
- TOKEN( "first-page", XML_FIRST_PAGE ),
- TOKEN( "first-page-number", XML_FIRST_PAGE_NUMBER ),
diff --git a/patches/test/calc-csv-import-as-text.diff b/patches/test/calc-csv-import-as-text.diff
deleted file mode 100644
index 616ede444..000000000
--- a/patches/test/calc-csv-import-as-text.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git sc/source/ui/dbgui/csvgrid.cxx sc/source/ui/dbgui/csvgrid.cxx
-index ddbfb44..723f16c 100644
---- sc/source/ui/dbgui/csvgrid.cxx
-+++ sc/source/ui/dbgui/csvgrid.cxx
-@@ -497,7 +497,7 @@ void ScCsvGrid::SetTypeNames( const StringVec& rTypeNames )
- for( nIx = 0, nItemId = 1; nIx < nCount; ++nIx, ++nItemId )
- maPopup.InsertItem( nItemId, maTypeNames[ nIx ] );
-
-- ::std::for_each( maColStates.begin(), maColStates.end(), Func_SetType( CSV_TYPE_DEFAULT ) );
-+ ::std::for_each( maColStates.begin(), maColStates.end(), Func_SetType( CSV_TYPE_TEXT ) );
- }
-
- const String& ScCsvGrid::GetColumnTypeName( sal_uInt32 nColIndex ) const
-diff --git sc/source/ui/inc/csvcontrol.hxx sc/source/ui/inc/csvcontrol.hxx
-index 85aa777..dea691b 100644
---- sc/source/ui/inc/csvcontrol.hxx
-+++ sc/source/ui/inc/csvcontrol.hxx
-@@ -65,6 +65,9 @@ const sal_Int32 CSV_MAXCOLCOUNT = MAXCOLCOUNT;
-
- /** Default column data type. */
- const sal_Int32 CSV_TYPE_DEFAULT = 0;
-+/** Text column data type. */
-+const sal_Int32 CSV_TYPE_TEXT = 1;
-+
- /** Multi selection with different types. */
- const sal_Int32 CSV_TYPE_MULTI = -1;
- /** No column selected. */
-diff --git sc/source/ui/inc/csvgrid.hxx sc/source/ui/inc/csvgrid.hxx
-index 4729e7b..671e1f6 100644
---- sc/source/ui/inc/csvgrid.hxx
-+++ sc/source/ui/inc/csvgrid.hxx
-@@ -72,7 +72,7 @@ struct ScCsvColState
- sal_uInt8 mnFlags; /// Flags (i.e. selection state).
-
- inline explicit ScCsvColState(
-- sal_Int32 nType = CSV_TYPE_DEFAULT,
-+ sal_Int32 nType = CSV_TYPE_TEXT,
- sal_uInt8 nFlags = CSV_COLFLAG_NONE ) :
- mnType( nType ), mnFlags( nFlags ) {}
-
diff --git a/patches/test/calc-csv-import-quoted-text.diff b/patches/test/calc-csv-import-quoted-text.diff
deleted file mode 100644
index d23d9d456..000000000
--- a/patches/test/calc-csv-import-quoted-text.diff
+++ /dev/null
@@ -1,89 +0,0 @@
-diff --git sc/source/ui/dbgui/csvgrid.cxx sc/source/ui/dbgui/csvgrid.cxx
-index ddbfb44..5725645 100644
---- sc/source/ui/dbgui/csvgrid.cxx
-+++ sc/source/ui/dbgui/csvgrid.cxx
-@@ -737,7 +737,8 @@ void ScCsvGrid::ImplSetTextLineSep(
- while( *pChar && (nColIx < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT)) )
- {
- // scan for next cell text
-- pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
-+ bool bIsQuoted = false;
-+ pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted );
-
- // update column width
- sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) );
-diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
-index 7c21c4a..07d6a80 100644
---- sc/source/ui/docshell/impex.cxx
-+++ sc/source/ui/docshell/impex.cxx
-@@ -762,12 +762,10 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm )
- //
-
-
--bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
-- const String& rStr, BYTE nColFormat,
-- ::utl::TransliterationWrapper& rTransliteration,
-- CalendarWrapper& rCalendar,
-- ::utl::TransliterationWrapper* pSecondTransliteration,
-- CalendarWrapper* pSecondCalendar )
-+static bool lcl_PutString(
-+ ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat,
-+ ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
-+ ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
- {
- bool bMultiLine = false;
- if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) )
-@@ -1138,7 +1136,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
- // SC_COL_SKIP.
- while (*p && nCol <= MAXCOL+1)
- {
-- p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge );
-+ bool bIsQuoted = false;
-+ p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted );
-
- BYTE nFmt = SC_COL_STANDARD;
- for ( i=nInfoStart; i<nInfoCount; i++ )
-@@ -1155,10 +1154,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
- if (nCol > MAXCOL)
- bOverflow = TRUE; // display warning on import
- else if (!bDetermineRange)
-+ {
-+ if (bIsQuoted)
-+ nFmt = SC_COL_TEXT;
-+
- bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
- nTab, aCell, nFmt, aTransliteration,
- aCalendar, pEnglishTransliteration,
- pEnglishCalendar);
-+ }
- ++nCol;
- }
-
-@@ -1232,11 +1236,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
-
- // static
- const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p,
-- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps )
-+ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted )
- {
-+ rbIsQuoted = false;
- rField.Erase();
- if ( *p == cStr ) // String in Anfuehrungszeichen
- {
-+ rbIsQuoted = true;
- const sal_Unicode* p1;
- p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE );
- while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) )
-diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
-index 515063a..aaddeeb 100644
---- sc/source/ui/inc/impex.hxx
-+++ sc/source/ui/inc/impex.hxx
-@@ -98,7 +98,7 @@ public:
-
- static BOOL IsFormatSupported( ULONG nFormat );
- static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p,
-- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps );
-+ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted );
- static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE );
- static void WriteUnicodeOrByteEndl( SvStream& rStrm );
- static inline BOOL IsEndianSwap( const SvStream& rStrm );
diff --git a/patches/test/calc-external-defined-names-offapi-before-merge.diff b/patches/test/calc-external-defined-names-offapi-before-merge.diff
deleted file mode 100644
index 12b5ee888..000000000
--- a/patches/test/calc-external-defined-names-offapi-before-merge.diff
+++ /dev/null
@@ -1,435 +0,0 @@
-diff --git offapi/com/sun/star/sheet/ExternalDocLink.idl offapi/com/sun/star/sheet/ExternalDocLink.idl
-new file mode 100644
-index 0000000..7320905
---- /dev/null
-+++ offapi/com/sun/star/sheet/ExternalDocLink.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_ExternalDocLink_idl__
-+#define __com_sun_star_sheet_ExternalDocLink_idl__
-+
-+#include <com/sun/star/sheet/XExternalDocLink.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** Represents a single external document link.
-+
-+ <p>An external document link contains cached data used for external cell
-+ and cell range references as well as external range names.</p>
-+
-+ @see com::sun::star::sheet::XExternalDocLink
-+
-+ @since OOo 3.1.0
-+ */
-+service ExternalDocLink : XExternalDocLink
-+{
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/ExternalDocLinks.idl offapi/com/sun/star/sheet/ExternalDocLinks.idl
-new file mode 100644
-index 0000000..105cb8f
---- /dev/null
-+++ offapi/com/sun/star/sheet/ExternalDocLinks.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_ExternalDocLinks_idl__
-+#define __com_sun_star_sheet_ExternalDocLinks_idl__
-+
-+#include <com/sun/star/sheet/XExternalDocLinks.idl>
-+#include <com/sun/star/sheet/XSpreadsheetDocument.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** Represents a collection of external document links.
-+
-+ <p>An external document link contains cached data used for external cell
-+ and cell range references as well as external range names.</p>
-+
-+ @see com::sun::star::sheet::ExternalDocLink
-+ @see com::sun::star::sheet::XExternalDocLinks
-+
-+ @since OOo 3.1.0
-+ */
-+service ExternalDocLinks : XExternalDocLinks
-+{
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/ExternalSheetCache.idl offapi/com/sun/star/sheet/ExternalSheetCache.idl
-new file mode 100644
-index 0000000..17af156
---- /dev/null
-+++ offapi/com/sun/star/sheet/ExternalSheetCache.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_ExternalSheetCache_idl__
-+#define __com_sun_star_sheet_ExternalSheetCache_idl__
-+
-+#include <com/sun/star/sheet/XExternalSheetCache.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** A single sheet cache for an external document.
-+
-+ <p>This cached data is used for external cell and cell range references,
-+ as well as external range names. An <type scope="com::sun::star::sheet">ExternalDocLink</type>
-+ instance contains a set of these sheet caches.</p>
-+
-+ @see com::sun::star::sheet::ExternalDocLink
-+ @see com::sun::star::sheet::XExternalSheetCache
-+
-+ @since OOo 3.1.0
-+ */
-+service ExternalSheetCache : XExternalSheetCache
-+{
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/XExternalDocLink.idl offapi/com/sun/star/sheet/XExternalDocLink.idl
-new file mode 100644
-index 0000000..65928c5
---- /dev/null
-+++ offapi/com/sun/star/sheet/XExternalDocLink.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_XExternalDocLink_idl__
-+#define __com_sun_star_sheet_XExternalDocLink_idl__
-+
-+#include <com/sun/star/sheet/XExternalSheetCache.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** Primary interface for the <type scope="com::sun::star::sheet">ExternalDocLink</type> service.
-+
-+ @see com::sun::star::sheet::ExternalDocLink
-+
-+ @since OOo 3.1.0
-+ */
-+interface XExternalDocLink
-+{
-+ /** <p>This method adds a new sheet cache instance to the extternal document
-+ link for a specified sheet name. If a sheet cache instance already
-+ exists for the specified name, then the existing instance is returned.</p>
-+
-+ <p>Note that a sheet name lookup is performed in a case-insensitive
-+ fashion.</p>
-+
-+ @param aSheetName sheet name
-+
-+ @return com::sun::star::sheet::XExternalSheetCache sheet cache instance
-+ */
-+ com::sun::star::sheet::XExternalSheetCache addSheetCache( [in] string aSheetName );
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/XExternalDocLinks.idl offapi/com/sun/star/sheet/XExternalDocLinks.idl
-new file mode 100644
-index 0000000..384d405
---- /dev/null
-+++ offapi/com/sun/star/sheet/XExternalDocLinks.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_XExternalDocLinks_idl__
-+#define __com_sun_star_sheet_XExternalDocLinks_idl__
-+
-+#include <com/sun/star/sheet/XExternalDocLink.idl>
-+#include <com/sun/star/container/XNameAccess.idl>
-+#include <com/sun/star/container/XIndexAccess.idl>
-+#include <com/sun/star/container/XEnumerationAccess.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** Primary interface for the <type scope="com::sun::star::sheet">ExternalDocLinks</type> service.
-+
-+ @see com::sun::star::sheet::ExternalDocLinks
-+
-+ @since OOo 3.1.0
-+ */
-+interface XExternalDocLinks
-+{
-+ interface com::sun::star::container::XNameAccess;
-+ interface com::sun::star::container::XIndexAccess;
-+ interface com::sun::star::container::XEnumerationAccess;
-+
-+ /** This method adds a new external document link by its URL, and returns
-+ its instance. If an document instance already exists for the specified URL,
-+ then that instance gets returned instead of creating a new one.
-+
-+ @param aDocName document URL (e.g. file:///path/to/document.ods)
-+
-+ @return com::sun::star::sheet::XExternalDocLink external document link instance
-+ */
-+ com::sun::star::sheet::XExternalDocLink addDocLink( [in] string aDocName );
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/XExternalSheetCache.idl offapi/com/sun/star/sheet/XExternalSheetCache.idl
-new file mode 100644
-index 0000000..0c35f7f
---- /dev/null
-+++ offapi/com/sun/star/sheet/XExternalSheetCache.idl
-@@ -0,0 +1,84 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: DDELink.idl,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 __com_sun_star_sheet_XExternalSheetCache_idl__
-+#define __com_sun_star_sheet_XExternalSheetCache_idl__
-+
-+#include <com/sun/star/lang/IllegalArgumentException.idl>
-+
-+module com { module sun { module star { module sheet {
-+
-+/** Primary interface for the <type scope="com::sun::star::sheet">ExternalSheetCache</type> service.
-+
-+ @see com::sun::star::sheet::ExternalSheetCache
-+
-+ @since OOo 3.1.0
-+ */
-+interface XExternalSheetCache
-+{
-+ /** It sets a cached value for a specified cell position. The value is expected
-+ to be either of type <type>string</type> or of type <type>double</type>. No
-+ other data types are supported.
-+
-+ @param nRow row position (0-based)
-+ @param nColumn column position (0-based)
-+ @param aValue cell value to be cached
-+ */
-+ void setCellValue( [in] long nRow, [in] long nColumn, [in] any aValue )
-+ raises (com::sun::star::lang::IllegalArgumentException);
-+
-+ /** It retrieves a cached value from a specified cell position. The cached
-+ value can be either <type>string</type> or <type>double</type>.
-+
-+ @return any cached cell value
-+ */
-+ any getCellValue( [in] long nRow, [in] long nColumn )
-+ raises (com::sun::star::lang::IllegalArgumentException);
-+
-+ /** It returns a list of all row numbers where a cached cell or cells exist.
-+ The row numbers are sorted in ascending order.
-+
-+ @return sequence<long> list of all row numbers with cached cell(s)
-+ */
-+ sequence< long > getAllRows();
-+
-+ /** Given a row number, this method returns a list of all columns numbers
-+ that store cached cell values in that row. The column numbers are
-+ sorted in ascending order.
-+
-+ @return sequence<long> list of all columns numbers with cached cell values
-+ */
-+ sequence< long > getAllColumns( [in] long nRow )
-+ raises (com::sun::star::lang::IllegalArgumentException);
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/makefile.mk offapi/com/sun/star/sheet/makefile.mk
-index c1d2844..16dffda 100644
---- offapi/com/sun/star/sheet/makefile.mk
-+++ offapi/com/sun/star/sheet/makefile.mk
-@@ -123,6 +123,9 @@ IDLFILES=\
- DatabaseRangesEnumeration.idl\
- DDELinkMode.idl\
- DocumentSettings.idl\
-+ ExternalDocLink.idl\
-+ ExternalDocLinks.idl\
-+ ExternalSheetCache.idl\
- FillDateMode.idl\
- FillDirection.idl\
- FillMode.idl\
-@@ -255,6 +258,9 @@ IDLFILES=\
- XDocumentAuditing.idl\
- XDrillDownDataSupplier.idl\
- XEnhancedMouseClickBroadcaster.idl\
-+ XExternalDocLink.idl\
-+ XExternalDocLinks.idl\
-+ XExternalSheetCache.idl\
- XExternalSheetName.idl\
- XFillAcrossSheet.idl\
- XFormulaOpCodeMapper.idl\
diff --git a/patches/test/calc-external-defined-names-sc-before-merge.diff b/patches/test/calc-external-defined-names-sc-before-merge.diff
deleted file mode 100644
index f390fddf1..000000000
--- a/patches/test/calc-external-defined-names-sc-before-merge.diff
+++ /dev/null
@@ -1,9415 +0,0 @@
-diff --git sc/inc/address.hxx sc/inc/address.hxx
-index f92fc8e..f15a341 100644
---- sc/inc/address.hxx
-+++ sc/inc/address.hxx
-@@ -287,6 +287,15 @@ public:
- };
- static const Details detailsOOOa1;
-
-+ struct ExternalInfo
-+ {
-+ String maTabName;
-+ sal_uInt16 mnFileId;
-+ bool mbExternal;
-+
-+ inline ExternalInfo() : mnFileId(0), mbExternal(false) {}
-+ };
-+
- inline ScAddress() : nRow(0), nCol(0), nTab(0) {}
- inline ScAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
- : nRow(nRowP), nCol(nColP), nTab(nTabP)
-@@ -317,8 +326,8 @@ public:
- inline void GetVars( SCCOL& nColP, SCROW& nRowP, SCTAB& nTabP ) const
- { nColP = nCol; nRowP = nRow; nTabP = nTab; }
-
-- USHORT Parse( const String&, ScDocument* = NULL,
-- const Details& rDetails = detailsOOOa1);
-+ USHORT Parse( const String&, ScDocument* = NULL,
-+ const Details& rDetails = detailsOOOa1, ExternalInfo* pExtInfo = NULL);
- void Format( String&, USHORT = 0, ScDocument* = NULL,
- const Details& rDetails = detailsOOOa1) const;
-
-@@ -463,7 +472,8 @@ public:
- inline bool In( const ScRange& ) const; // is Range& in Range?
-
- USHORT Parse( const String&, ScDocument* = NULL,
-- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
-+ const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
-+ ScAddress::ExternalInfo* pExtInfo = NULL );
- USHORT ParseAny( const String&, ScDocument* = NULL,
- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 );
- USHORT ParseCols( const String&, ScDocument* = NULL,
-diff --git sc/inc/compiler.hrc sc/inc/compiler.hrc
-index 92b7e82..22d77cb 100644
---- sc/inc/compiler.hrc
-+++ sc/inc/compiler.hrc
-@@ -39,25 +39,26 @@
- #define SC_OPCODE_STOP 2
- #define SC_OPCODE_EXTERNAL 3
- #define SC_OPCODE_NAME 4
--#define SC_OPCODE_IF 5 /* jump commands */
--#define SC_OPCODE_CHOSE 6
--#define SC_OPCODE_OPEN 7 /* parentheses and separators */
--#define SC_OPCODE_CLOSE 8
--#define SC_OPCODE_SEP 9
--#define SC_OPCODE_MISSING 10 /* special OpCodes */
--#define SC_OPCODE_BAD 11
--#define SC_OPCODE_SPACES 12
--#define SC_OPCODE_MAT_REF 13
--#define SC_OPCODE_DB_AREA 14 /* additional access operators */
--#define SC_OPCODE_MACRO 15
--#define SC_OPCODE_COL_ROW_NAME 16
--#define SC_OPCODE_COL_ROW_NAME_AUTO 17
--#define SC_OPCODE_PERCENT_SIGN 18 /* operator _follows_ value */
--#define SC_OPCODE_ARRAY_OPEN 19
--#define SC_OPCODE_ARRAY_CLOSE 20
--#define SC_OPCODE_ARRAY_ROW_SEP 21
--#define SC_OPCODE_ARRAY_COL_SEP 22 /* some convs use sep != col_sep */
--#define SC_OPCODE_STOP_DIV 23
-+#define SC_OPCODE_EXTERNAL_NAME 5
-+#define SC_OPCODE_IF 6 /* jump commands */
-+#define SC_OPCODE_CHOSE 7
-+#define SC_OPCODE_OPEN 8 /* parentheses and separators */
-+#define SC_OPCODE_CLOSE 9
-+#define SC_OPCODE_SEP 10
-+#define SC_OPCODE_MISSING 11 /* special OpCodes */
-+#define SC_OPCODE_BAD 12
-+#define SC_OPCODE_SPACES 13
-+#define SC_OPCODE_MAT_REF 14
-+#define SC_OPCODE_DB_AREA 15 /* additional access operators */
-+#define SC_OPCODE_MACRO 16
-+#define SC_OPCODE_COL_ROW_NAME 17
-+#define SC_OPCODE_COL_ROW_NAME_AUTO 18
-+#define SC_OPCODE_PERCENT_SIGN 19 /* operator _follows_ value */
-+#define SC_OPCODE_ARRAY_OPEN 20
-+#define SC_OPCODE_ARRAY_CLOSE 21
-+#define SC_OPCODE_ARRAY_ROW_SEP 22
-+#define SC_OPCODE_ARRAY_COL_SEP 23 /* some convs use sep != col_sep */
-+#define SC_OPCODE_STOP_DIV 24
-
- /*** error constants #... ***/
- #define SC_OPCODE_START_ERRORS 30
-diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
-index 7bb6767..85fdf91 100644
---- sc/inc/compiler.hxx
-+++ sc/inc/compiler.hxx
-@@ -45,6 +45,7 @@
- #include <unotools/charclass.hxx>
- #include <rtl/ustrbuf.hxx>
- #include <com/sun/star/uno/Sequence.hxx>
-+#include <vector>
-
- namespace com { namespace sun { namespace star {
- namespace sheet {
-@@ -100,6 +101,7 @@ namespace com { namespace sun { namespace star {
- class ScDocument;
- class ScMatrix;
- class ScRangeData;
-+class ScExternalRefManager;
-
- // constants and data types internal to compiler
-
-@@ -151,6 +153,15 @@ public:
- bool bHasForceArray;
- } sbyte;
- ComplRefData aRef;
-+ struct {
-+ sal_uInt16 nFileId;
-+ sal_Unicode cTabName[MAXSTRLEN+1];
-+ ComplRefData aRef;
-+ } extref;
-+ struct {
-+ sal_uInt16 nFileId;
-+ sal_Unicode cName[MAXSTRLEN+1];
-+ } extname;
- ScMatrix* pMat;
- USHORT nIndex; // index into name collection
- sal_Unicode cStr[ MAXSTRLEN+1 ]; // string (up to 255 characters + 0)
-@@ -180,6 +191,9 @@ public:
- void SetDouble( double fVal );
- void SetInt( int nVal );
- void SetName( USHORT n );
-+ void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+ void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
-+ void SetExternalName( sal_uInt16 nFileId, const String& rName );
- void SetMatrix( ScMatrix* p );
- void SetExternal(const sal_Unicode* pStr);
- // These methods are ok to use, reference count not cleared.
-@@ -228,6 +242,24 @@ public:
- xub_StrLen nSrcPos,
- const CharClass* pCharClass) const = 0;
-
-+ /**
-+ * Parse the symbol string and pick up the file name and the external
-+ * range name.
-+ *
-+ * @return true on successful parse, or false otherwise.
-+ */
-+ virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName ) const = 0;
-+
-+ virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0;
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const = 0;
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const = 0;
-+
- enum SpecialSymbolType
- {
- /**
-@@ -448,6 +480,7 @@ private:
- BOOL IsDoubleReference( const String& );
- BOOL IsMacro( const String& );
- BOOL IsNamedRange( const String& );
-+ bool IsExternalNamedRange( const String& rSymbol );
- BOOL IsDBRange( const String& );
- BOOL IsColRowName( const String& );
- BOOL IsBoolean( const String& );
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index a01f09b..5d4ca1f 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -93,6 +93,7 @@ class ScDocProtection;
- class ScDocumentPool;
- class ScDrawLayer;
- class ScExtDocOptions;
-+class ScExternalRefManager;
- class ScFormulaCell;
- class ScMarkData;
- class ScOutlineTable;
-@@ -282,6 +283,7 @@ private:
- ScFieldEditEngine* pCacheFieldEditEngine;
-
- ::std::auto_ptr<ScDocProtection> pDocProtection;
-+ ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
- String aDocName; // opt: Dokumentname
- String aDocCodeName; // opt: Dokumentname
- ScRangePairListRef xColNameRanges;
-@@ -634,6 +636,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
- const String& aFileName,
- const String& aTabName );
-
-+ ScExternalRefManager* GetExternalRefManager();
-+
- /** Creates a new sheet, and makes it linked to the specified sheet in an external document.
- @param rnTab (out-param) Returns the sheet index, if sheet could be inserted).
- @return TRUE = Sheet created, rnTab contains valid sheet index. */
-@@ -642,6 +646,7 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
-
- BOOL HasDdeLinks() const;
- BOOL HasAreaLinks() const;
-+ void UpdateExternalRefLinks();
- void UpdateDdeLinks();
- void UpdateAreaLinks();
-
-diff --git sc/inc/externalrefmgr.hxx sc/inc/externalrefmgr.hxx
-new file mode 100644
-index 0000000..46d691d
---- /dev/null
-+++ sc/inc/externalrefmgr.hxx
-@@ -0,0 +1,382 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.hxx,v $
-+ * $Revision: 1.112 $
-+ *
-+ * 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 SC_EXTERNALREFMGR_HXX
-+#define SC_EXTERNALREFMGR_HXX
-+
-+#include "global.hxx"
-+#include "address.hxx"
-+#include "sfx2/objsh.hxx"
-+#include "sfx2/lnkbase.hxx"
-+#include "tools/time.hxx"
-+#include "vcl/timer.hxx"
-+#include "scmatrix.hxx"
-+
-+#include <hash_map>
-+#include <hash_set>
-+#include <boost/shared_ptr.hpp>
-+#include <vector>
-+
-+class ScDocument;
-+class ScToken;
-+class ScMatrix;
-+class ScTokenArray;
-+class String;
-+class SfxObjectShellRef;
-+class Window;
-+
-+class ScExternalRefCache;
-+
-+class ScExternalRefLink : public ::sfx2::SvBaseLink
-+{
-+public:
-+ ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const String& rFilter);
-+ virtual ~ScExternalRefLink();
-+
-+ virtual void Closed();
-+ virtual void DataChanged(const String& rMimeType, const ::com::sun::star::uno::Any & rValue);
-+ virtual void Edit(Window* pParent, const Link& rEndEditHdl);
-+
-+ void SetDoReferesh(bool b);
-+
-+private:
-+ ScExternalRefLink(); // disabled
-+ ScExternalRefLink(const ScExternalRefLink&); // disabled
-+
-+ DECL_LINK(EndEditHdl, void*);
-+
-+ sal_uInt16 mnFileId;
-+ String maFilterName;
-+ ScDocument* mpDoc;
-+ bool mbDoRefresh;
-+};
-+
-+// ============================================================================
-+
-+/**
-+ * Cache table for external reference data.
-+ */
-+class ScExternalRefCache
-+{
-+ struct RangeHash
-+ {
-+ size_t operator()(const ScRange& rRange) const
-+ {
-+ const ScAddress& s = rRange.aStart;
-+ const ScAddress& e = rRange.aEnd;
-+ return s.Tab() + s.Col() + s.Row() + e.Tab() + e.Col() + e.Row();
-+ }
-+ };
-+
-+public:
-+
-+ typedef ::boost::shared_ptr<ScToken> TokenRef;
-+ typedef ::boost::shared_ptr<ScTokenArray> TokenArrayRef;
-+ typedef ::std::hash_map<SCCOL, TokenRef> RowDataType;
-+ typedef ::std::hash_map<SCROW, RowDataType> RowsDataType;
-+
-+ class Table
-+ {
-+ public:
-+ Table();
-+ ~Table();
-+
-+ void setCell(SCROW nRow, SCCOL nCol, TokenRef pToken);
-+ TokenRef getCell(SCROW nRow, SCCOL nCol) const;
-+ void getAllRows(::std::vector<SCROW>& rRows) const;
-+ void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols) const;
-+
-+ private:
-+ RowsDataType maRows;
-+ };
-+
-+ typedef ::boost::shared_ptr<Table> TableTypeRef;
-+ typedef ::std::hash_map<String, size_t, ScStringHashCode> TableNameIndexMap;
-+
-+ ScExternalRefCache();
-+ ~ScExternalRefCache();
-+
-+ /**
-+ * Get a cached cell data at specified cell location.
-+ *
-+ * @param nFileId file ID of an external document
-+ * @param rTabName sheet name
-+ * @param nRow
-+ * @param nCol
-+ *
-+ * @return pointer to the token instance in the cache. <i>The caller does
-+ * not need to delete this instance since its life cycle is
-+ * managed by this class.</i>
-+ */
-+ ScToken* getCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol);
-+
-+ /**
-+ * Get a cached cell range data.
-+ *
-+ * @return a new token array instance. Note that <i>the caller must
-+ * manage the life cycle of the returned instance</i>.
-+ */
-+ ScTokenArray* getCellRangeData(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange);
-+
-+ ScTokenArray* getRangeNameTokens(sal_uInt16 nFileId, const String& rName);
-+ void setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray);
-+
-+ void setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol, TokenRef pToken);
-+
-+ struct SingleRangeData
-+ {
-+ String maTableName;
-+ ScMatrixRef mpRangeData;
-+ };
-+ void setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const ::std::vector<SingleRangeData>& rData,
-+ TokenArrayRef pArray);
-+
-+ bool isDocInitialized(sal_uInt16 nFileId);
-+ void initializeDoc(sal_uInt16 nFileId, const ::std::vector<String>& rTabNames);
-+ const ::std::vector<String>* getAllTableNames(sal_uInt16 nFileId) const;
-+
-+ /**
-+ * Get a cache table instance for specified file and table name. If the
-+ * table instance is not already present, it'll instantiate a new one and
-+ * append it to the end of the table array. <I>It's important to be
-+ * aware of this fact especially for multi-table ranges for which
-+ * table orders are critical.</I>
-+ *
-+ * Excel filter calls this method to populate the cache table from the
-+ * XCT/CRN records.
-+ *
-+ * @param nFileId file ID
-+ * @param rTabName table name
-+ *
-+ * @return pointer to the cache table instance
-+ */
-+ Table* getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew);
-+
-+ void clearCache(sal_uInt16 nFileId);
-+
-+private:
-+ typedef ::std::hash_map<String, TokenArrayRef, ScStringHashCode> RangeNameMap;
-+ typedef ::std::hash_map<ScRange, TokenArrayRef, RangeHash> RangeArrayMap;
-+
-+ /** Represents data cached for a single external document. */
-+ struct DocItem
-+ {
-+ ::std::vector<TableTypeRef> maTables;
-+ ::std::vector<String> maTableNames;
-+ TableNameIndexMap maTableNameIndex;
-+ RangeNameMap maRangeNames;
-+ RangeArrayMap maRangeArrays;
-+
-+ bool mbInitFromSource;
-+
-+ DocItem() : mbInitFromSource(false) {}
-+ };
-+ typedef ::std::hash_map<sal_uInt16, DocItem> DocDataType;
-+ DocItem* getDocItem(sal_uInt16 nFileId) const;
-+
-+private:
-+ mutable DocDataType maDocs;
-+};
-+
-+// ============================================================================
-+
-+class ScExternalRefManager
-+{
-+private:
-+ struct AddressHash
-+ {
-+ size_t operator()(const ScAddress& rAddr) const
-+ {
-+ // dumb hashing - how do we properly hash a cell address?
-+ return rAddr.Tab() + rAddr.Col() + rAddr.Row();
-+ }
-+ };
-+
-+ /** Shell instance for a source document. */
-+ struct SrcShell
-+ {
-+ SfxObjectShellRef maShell;
-+ Time maLastAccess;
-+ };
-+
-+ typedef ::boost::shared_ptr<ScToken> TokenRef;
-+ typedef ::boost::shared_ptr<ScTokenArray> TokenArrayRef;
-+
-+ typedef ::std::hash_map<sal_uInt16, SrcShell> DocShellMap;
-+ typedef ::std::hash_set<sal_uInt16> LinkedDocSet;
-+
-+ typedef ::std::hash_set<ScAddress, AddressHash, ::std::equal_to<ScAddress> > RefCellSet;
-+ typedef ::std::hash_map<sal_uInt16, RefCellSet> RefCellMap;
-+
-+public:
-+ /** Source document meta-data container. */
-+ struct SrcFileData
-+ {
-+ String maFileName;
-+ String maRelativeName;
-+ String maFilterName;
-+ String maFilterOptions;
-+ };
-+
-+public:
-+ explicit ScExternalRefManager(ScDocument* pDoc);
-+ ~ScExternalRefManager();
-+
-+ ScExternalRefCache::Table* getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew = true);
-+ void storeRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScTokenArray& rArray);
-+
-+ ScToken* getSingleRefToken(sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell, const ScAddress* pCurPos, SCTAB* pTab);
-+
-+ /**
-+ * Get an array of tokens that consist of the specified external cell
-+ * range.
-+ *
-+ * @param nFileId file ID for an external document
-+ * @param rTabName referenced sheet name
-+ * @param rRange referenced cell range
-+ * @param pCurPos current cursor position to keep track of cells that
-+ * reference an external data.
-+ *
-+ * @return pointer to a token array instance. <i>The caller must not
-+ * delete the instance returned by this method.</i>
-+ */
-+ ScTokenArray* getDoubleRefTokens(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos);
-+
-+ /**
-+ * Get an array of tokens corresponding with a specified name in a
-+ * specified file.
-+ *
-+ * @param pCurPos currnet cell address where this name token is used.
-+ * This is purely to keep track of all cells containing
-+ * external names for refreshing purposes. If this is
-+ * NULL, then the cell will not be added to the list.
-+ *
-+ * @return array of tokens composing the name
-+ */
-+ ScTokenArray* getRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos = NULL);
-+
-+ const String& getOwnDocumentName() const;
-+ bool isOwnDocument(const String& rFile) const;
-+
-+ /**
-+ * Takes a flat file name, and convert it to an absolute URL path. An
-+ * absolute URL path begines with 'file:///.
-+ *
-+ * @param rFile file name to convert
-+ */
-+ void convertToAbsName(String& rFile) const;
-+ sal_uInt16 getExternalFileId(const String& rFile);
-+ const String* getExternalFileName(sal_uInt16 nFileId) const;
-+ const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const;
-+
-+ const ::std::vector<String>* getAllCachedTableNames(sal_uInt16 nFileId) const;
-+ sal_uInt16 getCachedFileCount() const;
-+ void refreshNames(sal_uInt16 nFileId);
-+ void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile);
-+
-+ void setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl);
-+
-+ /**
-+ * Set the filter name and options if any for a given source document.
-+ * These values get reset whne the source document ever gets reloaded.
-+ *
-+ * @param nFileId
-+ * @param rFilterName
-+ * @param rOptions
-+ * @return
-+ */
-+ void setFilterData(sal_uInt16 nFileId, const String& rFilterName, const String& rOptions);
-+
-+ void removeSrcDocument(sal_uInt16 nFileId, bool bBreakLink);
-+ void clear();
-+
-+ bool hasExternalData() const;
-+
-+ /**
-+ * Re-generates relative names for all stored source files. This is
-+ * necessary when exporting to an ods document, to ensure that all source
-+ * files have their respective relative names for xlink:href export.
-+ */
-+ void resetSrcFileData();
-+
-+private:
-+ ScExternalRefManager();
-+ ScExternalRefManager(const ScExternalRefManager&);
-+
-+ void refreshAllReferencingCells(sal_uInt16 nFileId);
-+
-+ void insertReferencingCell(sal_uInt16 nFileId, const ScAddress& rCell);
-+
-+ ScDocument* getSrcDocument(sal_uInt16 nFileId);
-+ SfxObjectShellRef loadSrcDocument(sal_uInt16 nFileId, String& rFilter);
-+ bool isFileLoadable(const String& rFile) const;
-+
-+ void maybeLinkExternalFile(sal_uInt16 nFileId);
-+
-+ bool compileTokensByCell(const ScAddress& rCell);
-+
-+ /**
-+ * Purge those source document instances that have not been accessed for
-+ * the specified duration.
-+ *
-+ * @param nTimeOut time out value in 100th of a second
-+ */
-+ void purgeStaleSrcDocument(sal_Int32 nTimeOut);
-+
-+private:
-+ /** cache of referenced ranges and names from source documents. */
-+ ScExternalRefCache maRefCache;
-+
-+ ScDocument* mpDoc;
-+
-+ /**
-+ * Source document cache. This stores the original source document shell
-+ * instances. They get purged after a certain period of time.
-+ */
-+ DocShellMap maDocShells;
-+
-+ /** list of source documents that are managed by the link manager. */
-+ LinkedDocSet maLinkedDocs;
-+
-+ /**
-+ * List of referencing cells that may contain external names. There is
-+ * one list per source document.
-+ */
-+ RefCellMap maRefCells;
-+
-+ /** original source file index. */
-+ ::std::vector<SrcFileData> maSrcFiles;
-+
-+ AutoTimer maSrcDocTimer;
-+ DECL_LINK(TimeOutHdl, AutoTimer*);
-+};
-+
-+
-+#endif
-diff --git sc/inc/linkuno.hxx sc/inc/linkuno.hxx
-index b6fc524..926fed7 100644
---- sc/inc/linkuno.hxx
-+++ sc/inc/linkuno.hxx
-@@ -36,6 +36,9 @@
- #include <com/sun/star/sheet/XDDELink.hpp>
- #include <com/sun/star/sheet/XDDELinkResults.hpp>
- #include <com/sun/star/sheet/XDDELinks.hpp>
-+#include <com/sun/star/sheet/XExternalDocLink.hpp>
-+#include <com/sun/star/sheet/XExternalDocLinks.hpp>
-+#include <com/sun/star/sheet/XExternalSheetCache.hpp>
- #include <com/sun/star/sheet/XAreaLink.hpp>
- #include <com/sun/star/sheet/XAreaLinks.hpp>
- #include <com/sun/star/util/XRefreshable.hpp>
-@@ -45,10 +48,15 @@
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/container/XNamed.hpp>
-+#include <cppuhelper/implbase1.hxx>
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
- #include <cppuhelper/implbase5.hxx>
-
-+#include "externalrefmgr.hxx"
-+
-+#include <hash_map>
-+#include <vector>
-
- class ScAreaLink;
- class ScDocShell;
-@@ -493,8 +501,108 @@ public:
- throw(::com::sun::star::uno::RuntimeException);
- };
-
-+// ============================================================================
-+
-+class ScExternalSheetCacheObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalSheetCache >
-+{
-+public:
-+ explicit ScExternalSheetCacheObj(ScExternalRefCache::Table* pTable);
-+ ~ScExternalSheetCacheObj();
-+
-+ // XExternalSheetCache
-+ virtual void SAL_CALL setCellValue(
-+ sal_Int32 nRow, sal_Int32 nCol, const ::com::sun::star::uno::Any& rAny)
-+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Any SAL_CALL getCellValue(sal_Int32 nRow, sal_Int32 nCol)
-+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllRows()
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow)
-+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+
-+private:
-+ ScExternalSheetCacheObj();
-+ ScExternalSheetCacheObj(const ScExternalSheetCacheObj&);
-+
-+private:
-+ ScExternalRefCache::Table* mpTable;
-+};
-+
-+// ============================================================================
-+
-+class ScExternalDocLinkObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLink >
-+{
-+public:
-+ ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
-+ ~ScExternalDocLinkObj();
-+
-+ // XExternalDocLink
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
-+ SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+private:
-+ ScExternalRefManager* mpRefMgr;
-+ sal_uInt16 mnFileId;
-+};
-+
-+// ============================================================================
-
-+/** This is the UNO API equivalent of ScExternalRefManager. */
-+class ScExternalDocLinksObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLinks >
-+{
-+public:
-+ ScExternalDocLinksObj(ScDocShell* pDocShell);
-+ ~ScExternalDocLinksObj();
-
-+ // XExternalDocLinks
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >
-+ SAL_CALL addDocLink( const ::rtl::OUString& aDocName )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ // XNameAccess
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
-+ throw(::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
-+ throw(::com::sun::star::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
-+ throw(::com::sun::star::uno::RuntimeException);
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
-+ throw(::com::sun::star::lang::IndexOutOfBoundsException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // XEnumerationAccess
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
-+ createEnumeration() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
-+ throw(::com::sun::star::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
-+
-+private:
-+ ScExternalDocLinksObj();
-+ ScExternalDocLinksObj(const ScExternalDocLinksObj&);
-+
-+private:
-+ typedef ::std::hash_map<
-+ ::rtl::OUString,
-+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >,
-+ ::rtl::OUStringHash > DocLinkMap;
-+ DocLinkMap maDocLinks;
-+ ::std::vector< ::rtl::OUString > maDocNames;
-+ ScDocShell* mpDocShell;
-+ ScExternalRefManager* mpRefMgr;
-+};
-
- #endif
-
-diff --git sc/inc/opcode.hxx sc/inc/opcode.hxx
-index 285104d..b72ebad 100644
---- sc/inc/opcode.hxx
-+++ sc/inc/opcode.hxx
-@@ -44,6 +44,7 @@ enum OpCodeEnum
- ocStop = SC_OPCODE_STOP,
- ocExternal = SC_OPCODE_EXTERNAL,
- ocName = SC_OPCODE_NAME,
-+ ocExternalName = SC_OPCODE_EXTERNAL_NAME,
- // Jump commands
- ocIf = SC_OPCODE_IF,
- ocChose = SC_OPCODE_CHOSE,
-diff --git sc/inc/refdata.hxx sc/inc/refdata.hxx
-index 92d1320..9e83a45 100644
---- sc/inc/refdata.hxx
-+++ sc/inc/refdata.hxx
-@@ -116,6 +116,7 @@ struct SingleRefData // Single reference (one address) into the sheet
- BYTE CreateStoreByteFromFlags() const;
- void CreateFlagsFromLoadByte( BYTE );
- BOOL operator==( const SingleRefData& ) const;
-+ bool operator!=( const SingleRefData& ) const;
- };
-
- inline void SingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
-diff --git sc/inc/token.hxx sc/inc/token.hxx
-index ded3a94..7e49031 100644
---- sc/inc/token.hxx
-+++ sc/inc/token.hxx
-@@ -64,7 +64,7 @@ enum StackVarEnum
- // cell during import, having a double
- // and/or string result and a formula
- // string to be compiled.
--
-+ svExternalName,
- svError, // error token
- svMissing = 0x70, // 0 or ""
- svSep, // separator, ocSep, ocOpen, ocClose
-@@ -448,6 +448,69 @@ public:
- };
-
-
-+class ScExternalSingleRefToken : public ScOpToken
-+{
-+private:
-+ sal_uInt16 mnFileId;
-+ String maTabName;
-+ SingleRefData maSingleRef;
-+
-+ ScExternalSingleRefToken(); // disabled
-+public:
-+ ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& r );
-+ ScExternalSingleRefToken( const ScExternalSingleRefToken& r );
-+ virtual ~ScExternalSingleRefToken();
-+
-+ virtual USHORT GetIndex() const;
-+ virtual const String& GetString() const;
-+ virtual const SingleRefData& GetSingleRef() const;
-+ virtual SingleRefData& GetSingleRef();
-+ virtual BOOL operator==( const ScToken& rToken ) const;
-+};
-+
-+
-+class ScExternalDoubleRefToken : public ScOpToken
-+{
-+private:
-+ sal_uInt16 mnFileId;
-+ String maTabName; // name of the first sheet
-+ ComplRefData maDoubleRef;
-+
-+ ScExternalDoubleRefToken(); // disabled
-+public:
-+ ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& r );
-+ ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r );
-+ virtual ~ScExternalDoubleRefToken();
-+
-+ virtual USHORT GetIndex() const;
-+ virtual const String& GetString() const;
-+ virtual const SingleRefData& GetSingleRef() const;
-+ virtual SingleRefData& GetSingleRef();
-+ virtual const SingleRefData& GetSingleRef2() const;
-+ virtual SingleRefData& GetSingleRef2();
-+ virtual const ComplRefData& GetDoubleRef() const;
-+ virtual ComplRefData& GetDoubleRef();
-+ virtual BOOL operator==( const ScToken& rToken ) const;
-+};
-+
-+
-+class ScExternalNameToken : public ScOpToken
-+{
-+private:
-+ sal_uInt16 mnFileId;
-+ String maName;
-+private:
-+ ScExternalNameToken(); // disabled
-+public:
-+ ScExternalNameToken( sal_uInt16 nFileId, const String& rName );
-+ ScExternalNameToken( const ScExternalNameToken& r );
-+ virtual ~ScExternalNameToken();
-+ virtual USHORT GetIndex() const;
-+ virtual const String& GetString() const;
-+ virtual BOOL operator==( const ScToken& rToken ) const;
-+};
-+
-+
- class ScJumpToken : public ScOpToken
- {
- private:
-diff --git sc/inc/tokenarray.hxx sc/inc/tokenarray.hxx
-index 1d903ce..1e94c2f 100644
---- sc/inc/tokenarray.hxx
-+++ sc/inc/tokenarray.hxx
-@@ -193,6 +193,9 @@ public:
- ScToken* AddDoubleReference( const ComplRefData& rRef );
- ScToken* AddName( USHORT n );
- ScToken* AddMatrix( ScMatrix* p );
-+ ScToken* AddExternalName( sal_uInt16 nFileId, const String& rName );
-+ ScToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+ ScToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
- ScToken* AddExternal( const sal_Unicode* pStr );
- /** Xcl import may play dirty tricks with OpCode!=ocExternal.
- Others don't use! */
-diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index b2c45ac..51ebf60 100644
---- sc/inc/unonames.hxx
-+++ sc/inc/unonames.hxx
-@@ -47,6 +47,7 @@
- // document
- #define SC_UNO_AREALINKS "AreaLinks"
- #define SC_UNO_DDELINKS "DDELinks"
-+#define SC_UNO_EXTERNALDOCLINKS "ExternalDocLinks"
- #define SC_UNO_COLLABELRNG "ColumnLabelRanges"
- #define SC_UNO_DATABASERNG "DatabaseRanges"
- #define SC_UNO_NAMEDRANGES "NamedRanges"
-diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index 1c7ac08..4611515 100644
---- sc/source/core/data/cell.cxx
-+++ sc/source/core/data/cell.cxx
-@@ -689,7 +689,12 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
- for( ScToken* t = pCode->GetNextReferenceOrName(); t && !bCompile;
- t = pCode->GetNextReferenceOrName() )
- {
-- if ( t->GetType() == svIndex )
-+ if ( t->GetOpCode() == ocExternalName )
-+ {
-+ // External name, cell, and area references.
-+ bCompile = true;
-+ }
-+ else if ( t->GetType() == svIndex )
- {
- ScRangeData* pRangeData = pDoc->GetRangeName()->FindIndex( t->GetIndex() );
- if( pRangeData )
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index b75279e..d739a17 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -94,6 +94,7 @@
- #include "recursionhelper.hxx"
- #include "lookupcache.hxx"
- #include "tabprotection.hxx"
-+#include "externalrefmgr.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
-@@ -153,6 +154,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- pScriptTypeData( NULL ),
- pCacheFieldEditEngine( NULL ),
- pDocProtection( NULL ),
-+ pExternalRefMgr( NULL ),
- pViewOptions( NULL ),
- pDocOptions( NULL ),
- pExtDocOptions( NULL ),
-@@ -383,6 +385,11 @@ ScDocument::~ScDocument()
- pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() );
- }
-
-+ if (pExternalRefMgr.get())
-+ // Destroy the external ref mgr instance here because it has a timer
-+ // which needs to be stopped before the app closes.
-+ pExternalRefMgr.reset(NULL);
-+
- ScAddInAsync::RemoveDocument( this );
- ScAddInListener::RemoveDocument( this );
- delete pChartListenerCollection; // vor pBASM wg. evtl. Listener!
-diff --git sc/source/core/data/documen3.cxx sc/source/core/data/documen3.cxx
-index 541e2e4..20dae1e 100644
---- sc/source/core/data/documen3.cxx
-+++ sc/source/core/data/documen3.cxx
-@@ -61,6 +61,7 @@
- #include "brdcst.hxx"
- #include "bcaslot.hxx"
- #include "tablink.hxx"
-+#include "externalrefmgr.hxx"
- #include "markdata.hxx"
- #include "validat.hxx"
- #include "dociter.hxx"
-@@ -81,7 +82,10 @@
- #include "svtools/PasswordHelper.hxx"
- #include "tabprotection.hxx"
-
-+#include <memory>
-+
- using namespace com::sun::star;
-+using ::std::auto_ptr;
-
- //------------------------------------------------------------------------
-
-@@ -478,6 +482,14 @@ BOOL ScDocument::LinkExternalTab( SCTAB& rTab, const String& aDocTab,
- return TRUE;
- }
-
-+ScExternalRefManager* ScDocument::GetExternalRefManager()
-+{
-+ if (!pExternalRefMgr.get())
-+ pExternalRefMgr.reset(new ScExternalRefManager(this));
-+
-+ return pExternalRefMgr.get();
-+}
-+
- BOOL ScDocument::InsertLinkedEmptyTab( SCTAB& rnTab, const String& rFileName,
- const String& rFilterName, const String& rFilterOpt, const String& rTabName )
- {
-diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
-index fd09e93..719206e 100644
---- sc/source/core/data/documen8.cxx
-+++ sc/source/core/data/documen8.cxx
-@@ -91,6 +91,7 @@
- #include "markdata.hxx"
- #include "scmod.hxx"
- #include "printopt.hxx"
-+#include "externalrefmgr.hxx"
- #include "globstr.hrc"
- #include "sc.hrc"
-
-@@ -1062,6 +1063,33 @@ BOOL ScDocument::IsInLinkUpdate() const
- return bInLinkUpdate || IsInDdeLinkUpdate();
- }
-
-+void ScDocument::UpdateExternalRefLinks()
-+{
-+ if (!pLinkManager)
-+ return;
-+
-+ const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
-+ USHORT nCount = rLinks.Count();
-+
-+ bool bAny = false;
-+ for (USHORT i = 0; i < nCount; ++i)
-+ {
-+ ::sfx2::SvBaseLink* pBase = *rLinks[i];
-+ ScExternalRefLink* pRefLink = dynamic_cast<ScExternalRefLink*>(pBase);
-+ if (pRefLink)
-+ {
-+ pRefLink->Update();
-+ bAny = true;
-+ }
-+ }
-+ if (bAny)
-+ {
-+ TrackFormulas();
-+ pShell->Broadcast( SfxSimpleHint(FID_DATACHANGED) );
-+ ResetChanged( ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB) );
-+ }
-+}
-+
- void ScDocument::UpdateDdeLinks()
- {
- if (pLinkManager)
-diff --git sc/source/core/tool/address.cxx sc/source/core/tool/address.cxx
-index 2cb5dce..e518b27 100644
---- sc/source/core/tool/address.cxx
-+++ sc/source/core/tool/address.cxx
-@@ -35,6 +35,7 @@
- #include "global.hxx"
- #include "compiler.hxx"
- #include "document.hxx"
-+#include "externalrefmgr.hxx"
-
- #include "globstr.hrc"
- #include <sal/alloca.h>
-@@ -68,6 +69,49 @@ void ScAddress::Details::SetPos ( const ScDocument* pDoc,
-
- #include <iostream>
-
-+/**
-+ * Parse from the opening single quote to the closing single quote. Inside
-+ * the quotes, a single quote character is encoded by double single-quote
-+ * characters.
-+ *
-+ * @param p pointer to the first character to begin parsing.
-+ * @param rName (reference) parsed name within the quotes. If the name is
-+ * empty, either the parsing failed or it's an empty quote.
-+ *
-+ * @return pointer to the character immediately after the closing single
-+ * quote.
-+ */
-+static const sal_Unicode* lcl_ParseQuotedName( const sal_Unicode* p, String& rName )
-+{
-+ rName.Erase();
-+ if (*p != '\'')
-+ return p;
-+
-+ const sal_Unicode* pStart = p;
-+ sal_Unicode cPrev = 0;
-+ for (++p; *p; ++p)
-+ {
-+ if (*p == '\'')
-+ {
-+ if (cPrev == '\'')
-+ {
-+ // double single-quote equals one single quote.
-+ rName += *p;
-+ cPrev = 0;
-+ continue;
-+ }
-+ }
-+ else if (cPrev == '\'')
-+ // We are past the closing quote. We're done!
-+ return p;
-+ else
-+ rName += *p;
-+ cPrev = *p;
-+ }
-+ rName.Erase();
-+ return pStart;
-+}
-+
- static long int
- sal_Unicode_strtol ( const sal_Unicode* p,
- const sal_Unicode** pEnd )
-@@ -102,31 +146,18 @@ sal_Unicode_strtol ( const sal_Unicode* p,
- // Returns NULL if the string should be a sheet name, but is invalid
- // Returns a pointer to the first character after the sheet name
- static const sal_Unicode *
--lcl_XL_ParseSheetRef( const sal_Unicode *start,
-- ScAddress *pAddr,
-- const ScDocument* pDoc,
-- const String& rDocName,
-+lcl_XL_ParseSheetRef( const sal_Unicode* start,
- String& rExternTabName,
- bool allow_3d )
- {
- String aTabName;
-- SCTAB nTab = 0;
- const sal_Unicode *p = start;
-
- //pAddr->SetTab( 0 );
- if( *p == '\'' ) // XL only seems to use single quotes for sheet names
- {
-- for( p++; *p ; )
-- {
-- if( *p == '\'' )
-- {
-- if( p[1] != '\'' ) // end quote
-- break;
-- p++; // 2 quotes in a row are a quote in a the name
-- }
-- aTabName += *p++;
-- }
-- if( *p++ != '\'' )
-+ p = lcl_ParseQuotedName(p, aTabName);
-+ if (!aTabName.Len())
- return NULL;
- }
- else
-@@ -190,26 +221,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode *start,
- aTabName.Append( start, sal::static_int_cast<xub_StrLen>( p - start ) );
- }
-
-- if( pDoc )
-- {
-- if( rDocName.Len() > 0 )
-- {
-- // This is a simplification of the OOo code which does an
-- // optimization to manually construct the DocTab before calling
-- // GetDocTabName
-- String aDocTab = ScGlobal::GetDocTabName( rDocName, aTabName );
-- if( !pDoc->GetTable( aDocTab, nTab ) &&
-- pDoc->ValidTabName( aTabName ) &&
-- !pDoc->GetTable( aDocTab, nTab ) )
-- {
-- rExternTabName = aDocTab;
-- }
-- }
-- else if( !pDoc->GetTable( aTabName, nTab ) )
-- return start;
-- }
--
-- pAddr->SetTab( nTab );
-+ rExternTabName = aTabName;
- return p;
- }
-
-@@ -227,39 +239,33 @@ lcl_ScRange_Parse_XL_Header( ScRange& r,
- // Is this an external reference ?
- rStartTabName.Erase();
- rEndTabName.Erase();
-- if( *p == '[' )
-+ rExternDocName.Erase();
-+ if (*p == '[')
- {
-- p++;
-- // TODO : Get more detail on how paths are quoted
-- // 1) I suspect only single quote is correct
-- // 2) check whether this is another doubled quote rather than a
-- // backslash
-- if( *p == '\'' || *p == '\"' )
-+ ++p;
-+ // Only single quotes are correct, and a double single quote escapes a
-+ // single quote text inside the quoted text.
-+ if (*p == '\'')
- {
-- for( const sal_Unicode cQuote = *p++; *p && *p != cQuote ; )
-- {
-- if( *p == '\\' && p[1] )
-- p++;
-- rExternDocName += *p++;
-- }
-+ p = lcl_ParseQuotedName(p, rExternDocName);
-+ if (!*p || *p != ']' || !rExternDocName.Len())
-+ return start;
- }
- else
- {
-+ // non-quoted file name.
- p = ScGlobal::UnicodeStrChr( start+1, ']' );
- if( p == NULL )
- return start;
- rExternDocName.Append( start+1, sal::static_int_cast<xub_StrLen>( p-(start+1) ) );
- }
-
-- rExternDocName = ScGlobal::GetAbsDocName( rExternDocName,
-- pDoc->GetDocumentShell() );
-- if( *p != ']' )
-- return start;
-- p++;
-+ rExternDocName = ScGlobal::GetAbsDocName(rExternDocName, pDoc->GetDocumentShell());
-+ ++p;
- }
-
- startTabs = p;
-- p = lcl_XL_ParseSheetRef( p, &r.aStart, pDoc, rExternDocName, rStartTabName, TRUE );
-+ p = lcl_XL_ParseSheetRef( p, rStartTabName, TRUE );
- if( NULL == p )
- return start; // invalid tab
- if( p != startTabs )
-@@ -267,7 +273,7 @@ lcl_ScRange_Parse_XL_Header( ScRange& r,
- nFlags |= SCA_VALID_TAB | SCA_TAB_3D | SCA_TAB_ABSOLUTE;
- if( *p == ':' ) // 3d ref
- {
-- p = lcl_XL_ParseSheetRef( p+1, &r.aEnd, pDoc, rExternDocName, rEndTabName, FALSE );
-+ p = lcl_XL_ParseSheetRef( p+1, rEndTabName, FALSE );
- if( p == NULL )
- return start; // invalid tab
- nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE;
-@@ -289,45 +295,36 @@ lcl_ScRange_Parse_XL_Header( ScRange& r,
- // Use the current tab, it needs to be passed in. : r.aEnd.SetTab( .. );
- }
-
-- return p;
--}
--
--static USHORT
--lcl_XL_LinkSheetRef( ScRange& r,
-- ScDocument* pDoc,
-- const String& rExternDocName,
-- const String& rStartTabName,
-- const String& rEndTabName,
-- USHORT nFlags )
--{
-- SCTAB nTab;
--
-- if( rExternDocName.Len() > 0 )
-+ if (!rExternDocName.Len())
- {
-- String aDocName = ScGlobal::GetAbsDocName( rExternDocName,
-- pDoc->GetDocumentShell() );
-+ // Internal reference.
-+ if (!rStartTabName.Len())
-+ return start;
-
-- String aDocTab;
--
-- aDocTab = ScGlobal::GetDocTabName( aDocName, rStartTabName );
-- if( !pDoc->LinkExternalTab( nTab, aDocTab, rExternDocName, rStartTabName ) )
-- return 0;
-- r.aStart.SetTab( nTab );
-+ SCTAB nTab;
-+ if (!pDoc->GetTable(rStartTabName, nTab))
-+ {
-+ // invalid table name.
-+ nFlags &= ~SCA_VALID_TAB;
-+ nTab = -1;
-+ }
-+
-+ r.aStart.SetTab(nTab);
-+ r.aEnd.SetTab(nTab);
-
-- if( rEndTabName.Len() > 0 &&
-- rStartTabName != rEndTabName )
-+ if (rEndTabName.Len())
- {
-- aDocTab = ScGlobal::GetDocTabName( aDocName, rEndTabName );
-- if( !pDoc->LinkExternalTab( nTab, aDocTab, rExternDocName, rEndTabName ) )
-- {
-- DBG_ASSERT( r.IsValid(), "lcl_XL_LinkSheetRef - unable to link endTab of 3d ref" );
-- return 0;
-+ if (!pDoc->GetTable(rEndTabName, nTab))
-+ {
-+ // invalid table name.
-+ nFlags &= ~SCA_VALID_TAB2;
-+ nTab = -1;
- }
-+
-+ r.aEnd.SetTab(nTab);
- }
-- r.aEnd.SetTab( nTab );
- }
--
-- return nFlags;
-+ return p;
- }
-
-
-@@ -427,7 +424,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- const sal_Unicode* p,
- ScDocument* pDoc,
- const ScAddress::Details& rDetails,
-- BOOL bOnlyAcceptSingle )
-+ BOOL bOnlyAcceptSingle, ScAddress::ExternalInfo* pExtInfo )
- {
- const sal_Unicode* pTmp = NULL;
- String aExternDocName, aStartTabName, aEndTabName;
-@@ -442,6 +439,18 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- #endif
- p = lcl_ScRange_Parse_XL_Header( r, p, pDoc,
- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+
-+ if (aExternDocName.Len() > 0)
-+ {
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ if (pExtInfo && !pRefMgr->isOwnDocument(aExternDocName))
-+ {
-+ pExtInfo->mbExternal = true;
-+ pExtInfo->maTabName = aStartTabName;
-+ pExtInfo->mnFileId = pRefMgr->getExternalFileId(aExternDocName);
-+ }
-+ }
-+
- if( NULL == p )
- return 0;
-
-@@ -480,8 +489,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- r.aStart.SetCol( 0 );
- r.aEnd.SetCol( MAXCOL );
-
-- return bOnlyAcceptSingle ? 0 : lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return bOnlyAcceptSingle ? 0 : nFlags;
- }
- else if( NULL == (p = lcl_r1c1_get_col( p, rDetails, &r.aStart, &nFlags )))
- goto failed;
-@@ -501,8 +509,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- return nFlags;
- }
-
-- return bOnlyAcceptSingle ? lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags ) : 0;
-+ return bOnlyAcceptSingle ? nFlags : 0;
- }
- p = pTmp;
-
-@@ -517,8 +524,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- }
-
- nFlags |= (nFlags2 << 4);
-- return bOnlyAcceptSingle ? 0 : lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return bOnlyAcceptSingle ? 0 : nFlags;
- }
- else if( *p == 'C' || *p == 'c' ) // full col C#
- {
-@@ -550,8 +556,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
- r.aStart.SetRow( 0 );
- r.aEnd.SetRow( MAXROW );
-
-- return bOnlyAcceptSingle ? 0 : lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return bOnlyAcceptSingle ? 0 : nFlags;
- }
-
- failed :
-@@ -604,7 +609,8 @@ static USHORT
- lcl_ScRange_Parse_XL_A1( ScRange& r,
- const sal_Unicode* p,
- ScDocument* pDoc,
-- BOOL bOnlyAcceptSingle )
-+ BOOL bOnlyAcceptSingle,
-+ ScAddress::ExternalInfo* pExtInfo )
- {
- const sal_Unicode* tmp1, *tmp2;
- String aExternDocName, aStartTabName, aEndTabName; // for external link table
-@@ -619,6 +625,18 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- #endif
- p = lcl_ScRange_Parse_XL_Header( r, p, pDoc,
- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+
-+ if (aExternDocName.Len() > 0)
-+ {
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ if (pExtInfo && !pRefMgr->isOwnDocument(aExternDocName))
-+ {
-+ pExtInfo->mbExternal = true;
-+ pExtInfo->maTabName = aStartTabName;
-+ pExtInfo->mnFileId = pRefMgr->getExternalFileId(aExternDocName);
-+ }
-+ }
-+
- if( NULL == p )
- return 0;
-
-@@ -640,8 +658,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- SCA_VALID_COL | SCA_VALID_COL2 |
- SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE;
- nFlags |= (nFlags2 << 4);
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
- }
-
- tmp2 = lcl_a1_get_row( tmp1, &r.aStart, &nFlags );
-@@ -661,8 +678,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- SCA_VALID_ROW | SCA_VALID_ROW2 |
- SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE;
- nFlags |= (nFlags2 << 4);
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
- }
-
- // prepare as if it's a singleton, in case we want to fall back */
-@@ -672,8 +688,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- if ( bOnlyAcceptSingle )
- {
- if ( *tmp2 == 0 )
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
- else
- {
- // any trailing invalid character must invalidate the address.
-@@ -692,12 +707,11 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- p = tmp2;
- tmp1 = lcl_a1_get_col( p+1, &r.aEnd, &nFlags2 );
- if( !tmp1 ) // strange, but valid singleton
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
-+
- tmp2 = lcl_a1_get_row( tmp1, &r.aEnd, &nFlags2 );
- if( !tmp2 ) // strange, but valid singleton
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
-
- if ( *tmp2 != 0 )
- {
-@@ -708,45 +722,31 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
- }
-
- nFlags |= (nFlags2 << 4);
-- return lcl_XL_LinkSheetRef( r, pDoc,
-- aExternDocName, aStartTabName, aEndTabName, nFlags );
-+ return nFlags;
- }
-
- static USHORT
--lcl_ScAddress_Parse_OOo( BOOL& bExternal, const sal_Unicode* p,
-- ScDocument* pDoc, ScAddress& rAddr )
-+lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr,
-+ ScAddress::ExternalInfo* pExtInfo = NULL )
- {
- USHORT nRes = 0;
- String aDocName; // der pure Dokumentenname
-- String aDocTab; // zusammengesetzt fuer Table
- String aTab;
- BOOL bExtDoc = FALSE;
-- BOOL bNeedExtTab = FALSE;
-+ const ScAddress aCurPos(rAddr);
-
-- // Lets see if this is a reference to something in an external file.
-- // A Documentname is always quoted and has a trailing #
-- if ( *p == '\'' && ScGlobal::UnicodeStrChr( p, SC_COMPILER_FILE_TAB_SEP ) )
-+ // Lets see if this is a reference to something in an external file. A
-+ // document name is always quoted and has a trailing #.
-+ if (*p == '\'')
- {
-- const sal_Unicode *pStart = p;
-- BOOL bQuote = TRUE; // A Documentname is always quoted
-- aDocTab += *p++;
-- while ( bQuote && *p )
-- {
-- if ( *p == '\'' && *(p-1) != '\\' )
-- bQuote = FALSE;
-- else if( !(*p == '\\' && *(p+1) == '\'') )
-- aDocName += *p; // An escaped Quote in the Documentname
-- aDocTab += *p++;
-- }
-- aDocTab += *p; // den SC_COMPILER_FILE_TAB_SEP mitnehmen
-- if( *p++ == SC_COMPILER_FILE_TAB_SEP )
-- bExtDoc = TRUE;
-+ const sal_Unicode* pStart = p;
-+ p = lcl_ParseQuotedName(p, aDocName);
-+ if (*p++ == SC_COMPILER_FILE_TAB_SEP)
-+ bExtDoc = true;
- else
-- {
-- // It wasn't a document after all, reset and continue as normal
-+ // This is not a document name. Perhaps a quoted relative table
-+ // name.
- p = pStart;
-- aDocTab = String();
-- }
- }
-
- SCCOL nCol = 0;
-@@ -762,25 +762,11 @@ lcl_ScAddress_Parse_OOo( BOOL& bExternal, const sal_Unicode* p,
- if (*p == '$')
- nRes |= SCA_TAB_ABSOLUTE, p++;
-
-- // Tokens that start at ' can have anything in them until a final '
-- // but '' marks an escaped '
-- // We've earlier guaranteed that a string containing '' will be
-- // surrounded by '
-- if( *p == '\'' )
-- {
-- ++p;
-- while (*p)
-- {
-- if (*p == '\'')
-- {
-- if ( (*(p+1) != '\'') )
-- break;
-- else
-- *p++;
-- }
-- aTab += *p++;
-- }
-- }
-+ if (*p == '\'')
-+ // Tokens that start at ' can have anything in them until a final
-+ // ' but '' marks an escaped '. We've earlier guaranteed that a
-+ // string containing '' will be surrounded by '.
-+ p = lcl_ParseQuotedName(p, aTab);
-
- while (*p)
- {
-@@ -795,35 +781,11 @@ lcl_ScAddress_Parse_OOo( BOOL& bExternal, const sal_Unicode* p,
- }
- if( *p++ != '.' )
- nBits = 0;
-- if ( pDoc )
-+
-+ if (pDoc)
- {
-- if ( bExtDoc )
-- {
-- bExternal = TRUE;
-- aDocTab += aTab; // "'Doc'#Tab"
-- if ( !pDoc->GetTable( aDocTab, nTab ) )
-- {
-- if ( pDoc->ValidTabName( aTab ) )
-- {
-- aDocName = ScGlobal::GetAbsDocName( aDocName,
-- pDoc->GetDocumentShell() );
-- aDocTab = ScGlobal::GetDocTabName( aDocName, aTab );
-- if ( !pDoc->GetTable( aDocTab, nTab ) )
-- {
-- // erst einfuegen, wenn Rest der Ref ok
-- bNeedExtTab = TRUE;
-- nBits = 0;
-- }
-- }
-- else
-- nBits = 0;
-- }
-- }
-- else
-- {
-- if ( !pDoc->GetTable( aTab, nTab ) )
-- nBits = 0;
-- }
-+ if ( !pDoc->GetTable( aTab, nTab ) )
-+ nBits = 0;
- }
- else
- nBits = 0;
-@@ -884,16 +846,31 @@ lcl_ScAddress_Parse_OOo( BOOL& bExternal, const sal_Unicode* p,
- if( !nBits )
- p = q;
- }
-- if ( bNeedExtTab )
-+
-+ if (bExtDoc)
- {
-- if ( (nRes & SCA_VALID_ROW) && (nRes & SCA_VALID_COL)
-- && pDoc->LinkExternalTab( nTab, aDocTab, aDocName, aTab ) )
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ pRefMgr->convertToAbsName(aDocName);
-+
-+ if (!pRefMgr->isOwnDocument(aDocName))
- {
-- nRes |= SCA_VALID_TAB;
-+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(aDocName);
-+ if (pExtInfo && !pExtInfo->mbExternal)
-+ {
-+ pExtInfo->mbExternal = true;
-+ pExtInfo->maTabName = aTab;
-+ pExtInfo->mnFileId = nFileId;
-+ }
-+
-+ if (pRefMgr->getSingleRefToken(nFileId, aTab, ScAddress(nCol, nRow, 0), NULL, &nTab))
-+ {
-+ nRes |= SCA_VALID_TAB;
-+ }
-+ else
-+ nRes = 0;
- }
-- else
-- nRes = 0; // #NAME? statt #REF!, Dateiname bleibt erhalten
- }
-+
- if ( !(nRes & SCA_VALID_ROW) && (nRes & SCA_VALID_COL)
- && !( (nRes & SCA_TAB_3D) && (nRes & SCA_VALID_TAB)) )
- { // keine Row, keine Tab, aber Col => DM (...), B (...) o.ae.
-@@ -912,9 +889,8 @@ lcl_ScAddress_Parse_OOo( BOOL& bExternal, const sal_Unicode* p,
- }
-
- static USHORT
--lcl_ScAddress_Parse ( BOOL& bExternal, const sal_Unicode* p,
-- ScDocument* pDoc, ScAddress& rAddr,
-- const ScAddress::Details& rDetails )
-+lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr,
-+ const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo = NULL )
- {
- if( !*p )
- return 0;
-@@ -924,20 +900,20 @@ lcl_ScAddress_Parse ( BOOL& bExternal, const sal_Unicode* p,
- default :
- case ScAddress::CONV_OOO:
- {
-- return lcl_ScAddress_Parse_OOo( bExternal, p, pDoc, rAddr );
-+ return lcl_ScAddress_Parse_OOo( p, pDoc, rAddr, pExtInfo );
- }
-
- case ScAddress::CONV_XL_A1:
- {
- ScRange r = rAddr;
-- USHORT nFlags = lcl_ScRange_Parse_XL_A1( r, p, pDoc, TRUE );
-+ USHORT nFlags = lcl_ScRange_Parse_XL_A1( r, p, pDoc, TRUE, pExtInfo );
- rAddr = r.aStart;
- return nFlags;
- }
- case ScAddress::CONV_XL_R1C1:
- {
- ScRange r = rAddr;
-- USHORT nFlags = lcl_ScRange_Parse_XL_R1C1( r, p, pDoc, rDetails, TRUE );
-+ USHORT nFlags = lcl_ScRange_Parse_XL_R1C1( r, p, pDoc, rDetails, TRUE, pExtInfo );
- rAddr = r.aStart;
- return nFlags;
- }
-@@ -949,9 +925,8 @@ bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
- SCTAB nDefTab, ScRefAddress& rRefAddress,
- const ScAddress::Details& rDetails )
- {
-- BOOL bExternal = FALSE;
- ScAddress aAddr( 0, 0, nDefTab );
-- USHORT nRes = lcl_ScAddress_Parse( bExternal, rRefString.GetBuffer(), pDoc, aAddr, rDetails );
-+ USHORT nRes = lcl_ScAddress_Parse( rRefString.GetBuffer(), pDoc, aAddr, rDetails, NULL );
- if( nRes & SCA_VALID )
- {
- rRefAddress.Set( aAddr,
-@@ -988,10 +963,9 @@ bool ConvertDoubleRef( ScDocument* pDoc, const String& rRefString, SCTAB nDefTab
-
-
- USHORT ScAddress::Parse( const String& r, ScDocument* pDoc,
-- const Details& rDetails)
-+ const Details& rDetails, ExternalInfo* pExtInfo )
- {
-- BOOL bExternal = FALSE;
-- return lcl_ScAddress_Parse( bExternal, r.GetBuffer(), pDoc, *this, rDetails );
-+ return lcl_ScAddress_Parse( r.GetBuffer(), pDoc, *this, rDetails, pExtInfo );
- }
-
-
-@@ -1060,7 +1034,7 @@ void ScRange::ExtendTo( const ScRange& rRange )
- }
-
- static USHORT
--lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc )
-+lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc, ScAddress::ExternalInfo* pExtInfo = NULL )
- {
- USHORT nRes1 = 0, nRes2 = 0;
- xub_StrLen nTmp = 0;
-@@ -1073,13 +1047,12 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc )
- String aTmp( r );
- sal_Unicode* p = aTmp.GetBufferAccess();
- p[ nPos ] = 0;
-- BOOL bExternal = FALSE;
-- if( (nRes1 = lcl_ScAddress_Parse_OOo( bExternal, p, pDoc, aRange.aStart ) ) != 0 )
-+ if( (nRes1 = lcl_ScAddress_Parse_OOo( p, pDoc, aRange.aStart, pExtInfo ) ) != 0 )
- {
- aRange.aEnd = aRange.aStart; // die Tab _muss_ gleich sein, so ist`s weniger Code
-- if ( (nRes2 = lcl_ScAddress_Parse_OOo( bExternal, p + nPos+ 1, pDoc, aRange.aEnd ) ) != 0 )
-+ if ( (nRes2 = lcl_ScAddress_Parse_OOo( p + nPos+ 1, pDoc, aRange.aEnd, NULL ) ) != 0 )
- {
-- if ( bExternal && aRange.aStart.Tab() != aRange.aEnd.Tab() )
-+ if ( pExtInfo && pExtInfo->mbExternal && aRange.aStart.Tab() != aRange.aEnd.Tab() )
- nRes2 &= ~SCA_VALID_TAB; // #REF!
- else
- {
-@@ -1132,7 +1105,7 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc )
- }
-
- USHORT ScRange::Parse( const String& r, ScDocument* pDoc,
-- const ScAddress::Details& rDetails )
-+ const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo )
- {
- if ( r.Len() <= 0 )
- return 0;
-@@ -1141,13 +1114,13 @@ USHORT ScRange::Parse( const String& r, ScDocument* pDoc,
- {
- default :
- case ScAddress::CONV_OOO:
-- return lcl_ScRange_Parse_OOo( *this, r, pDoc );
-+ return lcl_ScRange_Parse_OOo( *this, r, pDoc, pExtInfo );
-
- case ScAddress::CONV_XL_A1:
-- return lcl_ScRange_Parse_XL_A1( *this, r.GetBuffer(), pDoc, FALSE );
-+ return lcl_ScRange_Parse_XL_A1( *this, r.GetBuffer(), pDoc, FALSE, pExtInfo );
-
- case ScAddress::CONV_XL_R1C1:
-- return lcl_ScRange_Parse_XL_R1C1( *this, r.GetBuffer(), pDoc, rDetails, FALSE );
-+ return lcl_ScRange_Parse_XL_R1C1( *this, r.GetBuffer(), pDoc, rDetails, FALSE, pExtInfo );
- }
- }
-
-diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index 918332d..d9b0549 100644
---- sc/source/core/tool/compiler.cxx
-+++ sc/source/core/tool/compiler.cxx
-@@ -74,9 +74,11 @@
- #include "errorcodes.hxx"
- #include "parclass.hxx"
- #include "autonamecache.hxx"
-+#include "externalrefmgr.hxx"
-
- using namespace ::com::sun::star;
- using rtl::OUString;
-+using ::std::vector;
-
- #if OSL_DEBUG_LEVEL > 1
- // For some unknown reason the identical dbg_dump utilities in
-@@ -1191,7 +1193,7 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
- {
- rRes.TokenType = KParseType::SINGLE_QUOTE_NAME;
- rRes.EndPos = nPos+1;
-- return false;
-+ return true;
- }
- ++nPos;
- }
-@@ -1199,9 +1201,197 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
- }
- }
-
-+ return false;
-+}
-+
-+static bool lcl_parseExternalName( const String& rSymbol, String& rFile, String& rName, const sal_Unicode cSep )
-+{
-+ const sal_Unicode* p = rSymbol.GetBuffer();
-+ xub_StrLen nLen = rSymbol.Len();
-+ sal_Unicode cPrev = 0;
-+ String aTmpFile, aTmpName;
-+ bool bInName = false;
-+ for (xub_StrLen i = 0; i < nLen; ++i, ++p)
-+ {
-+ sal_Unicode c = *p;
-+ if (i == 0)
-+ {
-+ if (c == '.' || c == cSep)
-+ return false;
-+
-+ if (c == '\'')
-+ {
-+ // Move to the next chart and loop until the second single
-+ // quote.
-+ cPrev = c;
-+ ++i; ++p;
-+ for (xub_StrLen j = i; j < nLen; ++j, ++p)
-+ {
-+ c = *p;
-+ if (c == '\'')
-+ {
-+ if (j == i)
-+ {
-+ // empty quote e.g. (=''!Name)
-+ return false;
-+ }
-+
-+ if (cPrev == '\'')
-+ {
-+ // two consecutive quotes equals a single
-+ // quote in the file name.
-+ aTmpFile.Append(c);
-+ cPrev = 'a';
-+ }
-+ else
-+ cPrev = c;
-+
-+ continue;
-+ }
-+
-+ if (cPrev == '\'' && j != i)
-+ {
-+ // this is not a quote but the previous one
-+ // is. This ends the parsing of the quoted
-+ // segment.
-+
-+ i = j;
-+ bInName = true;
-+ break;
-+ }
-+ aTmpFile.Append(c);
-+ cPrev = c;
-+ }
-+
-+ if (!bInName)
-+ {
-+ // premature ending of the quoted segment.
-+ return false;
-+ }
-+
-+ if (c != cSep)
-+ {
-+ // only the separator is allowed after the closing quote.
-+ return false;
-+ }
-+
-+ cPrev = c;
-+ continue;
-+ }
-+ }
-+
-+ if (bInName)
-+ {
-+ if (c == cSep)
-+ {
-+ // A second separator ? Not a valid external name.
-+ return false;
-+ }
-+ aTmpName.Append(c);
-+ }
-+ else
-+ {
-+ if (c == cSep)
-+ {
-+ bInName = true;
-+ }
-+ else
-+ {
-+ do
-+ {
-+ if (CharClass::isAsciiAlphaNumeric(c))
-+ // allowed.
-+ break;
-+
-+ if (c > 128)
-+ // non-ASCII character is allowed.
-+ break;
-+
-+ bool bValid = false;
-+ switch (c)
-+ {
-+ case '_':
-+ case '-':
-+ case '.':
-+ // these special characters are allowed.
-+ bValid = true;
-+ break;
-+ }
-+ if (bValid)
-+ break;
-+
-+ return false;
-+ }
-+ while (false);
-+ aTmpFile.Append(c);
-+ }
-+ }
-+ cPrev = c;
-+ }
-+
-+ if (!bInName)
-+ {
-+ // No name found - most likely the symbol has no '!'s.
-+ return false;
-+ }
-+
-+ rFile = aTmpFile;
-+ rName = aTmpName;
-+ return true;
-+}
-+
-+static String lcl_makeExternalNameStr( const String& rFile, const String& rName, const sal_Unicode cSep )
-+{
-+ String aStr, aFile = rFile;
-+ aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
-+ aStr.Append(sal_Unicode('\''));
-+ aStr.Append(aFile);
-+ aStr.Append(sal_Unicode('\''));
-+ aStr.Append(cSep);
-+ aStr.Append(rName);
-+ return aStr;
-+}
-+
-+static bool lcl_getLastTabName( String& rTabName2, const String& rTabName1,
-+ const vector<String>& rTabNames, const ComplRefData& rRef )
-+{
-+ SCsTAB nTabSpan = rRef.Ref2.nTab - rRef.Ref1.nTab;
-+ if (nTabSpan > 0)
-+ {
-+ size_t nCount = rTabNames.size();
-+ vector<String>::const_iterator itrBeg = rTabNames.begin(), itrEnd = rTabNames.end();
-+ vector<String>::const_iterator itr = ::std::find(itrBeg, itrEnd, rTabName1);
-+ if (itr == rTabNames.end())
-+ {
-+ rTabName2 = ScGlobal::GetRscString(STR_NO_REF_TABLE);
-+ return false;
-+ }
-+
-+ size_t nDist = ::std::distance(itrBeg, itr);
-+ if (nDist + static_cast<size_t>(nTabSpan) >= nCount)
-+ {
-+ rTabName2 = ScGlobal::GetRscString(STR_NO_REF_TABLE);
-+ return false;
-+ }
-+
-+ rTabName2 = rTabNames[nDist+nTabSpan];
-+ }
-+ else
-+ rTabName2 = rTabName1;
-+
- return true;
- }
-
-+static void lcl_appendTabName(::rtl::OUStringBuffer& rBuffer, const String& rTabName)
-+{
-+ bool bQuote = (rTabName.Search(sal_Unicode(' '), 0) != STRING_NOTFOUND);
-+ if (bQuote)
-+ rBuffer.append(sal_Unicode('\''));
-+ rBuffer.append(rTabName);
-+ if (bQuote)
-+ rBuffer.append(sal_Unicode('\''));
-+}
-+
- struct Convention_A1 : public ScCompiler::Convention
- {
- Convention_A1( ScAddress::Convention eConv ) : ScCompiler::Convention( eConv ) { }
-@@ -1215,14 +1405,14 @@ struct Convention_A1 : public ScCompiler::Convention
- const CharClass* pCharClass) const
- {
- ParseResult aRet;
-- if ( !lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
-+ if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
- return aRet;
-
- static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
- KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR;
- static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT;
- // '?' allowed in range names because of Xcl :-/
-- static const String aAddAllowed( '?' );
-+ static const String aAddAllowed(String::CreateFromAscii("?#"));
- return pCharClass->parseAnyToken( rFormula,
- nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
- }
-@@ -1405,6 +1595,86 @@ struct ConventionOOO_A1 : public Convention_A1
-
- return sal_Unicode(0);
- }
-+
-+ virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName ) const
-+ {
-+ return lcl_parseExternalName(rSymbol, rFile, rName, sal_Unicode('#'));
-+ }
-+
-+ virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
-+ {
-+ return lcl_makeExternalNameStr(rFile, rName, sal_Unicode('#'));
-+ }
-+
-+ bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId,
-+ const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr, bool bDisplayTabName ) const
-+ {
-+ if (bDisplayTabName)
-+ {
-+ String aFile;
-+ const String* p = pRefMgr->getExternalFileName(nFileId);
-+ if (p)
-+ aFile = *p;
-+ aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
-+
-+ rBuffer.append(sal_Unicode('\''));
-+ rBuffer.append(aFile);
-+ rBuffer.append(sal_Unicode('\''));
-+ rBuffer.append(sal_Unicode('#'));
-+
-+ // external reference is always 3D and the sheet is absolute.
-+ rBuffer.append(sal_Unicode('$'));
-+ lcl_appendTabName(rBuffer, rTabName);
-+
-+ rBuffer.append(sal_Unicode('.'));
-+ }
-+
-+ if (!rRef.IsColRel())
-+ rBuffer.append(sal_Unicode('$'));
-+ rBuffer.append(MakeColStr(rRef.nCol));
-+ if (!rRef.IsRowRel())
-+ rBuffer.append(sal_Unicode('$'));
-+ rBuffer.append(MakeRowStr(rRef.nRow));
-+
-+ return true;
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ SingleRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ ComplRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true))
-+ return;
-+
-+ rBuffer.append(sal_Unicode(':'));
-+
-+ // Get the name of the last table.
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ return;
-+
-+ String aLastTabName;
-+ if (!lcl_getLastTabName(aLastTabName, rTabName, *pTabNames, aRef))
-+ {
-+ rBuffer.append(aLastTabName);
-+ return;
-+ }
-+ makeExternalSingleRefStr(rBuffer, nFileId, aLastTabName, aRef.Ref2, pRefMgr, (aRef.Ref1.nTab != aRef.Ref2.nTab));
-+ }
- };
-
-
-@@ -1526,11 +1796,128 @@ struct ConventionXL
- }
- return sal_Unicode(0);
- }
-+
-+ static bool parseExternalName( const String& rSymbol, String& rFile, String& rName )
-+ {
-+ return lcl_parseExternalName(rSymbol, rFile, rName, sal_Unicode('!'));
-+ }
-+
-+ static String makeExternalNameStr( const String& rFile, const String& rName )
-+ {
-+ return lcl_makeExternalNameStr(rFile, rName, sal_Unicode('!'));
-+ }
-+
-+ static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName )
-+ {
-+ // Format that is easier to deal with inside OOo, because we use file
-+ // URL, and all characetrs are allowed. Check if it makes sense to do
-+ // it the way Gnumeric does it. Gnumeric doesn't use the URL form
-+ // and allows relative file path.
-+ //
-+ // ['file:///path/to/source/filename.xls']
-+
-+ rBuffer.append(sal_Unicode('['));
-+ rBuffer.append(sal_Unicode('\''));
-+ const sal_Unicode* pBuf = rFullName.GetBuffer();
-+ xub_StrLen nLen = rFullName.Len();
-+ for (xub_StrLen i = 0; i < nLen; ++i)
-+ {
-+ const sal_Unicode c = pBuf[i];
-+ if (c == sal_Unicode('\''))
-+ rBuffer.append(c);
-+ rBuffer.append(c);
-+ }
-+ rBuffer.append(sal_Unicode('\''));
-+ rBuffer.append(sal_Unicode(']'));
-+ }
-+
-+ static void makeExternalTabNameRange( ::rtl::OUStringBuffer& rBuf, const String& rTabName,
-+ const vector<String>& rTabNames,
-+ const ComplRefData& rRef )
-+ {
-+ String aLastTabName;
-+ if (!lcl_getLastTabName(aLastTabName, rTabName, rTabNames, rRef))
-+ {
-+ rBuf.append(aLastTabName);
-+ return;
-+ }
-+
-+ lcl_appendTabName(rBuf, rTabName);
-+ if (rTabName != aLastTabName)
-+ {
-+ rBuf.append(sal_Unicode(':'));
-+ lcl_appendTabName(rBuf, aLastTabName);
-+ }
-+ }
-+
-+ static void parseExternalDocName( const String& rFormula, xub_StrLen& rSrcPos )
-+ {
-+ xub_StrLen nLen = rFormula.Len();
-+ const sal_Unicode* p = rFormula.GetBuffer();
-+ sal_Unicode cPrev = 0;
-+ for (xub_StrLen i = rSrcPos; i < nLen; ++i)
-+ {
-+ sal_Unicode c = p[i];
-+ if (i == rSrcPos)
-+ {
-+ // first character must be '['.
-+ if (c != '[')
-+ return;
-+ }
-+ else if (i == rSrcPos + 1)
-+ {
-+ // second character must be a single quote.
-+ if (c != '\'')
-+ return;
-+ }
-+ else if (c == '\'')
-+ {
-+ if (cPrev == '\'')
-+ // two successive single quote is treated as a single
-+ // valid character.
-+ c = 'a';
-+ }
-+ else if (c == ']')
-+ {
-+ if (cPrev == '\'')
-+ {
-+ // valid source document path found. Increment the
-+ // current position to skip the source path.
-+ rSrcPos = i + 1;
-+ if (rSrcPos >= nLen)
-+ rSrcPos = nLen - 1;
-+ return;
-+ }
-+ else
-+ return;
-+ }
-+ else
-+ {
-+ // any other character
-+ if (i > rSrcPos + 2 && cPrev == '\'')
-+ // unless it's the 3rd character, a normal character
-+ // following immediately a single quote is invalid.
-+ return;
-+ }
-+ cPrev = c;
-+ }
-+ }
- };
-
- struct ConventionXL_A1 : public Convention_A1, public ConventionXL
- {
- ConventionXL_A1() : Convention_A1( ScAddress::CONV_XL_A1 ) { }
-+
-+ void makeSingleCellStr( ::rtl::OUStringBuffer& rBuf, const SingleRefData& rRef ) const
-+ {
-+ if (!rRef.IsColRel())
-+ rBuf.append(sal_Unicode('$'));
-+ MakeColStr(rBuf, rRef.nCol);
-+ if (!rRef.IsRowRel())
-+ rBuf.append(sal_Unicode('$'));
-+ MakeRowStr(rBuf, rRef.nRow);
-+ }
-+
- void MakeRefStr( rtl::OUStringBuffer& rBuf,
- const ScCompiler& rComp,
- const ComplRefData& rRef,
-@@ -1584,22 +1971,11 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
- }
- }
-
-- if (!aRef.Ref1.IsColRel())
-- rBuf.append(sal_Unicode('$'));
-- MakeColStr(rBuf, aRef.Ref1.nCol );
-- if (!aRef.Ref1.IsRowRel())
-- rBuf.append(sal_Unicode('$'));
-- MakeRowStr( rBuf, aRef.Ref1.nRow );
--
-+ makeSingleCellStr(rBuf, aRef.Ref1);
- if (!bSingleRef)
- {
- rBuf.append(sal_Unicode( ':' ));
-- if (!aRef.Ref2.IsColRel())
-- rBuf.append(sal_Unicode('$'));
-- MakeColStr(rBuf, aRef.Ref2.nCol );
-- if (!aRef.Ref2.IsRowRel())
-- rBuf.append(sal_Unicode('$'));
-- MakeRowStr( rBuf, aRef.Ref2.nRow );
-+ makeSingleCellStr(rBuf, aRef.Ref2);
- }
- }
-
-@@ -1607,8 +1983,10 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
- xub_StrLen nSrcPos,
- const CharClass* pCharClass) const
- {
-+ ConventionXL::parseExternalDocName(rFormula, nSrcPos);
-+
- ParseResult aRet;
-- if ( !lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
-+ if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
- return aRet;
-
- static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
-@@ -1624,6 +2002,67 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
- {
- return ConventionXL::getSpecialSymbol(eSymType);
- }
-+
-+ virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName ) const
-+ {
-+ return ConventionXL::parseExternalName(rSymbol, rFile, rName);
-+ }
-+
-+ virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
-+ {
-+ return ConventionXL::makeExternalNameStr(rFile, rName);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ // ['file:///path/to/file/filename.xls']'Sheet Name'!$A$1
-+ // This is a little different from the format Excel uses, as Excel
-+ // puts [] only around the file name. But we need to enclose the
-+ // whole file path with [] because the file name can contain any
-+ // characters.
-+
-+ const String* pFullName = pRefMgr->getExternalFileName(nFileId);
-+ if (!pFullName)
-+ return;
-+
-+ SingleRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
-+ lcl_appendTabName(rBuffer, rTabName);
-+ rBuffer.append(sal_Unicode('!'));
-+
-+ makeSingleCellStr(rBuffer, aRef);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ const String* pFullName = pRefMgr->getExternalFileName(nFileId);
-+ if (!pFullName)
-+ return;
-+
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ return;
-+
-+ ComplRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
-+ ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, *pTabNames, aRef);
-+ rBuffer.append(sal_Unicode('!'));
-+
-+ makeSingleCellStr(rBuffer, aRef.Ref1);
-+ if (aRef.Ref1 != aRef.Ref2)
-+ {
-+ rBuffer.append(sal_Unicode(':'));
-+ makeSingleCellStr(rBuffer, aRef.Ref2);
-+ }
-+ }
- };
-
- static const ConventionXL_A1 ConvXL_A1;
-@@ -1733,8 +2172,10 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
- xub_StrLen nSrcPos,
- const CharClass* pCharClass) const
- {
-+ ConventionXL::parseExternalDocName(rFormula, nSrcPos);
-+
- ParseResult aRet;
-- if ( !lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
-+ if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
- return aRet;
-
- static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
-@@ -1751,6 +2192,95 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
- {
- return ConventionXL::getSpecialSymbol(eSymType);
- }
-+
-+ virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName ) const
-+ {
-+ return ConventionXL::parseExternalName(rSymbol, rFile, rName);
-+ }
-+
-+ virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
-+ {
-+ return ConventionXL::makeExternalNameStr(rFile, rName);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ // ['file:///path/to/file/filename.xls']'Sheet Name'!$A$1
-+ // This is a little different from the format Excel uses, as Excel
-+ // puts [] only around the file name. But we need to enclose the
-+ // whole file path with [] because the file name can contain any
-+ // characters.
-+
-+ const String* pFullName = pRefMgr->getExternalFileName(nFileId);
-+ if (!pFullName)
-+ return;
-+
-+ SingleRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
-+ lcl_appendTabName(rBuffer, rTabName);
-+ rBuffer.append(sal_Unicode('!'));
-+
-+ r1c1_add_row(rBuffer, aRef);
-+ r1c1_add_col(rBuffer, aRef);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ const String* pFullName = pRefMgr->getExternalFileName(nFileId);
-+ if (!pFullName)
-+ return;
-+
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ return;
-+
-+ ComplRefData aRef(rRef);
-+ aRef.CalcAbsIfRel(rCompiler.GetPos());
-+
-+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
-+ ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, *pTabNames, aRef);
-+ rBuffer.append(sal_Unicode('!'));
-+
-+ if (aRef.Ref2.IsColDeleted() || aRef.Ref2.IsRowDeleted())
-+ {
-+ rBuffer.append(ScGlobal::GetRscString(STR_NO_REF_TABLE));
-+ return;
-+ }
-+
-+ if (aRef.Ref1.nCol == 0 && aRef.Ref2.nCol >= MAXCOL)
-+ {
-+ r1c1_add_row(rBuffer, rRef.Ref1);
-+ if (rRef.Ref1.nRow != rRef.Ref2.nRow || rRef.Ref1.IsRowRel() != rRef.Ref2.IsRowRel())
-+ {
-+ rBuffer.append (sal_Unicode(':'));
-+ r1c1_add_row(rBuffer, rRef.Ref2);
-+ }
-+ return;
-+ }
-+
-+ if (aRef.Ref1.nRow == 0 && aRef.Ref2.nRow >= MAXROW)
-+ {
-+ r1c1_add_col(rBuffer, aRef.Ref1);
-+ if (aRef.Ref1.nCol != aRef.Ref2.nCol || aRef.Ref1.IsColRel() != aRef.Ref2.IsColRel())
-+ {
-+ rBuffer.append (sal_Unicode(':'));
-+ r1c1_add_col(rBuffer, aRef.Ref2);
-+ }
-+ return;
-+ }
-+
-+ r1c1_add_row(rBuffer, aRef.Ref1);
-+ r1c1_add_col(rBuffer, aRef.Ref1);
-+ rBuffer.append (sal_Unicode (':'));
-+ r1c1_add_row(rBuffer, aRef.Ref2);
-+ r1c1_add_col(rBuffer, aRef.Ref2);
-+ }
- };
-
- static const ConventionXL_R1C1 ConvXL_R1C1;
-@@ -2208,7 +2738,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
- static const int kQuote = kInc * 2;
- static const int kPast = kInc * 3;
- bool bAddToSymbol = true;
-- if ('.' == c && nRefInSheetName == 0)
-+ if (cSheetSep == c && nRefInSheetName == 0)
- {
- // eat it, no sheet name
- bAddToSymbol = false;
-@@ -2223,7 +2753,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
- }
- else if (nRefInSheetName < kPast)
- {
-- if ('$' == c && nRefInSheetName < kDollar)
-+ if (cSheetPrefix == c && nRefInSheetName < kDollar)
- nRefInSheetName += kDollar;
- else if ('\'' == c)
- {
-@@ -2545,7 +3075,8 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
- {
- ScRange aRange( aPos, aPos );
- const ScAddress::Details aDetails( pConv->meConv, aPos );
-- USHORT nFlags = aRange.Parse( rName, pDoc, aDetails );
-+ ScAddress::ExternalInfo aExtInfo;
-+ USHORT nFlags = aRange.Parse( rName, pDoc, aDetails, &aExtInfo );
- if( nFlags & SCA_VALID )
- {
- ScRawToken aToken;
-@@ -2564,7 +3095,14 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
- aRef.Ref2.SetTabDeleted( TRUE ); // #REF!
- aRef.Ref2.SetFlag3D( ( nFlags & SCA_TAB2_3D ) != 0 );
- aRef.CalcRelFromAbs( aPos );
-- aToken.SetDoubleReference( aRef );
-+ if (aExtInfo.mbExternal)
-+ {
-+ aToken.SetExternalDoubleRef(aExtInfo.mnFileId, aExtInfo.maTabName, aRef);
-+ }
-+ else
-+ {
-+ aToken.SetDoubleReference(aRef);
-+ }
- pRawToken = aToken.Clone();
- }
-
-@@ -2576,7 +3114,8 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
- {
- ScAddress aAddr( aPos );
- const ScAddress::Details aDetails( pConv->meConv, aPos );
-- USHORT nFlags = aAddr.Parse( rName, pDoc, aDetails );
-+ ScAddress::ExternalInfo aExtInfo;
-+ USHORT nFlags = aAddr.Parse( rName, pDoc, aDetails, &aExtInfo );
- // Something must be valid in order to recognize Sheet1.blah or blah.a1
- // as a (wrong) reference.
- if( nFlags & ( SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB ) )
-@@ -2600,7 +3139,11 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
- nFlags |= SCA_VALID;
- }
- aRef.CalcRelFromAbs( aPos );
-- aToken.SetSingleReference( aRef );
-+
-+ if (aExtInfo.mbExternal)
-+ aToken.SetExternalSingleRef(aExtInfo.mnFileId, aExtInfo.maTabName, aRef);
-+ else
-+ aToken.SetSingleReference(aRef);
- pRawToken = aToken.Clone();
- }
-
-@@ -2708,6 +3251,27 @@ BOOL ScCompiler::IsNamedRange( const String& rUpperName )
- return FALSE;
- }
-
-+bool ScCompiler::IsExternalNamedRange( const String& rSymbol )
-+{
-+ if (!pConv)
-+ return false;
-+
-+ String aFile, aName;
-+ if (!pConv->parseExternalName(rSymbol, aFile, aName))
-+ return false;
-+
-+ ScRawToken aToken;
-+ if (aFile.Len() > MAXSTRLEN || aName.Len() > MAXSTRLEN)
-+ return false;
-+
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ pRefMgr->convertToAbsName(aFile);
-+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(aFile);
-+ aToken.SetExternalName(nFileId, aName);
-+ pRawToken = aToken.Clone();
-+ return true;
-+}
-+
- BOOL ScCompiler::IsDBRange( const String& rName )
- {
- USHORT n;
-@@ -3243,7 +3807,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
- if (mnPredetectedReference)
- {
- String aStr( cSymbol);
-- if (!IsPredetectedReference( aStr))
-+ if (!IsPredetectedReference( aStr) && !IsExternalNamedRange( aStr))
- {
- /* TODO: it would be nice to generate a #REF! error here, which
- * would need an ocBad token with additional error value.
-@@ -3306,6 +3870,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
- && !(bAllowBooleans && IsBoolean( aUpper ))
- && !IsValue( aUpper )
- && !IsNamedRange( aUpper )
-+ && !IsExternalNamedRange(aOrg)
- && !IsDBRange( aUpper )
- && !IsColRowName( aUpper )
- && !(bMayBeFuncName && IsMacro( aUpper ))
-@@ -3641,6 +4206,66 @@ BOOL ScCompiler::GetToken()
- }
- if( pToken->GetOpCode() == ocSubTotal )
- glSubTotal = TRUE;
-+ else if ( pToken->GetOpCode() == ocExternalName )
-+ {
-+ // Handle external single and double references, or names.
-+
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ const String* pFile = pRefMgr->getExternalFileName(pToken->GetIndex());
-+ if (!pFile)
-+ SetError(errNoName);
-+
-+ switch (pToken->GetType())
-+ {
-+ case svExternalName:
-+ {
-+ const String& rName = pToken->GetString();
-+ ScTokenArray* pNew = pRefMgr->getRangeNameTokens(pToken->GetIndex(), rName, &aPos);
-+ if (pNew)
-+ {
-+ PushTokenArray(pNew->Clone(), true);
-+ return GetToken();
-+ }
-+ }
-+ break;
-+ case svSingleRef:
-+ {
-+ SingleRefData aData(pToken->GetSingleRef());
-+ if (aData.IsTabRel())
-+ // external single reference must have an absolute table reference!
-+ break;
-+
-+ aData.CalcAbsIfRel(aPos);
-+ ScAddress aAddr(aData.nCol, aData.nRow, aData.nTab);
-+ ScToken* pNew = pRefMgr->getSingleRefToken(pToken->GetIndex(), pToken->GetString(), aAddr, &aPos, NULL);
-+ if (pNew)
-+ {
-+ pToken = pNew->Clone();
-+ return true;
-+ }
-+ }
-+ break;
-+ case svDoubleRef:
-+ {
-+ ComplRefData aData(pToken->GetDoubleRef());
-+ if (aData.Ref1.IsTabRel() || aData.Ref2.IsTabRel())
-+ // external double reference must have an absolute table reference!
-+ break;
-+
-+ aData.CalcAbsIfRel(aPos);
-+ ScRange aRange(aData.Ref1.nCol, aData.Ref1.nRow, aData.Ref1.nTab,
-+ aData.Ref2.nCol, aData.Ref2.nRow, aData.Ref2.nTab);
-+ ScTokenArray* pNew = pRefMgr->getDoubleRefTokens(pToken->GetIndex(), pToken->GetString(), aRange, &aPos);
-+ if (pNew)
-+ {
-+ PushTokenArray(pNew->Clone(), true);
-+ return GetToken();
-+ }
-+ }
-+ break;
-+ }
-+ SetError(errNoName);
-+ }
- else if( pToken->GetOpCode() == ocName )
- {
- ScRangeData* pRangeData = pDoc->GetRangeName()->FindIndex( pToken->GetIndex() );
-@@ -5638,111 +6263,140 @@ ScToken* ScCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuffer, ScToke
- DBG_ERRORFILE("unknown OpCode");
- rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
- }
-- if( bNext ) switch( t->GetType() )
-+ if (bNext)
- {
-- case svDouble:
-- AppendDouble( rBuffer, t->GetDouble() );
-- break;
--
-- case svString:
-- if( eOp == ocBad )
-- rBuffer.append(t->GetString());
-- else
-- AppendString( rBuffer, t->GetString() );
-- break;
-- case svSingleRef:
-+ if (eOp == ocExternalName)
- {
-- SingleRefData& rRef = t->GetSingleRef();
-- ComplRefData aRef;
-- aRef.Ref1 = aRef.Ref2 = rRef;
-- if ( eOp == ocColRowName )
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ switch (t->GetType())
- {
-- rRef.CalcAbsIfRel( aPos );
-- if ( pDoc->HasStringData( rRef.nCol, rRef.nRow, rRef.nTab ) )
-- {
-- String aStr;
-- pDoc->GetString( rRef.nCol, rRef.nRow, rRef.nTab, aStr );
-- EnQuote( aStr );
-- rBuffer.append(aStr);
-- }
-- else
-+ case svExternalName:
- {
-- rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
-- pConv->MakeRefStr (rBuffer, *this, aRef, TRUE );
-+ const String *pStr = pRefMgr->getExternalFileName(t->GetIndex());
-+ String aFileName = pStr ? *pStr : ScGlobal::GetRscString(STR_NO_NAME_REF);
-+ rBuffer.append(pConv->makeExternalNameStr(
-+ aFileName, t->GetString()));
- }
-+ break;
-+ case svSingleRef:
-+ pConv->makeExternalRefStr(
-+ rBuffer, *this, t->GetIndex(), t->GetString(), t->GetSingleRef(), pRefMgr);
-+ break;
-+ case svDoubleRef:
-+ pConv->makeExternalRefStr(
-+ rBuffer, *this, t->GetIndex(), t->GetString(), t->GetDoubleRef(), pRefMgr);
-+ break;
- }
-- else
-- pConv->MakeRefStr( rBuffer, *this, aRef, TRUE );
- }
-- break;
-- case svDoubleRef:
-- pConv->MakeRefStr( rBuffer, *this, t->GetDoubleRef(), FALSE );
-- break;
-- case svMatrix:
-- CreateStringFromScMatrix( rBuffer, t->GetMatrix() );
-- break;
--
-- case svIndex:
-+ else
- {
-- rtl::OUStringBuffer aBuffer;
-- switch ( eOp )
-+ switch( t->GetType() )
- {
-- case ocName:
-+ case svDouble:
-+ AppendDouble( rBuffer, t->GetDouble() );
-+ break;
-+
-+ case svString:
-+ if( eOp == ocBad )
-+ rBuffer.append(t->GetString());
-+ else
-+ AppendString( rBuffer, t->GetString() );
-+ break;
-+ case svSingleRef:
- {
-- ScRangeData* pData = pDoc->GetRangeName()->FindIndex(t->GetIndex());
-- if (pData)
-+ SingleRefData& rRef = t->GetSingleRef();
-+ ComplRefData aRef;
-+ aRef.Ref1 = aRef.Ref2 = rRef;
-+ if ( eOp == ocColRowName )
- {
-- if (pData->HasType(RT_SHARED))
-- pData->UpdateSymbol( aBuffer, aPos, GetGrammar());
-+ rRef.CalcAbsIfRel( aPos );
-+ if ( pDoc->HasStringData( rRef.nCol, rRef.nRow, rRef.nTab ) )
-+ {
-+ String aStr;
-+ pDoc->GetString( rRef.nCol, rRef.nRow, rRef.nTab, aStr );
-+ EnQuote( aStr );
-+ rBuffer.append(aStr);
-+ }
- else
-- aBuffer.append(pData->GetName());
-+ {
-+ rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
-+ pConv->MakeRefStr (rBuffer, *this, aRef, TRUE );
-+ }
- }
-+ else
-+ pConv->MakeRefStr( rBuffer, *this, aRef, TRUE );
- }
-- break;
-- case ocDBArea:
-+ break;
-+ case svDoubleRef:
-+ pConv->MakeRefStr( rBuffer, *this, t->GetDoubleRef(), FALSE );
-+ break;
-+ case svMatrix:
-+ CreateStringFromScMatrix( rBuffer, t->GetMatrix() );
-+ break;
-+
-+ case svIndex:
- {
-- ScDBData* pDBData = pDoc->GetDBCollection()->FindIndex(t->GetIndex());
-- if (pDBData)
-- aBuffer.append(pDBData->GetName());
-+ rtl::OUStringBuffer aBuffer;
-+ switch ( eOp )
-+ {
-+ case ocName:
-+ {
-+ ScRangeData* pData = pDoc->GetRangeName()->FindIndex(t->GetIndex());
-+ if (pData)
-+ {
-+ if (pData->HasType(RT_SHARED))
-+ pData->UpdateSymbol( aBuffer, aPos, GetGrammar());
-+ else
-+ aBuffer.append(pData->GetName());
-+ }
-+ }
-+ break;
-+ case ocDBArea:
-+ {
-+ ScDBData* pDBData = pDoc->GetDBCollection()->FindIndex(t->GetIndex());
-+ if (pDBData)
-+ aBuffer.append(pDBData->GetName());
-+ }
-+ break;
-+ default:
-+ ; // nothing
-+ }
-+ if ( aBuffer.getLength() )
-+ rBuffer.append(aBuffer);
-+ else
-+ rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
-+ break;
- }
-- break;
-- default:
-- ; // nothing
-- }
-- if ( aBuffer.getLength() )
-- rBuffer.append(aBuffer);
-- else
-- rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
-- break;
-- }
-- case svExternal:
-- {
-- // mapped or translated name of AddIns
-- String aAddIn( t->GetExternal() );
-- bool bMapped = mxSymbols->isPODF(); // ODF 1.1 directly uses programmatical name
-- if (!bMapped && mxSymbols->hasExternals())
-- {
-- ScExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap()->find( aAddIn);
-- if (iLook != mxSymbols->getReverseExternalHashMap()->end())
-+ case svExternal:
- {
-- aAddIn = (*iLook).second;
-- bMapped = true;
-+ // mapped or translated name of AddIns
-+ String aAddIn( t->GetExternal() );
-+ bool bMapped = mxSymbols->isPODF(); // ODF 1.1 directly uses programmatical name
-+ if (!bMapped && mxSymbols->hasExternals())
-+ {
-+ ScExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap()->find( aAddIn);
-+ if (iLook != mxSymbols->getReverseExternalHashMap()->end())
-+ {
-+ aAddIn = (*iLook).second;
-+ bMapped = true;
-+ }
-+ }
-+ if (!bMapped && !mxSymbols->isEnglish())
-+ ScGlobal::GetAddInCollection()->LocalizeString( aAddIn );
-+ rBuffer.append(aAddIn);
- }
-- }
-- if (!bMapped && !mxSymbols->isEnglish())
-- ScGlobal::GetAddInCollection()->LocalizeString( aAddIn );
-- rBuffer.append(aAddIn);
-+ break;
-+ case svByte:
-+ case svJump:
-+ case svFAP:
-+ case svMissing:
-+ case svSep:
-+ break; // Opcodes
-+ default:
-+ DBG_ERROR("ScCompiler:: GetStringFromToken errUnknownVariable");
-+ } // of switch
- }
-- break;
-- case svByte:
-- case svJump:
-- case svFAP:
-- case svMissing:
-- case svSep:
-- break; // Opcodes
-- default:
-- DBG_ERROR("ScCompiler:: GetStringFromToken errUnknownVariable");
-- } // of switch
-+ }
- if( bSpaces )
- rBuffer.append(sal_Unicode(' '));
- if ( bAllowArrAdvance )
-diff --git sc/source/core/tool/refdata.cxx sc/source/core/tool/refdata.cxx
-index 4ac1814..7ec74d8 100644
---- sc/source/core/tool/refdata.cxx
-+++ sc/source/core/tool/refdata.cxx
-@@ -200,6 +200,10 @@ BOOL SingleRefData::operator==( const SingleRefData& r ) const
- (Flags.bTabRel ? nRelTab == r.nRelTab : nTab == r.nTab);
- }
-
-+bool SingleRefData::operator!=( const SingleRefData& r ) const
-+{
-+ return !operator==(r);
-+}
-
- static void lcl_putInOrder( SingleRefData & rRef1, SingleRefData & rRef2 )
- {
-diff --git sc/source/core/tool/token.cxx sc/source/core/tool/token.cxx
-index a20cbd5..51611ef 100644
---- sc/source/core/tool/token.cxx
-+++ sc/source/core/tool/token.cxx
-@@ -54,6 +54,8 @@
- #include "parclass.hxx"
- #include "jumpmatrix.hxx"
-
-+using ::std::vector;
-+
- // ImpTokenIterator wird je Interpreter angelegt, mehrfache auch durch
- // SubCode via ScTokenIterator Push/Pop moeglich
- IMPL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator, 32, 16 )
-@@ -209,6 +211,48 @@ void ScRawToken::SetName( USHORT n )
- nRefCnt = 0;
- }
-
-+void ScRawToken::SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef )
-+{
-+ eOp = ocExternalName;
-+ eType = svSingleRef;
-+ nRefCnt = 0;
-+
-+ extref.nFileId = nFileId;
-+ extref.aRef.Ref1 =
-+ extref.aRef.Ref2 = rRef;
-+
-+ xub_StrLen n = rTabName.Len();
-+ memcpy(extref.cTabName, rTabName.GetBuffer(), n*sizeof(sal_Unicode));
-+ extref.cTabName[n] = 0;
-+}
-+
-+void ScRawToken::SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef )
-+{
-+ eOp = ocExternalName;
-+ eType = svDoubleRef;
-+ nRefCnt = 0;
-+
-+ extref.nFileId = nFileId;
-+ extref.aRef = rRef;
-+
-+ xub_StrLen n = rTabName.Len();
-+ memcpy(extref.cTabName, rTabName.GetBuffer(), n*sizeof(sal_Unicode));
-+ extref.cTabName[n] = 0;
-+}
-+
-+void ScRawToken::SetExternalName( sal_uInt16 nFileId, const String& rName )
-+{
-+ eOp = ocExternalName;
-+ eType = svExternalName;
-+ nRefCnt = 0;
-+
-+ extname.nFileId = nFileId;
-+
-+ xub_StrLen n = rName.Len();
-+ memcpy(extname.cName, rName.GetBuffer(), n*sizeof(sal_Unicode));
-+ extname.cName[n] = 0;
-+}
-+
- ComplRefData& ScRawToken::GetReference()
- {
- DBG_ASSERT( lcl_IsReference( eOp, GetType() ), "GetReference: no Ref" );
-@@ -260,22 +304,34 @@ ScRawToken* ScRawToken::Clone() const
- static USHORT nOffset = lcl_ScRawTokenOffset(); // offset of sbyte
- USHORT n = nOffset;
-
-- switch( eType )
-+ if (eOp == ocExternalName)
- {
-- case svSep: break;
-- case svByte: n += sizeof(ScRawToken::sbyte); break;
-- case svDouble: n += sizeof(double); break;
-- case svString: n = sal::static_int_cast<USHORT>( n + GetStrLenBytes( cStr ) + GetStrLenBytes( 1 ) ); break;
-- case svSingleRef:
-- case svDoubleRef: n += sizeof(aRef); break;
-- case svMatrix: n += sizeof(ScMatrix*); break;
-- case svIndex: n += sizeof(USHORT); break;
-- case svJump: n += nJump[ 0 ] * 2 + 2; break;
-- case svExternal: n = sal::static_int_cast<USHORT>( n + GetStrLenBytes( cStr+1 ) + GetStrLenBytes( 2 ) ); break;
-- default:
-- {
-- DBG_ERROR1( "unknown ScRawToken::Clone() type %d", int(eType));
-- }
-+ switch (eType)
-+ {
-+ case svSingleRef:
-+ case svDoubleRef: n += sizeof(extref); break;
-+ case svExternalName: n += sizeof(extname); break;
-+ }
-+ }
-+ else
-+ {
-+ switch( eType )
-+ {
-+ case svSep: break;
-+ case svByte: n += sizeof(ScRawToken::sbyte); break;
-+ case svDouble: n += sizeof(double); break;
-+ case svString: n = sal::static_int_cast<USHORT>( n + GetStrLenBytes( cStr ) + GetStrLenBytes( 1 ) ); break;
-+ case svSingleRef:
-+ case svDoubleRef: n += sizeof(aRef); break;
-+ case svMatrix: n += sizeof(ScMatrix*); break;
-+ case svIndex: n += sizeof(USHORT); break;
-+ case svJump: n += nJump[ 0 ] * 2 + 2; break;
-+ case svExternal: n = sal::static_int_cast<USHORT>( n + GetStrLenBytes( cStr+1 ) + GetStrLenBytes( 2 ) ); break;
-+ default:
-+ {
-+ DBG_ERROR1( "unknown ScRawToken::Clone() type %d", int(eType));
-+ }
-+ }
- }
- p = (ScRawToken*) new BYTE[ n ];
- memcpy( p, this, n * sizeof(BYTE) );
-@@ -311,12 +367,22 @@ ScToken* ScRawToken::CreateToken() const
- case svSingleRef :
- if (eOp == ocPush)
- return new ScSingleRefToken( aRef.Ref1 );
-+ else if (eOp == ocExternalName)
-+ {
-+ String aTabName(extref.cTabName);
-+ return new ScExternalSingleRefToken(extref.nFileId, aTabName, extref.aRef.Ref1);
-+ }
- else
- return new ScSingleRefOpToken( eOp, aRef.Ref1 );
- //break;
- case svDoubleRef :
- if (eOp == ocPush)
- return new ScDoubleRefToken( aRef );
-+ else if (eOp == ocExternalName)
-+ {
-+ String aTabName(extref.cTabName);
-+ return new ScExternalDoubleRefToken(extref.nFileId, aTabName, extref.aRef);
-+ }
- else
- return new ScDoubleRefOpToken( eOp, aRef );
- //break;
-@@ -327,6 +393,11 @@ ScToken* ScRawToken::CreateToken() const
- case svIndex :
- return new ScIndexToken( eOp, nIndex );
- //break;
-+ case svExternalName:
-+ {
-+ String aName(extname.cName);
-+ return new ScExternalNameToken( extname.nFileId, aName );
-+ }
- case svJump :
- return new ScJumpToken( eOp, (short*) nJump );
- //break;
-@@ -478,6 +549,7 @@ BOOL ScToken::IsMatrixFunction() const
-
- ScToken* ScToken::Clone() const
- {
-+ OpCode nOp = GetOpCode();
- switch ( GetType() )
- {
- case svByte :
-@@ -487,20 +559,24 @@ ScToken* ScToken::Clone() const
- return new ScDoubleToken( *static_cast<const ScDoubleToken*>(this) );
- //break;
- case svString :
-- if (GetOpCode() == ocPush)
-+ if (nOp == ocPush)
- return new ScStringToken( *static_cast<const ScStringToken*>(this) );
- else
- return new ScStringOpToken( *static_cast<const ScStringOpToken*>(this) );
- //break;
- case svSingleRef :
-- if (GetOpCode() == ocPush)
-+ if (nOp == ocPush)
- return new ScSingleRefToken( *static_cast<const ScSingleRefToken*>(this) );
-+ else if (nOp == ocExternalName)
-+ return new ScExternalSingleRefToken( *static_cast<const ScExternalSingleRefToken*>(this) );
- else
- return new ScSingleRefOpToken( *static_cast<const ScSingleRefOpToken*>(this) );
- //break;
- case svDoubleRef :
-- if (GetOpCode() == ocPush)
-+ if (nOp == ocPush)
- return new ScDoubleRefToken( *static_cast<const ScDoubleRefToken*>(this) );
-+ else if (nOp == ocExternalName)
-+ return new ScExternalDoubleRefToken( *static_cast<const ScExternalDoubleRefToken*>(this) );
- else
- return new ScDoubleRefOpToken( *static_cast<const ScDoubleRefOpToken*>(this) );
- //break;
-@@ -522,6 +598,9 @@ ScToken* ScToken::Clone() const
- case svExternal :
- return new ScExternalToken( *static_cast<const ScExternalToken*>(this) );
- //break;
-+ case svExternalName :
-+ return new ScExternalNameToken( *static_cast<const ScExternalNameToken*>(this) );
-+ //break;
- case svFAP :
- return new ScFAPToken( *static_cast<const ScFAPToken*>(this) );
- //break;
-@@ -660,6 +739,7 @@ ScTokenRef ScToken::ExtendRangeReference( ScToken & rTok1, ScToken & rTok2,
- return NULL;
-
- ScTokenRef xRes;
-+ bool bExternal = rTok1.GetOpCode() == ocExternalName;
- if (sv1 == svSingleRef && sv2 == svSingleRef)
- {
- // Range references like Sheet1.A1:A2 are generalized and built by
-@@ -671,7 +751,10 @@ ScTokenRef ScToken::ExtendRangeReference( ScToken & rTok1, ScToken & rTok2,
- aRef.Ref1 = aRef.Ref2 = p1->GetSingleRef();
- aRef.Ref2.SetFlag3D( false);
- aRef.Extend( p2->GetSingleRef(), rPos);
-- xRes = new ScDoubleRefToken( aRef);
-+ if (bExternal)
-+ xRes = new ScExternalDoubleRefToken(rTok1.GetIndex(), rTok1.GetString(), aRef);
-+ else
-+ xRes = new ScDoubleRefToken( aRef);
- }
- else
- {
-@@ -694,7 +777,10 @@ ScTokenRef ScToken::ExtendRangeReference( ScToken & rTok1, ScToken & rTok2,
- {
- if (!pRefList->size())
- return NULL;
-- xRes = new ScDoubleRefToken( (*pRefList)[0] );
-+ if (bExternal)
-+ xRes = new ScExternalDoubleRefToken(rTok1.GetIndex(), rTok1.GetString(), (*pRefList)[0]);
-+ else
-+ xRes = new ScDoubleRefToken( (*pRefList)[0] );
- }
- if (!xRes)
- return NULL; // shouldn't happen..
-@@ -1035,6 +1121,190 @@ BOOL ScIndexToken::operator==( const ScToken& r ) const
- return ScToken::operator==( r ) && nIndex == r.GetIndex();
- }
-
-+// ============================================================================
-+
-+ScExternalSingleRefToken::ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& r ) :
-+ ScOpToken(ocExternalName, svSingleRef),
-+ mnFileId(nFileId),
-+ maTabName(rTabName),
-+ maSingleRef(r)
-+{
-+}
-+
-+ScExternalSingleRefToken::ScExternalSingleRefToken( const ScExternalSingleRefToken& r ) :
-+ ScOpToken(r),
-+ mnFileId(r.mnFileId),
-+ maTabName(r.maTabName),
-+ maSingleRef(r.maSingleRef)
-+{
-+}
-+
-+ScExternalSingleRefToken::~ScExternalSingleRefToken()
-+{
-+}
-+
-+USHORT ScExternalSingleRefToken::GetIndex() const
-+{
-+ return mnFileId;
-+}
-+
-+const String& ScExternalSingleRefToken::GetString() const
-+{
-+ return maTabName;
-+}
-+
-+const SingleRefData& ScExternalSingleRefToken::GetSingleRef() const
-+{
-+ return maSingleRef;
-+}
-+
-+SingleRefData& ScExternalSingleRefToken::GetSingleRef()
-+{
-+ return maSingleRef;
-+}
-+
-+BOOL ScExternalSingleRefToken::operator ==( const ScToken& r ) const
-+{
-+ if (!ScToken::operator==(r))
-+ return false;
-+
-+ if (mnFileId != r.GetIndex())
-+ return false;
-+
-+ if (maTabName != r.GetString())
-+ return false;
-+
-+ return maSingleRef == r.GetSingleRef();
-+}
-+
-+// ============================================================================
-+
-+ScExternalDoubleRefToken::ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& r ) :
-+ ScOpToken(ocExternalName, svDoubleRef),
-+ mnFileId(nFileId),
-+ maTabName(rTabName),
-+ maDoubleRef(r)
-+{
-+}
-+
-+ScExternalDoubleRefToken::ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r ) :
-+ ScOpToken(r),
-+ mnFileId(r.mnFileId),
-+ maTabName(r.maTabName),
-+ maDoubleRef(r.maDoubleRef)
-+{
-+}
-+
-+ScExternalDoubleRefToken::~ScExternalDoubleRefToken()
-+{
-+}
-+
-+USHORT ScExternalDoubleRefToken::GetIndex() const
-+{
-+ return mnFileId;
-+}
-+
-+const String& ScExternalDoubleRefToken::GetString() const
-+{
-+ return maTabName;
-+}
-+
-+const SingleRefData& ScExternalDoubleRefToken::GetSingleRef() const
-+{
-+ return maDoubleRef.Ref1;
-+}
-+
-+SingleRefData& ScExternalDoubleRefToken::GetSingleRef()
-+{
-+ return maDoubleRef.Ref1;
-+}
-+
-+const SingleRefData& ScExternalDoubleRefToken::GetSingleRef2() const
-+{
-+ return maDoubleRef.Ref2;
-+}
-+
-+SingleRefData& ScExternalDoubleRefToken::GetSingleRef2()
-+{
-+ return maDoubleRef.Ref2;
-+}
-+
-+const ComplRefData& ScExternalDoubleRefToken::GetDoubleRef() const
-+{
-+ return maDoubleRef;
-+}
-+
-+ComplRefData& ScExternalDoubleRefToken::GetDoubleRef()
-+{
-+ return maDoubleRef;
-+}
-+
-+BOOL ScExternalDoubleRefToken::operator ==( const ScToken& r ) const
-+{
-+ if (!ScToken::operator==(r))
-+ return false;
-+
-+ if (mnFileId != r.GetIndex())
-+ return false;
-+
-+ if (maTabName != r.GetString())
-+ return false;
-+
-+ return maDoubleRef == r.GetDoubleRef();
-+}
-+
-+// ============================================================================
-+
-+ScExternalNameToken::ScExternalNameToken( sal_uInt16 nFileId, const String& rName ) :
-+ ScOpToken(ocExternalName, svExternalName),
-+ mnFileId(nFileId),
-+ maName(rName)
-+{
-+}
-+
-+ScExternalNameToken::ScExternalNameToken( const ScExternalNameToken& r ) :
-+ ScOpToken(r),
-+ mnFileId(r.mnFileId),
-+ maName(r.maName)
-+{
-+}
-+
-+ScExternalNameToken::~ScExternalNameToken() {}
-+
-+USHORT ScExternalNameToken::GetIndex() const
-+{
-+ return mnFileId;
-+}
-+
-+const String& ScExternalNameToken::GetString() const
-+{
-+ return maName;
-+}
-+
-+BOOL ScExternalNameToken::operator==( const ScToken& r ) const
-+{
-+ if ( !ScToken::operator==(r) )
-+ return false;
-+
-+ if (mnFileId != r.GetIndex())
-+ return false;
-+
-+ xub_StrLen nLen = maName.Len();
-+ const String& rName = r.GetString();
-+ if (nLen != rName.Len())
-+ return false;
-+
-+ const sal_Unicode* p1 = maName.GetBuffer();
-+ const sal_Unicode* p2 = rName.GetBuffer();
-+ for (xub_StrLen j = 0; j < nLen; ++j)
-+ {
-+ if (p1[j] != p2[j])
-+ return false;
-+ }
-+ return true;
-+}
-+
-+// ============================================================================
-
- short* ScJumpToken::GetJump() const { return pJump; }
- BOOL ScJumpToken::operator==( const ScToken& r ) const
-@@ -1237,6 +1507,9 @@ ScToken* ScTokenArray::GetNextReferenceOrName()
- {
- for( ScToken* t = Next(); t; t = Next() )
- {
-+ if ( t->GetOpCode() == ocExternalName )
-+ return t;
-+
- switch( t->GetType() )
- {
- case svSingleRef:
-@@ -1893,6 +2166,21 @@ ScToken* ScTokenArray::AddMatrix( ScMatrix* p )
- return Add( new ScMatrixToken( p ) );
- }
-
-+ScToken* ScTokenArray::AddExternalName( sal_uInt16 nFileId, const String& rName )
-+{
-+ return Add( new ScExternalNameToken(nFileId, rName) );
-+}
-+
-+ScToken* ScTokenArray::AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef )
-+{
-+ return Add( new ScExternalSingleRefToken(nFileId, rTabName, rRef) );
-+}
-+
-+ScToken* ScTokenArray::AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef )
-+{
-+ return Add( new ScExternalDoubleRefToken(nFileId, rTabName, rRef) );
-+}
-+
- ScToken* ScTokenArray::AddColRowName( const SingleRefData& rRef )
- {
- return Add( new ScSingleRefOpToken( ocColRowName, rRef ) );
-diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
-index 3070f34..fd87dbf 100644
---- sc/source/filter/excel/excform.cxx
-+++ sc/source/filter/excel/excform.cxx
-@@ -46,6 +46,7 @@
- #include "xilink.hxx"
- #include "xiname.hxx"
-
-+using ::std::vector;
-
- const UINT16 ExcelToSc::nRowMask = 0x3FFF;
- const UINT16 ExcelToSc::nLastInd = 399;
-@@ -1329,6 +1330,13 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
- return eRet;
- }
-
-+ConvErr ExcelToSc::ConvertExternName( const ScTokenArray*& /*rpArray*/, XclImpStream& /*rStrm*/, sal_Size /*nFormulaLen*/,
-+ const String& /*rUrl*/, const vector<String>& /*rTabNames*/ )
-+{
-+ // not implemented ...
-+ return ConvErrNi;
-+}
-+
- BOOL ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen )
- {
- DBG_ASSERT_BIFF( GetBiff() == EXC_BIFF5 );
-diff --git sc/source/filter/excel/excform8.cxx sc/source/filter/excel/excform8.cxx
-index ebf8543..e0467a0 100644
---- sc/source/filter/excel/excform8.cxx
-+++ sc/source/filter/excel/excform8.cxx
-@@ -41,6 +41,18 @@
- #include "xilink.hxx"
- #include "xiname.hxx"
-
-+#include "externalrefmgr.hxx"
-+
-+#include <vector>
-+
-+using ::std::vector;
-+
-+ExcelToSc8::ExternalTabInfo::ExternalTabInfo() :
-+ mnFileId(0), mbExternal(false)
-+{
-+}
-+
-+// ============================================================================
-
- ExcelToSc8::ExcelToSc8( const XclImpRoot& rRoot ) :
- ExcelToSc( rRoot ),
-@@ -53,15 +65,33 @@ ExcelToSc8::~ExcelToSc8()
- {
- }
-
-+bool ExcelToSc8::GetExternalFileIdFromXti( UINT16 nIxti, sal_uInt16& rFileId ) const
-+{
-+ const String* pFileUrl = rLinkMan.GetSupbookUrl(nIxti);
-+ if (!pFileUrl || pFileUrl->Len() == 0)
-+ return false;
-+
-+ String aFileUrl = ScGlobal::GetAbsDocName(*pFileUrl, GetDocShell());
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ rFileId = pRefMgr->getExternalFileId(aFileUrl);
-
--BOOL ExcelToSc8::Read3DTabReference( XclImpStream& rStrm, SCTAB& rFirstTab, SCTAB& rLastTab )
-+ return true;
-+}
-+
-+bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo )
- {
- rFirstTab = rLastTab = 0;
-+ rExtInfo.mbExternal = !rLinkMan.IsSelfRef(nIxti);
-+ bool bSuccess = rLinkMan.GetScTabRange(rFirstTab, rLastTab, nIxti);
-+ if (!bSuccess)
-+ return false;
-
-- UINT16 nIxti;
-- rStrm >> nIxti;
-+ if (!rExtInfo.mbExternal)
-+ // This is internal reference. Stop here.
-+ return true;
-
-- return rLinkMan.GetScTabRange( rFirstTab, rLastTab, nIxti );
-+ rExtInfo.maTabName = rLinkMan.GetSupbookTabName(nIxti, rFirstTab);
-+ return GetExternalFileIdFromXti(nIxti, rExtInfo.mnFileId);
- }
-
-
-@@ -608,8 +638,15 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
- {
- case xlExtName:
- {
-- aStack << aPool.Store( ocNoName, pExtName->GetName() );
-- GetTracer().TraceFormulaExtName();
-+ sal_uInt16 nFileId;
-+ if (!GetExternalFileIdFromXti(nXtiIndex, nFileId))
-+ {
-+ aStack << aPool.Store(ocNoName, pExtName->GetName());
-+ break;
-+ }
-+
-+ aStack << aPool.StoreExtName(nFileId, pExtName->GetName());
-+ pExtName->CreateExtNameData(GetDoc(), nFileId);
- }
- break;
-
-@@ -657,47 +694,67 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
- case 0x7C:
- case 0x3C: // Deleted 3-D Cell Reference [ 277]
- {
-- UINT16 nRw, nGrbitCol;
-+ UINT16 nIxti, nRw, nGrbitCol;
- SCTAB nTabFirst, nTabLast;
-
-- BOOL bOK = Read3DTabReference( aIn, nTabFirst, nTabLast );
-- aIn >> nRw >> nGrbitCol;
-+ aIn >> nIxti >> nRw >> nGrbitCol;
-
-- if( bOK )
-- {
-- aSRD.nTab = nTabFirst;
-- aSRD.SetFlag3D( TRUE );
-- aSRD.SetTabRel( FALSE );
-+ ExternalTabInfo aExtInfo;
-+ if (!Read3DTabReference(nIxti, nTabFirst, nTabLast, aExtInfo))
-+ {
-+ aPool << ocBad;
-+ aPool >> aStack;
-+ break;
-+ }
-
-- ExcRelToScRel8( nRw, nGrbitCol, aSRD, bRangeName );
-+ aSRD.nTab = nTabFirst;
-+ aSRD.SetFlag3D( TRUE );
-+ aSRD.SetTabRel( FALSE );
-
-- switch ( nOp )
-- {
-- case 0x5C:
-- case 0x7C:
-- case 0x3C: // Deleted 3-D Cell Reference [ 277]
-- // no information which part is deleted, set both
-- aSRD.SetColDeleted( TRUE );
-- aSRD.SetRowDeleted( TRUE );
-- }
-- if ( !ValidTab(nTabFirst) )
-- aSRD.SetTabDeleted( TRUE );
-+ ExcRelToScRel8( nRw, nGrbitCol, aSRD, bRangeName );
-
-- if( nTabLast != nTabFirst )
-- {
-- aCRD.Ref1 = aCRD.Ref2 = aSRD;
-- aCRD.Ref2.nTab = nTabLast;
-+ switch ( nOp )
-+ {
-+ case 0x5C:
-+ case 0x7C:
-+ case 0x3C: // Deleted 3-D Cell Reference [ 277]
-+ // no information which part is deleted, set both
-+ aSRD.SetColDeleted( TRUE );
-+ aSRD.SetRowDeleted( TRUE );
-+ }
-+
-+ if (aExtInfo.mbExternal)
-+ {
-+ // nTabFirst and nTabLast are the indices of the refernced
-+ // sheets in the SUPBOOK record, hence do not represent
-+ // the actual indices of the original sheets since the
-+ // SUPBOOK record only stores referenced sheets and skips
-+ // the ones that are not referenced.
-+
-+ if (nTabLast != nTabFirst)
-+ {
-+ aCRD.Ref1 = aCRD.Ref2 = aSRD;
-+ aCRD.Ref2.nTab = nTabLast;
-+ aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aCRD);
-+ }
-+ else
-+ aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aSRD);
-+ }
-+ else
-+ {
-+ if ( !ValidTab(nTabFirst))
-+ aSRD.SetTabDeleted( TRUE );
-+
-+ if( nTabLast != nTabFirst )
-+ {
-+ aCRD.Ref1 = aCRD.Ref2 = aSRD;
-+ aCRD.Ref2.nTab = nTabLast;
- aCRD.Ref2.SetTabDeleted( !ValidTab(nTabLast) );
-- aStack << aPool.Store( aCRD );
-- }
-- else
-- aStack << aPool.Store( aSRD );
-- }
-- else
-- {
-- aPool << ocBad;
-- aPool >> aStack;
-- }
-+ aStack << aPool.Store( aCRD );
-+ }
-+ else
-+ aStack << aPool.Store( aSRD );
-+ }
- }
- break;
- case 0x5B:
-@@ -707,55 +764,61 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
- case 0x7D:
- case 0x3D: // Deleted 3-D Area Reference [ 277]
- {
-- UINT16 nRw1, nGrbitCol1, nRw2, nGrbitCol2;
-+ UINT16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2;
- SCTAB nTabFirst, nTabLast;
-+ aIn >> nIxti >> nRw1 >> nRw2 >> nGrbitCol1 >> nGrbitCol2;
-
-- BOOL bOK = Read3DTabReference( aIn, nTabFirst, nTabLast );
-- aIn >> nRw1 >> nRw2 >> nGrbitCol1 >> nGrbitCol2;
--
-- if( bOK )
-- {
-- SingleRefData &rR1 = aCRD.Ref1;
-- SingleRefData &rR2 = aCRD.Ref2;
--
-- rR1.nTab = nTabFirst;
-- rR2.nTab = nTabLast;
-- rR1.SetFlag3D( TRUE );
-- rR1.SetTabRel( FALSE );
-- rR2.SetFlag3D( nTabFirst != nTabLast );
-- rR2.SetTabRel( FALSE );
--
-- ExcRelToScRel8( nRw1, nGrbitCol1, aCRD.Ref1, bRangeName );
-- ExcRelToScRel8( nRw2, nGrbitCol2, aCRD.Ref2, bRangeName );
--
-- if( IsComplColRange( nGrbitCol1, nGrbitCol2 ) )
-- SetComplCol( aCRD );
-- else if( IsComplRowRange( nRw1, nRw2 ) )
-- SetComplRow( aCRD );
--
-- switch ( nOp )
-- {
-- case 0x5D:
-- case 0x7D:
-- case 0x3D: // Deleted 3-D Area Reference [ 277]
-- // no information which part is deleted, set all
-- rR1.SetColDeleted( TRUE );
-- rR1.SetRowDeleted( TRUE );
-- rR2.SetColDeleted( TRUE );
-- rR2.SetRowDeleted( TRUE );
-- }
-- if ( !ValidTab(nTabFirst) )
-- rR1.SetTabDeleted( TRUE );
-- if ( !ValidTab(nTabLast) )
-- rR2.SetTabDeleted( TRUE );
--
-- aStack << aPool.Store( aCRD );
-- }
-- else
-+ ExternalTabInfo aExtInfo;
-+ if (!Read3DTabReference(nIxti, nTabFirst, nTabLast, aExtInfo))
- {
- aPool << ocBad;
- aPool >> aStack;
-+ break;
- }
-+
-+ SingleRefData &rR1 = aCRD.Ref1;
-+ SingleRefData &rR2 = aCRD.Ref2;
-+
-+ rR1.nTab = nTabFirst;
-+ rR2.nTab = nTabLast;
-+ rR1.SetFlag3D( TRUE );
-+ rR1.SetTabRel( FALSE );
-+ rR2.SetFlag3D( nTabFirst != nTabLast );
-+ rR2.SetTabRel( FALSE );
-+
-+ ExcRelToScRel8( nRw1, nGrbitCol1, aCRD.Ref1, bRangeName );
-+ ExcRelToScRel8( nRw2, nGrbitCol2, aCRD.Ref2, bRangeName );
-+
-+ if( IsComplColRange( nGrbitCol1, nGrbitCol2 ) )
-+ SetComplCol( aCRD );
-+ else if( IsComplRowRange( nRw1, nRw2 ) )
-+ SetComplRow( aCRD );
-+
-+ switch ( nOp )
-+ {
-+ case 0x5D:
-+ case 0x7D:
-+ case 0x3D: // Deleted 3-D Area Reference [ 277]
-+ // no information which part is deleted, set all
-+ rR1.SetColDeleted( TRUE );
-+ rR1.SetRowDeleted( TRUE );
-+ rR2.SetColDeleted( TRUE );
-+ rR2.SetRowDeleted( TRUE );
-+ }
-+
-+ if (aExtInfo.mbExternal)
-+ {
-+ aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aCRD);
-+ }
-+ else
-+ {
-+ if ( !ValidTab(nTabFirst) )
-+ rR1.SetTabDeleted( TRUE );
-+ if ( !ValidTab(nTabLast) )
-+ rR2.SetTabDeleted( TRUE );
-+
-+ aStack << aPool.Store( aCRD );
-+ }
- }
- break;
- default: bError = TRUE;
-@@ -1143,7 +1206,130 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
- return eRet;
- }
-
-+ConvErr ExcelToSc8::ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
-+ const String& rUrl, const vector<String>& rTabNames )
-+{
-+ String aFileUrl = ScGlobal::GetAbsDocName(rUrl, GetDocShell());
-+
-+ sal_uInt8 nOp, nByte;
-+ bool bError = false;
-+
-+ SingleRefData aSRD;
-+ ComplRefData aCRD;
-+
-+ if (eStatus != ConvOK)
-+ {
-+ rStrm.Ignore(nFormulaLen);
-+ return eStatus;
-+ }
-+
-+ if (nFormulaLen == 0)
-+ {
-+ aPool.Store(CREATE_STRING("-/-"));
-+ aPool >> aStack;
-+ rpArray = aPool[aStack.Get()];
-+ return ConvOK;
-+ }
-+
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(aFileUrl);
-+ sal_uInt16 nTabCount = rTabNames.size();
-+
-+ sal_Size nEndPos = rStrm.GetRecPos() + nFormulaLen;
-+
-+ while( (rStrm.GetRecPos() < nEndPos) && !bError )
-+ {
-+ rStrm >> nOp;
-+
-+ // #98524# always reset flags
-+ aSRD.InitFlags();
-+ aCRD.InitFlags();
-+
-+ switch( nOp )
-+ {
-+ case 0x1C: // Error Value
-+ {
-+ rStrm >> nByte;
-+ DefTokenId eOc;
-+ switch( nByte )
-+ {
-+ case EXC_ERR_NULL:
-+ case EXC_ERR_DIV0:
-+ case EXC_ERR_VALUE:
-+ case EXC_ERR_REF:
-+ case EXC_ERR_NAME:
-+ case EXC_ERR_NUM: eOc = ocStop; break;
-+ case EXC_ERR_NA: eOc = ocNotAvail; break;
-+ default: eOc = ocNoName;
-+ }
-+ aPool << eOc;
-+ if( eOc != ocStop )
-+ aPool << ocOpen << ocClose;
-+ aPool >> aStack;
-+ }
-+ break;
-+ case 0x3A:
-+ {
-+ // cell reference in external range name
-+ sal_uInt16 nExtTab1, nExtTab2, nRow, nGrbitCol;
-+ rStrm >> nExtTab1 >> nExtTab2 >> nRow >> nGrbitCol;
-+ if (nExtTab1 >= nTabCount || nExtTab2 >= nTabCount)
-+ {
-+ bError = true;
-+ break;
-+ }
-+
-+ aSRD.nTab = nExtTab1;
-+ aSRD.SetFlag3D(true);
-+ aSRD.SetTabRel(false);
-+ ExcRelToScRel8(nRow, nGrbitCol, aSRD, true);
-+ aCRD.Ref1 = aCRD.Ref2 = aSRD;
-+ String aTabName = rTabNames[nExtTab1];
-
-+ if (nExtTab1 == nExtTab2)
-+ {
-+ // single cell reference
-+ aStack << aPool.StoreExtRef(nFileId, aTabName, aSRD);
-+ }
-+ else
-+ {
-+ // area reference
-+ aCRD.Ref2.nTab = nExtTab2;
-+ aStack << aPool.StoreExtRef(nFileId, aTabName, aCRD);
-+ }
-+ }
-+ break;
-+ default:
-+ bError = true;
-+ }
-+ bError |= !rStrm.IsValid();
-+ }
-+
-+ ConvErr eRet;
-+
-+ if( bError )
-+ {
-+ aPool << ocBad;
-+ aPool >> aStack;
-+ rpArray = aPool[ aStack.Get() ];
-+ eRet = ConvErrNi;
-+ }
-+ else if( rStrm.GetRecPos() != nEndPos )
-+ {
-+ aPool << ocBad;
-+ aPool >> aStack;
-+ rpArray = aPool[ aStack.Get() ];
-+ eRet = ConvErrCount;
-+ }
-+ else
-+ {
-+ rpArray = aPool[ aStack.Get() ];
-+ eRet = ConvOK;
-+ }
-+
-+ rStrm.Seek(nEndPos);
-+ return eRet;
-+}
-
- void ExcelToSc8::ExcRelToScRel8( UINT16 nRow, UINT16 nC, SingleRefData &rSRD, const BOOL bName )
- {
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index 2cc592c..7f1c44b 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -967,7 +967,7 @@ FltError ImportExcel8::Read( void )
- case EXC_ID_SUPBOOK: rLinkMgr.ReadSupbook( maStrm ); break;
- case EXC_ID_XCT: rLinkMgr.ReadXct( maStrm ); break;
- case EXC_ID_CRN: rLinkMgr.ReadCrn( maStrm ); break;
-- case EXC_ID_EXTERNNAME: rLinkMgr.ReadExternname( maStrm ); break;
-+ case EXC_ID_EXTERNNAME: rLinkMgr.ReadExternname( maStrm, pFormConv ); break;
-
- case EXC_ID_MSODRAWINGGROUP:rObjMgr.ReadMsoDrawingGroup( maStrm ); break;
-
-diff --git sc/source/filter/excel/tokstack.cxx sc/source/filter/excel/tokstack.cxx
-index 20ada63..9c4ddba 100644
---- sc/source/filter/excel/tokstack.cxx
-+++ sc/source/filter/excel/tokstack.cxx
-@@ -395,6 +395,34 @@ void TokenPool::GetElement( const UINT16 nId )
- pScToken->AddMatrix( p );
- }
- break;
-+ case T_ExtName:
-+ {
-+ UINT16 n = pElement[nId];
-+ if (n < maExtNames.size())
-+ {
-+ const ExtName& r = maExtNames[n];
-+ pScToken->AddExternalName(r.mnFileId, r.maName);
-+ }
-+ }
-+ case T_ExtRefC:
-+ {
-+ UINT16 n = pElement[nId];
-+ if (n < maExtCellRefs.size())
-+ {
-+ const ExtCellRef& r = maExtCellRefs[n];
-+ pScToken->AddExternalSingleReference(r.mnFileId, r.maTabName, r.maRef);
-+ }
-+ }
-+ case T_ExtRefA:
-+ {
-+ UINT16 n = pElement[nId];
-+ if (n < maExtAreaRefs.size())
-+ {
-+ const ExtAreaRef& r = maExtAreaRefs[n];
-+ pScToken->AddExternalDoubleReference(r.mnFileId, r.maTabName, r.maRef);
-+ }
-+ }
-+ break;
- default:
- DBG_ERROR("-TokenPool::GetElement(): Zustand undefiniert!?");
- }
-@@ -477,6 +505,34 @@ void TokenPool::GetElementRek( const UINT16 nId )
- pScToken->AddMatrix( p );
- }
- break;
-+ case T_ExtName:
-+ {
-+ UINT16 n = pElement[*pAkt];
-+ if (n < maExtNames.size())
-+ {
-+ const ExtName& r = maExtNames[n];
-+ pScToken->AddExternalName(r.mnFileId, r.maName);
-+ }
-+ }
-+ case T_ExtRefC:
-+ {
-+ UINT16 n = pElement[*pAkt];
-+ if (n < maExtCellRefs.size())
-+ {
-+ const ExtCellRef& r = maExtCellRefs[n];
-+ pScToken->AddExternalSingleReference(r.mnFileId, r.maTabName, r.maRef);
-+ }
-+ }
-+ case T_ExtRefA:
-+ {
-+ UINT16 n = pElement[*pAkt];
-+ if (n < maExtAreaRefs.size())
-+ {
-+ const ExtAreaRef& r = maExtAreaRefs[n];
-+ pScToken->AddExternalDoubleReference(r.mnFileId, r.maTabName, r.maRef);
-+ }
-+ }
-+ break;
- default:
- DBG_ERROR("-TokenPool::GetElementRek(): Zustand undefiniert!?");
- }
-@@ -724,9 +780,68 @@ const TokenId TokenPool::StoreMatrix( SCSIZE nC, SCSIZE nR )
- return ( const TokenId ) nElementAkt;
- }
-
-+const TokenId TokenPool::StoreExtName( sal_uInt16 nFileId, const String& rName )
-+{
-+ if ( nElementAkt >= nElement )
-+ GrowElement();
-+
-+ pElement[nElementAkt] = static_cast<UINT16>(maExtNames.size());
-+ pType[nElementAkt] = T_ExtName;
-+
-+ maExtNames.push_back(ExtName());
-+ ExtName& r = maExtNames.back();
-+ r.mnFileId = nFileId;
-+ r.maName = rName;
-+
-+ ++nElementAkt;
-+
-+ return static_cast<const TokenId>(nElementAkt);
-+}
-+
-+const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef )
-+{
-+ if ( nElementAkt >= nElement )
-+ GrowElement();
-+
-+ pElement[nElementAkt] = static_cast<UINT16>(maExtCellRefs.size());
-+ pType[nElementAkt] = T_ExtRefC;
-+
-+ maExtCellRefs.push_back(ExtCellRef());
-+ ExtCellRef& r = maExtCellRefs.back();
-+ r.mnFileId = nFileId;
-+ r.maTabName = rTabName;
-+ r.maRef = rRef;
-+
-+ ++nElementAkt;
-+
-+ return static_cast<const TokenId>(nElementAkt);
-+}
-+
-+const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef )
-+{
-+ if ( nElementAkt >= nElement )
-+ GrowElement();
-+
-+ pElement[nElementAkt] = static_cast<UINT16>(maExtAreaRefs.size());
-+ pType[nElementAkt] = T_ExtRefA;
-+
-+ maExtAreaRefs.push_back(ExtAreaRef());
-+ ExtAreaRef& r = maExtAreaRefs.back();
-+ r.mnFileId = nFileId;
-+ r.maTabName = rTabName;
-+ r.maRef = rRef;
-+
-+ ++nElementAkt;
-+
-+ return static_cast<const TokenId>(nElementAkt);
-+}
-+
- void TokenPool::Reset( void )
- {
- nP_IdAkt = nP_IdLast = nElementAkt = nP_StrAkt = nP_DblAkt = nP_ErrAkt = nP_RefTrAkt = nP_ExtAkt = nP_NlfAkt = nP_MatrixAkt = 0;
-+ maExtNames.clear();
-+ maExtCellRefs.clear();
-+ maExtAreaRefs.clear();
- }
-
-
-diff --git sc/source/filter/excel/xeformula.cxx sc/source/filter/excel/xeformula.cxx
-index 3db8da7..947b4ce 100644
---- sc/source/filter/excel/xeformula.cxx
-+++ sc/source/filter/excel/xeformula.cxx
-@@ -42,6 +42,11 @@
- #include "xelink.hxx"
- #include "xename.hxx"
-
-+#include "document.hxx"
-+#include "externalrefmgr.hxx"
-+
-+#include <memory>
-+
- // External reference log =====================================================
-
- XclExpRefLogEntry::XclExpRefLogEntry() :
-@@ -225,6 +230,32 @@ void XclExpFuncData::IncExpParamClassIdx()
- ++mnClassIdx;
- }
-
-+// reference handling ---------------------------------------------------------
-+
-+namespace {
-+
-+inline bool lclIsRefRel2D( const SingleRefData& rRefData )
-+{
-+ return rRefData.IsColRel() || rRefData.IsRowRel();
-+}
-+
-+inline bool lclIsRefDel2D( const SingleRefData& rRefData )
-+{
-+ return rRefData.IsColDeleted() || rRefData.IsRowDeleted();
-+}
-+
-+inline bool lclIsRefRel2D( const ComplRefData& rRefData )
-+{
-+ return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 );
-+}
-+
-+inline bool lclIsRefDel2D( const ComplRefData& rRefData )
-+{
-+ return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 );
-+}
-+
-+} // namespace
-+
- // ----------------------------------------------------------------------------
-
- /** Implementation class of the export formula compiler. */
-@@ -299,6 +330,7 @@ private:
- void ProcessBoolean( const XclExpTokenData& rTokData );
- void ProcessDdeLink( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessExternal( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
-+ void ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
-
- void ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void PrepareFunction( XclExpFuncData& rFuncData );
-@@ -1114,6 +1146,12 @@ XclExpTokenData XclExpFmlaCompImpl::Factor( XclExpTokenData aTokData, sal_uInt8
- StackVar eTokType = aTokData.GetType();
- OpCode eOpCode = aTokData.GetOpCode();
-
-+ if (eOpCode == ocExternalName)
-+ {
-+ ProcessExternalName( aTokData, nExpClass );
-+ return GetNextToken();
-+ }
-+
- switch( eTokType )
- {
- case svUnknown: mbOk = false; break;
-@@ -1248,6 +1286,131 @@ void XclExpFmlaCompImpl::ProcessExternal( const XclExpTokenData& rTokData, sal_u
- ProcessFunction( rTokData, nExpClass );
- }
-
-+void XclExpFmlaCompImpl::ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
-+{
-+ StackVar eType = rTokData.GetType();
-+
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ USHORT nFileId = rTokData.mpScToken->GetIndex();
-+ switch (eType)
-+ {
-+ case svSingleRef:
-+ {
-+ if (!mpScBasePos)
-+ {
-+ AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
-+ break;
-+ }
-+ SingleRefData aRef(rTokData.mpScToken->GetSingleRef());
-+ aRef.CalcAbsIfRel(*mpScBasePos);
-+ const String& rTabName = rTokData.mpScToken->GetString();
-+ ScToken* p = pRefMgr->getSingleRefToken(nFileId, rTabName, ScAddress(aRef.nCol, aRef.nRow, aRef.nTab), NULL, NULL);
-+ if (!p)
-+ {
-+ AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
-+ break;
-+ }
-+
-+ mpLinkMgr->StoreCell(nFileId, rTabName, aRef);
-+
-+ XclAddress aXclPos(ScAddress::UNINITIALIZED);
-+ ConvertRefData(aRef, aXclPos, false, false, false);
-+
-+ sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
-+ mpLinkMgr->FindExtSheet(nFileId, rTabName, 1, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry());
-+ sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D;
-+ AppendOpTokenId(GetTokenId(nBaseId, EXC_TOKCLASS_REF), nExpClass, rTokData.mnSpaces);
-+ Append(nExtSheet);
-+ if (meBiff <= EXC_BIFF5)
-+ {
-+ Append(0, 8);
-+ Append(static_cast<sal_uInt16>(nFirstSBTab));
-+ Append(static_cast<sal_uInt16>(nFirstSBTab));
-+ }
-+ AppendAddress(aXclPos);
-+ }
-+ break;
-+ case svDoubleRef:
-+ {
-+ if (!mpScBasePos)
-+ {
-+ AppendErrorToken(XclTools::GetXclErrorCode(errNoRef), rTokData.mnSpaces);
-+ break;
-+ }
-+ ComplRefData aRef(rTokData.mpScToken->GetDoubleRef());
-+ aRef.CalcAbsIfRel(*mpScBasePos);
-+ const String& rTabName = rTokData.mpScToken->GetString();
-+ const SingleRefData& r1 = aRef.Ref1;
-+ const SingleRefData& r2 = aRef.Ref2;
-+ ScRange aRange(r1.nCol, r1.nRow, r1.nTab, r2.nCol, r2.nRow, r2.nTab);
-+ ScTokenArray* pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, aRange, NULL);
-+ if (!pArray)
-+ {
-+ AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
-+ break;
-+ }
-+
-+ mpLinkMgr->StoreCellRange(nFileId, rTabName, aRef);
-+ XclRange aXclRange(ScAddress::UNINITIALIZED);
-+ ConvertRefData(aRef, aXclRange, false);
-+ sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
-+ sal_uInt16 nTabSpan = r2.nTab - r1.nTab + 1;
-+ mpLinkMgr->FindExtSheet(nFileId, rTabName, nTabSpan, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry());
-+
-+ sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D;
-+ AppendOpTokenId(GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces);
-+ Append(nExtSheet);
-+ if (meBiff <= EXC_BIFF5)
-+ {
-+ Append(0, 8);
-+ Append(static_cast<sal_uInt16>(nFirstSBTab));
-+ Append(static_cast<sal_uInt16>(nLastSBTab));
-+ }
-+ AppendRange(aXclRange);
-+ }
-+ break;
-+ case svExternalName:
-+ {
-+ const String& aName = rTokData.mpScToken->GetString();
-+ ScTokenArray* pArray = pRefMgr->getRangeNameTokens(nFileId, aName);
-+ if (!pArray || !mpScBasePos)
-+ {
-+ AppendErrorToken(XclTools::GetXclErrorCode(errNoName), rTokData.mnSpaces);
-+ break;
-+ }
-+
-+ // Go through all these tokens to store the external cell/range
-+ // references for CRN records.
-+ for (ScToken* p = pArray->First(); p; p = pArray->Next())
-+ {
-+ if (p->GetOpCode() == ocExternalName)
-+ {
-+ if (p->GetType() == svSingleRef)
-+ {
-+ SingleRefData aData(p->GetSingleRef());
-+ aData.CalcAbsIfRel(*mpScBasePos);
-+ mpLinkMgr->StoreCell(nFileId, p->GetString(), aData);
-+ }
-+ else if (p->GetType() == svDoubleRef)
-+ {
-+ ComplRefData aData(p->GetDoubleRef());
-+ aData.CalcAbsIfRel(*mpScBasePos);
-+ mpLinkMgr->StoreCellRange(nFileId, p->GetString(), aData);
-+ }
-+ }
-+ }
-+
-+ const String* pFile = pRefMgr->getExternalFileName(nFileId);
-+ sal_uInt16 nExtSheet, nExtName;
-+ if (mpLinkMgr->InsertExtName(nExtSheet, nExtName, *pFile, aName, pArray))
-+ AppendNameXToken(nExtSheet, nExtName, nExpClass, rTokData.mnSpaces);
-+ else
-+ AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
-+ }
-+ break;
-+ }
-+}
-+
- void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
- {
- OpCode eOpCode = rTokData.GetOpCode();
-@@ -1623,32 +1786,6 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData )
- }
- }
-
--// reference handling ---------------------------------------------------------
--
--namespace {
--
--inline bool lclIsRefRel2D( const SingleRefData& rRefData )
--{
-- return rRefData.IsColRel() || rRefData.IsRowRel();
--}
--
--inline bool lclIsRefDel2D( const SingleRefData& rRefData )
--{
-- return rRefData.IsColDeleted() || rRefData.IsRowDeleted();
--}
--
--inline bool lclIsRefRel2D( const ComplRefData& rRefData )
--{
-- return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 );
--}
--
--inline bool lclIsRefDel2D( const ComplRefData& rRefData )
--{
-- return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 );
--}
--
--} // namespace
--
- // ----------------------------------------------------------------------------
-
- SCTAB XclExpFmlaCompImpl::GetScTab( const SingleRefData& rRefData ) const
-diff --git sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xelink.cxx
-index b1bacad..08517ca 100644
---- sc/source/filter/excel/xelink.cxx
-+++ sc/source/filter/excel/xelink.cxx
-@@ -38,6 +38,14 @@
- #include "document.hxx"
- #include "cell.hxx"
- #include "scextopt.hxx"
-+#include "externalrefmgr.hxx"
-+
-+#include <vector>
-+#include <memory>
-+
-+using ::std::auto_ptr;
-+using ::std::find_if;
-+using ::std::vector;
-
- // ============================================================================
- // *** Helper classes ***
-@@ -102,6 +110,25 @@ private:
- XclExpCachedMatRef mxMatrix; /// Cached results of the DDE link.
- };
-
-+// ----------------------------------------------------------------------------
-+
-+class XclExpSupbook;
-+
-+class XclExpExtName : public XclExpExtNameBase
-+{
-+public:
-+ explicit XclExpExtName( const XclExpRoot& rRoot, const XclExpSupbook& rSupbook, const String& rName,
-+ const ScTokenArray* pArray );
-+
-+private:
-+ /** Writes additional record contents. */
-+ virtual void WriteAddData( XclExpStream& rStrm );
-+
-+private:
-+ const XclExpSupbook& mrSupbook;
-+ auto_ptr<ScTokenArray> mpArray;
-+};
-+
- // List of external names =====================================================
-
- /** List of all external names of a sheet. */
-@@ -117,6 +144,8 @@ public:
- @return The 1-based (Excel-like) list index of the DDE link. */
- sal_uInt16 InsertDde( const String& rApplic, const String& rTopic, const String& rItem );
-
-+ sal_uInt16 InsertExtName( const XclExpSupbook& rSupbook, const String& rName, const ScTokenArray* pArray );
-+
- /** Writes the EXTERNNAME record list. */
- virtual void Save( XclExpStream& rStrm );
-
-@@ -220,6 +249,9 @@ public:
- /** Stores all cells in the given range in the CRN list. */
- void StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange );
-
-+ void StoreCell( const XclExpRoot& rRoot, const ScAddress& rCell, const ScToken& rToken );
-+ void StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange, const ScToken& rToken );
-+
- /** Writes the XCT and all CRN records. */
- virtual void Save( XclExpStream& rStrm );
-
-@@ -319,6 +351,12 @@ public:
- /** Stores all cells in the given range in the CRN list of the specified SUPBOOK sheet. */
- void StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab );
-
-+ void StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const ScToken& rToken );
-+ void StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const ScToken& rToken );
-+
-+ sal_uInt16 GetTabIndex( const String& rTabName ) const;
-+ sal_uInt16 GetTabCount() const;
-+
- /** Inserts a new sheet name into the SUPBOOK and returns the SUPBOOK internal sheet index. */
- sal_uInt16 InsertTabName( const String& rTabName );
- /** Finds or inserts an EXTERNNAME record for add-ins.
-@@ -328,6 +366,8 @@ public:
- @return The 1-based EXTERNNAME record index; or 0, if the record list is full. */
- sal_uInt16 InsertDde( const String& rItem );
-
-+ sal_uInt16 InsertExtName( const String& rName, const ScTokenArray* pArray );
-+
- /** Writes the SUPBOOK and all EXTERNNAME, XCT and CRN records. */
- virtual void Save( XclExpStream& rStrm );
-
-@@ -394,6 +434,9 @@ public:
- /** Stores all cells in the given range in a CRN record list. */
- void StoreCellRange( const ScRange& rRange );
-
-+ void StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell );
-+ void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange );
-+
- /** Finds or inserts an EXTERNNAME record for an add-in function name.
- @param rnSupbook Returns the index of the SUPBOOK record which contains the add-in function name.
- @param rnExtName Returns the 1-based EXTERNNAME record index. */
-@@ -407,9 +450,25 @@ public:
- sal_uInt16& rnSupbook, sal_uInt16& rnExtName,
- const String& rApplic, const String& rTopic, const String& rItem );
-
-+ bool InsertExtName(
-+ sal_uInt16& rnSupbook, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray );
-+
-+ XclExpXti GetXti( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ XclExpRefLogEntry* pRefLogEntry = NULL );
-+
- /** Writes all SUPBOOK records with their sub records. */
- virtual void Save( XclExpStream& rStrm );
-
-+ struct XclExpSBIndex
-+ {
-+ sal_uInt16 mnSupbook; /// SUPBOOK index for an Excel sheet.
-+ sal_uInt16 mnSBTab; /// Sheet name index in SUPBOOK for an Excel sheet.
-+ inline void Set( sal_uInt16 nSupbook, sal_uInt16 nSBTab )
-+ { mnSupbook = nSupbook; mnSBTab = nSBTab; }
-+ };
-+ typedef ::std::vector< XclExpSBIndex > XclExpSBIndexVec;
-+
- private:
- typedef XclExpRecordList< XclExpSupbook > XclExpSupbookList;
- typedef XclExpSupbookList::RecordRefType XclExpSupbookRef;
-@@ -431,19 +490,8 @@ private:
- /** Appends a new SUPBOOK to the list.
- @return The list index of the SUPBOOK record. */
- sal_uInt16 Append( XclExpSupbookRef xSupbook );
-- /** Creates and appends an external SUPBOOK record from the Calc sheet nScTab. */
-- void AddExtSupbook( SCTAB nScTab );
-
- private:
-- struct XclExpSBIndex
-- {
-- sal_uInt16 mnSupbook; /// SUPBOOK index for an Excel sheet.
-- sal_uInt16 mnSBTab; /// Sheet name in SUPBOOK for an Excel sheet.
-- inline void Set( sal_uInt16 nSupbook, sal_uInt16 nSBTab )
-- { mnSupbook = nSupbook; mnSBTab = nSBTab; }
-- };
-- typedef ::std::vector< XclExpSBIndex > XclExpSBIndexVec;
--
- XclExpSupbookList maSupbookList; /// List of all SUPBOOK records.
- XclExpSBIndexVec maSBIndexVec; /// SUPBOOK and sheet name index for each Excel sheet.
- sal_uInt16 mnOwnDocSB; /// Index to SUPBOOK for own document.
-@@ -464,9 +512,16 @@ public:
- /** Derived classes search for a special EXTERNSHEET index for the own document. */
- virtual sal_uInt16 FindExtSheet( sal_Unicode cCode ) = 0;
-
-+ virtual void FindExtSheet( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry ) = 0;
-+
- /** Derived classes store all cells in the given range in a CRN record list. */
- virtual void StoreCellRange( const SingleRefData& rRef1, const SingleRefData& rRef2 ) = 0;
-
-+ virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef ) = 0;
-+ virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef1, const SingleRefData& rRef2 ) = 0;
-+
- /** Derived classes find or insert an EXTERNNAME record for an add-in function name. */
- virtual bool InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
-@@ -476,6 +531,10 @@ public:
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rApplic, const String& rTopic, const String& rItem ) = 0;
-
-+ virtual bool InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray ) = 0;
-+
- /** Derived classes write the entire link table to the passed stream. */
- virtual void Save( XclExpStream& rStrm ) = 0;
-
-@@ -497,15 +556,27 @@ public:
- XclExpRefLogEntry* pRefLogEntry );
- virtual sal_uInt16 FindExtSheet( sal_Unicode cCode );
-
-+ virtual void FindExtSheet( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry );
-+
- virtual void StoreCellRange( const SingleRefData& rRef1, const SingleRefData& rRef2 );
-
-+ virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+ virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef1, const SingleRefData& rRef2 );
-+
- virtual bool InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rName );
-+
- virtual bool InsertDde(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rApplic, const String& rTopic, const String& rItem );
-
-+ virtual bool InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray );
-+
- virtual void Save( XclExpStream& rStrm );
-
- private:
-@@ -550,15 +621,27 @@ public:
- XclExpRefLogEntry* pRefLogEntry );
- virtual sal_uInt16 FindExtSheet( sal_Unicode cCode );
-
-+ virtual void FindExtSheet( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry );
-+
- virtual void StoreCellRange( const SingleRefData& rRef1, const SingleRefData& rRef2 );
-
-+ virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+ virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef1, const SingleRefData& rRef2 );
-+
- virtual bool InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rName );
-+
- virtual bool InsertDde(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rApplic, const String& rTopic, const String& rItem );
-
-+ virtual bool InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray );
-+
- virtual void Save( XclExpStream& rStrm );
-
- private:
-@@ -885,6 +968,100 @@ void XclExpExtNameDde::WriteAddData( XclExpStream& rStrm )
- mxMatrix->Save( rStrm );
- }
-
-+// ----------------------------------------------------------------------------
-+
-+XclExpExtName::XclExpExtName( const XclExpRoot& rRoot, const XclExpSupbook& rSupbook, const String& rName, const ScTokenArray* pArray ) :
-+ XclExpExtNameBase( rRoot, rName ),
-+ mrSupbook(rSupbook),
-+ mpArray(pArray->Clone())
-+{
-+}
-+
-+void XclExpExtName::WriteAddData( XclExpStream& rStrm )
-+{
-+ // Write only if it only has a single token that is either a cell or cell
-+ // range address. Excel just writes '02 00 1C 17' for all the other types
-+ // of external names.
-+
-+ do
-+ {
-+ if (mpArray->GetLen() != 1)
-+ break;
-+
-+ const ScToken* p = mpArray->First();
-+ if (p->GetOpCode() != ocExternalName)
-+ break;
-+
-+ switch (p->GetType())
-+ {
-+ case svSingleRef:
-+ {
-+ const SingleRefData& rRef = p->GetSingleRef();
-+ if (rRef.IsTabRel())
-+ break;
-+
-+ bool bColRel = rRef.IsColRel();
-+ bool bRowRel = rRef.IsRowRel();
-+ sal_uInt16 nCol = bColRel ? rRef.nRelCol : rRef.nCol;
-+ sal_uInt16 nRow = bRowRel ? rRef.nRelRow : rRef.nRow;
-+ if (bColRel) nCol |= 0x4000;
-+ if (bRowRel) nCol |= 0x8000;
-+
-+ const String& rTabName = p->GetString();
-+ sal_uInt16 nSBTab = mrSupbook.GetTabIndex(rTabName);
-+
-+ // size is always 9
-+ rStrm << static_cast<sal_uInt16>(9);
-+ // operator token (3A for cell reference)
-+ rStrm << static_cast<sal_uInt8>(0x3A);
-+ // cell address (Excel's address has 2 sheet IDs.)
-+ rStrm << nSBTab << nSBTab << nRow << nCol;
-+ return;
-+ }
-+ case svDoubleRef:
-+ {
-+ const ComplRefData& rRef = p->GetDoubleRef();
-+ const SingleRefData& r1 = rRef.Ref1;
-+ const SingleRefData& r2 = rRef.Ref2;
-+ if (r1.IsTabRel() || r2.IsTabRel())
-+ break;
-+
-+ sal_uInt16 nTab1 = r1.nTab;
-+ sal_uInt16 nTab2 = r2.nTab;
-+ bool bCol1Rel = r1.IsColRel();
-+ bool bRow1Rel = r1.IsRowRel();
-+ bool bCol2Rel = r2.IsColRel();
-+ bool bRow2Rel = r2.IsRowRel();
-+
-+ sal_uInt16 nCol1 = bCol1Rel ? r1.nRelCol : r1.nCol;
-+ sal_uInt16 nCol2 = bCol2Rel ? r2.nRelCol : r2.nCol;
-+ sal_uInt16 nRow1 = bRow1Rel ? r1.nRelRow : r1.nRow;
-+ sal_uInt16 nRow2 = bRow2Rel ? r2.nRelRow : r2.nRow;
-+ if (bCol1Rel) nCol1 |= 0x4000;
-+ if (bRow1Rel) nCol1 |= 0x8000;
-+ if (bCol2Rel) nCol2 |= 0x4000;
-+ if (bRow2Rel) nCol2 |= 0x8000;
-+
-+ const String& rTabName = p->GetString();
-+ sal_uInt16 nSBTab = mrSupbook.GetTabIndex(rTabName);
-+
-+ // size is always 13 (0x0D)
-+ rStrm << static_cast<sal_uInt16>(13);
-+ // operator token (3B for area reference)
-+ rStrm << static_cast<sal_uInt8>(0x3B);
-+ // range (area) address
-+ sal_uInt16 nSBTab2 = nSBTab + nTab2 - nTab1;
-+ rStrm << nSBTab << nSBTab2 << nRow1 << nRow2 << nCol1 << nCol2;
-+ return;
-+ }
-+ }
-+ }
-+ while (false);
-+
-+ // special value for #REF! (02 00 1C 17)
-+ rStrm << static_cast<sal_uInt16>(2) << EXC_TOKID_ERR << EXC_ERR_REF;
-+}
-+
- // List of external names =====================================================
-
- XclExpExtNameBuffer::XclExpExtNameBuffer( const XclExpRoot& rRoot ) :
-@@ -920,6 +1097,12 @@ sal_uInt16 XclExpExtNameBuffer::InsertDde(
- return nIndex;
- }
-
-+sal_uInt16 XclExpExtNameBuffer::InsertExtName( const XclExpSupbook& rSupbook, const String& rName, const ScTokenArray* pArray )
-+{
-+ sal_uInt16 nIndex = GetIndex( rName );
-+ return nIndex ? nIndex : AppendNew( new XclExpExtName( GetRoot(), rSupbook, rName, pArray ) );
-+}
-+
- void XclExpExtNameBuffer::Save( XclExpStream& rStrm )
- {
- maNameList.Save( rStrm );
-@@ -1066,6 +1249,78 @@ void XclExpXct::StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange )
- maUsedCells.SetMultiMarkArea( rRange );
- }
-
-+void XclExpXct::StoreCell( const XclExpRoot& /*rRoot*/, const ScAddress& rCell, const ScToken& rToken )
-+{
-+ switch (rToken.GetType())
-+ {
-+ case svString:
-+ {
-+ XclExpCrnRef xCrn(
-+ new XclExpCrnString(rCell.Col(), rCell.Row(), rToken.GetString()));
-+ maCrnList.AppendRecord(xCrn);
-+ }
-+ break;
-+ case svDouble:
-+ {
-+ XclExpCrnRef xCrn(
-+ new XclExpCrnDouble(rCell.Col(), rCell.Row(), rToken.GetDouble()));
-+ maCrnList.AppendRecord(xCrn);
-+ }
-+ break;
-+ case svEmptyCell:
-+ {
-+ XclExpCrnRef xCrn(
-+ new XclExpCrnDouble(rCell.Col(), rCell.Row(), 0.0));
-+ maCrnList.AppendRecord(xCrn);
-+ }
-+ break;
-+ }
-+}
-+
-+void XclExpXct::StoreCellRange( const XclExpRoot& /*rRoot*/, const ScRange& rRange, const ScToken& rToken )
-+{
-+ if (rToken.GetType() != svMatrix)
-+ return;
-+
-+ if (rRange.aStart.Tab() != rRange.aEnd.Tab())
-+ // multi-table range is not supported here.
-+ return;
-+
-+ const ScMatrix* pMtx = rToken.GetMatrix();
-+ if (!pMtx)
-+ return;
-+
-+ SCSIZE nCols, nRows;
-+ pMtx->GetDimensions(nCols, nRows);
-+ const ScAddress& s = rRange.aStart;
-+ const ScAddress& e = rRange.aEnd;
-+ if (static_cast<SCCOL>(nCols) != e.Col() - s.Col() + 1 ||
-+ static_cast<SCROW>(nRows) != e.Row() - s.Row() + 1)
-+ {
-+ // size mis-match!
-+ return;
-+ }
-+
-+ for (SCSIZE nCol = 0; nCol < nCols; ++nCol)
-+ {
-+ for (SCSIZE nRow = 0; nRow < nRows; ++nRow)
-+ {
-+ if (pMtx->IsString(nCol, nRow))
-+ {
-+ XclExpCrnRef xCrn(new XclExpCrnString(
-+ s.Col() + nCol, s.Row() + nRow, pMtx->GetString(nCol, nRow)));
-+ maCrnList.AppendRecord(xCrn);
-+ }
-+ else if (pMtx->IsValueOrEmpty(nCol, nRow))
-+ {
-+ XclExpCrnRef xCrn(new XclExpCrnDouble(
-+ s.Col() + nCol, s.Row() + nRow, pMtx->GetDouble(nCol, nRow)));
-+ maCrnList.AppendRecord(xCrn);
-+ }
-+ }
-+ }
-+}
-+
- void XclExpXct::Save( XclExpStream& rStrm )
- {
- XclExpRecord::Save( rStrm );
-@@ -1168,6 +1423,17 @@ XclExpSupbook::XclExpSupbook( const XclExpRoot& rRoot, const String& rUrl ) :
- mnXclTabCount( 0 )
- {
- SetRecSize( 2 + maUrlEncoded.GetSize() );
-+
-+ // We need to create all tables up front to ensure the correct table order.
-+ ScExternalRefManager* pRefMgr = rRoot.GetDoc().GetExternalRefManager();
-+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(rUrl);
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ return;
-+
-+ vector<String>::const_iterator itr = pTabNames->begin(), itrEnd = pTabNames->end();
-+ for (; itr != itrEnd; ++itr)
-+ InsertTabName(*itr);
- }
-
- XclExpSupbook::XclExpSupbook( const XclExpRoot& rRoot, const String& rApplic, const String& rTopic ) :
-@@ -1206,6 +1472,46 @@ void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab )
- xXct->StoreCellRange( GetRoot(), rRange );
- }
-
-+void XclExpSupbook::StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const ScToken& rToken )
-+{
-+ XclExpXctRef xXct = maXctList.GetRecord(nSBTab);
-+ if (!xXct.is())
-+ return;
-+
-+ xXct->StoreCell(GetRoot(), rCell, rToken);
-+}
-+
-+void XclExpSupbook::StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const ScToken& rToken )
-+{
-+ if (rRange.aStart.Tab() != rRange.aEnd.Tab())
-+ // multi-table range is not allowed!
-+ return;
-+
-+ XclExpXctRef xXct = maXctList.GetRecord(nSBTab);
-+ if (!xXct.is())
-+ return;
-+
-+ xXct->StoreCellRange(GetRoot(), rRange, rToken);
-+}
-+
-+sal_uInt16 XclExpSupbook::GetTabIndex( const String& rTabName ) const
-+{
-+ XclExpString aXclName(rTabName);
-+ size_t nSize = maXctList.GetSize();
-+ for (size_t i = 0; i < nSize; ++i)
-+ {
-+ XclExpXctRef aRec = maXctList.GetRecord(i);
-+ if (aXclName == aRec->GetTabName())
-+ return ulimit_cast<sal_uInt16>(i);
-+ }
-+ return EXC_NOTAB;
-+}
-+
-+sal_uInt16 XclExpSupbook::GetTabCount() const
-+{
-+ return ulimit_cast<sal_uInt16>(maXctList.GetSize());
-+}
-+
- sal_uInt16 XclExpSupbook::InsertTabName( const String& rTabName )
- {
- DBG_ASSERT( meType == EXC_SBTYPE_EXTERN, "XclExpSupbook::InsertTabName - don't insert sheet names here" );
-@@ -1226,6 +1532,11 @@ sal_uInt16 XclExpSupbook::InsertDde( const String& rItem )
- return GetExtNameBuffer().InsertDde( maUrl, maDdeTopic, rItem );
- }
-
-+sal_uInt16 XclExpSupbook::InsertExtName( const String& rName, const ScTokenArray* pArray )
-+{
-+ return GetExtNameBuffer().InsertExtName(*this, rName, pArray);
-+}
-+
- void XclExpSupbook::Save( XclExpStream& rStrm )
- {
- // SUPBOOK record
-@@ -1289,11 +1600,6 @@ XclExpSupbookBuffer::XclExpSupbookBuffer( const XclExpRoot& rRoot ) :
- mnOwnDocSB = Append( xSupbook );
- for( sal_uInt16 nXclTab = 0; nXclTab < nXclCnt; ++nXclTab )
- maSBIndexVec[ nXclTab ].Set( mnOwnDocSB, nXclTab );
--
-- // add SUPBOOKs with external references
-- for( SCTAB nScTab = 0, nScCnt = rTabInfo.GetScTabCount(); nScTab < nScCnt; ++nScTab )
-- if( rTabInfo.IsExternalTab( nScTab ) )
-- AddExtSupbook( nScTab );
- }
- }
-
-@@ -1352,6 +1658,130 @@ void XclExpSupbookBuffer::StoreCellRange( const ScRange& rRange )
- }
- }
-
-+namespace {
-+
-+class FindSBIndexEntry
-+{
-+public:
-+ explicit FindSBIndexEntry(sal_uInt16 nSupbookId, sal_uInt16 nTabId) :
-+ mnSupbookId(nSupbookId), mnTabId(nTabId) {}
-+
-+ bool operator()(const XclExpSupbookBuffer::XclExpSBIndex& r) const
-+ {
-+ return mnSupbookId == r.mnSupbook && mnTabId == r.mnSBTab;
-+ }
-+
-+private:
-+ sal_uInt16 mnSupbookId;
-+ sal_uInt16 mnTabId;
-+};
-+
-+}
-+
-+void XclExpSupbookBuffer::StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell )
-+{
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ const String* pUrl = pRefMgr->getExternalFileName(nFileId);
-+ if (!pUrl)
-+ return;
-+
-+ XclExpSupbookRef xSupbook;
-+ sal_uInt16 nSupbookId;
-+ if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl))
-+ {
-+ xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl));
-+ nSupbookId = Append(xSupbook);
-+ }
-+
-+ ScToken* pToken = pRefMgr->getSingleRefToken(nFileId, rTabName, rCell, NULL, NULL);
-+ if (!pToken)
-+ return;
-+
-+ sal_uInt16 nSheetId = xSupbook->GetTabIndex(rTabName);
-+ if (nSheetId == EXC_NOTAB)
-+ // specified table name not found in this SUPBOOK.
-+ return;
-+
-+ FindSBIndexEntry f(nSupbookId, nSheetId);
-+ XclExpSBIndexVec::iterator itrEnd = maSBIndexVec.end();
-+ XclExpSBIndexVec::const_iterator itr = find_if(maSBIndexVec.begin(), itrEnd, f);
-+ if (itr == itrEnd)
-+ {
-+ maSBIndexVec.push_back(XclExpSBIndex());
-+ XclExpSBIndex& r = maSBIndexVec.back();
-+ r.mnSupbook = nSupbookId;
-+ r.mnSBTab = nSheetId;
-+ }
-+
-+ xSupbook->StoreCell(nSheetId, rCell, *pToken);
-+}
-+
-+void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange )
-+{
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ const String* pUrl = pRefMgr->getExternalFileName(nFileId);
-+ if (!pUrl)
-+ return;
-+
-+ XclExpSupbookRef xSupbook;
-+ sal_uInt16 nSupbookId;
-+ if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl))
-+ {
-+ xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl));
-+ nSupbookId = Append(xSupbook);
-+ }
-+
-+ SCTAB nTabCount = rRange.aEnd.Tab() - rRange.aStart.Tab() + 1;
-+
-+ // If this is a multi-table range, get token for each table.
-+ vector<ScToken*> aMatrixList;
-+ aMatrixList.reserve(nTabCount);
-+
-+ // This is a new'ed instance, so we must manage its life cycle here.
-+ ScTokenArray* pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, rRange, NULL);
-+ if (!pArray)
-+ return;
-+
-+ for (ScToken* p = pArray->First(); p; p = pArray->Next())
-+ {
-+ if (p->GetType() == svMatrix)
-+ aMatrixList.push_back(p);
-+ else if (p->GetOpCode() != ocSep)
-+ {
-+ // This is supposed to be ocSep!!!
-+ return;
-+ }
-+ }
-+
-+ if (aMatrixList.size() != static_cast<size_t>(nTabCount))
-+ {
-+ // matrix size mis-match !
-+ return;
-+ }
-+
-+ sal_uInt16 nFirstSheetId = xSupbook->GetTabIndex(rTabName);
-+
-+ ScRange aRange(rRange);
-+ aRange.aStart.SetTab(0);
-+ aRange.aEnd.SetTab(0);
-+ for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
-+ {
-+ sal_uInt16 nSheetId = nFirstSheetId + static_cast<sal_uInt16>(nTab);
-+ FindSBIndexEntry f(nSupbookId, nSheetId);
-+ XclExpSBIndexVec::iterator itrEnd = maSBIndexVec.end();
-+ XclExpSBIndexVec::const_iterator itr = find_if(maSBIndexVec.begin(), itrEnd, f);
-+ if (itr == itrEnd)
-+ {
-+ maSBIndexVec.push_back(XclExpSBIndex());
-+ XclExpSBIndex& r = maSBIndexVec.back();
-+ r.mnSupbook = nSupbookId;
-+ r.mnSBTab = nSheetId;
-+ }
-+
-+ xSupbook->StoreCellRange(nSheetId, aRange, *aMatrixList[nTab]);
-+ }
-+}
-+
- bool XclExpSupbookBuffer::InsertAddIn(
- sal_uInt16& rnSupbook, sal_uInt16& rnExtName, const String& rName )
- {
-@@ -1383,6 +1813,78 @@ bool XclExpSupbookBuffer::InsertDde(
- return rnExtName > 0;
- }
-
-+bool XclExpSupbookBuffer::InsertExtName(
-+ sal_uInt16& rnSupbook, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray )
-+{
-+ XclExpSupbookRef xSupbook;
-+ if (!GetSupbookUrl(xSupbook, rnSupbook, rUrl))
-+ {
-+ xSupbook.reset( new XclExpSupbook(GetRoot(), rUrl) );
-+ rnSupbook = Append(xSupbook);
-+ }
-+ rnExtName = xSupbook->InsertExtName(rName, pArray);
-+ return rnExtName > 0;
-+}
-+
-+XclExpXti XclExpSupbookBuffer::GetXti( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ XclExpRefLogEntry* pRefLogEntry )
-+{
-+ XclExpXti aXti(0, EXC_NOTAB, EXC_NOTAB);
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ const String* pUrl = pRefMgr->getExternalFileName(nFileId);
-+ if (!pUrl)
-+ return aXti;
-+
-+ XclExpSupbookRef xSupbook;
-+ sal_uInt16 nSupbookId;
-+ if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl))
-+ {
-+ xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl));
-+ nSupbookId = Append(xSupbook);
-+ }
-+ aXti.mnSupbook = nSupbookId;
-+
-+ sal_uInt16 nFirstSheetId = xSupbook->GetTabIndex(rTabName);
-+ if (nFirstSheetId == EXC_NOTAB)
-+ {
-+ // first sheet not found in SUPBOOK.
-+ return aXti;
-+ }
-+ sal_uInt16 nSheetCount = xSupbook->GetTabCount();
-+ for (sal_uInt16 i = 0; i < nXclTabSpan; ++i)
-+ {
-+ sal_uInt16 nSheetId = nFirstSheetId + i;
-+ if (nSheetId >= nSheetCount)
-+ return aXti;
-+
-+ FindSBIndexEntry f(nSupbookId, nSheetId);
-+ XclExpSBIndexVec::iterator itrEnd = maSBIndexVec.end();
-+ XclExpSBIndexVec::const_iterator itr = find_if(maSBIndexVec.begin(), itrEnd, f);
-+ if (itr == itrEnd)
-+ {
-+ maSBIndexVec.push_back(XclExpSBIndex());
-+ XclExpSBIndex& r = maSBIndexVec.back();
-+ r.mnSupbook = nSupbookId;
-+ r.mnSBTab = nSheetId;
-+ }
-+ if (i == 0)
-+ aXti.mnFirstSBTab = nSheetId;
-+ if (i == nXclTabSpan - 1)
-+ aXti.mnLastSBTab = nSheetId;
-+ }
-+
-+ if (pRefLogEntry)
-+ {
-+ pRefLogEntry->mnFirstXclTab = 0;
-+ pRefLogEntry->mnLastXclTab = 0;
-+ if (xSupbook.is())
-+ xSupbook->FillRefLogEntry(*pRefLogEntry, aXti.mnFirstSBTab, aXti.mnLastSBTab);
-+ }
-+
-+ return aXti;
-+}
-+
- void XclExpSupbookBuffer::Save( XclExpStream& rStrm )
- {
- maSupbookList.Save( rStrm );
-@@ -1424,27 +1926,6 @@ sal_uInt16 XclExpSupbookBuffer::Append( XclExpSupbookRef xSupbook )
- return ulimit_cast< sal_uInt16 >( maSupbookList.GetSize() - 1 );
- }
-
--void XclExpSupbookBuffer::AddExtSupbook( SCTAB nScTab )
--{
-- sal_uInt16 nXclTab = GetTabInfo().GetXclTab( nScTab );
-- DBG_ASSERT( nXclTab < maSBIndexVec.size(), "XclExpSupbookBuffer::AddExtSupbook - out of range" );
--
-- // find ext doc name or append new one, save position in maSBIndexBuffer
-- const String& rUrl = GetDoc().GetLinkDoc( nScTab );
-- DBG_ASSERT( rUrl.Len(), "XclExpSupbookBuffer::AddExtSupbook - missing external linked sheet" );
-- sal_uInt16 nSupbook;
-- XclExpSupbookRef xSupbook;
-- if( !GetSupbookUrl( xSupbook, nSupbook, rUrl ) )
-- {
-- xSupbook.reset( new XclExpSupbook( GetRoot(), rUrl ) );
-- nSupbook = Append( xSupbook );
-- }
--
-- // append new sheet name, save SUPBOOK and sheet position in maSBIndexVec
-- maSBIndexVec[ nXclTab ].mnSupbook = nSupbook;
-- maSBIndexVec[ nXclTab ].mnSBTab = xSupbook->InsertTabName( GetDoc().GetLinkTab( nScTab ) );
--}
--
- // Export link manager ========================================================
-
- XclExpLinkManagerImpl::XclExpLinkManagerImpl( const XclExpRoot& rRoot ) :
-@@ -1485,11 +1966,29 @@ sal_uInt16 XclExpLinkManagerImpl5::FindExtSheet( sal_Unicode cCode )
- return nExtSheet;
- }
-
-+void XclExpLinkManagerImpl5::FindExtSheet(
-+ sal_uInt16 /*nFileId*/, const String& /*rTabName*/, sal_uInt16 /*nXclTabSpan*/,
-+ sal_uInt16& /*rnExtSheet*/, sal_uInt16& /*rnFirstSBTab*/, sal_uInt16& /*rnLastSBTab*/,
-+ XclExpRefLogEntry* /*pRefLogEntry*/ )
-+{
-+ // not implemented
-+}
-+
- void XclExpLinkManagerImpl5::StoreCellRange( const SingleRefData& /*rRef1*/, const SingleRefData& /*rRef2*/ )
- {
- // not implemented
- }
-
-+void XclExpLinkManagerImpl5::StoreCell( sal_uInt16 /*nFileId*/, const String& /*rTabName*/, const SingleRefData& /*rRef*/ )
-+{
-+ // not implemented
-+}
-+
-+void XclExpLinkManagerImpl5::StoreCellRange( sal_uInt16 /*nFileId*/, const String& /*rTabName*/, const SingleRefData& /*rRef1*/, const SingleRefData& /*rRef2*/ )
-+{
-+ // not implemented
-+}
-+
- bool XclExpLinkManagerImpl5::InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
- {
-@@ -1510,6 +2009,14 @@ bool XclExpLinkManagerImpl5::InsertDde(
- return false;
- }
-
-+bool XclExpLinkManagerImpl5::InsertExtName(
-+ sal_uInt16& /*rnExtSheet*/, sal_uInt16& /*rnExtName*/, const String& /*rUrl*/,
-+ const String& /*rName*/, const ScTokenArray* /*pArray*/ )
-+{
-+ // not implemented
-+ return false;
-+}
-+
- void XclExpLinkManagerImpl5::Save( XclExpStream& rStrm )
- {
- if( sal_uInt16 nExtSheetCount = GetExtSheetCount() )
-@@ -1630,6 +2137,17 @@ sal_uInt16 XclExpLinkManagerImpl8::FindExtSheet( sal_Unicode cCode )
- return InsertXti( maSBBuffer.GetXti( EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) );
- }
-
-+void XclExpLinkManagerImpl8::FindExtSheet(
-+ sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry )
-+{
-+ XclExpXti aXti = maSBBuffer.GetXti(nFileId, rTabName, nXclTabSpan, pRefLogEntry);
-+ rnExtSheet = InsertXti(aXti);
-+ rnFirstSBTab = aXti.mnFirstSBTab;
-+ rnLastSBTab = aXti.mnLastSBTab;
-+}
-+
- void XclExpLinkManagerImpl8::StoreCellRange( const SingleRefData& rRef1, const SingleRefData& rRef2 )
- {
- if( !rRef1.IsDeleted() && !rRef2.IsDeleted() && (rRef1.nTab >= 0) && (rRef2.nTab >= 0) )
-@@ -1652,6 +2170,19 @@ void XclExpLinkManagerImpl8::StoreCellRange( const SingleRefData& rRef1, const S
- }
- }
-
-+void XclExpLinkManagerImpl8::StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef )
-+{
-+ ScAddress aAddr(rRef.nCol, rRef.nRow, rRef.nTab);
-+ maSBBuffer.StoreCell(nFileId, rTabName, aAddr);
-+}
-+
-+void XclExpLinkManagerImpl8::StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef1, const SingleRefData& rRef2 )
-+{
-+ ScRange aRange(static_cast<SCCOL>(rRef1.nCol), static_cast<SCROW>(rRef1.nRow), static_cast<SCTAB>(rRef1.nTab),
-+ static_cast<SCCOL>(rRef2.nCol), static_cast<SCROW>(rRef2.nRow), static_cast<SCTAB>(rRef2.nTab));
-+ maSBBuffer.StoreCellRange(nFileId, rTabName, aRange);
-+}
-+
- bool XclExpLinkManagerImpl8::InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
- {
-@@ -1677,6 +2208,18 @@ bool XclExpLinkManagerImpl8::InsertDde(
- return false;
- }
-
-+bool XclExpLinkManagerImpl8::InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName, const String& rUrl, const ScTokenArray* pArray )
-+{
-+ sal_uInt16 nSupbook;
-+ if( maSBBuffer.InsertExtName( nSupbook, rnExtName, rUrl, rName, pArray ) )
-+ {
-+ rnExtSheet = InsertXti( XclExpXti( nSupbook, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) );
-+ return true;
-+ }
-+ return false;
-+}
-+
- void XclExpLinkManagerImpl8::Save( XclExpStream& rStrm )
- {
- if( !maXtiVec.empty() )
-@@ -1745,6 +2288,13 @@ sal_uInt16 XclExpLinkManager::FindExtSheet( sal_Unicode cCode )
- return mxImpl->FindExtSheet( cCode );
- }
-
-+void XclExpLinkManager::FindExtSheet( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry )
-+{
-+ mxImpl->FindExtSheet( nFileId, rTabName, nXclTabSpan, rnExtSheet, rnFirstSBTab, rnLastSBTab, pRefLogEntry );
-+}
-+
- void XclExpLinkManager::StoreCell( const SingleRefData& rRef )
- {
- mxImpl->StoreCellRange( rRef, rRef );
-@@ -1755,6 +2305,16 @@ void XclExpLinkManager::StoreCellRange( const ComplRefData& rRef )
- mxImpl->StoreCellRange( rRef.Ref1, rRef.Ref2 );
- }
-
-+void XclExpLinkManager::StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef )
-+{
-+ mxImpl->StoreCell( nFileId, rTabName, rRef );
-+}
-+
-+void XclExpLinkManager::StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef )
-+{
-+ mxImpl->StoreCellRange( nFileId, rTabName, rRef.Ref1, rRef.Ref2 );
-+}
-+
- bool XclExpLinkManager::InsertAddIn(
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
- {
-@@ -1768,6 +2328,13 @@ bool XclExpLinkManager::InsertDde(
- return mxImpl->InsertDde( rnExtSheet, rnExtName, rApplic, rTopic, rItem );
- }
-
-+bool XclExpLinkManager::InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName, const String& rUrl,
-+ const ScTokenArray* pArray )
-+{
-+ return mxImpl->InsertExtName( rnExtSheet, rnExtName, rUrl, rName, pArray );
-+}
-+
- void XclExpLinkManager::Save( XclExpStream& rStrm )
- {
- mxImpl->Save( rStrm );
-diff --git sc/source/filter/excel/xilink.cxx sc/source/filter/excel/xilink.cxx
-index 01932a5..ab4c08b 100644
---- sc/source/filter/excel/xilink.cxx
-+++ sc/source/filter/excel/xilink.cxx
-@@ -38,6 +38,13 @@
- #include "xistream.hxx"
- #include "xihelper.hxx"
- #include "xiname.hxx"
-+#include "excform.hxx"
-+#include "tokenarray.hxx"
-+#include "externalrefmgr.hxx"
-+
-+#include <vector>
-+
-+using ::std::vector;
-
- // ============================================================================
- // *** Helper classes ***
-@@ -52,8 +59,7 @@ public:
- /** Reads a cached value and stores it with its cell address. */
- explicit XclImpCrn( XclImpStream& rStrm, const XclAddress& rXclPos );
-
-- /** Copies the cached value to sheet nTab in the document. */
-- void SetCell( const XclImpRoot& rRoot, SCTAB nScTab ) const;
-+ const XclAddress& GetAddress() const;
-
- private:
- XclAddress maXclPos; /// Excel position of the cached cell.
-@@ -71,16 +77,11 @@ public:
- ~XclImpSupbookTab();
-
- inline const String& GetTabName() const { return maTabName; }
-- inline SCTAB GetScTab() const { return mnScTab; }
-
- /** Reads a CRN record (external referenced cell) at the specified address. */
- void ReadCrn( XclImpStream& rStrm, const XclAddress& rXclPos );
-
-- /** Creates a new linked table in the passed document and fills it with the cached cells.
-- @descr Stores the index of the new sheet, will be accessible with GetScTab(). */
-- void CreateAndFillTable(
-- const XclImpRoot& rRoot, const String& rAbsUrl,
-- const String& rFilterName, const String& rFilterOpt );
-+ void LoadCachedValues(ScExternalRefCache::Table* pCacheTable);
-
- private:
- typedef ScfDelList< XclImpCrn > XclImpCrnList;
-@@ -105,7 +106,7 @@ public:
- /** Reads a CRN record (external referenced cell). */
- void ReadCrn( XclImpStream& rStrm );
- /** Reads an EXTERNNAME record. */
-- void ReadExternname( XclImpStream& rStrm );
-+ void ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv = NULL );
-
- /** Returns the SUPBOOK record type. */
- inline XclSupbookType GetType() const { return meType; }
-@@ -113,11 +114,6 @@ public:
- /** Returns the URL of the external document. */
- inline const String& GetXclUrl() const { return maXclUrl; }
-
-- /** Returns Calc sheet index from Excel sheet index. */
-- SCTAB GetScTabNum( sal_uInt16 nXclTab ) const;
-- /** Returns Calc sheet index from sheet name. */
-- SCTAB GetScTabNum( const String& rTabName ) const;
--
- /** Returns the external name specified by an index from the Excel document (one-based). */
- const XclImpExtName* GetExternName( sal_uInt16 nXclIndex ) const;
- /** Tries to decode the URL to OLE or DDE link components.
-@@ -128,10 +124,11 @@ public:
- /** Returns the specified macro name (1-based) or an empty string on error. */
- const String& GetMacroName( sal_uInt16 nXclNameIdx ) const;
-
-- /** Creates all sheets of this external document.
-- @param nFirstTab The external Excel index of the first sheet to be created.
-- @param nLastTab The external Excel index of the last sheet to be created. */
-- void CreateTables( sal_uInt16 nSBTabFirst, sal_uInt16 nSBTabLast );
-+ const String& GetTabName( sal_uInt16 nXtiTab ) const;
-+
-+ sal_uInt16 GetTabCount() const;
-+
-+ void LoadCachedValues();
-
- private:
- typedef ScfDelList< XclImpSupbookTab > XclImpSupbookTabList;
-@@ -180,7 +177,7 @@ public:
- /** Reads a CRN record and appends it to the current SUPBOOK. */
- void ReadCrn( XclImpStream& rStrm );
- /** Reads an EXTERNNAME record and appends it to the current SUPBOOK. */
-- void ReadExternname( XclImpStream& rStrm );
-+ void ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv = NULL );
-
- /** Returns true, if the specified XTI entry contains an internal reference. */
- bool IsSelfRef( sal_uInt16 nXtiIndex ) const;
-@@ -191,6 +188,13 @@ public:
- sal_uInt16 nXtiIndex ) const;
- /** Returns the specified external name or 0 on error. */
- const XclImpExtName* GetExternName( sal_uInt16 nXtiIndex, sal_uInt16 nExtName ) const;
-+
-+ /** Returns the absolute file URL of a supporting workbook specified by
-+ the index. */
-+ const String* GetSupbookUrl( sal_uInt16 nXtiIndex ) const;
-+
-+ const String& GetSupbookTabName( sal_uInt16 nXti, sal_uInt16 nXtiTab ) const;
-+
- /** Tries to decode the URL of the specified XTI entry to OLE or DDE link components.
- @descr For DDE links: Decodes to application name and topic.
- For OLE object links: Decodes to class name and document URL.
-@@ -199,18 +203,13 @@ public:
- /** Returns the specified macro name or an empty string on error. */
- const String& GetMacroName( sal_uInt16 nExtSheet, sal_uInt16 nExtName ) const;
-
-- /** Returns the Calc sheet index of a table in an external document.
-- @return Calc sheet index or EXC_TAB_INVALID on error. */
-- SCTAB GetScTab( const String& rUrl, const String& rTabName ) const;
--
- private:
- /** Returns the specified SUPBOOK (external document). */
- const XclImpSupbook* GetSupbook( sal_uInt32 nXtiIndex ) const;
- /** Returns the SUPBOOK (external workbook) specified by its URL. */
- const XclImpSupbook* GetSupbook( const String& rUrl ) const;
-
-- /** Creates all external sheets in the Calc document. */
-- void CreateTables();
-+ void LoadCachedValues();
-
- /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index.
- @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here.
-@@ -291,14 +290,13 @@ sal_uInt16 XclImpTabInfo::GetCurrentIndex( sal_uInt16 nCreatedId, sal_uInt16 nMa
-
- // External names =============================================================
-
--XclImpExtName::XclImpExtName( XclImpStream& rStrm, bool bAddIn )
-+XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, bool bAddIn, ExcelToSc* pFormulaConv )
- {
- sal_uInt16 nFlags;
- sal_uInt8 nLen;
-
- rStrm >> nFlags >> mnStorageId >> nLen ;
- maName = rStrm.ReadUniString( nLen );
--
- if( ::get_flag( nFlags, EXC_EXTN_BUILTIN ) || !::get_flag( nFlags, EXC_EXTN_OLE_OR_DDE ) )
- {
- if( bAddIn )
-@@ -319,6 +317,28 @@ XclImpExtName::XclImpExtName( XclImpStream& rStrm, bool bAddIn )
-
- if( (meType == xlExtDDE) && (rStrm.GetRecLeft() > 1) )
- mxDdeMatrix.reset( new XclImpCachedMatrix( rStrm ) );
-+
-+ if (meType == xlExtName)
-+ {
-+ if (mnStorageId == 0)
-+ {
-+ if (pFormulaConv)
-+ {
-+ const ScTokenArray* pArray = NULL;
-+ sal_uInt16 nFmlaLen;
-+ rStrm >> nFmlaLen;
-+ vector<String> aTabNames;
-+ sal_uInt16 nCount = rSupbook.GetTabCount();
-+ aTabNames.reserve(nCount);
-+ for (sal_uInt16 i = 0; i < nCount; ++i)
-+ aTabNames.push_back(rSupbook.GetTabName(i));
-+
-+ pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames);
-+ if (pArray)
-+ mxArray.reset(pArray->Clone());
-+ }
-+ }
-+ }
- }
-
- XclImpExtName::~XclImpExtName()
-@@ -333,6 +353,12 @@ void XclImpExtName::CreateDdeData( ScDocument& rDoc, const String& rApplic, cons
- rDoc.CreateDdeLink( rApplic, rTopic, maName, SC_DDE_DEFAULT, xResults );
- }
-
-+void XclImpExtName::CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) const
-+{
-+ ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
-+ pRefMgr->storeRangeNameTokens(nFileId, maName, *mxArray);
-+}
-+
- // Cached external cells ======================================================
-
- XclImpCrn::XclImpCrn( XclImpStream& rStrm, const XclAddress& rXclPos ) :
-@@ -341,29 +367,9 @@ XclImpCrn::XclImpCrn( XclImpStream& rStrm, const XclAddress& rXclPos ) :
- {
- }
-
--void XclImpCrn::SetCell( const XclImpRoot& rRoot, SCTAB nScTab ) const
-+const XclAddress& XclImpCrn::GetAddress() const
- {
-- ScAddress aScPos( ScAddress::UNINITIALIZED );
-- if( rRoot.GetAddressConverter().ConvertAddress( aScPos, maXclPos, nScTab, false ) )
-- {
-- switch( GetType() )
-- {
-- case EXC_CACHEDVAL_DOUBLE:
-- rRoot.GetDoc().SetValue( aScPos.Col(), aScPos.Row(), aScPos.Tab(), GetValue() );
-- break;
-- case EXC_CACHEDVAL_STRING:
-- rRoot.GetDoc().PutCell( aScPos, new ScStringCell( GetString() ) );
-- break;
-- case EXC_CACHEDVAL_BOOL:
-- case EXC_CACHEDVAL_ERROR:
-- {
-- ScFormulaCell* pFmlaCell = new ScFormulaCell( rRoot.GetDocPtr(), aScPos, GetBoolErrFmla() );
-- pFmlaCell->SetHybridDouble( GetBool() ? 1.0 : 0.0 ); // GetBool() returns false for error codes
-- rRoot.GetDoc().PutCell( aScPos, pFmlaCell );
-- }
-- break;
-- }
-- }
-+ return maXclPos;
- }
-
- // Sheet in an external document ==============================================
-@@ -383,13 +389,40 @@ void XclImpSupbookTab::ReadCrn( XclImpStream& rStrm, const XclAddress& rXclPos )
- maCrnList.Append( new XclImpCrn( rStrm, rXclPos ) );
- }
-
--void XclImpSupbookTab::CreateAndFillTable( const XclImpRoot& rRoot,
-- const String& rAbsUrl, const String& rFilterName, const String& rFilterOpt )
-+void XclImpSupbookTab::LoadCachedValues(ScExternalRefCache::Table* pCacheTable)
- {
-- if( mnScTab == SCTAB_INVALID )
-- if( rRoot.GetDoc().InsertLinkedEmptyTab( mnScTab, rAbsUrl, rFilterName, rFilterOpt, maTabName ) )
-- for( const XclImpCrn* pCrn = maCrnList.First(); pCrn; pCrn = maCrnList.Next() )
-- pCrn->SetCell( rRoot, mnScTab );
-+ if (maCrnList.Empty())
-+ return;
-+
-+ for (XclImpCrn* p = maCrnList.First(); p; p = maCrnList.Next())
-+ {
-+ const XclAddress& rAddr = p->GetAddress();
-+ switch (p->GetType())
-+ {
-+ case EXC_CACHEDVAL_BOOL:
-+ break;
-+ case EXC_CACHEDVAL_DOUBLE:
-+ {
-+ double f = p->GetValue();
-+ ScExternalRefCache::TokenRef pToken(new ScDoubleToken(f));
-+ pCacheTable->setCell(rAddr.mnRow, rAddr.mnCol, pToken);
-+ }
-+ break;
-+ case EXC_CACHEDVAL_EMPTY:
-+ break;
-+ case EXC_CACHEDVAL_ERROR:
-+ break;
-+ case EXC_CACHEDVAL_STRING:
-+ {
-+ const String& rStr = p->GetString();
-+ ScExternalRefCache::TokenRef pToken(new ScStringToken(rStr));
-+ pCacheTable->setCell(rAddr.mnRow, rAddr.mnCol, pToken);
-+ }
-+ break;
-+ default:
-+ ;
-+ }
-+ }
- }
-
- // External document (SUPBOOK) ================================================
-@@ -453,25 +486,9 @@ void XclImpSupbook::ReadCrn( XclImpStream& rStrm )
- }
- }
-
--void XclImpSupbook::ReadExternname( XclImpStream& rStrm )
--{
-- maExtNameList.Append( new XclImpExtName( rStrm, meType == EXC_SBTYPE_ADDIN ) );
--}
--
--SCTAB XclImpSupbook::GetScTabNum( sal_uInt16 nXclTab ) const
--{
-- if( meType == EXC_SBTYPE_SELF )
-- return static_cast< SCTAB >( nXclTab );
-- const XclImpSupbookTab* pSBTab = maSupbTabList.GetObject( nXclTab );
-- return pSBTab ? pSBTab->GetScTab() : SCTAB_INVALID;
--}
--
--SCTAB XclImpSupbook::GetScTabNum( const String& rTabName ) const
-+void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
- {
-- for( const XclImpSupbookTab* pSBTab = maSupbTabList.First(); pSBTab; pSBTab = maSupbTabList.Next() )
-- if( pSBTab->GetTabName() == rTabName )
-- return pSBTab->GetScTab();
-- return SCTAB_INVALID;
-+ maExtNameList.Append( new XclImpExtName( *this, rStrm, meType == EXC_SBTYPE_ADDIN, pFormulaConv ) );
- }
-
- const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const
-@@ -492,20 +509,46 @@ const String& XclImpSupbook::GetMacroName( sal_uInt16 nXclNameIdx ) const
- return (pName && pName->IsVBName()) ? pName->GetScName() : EMPTY_STRING;
- }
-
--void XclImpSupbook::CreateTables( sal_uInt16 nSBTabFirst, sal_uInt16 nSBTabLast )
-+const String& XclImpSupbook::GetTabName( sal_uInt16 nXtiTab ) const
- {
-- if( (meType == EXC_SBTYPE_EXTERN) && (GetExtDocOptions().GetDocSettings().mnLinkCnt == 0) && GetDocShell() )
-+ if (maSupbTabList.Empty())
-+ return EMPTY_STRING;
-+
-+ sal_uInt16 i = 0;
-+ for (XclImpSupbookTab* p = maSupbTabList.First(); p; p = maSupbTabList.Next(), ++i)
- {
-- String aAbsUrl( ScGlobal::GetAbsDocName( maXclUrl, GetDocShell() ) );
-+ if (i == nXtiTab)
-+ return p->GetTabName();
-+ }
-+
-+ return EMPTY_STRING;
-+}
-+
-+sal_uInt16 XclImpSupbook::GetTabCount() const
-+{
-+ return ulimit_cast<sal_uInt16>(maSupbTabList.Count());
-+}
-+
-+void XclImpSupbook::LoadCachedValues()
-+{
-+ if (meType != EXC_SBTYPE_EXTERN || GetExtDocOptions().GetDocSettings().mnLinkCnt > 0)
-+ return;
-+
-+ String aAbsUrl( ScGlobal::GetAbsDocName(maXclUrl, GetDocShell()) );
-
-- // get filter name for external document
-- if( !maFilterName.Len() )
-- ScDocumentLoader::GetFilterName( aAbsUrl, maFilterName, maFilterOpt, FALSE, FALSE );
-+ ScExternalRefManager* pRefMgr = GetRoot().GetDoc().GetExternalRefManager();
-+ sal_uInt16 nFileId = pRefMgr->getExternalFileId(aAbsUrl);
-
-- // create tables
-- for( sal_uInt16 nSBTab = nSBTabFirst; nSBTab <= nSBTabLast; ++nSBTab )
-- if( XclImpSupbookTab* pSBTab = maSupbTabList.GetObject( nSBTab ) )
-- pSBTab->CreateAndFillTable( GetRoot(), aAbsUrl, maFilterName, maFilterOpt );
-+ sal_uInt16 nCount = maSupbTabList.Count();
-+ for (sal_uInt16 i = 0; i < nCount; ++i)
-+ {
-+ XclImpSupbookTab* pTab = maSupbTabList.GetObject(i);
-+ if (!pTab)
-+ return;
-+
-+ const String& rTabName = pTab->GetTabName();
-+ ScExternalRefCache::Table* pCacheTable = pRefMgr->getCacheTable(nFileId, rTabName, true);
-+ pTab->LoadCachedValues(pCacheTable);
- }
- }
-
-@@ -531,7 +574,7 @@ void XclImpLinkManagerImpl::ReadExternsheet( XclImpStream& rStrm )
- --nXtiCount;
- }
-
-- CreateTables();
-+ LoadCachedValues();
- }
-
- void XclImpLinkManagerImpl::ReadSupbook( XclImpStream& rStrm )
-@@ -551,10 +594,10 @@ void XclImpLinkManagerImpl::ReadCrn( XclImpStream& rStrm )
- pSupbook->ReadCrn( rStrm );
- }
-
--void XclImpLinkManagerImpl::ReadExternname( XclImpStream& rStrm )
-+void XclImpLinkManagerImpl::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
- {
- if( XclImpSupbook* pSupbook = maSupbookList.Last() )
-- pSupbook->ReadExternname( rStrm );
-+ pSupbook->ReadExternname( rStrm, pFormulaConv );
- }
-
- bool XclImpLinkManagerImpl::IsSelfRef( sal_uInt16 nXtiIndex ) const
-@@ -568,10 +611,10 @@ bool XclImpLinkManagerImpl::GetScTabRange(
- {
- if( const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex ) )
- {
-- if( const XclImpSupbook* pSupbook = maSupbookList.GetObject( pXti->mnSupbook ) )
-+ if (maSupbookList.GetObject(pXti->mnSupbook))
- {
-- rnFirstScTab = pSupbook->GetScTabNum( pXti->mnSBTabFirst );
-- rnLastScTab = pSupbook->GetScTabNum( pXti->mnSBTabLast );
-+ rnFirstScTab = pXti->mnSBTabFirst;
-+ rnLastScTab = pXti->mnSBTabLast;
- return true;
- }
- }
-@@ -584,6 +627,20 @@ const XclImpExtName* XclImpLinkManagerImpl::GetExternName( sal_uInt16 nXtiIndex,
- return pSupbook ? pSupbook->GetExternName( nExtName ) : 0;
- }
-
-+const String* XclImpLinkManagerImpl::GetSupbookUrl( sal_uInt16 nXtiIndex ) const
-+{
-+ const XclImpSupbook* p = GetSupbook( nXtiIndex );
-+ if (!p)
-+ return NULL;
-+ return &p->GetXclUrl();
-+}
-+
-+const String& XclImpLinkManagerImpl::GetSupbookTabName( sal_uInt16 nXti, sal_uInt16 nXtiTab ) const
-+{
-+ const XclImpSupbook* p = GetSupbook(nXti);
-+ return p ? p->GetTabName(nXtiTab) : EMPTY_STRING;
-+}
-+
- bool XclImpLinkManagerImpl::GetLinkData( String& rApplic, String& rTopic, sal_uInt16 nXtiIndex ) const
- {
- const XclImpSupbook* pSupbook = GetSupbook( nXtiIndex );
-@@ -596,12 +653,6 @@ const String& XclImpLinkManagerImpl::GetMacroName( sal_uInt16 nExtSheet, sal_uIn
- return pSupbook ? pSupbook->GetMacroName( nExtName ) : EMPTY_STRING;
- }
-
--SCTAB XclImpLinkManagerImpl::GetScTab( const String& rUrl, const String& rTabName ) const
--{
-- const XclImpSupbook* pSupbook = GetSupbook( rUrl );
-- return pSupbook ? pSupbook->GetScTabNum( rTabName ) : SCTAB_INVALID;
--}
--
- const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt32 nXtiIndex ) const
- {
- const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex );
-@@ -616,26 +667,17 @@ const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) con
- return 0;
- }
-
--void XclImpLinkManagerImpl::CreateTables()
-+void XclImpLinkManagerImpl::LoadCachedValues()
- {
-- DBG_ASSERT( !mbCreated, "XclImpLinkManager::CreateTables - multiple call" );
-- if( mbCreated ) return;
-+ // Read all CRN records which can be accessed via XclImpSupbook, and store
-+ // the cached values to the external reference manager.
-
-- sal_uInt16 nSBTabFirst, nSBTabLast;
- sal_uInt32 nCount = maSupbookList.Count();
--
-- for( sal_uInt16 nSupbook = 0; nSupbook < nCount; ++nSupbook )
-+ for (sal_uInt16 nSupbook = 0; nSupbook < nCount; ++nSupbook)
- {
-- XclImpSupbook* pSupbook = maSupbookList.GetObject( nSupbook );
-- bool bLoop = FindNextTabRange( nSBTabFirst, nSBTabLast, nSupbook, 0 );
-- while( bLoop && pSupbook )
-- {
-- pSupbook->CreateTables( nSBTabFirst, nSBTabLast );
-- // #96263# don't search again if last sheet == EXC_NOTAB
-- bLoop = (nSBTabLast != EXC_NOTAB) && FindNextTabRange( nSBTabFirst, nSBTabLast, nSupbook, nSBTabLast + 1 );
-- }
-+ XclImpSupbook* pSupbook = maSupbookList.GetObject(nSupbook);
-+ pSupbook->LoadCachedValues();
- }
-- mbCreated = true;
- }
-
- bool XclImpLinkManagerImpl::FindNextTabRange(
-@@ -686,9 +728,9 @@ void XclImpLinkManager::ReadCrn( XclImpStream& rStrm )
- mxImpl->ReadCrn( rStrm );
- }
-
--void XclImpLinkManager::ReadExternname( XclImpStream& rStrm )
-+void XclImpLinkManager::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv )
- {
-- mxImpl->ReadExternname( rStrm );
-+ mxImpl->ReadExternname( rStrm, pFormulaConv );
- }
-
- bool XclImpLinkManager::IsSelfRef( sal_uInt16 nXtiIndex ) const
-@@ -707,6 +749,16 @@ const XclImpExtName* XclImpLinkManager::GetExternName( sal_uInt16 nXtiIndex, sal
- return mxImpl->GetExternName( nXtiIndex, nExtName );
- }
-
-+const String* XclImpLinkManager::GetSupbookUrl( sal_uInt16 nXtiIndex ) const
-+{
-+ return mxImpl->GetSupbookUrl(nXtiIndex);
-+}
-+
-+const String& XclImpLinkManager::GetSupbookTabName( sal_uInt16 nXti, sal_uInt16 nXtiTab ) const
-+{
-+ return mxImpl->GetSupbookTabName(nXti, nXtiTab);
-+}
-+
- bool XclImpLinkManager::GetLinkData( String& rApplic, String& rTopic, sal_uInt16 nXtiIndex ) const
- {
- return mxImpl->GetLinkData( rApplic, rTopic, nXtiIndex );
-@@ -717,10 +769,5 @@ const String& XclImpLinkManager::GetMacroName( sal_uInt16 nExtSheet, sal_uInt16
- return mxImpl->GetMacroName( nExtSheet, nExtName );
- }
-
--SCTAB XclImpLinkManager::GetScTab( const String& rUrl, const String& rTabName ) const
--{
-- return mxImpl->GetScTab( rUrl, rTabName );
--}
--
- // ============================================================================
-
-diff --git sc/source/filter/inc/XclImpChangeTrack.hxx sc/source/filter/inc/XclImpChangeTrack.hxx
-index 2335c6c..60108cb 100644
---- sc/source/filter/inc/XclImpChangeTrack.hxx
-+++ sc/source/filter/inc/XclImpChangeTrack.hxx
-@@ -126,7 +126,7 @@ public:
-
- // reads extended 3D ref info following the formulas, returns sc tab nums
- // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
-- sal_Bool Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab );
-+ sal_Bool Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab, ExcelToSc8::ExternalTabInfo& rExtInfo );
-
- void Apply();
- };
-@@ -182,7 +182,7 @@ class XclImpChTrFmlConverter : public ExcelToSc8
- private:
- XclImpChangeTrack& rChangeTrack;
-
-- virtual BOOL Read3DTabReference( XclImpStream& rStrm, SCTAB& rFirstTab, SCTAB& rLastTab );
-+ virtual bool Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
-
- public:
- inline XclImpChTrFmlConverter(
-diff --git sc/source/filter/inc/excform.hxx sc/source/filter/inc/excform.hxx
-index 915dd98..3059d6d 100644
---- sc/source/filter/inc/excform.hxx
-+++ sc/source/filter/inc/excform.hxx
-@@ -35,6 +35,7 @@
- #include "xiroot.hxx"
- #include "formel.hxx"
-
-+#include <vector>
-
- class ScRangeList;
-
-@@ -64,6 +65,10 @@ public:
- bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
-
- virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
-+
-+ virtual ConvErr ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
-+ const String& rUrl, const ::std::vector<String>& rTabNames );
-+
- virtual BOOL GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
-
- void GetDummy( const ScTokenArray*& );
-@@ -102,19 +107,32 @@ inline BOOL ExcelToSc::IsComplRowRange( const UINT16 nRow1, const UINT16 nRow2 )
- return ( ( nRow1 & 0x3FFF ) == 0x0000 ) && ( ( nRow2 & 0x3FFF ) == 0x3FFF );
- }
-
-+// ============================================================================
-
- class XclImpLinkManager;
-
- class ExcelToSc8 : public ExcelToSc
- {
-+public:
-+
-+ struct ExternalTabInfo
-+ {
-+ String maTabName;
-+ sal_uInt16 mnFileId;
-+ bool mbExternal;
-+
-+ ExternalTabInfo();
-+ };
-+
- private:
- const XclImpLinkManager& rLinkMan;
-
- void ExcRelToScRel8( UINT16 nRow, UINT16 nCol, SingleRefData&,
- const BOOL bName );
-
-- // this function must read 2 bytes from stream and adjust <nBytesLeft>
-- virtual BOOL Read3DTabReference( XclImpStream& rStrm, SCTAB& rFirstTab, SCTAB& rLastTab );
-+ bool GetExternalFileIdFromXti( UINT16 nIxti, sal_uInt16& rFileId ) const;
-+
-+ virtual bool Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
-
- public:
- ExcelToSc8( const XclImpRoot& rRoot );
-@@ -124,6 +142,9 @@ public:
-
- virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
-
-+ virtual ConvErr ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
-+ const String& rUrl, const ::std::vector<String>& rTabNames );
-+
- static inline BOOL IsComplRowRange( const UINT16 nRow1, const UINT16 nRow2 );
-
- virtual BOOL GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
-diff --git sc/source/filter/inc/tokstack.hxx sc/source/filter/inc/tokstack.hxx
-index 89e955a..5bb6772 100644
---- sc/source/filter/inc/tokstack.hxx
-+++ sc/source/filter/inc/tokstack.hxx
-@@ -35,6 +35,8 @@
- #include <tools/debug.hxx>
- #include "compiler.hxx"
-
-+#include <vector>
-+
-
- typedef OpCode DefTokenId;
- // in PRODUCT version: ambiguity between OpCode (being USHORT) and UINT16
-@@ -78,6 +80,9 @@ enum E_TYPE
- T_Ext, // irgendwas Unbekanntes mit Funktionsnamen
- T_Nlf, // token for natural language formula
- T_Matrix, // token for inline arrays
-+ T_ExtName, // token for external names
-+ T_ExtRefC,
-+ T_ExtRefA,
- T_Error // fuer Abfrage im Fehlerfall
- };
-
-@@ -134,6 +139,32 @@ class TokenPool
- UINT16 nP_Matrix;
- UINT16 nP_MatrixAkt;
-
-+ /** for storage of external names */
-+ struct ExtName
-+ {
-+ sal_uInt16 mnFileId;
-+ String maName;
-+ };
-+ ::std::vector<ExtName> maExtNames;
-+
-+ /** for storage of external cell references */
-+ struct ExtCellRef
-+ {
-+ sal_uInt16 mnFileId;
-+ String maTabName;
-+ SingleRefData maRef;
-+ };
-+ ::std::vector<ExtCellRef> maExtCellRefs;
-+
-+ /** for storage of external area references */
-+ struct ExtAreaRef
-+ {
-+ sal_uInt16 mnFileId;
-+ String maTabName;
-+ ComplRefData maRef;
-+ };
-+ ::std::vector<ExtAreaRef> maExtAreaRefs;
-+
- UINT16* pElement; // Array mit Indizes fuer Elemente
- E_TYPE* pType; // ...mit Typ-Info
- UINT16* pSize; // ...mit Laengenangabe (Anz. UINT16)
-@@ -180,12 +211,14 @@ class TokenPool
- // 4 externals (e.g. AddIns, Makros...)
- const TokenId StoreNlf( const SingleRefData& rTr );
- const TokenId StoreMatrix( SCSIZE nC, SCSIZE nR );
-+ const TokenId StoreExtName( sal_uInt16 nFileId, const String& rName );
-+ const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+ const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
-
- inline const TokenId LastId( void ) const;
- inline const ScTokenArray* operator []( const TokenId nId );
- void Reset( void );
- inline E_TYPE GetType( const TokenId& nId ) const;
-- inline const SingleRefData* GetSRD( const TokenId& nId ) const;
- BOOL IsSingleOp( const TokenId& nId, const DefTokenId eId ) const;
- const String* GetExternal( const TokenId& nId ) const;
- const String* GetString( const TokenId& nId ) const;
-@@ -374,21 +407,5 @@ inline E_TYPE TokenPool::GetType( const TokenId& rId ) const
- }
-
-
--inline const SingleRefData* TokenPool::GetSRD( const TokenId& rId ) const
--{
-- SingleRefData* pRet;
--
-- UINT16 nId = (UINT16) rId - 1;
--
-- if( nId < nElementAkt && pType[ nId ] == T_RefC )
-- pRet = ppP_RefTr[ pElement[ nId ] ];
-- else
-- pRet = NULL;
--
-- return pRet;
--}
--
--
--
- #endif
-
-diff --git sc/source/filter/inc/xelink.hxx sc/source/filter/inc/xelink.hxx
-index 795219c..ee53c3a 100644
---- sc/source/filter/inc/xelink.hxx
-+++ sc/source/filter/inc/xelink.hxx
-@@ -173,11 +173,19 @@ public:
- /** Searches for a special EXTERNSHEET index for the own document. */
- sal_uInt16 FindExtSheet( sal_Unicode cCode );
-
-+ void FindExtSheet( sal_uInt16 nFileId, const String& rTabName, sal_uInt16 nXclTabSpan,
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab,
-+ XclExpRefLogEntry* pRefLogEntry = NULL );
-+
- /** Stores the cell with the given address in a CRN record list. */
- void StoreCell( const SingleRefData& rRef );
- /** Stores all cells in the given range in a CRN record list. */
- void StoreCellRange( const ComplRefData& rRef );
-
-+ void StoreCell( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
-+
-+ void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
-+
- /** Finds or inserts an EXTERNNAME record for an add-in function name.
- @param rnExtSheet (out-param) Returns the index of the EXTSHEET structure for the add-in function name.
- @param rnExtName (out-param) Returns the 1-based EXTERNNAME record index.
-@@ -193,6 +201,10 @@ public:
- sal_uInt16& rnExtSheet, sal_uInt16& rnExtName,
- const String& rApplic, const String& rTopic, const String& rItem );
-
-+ bool InsertExtName(
-+ sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rUrl,
-+ const String& rName, const ScTokenArray* pArray );
-+
- /** Writes the entire Link table. */
- virtual void Save( XclExpStream& rStrm );
-
-diff --git sc/source/filter/inc/xilink.hxx sc/source/filter/inc/xilink.hxx
-index 0d547fe..3983e4d 100644
---- sc/source/filter/inc/xilink.hxx
-+++ sc/source/filter/inc/xilink.hxx
-@@ -107,6 +107,8 @@ enum XclImpExtNameType
- // ----------------------------------------------------------------------------
-
- class XclImpCachedMatrix;
-+class ScTokenArray;
-+class XclImpSupbook;
-
- /** Stores contents of an external name.
- @descr Supported: External defined names, AddIn names, DDE links and OLE objects. */
-@@ -114,21 +116,26 @@ class XclImpExtName
- {
- public:
- /** Reads the external name from the stream. */
-- explicit XclImpExtName( XclImpStream& rStrm, bool bAddIn = false );
-+ explicit XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, bool bAddIn = false,
-+ ExcelToSc* pFormulaConv = NULL );
- ~XclImpExtName();
-
- /** Create and apply the cached list of this DDE Link to the document. */
- void CreateDdeData( ScDocument& rDoc,
- const String& rApplc, const String& rExtDoc ) const;
-
-+ void CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) const;
-+
- inline XclImpExtNameType GetType() const { return meType; }
- inline const String& GetName() const { return maName; }
- inline sal_uInt32 GetStorageId() const { return mnStorageId; }
-
- private:
- typedef ::std::auto_ptr< XclImpCachedMatrix > XclImpCachedMatrixPtr;
-+ typedef ::std::auto_ptr< ScTokenArray > TokenArrayPtr;
-
- XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link.
-+ TokenArrayPtr mxArray; /// Formula tokens for external name.
- String maName; /// The name of the external name.
- sal_uInt32 mnStorageId; /// Storage ID for OLE object storages.
- XclImpExtNameType meType; /// Type of the external name.
-@@ -168,7 +175,7 @@ public:
- /** Reads a CRN record and appends it to the current SUPBOOK. */
- void ReadCrn( XclImpStream& rStrm );
- /** Reads an EXTERNNAME record and appends it to the current SUPBOOK. */
-- void ReadExternname( XclImpStream& rStrm );
-+ void ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv = NULL );
-
- /** Returns true, if the specified XTI entry contains an internal reference. */
- bool IsSelfRef( sal_uInt16 nXtiIndex ) const;
-@@ -179,6 +186,11 @@ public:
- sal_uInt16 nXtiIndex ) const;
- /** Returns the specified external name or 0 on error. */
- const XclImpExtName* GetExternName( sal_uInt16 nXtiIndex, sal_uInt16 nExtName ) const;
-+
-+ const String* GetSupbookUrl( sal_uInt16 nXtiIndex ) const;
-+
-+ const String& GetSupbookTabName( sal_uInt16 nXti, sal_uInt16 nXtiTab ) const;
-+
- /** Tries to decode the URL of the specified XTI entry to OLE or DDE link components.
- @descr For DDE links: Decodes to application name and topic.
- For OLE object links: Decodes to class name and document URL.
-@@ -187,10 +199,6 @@ public:
- /** Returns the specified macro name or an empty string on error. */
- const String& GetMacroName( sal_uInt16 nExtSheet, sal_uInt16 nExtName ) const;
-
-- /** Returns the Calc sheet index of a table in an external document.
-- @return Calc sheet index or EXC_TAB_INVALID on error. */
-- SCTAB GetScTab( const String& rUrl, const String& rTabName ) const;
--
- private:
- typedef ::std::auto_ptr< XclImpLinkManagerImpl > XclImpLinkMgrImplPtr;
- XclImpLinkMgrImplPtr mxImpl;
-diff --git sc/source/filter/xcl97/XclImpChangeTrack.cxx sc/source/filter/xcl97/XclImpChangeTrack.cxx
-index 022b472..a1efd3e 100644
---- sc/source/filter/xcl97/XclImpChangeTrack.cxx
-+++ sc/source/filter/xcl97/XclImpChangeTrack.cxx
-@@ -40,6 +40,7 @@
- #include "chgtrack.hxx"
- #include "xihelper.hxx"
- #include "xilink.hxx"
-+#include "externalrefmgr.hxx"
-
- //___________________________________________________________________
- // class XclImpChangeTrack
-@@ -153,10 +154,11 @@ sal_Bool XclImpChangeTrack::CheckRecord( sal_uInt16 nOpCode )
- return aRecHeader.nIndex != 0;
- }
-
--sal_Bool XclImpChangeTrack::Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab )
-+sal_Bool XclImpChangeTrack::Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab, ExcelToSc8::ExternalTabInfo& rExtInfo )
- {
- if( LookAtuInt8() == 0x01 )
- {
-+ rExtInfo.mbExternal = false;
- // internal ref - read tab num and return sc tab num (position in TABID list)
- pStrm->Ignore( 3 );
- rFirstTab = static_cast< SCTAB >( GetTabInfo().GetCurrentIndex( pStrm->ReaduInt16(), nTabIdCount ) );
-@@ -176,7 +178,13 @@ sal_Bool XclImpChangeTrack::Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab
- // - sheet name, always separated from URL
- String aTabName( pStrm->ReadUniString() );
- pStrm->Ignore( 1 );
-- rFirstTab = rLastTab = static_cast<SCTAB>(GetLinkManager().GetScTab( aUrl, aTabName ));
-+
-+ rExtInfo.mbExternal = true;
-+ ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
-+ pRefMgr->convertToAbsName(aUrl);
-+ rExtInfo.mnFileId = pRefMgr->getExternalFileId(aUrl);
-+ rExtInfo.maTabName = aTabName;
-+ rFirstTab = rLastTab = 0;
- }
- return sal_True;
- }
-@@ -329,7 +337,8 @@ void XclImpChangeTrack::ReadChTrCellContent()
- if( CheckRecord( EXC_CHTR_OP_CELL ) )
- {
- ScAddress aPosition;
-- aPosition.SetTab( ReadTabNum() );
-+ SCTAB nTab = ReadTabNum();
-+ aPosition.SetTab( nTab );
- sal_uInt16 nValueType;
- *pStrm >> nValueType;
- sal_uInt16 nOldValueType = (nValueType >> 3) & EXC_CHTR_TYPE_MASK;
-@@ -490,9 +499,9 @@ XclImpChTrFmlConverter::~XclImpChTrFmlConverter()
- }
-
- // virtual, called from ExcToSc8::Convert()
--BOOL XclImpChTrFmlConverter::Read3DTabReference( XclImpStream& rStrm, SCTAB& rFirstTab, SCTAB& rLastTab )
-+bool XclImpChTrFmlConverter::Read3DTabReference( UINT16 /*nIxti*/, SCTAB& rFirstTab, SCTAB& rLastTab,
-+ ExternalTabInfo& rExtInfo )
- {
-- rStrm.Ignore( 2 );
-- return rChangeTrack.Read3DTabRefInfo( rFirstTab, rLastTab );
-+ return rChangeTrack.Read3DTabRefInfo( rFirstTab, rLastTab, rExtInfo );
- }
-
-diff --git sc/source/filter/xml/XMLDDELinksContext.cxx sc/source/filter/xml/XMLDDELinksContext.cxx
-index 81ec1d2..4ab6982 100644
---- sc/source/filter/xml/XMLDDELinksContext.cxx
-+++ sc/source/filter/xml/XMLDDELinksContext.cxx
-@@ -46,6 +46,7 @@
-
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- //------------------------------------------------------------------
-
-diff --git sc/source/filter/xml/XMLTableShapeImportHelper.cxx sc/source/filter/xml/XMLTableShapeImportHelper.cxx
-index bb6fe74..219b5cc 100644
---- sc/source/filter/xml/XMLTableShapeImportHelper.cxx
-+++ sc/source/filter/xml/XMLTableShapeImportHelper.cxx
-@@ -49,6 +49,7 @@
-
- using namespace ::com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- XMLTableShapeImportHelper::XMLTableShapeImportHelper(
- ScXMLImport& rImp, SvXMLImportPropertyMapper *pImpMapper ) :
-diff --git sc/source/filter/xml/XMLTrackedChangesContext.cxx sc/source/filter/xml/XMLTrackedChangesContext.cxx
-index a779ddf..3b2ea17 100644
---- sc/source/filter/xml/XMLTrackedChangesContext.cxx
-+++ sc/source/filter/xml/XMLTrackedChangesContext.cxx
-@@ -48,6 +48,7 @@
-
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- //-----------------------------------------------------------------------------
-
-diff --git sc/source/filter/xml/makefile.mk sc/source/filter/xml/makefile.mk
-index 68ee10b..d44da6b 100644
---- sc/source/filter/xml/makefile.mk
-+++ sc/source/filter/xml/makefile.mk
-@@ -57,6 +57,7 @@ CXXFILES = \
- xmlexprt.cxx \
- xmlbodyi.cxx \
- xmltabi.cxx \
-+ xmlexternaltabi.cxx \
- xmlrowi.cxx \
- xmlcelli.cxx \
- xmlconti.cxx \
-@@ -106,6 +107,7 @@ SLOFILES = \
- $(SLO)$/xmlexprt.obj \
- $(SLO)$/xmlbodyi.obj \
- $(SLO)$/xmltabi.obj \
-+ $(SLO)$/xmlexternaltabi.obj \
- $(SLO)$/xmlrowi.obj \
- $(SLO)$/xmlcelli.obj \
- $(SLO)$/xmlconti.obj \
-diff --git sc/source/filter/xml/xmlbodyi.cxx sc/source/filter/xml/xmlbodyi.cxx
-index 5f3545a..76780d3 100644
---- sc/source/filter/xml/xmlbodyi.cxx
-+++ sc/source/filter/xml/xmlbodyi.cxx
-@@ -67,6 +67,7 @@
-
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- //------------------------------------------------------------------
-
-diff --git sc/source/filter/xml/xmlcelli.cxx sc/source/filter/xml/xmlcelli.cxx
-index 92eb208..a990e54 100644
---- sc/source/filter/xml/xmlcelli.cxx
-+++ sc/source/filter/xml/xmlcelli.cxx
-@@ -146,185 +146,131 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
- rtl::OUString aLocalName;
- rtl::OUString* pStyleName = NULL;
- rtl::OUString* pCurrencySymbol = NULL;
-- for( sal_Int16 i=0; i < nAttrCount; ++i )
-+ const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
-+ for (sal_Int16 i = 0; i < nAttrCount; ++i)
- {
-- sal_uInt16 nPrefix = rXMLImport.GetNamespaceMap().GetKeyByAttrName(
-- xAttrList->getNameByIndex( i ), &aLocalName );
-- const rtl::OUString& sValue(xAttrList->getValueByIndex( i ));
-+ sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
-+ xAttrList->getNameByIndex(i), &aLocalName);
-
-- if (nPrefix == XML_NAMESPACE_TABLE)
-- {
-- sal_uInt32 nLength(aLocalName.getLength());
--
-- switch (nLength)
-+ const rtl::OUString& sValue = xAttrList->getValueByIndex(i);
-+ sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
-+ switch (nToken)
-+ {
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
-+ pStyleName = new rtl::OUString(sValue);
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME:
-+ DBG_ASSERT(!pContentValidationName, "here should be only one Validation Name");
-+ pContentValidationName = new rtl::OUString(sValue);
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS:
-+ bIsMerged = sal_True;
-+ nMergedRows = sValue.toInt32();
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS:
-+ bIsMerged = sal_True;
-+ nMergedCols = sValue.toInt32();
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS:
-+ bIsMatrix = sal_True;
-+ nMatrixCols = sValue.toInt32();
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS:
-+ bIsMatrix = sal_True;
-+ nMatrixRows = sValue.toInt32();
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
-+ nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 );
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
-+ nCellType = GetScImport().GetCellType(sValue);
-+ bIsEmpty = sal_False;
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
- {
-- case 7 :
-- {
-- if (IsXMLToken(aLocalName, XML_FORMULA))
-- {
-- if (sValue.getLength())
-- {
-- DBG_ASSERT(!pOUFormula, "here should be only one formula");
-- DELETEZ( pOUFormula);
-- rtl::OUString sFormula;
-- sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
-- _GetKeyByAttrName( sValue, &sFormula, sal_False );
--
-- if (ScXMLImport::IsAcceptedFormulaNamespace(
-- nFormulaPrefix, sValue, eGrammar,
-- eStorageGrammar))
-- {
-- // Namespaces we accept.
-- pOUFormula = new rtl::OUString( sFormula);
-- }
-- else
-- {
-- // No namespace => entire string.
-- // Also unknown namespace included in formula,
-- // so hopefully will result in string or
-- // compile error.
-- pOUFormula = new rtl::OUString( sValue);
-- }
-- }
-- }
-- }
-- break;
-- case 10 :
-- {
-- if (IsXMLToken(aLocalName, XML_STYLE_NAME))
-- pStyleName = new rtl::OUString(sValue);
-- }
-- break;
-- case 19 :
-+ if (sValue.getLength())
- {
-- if (IsXMLToken(aLocalName, XML_NUMBER_ROWS_SPANNED))
-- {
-- bIsMerged = sal_True;
-- nMergedRows = sValue.toInt32();
-- }
-+ rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
-+ bIsEmpty = sal_False;
- }
-- break;
-- case 22 :
-- {
-- if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_SPANNED))
-- {
-- bIsMerged = sal_True;
-- nMergedCols = sValue.toInt32();
-- }
-- }
-- break;
-- case 23 :
-- {
-- if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_REPEATED))
-- nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 );
-- else if (IsXMLToken(aLocalName, XML_CONTENT_VALIDATION_NAME))
-- {
-- DBG_ASSERT(!pContentValidationName, "here should be only one Validation Name");
-- pContentValidationName = new rtl::OUString(sValue);
-- }
-- }
-- break;
-- case 26 :
-- {
-- if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_ROWS_SPANNED))
-- {
-- bIsMatrix = sal_True;
-- nMatrixRows = sValue.toInt32();
-- }
-- }
-- break;
-- case 29 :
-- {
-- if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_COLUMNS_SPANNED))
-- {
-- bIsMatrix = sal_True;
-- nMatrixCols = sValue.toInt32();
-- }
-- }
-- break;
- }
-- }
-- else if (nPrefix == XML_NAMESPACE_OFFICE)
-- {
-- sal_uInt32 nLength(aLocalName.getLength());
--
-- switch (nLength)
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
- {
-- case 5 :
-+ if (sValue.getLength() && rXMLImport.SetNullDateOnUnitConverter())
- {
-- if (IsXMLToken(aLocalName, XML_VALUE))
-- {
-- if (sValue.getLength())
-- {
-- rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
-- bIsEmpty = sal_False;
-- }
-- }
-+ rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, sValue);
-+ bIsEmpty = sal_False;
- }
-- break;
-- case 8 :
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
-+ {
-+ if (sValue.getLength())
- {
-- if (IsXMLToken(aLocalName, XML_CURRENCY))
-- pCurrencySymbol = new rtl::OUString(sValue);
-+ rXMLImport.GetMM100UnitConverter().convertTime(fValue, sValue);
-+ bIsEmpty = sal_False;
- }
-- break;
-- case 10 :
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
-+ {
-+ if (sValue.getLength())
- {
-- if (IsXMLToken(aLocalName, XML_VALUE_TYPE))
-- {
-- nCellType = GetCellType(sValue);
-- bIsEmpty = sal_False;
-- }
-- else if (IsXMLToken(aLocalName, XML_DATE_VALUE))
-- {
-- if (sValue.getLength() && rXMLImport.SetNullDateOnUnitConverter())
-- {
-- rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, sValue);
-- bIsEmpty = sal_False;
-- }
-- }
-- else if (IsXMLToken(aLocalName, XML_TIME_VALUE))
-- {
-- if (sValue.getLength())
-- {
-- rXMLImport.GetMM100UnitConverter().convertTime(fValue, sValue);
-- bIsEmpty = sal_False;
-- }
-- }
-+ DBG_ASSERT(!pOUTextValue, "here should be only one string value");
-+ pOUTextValue = new rtl::OUString(sValue);
-+ bIsEmpty = sal_False;
- }
-- break;
-- case 12 :
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
-+ {
-+ if (sValue.getLength())
- {
-- if (IsXMLToken(aLocalName, XML_STRING_VALUE))
-- {
-- if (sValue.getLength())
-- {
-- DBG_ASSERT(!pOUTextValue, "here should be only one string value");
-- pOUTextValue = new rtl::OUString(sValue);
-- bIsEmpty = sal_False;
-- }
-- }
-+ if ( IsXMLToken(sValue, XML_TRUE) )
-+ fValue = 1.0;
-+ else if ( IsXMLToken(sValue, XML_FALSE) )
-+ fValue = 0.0;
-+ else
-+ rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
-+ bIsEmpty = sal_False;
- }
-- break;
-- case 13 :
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA:
-+ {
-+ if (sValue.getLength())
- {
-- if (IsXMLToken(aLocalName, XML_BOOLEAN_VALUE))
-- {
-- if (sValue.getLength())
-- {
-- if ( IsXMLToken(sValue, XML_TRUE) )
-- fValue = 1.0;
-- else if ( IsXMLToken(sValue, XML_FALSE) )
-- fValue = 0.0;
-- else
-- rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
-- bIsEmpty = sal_False;
-- }
-- }
-+ DBG_ASSERT(!pOUFormula, "here should be only one formula");
-+ DELETEZ( pOUFormula);
-+ rtl::OUString sFormula;
-+ sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
-+ _GetKeyByAttrName( sValue, &sFormula, sal_False );
-+
-+ if (ScXMLImport::IsAcceptedFormulaNamespace(
-+ nFormulaPrefix, sValue, eGrammar,
-+ eStorageGrammar))
-+ {
-+ // Namespaces we accept.
-+ pOUFormula = new rtl::OUString( sFormula);
-+ }
-+ else
-+ {
-+ // No namespace => entire string.
-+ // Also unknown namespace included in formula,
-+ // so hopefully will result in string or
-+ // compile error.
-+ pOUFormula = new rtl::OUString( sValue);
-+ }
- }
-- break;
- }
-- }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY:
-+ pCurrencySymbol = new rtl::OUString(sValue);
-+ break;
-+ default:
-+ ;
-+ }
- }
- if (pOUFormula)
- {
-@@ -335,32 +281,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
- rXMLImport.GetStylesImportHelper()->SetAttributes(pStyleName, pCurrencySymbol, nCellType);
- }
-
--sal_Int16 ScXMLTableRowCellContext::GetCellType(const rtl::OUString& sOUValue) const
--{
-- if (IsXMLToken(sOUValue, XML_FLOAT))
-- return util::NumberFormat::NUMBER;
-- else
-- if (IsXMLToken(sOUValue, XML_STRING))
-- return util::NumberFormat::TEXT;
-- else
-- if (IsXMLToken(sOUValue, XML_TIME))
-- return util::NumberFormat::TIME;
-- else
-- if (IsXMLToken(sOUValue, XML_DATE))
-- return util::NumberFormat::DATETIME;
-- else
-- if (IsXMLToken(sOUValue, XML_PERCENTAGE))
-- return util::NumberFormat::PERCENT;
-- else
-- if (IsXMLToken(sOUValue, XML_CURRENCY))
-- return util::NumberFormat::CURRENCY;
-- else
-- if (IsXMLToken(sOUValue, XML_BOOLEAN))
-- return util::NumberFormat::LOGICAL;
-- else
-- return util::NumberFormat::UNDEFINED;
--}
--
- ScXMLTableRowCellContext::~ScXMLTableRowCellContext()
- {
- if (pOUTextValue)
-diff --git sc/source/filter/xml/xmlcelli.hxx sc/source/filter/xml/xmlcelli.hxx
-index b1de3ee..589077d 100644
---- sc/source/filter/xml/xmlcelli.hxx
-+++ sc/source/filter/xml/xmlcelli.hxx
-@@ -95,8 +95,6 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
- const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
- ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
-
-- sal_Int16 GetCellType(const rtl::OUString& sOUValue) const;
--
- sal_Bool IsMerged (const com::sun::star::uno::Reference <com::sun::star::table::XCellRange>& xCellRange,
- const sal_Int32 nCol, const sal_Int32 nRow,
- com::sun::star::table::CellRangeAddress& aCellAddress) const;
-diff --git sc/source/filter/xml/xmldpimp.cxx sc/source/filter/xml/xmldpimp.cxx
-index e29223a..604e04e 100644
---- sc/source/filter/xml/xmldpimp.cxx
-+++ sc/source/filter/xml/xmldpimp.cxx
-@@ -65,6 +65,7 @@
-
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- //------------------------------------------------------------------
-
-diff --git sc/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
-index 441f463..535ed45 100644
---- sc/source/filter/xml/xmlexprt.cxx
-+++ sc/source/filter/xml/xmlexprt.cxx
-@@ -68,6 +68,7 @@
- #include "convuno.hxx"
- #include "postit.hxx"
- #include "tabprotection.hxx"
-+#include "externalrefmgr.hxx"
-
- #include <xmloff/xmltoken.hxx>
- #include <xmloff/xmlnmspe.hxx>
-@@ -129,6 +130,8 @@
-
- #include <sfx2/objsh.hxx>
-
-+#include <vector>
-+
- //! not found in unonames.hxx
- #define SC_STANDARDFORMAT "StandardFormat"
- #define SC_LAYERID "LayerID"
-@@ -152,6 +155,7 @@
- using namespace rtl;
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::std::vector;
-
- //----------------------------------------------------------------------------
-
-@@ -479,6 +483,12 @@ ScXMLExport::ScXMLExport(
-
- if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
- {
-+ // This name is reserved for the external ref cache tables. This
-+ // should not conflict with user-defined styles since this name is
-+ // used for a table style which is not available in the UI.
-+ sExternalRefTabStyleName = rtl::OUString::createFromAscii("ta_extref");
-+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_TABLE, sExternalRefTabStyleName);
-+
- sAttrName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_NAME));
- sAttrStyleName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_STYLE_NAME));
- sAttrColumnsRepeated = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_NUMBER_COLUMNS_REPEATED));
-@@ -1422,180 +1432,181 @@ void ScXMLExport::_ExportContent()
- DBG_ERROR("no shared data setted");
- }
- ScXMLExportDatabaseRanges aExportDatabaseRanges(*this);
-- if (!GetModel().is())
-+ if (!GetModel().is())
- return;
-
-- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY );
- if ( !xSpreadDoc.is() )
- return;
-
-- uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
-- if ( xIndex.is() )
-- {
-- //_GetNamespaceMap().ClearQNamesCache();
-- pChangeTrackingExportHelper->CollectAndWriteChanges();
-- WriteCalculationSettings(xSpreadDoc);
-- sal_Int32 nTableCount(xIndex->getCount());
-- ScMyAreaLinksContainer aAreaLinks;
-- GetAreaLinks( xSpreadDoc, aAreaLinks );
-- ScMyEmptyDatabaseRangesContainer aEmptyRanges(aExportDatabaseRanges.GetEmptyDatabaseRanges());
-- ScMyDetectiveOpContainer aDetectiveOpContainer;
-- GetDetectiveOpList( aDetectiveOpContainer );
--
-- pCellStyles->Sort();
-- pMergedRangesContainer->Sort();
-- pSharedData->GetDetectiveObjContainer()->Sort();
--
-- pCellsItr->Clear();
-- pCellsItr->SetShapes( pSharedData->GetShapesContainer() );
-- pCellsItr->SetNoteShapes( pSharedData->GetNoteShapes() );
-- pCellsItr->SetMergedRanges( pMergedRangesContainer );
-- pCellsItr->SetAreaLinks( &aAreaLinks );
-- pCellsItr->SetEmptyDatabaseRanges( &aEmptyRanges );
-- pCellsItr->SetDetectiveObj( pSharedData->GetDetectiveObjContainer() );
-- pCellsItr->SetDetectiveOp( &aDetectiveOpContainer );
--
-- if (nTableCount > 0)
-- pValidationsContainer->WriteValidations(*this);
-- WriteTheLabelRanges( xSpreadDoc );
-- for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
-- {
-- uno::Reference<sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-- if (xTable.is())
-- {
-- xCurrentTable.set(xTable);
-- xCurrentTableCellRange.set(xTable, uno::UNO_QUERY);
-- uno::Reference<container::XNamed> xName (xTable, uno::UNO_QUERY );
-- if ( xName.is() )
-- {
-- nCurrentTable = sal::static_int_cast<sal_uInt16>( nTable );
-- rtl::OUString sOUTableName(xName->getName());
-- AddAttribute(sAttrName, sOUTableName);
-- AddAttribute(sAttrStyleName, aTableStyles[nTable]);
-- uno::Reference<util::XProtectable> xProtectable (xTable, uno::UNO_QUERY);
-- if (xProtectable.is() && xProtectable->isProtected())
-- {
-- AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
-- rtl::OUStringBuffer aBuffer;
-- if (pDoc)
-+ uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
-+ if ( xIndex.is() )
-+ {
-+ //_GetNamespaceMap().ClearQNamesCache();
-+ pChangeTrackingExportHelper->CollectAndWriteChanges();
-+ WriteCalculationSettings(xSpreadDoc);
-+ sal_Int32 nTableCount(xIndex->getCount());
-+ ScMyAreaLinksContainer aAreaLinks;
-+ GetAreaLinks( xSpreadDoc, aAreaLinks );
-+ ScMyEmptyDatabaseRangesContainer aEmptyRanges(aExportDatabaseRanges.GetEmptyDatabaseRanges());
-+ ScMyDetectiveOpContainer aDetectiveOpContainer;
-+ GetDetectiveOpList( aDetectiveOpContainer );
-+
-+ pCellStyles->Sort();
-+ pMergedRangesContainer->Sort();
-+ pSharedData->GetDetectiveObjContainer()->Sort();
-+
-+ pCellsItr->Clear();
-+ pCellsItr->SetShapes( pSharedData->GetShapesContainer() );
-+ pCellsItr->SetNoteShapes( pSharedData->GetNoteShapes() );
-+ pCellsItr->SetMergedRanges( pMergedRangesContainer );
-+ pCellsItr->SetAreaLinks( &aAreaLinks );
-+ pCellsItr->SetEmptyDatabaseRanges( &aEmptyRanges );
-+ pCellsItr->SetDetectiveObj( pSharedData->GetDetectiveObjContainer() );
-+ pCellsItr->SetDetectiveOp( &aDetectiveOpContainer );
-+
-+ if (nTableCount > 0)
-+ pValidationsContainer->WriteValidations(*this);
-+ WriteTheLabelRanges( xSpreadDoc );
-+ for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
-+ {
-+ uno::Reference<sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-+ if (xTable.is())
-+ {
-+ xCurrentTable.set(xTable);
-+ xCurrentTableCellRange.set(xTable, uno::UNO_QUERY);
-+ uno::Reference<container::XNamed> xName (xTable, uno::UNO_QUERY );
-+ if ( xName.is() )
-+ {
-+ nCurrentTable = sal::static_int_cast<sal_uInt16>( nTable );
-+ rtl::OUString sOUTableName(xName->getName());
-+ AddAttribute(sAttrName, sOUTableName);
-+ AddAttribute(sAttrStyleName, aTableStyles[nTable]);
-+ uno::Reference<util::XProtectable> xProtectable (xTable, uno::UNO_QUERY);
-+ if (xProtectable.is() && xProtectable->isProtected())
-+ {
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
-+ rtl::OUStringBuffer aBuffer;
-+ if (pDoc)
-+ {
-+ ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable));
-+ if (pProtect)
-+ SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO));
-+ }
-+ if (aBuffer.getLength())
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
-+ }
-+ rtl::OUString sPrintRanges;
-+ table::CellRangeAddress aColumnHeaderRange;
-+ sal_Bool bHasColumnHeader;
-+ GetColumnRowHeader(bHasColumnHeader, aColumnHeaderRange, bHasRowHeader, aRowHeaderRange, sPrintRanges);
-+ if( sPrintRanges.getLength() )
-+ AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT_RANGES, sPrintRanges );
-+ else if (!pDoc->IsPrintEntireSheet(static_cast<SCTAB>(nTable)))
-+ AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT, XML_FALSE);
-+ SvXMLElementExport aElemT(*this, sElemTab, sal_True, sal_True);
-+ CheckAttrList();
-+ WriteTableSource();
-+ WriteScenario();
-+ uno::Reference<drawing::XDrawPage> xDrawPage;
-+ if (pSharedData->HasForm(nTable, xDrawPage) && xDrawPage.is())
-+ {
-+ ::xmloff::OOfficeFormsExport aForms(*this);
-+ GetFormExport()->exportForms( xDrawPage );
-+ sal_Bool bRet(GetFormExport()->seekPage( xDrawPage ));
-+ DBG_ASSERT( bRet, "OFormLayerXMLExport::seekPage failed!" );
-+ (void)bRet; // avoid warning in product version
-+ }
-+ if (pSharedData->HasDrawPage())
-+ {
-+ GetShapeExport()->seekShapes(uno::Reference<drawing::XShapes>(pSharedData->GetDrawPage(nTable), uno::UNO_QUERY));
-+ WriteTableShapes();
-+ }
-+ table::CellRangeAddress aRange(GetEndAddress(xTable, nTable));
-+ pSharedData->SetLastColumn(nTable, aRange.EndColumn);
-+ pSharedData->SetLastRow(nTable, aRange.EndRow);
-+ pCellsItr->SetCurrentTable(static_cast<SCTAB>(nTable), xCurrentTable);
-+ pGroupColumns->NewTable();
-+ pGroupRows->NewTable();
-+ FillColumnRowGroups();
-+ if (bHasColumnHeader)
-+ pSharedData->SetLastColumn(nTable, aColumnHeaderRange.EndColumn);
-+ bRowHeaderOpen = sal_False;
-+ if (bHasRowHeader)
-+ pSharedData->SetLastRow(nTable, aRowHeaderRange.EndRow);
-+ pDefaults->FillDefaultStyles(nTable, pSharedData->GetLastRow(nTable),
-+ pSharedData->GetLastColumn(nTable), pCellStyles, pDoc);
-+ pRowFormatRanges->SetRowDefaults(pDefaults->GetRowDefaults());
-+ pRowFormatRanges->SetColDefaults(pDefaults->GetColDefaults());
-+ pCellStyles->SetRowDefaults(pDefaults->GetRowDefaults());
-+ pCellStyles->SetColDefaults(pDefaults->GetColDefaults());
-+ ExportColumns(nTable, aColumnHeaderRange, bHasColumnHeader);
-+ sal_Bool bIsFirst(sal_True);
-+ sal_Int32 nEqualCells(0);
-+ ScMyCell aCell;
-+ ScMyCell aPrevCell;
-+ while(pCellsItr->GetNext(aCell, pCellStyles))
-+ {
-+ if (bIsFirst)
-+ {
-+ ExportFormatRanges(0, 0, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable);
-+ aPrevCell = aCell;
-+ bIsFirst = sal_False;
-+ }
-+ else
-+ {
-+ if ((aPrevCell.aCellAddress.Row == aCell.aCellAddress.Row) &&
-+ (aPrevCell.aCellAddress.Column + nEqualCells + 1 == aCell.aCellAddress.Column))
-+ {
-+ if(IsCellEqual(aPrevCell, aCell))
-+ ++nEqualCells;
-+ else
- {
-- ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable));
-- if (pProtect)
-- SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO));
-+ SetRepeatAttribute(nEqualCells);
-+ WriteCell(aPrevCell);
-+ nEqualCells = 0;
-+ aPrevCell = aCell;
- }
-- if (aBuffer.getLength())
-- AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
-- }
-- rtl::OUString sPrintRanges;
-- table::CellRangeAddress aColumnHeaderRange;
-- sal_Bool bHasColumnHeader;
-- GetColumnRowHeader(bHasColumnHeader, aColumnHeaderRange, bHasRowHeader, aRowHeaderRange, sPrintRanges);
-- if( sPrintRanges.getLength() )
-- AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT_RANGES, sPrintRanges );
-- else if (!pDoc->IsPrintEntireSheet(static_cast<SCTAB>(nTable)))
-- AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT, XML_FALSE);
-- SvXMLElementExport aElemT(*this, sElemTab, sal_True, sal_True);
-- CheckAttrList();
-- WriteTableSource();
-- WriteScenario();
-- uno::Reference<drawing::XDrawPage> xDrawPage;
-- if (pSharedData->HasForm(nTable, xDrawPage) && xDrawPage.is())
-- {
-- ::xmloff::OOfficeFormsExport aForms(*this);
-- GetFormExport()->exportForms( xDrawPage );
-- sal_Bool bRet(GetFormExport()->seekPage( xDrawPage ));
-- DBG_ASSERT( bRet, "OFormLayerXMLExport::seekPage failed!" );
-- (void)bRet; // avoid warning in product version
-- }
-- if (pSharedData->HasDrawPage())
-- {
-- GetShapeExport()->seekShapes(uno::Reference<drawing::XShapes>(pSharedData->GetDrawPage(nTable), uno::UNO_QUERY));
-- WriteTableShapes();
-- }
-- table::CellRangeAddress aRange(GetEndAddress(xTable, nTable));
-- pSharedData->SetLastColumn(nTable, aRange.EndColumn);
-- pSharedData->SetLastRow(nTable, aRange.EndRow);
-- pCellsItr->SetCurrentTable(static_cast<SCTAB>(nTable), xCurrentTable);
-- pGroupColumns->NewTable();
-- pGroupRows->NewTable();
-- FillColumnRowGroups();
-- if (bHasColumnHeader)
-- pSharedData->SetLastColumn(nTable, aColumnHeaderRange.EndColumn);
-- bRowHeaderOpen = sal_False;
-- if (bHasRowHeader)
-- pSharedData->SetLastRow(nTable, aRowHeaderRange.EndRow);
-- pDefaults->FillDefaultStyles(nTable, pSharedData->GetLastRow(nTable),
-- pSharedData->GetLastColumn(nTable), pCellStyles, pDoc);
-- pRowFormatRanges->SetRowDefaults(pDefaults->GetRowDefaults());
-- pRowFormatRanges->SetColDefaults(pDefaults->GetColDefaults());
-- pCellStyles->SetRowDefaults(pDefaults->GetRowDefaults());
-- pCellStyles->SetColDefaults(pDefaults->GetColDefaults());
-- ExportColumns(nTable, aColumnHeaderRange, bHasColumnHeader);
-- sal_Bool bIsFirst(sal_True);
-- sal_Int32 nEqualCells(0);
-- ScMyCell aCell;
-- ScMyCell aPrevCell;
-- while(pCellsItr->GetNext(aCell, pCellStyles))
-- {
-- if (bIsFirst)
-- {
-- ExportFormatRanges(0, 0, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable);
-- aPrevCell = aCell;
-- bIsFirst = sal_False;
-- }
-- else
-- {
-- if ((aPrevCell.aCellAddress.Row == aCell.aCellAddress.Row) &&
-- (aPrevCell.aCellAddress.Column + nEqualCells + 1 == aCell.aCellAddress.Column))
-- {
-- if(IsCellEqual(aPrevCell, aCell))
-- ++nEqualCells;
-- else
-- {
-- SetRepeatAttribute(nEqualCells);
-- WriteCell(aPrevCell);
-- nEqualCells = 0;
-- aPrevCell = aCell;
-- }
-- }
-- else
-- {
-- SetRepeatAttribute(nEqualCells);
-- WriteCell(aPrevCell);
-- ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row,
-- aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable);
-- nEqualCells = 0;
-- aPrevCell = aCell;
-- }
-- }
-- }
-- if (!bIsFirst)
-- {
-- SetRepeatAttribute(nEqualCells);
-- WriteCell(aPrevCell);
-- ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row,
-- pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable);
-- }
-- else
-- ExportFormatRanges(0, 0, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable);
-- CloseRow(pSharedData->GetLastRow(nTable));
-- nEqualCells = 0;
-- }
-- }
-- RemoveTempAnnotaionShape(nTable);
-+ }
-+ else
-+ {
-+ SetRepeatAttribute(nEqualCells);
-+ WriteCell(aPrevCell);
-+ ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row,
-+ aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable);
-+ nEqualCells = 0;
-+ aPrevCell = aCell;
-+ }
-+ }
-+ }
-+ if (!bIsFirst)
-+ {
-+ SetRepeatAttribute(nEqualCells);
-+ WriteCell(aPrevCell);
-+ ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row,
-+ pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable);
-+ }
-+ else
-+ ExportFormatRanges(0, 0, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable);
-+ CloseRow(pSharedData->GetLastRow(nTable));
-+ nEqualCells = 0;
-+ }
-+ }
-+ RemoveTempAnnotaionShape(nTable);
-
-- IncrementProgressBar(sal_False);
-- }
-- }
-- WriteNamedExpressions(xSpreadDoc);
-- aExportDatabaseRanges.WriteDatabaseRanges(xSpreadDoc);
-- ScXMLExportDataPilot aExportDataPilot(*this);
-- aExportDataPilot.WriteDataPilots(xSpreadDoc);
-- WriteConsolidation();
-- ScXMLExportDDELinks aExportDDELinks(*this);
-- aExportDDELinks.WriteDDELinks(xSpreadDoc);
-- IncrementProgressBar(sal_True, 0);
-- GetProgressBarHelper()->SetValue(GetProgressBarHelper()->GetReference());
-+ IncrementProgressBar(sal_False);
-+ }
-+ }
-+ WriteExternalRefCaches();
-+ WriteNamedExpressions(xSpreadDoc);
-+ aExportDatabaseRanges.WriteDatabaseRanges(xSpreadDoc);
-+ ScXMLExportDataPilot aExportDataPilot(*this);
-+ aExportDataPilot.WriteDataPilots(xSpreadDoc);
-+ WriteConsolidation();
-+ ScXMLExportDDELinks aExportDDELinks(*this);
-+ aExportDDELinks.WriteDDELinks(xSpreadDoc);
-+ IncrementProgressBar(sal_True, 0);
-+ GetProgressBarHelper()->SetValue(GetProgressBarHelper()->GetReference());
- }
-
- void ScXMLExport::_ExportStyles( sal_Bool bUsed )
-@@ -2000,6 +2011,15 @@ void ScXMLExport::_ExportAutoStyles()
-
- GetShapeExport()->exportAutoStyles();
- GetFormExport()->exportAutoStyles( );
-+
-+ {
-+ // Special table style for the external ref cache tables.
-+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sExternalRefTabStyleName);
-+ AddAttribute(XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE);
-+ SvXMLElementExport aElemStyle(*this, XML_NAMESPACE_STYLE, XML_STYLE, sal_True, sal_True);
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, XML_FALSE);
-+ SvXMLElementExport aElemStyleTabProps(*this, XML_NAMESPACE_STYLE, XML_TABLE_PROPERTIES, sal_True, sal_True);
-+ }
- }
- if (getExportFlags() & EXPORT_MASTERSTYLES)
- {
-@@ -3333,6 +3353,183 @@ void ScXMLExport::WriteNamedExpressions(const com::sun::star::uno::Reference <co
- }
- }
-
-+void ScXMLExport::WriteExternalRefCaches()
-+{
-+ if (!pDoc)
-+ return;
-+
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ pRefMgr->resetSrcFileData();
-+ sal_uInt16 nCount = pRefMgr->getCachedFileCount();
-+ for (sal_uInt16 nFileId = 0; nFileId < nCount; ++nFileId)
-+ {
-+ const String* pUrl = pRefMgr->getExternalFileName(nFileId);
-+ if (!pUrl)
-+ continue;
-+
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ continue;
-+
-+ for (vector<String>::const_iterator itr = pTabNames->begin(), itrEnd = pTabNames->end();
-+ itr != itrEnd; ++itr)
-+ {
-+ ScExternalRefCache::Table* pTable = pRefMgr->getCacheTable(nFileId, *itr, false);
-+ if (!pTable)
-+ continue;
-+
-+ OUStringBuffer aBuf;
-+ aBuf.append(sal_Unicode('\''));
-+ aBuf.append(*pUrl);
-+ aBuf.append(sal_Unicode('\''));
-+ aBuf.append(sal_Unicode('#'));
-+ aBuf.append(*itr);
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, aBuf.makeStringAndClear());
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_PRINT, GetXMLToken(XML_FALSE));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sExternalRefTabStyleName);
-+ SvXMLElementExport aElemTable(*this, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True);
-+ {
-+ const ScExternalRefManager::SrcFileData* pExtFileData = pRefMgr->getExternalFileData(nFileId);
-+ if (pExtFileData)
-+ {
-+ String aRelUrl;
-+ if (pExtFileData->maRelativeName.Len())
-+ aRelUrl = pExtFileData->maRelativeName;
-+ else
-+ aRelUrl = GetRelativeReference(pExtFileData->maRelativeName);
-+ AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aRelUrl);
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE_NAME, *itr);
-+ if (pExtFileData->maFilterName.Len())
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_NAME, pExtFileData->maFilterName);
-+ if (pExtFileData->maFilterOptions.Len())
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, pExtFileData->maFilterOptions);
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_MODE, XML_COPY_RESULTS_ONLY);
-+ }
-+ SvXMLElementExport aElemTableSource(*this, XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, sal_True, sal_True);
-+ }
-+
-+ // Write cache content for this table.
-+ vector<SCROW> aRows;
-+ pTable->getAllRows(aRows);
-+ SCROW nLastRow = 0;
-+ bool bFirstRow = true;
-+ for (vector<SCROW>::const_iterator itrRow = aRows.begin(), itrRowEnd = aRows.end();
-+ itrRow != itrRowEnd; ++itrRow)
-+ {
-+ SCROW nRow = *itrRow;
-+ if (bFirstRow)
-+ {
-+ if (nRow > 0)
-+ {
-+ if (nRow > 1)
-+ {
-+ OUStringBuffer aVal;
-+ aVal.append(nRow);
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, aVal.makeStringAndClear());
-+ }
-+ SvXMLElementExport aElemRow(*this, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True);
-+ OUStringBuffer aVal;
-+ aVal.append(static_cast<sal_Int32>(MAXCOLCOUNT));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aVal.makeStringAndClear());
-+ SvXMLElementExport aElemCell(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
-+ }
-+ }
-+ else
-+ {
-+ SCROW nRowGap = nRow - nLastRow;
-+ if (nRowGap > 1)
-+ {
-+ if (nRowGap > 2)
-+ {
-+ OUStringBuffer aVal;
-+ aVal.append(static_cast<sal_Int32>(nRowGap-1));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, aVal.makeStringAndClear());
-+ }
-+ SvXMLElementExport aElemRow(*this, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True);
-+ OUStringBuffer aVal;
-+ aVal.append(static_cast<sal_Int32>(MAXCOLCOUNT));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aVal.makeStringAndClear());
-+ SvXMLElementExport aElemCell(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
-+ }
-+ }
-+ SvXMLElementExport aElemRow(*this, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True);
-+
-+ vector<SCCOL> aCols;
-+ pTable->getAllCols(nRow, aCols);
-+ SCCOL nLastCol = 0;
-+ bool bFirstCol = true;
-+ for (vector<SCCOL>::const_iterator itrCol = aCols.begin(), itrColEnd = aCols.end();
-+ itrCol != itrColEnd; ++itrCol)
-+ {
-+ SCCOL nCol = *itrCol;
-+ if (bFirstCol)
-+ {
-+ if (nCol > 0)
-+ {
-+ if (nCol > 1)
-+ {
-+ OUStringBuffer aVal;
-+ aVal.append(static_cast<sal_Int32>(nCol));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aVal.makeStringAndClear());
-+ }
-+ SvXMLElementExport aElemCell(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
-+ }
-+ }
-+ else
-+ {
-+ SCCOL nColGap = nCol - nLastCol;
-+ if (nColGap > 1)
-+ {
-+ if (nColGap > 2)
-+ {
-+ OUStringBuffer aVal;
-+ aVal.append(static_cast<sal_Int32>(nColGap-1));
-+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aVal.makeStringAndClear());
-+ }
-+ SvXMLElementExport aElemCell(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
-+ }
-+ }
-+
-+ // Write out this cell.
-+ ScToken* pToken = pTable->getCell(nRow, nCol).get();
-+ OUString aStrVal;
-+ if (pToken)
-+ {
-+ switch(pToken->GetType())
-+ {
-+ case svDouble:
-+ {
-+ AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT);
-+ OUStringBuffer aVal;
-+ aVal.append(pToken->GetDouble());
-+ aStrVal = aVal.makeStringAndClear();
-+ AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE, aStrVal);
-+ }
-+ break;
-+ case svString:
-+ {
-+ AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING);
-+ aStrVal = pToken->GetString();
-+ }
-+ break;
-+ default:
-+ ;
-+ }
-+ }
-+ SvXMLElementExport aElemCell(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
-+ SvXMLElementExport aElemText(*this, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
-+ Characters(aStrVal);
-+
-+ nLastCol = nCol;
-+ bFirstCol = false;
-+ }
-+ nLastRow = nRow;
-+ bFirstRow = false;
-+ }
-+ }
-+ }
-+}
-+
- // core implementation
- void ScXMLExport::WriteConsolidation()
- {
-diff --git sc/source/filter/xml/xmlexprt.hxx sc/source/filter/xml/xmlexprt.hxx
-index 47171b6..e8477e5 100644
---- sc/source/filter/xml/xmlexprt.hxx
-+++ sc/source/filter/xml/xmlexprt.hxx
-@@ -98,6 +98,7 @@ class ScXMLExport : public SvXMLExport
- ScChangeTrackingExportHelper* pChangeTrackingExportHelper;
- const rtl::OUString sLayerID;
- const rtl::OUString sCaptionShape;
-+ rtl::OUString sExternalRefTabStyleName;
- rtl::OUString sAttrName;
- rtl::OUString sAttrStyleName;
- rtl::OUString sAttrColumnsRepeated;
-@@ -195,6 +196,7 @@ class ScXMLExport : public SvXMLExport
- void WriteTheLabelRanges(const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument >& xSpreadDoc);
- void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, sal_Bool bColumn );
- void WriteNamedExpressions(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc);
-+ void WriteExternalRefCaches();
- void WriteConsolidation(); // core implementation
-
- void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib);
-diff --git sc/source/filter/xml/xmlexternaltabi.cxx sc/source/filter/xml/xmlexternaltabi.cxx
-new file mode 100644
-index 0000000..e1d0ebd
---- /dev/null
-+++ sc/source/filter/xml/xmlexternaltabi.cxx
-@@ -0,0 +1,343 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: xmlcoli.hxx,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "xmlexternaltabi.hxx"
-+#include "xmlimprt.hxx"
-+#include "xmltabi.hxx"
-+
-+#include "token.hxx"
-+#include "document.hxx"
-+
-+#include <xmloff/nmspmap.hxx>
-+#include <xmloff/xmlnmspe.hxx>
-+#include <xmloff/xmltoken.hxx>
-+#include <xmloff/xmluconv.hxx>
-+#include <com/sun/star/util/NumberFormat.hpp>
-+
-+using namespace ::com::sun::star;
-+
-+using ::rtl::OUString;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::xml::sax::XAttributeList;
-+
-+// ============================================================================
-+
-+ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
-+ ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
-+ const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
-+ SvXMLImportContext( rImport, nPrefix, rLName ),
-+ mrScImport(rImport),
-+ mrExternalRefInfo(rRefInfo)
-+{
-+ using namespace ::xmloff::token;
-+
-+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-+ for (sal_Int16 i = 0; i < nAttrCount; ++i)
-+ {
-+ const rtl::OUString& sAttrName = xAttrList->getNameByIndex(i);
-+ rtl::OUString aLocalName;
-+ sal_uInt16 nAttrPrefix = mrScImport.GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
-+ const rtl::OUString& sValue = xAttrList->getValueByIndex(i);
-+ if (nAttrPrefix == XML_NAMESPACE_XLINK)
-+ {
-+ if (IsXMLToken(aLocalName, XML_HREF))
-+ maRelativeUrl = sValue;
-+ }
-+ else if (nAttrPrefix == XML_NAMESPACE_TABLE)
-+ {
-+ if (IsXMLToken(aLocalName, XML_TABLE_NAME))
-+ maTableName = sValue;
-+ else if (IsXMLToken(aLocalName, XML_FILTER_NAME))
-+ maFilterName = sValue;
-+ else if (IsXMLToken(aLocalName, XML_FILTER_OPTIONS))
-+ maFilterOptions = sValue;
-+ }
-+ }
-+}
-+
-+ScXMLExternalRefTabSourceContext::~ScXMLExternalRefTabSourceContext()
-+{
-+}
-+
-+SvXMLImportContext* ScXMLExternalRefTabSourceContext::CreateChildContext(
-+ USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& /*xAttrList*/ )
-+{
-+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-+}
-+
-+void ScXMLExternalRefTabSourceContext::EndElement()
-+{
-+ ScDocument* pDoc = mrScImport.GetDocument();
-+ if (!pDoc)
-+ return;
-+
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ if (!maRelativeUrl.equals(mrExternalRefInfo.maFileUrl))
-+ pRefMgr->setRelativeFileName(mrExternalRefInfo.mnFileId, maRelativeUrl);
-+ pRefMgr->setFilterData(mrExternalRefInfo.mnFileId, maFilterName, maFilterOptions);
-+}
-+
-+// ============================================================================
-+
-+ScXMLExternalRefRowContext::ScXMLExternalRefRowContext(
-+ ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
-+ const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
-+ SvXMLImportContext( rImport, nPrefix, rLName ),
-+ mrScImport(rImport),
-+ mrExternalRefInfo(rRefInfo),
-+ mnRepeatRowCount(1)
-+{
-+ mrExternalRefInfo.mnCol = 0;
-+
-+ sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-+ const SvXMLTokenMap& rAttrTokenMap = mrScImport.GetTableRowAttrTokenMap();
-+ for( sal_Int16 i=0; i < nAttrCount; ++i )
-+ {
-+ const rtl::OUString& sAttrName = xAttrList->getNameByIndex(i);
-+ rtl::OUString aLocalName;
-+ sal_uInt16 nAttrPrefix = mrScImport.GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
-+ const rtl::OUString& sValue = xAttrList->getValueByIndex(i);
-+
-+ switch (rAttrTokenMap.Get(nAttrPrefix, aLocalName))
-+ {
-+ case XML_TOK_TABLE_ROW_ATTR_REPEATED:
-+ {
-+ mnRepeatRowCount = std::max(sValue.toInt32(), static_cast<sal_Int32>(1));
-+ }
-+ break;
-+ }
-+ }
-+}
-+
-+ScXMLExternalRefRowContext::~ScXMLExternalRefRowContext()
-+{
-+}
-+
-+SvXMLImportContext* ScXMLExternalRefRowContext::CreateChildContext(
-+ USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
-+{
-+ const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowElemTokenMap();
-+ sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
-+ if (nToken == XML_TOK_TABLE_ROW_CELL)
-+ return new ScXMLExternalRefCellContext(mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
-+
-+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-+}
-+
-+void ScXMLExternalRefRowContext::EndElement()
-+{
-+ ScExternalRefCache::Table* pTab = mrExternalRefInfo.mpCacheTable;
-+
-+ for (sal_Int32 i = 1; i < mnRepeatRowCount; ++i)
-+ {
-+ for (sal_Int32 j = 0; j < mrExternalRefInfo.mnCol; ++j)
-+ {
-+ ScExternalRefCache::TokenRef pToken = pTab->getCell(
-+ static_cast<SCROW>(mrExternalRefInfo.mnRow), static_cast<SCCOL>(j));
-+
-+ if (pToken.get())
-+ {
-+ pTab->setCell(static_cast<SCROW>(
-+ mrExternalRefInfo.mnRow+i), static_cast<SCCOL>(j), pToken);
-+ }
-+ }
-+ }
-+ mrExternalRefInfo.mnRow += mnRepeatRowCount;
-+}
-+
-+// ============================================================================
-+
-+ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
-+ ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
-+ const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
-+ SvXMLImportContext( rImport, nPrefix, rLName ),
-+ mrScImport(rImport),
-+ mrExternalRefInfo(rRefInfo),
-+ mfCellValue(0.0),
-+ mnRepeatCount(1),
-+ mnCellType(::com::sun::star::util::NumberFormat::UNDEFINED),
-+ mbIsNumeric(false),
-+ mbIsEmpty(true)
-+{
-+ using namespace ::xmloff::token;
-+
-+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-+ const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
-+ for (sal_Int16 i = 0; i < nAttrCount; ++i)
-+ {
-+ OUString aLocalName;
-+ sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
-+ xAttrList->getNameByIndex(i), &aLocalName);
-+
-+ const rtl::OUString& sValue = xAttrList->getValueByIndex(i);
-+ sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
-+
-+ switch (nToken)
-+ {
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
-+ {
-+ mnRepeatCount = ::std::max(sValue.toInt32(), static_cast<sal_Int32>(1));
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
-+ {
-+ mnCellType = mrScImport.GetCellType(sValue);
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
-+ {
-+ if (sValue.getLength())
-+ {
-+ mrScImport.GetMM100UnitConverter().convertDouble(mfCellValue, sValue);
-+ mbIsNumeric = true;
-+ mbIsEmpty = false;
-+ }
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
-+ {
-+ if (sValue.getLength() && mrScImport.SetNullDateOnUnitConverter())
-+ {
-+ mrScImport.GetMM100UnitConverter().convertDateTime(mfCellValue, sValue);
-+ mbIsNumeric = true;
-+ mbIsEmpty = false;
-+ }
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
-+ {
-+ if (sValue.getLength())
-+ {
-+ mrScImport.GetMM100UnitConverter().convertTime(mfCellValue, sValue);
-+ mbIsNumeric = true;
-+ mbIsEmpty = false;
-+ }
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
-+ {
-+ if (sValue.getLength())
-+ {
-+ maCellString = sValue;
-+ mbIsNumeric = false;
-+ mbIsEmpty = false;
-+ }
-+ }
-+ break;
-+ case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
-+ {
-+ if (sValue.getLength())
-+ {
-+ mfCellValue = IsXMLToken(sValue, XML_TRUE) ? 1.0 : 0.0;
-+ mbIsNumeric = true;
-+ mbIsEmpty = false;
-+ }
-+ }
-+ break;
-+ default:
-+ ;
-+ }
-+ }
-+}
-+
-+ScXMLExternalRefCellContext::~ScXMLExternalRefCellContext()
-+{
-+}
-+
-+SvXMLImportContext* ScXMLExternalRefCellContext::CreateChildContext(
-+ USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
-+{
-+ const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowCellElemTokenMap();
-+ sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
-+ if (nToken == XML_TOK_TABLE_ROW_CELL_P)
-+ return new ScXMLExternalRefCellTextContext(mrScImport, nPrefix, rLocalName, xAttrList, maCellString);
-+
-+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-+}
-+
-+void ScXMLExternalRefCellContext::EndElement()
-+{
-+ if (maCellString.getLength())
-+ mbIsEmpty = false;
-+
-+ for (sal_Int32 i = 0; i < mnRepeatCount; ++i, ++mrExternalRefInfo.mnCol)
-+ {
-+ if (mbIsEmpty)
-+ continue;
-+
-+ ScExternalRefCache::TokenRef aToken;
-+ if (mbIsNumeric)
-+ aToken.reset(new ScDoubleToken(mfCellValue));
-+ else
-+ aToken.reset(new ScStringToken(maCellString));
-+
-+ mrExternalRefInfo.mpCacheTable->setCell(
-+ static_cast<SCROW>(mrExternalRefInfo.mnRow),
-+ static_cast<SCCOL>(mrExternalRefInfo.mnCol),
-+ aToken);
-+ }
-+}
-+
-+// ============================================================================
-+
-+ScXMLExternalRefCellTextContext::ScXMLExternalRefCellTextContext(
-+ ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
-+ const Reference<XAttributeList>& /*xAttrList*/, OUString& rCellString ) :
-+ SvXMLImportContext( rImport, nPrefix, rLName ),
-+ mrScImport(rImport),
-+ mrCellString(rCellString)
-+{
-+}
-+
-+ScXMLExternalRefCellTextContext::~ScXMLExternalRefCellTextContext()
-+{
-+}
-+
-+SvXMLImportContext* ScXMLExternalRefCellTextContext::CreateChildContext(
-+ USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& /*xAttrList*/ )
-+{
-+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
-+}
-+
-+void ScXMLExternalRefCellTextContext::Characters(const OUString& rChar)
-+{
-+ mrCellString = rChar;
-+}
-+
-+void ScXMLExternalRefCellTextContext::EndElement()
-+{
-+}
-diff --git sc/source/filter/xml/xmlexternaltabi.hxx sc/source/filter/xml/xmlexternaltabi.hxx
-new file mode 100644
-index 0000000..6f26789
---- /dev/null
-+++ sc/source/filter/xml/xmlexternaltabi.hxx
-@@ -0,0 +1,149 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: xmlcoli.hxx,v $
-+ * $Revision: 1.9 $
-+ *
-+ * 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 SC_XMLEXTERNALTABI_HXX
-+#define SC_XMLEXTERNALTABI_HXX
-+
-+#include <xmloff/xmlictxt.hxx>
-+
-+class ScXMLImport;
-+struct ScXMLExternalTabData;
-+
-+class ScXMLExternalRefTabSourceContext : public SvXMLImportContext
-+{
-+public:
-+ ScXMLExternalRefTabSourceContext( ScXMLImport& rImport, USHORT nPrefix,
-+ const ::rtl::OUString& rLName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
-+ ScXMLExternalTabData& rRefInfo );
-+
-+ virtual ~ScXMLExternalRefTabSourceContext();
-+
-+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
-+ const ::rtl::OUString& rLocalName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-+
-+ virtual void EndElement();
-+private:
-+ ScXMLImport& mrScImport;
-+ ScXMLExternalTabData& mrExternalRefInfo;
-+
-+ ::rtl::OUString maRelativeUrl;
-+ ::rtl::OUString maTableName;
-+ ::rtl::OUString maFilterName;
-+ ::rtl::OUString maFilterOptions;
-+};
-+
-+// ============================================================================
-+
-+class ScXMLExternalRefRowContext : public SvXMLImportContext
-+{
-+public:
-+ ScXMLExternalRefRowContext( ScXMLImport& rImport, USHORT nPrefix,
-+ const ::rtl::OUString& rLName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
-+ ScXMLExternalTabData& rRefInfo );
-+
-+ virtual ~ScXMLExternalRefRowContext();
-+
-+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
-+ const ::rtl::OUString& rLocalName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-+
-+ virtual void EndElement();
-+private:
-+ ScXMLImport& mrScImport;
-+ ScXMLExternalTabData& mrExternalRefInfo;
-+ sal_Int32 mnRepeatRowCount;
-+};
-+
-+// ============================================================================
-+
-+class ScXMLExternalRefCellContext : public SvXMLImportContext
-+{
-+public:
-+ ScXMLExternalRefCellContext( ScXMLImport& rImport, USHORT nPrefix,
-+ const ::rtl::OUString& rLName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
-+ ScXMLExternalTabData& rRefInfo );
-+
-+ virtual ~ScXMLExternalRefCellContext();
-+
-+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
-+ const ::rtl::OUString& rLocalName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-+
-+ virtual void EndElement();
-+
-+private:
-+ ScXMLImport& mrScImport;
-+ ScXMLExternalTabData& mrExternalRefInfo;
-+ ::rtl::OUString maCellString;
-+ double mfCellValue;
-+ sal_Int32 mnRepeatCount;
-+ sal_Int16 mnCellType;
-+ bool mbIsNumeric;
-+ bool mbIsEmpty;
-+};
-+
-+// ============================================================================
-+
-+class ScXMLExternalRefCellTextContext : public SvXMLImportContext
-+{
-+public:
-+ ScXMLExternalRefCellTextContext( ScXMLImport& rImport, USHORT nPrefix,
-+ const ::rtl::OUString& rLName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
-+ ::rtl::OUString& rCellString );
-+
-+ virtual ~ScXMLExternalRefCellTextContext();
-+
-+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
-+ const ::rtl::OUString& rLocalName,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
-+
-+ virtual void Characters(const ::rtl::OUString& rChar);
-+
-+ virtual void EndElement();
-+
-+private:
-+ ScXMLImport& mrScImport;
-+ ::rtl::OUString& mrCellString;
-+};
-+
-+#endif
-diff --git sc/source/filter/xml/xmlimprt.cxx sc/source/filter/xml/xmlimprt.cxx
-index 47b26b9..eb74c99 100644
---- sc/source/filter/xml/xmlimprt.cxx
-+++ sc/source/filter/xml/xmlimprt.cxx
-@@ -104,6 +104,7 @@
-
- using namespace com::sun::star;
- using namespace ::xmloff::token;
-+using ::rtl::OUString;
-
- OUString SAL_CALL ScXMLImport_getImplementationName() throw()
- {
-@@ -417,22 +418,22 @@ static __FAR_DATA SvXMLTokenMapEntry aTableRowCellTokenMap[] =
-
- static __FAR_DATA SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
- {
-- { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
-- { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
-- { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
-- { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
-- { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
-- { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
-- { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
-- { XML_NAMESPACE_TABLE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
-- { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
-- { XML_NAMESPACE_TABLE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
-- { XML_NAMESPACE_TABLE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
-- { XML_NAMESPACE_TABLE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
-- { XML_NAMESPACE_TABLE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
-- { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
-- { XML_NAMESPACE_TABLE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
-- XML_TOKEN_MAP_END
-+ { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
-+ { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
-+ { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
-+ { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
-+ { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
-+ { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
-+ { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
-+ { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
-+ { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
-+ { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
-+ { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
-+ { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
-+ { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
-+ { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
-+ { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
-+ XML_TOKEN_MAP_END
- };
-
- static __FAR_DATA SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
-@@ -1561,6 +1562,25 @@ ScXMLImport::ScXMLImport(
- GetXMLToken( XML_NP_PRESENTATION ),
- GetXMLToken( XML_N_PRESENTATION ),
- XML_NAMESPACE_PRESENTATION );
-+
-+ // initialize cell type map.
-+ const struct { XMLTokenEnum _token; sal_Int16 _type; } aCellTypePairs[] =
-+ {
-+ { XML_FLOAT, util::NumberFormat::NUMBER },
-+ { XML_STRING, util::NumberFormat::TEXT },
-+ { XML_TIME, util::NumberFormat::TIME },
-+ { XML_DATE, util::NumberFormat::DATETIME },
-+ { XML_PERCENTAGE, util::NumberFormat::PERCENT },
-+ { XML_CURRENCY, util::NumberFormat::CURRENCY },
-+ { XML_BOOLEAN, util::NumberFormat::LOGICAL }
-+ };
-+ size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]);
-+ for (size_t i = 0; i < n; ++i)
-+ {
-+ aCellTypeMap.insert(
-+ CellTypeMap::value_type(
-+ GetXMLToken(aCellTypePairs[i]._token), aCellTypePairs[i]._type));
-+ }
- }
-
- ScXMLImport::~ScXMLImport() throw()
-@@ -1777,6 +1797,15 @@ void ScXMLImport::SetStatistics(
- }
- }
-
-+sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
-+{
-+ CellTypeMap::const_iterator itr = aCellTypeMap.find(rStrValue);
-+ if (itr != aCellTypeMap.end())
-+ return itr->second;
-+
-+ return util::NumberFormat::UNDEFINED;
-+}
-+
- XMLShapeImportHelper* ScXMLImport::CreateShapeImport()
- {
- /*UniReference < XMLPropertySetMapper > xShapeStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScShapeStylesProperties, xScPropHdlFactory);
-diff --git sc/source/filter/xml/xmlimprt.hxx sc/source/filter/xml/xmlimprt.hxx
-index e4fd8a0..cace08e 100644
---- sc/source/filter/xml/xmlimprt.hxx
-+++ sc/source/filter/xml/xmlimprt.hxx
-@@ -40,7 +40,6 @@
- #include <com/sun/star/frame/XModel.hpp>
- #include <tools/time.hxx>
- #include <com/sun/star/util/DateTime.hpp>
--#include <vector>
- #include "xmlsubti.hxx"
- #include "global.hxx"
- #include "grammar.hxx"
-@@ -55,12 +54,13 @@
- #include <com/sun/star/util/XNumberFormatTypes.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-
-+#include <vector>
-+#include <hash_map>
-+
- class ScRangeList;
- class ScMyStyleNumberFormats;
- class XMLNumberFormatAttributesExportHelper;
-
--using namespace rtl;
--
- enum ScXMLDocTokens
- {
- XML_TOK_DOC_FONTDECLS,
-@@ -643,6 +643,9 @@ class ScMyStylesImportHelper;
-
- class ScXMLImport: public SvXMLImport
- {
-+ typedef ::std::hash_map< ::rtl::OUString, sal_Int16, ::rtl::OUStringHash > CellTypeMap;
-+ CellTypeMap aCellTypeMap;
-+
- ScDocument* pDoc;
- ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
- ScMyViewContextList aViewContextList;
-@@ -810,6 +813,8 @@ public:
-
- sal_Bool IsLatinDefaultStyle() const { return bLatinDefaultStyle; }
-
-+ sal_Int16 GetCellType(const ::rtl::OUString& rStrValue) const;
-+
- // SvI18NMap& GetI18NMap() { return *pI18NMap; }
-
- // inline const SvXMLImportItemMapper& GetParaItemMapper() const;
-diff --git sc/source/filter/xml/xmlsceni.cxx sc/source/filter/xml/xmlsceni.cxx
-index cfe859d..f4d6c89 100644
---- sc/source/filter/xml/xmlsceni.cxx
-+++ sc/source/filter/xml/xmlsceni.cxx
-@@ -50,6 +50,7 @@
-
- using namespace com::sun::star;
- using namespace xmloff::token;
-+using ::rtl::OUString;
-
- //------------------------------------------------------------------
-
-diff --git sc/source/filter/xml/xmlstyle.cxx sc/source/filter/xml/xmlstyle.cxx
-index 7aec632..863e82c 100644
---- sc/source/filter/xml/xmlstyle.cxx
-+++ sc/source/filter/xml/xmlstyle.cxx
-@@ -65,6 +65,7 @@
-
- using namespace com::sun::star;
- using namespace ::xmloff::token;
-+using ::rtl::OUString;
-
- #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
- #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 }
-diff --git sc/source/filter/xml/xmlstyle.hxx sc/source/filter/xml/xmlstyle.hxx
-index 4d51084..ee9a2ea 100644
---- sc/source/filter/xml/xmlstyle.hxx
-+++ sc/source/filter/xml/xmlstyle.hxx
-@@ -40,8 +40,6 @@
- #include <xmloff/xmlexppr.hxx>
- #include <xmloff/contextid.hxx>
-
--using namespace rtl;
--
- extern const XMLPropertyMapEntry aXMLScCellStylesProperties[];
- extern const XMLPropertyMapEntry aXMLScColumnStylesProperties[];
- extern const XMLPropertyMapEntry aXMLScRowStylesProperties[];
-diff --git sc/source/filter/xml/xmltabi.cxx sc/source/filter/xml/xmltabi.cxx
-index 4a0f83e..264901d 100644
---- sc/source/filter/xml/xmltabi.cxx
-+++ sc/source/filter/xml/xmltabi.cxx
-@@ -40,6 +40,7 @@
- #include "xmlrowi.hxx"
- #include "xmlcoli.hxx"
- #include "xmlsceni.hxx"
-+#include "xmlexternaltabi.hxx"
- #include "document.hxx"
- #include "docuno.hxx"
- #include "olinetab.hxx"
-@@ -48,6 +49,7 @@
- #include "XMLTableSourceContext.hxx"
- #include "XMLStylesImportHelper.hxx"
- #include "rangeutl.hxx"
-+#include "externalrefmgr.hxx"
-
- #include <xmloff/xmltkmap.hxx>
- #include <xmloff/nmspmap.hxx>
-@@ -63,6 +65,77 @@
- using namespace com::sun::star;
- using namespace xmloff::token;
-
-+/**
-+ * Determine whether this table is an external reference cache from its
-+ * name. There is currently no way of determining whether a table is a
-+ * regular table or an external reference cache other than examining the
-+ * name itself. We should probably introduce a new boolean value for
-+ * table:table element and use it instead of doing this, to make it more
-+ * reliable and future-proof.
-+ *
-+ * @param rName
-+ *
-+ * @return
-+ */
-+static bool lcl_isExternalRefCache(const rtl::OUString& rName, rtl::OUString& rUrl, rtl::OUString& rExtTabName)
-+{
-+ // 'file:///path/to/file.ods'#MySheet
-+ // 'file:///path/to/file.ods'#MySheet with space
-+ // 'file:///path/to/file's.ods'#Sheet (Notice the quote in the file name.
-+ // That's allowed.)
-+
-+ static const sal_Unicode aPrefix[] = {
-+ '\'', 'f', 'i', 'l', 'e', ':', '/', '/'
-+ };
-+
-+ rtl::OUStringBuffer aUrlBuf, aTabNameBuf;
-+ aUrlBuf.appendAscii("file://");
-+ sal_Int32 n = rName.getLength();
-+ const sal_Unicode* p = rName.getStr();
-+
-+ bool bInUrl = true;
-+ sal_Unicode cPrev = 0;
-+ for (sal_Int32 i = 0; i < n; ++i)
-+ {
-+ const sal_Unicode c = p[i];
-+ if (i <= 7)
-+ {
-+ if (c != aPrefix[i])
-+ return false;
-+ }
-+ else if (c == '#')
-+ {
-+ if (cPrev != '\'')
-+ return false;
-+
-+ rUrl = aUrlBuf.makeStringAndClear();
-+ rUrl = rUrl.copy(0, rUrl.getLength()-1); // remove the trailing single-quote.
-+ bInUrl = false;
-+ }
-+ else if (bInUrl)
-+ aUrlBuf.append(c);
-+ else
-+ aTabNameBuf.append(c);
-+
-+ cPrev = c;
-+ }
-+
-+ if (bInUrl)
-+ return false;
-+
-+ if (aTabNameBuf.getLength() == 0)
-+ return false;
-+
-+ rExtTabName = aTabNameBuf.makeStringAndClear();
-+
-+ return true;
-+}
-+
-+ScXMLExternalTabData::ScXMLExternalTabData() :
-+ mpCacheTable(NULL), mnRow(0), mnCol(0), mnFileId(0)
-+{
-+}
-+
- //------------------------------------------------------------------
-
- ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
-@@ -73,6 +146,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
- const sal_Bool bTempIsSubTable,
- const sal_Int32 nSpannedCols) :
- SvXMLImportContext( rImport, nPrfx, rLName ),
-+ pExternalRefInfo(NULL),
- bStartFormPage(sal_False),
- bPrintEntireSheet(sal_True)
- {
-@@ -117,7 +191,26 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
- break;
- }
- }
-- GetScImport().GetTables().NewSheet(sName, sStyleName, bProtection, sPassword);
-+
-+ rtl::OUString aExtUrl, aExtTabName;
-+ if (lcl_isExternalRefCache(sName, aExtUrl, aExtTabName))
-+ {
-+ // This is an external ref cache table.
-+ pExternalRefInfo.reset(new ScXMLExternalTabData);
-+ pExternalRefInfo->maFileUrl = aExtUrl;
-+ ScDocument* pDoc = GetScImport().GetDocument();
-+ if (pDoc)
-+ {
-+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
-+ pExternalRefInfo->mnFileId = pRefMgr->getExternalFileId(aExtUrl);
-+ pExternalRefInfo->mpCacheTable = pRefMgr->getCacheTable(pExternalRefInfo->mnFileId, aExtTabName, true);
-+ }
-+ }
-+ else
-+ {
-+ // This is a regular table.
-+ GetScImport().GetTables().NewSheet(sName, sStyleName, bProtection, sPassword);
-+ }
- }
- else
- {
-@@ -134,10 +227,30 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( USHORT nPrefix,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
- {
-+ const SvXMLTokenMap& rTokenMap(GetScImport().GetTableElemTokenMap());
-+ sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLName);
-+ if (pExternalRefInfo.get())
-+ {
-+ // We only care about the table-row and table-source elements for
-+ // external cache data.
-+ switch (nToken)
-+ {
-+ case XML_TOK_TABLE_ROW:
-+ return new ScXMLExternalRefRowContext(
-+ GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
-+ case XML_TOK_TABLE_SOURCE:
-+ return new ScXMLExternalRefTabSourceContext(
-+ GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
-+ default:
-+ ;
-+ }
-+
-+ return new SvXMLImportContext(GetImport(), nPrefix, rLName);
-+ }
-+
- SvXMLImportContext *pContext(0);
-
-- const SvXMLTokenMap& rTokenMap(GetScImport().GetTableElemTokenMap());
-- switch( rTokenMap.Get( nPrefix, rLName ) )
-+ switch (nToken)
- {
- case XML_TOK_TABLE_COL_GROUP:
- pContext = new ScXMLTableColsContext( GetScImport(), nPrefix,
-@@ -195,6 +308,8 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( USHORT nPrefix,
- pContext = GetScImport().GetFormImport()->createOfficeFormsContext( GetScImport(), nPrefix, rLName );
- }
- break;
-+ default:
-+ ;
- }
-
- if( !pContext )
-diff --git sc/source/filter/xml/xmltabi.hxx sc/source/filter/xml/xmltabi.hxx
-index 687cff8..e2960c2 100644
---- sc/source/filter/xml/xmltabi.hxx
-+++ sc/source/filter/xml/xmltabi.hxx
-@@ -30,13 +30,28 @@
- #ifndef SC_XMLTABI_HXX
- #define SC_XMLTABI_HXX
-
-+#include "externalrefmgr.hxx"
-+
- #include <xmloff/xmlictxt.hxx>
-+#include <memory>
-
- class ScXMLImport;
-
-+struct ScXMLExternalTabData
-+{
-+ String maFileUrl;
-+ ScExternalRefCache::Table* mpCacheTable;
-+ sal_Int32 mnRow;
-+ sal_Int32 mnCol;
-+ sal_uInt16 mnFileId;
-+
-+ ScXMLExternalTabData();
-+};
-+
- class ScXMLTableContext : public SvXMLImportContext
- {
- rtl::OUString sPrintRanges;
-+ ::std::auto_ptr<ScXMLExternalTabData> pExternalRefInfo;
- sal_Bool bStartFormPage;
- sal_Bool bPrintEntireSheet;
-
-diff --git sc/source/filter/xml/xmlwrap.cxx sc/source/filter/xml/xmlwrap.cxx
-index 851d338..035793b 100644
---- sc/source/filter/xml/xmlwrap.cxx
-+++ sc/source/filter/xml/xmlwrap.cxx
-@@ -85,6 +85,7 @@
- #define MAP_LEN(x) x, sizeof(x) - 1
-
- using namespace com::sun::star;
-+using ::rtl::OUString;
-
- // -----------------------------------------------------------------------
-
-diff --git sc/source/ui/docshell/docsh4.cxx sc/source/ui/docshell/docsh4.cxx
-index bc5975d..6701d1c 100644
---- sc/source/ui/docshell/docsh4.cxx
-+++ sc/source/ui/docshell/docsh4.cxx
-@@ -123,6 +123,7 @@ using namespace ::com::sun::star;
- #include <com/sun/star/document/UpdateDocMode.hpp>
- #include "scresid.hxx" //add by CHINA001
- #include "scabstdlg.hxx" //CHINA001
-+#include "externalrefmgr.hxx"
-
- #include "sharedocdlg.hxx"
-
-@@ -540,6 +541,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
- if (nDlgRet == RET_YES || nSet==LM_ALWAYS)
- {
- ReloadTabLinks();
-+ aDocument.UpdateExternalRefLinks();
- aDocument.UpdateDdeLinks();
- aDocument.UpdateAreaLinks();
-
-diff --git sc/source/ui/docshell/externalrefmgr.cxx sc/source/ui/docshell/externalrefmgr.cxx
-new file mode 100644
-index 0000000..25266aa
---- /dev/null
-+++ sc/source/ui/docshell/externalrefmgr.cxx
-@@ -0,0 +1,1328 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.hxx,v $
-+ * $Revision: 1.112 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "externalrefmgr.hxx"
-+#include "document.hxx"
-+#include "token.hxx"
-+#include "tokenarray.hxx"
-+#include "address.hxx"
-+#include "tablink.hxx"
-+#include "docsh.hxx"
-+#include "scextopt.hxx"
-+#include "rangenam.hxx"
-+#include "cell.hxx"
-+#include "viewdata.hxx"
-+#include "tabvwsh.hxx"
-+#include "sc.hrc"
-+
-+#include "sfx2/app.hxx"
-+#include "sfx2/docfilt.hxx"
-+#include "sfx2/docfile.hxx"
-+#include "sfx2/fcontnr.hxx"
-+#include "sfx2/sfxsids.hrc"
-+#include "sfx2/objsh.hxx"
-+#include "svtools/broadcast.hxx"
-+#include "svtools/smplhint.hxx"
-+#include "svtools/itemset.hxx"
-+#include "svtools/stritem.hxx"
-+#include "svtools/urihelper.hxx"
-+#include "svx/linkmgr.hxx"
-+#include "tools/urlobj.hxx"
-+#include "unotools/ucbhelper.hxx"
-+
-+#include <memory>
-+#include <algorithm>
-+
-+using ::std::auto_ptr;
-+using ::com::sun::star::uno::Any;
-+using ::rtl::OUString;
-+using ::std::vector;
-+using ::std::find;
-+using ::std::distance;
-+
-+#define SRCDOC_LIFE_SPAN 6000 // 1 minute (in 100th of a sec)
-+#define SRCDOC_SCAN_INTERVAL 1000*5 // every 5 seconds (in msec)
-+
-+// ============================================================================
-+
-+ScExternalRefCache::Table::Table()
-+{
-+}
-+
-+ScExternalRefCache::Table::~Table()
-+{
-+}
-+
-+void ScExternalRefCache::Table::setCell(SCROW nRow, SCCOL nCol, TokenRef pToken)
-+{
-+ using ::std::pair;
-+ RowsDataType::iterator itrRow = maRows.find(nRow);
-+ if (itrRow == maRows.end())
-+ {
-+ // This row does not exist yet.
-+ pair<RowsDataType::iterator, bool> res = maRows.insert(
-+ RowsDataType::value_type(nRow, RowDataType()));
-+
-+ if (!res.second)
-+ return;
-+
-+ itrRow = res.first;
-+ }
-+
-+ // Insert this token into the specified column location. I don't need to
-+ // check for existing data. Just overwrite it.
-+ RowDataType& rRow = itrRow->second;
-+ rRow.insert(RowDataType::value_type(nCol, pToken));
-+}
-+
-+ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell(SCROW nRow, SCCOL nCol) const
-+{
-+ RowsDataType::const_iterator itrTable = maRows.find(nRow);
-+ if (itrTable == maRows.end())
-+ {
-+ // this table doesn't have the specified row.
-+ return TokenRef();
-+ }
-+
-+ const RowDataType& rRowData = itrTable->second;
-+ RowDataType::const_iterator itrRow = rRowData.find(nCol);
-+ if (itrRow == rRowData.end())
-+ {
-+ // this row doesn't have the specified column.
-+ return TokenRef();
-+ }
-+
-+ return itrRow->second;
-+}
-+
-+void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows) const
-+{
-+ vector<SCROW> aRows;
-+ aRows.reserve(maRows.size());
-+ RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end();
-+ for (; itr != itrEnd; ++itr)
-+ aRows.push_back(itr->first);
-+
-+ // hash map is not ordered, so we need to explicitly sort it.
-+ ::std::sort(aRows.begin(), aRows.end());
-+ rRows.swap(aRows);
-+}
-+
-+void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) const
-+{
-+ RowsDataType::const_iterator itrRow = maRows.find(nRow);
-+ if (itrRow == maRows.end())
-+ // this table doesn't have the specified row.
-+ return;
-+
-+ const RowDataType& rRowData = itrRow->second;
-+ vector<SCCOL> aCols;
-+ aCols.reserve(rRowData.size());
-+ RowDataType::const_iterator itrCol = rRowData.begin(), itrColEnd = rRowData.end();
-+ for (; itrCol != itrColEnd; ++itrCol)
-+ aCols.push_back(itrCol->first);
-+
-+ // hash map is not ordered, so we need to explicitly sort it.
-+ ::std::sort(aCols.begin(), aCols.end());
-+ rCols.swap(aCols);
-+}
-+
-+// ----------------------------------------------------------------------------
-+
-+ScExternalRefCache::ScExternalRefCache()
-+{
-+}
-+ScExternalRefCache::~ScExternalRefCache()
-+{
-+}
-+
-+ScToken* ScExternalRefCache::getCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol)
-+{
-+ DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
-+ if (itrDoc == maDocs.end())
-+ {
-+ // specified document is not cached.
-+ return NULL;
-+ }
-+
-+ const DocItem& rDoc = itrDoc->second;
-+ TableNameIndexMap::const_iterator itrTabId = rDoc.maTableNameIndex.find(rTabName);
-+ if (itrTabId == rDoc.maTableNameIndex.end())
-+ {
-+ // the specified table is not in cache.
-+ return NULL;
-+ }
-+
-+ const TableTypeRef& pTableData = rDoc.maTables[itrTabId->second];
-+ if (!pTableData.get())
-+ {
-+ // the table data is not instantiated yet.
-+ return NULL;
-+ }
-+ return pTableData->getCell(nRow, nCol).get();
-+}
-+
-+ScTokenArray* ScExternalRefCache::getCellRangeData(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange)
-+{
-+ DocDataType::iterator itrDoc = maDocs.find(nFileId);
-+ if (itrDoc == maDocs.end())
-+ // specified document is not cached.
-+ return NULL;
-+
-+ DocItem& rDoc = itrDoc->second;
-+ RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange);
-+ if (itrRange != rDoc.maRangeArrays.end())
-+ {
-+ return itrRange->second.get();
-+ }
-+
-+ TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(rTabName);
-+ if (itrTabId == rDoc.maTableNameIndex.end())
-+ // the specified table is not in cache.
-+ return NULL;
-+
-+ const ScAddress& s = rRange.aStart;
-+ const ScAddress& e = rRange.aEnd;
-+
-+ SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
-+ SCCOL nCol1 = s.Col(), nCol2 = e.Col();
-+ SCROW nRow1 = s.Row(), nRow2 = e.Row();
-+
-+ // Make sure I have all the tables cached.
-+ size_t nTabFirstId = itrTabId->second;
-+ size_t nTabLastId = nTabFirstId + nTab2 - nTab1;
-+ if (nTabLastId >= rDoc.maTables.size())
-+ // not all tables are cached.
-+ return NULL;
-+
-+ TokenArrayRef pArray(new ScTokenArray);
-+ bool bFirstTab = true;
-+ for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
-+ {
-+ TableTypeRef pTab = rDoc.maTables[nTab];
-+ if (!pTab.get())
-+ return NULL;
-+
-+ ScMatrixRef xMat = new ScMatrix(
-+ static_cast<SCSIZE>(nCol2-nCol1+1), static_cast<SCSIZE>(nRow2-nRow1+1));
-+
-+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
-+ {
-+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
-+ {
-+ ScToken* pToken = pTab->getCell(nRow, nCol).get();
-+ if (!pToken)
-+ return NULL;
-+
-+ SCSIZE nC = nCol - nCol1, nR = nRow - nRow1;
-+ switch (pToken->GetType())
-+ {
-+ case svDouble:
-+ xMat->PutDouble(pToken->GetDouble(), nC, nR);
-+ break;
-+ case svString:
-+ xMat->PutString(pToken->GetString(), nC, nR);
-+ break;
-+ default:
-+ xMat->PutEmpty(nC, nR);
-+ }
-+ }
-+ }
-+
-+ if (!bFirstTab)
-+ pArray->AddOpCode(ocSep);
-+
-+ ScMatrix* pMat2 = xMat;
-+ ScMatrixToken aToken(pMat2);
-+ pArray->AddToken(aToken);
-+
-+ bFirstTab = false;
-+ }
-+ rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
-+ return pArray.get();
-+}
-+
-+ScTokenArray* ScExternalRefCache::getRangeNameTokens(sal_uInt16 nFileId, const String& rName)
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return NULL;
-+
-+ RangeNameMap& rMap = pDoc->maRangeNames;
-+ RangeNameMap::const_iterator itr = rMap.find(rName);
-+ if (itr == rMap.end())
-+ return NULL;
-+
-+ return itr->second.get();
-+}
-+
-+void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray)
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return;
-+
-+ RangeNameMap& rMap = pDoc->maRangeNames;
-+ rMap.insert(RangeNameMap::value_type(rName, pArray));
-+}
-+
-+void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const String& rTabName, SCROW nRow, SCCOL nCol, TokenRef pToken)
-+{
-+ if (!isDocInitialized(nFileId))
-+ return;
-+
-+ using ::std::pair;
-+ DocItem* pDocItem = getDocItem(nFileId);
-+ if (!pDocItem)
-+ return;
-+
-+ DocItem& rDoc = *pDocItem;
-+
-+ // See if the table by this name already exists.
-+ TableNameIndexMap::iterator itrTabName = rDoc.maTableNameIndex.find(rTabName);
-+ if (itrTabName == rDoc.maTableNameIndex.end())
-+ // Table not found. Maybe the table name or the file id is wrong ???
-+ return;
-+
-+ TableTypeRef& pTableData = rDoc.maTables[itrTabName->second];
-+ if (!pTableData.get())
-+ pTableData.reset(new Table);
-+
-+ pTableData->setCell(nRow, nCol, pToken);
-+}
-+
-+void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const vector<SingleRangeData>& rData,
-+ TokenArrayRef pArray)
-+{
-+ using ::std::pair;
-+ if (rData.empty() || !isDocInitialized(nFileId))
-+ // nothing to cache
-+ return;
-+
-+ // First, get the document item for the given file ID.
-+ DocItem* pDocItem = getDocItem(nFileId);
-+ if (!pDocItem)
-+ return;
-+
-+ DocItem& rDoc = *pDocItem;
-+
-+ // Now, find the table position of the first table to cache.
-+ const String& rFirstTabName = rData.front().maTableName;
-+ TableNameIndexMap::iterator itrTabName = rDoc.maTableNameIndex.find(rFirstTabName);
-+ if (itrTabName == rDoc.maTableNameIndex.end())
-+ {
-+ // table index not found.
-+ return;
-+ }
-+
-+ size_t nTab1 = itrTabName->second;
-+ SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
-+ SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
-+ vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
-+ for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
-+ {
-+ size_t i = nTab1 + ::std::distance(itrDataBeg, itrData);
-+ TableTypeRef& pTabData = rDoc.maTables[i];
-+ if (!pTabData.get())
-+ pTabData.reset(new Table);
-+
-+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
-+ {
-+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
-+ {
-+ SCSIZE nC = nCol - nCol1, nR = nRow - nRow1;
-+ TokenRef pToken;
-+ const ScMatrixRef& pMat = itrData->mpRangeData;
-+ if (pMat->IsValue(nC, nR))
-+ pToken.reset(new ScDoubleToken(pMat->GetDouble(nC, nR)));
-+ else if (pMat->IsString(nC, nR))
-+ pToken.reset(new ScStringToken(pMat->GetString(nC, nR)));
-+ else
-+ pToken.reset(new ScEmptyCellToken(false, false));
-+
-+ pTabData->setCell(nRow, nCol, pToken);
-+ }
-+ }
-+ }
-+
-+ rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
-+}
-+
-+bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return false;
-+
-+ return pDoc->mbInitFromSource;
-+}
-+
-+static bool lcl_getTableDataIndex(const ScExternalRefCache::TableNameIndexMap& rMap, const String& rName, size_t& rIndex)
-+{
-+ ScExternalRefCache::TableNameIndexMap::const_iterator itr = rMap.find(rName);
-+ if (itr == rMap.end())
-+ return false;
-+
-+ rIndex = itr->second;
-+ return true;
-+}
-+
-+void ScExternalRefCache::initializeDoc(sal_uInt16 nFileId, const vector<String>& rTabNames)
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return;
-+
-+ size_t n = rTabNames.size();
-+
-+ // table name list - the list must include all table names in the source
-+ // document and only to be populated when loading the source document, not
-+ // when loading cached data from, say, Excel XCT/CRN records.
-+ pDoc->maTableNames.assign(rTabNames.begin(), rTabNames.end());
-+
-+ // data tables - preserve any existing data that may have been set during
-+ // Excel import.
-+ vector<TableTypeRef> aNewTables(n);
-+ for (size_t i = 0; i < n; ++i)
-+ {
-+ size_t nIndex;
-+ if (lcl_getTableDataIndex(pDoc->maTableNameIndex, rTabNames[i], nIndex))
-+ {
-+ aNewTables[i] = pDoc->maTables[nIndex];
-+ }
-+ }
-+ pDoc->maTables.swap(aNewTables);
-+
-+ // name index map
-+ TableNameIndexMap aNewNameIndex;
-+ for (size_t i = 0; i < n; ++i)
-+ aNewNameIndex.insert(TableNameIndexMap::value_type(rTabNames[i], i));
-+ pDoc->maTableNameIndex.swap(aNewNameIndex);
-+
-+ pDoc->mbInitFromSource = true;
-+}
-+
-+const vector<String>* ScExternalRefCache::getAllTableNames(sal_uInt16 nFileId) const
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return NULL;
-+
-+ return &pDoc->maTableNames;
-+}
-+
-+ScExternalRefCache::Table* ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew)
-+{
-+ DocItem* pDoc = getDocItem(nFileId);
-+ if (!pDoc)
-+ return NULL;
-+
-+ DocItem& rDoc = *pDoc;
-+
-+ size_t nIndex;
-+ if (lcl_getTableDataIndex(rDoc.maTableNameIndex, rTabName, nIndex))
-+ // specified table found.
-+ return rDoc.maTables[nIndex].get();
-+
-+ if (!bCreateNew)
-+ return NULL;
-+
-+ // Specified table doesn't exist yet. Create one.
-+ TableTypeRef pTab(new Table);
-+ rDoc.maTables.push_back(pTab);
-+ rDoc.maTableNames.push_back(rTabName);
-+ rDoc.maTableNameIndex.insert(
-+ TableNameIndexMap::value_type(rTabName, rDoc.maTables.size()-1));
-+ return pTab.get();
-+}
-+
-+void ScExternalRefCache::clearCache(sal_uInt16 nFileId)
-+{
-+ maDocs.erase(nFileId);
-+}
-+
-+ScExternalRefCache::DocItem* ScExternalRefCache::getDocItem(sal_uInt16 nFileId) const
-+{
-+ using ::std::pair;
-+ DocDataType::iterator itrDoc = maDocs.find(nFileId);
-+ if (itrDoc == maDocs.end())
-+ {
-+ // specified document is not cached.
-+ pair<DocDataType::iterator, bool> res = maDocs.insert(
-+ DocDataType::value_type(nFileId, DocItem()));
-+
-+ if (!res.second)
-+ // insertion failed.
-+ return NULL;
-+
-+ itrDoc = res.first;
-+ }
-+
-+ return &itrDoc->second;
-+}
-+
-+// ============================================================================
-+
-+ScExternalRefLink::ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const String& rFilter) :
-+ ::sfx2::SvBaseLink(::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
-+ mnFileId(nFileId),
-+ maFilterName(rFilter),
-+ mpDoc(pDoc),
-+ mbDoRefresh(true)
-+{
-+}
-+
-+ScExternalRefLink::~ScExternalRefLink()
-+{
-+}
-+
-+void ScExternalRefLink::Closed()
-+{
-+ ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager();
-+ pMgr->removeSrcDocument(mnFileId, true);
-+}
-+
-+void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rValue*/)
-+{
-+ if (!mbDoRefresh)
-+ return;
-+
-+ String aFile, aFilter;
-+ mpDoc->GetLinkManager()->GetDisplayNames(this, NULL, &aFile, NULL, &aFilter);
-+ ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager();
-+ const String* pCurFile = pMgr->getExternalFileName(mnFileId);
-+ if (!pCurFile)
-+ return;
-+
-+ if (pCurFile->Equals(aFile))
-+ {
-+ // Refresh the current source document.
-+ pMgr->refreshNames(mnFileId);
-+ }
-+ else
-+ {
-+ // The source document has changed.
-+ pMgr->switchSrcFile(mnFileId, aFile);
-+ maFilterName = aFilter;
-+ }
-+}
-+
-+void ScExternalRefLink::Edit(Window* pParent, const Link& /*rEndEditHdl*/)
-+{
-+ SvBaseLink::Edit(pParent, LINK(this, ScExternalRefLink, EndEditHdl));
-+}
-+
-+void ScExternalRefLink::SetDoReferesh(bool b)
-+{
-+ mbDoRefresh = b;
-+}
-+
-+IMPL_LINK(ScExternalRefLink, EndEditHdl, void*, EMPTYARG)
-+{
-+ return 0;
-+}
-+
-+// ============================================================================
-+
-+static ScToken* lcl_convertToToken(ScBaseCell* pCell)
-+{
-+ if (!pCell)
-+ return NULL;
-+
-+ switch (pCell->GetCellType())
-+ {
-+ case CELLTYPE_STRING:
-+ {
-+ String aStr;
-+ static_cast<ScStringCell*>(pCell)->GetString(aStr);
-+ ScStringToken aToken(aStr);
-+ return aToken.Clone();
-+ }
-+ break;
-+ case CELLTYPE_VALUE:
-+ {
-+ double fVal = static_cast<ScValueCell*>(pCell)->GetValue();
-+ ScDoubleToken aToken(fVal);
-+ return aToken.Clone();
-+ }
-+ break;
-+ case CELLTYPE_FORMULA:
-+ {
-+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
-+ if (pFCell->IsValue())
-+ {
-+ double fVal = pFCell->GetValue();
-+ ScDoubleToken aToken(fVal);
-+ return aToken.Clone();
-+ }
-+ else
-+ {
-+ String aStr;
-+ pFCell->GetString(aStr);
-+ ScStringToken aToken(aStr);
-+ return aToken.Clone();
-+ }
-+ }
-+ break;
-+ default:
-+ DBG_ERROR("attempted to convert an unknown cell type.");
-+ }
-+
-+ return NULL;
-+}
-+
-+static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, const ScRange& rRange,
-+ vector<ScExternalRefCache::SingleRangeData>& rCacheData)
-+{
-+ const ScAddress& s = rRange.aStart;
-+ const ScAddress& e = rRange.aEnd;
-+
-+ SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
-+ SCCOL nCol1 = s.Col(), nCol2 = e.Col();
-+ SCROW nRow1 = s.Row(), nRow2 = e.Row();
-+
-+ auto_ptr<ScTokenArray> pArray(new ScTokenArray);
-+ bool bFirstTab = true;
-+ vector<ScExternalRefCache::SingleRangeData>::iterator
-+ itrCache = rCacheData.begin(), itrCacheEnd = rCacheData.end();
-+ for (SCTAB nTab = nTab1; nTab <= nTab2 && itrCache != itrCacheEnd; ++nTab, ++itrCache)
-+ {
-+ ScMatrixRef xMat = new ScMatrix(
-+ static_cast<SCSIZE>(nCol2-nCol1+1),
-+ static_cast<SCSIZE>(nRow2-nRow1+1));
-+
-+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
-+ {
-+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
-+ {
-+ SCSIZE nC = nCol - nCol1, nR = nRow - nRow1;
-+ ScBaseCell* pCell;
-+ pSrcDoc->GetCell(nCol, nRow, nTab, pCell);
-+ if (pCell)
-+ {
-+ switch (pCell->GetCellType())
-+ {
-+ case CELLTYPE_STRING:
-+ {
-+ String aStr;
-+ static_cast<ScStringCell*>(pCell)->GetString(aStr);
-+ xMat->PutString(aStr, nC, nR);
-+ }
-+ break;
-+ case CELLTYPE_VALUE:
-+ {
-+ double fVal = static_cast<ScValueCell*>(pCell)->GetValue();
-+ xMat->PutDouble(fVal, nC, nR);
-+ }
-+ break;
-+ case CELLTYPE_FORMULA:
-+ {
-+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
-+ if (pFCell->IsValue())
-+ {
-+ double fVal = pFCell->GetValue();
-+ xMat->PutDouble(fVal, nC, nR);
-+ }
-+ else
-+ {
-+ String aStr;
-+ pFCell->GetString(aStr);
-+ xMat->PutString(aStr, nC, nR);
-+ }
-+ }
-+ break;
-+ default:
-+ DBG_ERROR("attempted to convert an unknown cell type.");
-+ }
-+ }
-+ else
-+ {
-+ xMat->PutEmpty(nC, nR);
-+ }
-+ }
-+ }
-+ if (!bFirstTab)
-+ pArray->AddOpCode(ocSep);
-+
-+ ScMatrix* pMat2 = xMat;
-+ ScMatrixToken aToken(pMat2);
-+ pArray->AddToken(aToken);
-+
-+ itrCache->mpRangeData = xMat;
-+
-+ bFirstTab = false;
-+ }
-+ return pArray.release();
-+}
-+
-+ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) :
-+ mpDoc(pDoc)
-+{
-+ maSrcDocTimer.SetTimeoutHdl( LINK(this, ScExternalRefManager, TimeOutHdl) );
-+ maSrcDocTimer.SetTimeout(SRCDOC_SCAN_INTERVAL);
-+}
-+
-+ScExternalRefManager::~ScExternalRefManager()
-+{
-+ clear();
-+}
-+
-+ScExternalRefCache::Table* ScExternalRefManager::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew)
-+{
-+ return maRefCache.getCacheTable(nFileId, rTabName, bCreateNew);
-+}
-+
-+void ScExternalRefManager::storeRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScTokenArray& rArray)
-+{
-+ ScExternalRefCache::TokenArrayRef pArray(rArray.Clone());
-+ maRefCache.setRangeNameTokens(nFileId, rName, pArray);
-+}
-+
-+ScToken* ScExternalRefManager::getSingleRefToken(sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell,
-+ const ScAddress* pCurPos, SCTAB* pTab)
-+{
-+ if (pCurPos)
-+ insertReferencingCell(nFileId, *pCurPos);
-+
-+ maybeLinkExternalFile(nFileId);
-+
-+ if (pTab)
-+ *pTab = -1;
-+
-+ // Check if the given table name and the cell position is cached.
-+ ScToken* pToken = maRefCache.getCellData(nFileId, rTabName, rCell.Row(), rCell.Col());
-+ if (pToken)
-+ {
-+ return pToken;
-+ }
-+
-+ // reference not cached. read from the source document.
-+ ScDocument* pSrcDoc = getSrcDocument(nFileId);
-+ if (!pSrcDoc)
-+ {
-+ return NULL;
-+ }
-+
-+ ScBaseCell* pCell = NULL;
-+ SCTAB nTab;
-+ if (!pSrcDoc->GetTable(rTabName, nTab))
-+ {
-+ // specified table name doesn't exist in the source document.
-+ return NULL;
-+ }
-+
-+ if (pTab)
-+ *pTab = nTab;
-+
-+ pSrcDoc->GetCell(rCell.Col(), rCell.Row(), nTab, pCell);
-+ TokenRef pTok(lcl_convertToToken(pCell));
-+
-+ if (!pTok.get())
-+ {
-+ // Cell in the source document is probably empty.
-+ pTok.reset(new ScEmptyCellToken(false, false));
-+ }
-+
-+ // Now, insert the token into cache table.
-+ maRefCache.setCellData(nFileId, rTabName, rCell.Row(), rCell.Col(), pTok);
-+ return pTok.get();
-+}
-+
-+ScTokenArray* ScExternalRefManager::getDoubleRefTokens(sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos)
-+{
-+ if (pCurPos)
-+ insertReferencingCell(nFileId, *pCurPos);
-+
-+ maybeLinkExternalFile(nFileId);
-+
-+ // Check if the given table name and the cell position is cached.
-+ ScTokenArray* p = maRefCache.getCellRangeData(nFileId, rTabName, rRange);
-+ if (p)
-+ return p;
-+
-+ ScDocument* pSrcDoc = getSrcDocument(nFileId);
-+ if (!pSrcDoc)
-+ return NULL;
-+
-+ SCTAB nTab1;
-+ if (!pSrcDoc->GetTable(rTabName, nTab1))
-+ // specified table name doesn't exist in the source document.
-+ return NULL;
-+
-+ ScRange aRange(rRange);
-+ SCTAB nTabSpan = aRange.aEnd.Tab() - aRange.aStart.Tab();
-+
-+ vector<ScExternalRefCache::SingleRangeData> aCacheData;
-+ aCacheData.reserve(nTabSpan+1);
-+ aCacheData.push_back(ScExternalRefCache::SingleRangeData());
-+ aCacheData.back().maTableName = rTabName;
-+
-+ for (SCTAB i = 1; i < nTabSpan + 1; ++i)
-+ {
-+ String aTabName;
-+ if (!pSrcDoc->GetName(nTab1 + 1, aTabName))
-+ // source document doesn't have any table by the specified name.
-+ break;
-+
-+ aCacheData.push_back(ScExternalRefCache::SingleRangeData());
-+ aCacheData.back().maTableName = aTabName;
-+ }
-+
-+ aRange.aStart.SetTab(nTab1);
-+ aRange.aEnd.SetTab(nTab1 + nTabSpan);
-+
-+ ScExternalRefCache::TokenArrayRef pArray;
-+ pArray.reset(lcl_convertToTokenArray(pSrcDoc, aRange, aCacheData));
-+
-+ // Cache these values.
-+ maRefCache.setCellRangeData(nFileId, rRange, aCacheData, pArray);
-+
-+ return pArray.get();
-+}
-+
-+ScTokenArray* ScExternalRefManager::getRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos)
-+{
-+ if (pCurPos)
-+ insertReferencingCell(nFileId, *pCurPos);
-+
-+ maybeLinkExternalFile(nFileId);
-+
-+ ScTokenArray* pArray = maRefCache.getRangeNameTokens(nFileId, rName);
-+ if (pArray)
-+ return pArray;
-+
-+ ScDocument* pSrcDoc = getSrcDocument(nFileId);
-+ if (!pSrcDoc)
-+ return NULL;
-+
-+ ScRangeName* pExtNames = pSrcDoc->GetRangeName();
-+ String aUpperName = ScGlobal::pCharClass->upper(rName);
-+ USHORT n;
-+ bool bRes = pExtNames->SearchNameUpper(aUpperName, n);
-+ if (!bRes)
-+ return NULL;
-+
-+ ScRangeData* pRangeData = (*pExtNames)[n];
-+ if (!pRangeData)
-+ return NULL;
-+
-+ // Parse all tokens in this external range data, and replace each absolute
-+ // reference token with an external reference token, and cache them. Also
-+ // register the source document with the link manager if it's a new
-+ // source.
-+
-+ TokenArrayRef pNew(new ScTokenArray);
-+
-+ ScTokenArray* pCode = pRangeData->GetCode();
-+ for (ScToken* pToken = pCode->First(); pToken; pToken = pCode->Next())
-+ {
-+ bool bTokenAdded = false;
-+ switch (pToken->GetType())
-+ {
-+ case svSingleRef:
-+ {
-+ const SingleRefData& rRef = pToken->GetSingleRef();
-+ String aTabName;
-+ pSrcDoc->GetName(rRef.nTab, aTabName);
-+ ScExternalSingleRefToken aNewToken(nFileId, aTabName, pToken->GetSingleRef());
-+ pNew->AddToken(aNewToken);
-+ bTokenAdded = true;
-+ }
-+ break;
-+ case svDoubleRef:
-+ {
-+ const SingleRefData& rRef = pToken->GetSingleRef();
-+ String aTabName;
-+ pSrcDoc->GetName(rRef.nTab, aTabName);
-+ ScExternalDoubleRefToken aNewToken(nFileId, aTabName, pToken->GetDoubleRef());
-+ pNew->AddToken(aNewToken);
-+ bTokenAdded = true;
-+ }
-+ break;
-+ default:
-+ ; // nothing to do
-+ }
-+
-+ if (!bTokenAdded)
-+ pNew->AddToken(*pToken);
-+ }
-+
-+ maRefCache.setRangeNameTokens(nFileId, rName, pNew);
-+ return pNew.get();
-+}
-+
-+void ScExternalRefManager::refreshAllReferencingCells(sal_uInt16 nFileId)
-+{
-+ RefCellMap::iterator itr = maRefCells.find(nFileId);
-+ if (itr == maRefCells.end())
-+ return;
-+
-+ RefCellSet aNewSet;
-+ RefCellSet& rSet = itr->second;
-+ RefCellSet::const_iterator itrSet = rSet.begin(), itrSetEnd = rSet.end();
-+ for (; itrSet != itrSetEnd; ++itrSet)
-+ {
-+ if (compileTokensByCell(*itrSet))
-+ // Cell still contains an external name/ref token.
-+ aNewSet.insert(*itrSet);
-+ }
-+ rSet.swap(aNewSet);
-+
-+ ScViewData* pViewData = ScDocShell::GetViewData();
-+ if (!pViewData)
-+ return;
-+
-+ ScTabViewShell* pVShell = pViewData->GetViewShell();
-+ if (!pVShell)
-+ return;
-+
-+ // Repainting the grid also repaints the texts, but is there a better way
-+ // to refresh texts?
-+ pVShell->Invalidate(FID_TAB_TOGGLE_GRID);
-+ pVShell->PaintGrid();
-+}
-+
-+void ScExternalRefManager::insertReferencingCell(sal_uInt16 nFileId, const ScAddress& rCell)
-+{
-+ RefCellMap::iterator itr = maRefCells.find(nFileId);
-+ if (itr != maRefCells.end())
-+ {
-+ itr->second.insert(rCell);
-+ return;
-+ }
-+
-+ RefCellSet aSet;
-+ aSet.insert(rCell);
-+ maRefCells.insert(RefCellMap::value_type(nFileId, aSet));
-+}
-+
-+ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
-+{
-+ DocShellMap::iterator itrEnd = maDocShells.end();
-+ DocShellMap::iterator itr = maDocShells.find(nFileId);
-+
-+ if (itr != itrEnd)
-+ {
-+ SfxObjectShell* p = itr->second.maShell;
-+ itr->second.maLastAccess = Time();
-+ return static_cast<ScDocShell*>(p)->GetDocument();
-+ }
-+
-+ const String* pFile = getExternalFileName(nFileId);
-+ if (!pFile)
-+ // no file name associated with this ID.
-+ return NULL;
-+
-+ String aFilter;
-+ SrcShell aSrcDoc;
-+ aSrcDoc.maShell = loadSrcDocument(nFileId, aFilter);
-+ if (!aSrcDoc.maShell.Is())
-+ {
-+ // source document could not be loaded.
-+ return NULL;
-+ }
-+
-+ if (maDocShells.empty())
-+ {
-+ // If this is the first source document insertion, start up the timer.
-+ maSrcDocTimer.Start();
-+ }
-+
-+ maDocShells.insert(DocShellMap::value_type(nFileId, aSrcDoc));
-+ SfxObjectShell* p = aSrcDoc.maShell;
-+ ScDocument* pSrcDoc = static_cast<ScDocShell*>(p)->GetDocument();
-+
-+ SCTAB nTabCount = pSrcDoc->GetTableCount();
-+ if (!maRefCache.isDocInitialized(nFileId) && nTabCount)
-+ {
-+ // Populate the cache with all table names in the source document.
-+ vector<String> aTabNames;
-+ aTabNames.reserve(nTabCount);
-+ for (SCTAB i = 0; i < nTabCount; ++i)
-+ {
-+ String aName;
-+ pSrcDoc->GetName(i, aName);
-+ aTabNames.push_back(aName);
-+ }
-+ maRefCache.initializeDoc(nFileId, aTabNames);
-+ }
-+ return pSrcDoc;
-+}
-+
-+SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, String& rFilter)
-+{
-+ const SrcFileData* pFileData = getExternalFileData(nFileId);
-+ if (!pFileData)
-+ return NULL;
-+
-+ String aFile = pFileData->maFileName;
-+ if (!isFileLoadable(aFile))
-+ {
-+ // The original file path is not loadable. Try the relative path.
-+ // Note that the path is relative to the content.xml substream which
-+ // is one-level higher than the file itself.
-+
-+ if (!pFileData->maRelativeName.Len())
-+ return NULL;
-+
-+ INetURLObject aBaseURL(getOwnDocumentName());
-+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
-+ bool bWasAbs = false;
-+ aFile = aBaseURL.smartRel2Abs(pFileData->maRelativeName, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
-+ if (!isFileLoadable(aFile))
-+ // Ok, I've tried both paths but no success. Bail out.
-+ return NULL;
-+ }
-+
-+ String aOptions;
-+ ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
-+ const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter);
-+
-+ if (!pFileData->maRelativeName.Len())
-+ {
-+ // Generate a relative file path.
-+ INetURLObject aBaseURL(getOwnDocumentName());
-+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
-+
-+ String aStr = URIHelper::simpleNormalizedMakeRelative(
-+ aBaseURL.GetMainURL(INetURLObject::NO_DECODE), aFile);
-+
-+ setRelativeFileName(nFileId, aStr);
-+ }
-+
-+ // Update the filter data now that we are loading it again.
-+ setFilterData(nFileId, rFilter, aOptions);
-+
-+ SfxItemSet* pSet = new SfxAllItemSet(SFX_APP()->GetPool());
-+ if (aOptions.Len())
-+ pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions));
-+
-+ auto_ptr<SfxMedium> pMedium(new SfxMedium(aFile, STREAM_STD_READ, false, pFilter, pSet));
-+ if (pMedium->GetError() != ERRCODE_NONE)
-+ return NULL;
-+
-+ pMedium->UseInteractionHandler(false);
-+
-+ ScDocShell* pNewShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
-+ SfxObjectShellRef aRef = pNewShell;
-+
-+ // increment the recursive link count of the source document.
-+ ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions();
-+ sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0;
-+ ScDocument* pSrcDoc = pNewShell->GetDocument();
-+ ScExtDocOptions* pExtOptNew = pSrcDoc->GetExtDocOptions();
-+ if (!pExtOptNew)
-+ {
-+ pExtOptNew = new ScExtDocOptions;
-+ pSrcDoc->SetExtDocOptions(pExtOptNew);
-+ }
-+ pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
-+
-+ pNewShell->DoLoad(pMedium.release());
-+ return aRef;
-+}
-+
-+bool ScExternalRefManager::isFileLoadable(const String& rFile) const
-+{
-+ if (isOwnDocument(rFile))
-+ return false;
-+
-+ if (utl::UCBContentHelper::IsFolder(rFile))
-+ return false;
-+
-+ return utl::UCBContentHelper::Exists(rFile);
-+}
-+
-+void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
-+{
-+ if (maLinkedDocs.count(nFileId))
-+ // file alerady linked.
-+ return;
-+
-+ // Source document not linked yet. Link it now.
-+ const String* pFileName = getExternalFileName(nFileId);
-+ if (!pFileName)
-+ return;
-+
-+ String aFilter, aOptions;
-+ ScDocumentLoader::GetFilterName(*pFileName, aFilter, aOptions, true, false);
-+ SvxLinkManager* pLinkMgr = mpDoc->GetLinkManager();
-+ ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId, aFilter);
-+ DBG_ASSERT(pFileName, "ScExternalRefManager::insertExternalFileLink: file name pointer is NULL");
-+ pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName, &aFilter);
-+
-+ pLink->SetDoReferesh(false);
-+ pLink->Update();
-+ pLink->SetDoReferesh(true);
-+
-+ maLinkedDocs.insert(nFileId);
-+}
-+
-+bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell)
-+{
-+ ScBaseCell* pCell;
-+ mpDoc->GetCell(rCell.Col(), rCell.Row(), rCell.Tab(), pCell);
-+
-+ if (!pCell || pCell->GetCellType() != CELLTYPE_FORMULA)
-+ return false;
-+
-+ ScFormulaCell* pFC = static_cast<ScFormulaCell*>(pCell);
-+
-+ // Check to make sure the cell really contains ocExternalName.
-+ bool bCompile = false;
-+ ScTokenArray* pCode = pFC->GetCode();
-+ pCode->Reset();
-+ for (ScToken* p = pCode->First(); p; p = pCode->Next())
-+ {
-+ // External names, external cell and range references all have a
-+ // ocExternalName token.
-+ if (p->GetOpCode() == ocExternalName)
-+ {
-+ bCompile = true;
-+ break;
-+ }
-+ }
-+ if (!bCompile)
-+ return false;
-+
-+ ScTokenArray* pArray = pFC->GetCode();
-+ if (pArray)
-+ // Clear the error code, or a cell with error won't get re-compiled.
-+ pArray->SetCodeError(0);
-+
-+ pFC->SetCompile(true);
-+ pFC->CompileTokenArray();
-+ pFC->SetDirty();
-+
-+ return true;
-+}
-+
-+const String& ScExternalRefManager::getOwnDocumentName() const
-+{
-+ SfxObjectShell* pShell = mpDoc->GetDocumentShell();
-+ if (!pShell)
-+ // This should not happen!
-+ return EMPTY_STRING;
-+
-+ SfxMedium* pMed = pShell->GetMedium();
-+ if (!pMed)
-+ return EMPTY_STRING;
-+
-+ return pMed->GetName();
-+}
-+
-+bool ScExternalRefManager::isOwnDocument(const String& rFile) const
-+{
-+ return getOwnDocumentName().Equals(rFile);
-+}
-+
-+void ScExternalRefManager::convertToAbsName(String& rFile) const
-+{
-+ SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
-+ rFile = ScGlobal::GetAbsDocName(rFile, pDocShell);
-+}
-+
-+namespace {
-+
-+class FindSrcFileByName : public ::std::unary_function<ScExternalRefManager::SrcFileData, bool>
-+{
-+public:
-+ FindSrcFileByName(const String& rMatchName) :
-+ mrMatchName(rMatchName)
-+ {
-+ }
-+
-+ bool operator()(const ScExternalRefManager::SrcFileData& rSrcData) const
-+ {
-+ return rSrcData.maFileName.Equals(mrMatchName);
-+ }
-+
-+private:
-+ const String& mrMatchName;
-+};
-+
-+}
-+sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile)
-+{
-+ using namespace std;
-+
-+ vector<SrcFileData>::const_iterator itrBeg = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
-+ vector<SrcFileData>::const_iterator itr = find_if(itrBeg, itrEnd, FindSrcFileByName(rFile));
-+ if (itr != itrEnd)
-+ {
-+ size_t nId = distance(itrBeg, itr);
-+ return static_cast<sal_uInt16>(nId);
-+ }
-+
-+ SrcFileData aData;
-+ aData.maFileName = rFile;
-+ maSrcFiles.push_back(aData);
-+ return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
-+}
-+
-+const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId) const
-+{
-+ if (nFileId >= maSrcFiles.size())
-+ return NULL;
-+
-+ return &maSrcFiles[nFileId].maFileName;
-+}
-+
-+const ScExternalRefManager::SrcFileData* ScExternalRefManager::getExternalFileData(sal_uInt16 nFileId) const
-+{
-+ if (nFileId >= maSrcFiles.size())
-+ return NULL;
-+
-+ return &maSrcFiles[nFileId];
-+}
-+
-+const vector<String>* ScExternalRefManager::getAllCachedTableNames(sal_uInt16 nFileId) const
-+{
-+ return maRefCache.getAllTableNames(nFileId);
-+}
-+
-+sal_uInt16 ScExternalRefManager::getCachedFileCount() const
-+{
-+ return static_cast<sal_uInt16>(maSrcFiles.size());
-+}
-+
-+template<typename MapContainer>
-+static void lcl_removeByFileId(sal_uInt16 nFileId, MapContainer& rMap)
-+{
-+ typename MapContainer::iterator itr = rMap.find(nFileId);
-+ if (itr != rMap.end())
-+ rMap.erase(itr);
-+}
-+
-+void ScExternalRefManager::refreshNames(sal_uInt16 nFileId)
-+{
-+ removeSrcDocument(nFileId, false);
-+
-+ // Update all cells containing names from this source document.
-+ refreshAllReferencingCells(nFileId);
-+}
-+
-+void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile)
-+{
-+ maSrcFiles[nFileId].maFileName = rNewFile;
-+ maSrcFiles[nFileId].maRelativeName.Erase();
-+ refreshNames(nFileId);
-+}
-+
-+void ScExternalRefManager::setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl)
-+{
-+ if (nFileId >= maSrcFiles.size())
-+ return;
-+ maSrcFiles[nFileId].maRelativeName = rRelUrl;
-+}
-+
-+void ScExternalRefManager::setFilterData(sal_uInt16 nFileId, const String& rFilterName, const String& rOptions)
-+{
-+ if (nFileId >= maSrcFiles.size())
-+ return;
-+ maSrcFiles[nFileId].maFilterName = rFilterName;
-+ maSrcFiles[nFileId].maFilterOptions = rOptions;
-+}
-+
-+void ScExternalRefManager::removeSrcDocument(sal_uInt16 nFileId, bool bBreakLink)
-+{
-+ maRefCache.clearCache(nFileId);
-+ lcl_removeByFileId(nFileId, maDocShells);
-+
-+ if (bBreakLink)
-+ maLinkedDocs.erase(nFileId);
-+
-+ if (maDocShells.empty())
-+ maSrcDocTimer.Stop();
-+}
-+
-+void ScExternalRefManager::clear()
-+{
-+ DocShellMap::iterator itrEnd = maDocShells.end();
-+ for (DocShellMap::iterator itr = maDocShells.begin(); itr != itrEnd; ++itr)
-+ itr->second.maShell->DoClose();
-+
-+ maDocShells.clear();
-+ maSrcDocTimer.Stop();
-+}
-+
-+bool ScExternalRefManager::hasExternalData() const
-+{
-+ return !maSrcFiles.empty();
-+}
-+
-+void ScExternalRefManager::resetSrcFileData()
-+{
-+ INetURLObject aBaseURL(getOwnDocumentName());
-+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
-+ String aBaseUrlStr = aBaseURL.GetMainURL(INetURLObject::NO_DECODE);
-+ for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
-+ itr != itrEnd; ++itr)
-+ {
-+ if (!itr->maRelativeName.Len())
-+ {
-+ itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
-+ aBaseUrlStr, itr->maFileName);
-+ }
-+ }
-+}
-+
-+void ScExternalRefManager::purgeStaleSrcDocument(sal_Int32 nTimeOut)
-+{
-+ DocShellMap aNewDocShells;
-+ DocShellMap::iterator itr = maDocShells.begin(), itrEnd = maDocShells.end();
-+ for (; itr != itrEnd; ++itr)
-+ {
-+ // in 100th of a second.
-+ sal_Int32 nSinceLastAccess = (Time() - itr->second.maLastAccess).GetTime();
-+ if (nSinceLastAccess < nTimeOut)
-+ aNewDocShells.insert(*itr);
-+ }
-+ maDocShells.swap(aNewDocShells);
-+
-+ if (maDocShells.empty())
-+ maSrcDocTimer.Stop();
-+}
-+
-+IMPL_LINK(ScExternalRefManager, TimeOutHdl, AutoTimer*, pTimer)
-+{
-+ if (pTimer == &maSrcDocTimer)
-+ purgeStaleSrcDocument(SRCDOC_LIFE_SPAN);
-+
-+ return 0;
-+}
-+
-diff --git sc/source/ui/docshell/makefile.mk sc/source/ui/docshell/makefile.mk
-index db83fec..6286dfb 100644
---- sc/source/ui/docshell/makefile.mk
-+++ sc/source/ui/docshell/makefile.mk
-@@ -53,6 +53,7 @@ CXXFILES = \
- docsh6.cxx \
- docsh7.cxx \
- docsh8.cxx \
-+ externalrefmgr.cxx \
- tablink.cxx \
- arealink.cxx \
- dbdocfun.cxx \
-@@ -79,6 +80,7 @@ SLOFILES = \
- $(SLO)$/docsh6.obj \
- $(SLO)$/docsh7.obj \
- $(SLO)$/docsh8.obj \
-+ $(SLO)$/externalrefmgr.obj \
- $(SLO)$/tablink.obj \
- $(SLO)$/arealink.obj \
- $(SLO)$/dbdocfun.obj \
-@@ -101,6 +103,7 @@ EXCEPTIONSFILES= \
- $(SLO)$/docsh3.obj \
- $(SLO)$/docsh4.obj \
- $(SLO)$/docsh8.obj \
-+ $(SLO)$/externalrefmgr.obj \
- $(SLO)$/dbdocimp.obj
-
- SRS1NAME=$(TARGET)
-@@ -117,6 +120,7 @@ LIB1OBJFILES = \
- $(SLO)$/docsh6.obj \
- $(SLO)$/docsh7.obj \
- $(SLO)$/docsh8.obj \
-+ $(SLO)$/externalrefmgr.obj \
- $(SLO)$/tablink.obj \
- $(SLO)$/arealink.obj \
- $(SLO)$/dbdocfun.obj \
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index 5a8c983..6a2fabf 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -123,6 +123,7 @@ const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_COLLABELRNG), 0, &getCppuType((uno::Reference<sheet::XLabelRanges>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_DDELINKS), 0, &getCppuType((uno::Reference<container::XNameAccess>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP), 0, &getCppuType((sal_Int16*)0), 0, 0},
-+ {MAP_CHAR_LEN(SC_UNO_EXTERNALDOCLINKS), 0, &getCppuType((uno::Reference<sheet::XExternalDocLinks>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_FORBIDDEN), 0, &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_HASDRAWPAGES), 0, &getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_IGNORECASE), 0, &getBooleanCppuType(), 0, 0},
-@@ -1537,6 +1538,10 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- {
- aRet <<= uno::Reference<container::XNameAccess>(new ScDDELinksObj( pDocShell ));
- }
-+ else if ( aString.EqualsAscii( SC_UNO_EXTERNALDOCLINKS ) )
-+ {
-+ aRet <<= uno::Reference<sheet::XExternalDocLinks>(new ScExternalDocLinksObj(pDocShell));
-+ }
- else if ( aString.EqualsAscii( SC_UNO_SHEETLINKS ) )
- {
- aRet <<= uno::Reference<container::XNameAccess>(new ScSheetLinksObj( pDocShell ));
-diff --git sc/source/ui/unoobj/linkuno.cxx sc/source/ui/unoobj/linkuno.cxx
-index 52a5a62..96a074e 100644
---- sc/source/ui/unoobj/linkuno.cxx
-+++ sc/source/ui/unoobj/linkuno.cxx
-@@ -48,8 +48,20 @@
- #include "hints.hxx"
- #include "unonames.hxx"
- #include "rangeseq.hxx"
-+#include "token.hxx"
-+
-+#include <vector>
-
- using namespace com::sun::star;
-+using ::com::sun::star::uno::Any;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::Sequence;
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::lang::IllegalArgumentException;
-+using ::com::sun::star::uno::RuntimeException;
-+using ::rtl::OUString;
-+using ::std::vector;
-
- //------------------------------------------------------------------------
-
-@@ -1480,4 +1492,223 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
- return xLink;
- }
-
--//------------------------------------------------------------------------
-+// ============================================================================
-+
-+ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScExternalRefCache::Table* pTable) :
-+ mpTable(pTable)
-+{
-+}
-+
-+ScExternalSheetCacheObj::~ScExternalSheetCacheObj()
-+{
-+}
-+
-+void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nRow, sal_Int32 nCol, const Any& rValue)
-+ throw (IllegalArgumentException, RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ if (nRow < 0 || nCol < 0)
-+ throw IllegalArgumentException();
-+
-+ ScExternalRefCache::TokenRef pToken;
-+ double fVal;
-+ OUString aVal;
-+ if (rValue >>= fVal)
-+ pToken.reset(new ScDoubleToken(fVal));
-+ else if (rValue >>= aVal)
-+ pToken.reset(new ScStringToken(aVal));
-+ else
-+ // unidentified value type.
-+ return;
-+
-+ mpTable->setCell(static_cast<SCROW>(nRow), static_cast<SCCOL>(nCol), pToken);
-+}
-+
-+Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nRow, sal_Int32 nCol)
-+ throw (IllegalArgumentException, RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ if (nRow < 0 || nCol < 0)
-+ throw IllegalArgumentException();
-+
-+ ScToken* pToken = mpTable->getCell(nRow, nCol).get();
-+ if (!pToken)
-+ throw IllegalArgumentException();
-+
-+ Any aValue;
-+ switch (pToken->GetType())
-+ {
-+ case svDouble:
-+ {
-+ double fVal = pToken->GetDouble();
-+ aValue <<= fVal;
-+ }
-+ break;
-+ case svString:
-+ {
-+ OUString aVal = pToken->GetString();
-+ aValue <<= aVal;
-+ }
-+ break;
-+ default:
-+ throw IllegalArgumentException();
-+ }
-+ return aValue;
-+}
-+
-+Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ vector<SCROW> aRows;
-+ mpTable->getAllRows(aRows);
-+ size_t nSize = aRows.size();
-+ Sequence<sal_Int32> aRowsSeq(nSize);
-+ for (size_t i = 0; i < nSize; ++i)
-+ aRowsSeq[i] = aRows[i];
-+
-+ return aRowsSeq;
-+}
-+
-+Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
-+ throw (IllegalArgumentException, RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ if (nRow < 0)
-+ throw IllegalArgumentException();
-+
-+ vector<SCCOL> aCols;
-+ mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
-+ size_t nSize = aCols.size();
-+ Sequence<sal_Int32> aColsSeq(nSize);
-+ for (size_t i = 0; i < nSize; ++i)
-+ aColsSeq[i] = aCols[i];
-+
-+ return aColsSeq;
-+}
-+
-+// ============================================================================
-+
-+ScExternalDocLinkObj::ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId) :
-+ mpRefMgr(pRefMgr), mnFileId(nFileId)
-+{
-+}
-+
-+ScExternalDocLinkObj::~ScExternalDocLinkObj()
-+{
-+}
-+
-+Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetCache(
-+ const OUString& aSheetName )
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ ScExternalRefCache::Table* pTable = mpRefMgr->getCacheTable(mnFileId, aSheetName, true);
-+ Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable));
-+ return aSheetCache;
-+}
-+
-+// ============================================================================
-+
-+ScExternalDocLinksObj::ScExternalDocLinksObj(ScDocShell* pDocShell) :
-+ mpDocShell(pDocShell),
-+ mpRefMgr(pDocShell->GetDocument()->GetExternalRefManager())
-+{
-+}
-+
-+ScExternalDocLinksObj::~ScExternalDocLinksObj()
-+{
-+}
-+
-+Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
-+ const OUString& aDocName )
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocName);
-+ Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpRefMgr, nFileId));
-+ maDocLinks.insert( DocLinkMap::value_type(aDocName, aDocLink) );
-+ maDocNames.push_back(aDocName);
-+ return aDocLink;
-+}
-+
-+Any SAL_CALL ScExternalDocLinksObj::getByName(const::rtl::OUString &aName)
-+ throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ DocLinkMap::const_iterator itr = maDocLinks.find(aName);
-+ if (itr == maDocLinks.end())
-+ throw container::NoSuchElementException();
-+
-+ Any aAny;
-+ aAny <<= itr->second;
-+ return aAny;
-+}
-+
-+Sequence< OUString > SAL_CALL ScExternalDocLinksObj::getElementNames()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ size_t n = maDocNames.size();
-+ Sequence<OUString> aSeq(n);
-+ for (size_t i = 0; i < n; ++i)
-+ aSeq[i] = maDocNames[i];
-+ return aSeq;
-+}
-+
-+sal_Bool SAL_CALL ScExternalDocLinksObj::hasByName(const OUString &aName)
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ return static_cast<sal_Bool>(maDocLinks.count(aName) > 0);
-+}
-+
-+sal_Int32 SAL_CALL ScExternalDocLinksObj::getCount()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ return static_cast<sal_Int32>(maDocLinks.size());
-+}
-+
-+Any SAL_CALL ScExternalDocLinksObj::getByIndex(sal_Int32 nIndex)
-+ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ if (nIndex < 0 || nIndex >= static_cast<sal_Int32>(maDocNames.size()))
-+ throw lang::IndexOutOfBoundsException();
-+
-+ const OUString& rDocName = maDocNames[nIndex];
-+ DocLinkMap::const_iterator itr = maDocLinks.find(rDocName);
-+ if (itr == maDocLinks.end())
-+ // This should never happen!
-+ throw lang::IndexOutOfBoundsException();
-+
-+ Any aAny;
-+ aAny <<= itr->second;
-+ return aAny;
-+}
-+
-+Reference< container::XEnumeration >SAL_CALL ScExternalDocLinksObj::createEnumeration()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ Reference< container::XEnumeration > aRef(
-+ new ScIndexEnumeration(this, OUString::createFromAscii(
-+ "com.sun.star.sheet.ExternalDocLinks")));
-+ return aRef;
-+}
-+
-+uno::Type SAL_CALL ScExternalDocLinksObj::getElementType()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ return getCppuType(static_cast<Reference<sheet::XExternalDocLinks>*>(0));
-+}
-+
-+sal_Bool SAL_CALL ScExternalDocLinksObj::hasElements()
-+ throw (RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ return static_cast<sal_Bool>(!maDocLinks.empty());
-+}
-+
-diff --git sc/source/ui/view/tabvwsh4.cxx sc/source/ui/view/tabvwsh4.cxx
-index 436f0eb..2bf1f26 100644
---- sc/source/ui/view/tabvwsh4.cxx
-+++ sc/source/ui/view/tabvwsh4.cxx
-@@ -100,6 +100,7 @@
- #include "navsett.hxx"
- #include "sc.hrc" //CHINA001
- #include "scabstdlg.hxx" //CHINA001
-+#include "externalrefmgr.hxx"
-
- void ActivateOlk( ScViewData* pViewData );
- void DeActivateOlk( ScViewData* pViewData );
-@@ -1833,11 +1834,8 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
- if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_INTERNAL &&
- pDocSh->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
- {
-- BOOL bLink = FALSE; // Links updaten
-- SCTAB nTabCount = pDoc->GetTableCount();
-- for (SCTAB i=0; i<nTabCount && !bLink; i++)
-- if (pDoc->IsLinked(i))
-- bLink = TRUE;
-+ // Check if there are any external data.
-+ bool bLink = pDoc->GetExternalRefManager()->hasExternalData();
- if (!bLink)
- if (pDoc->HasDdeLinks() || pDoc->HasAreaLinks())
- bLink = TRUE;
diff --git a/patches/test/calc-external-names-additional-fixes-before-merge.diff b/patches/test/calc-external-names-additional-fixes-before-merge.diff
deleted file mode 100644
index 86bec6a23..000000000
--- a/patches/test/calc-external-names-additional-fixes-before-merge.diff
+++ /dev/null
@@ -1,164 +0,0 @@
-diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index f675389..6aff7ad 100644
---- sc/source/core/tool/compiler.cxx
-+++ sc/source/core/tool/compiler.cxx
-@@ -1298,16 +1298,22 @@ static bool lcl_parseExternalName( const String& rSymbol, String& rFile, String&
- return true;
- }
-
--static String lcl_makeExternalNameStr( const String& rFile, const String& rName, const sal_Unicode cSep )
-+static String lcl_makeExternalNameStr( const String& rFile, const String& rName,
-+ const sal_Unicode cSep, bool bODF )
- {
-- String aStr, aFile = rFile;
-+ String aFile( rFile);
- aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
-- aStr.Append(sal_Unicode('\''));
-- aStr.Append(aFile);
-- aStr.Append(sal_Unicode('\''));
-- aStr.Append(cSep);
-- aStr.Append(rName);
-- return aStr;
-+ rtl::OUStringBuffer aBuf( aFile.Len() + rName.Len() + 5);
-+ if (bODF)
-+ aBuf.append( sal_Unicode( '['));
-+ aBuf.append( sal_Unicode( '\''));
-+ aBuf.append( aFile);
-+ aBuf.append( sal_Unicode( '\''));
-+ aBuf.append( cSep);
-+ aBuf.append( rName);
-+ if (bODF)
-+ aBuf.append( sal_Unicode(']'));
-+ return String( aBuf.makeStringAndClear());
- }
-
- static bool lcl_getLastTabName( String& rTabName2, const String& rTabName1,
-@@ -1561,7 +1567,7 @@ struct ConventionOOO_A1 : public Convention_A1
-
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
- {
-- return lcl_makeExternalNameStr(rFile, rName, sal_Unicode('#'));
-+ return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('#'), false);
- }
-
- bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId,
-@@ -1598,40 +1604,67 @@ struct ConventionOOO_A1 : public Convention_A1
- return true;
- }
-
-- virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ void makeExternalRefStrImpl( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-- ScExternalRefManager* pRefMgr ) const
-+ ScExternalRefManager* pRefMgr, bool bODF ) const
- {
- SingleRefData aRef(rRef);
- aRef.CalcAbsIfRel(rCompiler.GetPos());
-
-+ if (bODF)
-+ rBuffer.append( sal_Unicode('['));
- makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true);
-+ if (bODF)
-+ rBuffer.append( sal_Unicode(']'));
- }
-
- virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-- sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
- ScExternalRefManager* pRefMgr ) const
- {
-+ makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
-+ }
-+
-+ void makeExternalRefStrImpl( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr, bool bODF ) const
-+ {
- ComplRefData aRef(rRef);
- aRef.CalcAbsIfRel(rCompiler.GetPos());
-
-- if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true))
-- return;
-+ if (bODF)
-+ rBuffer.append( sal_Unicode('['));
-+ // Ensure that there's always a closing bracket, no premature returns.
-+ do
-+ {
-+ if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true))
-+ break;
-
-- rBuffer.append(sal_Unicode(':'));
-+ rBuffer.append(sal_Unicode(':'));
-
-- // Get the name of the last table.
-- const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-- if (!pTabNames)
-- return;
-+ // Get the name of the last table.
-+ const vector<String>* pTabNames = pRefMgr->getAllCachedTableNames(nFileId);
-+ if (!pTabNames)
-+ break;
-
-- String aLastTabName;
-- if (!lcl_getLastTabName(aLastTabName, rTabName, *pTabNames, aRef))
-- {
-- rBuffer.append(aLastTabName);
-- return;
-- }
-- makeExternalSingleRefStr(rBuffer, nFileId, aLastTabName, aRef.Ref2, pRefMgr, (aRef.Ref1.nTab != aRef.Ref2.nTab));
-+ String aLastTabName;
-+ if (!lcl_getLastTabName(aLastTabName, rTabName, *pTabNames, aRef))
-+ {
-+ rBuffer.append(aLastTabName);
-+ break;
-+ }
-+ makeExternalSingleRefStr( rBuffer, nFileId, aLastTabName,
-+ aRef.Ref2, pRefMgr, (aRef.Ref1.nTab != aRef.Ref2.nTab));
-+ } while (0);
-+ if (bODF)
-+ rBuffer.append( sal_Unicode(']'));
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
- }
- };
-
-@@ -1651,6 +1684,25 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
- {
- MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, true);
- }
-+
-+ virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
-+ {
-+ return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('#'), true);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
-+ }
-+
-+ virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
-+ sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
-+ ScExternalRefManager* pRefMgr ) const
-+ {
-+ makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
-+ }
- };
-
- static const ConventionOOO_A1_ODF ConvOOO_A1_ODF;
-@@ -1762,7 +1814,7 @@ struct ConventionXL
-
- static String makeExternalNameStr( const String& rFile, const String& rName )
- {
-- return lcl_makeExternalNameStr(rFile, rName, sal_Unicode('!'));
-+ return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('!'), false);
- }
-
- static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName )
diff --git a/patches/test/calc-selection-cursor-position.diff b/patches/test/calc-selection-cursor-position.diff
deleted file mode 100644
index 56afb37a9..000000000
--- a/patches/test/calc-selection-cursor-position.diff
+++ /dev/null
@@ -1,632 +0,0 @@
-diff --git sc/source/ui/inc/cellsh.hxx sc/source/ui/inc/cellsh.hxx
-index b859e36..39fe3e8 100644
---- sc/source/ui/inc/cellsh.hxx
-+++ sc/source/ui/inc/cellsh.hxx
-@@ -37,6 +37,7 @@
- #include <svx/svdmark.hxx>
- #include <tools/link.hxx>
- #include "formatsh.hxx"
-+#include "address.hxx"
-
- class SvxClipboardFmtItem;
- class TransferableDataHelper;
-diff --git sc/source/ui/inc/tabview.hxx sc/source/ui/inc/tabview.hxx
-index 4e5cb0b..d147e13 100644
---- sc/source/ui/inc/tabview.hxx
-+++ sc/source/ui/inc/tabview.hxx
-@@ -203,6 +203,8 @@ private:
- static void SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, BOOL bLayoutRTL );
- static long GetScrollBarPos( ScrollBar& rScroll, BOOL bLayoutRTL );
-
-+ void GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPageX, SCsROW& rPageY);
-+
- protected:
- void UpdateHeaderWidth( const ScVSplitPos* pWhich = NULL,
- const SCROW* pPosY = NULL );
-@@ -483,6 +485,10 @@ public:
-
- BOOL IsBlockMode() const { return bIsBlockMode; }
-
-+ void ExpandBlock(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode);
-+ void ExpandBlockPage(SCsCOL nMovX, SCsROW nMovY);
-+ void ExpandBlockArea(SCsCOL nMovX, SCsROW nMovY);
-+
- void MarkColumns();
- void MarkRows();
- void MarkDataArea( BOOL bIncludeCursor = TRUE );
-diff --git sc/source/ui/view/cellsh4.cxx sc/source/ui/view/cellsh4.cxx
-index afb7c54..3c0fb0c 100644
---- sc/source/ui/view/cellsh4.cxx
-+++ sc/source/ui/view/cellsh4.cxx
-@@ -53,6 +53,42 @@
- #include "sc.hrc"
-
-
-+#include <stdio.h>
-+#include <string>
-+#include <sys/time.h>
-+
-+namespace {
-+
-+class StackPrinter
-+{
-+public:
-+ explicit StackPrinter(const char* msg) :
-+ msMsg(msg)
-+ {
-+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-+ mfStartTime = getTime();
-+ }
-+
-+ ~StackPrinter()
-+ {
-+ double fEndTime = getTime();
-+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-+ }
-+
-+private:
-+ double getTime() const
-+ {
-+ timeval tv;
-+ gettimeofday(&tv, NULL);
-+ return tv.tv_sec + tv.tv_usec / 1000000.0;
-+ }
-+
-+ ::std::string msMsg;
-+ double mfStartTime;
-+};
-+
-+}
-+
- //------------------------------------------------------------------
-
- #define IS_AVAILABLE(WhichId,ppItem) \
-@@ -61,6 +97,8 @@
-
- void ScCellShell::ExecuteCursor( SfxRequest& rReq )
- {
-+ StackPrinter __stack_printer__("ScCellShell::ExecuteCursor ------------------------------");
-+
- ScViewData* pData = GetViewData();
- ScTabViewShell* pTabViewShell = pData->GetViewShell();
- const SfxItemSet* pReqArgs = rReq.GetArgs();
-@@ -92,6 +130,54 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
- }
- }
-
-+ fprintf(stdout, "ScCellShell::ExecuteCursor: selection (%d) keep (%d) repeat (%d)\n", bSel, bKeep, nRepeat);
-+ if (bSel)
-+ {
-+ switch (nSlotId)
-+ {
-+ case SID_CURSORDOWN:
-+ rReq.SetSlot(SID_CURSORDOWN_SEL);
-+ break;
-+ case SID_CURSORUP:
-+ rReq.SetSlot(SID_CURSORUP_SEL);
-+ break;
-+ case SID_CURSORRIGHT:
-+ rReq.SetSlot(SID_CURSORRIGHT_SEL);
-+ break;
-+ case SID_CURSORLEFT:
-+ rReq.SetSlot(SID_CURSORLEFT_SEL);
-+ break;
-+ case SID_CURSORPAGEDOWN:
-+ rReq.SetSlot(SID_CURSORPAGEDOWN_SEL);
-+ break;
-+ case SID_CURSORPAGEUP:
-+ rReq.SetSlot(SID_CURSORPAGEUP_SEL);
-+ break;
-+ case SID_CURSORPAGERIGHT:
-+ rReq.SetSlot(SID_CURSORPAGERIGHT_SEL);
-+ break;
-+ case SID_CURSORPAGELEFT:
-+ rReq.SetSlot(SID_CURSORPAGELEFT_SEL);
-+ break;
-+ case SID_CURSORBLKDOWN:
-+ rReq.SetSlot(SID_CURSORBLKDOWN_SEL);
-+ break;
-+ case SID_CURSORBLKUP:
-+ rReq.SetSlot(SID_CURSORBLKUP_SEL);
-+ break;
-+ case SID_CURSORBLKRIGHT:
-+ rReq.SetSlot(SID_CURSORBLKRIGHT_SEL);
-+ break;
-+ case SID_CURSORBLKLEFT:
-+ rReq.SetSlot(SID_CURSORBLKLEFT_SEL);
-+ break;
-+ default:
-+ ;
-+ }
-+ ExecuteCursorSel(rReq);
-+ return;
-+ }
-+
- SCsCOLROW nRTLSign = 1;
- if ( pData->GetDocument()->IsLayoutRTL( pData->GetTabNo() ) )
- {
-@@ -104,6 +190,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
-
- //OS: einmal fuer alle wird doch reichen!
- pTabViewShell->ExecuteInputDirect();
-+
- switch ( nSlotId )
- {
- case SID_CURSORDOWN:
-@@ -172,9 +259,61 @@ void ScCellShell::GetStateCursor( SfxItemSet& /* rSet */ )
-
- void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
- {
-- const SfxItemSet* pReqArgs = rReq.GetArgs();
-- USHORT nSlotId = rReq.GetSlot();
-- short nRepeat = 1;
-+ StackPrinter __stack_printer__("ScCellShell::ExecuteCursorSel");
-+ const SfxItemSet* pReqArgs = rReq.GetArgs();
-+ sal_uInt16 nSlotId = rReq.GetSlot();
-+ short nRepeat = 1;
-+ ScViewData* pData = GetViewData();
-+ ScTabViewShell* pViewShell = pData->GetViewShell();
-+
-+ sal_uInt16 nLocked = pViewShell->GetLockedModifiers();
-+ bool bAddSel = (nLocked & KEY_MOD1);
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: add selection (%d)\n", bAddSel);
-+
-+#if 1
-+ switch (nSlotId)
-+ {
-+ case SID_CURSORDOWN_SEL:
-+ pViewShell->ExpandBlock(0, 1, SC_FOLLOW_LINE);
-+ break;
-+ case SID_CURSORUP_SEL:
-+ pViewShell->ExpandBlock(0, -1, SC_FOLLOW_LINE);
-+ break;
-+ case SID_CURSORRIGHT_SEL:
-+ pViewShell->ExpandBlock(1, 0, SC_FOLLOW_LINE);
-+ break;
-+ case SID_CURSORLEFT_SEL:
-+ pViewShell->ExpandBlock(-1, 0, SC_FOLLOW_LINE);
-+ break;
-+ case SID_CURSORPAGEUP_SEL:
-+ pViewShell->ExpandBlockPage(0, -1);
-+ break;
-+ case SID_CURSORPAGEDOWN_SEL:
-+ pViewShell->ExpandBlockPage(0, 1);
-+ break;
-+ case SID_CURSORPAGERIGHT_SEL:
-+ pViewShell->ExpandBlockPage(1, 0);
-+ break;
-+ case SID_CURSORPAGELEFT_SEL:
-+ pViewShell->ExpandBlockPage(-1, 0);
-+ break;
-+ case SID_CURSORBLKDOWN_SEL:
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: block down\n");
-+ break;
-+ case SID_CURSORBLKUP_SEL:
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: block up\n");
-+ break;
-+ case SID_CURSORBLKRIGHT_SEL:
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: block right\n");
-+ break;
-+ case SID_CURSORBLKLEFT_SEL:
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: block left\n");
-+ break;
-+ default:
-+ fprintf(stdout, "ScCellShell::ExecuteCursorSel: other\n");
-+ ;
-+ }
-+#else
-
- if ( pReqArgs != NULL )
- {
-@@ -204,6 +343,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
- rReq.AppendItem( SfxInt16Item(FN_PARAM_1, nRepeat ) );
- rReq.AppendItem( SfxBoolItem(FN_PARAM_2, TRUE) );
- ExecuteSlot( rReq, GetInterface() );
-+#endif
- }
-
- void ScCellShell::ExecuteMove( SfxRequest& rReq )
-@@ -325,6 +465,7 @@ void ScCellShell::ExecutePageSel( SfxRequest& rReq )
-
- void ScCellShell::ExecutePage( SfxRequest& rReq )
- {
-+ StackPrinter __stack_printer__("ScCellShell::ExecutePage");
- ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
- const SfxItemSet* pReqArgs = rReq.GetArgs();
- USHORT nSlotId = rReq.GetSlot();
-diff --git sc/source/ui/view/select.cxx sc/source/ui/view/select.cxx
-index f7ae33d..b4e3f3d 100644
---- sc/source/ui/view/select.cxx
-+++ sc/source/ui/view/select.cxx
-@@ -54,6 +54,43 @@ extern USHORT nScFillModeMouseModifier; // global.cxx
-
- using namespace com::sun::star;
-
-+
-+#include <stdio.h>
-+#include <string>
-+#include <sys/time.h>
-+
-+namespace {
-+
-+class StackPrinter
-+{
-+public:
-+ explicit StackPrinter(const char* msg) :
-+ msMsg(msg)
-+ {
-+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-+ mfStartTime = getTime();
-+ }
-+
-+ ~StackPrinter()
-+ {
-+ double fEndTime = getTime();
-+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-+ }
-+
-+private:
-+ double getTime() const
-+ {
-+ timeval tv;
-+ gettimeofday(&tv, NULL);
-+ return tv.tv_sec + tv.tv_usec / 1000000.0;
-+ }
-+
-+ ::std::string msMsg;
-+ double mfStartTime;
-+};
-+
-+}
-+
- // STATIC DATA -----------------------------------------------------------
-
- static Point aSwitchPos; //! Member
-@@ -304,6 +341,8 @@ void ScViewFunctionSet::SetAnchorFlag( BOOL bSet )
-
- BOOL __EXPORT ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOOL /* bDontSelectAtCursor */ )
- {
-+ StackPrinter __stack_printer__("ScViewFunctionSet::SetCursorAtPoint");
-+ fprintf(stdout, "ScViewFunctionSet::SetCursorAtPoint: cursor at point (%ld,%ld)\n", rPointPixel.X(), rPointPixel.Y());
- if ( bDidSwitch )
- {
- if ( rPointPixel == aSwitchPos )
-@@ -402,6 +441,8 @@ BOOL __EXPORT ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOO
-
- BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScroll )
- {
-+ StackPrinter __stack_printer__("ScViewFunctionSet::SetCursorAtCell");
-+ fprintf(stdout, "ScViewFunctionSet::SetCursorAtCell: cursor at (%ld,%ld)\n", nPosX,nPosY);
- ScTabView* pView = pViewData->GetView();
- SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
-@@ -656,6 +697,7 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
-
- if (bAnchor)
- {
-+ fprintf(stdout, "ScViewFunctionSet::SetCursorAtCell: anchor\n");
- if (!bStarted)
- {
- BOOL bMove = ( nPosX != (SCsCOL) aAnchorPos.Col() ||
-@@ -668,13 +710,18 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
- }
- }
- if (bStarted)
-+ // If the selection is already started, don't set the cursor.
- pView->MarkCursor( (SCCOL) nPosX, (SCROW) nPosY, nTab, FALSE, FALSE, TRUE );
-+ else
-+ pView->SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
- }
- else
- {
-+ fprintf(stdout, "ScViewFunctionSet::SetCursorAtCell: no anchor\n");
- ScMarkData& rMark = pViewData->GetMarkData();
-- if (rMark.IsMarked() || rMark.IsMultiMarked())
-+ if (rMark.IsMarked() || rMark.IsMultiMarked())
- {
-+ fprintf(stdout, "ScViewFunctionSet::SetCursorAtCell: mark exists\n");
- pView->DoneBlockMode(TRUE);
- pView->InitBlockMode( nPosX, nPosY, nTab, TRUE );
- pView->MarkCursor( (SCCOL) nPosX, (SCROW) nPosY, nTab );
-@@ -704,9 +751,9 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
-
- bStarted = TRUE;
- }
-+ pView->SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
- }
-
-- pView->SetCursor( (SCCOL) nPosX, (SCROW) nPosY );
- pViewData->SetRefStart( nPosX, nPosY, nTab );
- if (bHideCur)
- pView->ShowAllCursors();
-diff --git sc/source/ui/view/tabview2.cxx sc/source/ui/view/tabview2.cxx
-index 72bae06..66b1a5e 100644
---- sc/source/ui/view/tabview2.cxx
-+++ sc/source/ui/view/tabview2.cxx
-@@ -68,6 +68,42 @@
- #define SC_BLOCKMODE_OWN 2
-
-
-+#include <stdio.h>
-+#include <string>
-+#include <sys/time.h>
-+
-+namespace {
-+
-+class StackPrinter
-+{
-+public:
-+ explicit StackPrinter(const char* msg) :
-+ msMsg(msg)
-+ {
-+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-+ mfStartTime = getTime();
-+ }
-+
-+ ~StackPrinter()
-+ {
-+ double fEndTime = getTime();
-+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-+ }
-+
-+private:
-+ double getTime() const
-+ {
-+ timeval tv;
-+ gettimeofday(&tv, NULL);
-+ return tv.tv_sec + tv.tv_usec / 1000000.0;
-+ }
-+
-+ ::std::string msMsg;
-+ double mfStartTime;
-+};
-+
-+}
-+
-
- //
- // Markier - Funktionen
-@@ -127,6 +163,7 @@ void ScTabView::InitOwnBlockMode()
- void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
- BOOL bTestNeg, BOOL bCols, BOOL bRows )
- {
-+ fprintf(stdout, "ScTabView::InitBlockMode: ********************* called !!!\n");
- if (!bIsBlockMode)
- {
- if (!ValidCol(nCurX)) nCurX = MAXCOL;
-@@ -414,6 +451,81 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
- aHdrFunc.SetAnchorFlag( FALSE );
- }
-
-+void ScTabView::GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPageX, SCsROW& rPageY)
-+{
-+ SCCOL nCurX;
-+ SCROW nCurY;
-+ aViewData.GetMoveCursor( nCurX,nCurY );
-+
-+ ScSplitPos eWhich = aViewData.GetActivePart();
-+ ScHSplitPos eWhichX = WhichH( eWhich );
-+ ScVSplitPos eWhichY = WhichV( eWhich );
-+
-+ SCsCOL nPageX;
-+ SCsROW nPageY;
-+ if (nMovX >= 0)
-+ nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, 1, eWhichX )) * nMovX;
-+ else
-+ nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, -1, eWhichX )) * nMovX;
-+
-+ if (nMovY >= 0)
-+ nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY )) * nMovY;
-+ else
-+ nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY )) * nMovY;
-+
-+ if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
-+ if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
-+
-+ rPageX = nPageX;
-+ rPageY = nPageY;
-+}
-+
-+void ScTabView::ExpandBlock(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode)
-+{
-+ if (!nMovX && !nMovY)
-+ // Nothing to do. Bail out.
-+ return;
-+
-+ StackPrinter __stack_printer__("ScTabView::ExpandBlock");
-+ if (!IsBlockMode())
-+ InitBlockMode(aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo());
-+
-+ if (nMovX)
-+ nBlockEndX += nMovX;
-+
-+ if (nMovY)
-+ nBlockEndY += nMovY;
-+
-+ // Check for boundaries.
-+
-+ if (nBlockEndX < 0)
-+ nBlockEndX = 0;
-+ else if (nBlockEndX > MAXCOL)
-+ nBlockEndX = MAXCOL;
-+
-+ if (nBlockEndY < 0)
-+ nBlockEndY = 0;
-+ else if (nBlockEndY > MAXROW)
-+ nBlockEndY = MAXROW;
-+
-+ MarkCursor(nBlockEndX, nBlockEndY, aViewData.GetTabNo(), false, false, true);
-+ AlignToCursor(nBlockEndX, nBlockEndY, eMode);
-+ fprintf(stdout, "ScTabView::ExpandBlock: block (%ld,%ld) - (%ld,%ld)\n",
-+ nBlockStartX, nBlockStartY, nBlockEndX, nBlockEndY);
-+}
-+
-+void ScTabView::ExpandBlockPage(SCsCOL nMovX, SCsROW nMovY)
-+{
-+ SCsCOL nPageX;
-+ SCsROW nPageY;
-+ GetPageMoveEndPosition(nMovX, nMovY, nPageX, nPageY);
-+ ExpandBlock(nPageX, nPageY, SC_FOLLOW_FIX);
-+}
-+
-+void ScTabView::ExpandBlockArea(SCsCOL nMovX, SCsROW nMovY)
-+{
-+}
-+
- void ScTabView::UpdateSelectionOverlay()
- {
- for (USHORT i=0; i<4; i++)
-diff --git sc/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
-index 6f559a5..144a665 100644
---- sc/source/ui/view/tabview3.cxx
-+++ sc/source/ui/view/tabview3.cxx
-@@ -87,6 +87,43 @@
-
- using namespace com::sun::star::document::VbaEventId;
-
-+
-+#include <stdio.h>
-+#include <string>
-+#include <sys/time.h>
-+
-+namespace {
-+
-+class StackPrinter
-+{
-+public:
-+ explicit StackPrinter(const char* msg) :
-+ msMsg(msg)
-+ {
-+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-+ mfStartTime = getTime();
-+ }
-+
-+ ~StackPrinter()
-+ {
-+ double fEndTime = getTime();
-+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-+ }
-+
-+private:
-+ double getTime() const
-+ {
-+ timeval tv;
-+ gettimeofday(&tv, NULL);
-+ return tv.tv_sec + tv.tv_usec / 1000000.0;
-+ }
-+
-+ ::std::string msMsg;
-+ double mfStartTime;
-+};
-+
-+}
-+
- namespace
- {
-
-@@ -292,6 +329,9 @@ void ScTabView::InvalidateAttribs()
-
- void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, BOOL bNew )
- {
-+ StackPrinter __stack_printer__("ScTabView::SetCursor");
-+ fprintf(stdout, "ScTabView::SetCursor: (%d,%d)\n", nPosX, nPosY);
-+
- SCCOL nOldX = aViewData.GetCurX();
- SCROW nOldY = aViewData.GetCurY();
-
-@@ -911,6 +951,9 @@ BOOL ScTabView::SelMouseButtonDown( const MouseEvent& rMEvt )
- void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
- BOOL bShift, BOOL bControl, BOOL bKeepOld, BOOL bKeepSel )
- {
-+ StackPrinter __stack_printer__("ScTabView::MoveCursorAbs");
-+ fprintf(stdout, "ScTabView::MoveCursorAbs: move cursor to (%ld,%ld) block mode? (%d) shift (%d) keep selection (%d)\n",
-+ nCurX,nCurY, IsBlockMode(), bShift, bKeepSel);
- if (!bKeepOld)
- aViewData.ResetOldCursor();
-
-@@ -921,12 +964,12 @@ void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
-
- HideAllCursors();
-
-- if ( bShift && bNewStartIfMarking && IsBlockMode() )
-- {
-- // used for ADD selection mode: start a new block from the cursor position
-- DoneBlockMode( TRUE );
-- InitBlockMode( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo(), TRUE );
-- }
-+// if ( bShift && bNewStartIfMarking && IsBlockMode() )
-+// {
-+// // used for ADD selection mode: start a new block from the cursor position
-+// DoneBlockMode( TRUE );
-+// InitBlockMode( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo(), TRUE );
-+// }
-
- // aktiven Teil umschalten jetzt in AlignToCursor
-
-@@ -934,22 +977,31 @@ void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
- //! auf OS/2: SC_FOLLOW_JUMP statt SC_FOLLOW_LINE, um Nachlaufen zu verhindern ???
-
- if (bKeepSel)
-+ {
- SetCursor( nCurX, nCurY ); // Markierung stehenlassen
-+ DoneBlockMode(true);
-+ }
- else
- {
-+ // Remove all marked data on cursor movement.
-+ ScMarkData aData(aViewData.GetMarkData());
-+ aData.ResetMark();
-+ SetMarkData(aData);
-+
- BOOL bSame = ( nCurX == aViewData.GetCurX() && nCurY == aViewData.GetCurY() );
- bMoveIsShift = bShift;
-- pSelEngine->CursorPosChanging( bShift, bControl );
-+ pSelEngine->CursorPosChanging( bShift, bControl );
- bMoveIsShift = FALSE;
- aFunctionSet.SetCursorAtCell( nCurX, nCurY, FALSE );
-
- // Wenn der Cursor nicht bewegt wurde, muss das SelectionChanged fuer das
- // Aufheben der Selektion hier einzeln passieren:
-- if (bSame)
-+ if (bSame)
- SelectionChanged();
- }
-
- ShowAllCursors();
-+ fprintf(stdout, "ScTabView::MoveCursorAbs: block mode? (%d)\n", IsBlockMode());
- }
-
- void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
-@@ -1080,29 +1132,9 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
-
- void ScTabView::MoveCursorPage( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, BOOL bShift, BOOL bKeepSel )
- {
-- SCCOL nCurX;
-- SCROW nCurY;
-- aViewData.GetMoveCursor( nCurX,nCurY );
--
-- ScSplitPos eWhich = aViewData.GetActivePart();
-- ScHSplitPos eWhichX = WhichH( eWhich );
-- ScVSplitPos eWhichY = WhichV( eWhich );
--
-- SCsCOL nPageX;
-- SCsROW nPageY;
-- if (nMovX >= 0)
-- nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, 1, eWhichX )) * nMovX;
-- else
-- nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, -1, eWhichX )) * nMovX;
--
-- if (nMovY >= 0)
-- nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY )) * nMovY;
-- else
-- nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY )) * nMovY;
--
-- if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
-- if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
--
-+ SCsCOL nPageX;
-+ SCsROW nPageY;
-+ GetPageMoveEndPosition(nMovX, nMovY, nPageX, nPageY);
- MoveCursorRel( nPageX, nPageY, eMode, bShift, bKeepSel );
- }
-
diff --git a/patches/test/calc-xls-import-formula-cache.diff b/patches/test/calc-xls-import-formula-cache.diff
deleted file mode 100644
index 4f089815b..000000000
--- a/patches/test/calc-xls-import-formula-cache.diff
+++ /dev/null
@@ -1,205 +0,0 @@
-diff --git sc/inc/cell.hxx sc/inc/cell.hxx
-index a5aa3cf..fa5f62b 100644
---- sc/inc/cell.hxx
-+++ sc/inc/cell.hxx
-@@ -341,6 +341,8 @@ public:
- void GetFormula( rtl::OUStringBuffer& rBuffer,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT ) const;
-
-+ void SetCachedResult(const String& rStrVal);
-+ void SetCachedResult(double fVal);
- void SetDirty();
- void SetDirtyVar();
- // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 35fd858..65106e6 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -826,7 +826,7 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
- void SetDirty( const ScRange& );
- void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
- void CalcAll();
-- void CalcAfterLoad();
-+ void CalcAfterLoad(bool bSetDirtyAfterLoad = true);
- void CompileAll();
- void CompileXML();
-
-diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index c330826..d9ab45f 100644
---- sc/source/core/data/cell.cxx
-+++ sc/source/core/data/cell.cxx
-@@ -943,6 +943,12 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress )
-
- void ScFormulaCell::CalcAfterLoad()
- {
-+ if (!bDirty)
-+ {
-+ StartListeningTo( pDocument );
-+ return;
-+ }
-+
- BOOL bNewCompiled = FALSE;
- // Falls ein Calc 1.0-Doc eingelesen wird, haben wir ein Ergebnis,
- // aber kein TokenArray
-@@ -1666,6 +1672,20 @@ void __EXPORT ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
- }
- }
-
-+void ScFormulaCell::SetCachedResult(const String& rStrVal)
-+{
-+ aResult.SetHybridString(rStrVal);
-+ aResult.SetResultError(0);
-+ bDirty = false;
-+}
-+
-+void ScFormulaCell::SetCachedResult(double fVal)
-+{
-+ aResult.SetDouble(fVal);
-+ aResult.SetResultError(0);
-+ bDirty = false;
-+}
-+
- void ScFormulaCell::SetDirty()
- {
- if ( !IsInChangeTrack() )
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index a94a264..5a811db 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -2594,7 +2594,7 @@ void ScDocument::CompileXML()
- }
-
-
--void ScDocument::CalcAfterLoad()
-+void ScDocument::CalcAfterLoad(bool bSetDirtyAfterLoad)
- {
- SCTAB i;
-
-@@ -2604,8 +2604,13 @@ void ScDocument::CalcAfterLoad()
- bCalcingAfterLoad = TRUE;
- for ( i = 0; i <= MAXTAB; i++)
- if (pTab[i]) pTab[i]->CalcAfterLoad();
-- for (i=0; i<=MAXTAB; i++)
-- if (pTab[i]) pTab[i]->SetDirtyAfterLoad();
-+
-+ if (bSetDirtyAfterLoad)
-+ {
-+ for (i = 0; i <= MAXTAB; ++i)
-+ if (pTab[i])
-+ pTab[i]->SetDirtyAfterLoad();
-+ }
- bCalcingAfterLoad = FALSE;
-
- SetDetectiveDirty(FALSE); // noch keine wirklichen Aenderungen
-diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
-index fd87dbf..6aa412c 100644
---- sc/source/filter/excel/excform.cxx
-+++ sc/source/filter/excel/excform.cxx
-@@ -161,6 +161,8 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
-
- if( pZelle )
- {
-+ pLastFormCell = pZelle;
-+
- if( eErr != ConvOK )
- ExcelToSc::SetError( *pZelle, eErr );
- #if 0
-@@ -169,6 +171,10 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
- #else
- (void)rCurVal;
- #endif
-+ if (!rtl::math::isNan(rCurVal))
-+ pZelle->SetCachedResult(rCurVal);
-+ else
-+ pZelle->SetDirty();
- }
-
- GetXFRangeBuffer().SetXF( aScPos, nXF );
-diff --git sc/source/filter/excel/impop.cxx sc/source/filter/excel/impop.cxx
-index b532a58..28992c9 100644
---- sc/source/filter/excel/impop.cxx
-+++ sc/source/filter/excel/impop.cxx
-@@ -124,7 +124,8 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
- ImportTyp( &rImpData.mrDoc, rImpData.meTextEnc ),
- XclImpRoot( rImpData ),
- maStrm( rStrm, GetRoot() ),
-- aIn( maStrm )
-+ aIn( maStrm ),
-+ pLastFormCell(NULL)
- {
- nBdshtTab = 0;
- nIxfeIndex = 0; // zur Sicherheit auf 0
-@@ -352,6 +353,18 @@ void ImportExcel::ReadRk()
- }
- }
-
-+void ImportExcel::ReadString()
-+{
-+ if (GetBiff() == EXC_BIFF8 && pLastFormCell)
-+ {
-+ sal_uInt16 nLen;
-+ sal_uInt8 nOpt;
-+ maStrm >> nLen >> nOpt;
-+ String aStr = maStrm.ReadUniString(nLen, nOpt);
-+ pLastFormCell->SetCachedResult(aStr);
-+ }
-+}
-+
-
- void ImportExcel::Window1()
- {
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index a868e17..3855335 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -1094,6 +1094,7 @@ FltError ImportExcel8::Read( void )
- case EXC_ID2_BOOLERR:
- case EXC_ID3_BOOLERR: ReadBoolErr(); break;
- case EXC_ID_RK: ReadRk(); break;
-+ case EXC_ID3_STRING: ReadString(); break;
-
- case 0x0006:
- case 0x0206:
-@@ -1171,10 +1172,16 @@ FltError ImportExcel8::Read( void )
-
- pProgress.reset();
-
-+#if 0
-+ // Excel documents look much better without this call; better in the
-+ // sense that the row heights are near-identical to the original
-+ // heights in Excel (running on Linux via wine). We need to test this
-+ // on Windows to see how it looks there.
- AdjustRowHeight();
-+#endif
- PostDocLoad();
-
-- pD->CalcAfterLoad();
-+ pD->CalcAfterLoad(false);
-
- // import change tracking data
- XclImpChangeTrack aImpChTr( GetRoot(), maStrm );
-diff --git sc/source/filter/inc/fdumper.hxx sc/source/filter/inc/fdumper.hxx
-index aea8de6..8f57403 100644
---- sc/source/filter/inc/fdumper.hxx
-+++ sc/source/filter/inc/fdumper.hxx
-@@ -31,7 +31,7 @@
- #ifndef SC_FDUMPER_HXX
- #define SC_FDUMPER_HXX
-
--#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0)
-+#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0
-
- #include <map>
- #include <math.h>
-diff --git sc/source/filter/inc/imp_op.hxx sc/source/filter/inc/imp_op.hxx
-index 4a7e8c6..8969ef3 100644
---- sc/source/filter/inc/imp_op.hxx
-+++ sc/source/filter/inc/imp_op.hxx
-@@ -127,6 +127,7 @@ protected:
- void ReadLabel();
- void ReadBoolErr();
- void ReadRk();
-+ void ReadString();
-
- void Window1();
- void Formula25( void ); // 0x06 -> excform.cxx
diff --git a/patches/test/canvas-gradient-fixes.diff b/patches/test/canvas-gradient-fixes.diff
deleted file mode 100644
index eeea2c347..000000000
--- a/patches/test/canvas-gradient-fixes.diff
+++ /dev/null
@@ -1,3787 +0,0 @@
-canvas gradient fixes
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx | 6
- basegfx/inc/basegfx/numeric/ftools.hxx | 2
- basegfx/inc/basegfx/tools/gradienttools.hxx | 18 +
- basegfx/inc/basegfx/tools/keystoplerp.hxx | 100 +++++
- basegfx/inc/basegfx/tools/lerp.hxx | 60 +++
- basegfx/prj/d.lst | 2
- basegfx/source/matrix/b2dhommatrixtools.cxx | 28 +
- basegfx/source/tools/gradienttools.cxx | 85 ++--
- basegfx/source/tools/keystoplerp.cxx | 104 +++++
- basegfx/source/tools/makefile.mk | 1
- basegfx/test/basegfxtools.cxx | 119 ++++++
- basegfx/test/makefile.mk | 1
- canvas/inc/canvas/base/graphicdevicebase.hxx | 86 +----
- canvas/inc/canvas/canvastools.hxx | 22 -
- canvas/inc/canvas/parametricpolypolygon.hxx | 40 +-
- canvas/source/cairo/cairo_canvas.hxx | 3
- canvas/source/cairo/cairo_canvashelper.cxx | 272 ++++++++++----
- canvas/source/cairo/cairo_spritecanvas.hxx | 3
- canvas/source/null/null_spritecanvas.hxx | 4
- canvas/source/tools/parametricpolypolygon.cxx | 114 +++++-
- canvas/source/vcl/canvas.hxx | 3
- canvas/source/vcl/canvashelper_texturefill.cxx | 286 ++++++---------
- canvas/source/vcl/spritecanvas.hxx | 3
- cppcanvas/source/mtfrenderer/emfplus.cxx | 74 ++--
- cppcanvas/source/mtfrenderer/implrenderer.cxx | 379 +++++++-------------
- .../source/primitive2d/fillgradientprimitive2d.cxx | 26 +
- .../source/primitive2d/fillhatchprimitive2d.cxx | 6
- .../source/primitive3d/hatchtextureprimitive3d.cxx | 6
- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2
- .../source/processor3d/defaultprocessor3d.cxx | 10 -
- drawinglayer/source/texture/texture.cxx | 126 +------
- drawinglayer/source/texture/texture3d.cxx | 2
- offapi/com/sun/star/rendering/XGraphicDevice.idl | 65 +++
- offapi/com/sun/star/rendering/makefile.mk | 1
- .../source/engine/activities/activitybase.cxx | 2
- .../activities/continuouskeytimeactivitybase.cxx | 69 +---
- .../activities/continuouskeytimeactivitybase.hxx | 7
- .../source/engine/activities/interpolation.hxx | 21 +
- slideshow/source/engine/shapes/viewshape.cxx | 7
- slideshow/source/engine/tools.cxx | 26 +
- slideshow/source/inc/lerp.hxx | 62 ---
- 41 files changed, 1237 insertions(+), 1016 deletions(-)
- create mode 100644 basegfx/inc/basegfx/tools/keystoplerp.hxx
- create mode 100644 basegfx/inc/basegfx/tools/lerp.hxx
- create mode 100644 basegfx/source/tools/keystoplerp.cxx
- create mode 100644 basegfx/test/basegfxtools.cxx
- delete mode 100644 slideshow/source/inc/lerp.hxx
-
-
-diff --git basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
-index 1597de8..31b503f 100644
---- basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
-+++ basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx
-@@ -36,6 +36,8 @@
- #include <basegfx/matrix/b2dhommatrix.hxx>
- #include <basegfx/vector/b2dvector.hxx>
-
-+namespace rtl { class OUString; }
-+
- ///////////////////////////////////////////////////////////////////////////////
-
- namespace basegfx
-@@ -79,6 +81,10 @@ namespace basegfx
- double getRotate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfRotate; }
- double getShearX() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfShearX; }
- };
-+
-+ /// Returns a string with svg's "matrix(m00,m10,m01,m11,m02,m12)" representation
-+ ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix );
-+
- } // end of namespace basegfx
-
- ///////////////////////////////////////////////////////////////////////////////
-diff --git basegfx/inc/basegfx/numeric/ftools.hxx basegfx/inc/basegfx/numeric/ftools.hxx
-index 9321745..080695d 100644
---- basegfx/inc/basegfx/numeric/ftools.hxx
-+++ basegfx/inc/basegfx/numeric/ftools.hxx
-@@ -112,7 +112,7 @@ namespace basegfx
-
- /** clamp given value against given minimum and maximum values
- */
-- template <class T> const T& clamp(const T& value, const T& minimum, const T& maximum)
-+ template <class T> inline const T& clamp(const T& value, const T& minimum, const T& maximum)
- {
- if(value < minimum)
- {
-diff --git basegfx/inc/basegfx/tools/gradienttools.hxx basegfx/inc/basegfx/tools/gradienttools.hxx
-index 1b45aa9..48d50bf 100644
---- basegfx/inc/basegfx/tools/gradienttools.hxx
-+++ basegfx/inc/basegfx/tools/gradienttools.hxx
-@@ -37,6 +37,9 @@
- #include <basegfx/matrix/b2dhommatrix.hxx>
- #include <basegfx/numeric/ftools.hxx>
-
-+#include <vector>
-+#include <algorithm>
-+
- namespace basegfx
- {
- /** Gradient definition as used in ODF 1.2
-@@ -78,6 +81,8 @@ namespace basegfx
- {
- /** Create matrix for ODF's linear gradient definition
-
-+ Note that odf linear gradients are varying in y direction.
-+
- @param o_rGradientInfo
- Receives the calculated texture transformation matrix (for
- use with standard [0,1]x[0,1] texture coordinates)
-@@ -109,7 +114,7 @@ namespace basegfx
-
- @param rUV
- Current uv coordinate. Values outside [0,1] will be
-- clamped.
-+ clamped. Assumes gradient color varies along the y axis.
-
- @param rGradInfo
- Gradient info, for transformation and number of steps
-@@ -129,6 +134,14 @@ namespace basegfx
-
- /** Create matrix for ODF's axial gradient definition
-
-+ Note that odf axial gradients are varying in y
-+ direction. Note further that you can map the axial
-+ gradient to a linear gradient (in case you want or need to
-+ avoid an extra gradient renderer), by using
-+ createLinearODFGradientInfo() instead, shifting the
-+ resulting texture transformation by 0.5 to the top and
-+ appending the same stop colors again, but mirrored.
-+
- @param o_rGradientInfo
- Receives the calculated texture transformation matrix (for
- use with standard [0,1]x[0,1] texture coordinates)
-@@ -160,7 +173,7 @@ namespace basegfx
-
- @param rUV
- Current uv coordinate. Values outside [0,1] will be
-- clamped.
-+ clamped. Assumes gradient color varies along the y axis.
-
- @param rGradInfo
- Gradient info, for transformation and number of steps
-@@ -394,7 +407,6 @@ namespace basegfx
- {
- return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs
- }
--
- }
- }
-
-diff --git basegfx/inc/basegfx/tools/keystoplerp.hxx basegfx/inc/basegfx/tools/keystoplerp.hxx
-new file mode 100644
-index 0000000..df4d3bb
---- /dev/null
-+++ basegfx/inc/basegfx/tools/keystoplerp.hxx
-@@ -0,0 +1,100 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: canvastools.hxx,v $
-+ * $Revision: 1.10 $
-+ *
-+ * 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 _BGFX_TOOLS_KEYSTOPLERP_HXX
-+#define _BGFX_TOOLS_KEYSTOPLERP_HXX
-+
-+#include <basegfx/numeric/ftools.hxx>
-+#include <vector>
-+
-+namespace com{ namespace sun{ namespace star{ namespace uno {
-+ template<typename T> class Sequence;
-+}}}}
-+
-+namespace basegfx
-+{
-+ namespace tools
-+ {
-+ /** Lerp in a vector of key stops
-+
-+ This class holds a key stop vector and provides the
-+ functionality to lerp inside it. Useful e.g. for
-+ multi-stop gradients, or the SMIL key time activity.
-+
-+ For those, given a global [0,1] lerp alpha, one need to
-+ find the suitable bucket index from key stop vector, and
-+ then calculate the relative alpha between the two buckets
-+ found.
-+ */
-+ class KeyStopLerp
-+ {
-+ public:
-+ typedef std::pair<std::ptrdiff_t,double> ResultType;
-+
-+ /** Create lerper with given vector of stops
-+
-+ @param rKeyStops
-+
-+ Vector of stops, must contain at least two elements
-+ (though preferrably more, otherwise you probably don't
-+ need key stop lerping in the first place). All
-+ elements must be of monotonically increasing value.
-+ */
-+ explicit KeyStopLerp( const std::vector<double>& rKeyStops );
-+
-+ /** Create lerper with given sequence of stops
-+
-+ @param rKeyStops
-+
-+ Sequence of stops, must contain at least two elements
-+ (though preferrably more, otherwise you probably don't
-+ need key stop lerping in the first place). All
-+ elements must be of monotonically increasing value.
-+ */
-+ explicit KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops );
-+
-+ /** Find two nearest bucket index & interpolate
-+
-+ @param fAlpha
-+ Find bucket index i, with keyStops[i] < fAlpha <=
-+ keyStops[i+1]. Return new alpha value in [0,1),
-+ proportional to fAlpha's position between keyStops[i]
-+ and keyStops[i+1]
-+ */
-+ ResultType lerp(double fAlpha) const;
-+
-+ private:
-+ std::vector<double> maKeyStops;
-+ mutable std::ptrdiff_t mnLastIndex;
-+ };
-+ }
-+}
-+
-+#endif
-diff --git basegfx/inc/basegfx/tools/lerp.hxx basegfx/inc/basegfx/tools/lerp.hxx
-new file mode 100644
-index 0000000..36835f5
---- /dev/null
-+++ basegfx/inc/basegfx/tools/lerp.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: lerp.hxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 _BGFX_TOOLS_LERP_HXX
-+#define _BGFX_TOOLS_LERP_HXX
-+
-+#include <sal/types.h>
-+
-+namespace basegfx
-+{
-+ namespace tools
-+ {
-+ /** Generic linear interpolator
-+
-+ @tpl ValueType
-+ Must have operator+ and operator* defined, and should
-+ have value semantics.
-+
-+ @param t
-+ As usual, t must be in the [0,1] range
-+ */
-+ template< typename ValueType > ValueType lerp( const ValueType& rFrom,
-+ const ValueType& rTo,
-+ double t )
-+ {
-+ // This is only to suppress a double->int warning. All other
-+ // types should be okay here.
-+ return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
-+ }
-+ }
-+}
-+
-+#endif /* _BGFX_TOOLS_LERP_HXX */
-diff --git basegfx/prj/d.lst basegfx/prj/d.lst
-index a58cd33..1707969 100644
---- basegfx/prj/d.lst
-+++ basegfx/prj/d.lst
-@@ -89,6 +89,8 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tuple
-
- mkdir: %_DEST%\inc%_EXT%\basegfx\tools
- ..\inc\basegfx\tools\canvastools.hxx %_DEST%\inc%_EXT%\basegfx\tools\canvastools.hxx
-+..\inc\basegfx\tools\keystoplerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\keystoplerp.hxx
-+..\inc\basegfx\tools\lerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\lerp.hxx
- ..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx
- ..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx
- ..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx
-diff --git basegfx/source/matrix/b2dhommatrixtools.cxx basegfx/source/matrix/b2dhommatrixtools.cxx
-index d7c844e..ade2a25 100644
---- basegfx/source/matrix/b2dhommatrixtools.cxx
-+++ basegfx/source/matrix/b2dhommatrixtools.cxx
-@@ -33,11 +33,39 @@
- #include "precompiled_basegfx.hxx"
-
- #include <basegfx/matrix/b2dhommatrixtools.hxx>
-+#include <rtl/ustring.hxx>
-+#include <rtl/ustrbuf.hxx>
-
- ///////////////////////////////////////////////////////////////////////////////
-
- namespace basegfx
- {
-+ ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix )
-+ {
-+ rtl::OUStringBuffer aStrBuf;
-+ aStrBuf.appendAscii("matrix(");
-+
-+ aStrBuf.append(rMatrix.get(0,0));
-+ aStrBuf.appendAscii(", ");
-+
-+ aStrBuf.append(rMatrix.get(1,0));
-+ aStrBuf.appendAscii(", ");
-+
-+ aStrBuf.append(rMatrix.get(0,1));
-+ aStrBuf.appendAscii(", ");
-+
-+ aStrBuf.append(rMatrix.get(1,1));
-+ aStrBuf.appendAscii(", ");
-+
-+ aStrBuf.append(rMatrix.get(0,2));
-+ aStrBuf.appendAscii(", ");
-+
-+ aStrBuf.append(rMatrix.get(1,2));
-+ aStrBuf.appendAscii(")");
-+
-+ return aStrBuf.makeStringAndClear();
-+ }
-+
- } // end of namespace basegfx
-
- ///////////////////////////////////////////////////////////////////////////////
-diff --git basegfx/source/tools/gradienttools.cxx basegfx/source/tools/gradienttools.cxx
-index 9fe7ab6..e08c38f 100644
---- basegfx/source/tools/gradienttools.cxx
-+++ basegfx/source/tools/gradienttools.cxx
-@@ -51,7 +51,9 @@ namespace basegfx
- o_rGradientInfo.maTextureTransform.identity();
- o_rGradientInfo.maBackTextureTransform.identity();
- o_rGradientInfo.mnSteps = nSteps;
--
-+
-+ fAngle = -fAngle;
-+
- double fTargetSizeX(rTargetRange.getWidth());
- double fTargetSizeY(rTargetRange.getHeight());
- double fTargetOffsetX(rTargetRange.getMinX());
-@@ -70,7 +72,23 @@ namespace basegfx
- fTargetSizeY = fNewY;
- }
-
-- // add object scale before rotate
-+ double fSizeWithoutBorder=0;
-+ double fTranslateY=0;
-+ if( bAxial )
-+ {
-+ fSizeWithoutBorder = (1.0 - fBorder) * 0.5;
-+ fTranslateY = 0.5;
-+ }
-+ else
-+ {
-+ fSizeWithoutBorder = 1.0 - fBorder;
-+ fTranslateY = fBorder;
-+ }
-+
-+ if(!fTools::equal(fSizeWithoutBorder, 0.0))
-+ o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder);
-+
-+ o_rGradientInfo.maTextureTransform.translate(0.0, fTranslateY);
- o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
-
- // add texture rotate after scale to keep perpendicular angles
-@@ -90,24 +108,9 @@ namespace basegfx
- // prepare aspect for texture
- o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0;
-
-- // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
-+ // build transform from u,v to [0.0 .. 1.0].
- o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
- o_rGradientInfo.maBackTextureTransform.invert();
--
-- double fSizeWithoutBorder=0;
-- if( bAxial )
-- {
-- fSizeWithoutBorder = (1.0 - fBorder) * 0.5;
-- o_rGradientInfo.maBackTextureTransform.translate(0.0, -0.5);
-- }
-- else
-- {
-- fSizeWithoutBorder = 1.0 - fBorder;
-- o_rGradientInfo.maBackTextureTransform.translate(0.0, -fBorder);
-- }
--
-- if(!fTools::equal(fSizeWithoutBorder, 0.0))
-- o_rGradientInfo.maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder);
- }
-
- /** Most of the setup for radial & ellipsoidal gradient is the same,
-@@ -124,7 +127,9 @@ namespace basegfx
- o_rGradientInfo.maTextureTransform.identity();
- o_rGradientInfo.maBackTextureTransform.identity();
- o_rGradientInfo.mnSteps = nSteps;
--
-+
-+ fAngle = -fAngle;
-+
- double fTargetSizeX(rTargetRange.getWidth());
- double fTargetSizeY(rTargetRange.getHeight());
- double fTargetOffsetX(rTargetRange.getMinX());
-@@ -147,7 +152,11 @@ namespace basegfx
- fTargetSizeY = 1.4142 * fTargetSizeY;
- }
-
-- // add object scale before rotate
-+ const double fHalfBorder((1.0 - fBorder) * 0.5);
-+ if(!fTools::equal(fHalfBorder, 0.0))
-+ o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder);
-+
-+ o_rGradientInfo.maTextureTransform.translate(0.5, 0.5);
- o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
-
- if( !bCircular )
-@@ -155,9 +164,8 @@ namespace basegfx
- // add texture rotate after scale to keep perpendicular angles
- if(0.0 != fAngle)
- {
-- B2DPoint aCenter(0.5, 0.5);
-- aCenter *= o_rGradientInfo.maTextureTransform;
--
-+ const B2DPoint aCenter(0.5*fTargetSizeX,
-+ 0.5*fTargetSizeY);
- o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY());
- o_rGradientInfo.maTextureTransform.rotate(fAngle);
- o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY());
-@@ -178,17 +186,9 @@ namespace basegfx
- // prepare aspect for texture
- o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0;
-
-- // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
-+ // build transform from u,v to [0.0 .. 1.0].
- o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
- o_rGradientInfo.maBackTextureTransform.invert();
-- o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5);
-- const double fHalfBorder((1.0 - fBorder) * 0.5);
--
-- if(!fTools::equal(fHalfBorder, 0.0))
-- {
-- const double fFactor(1.0 / fHalfBorder);
-- o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor);
-- }
- }
-
- /** Setup for rect & square gradient is exactly the same. Factored out
-@@ -205,6 +205,8 @@ namespace basegfx
- o_rGradientInfo.maBackTextureTransform.identity();
- o_rGradientInfo.mnSteps = nSteps;
-
-+ fAngle = -fAngle;
-+
- double fTargetSizeX(rTargetRange.getWidth());
- double fTargetSizeY(rTargetRange.getHeight());
- double fTargetOffsetX(rTargetRange.getMinX());
-@@ -223,15 +225,18 @@ namespace basegfx
- fTargetSizeY = fNewY;
- }
-
-- // add object scale before rotate
-+ const double fHalfBorder((1.0 - fBorder) * 0.5);
-+ if(!fTools::equal(fHalfBorder, 0.0))
-+ o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder);
-+
-+ o_rGradientInfo.maTextureTransform.translate(0.5, 0.5);
- o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY);
-
- // add texture rotate after scale to keep perpendicular angles
- if(0.0 != fAngle)
- {
-- B2DPoint aCenter(0.5, 0.5);
-- aCenter *= o_rGradientInfo.maTextureTransform;
--
-+ const B2DPoint aCenter(0.5*fTargetSizeX,
-+ 0.5*fTargetSizeY);
- o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY());
- o_rGradientInfo.maTextureTransform.rotate(fAngle);
- o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY());
-@@ -254,14 +259,6 @@ namespace basegfx
- // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform
- o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform;
- o_rGradientInfo.maBackTextureTransform.invert();
-- o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5);
-- const double fHalfBorder((1.0 - fBorder) * 0.5);
--
-- if(!fTools::equal(fHalfBorder, 0.0))
-- {
-- const double fFactor(1.0 / fHalfBorder);
-- o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor);
-- }
- }
-
- namespace tools
-diff --git basegfx/source/tools/keystoplerp.cxx basegfx/source/tools/keystoplerp.cxx
-new file mode 100644
-index 0000000..c7a58c2
---- /dev/null
-+++ basegfx/source/tools/keystoplerp.cxx
-@@ -0,0 +1,104 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: canvastools.hxx,v $
-+ * $Revision: 1.10 $
-+ *
-+ * 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 "basegfx/tools/keystoplerp.hxx"
-+#include <com/sun/star/uno/Sequence.hxx>
-+
-+#include <algorithm>
-+
-+static void validateInput(const std::vector<double>& rKeyStops)
-+{
-+ (void)rKeyStops;
-+#ifdef DBG_UTIL
-+ OSL_ENSURE( rKeyStops.size() > 1,
-+ "KeyStopLerp::KeyStopLerp(): key stop vector must have two entries or more" );
-+
-+ // rKeyStops must be sorted in ascending order
-+ for( ::std::size_t i=1, len=rKeyStops.size(); i<len; ++i )
-+ {
-+ if( rKeyStops[i-1] > rKeyStops[i] )
-+ OSL_ENSURE( false,
-+ "KeyStopLerp::KeyStopLerp(): time vector is not sorted in ascending order!" );
-+ }
-+#endif
-+}
-+
-+namespace basegfx
-+{
-+ namespace tools
-+ {
-+ KeyStopLerp::KeyStopLerp( const std::vector<double>& rKeyStops ) :
-+ maKeyStops(rKeyStops),
-+ mnLastIndex(0)
-+ {
-+ validateInput(maKeyStops);
-+ }
-+
-+ KeyStopLerp::KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops ) :
-+ maKeyStops(rKeyStops.getLength()),
-+ mnLastIndex(0)
-+ {
-+ std::copy( rKeyStops.getConstArray(),
-+ rKeyStops.getConstArray()+rKeyStops.getLength(),
-+ maKeyStops.begin() );
-+ validateInput(maKeyStops);
-+ }
-+
-+ KeyStopLerp::ResultType KeyStopLerp::lerp(double fAlpha) const
-+ {
-+ // cached value still okay?
-+ if( maKeyStops.at(mnLastIndex) < fAlpha ||
-+ maKeyStops.at(mnLastIndex+1) >= fAlpha )
-+ {
-+ // nope, find new index
-+ mnLastIndex = std::min<std::ptrdiff_t>(
-+ maKeyStops.size()-2,
-+ // range is ensured by max below
-+ std::max<std::ptrdiff_t>(
-+ 0,
-+ std::distance( maKeyStops.begin(),
-+ std::lower_bound( maKeyStops.begin(),
-+ maKeyStops.end(),
-+ fAlpha )) - 1 ));
-+ }
-+
-+ // lerp between stop and stop+1
-+ const double fRawLerp=
-+ (fAlpha-maKeyStops.at(mnLastIndex)) /
-+ (maKeyStops.at(mnLastIndex+1) - maKeyStops.at(mnLastIndex));
-+
-+ // clamp to permissible range (input fAlpha might be
-+ // everything)
-+ return ResultType(
-+ mnLastIndex,
-+ clamp(fRawLerp,0.0,1.0));
-+ }
-+ }
-+}
-diff --git basegfx/source/tools/makefile.mk basegfx/source/tools/makefile.mk
-index df75a82..39e63b3 100755
---- basegfx/source/tools/makefile.mk
-+++ basegfx/source/tools/makefile.mk
-@@ -44,6 +44,7 @@ ENABLE_EXCEPTIONS=TRUE
- SLOFILES= $(SLO)$/canvastools.obj \
- $(SLO)$/gradienttools.obj \
- $(SLO)$/debugplotter.obj \
-+ $(SLO)$/keystoplerp.obj \
- $(SLO)$/liangbarsky.obj \
- $(SLO)$/tools.obj \
- $(SLO)$/unopolypolygon.obj
-diff --git basegfx/test/basegfxtools.cxx basegfx/test/basegfxtools.cxx
-new file mode 100644
-index 0000000..c8e8b88
---- /dev/null
-+++ basegfx/test/basegfxtools.cxx
-@@ -0,0 +1,119 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: basegfx2d.cxx,v $
-+ * $Revision: 1.14 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+// autogenerated file with codegen.pl
-+
-+#include <cppunit/simpleheader.hxx>
-+
-+#include <basegfx/tools/keystoplerp.hxx>
-+#include <basegfx/numeric/ftools.hxx>
-+
-+#include <boost/tuple/tuple.hpp>
-+
-+using namespace ::basegfx;
-+using namespace ::boost::tuples;
-+
-+namespace basegfxtools
-+{
-+
-+class KeyStopLerpTest : public CppUnit::TestFixture
-+{
-+ tools::KeyStopLerp maKeyStops;
-+
-+ static std::vector<double> getTestVector()
-+ {
-+ std::vector<double> aStops(3);
-+ aStops[0] = 0.1;
-+ aStops[1] = 0.5;
-+ aStops[2] = 0.9;
-+ return aStops;
-+ }
-+
-+public:
-+ KeyStopLerpTest() :
-+ maKeyStops(getTestVector())
-+ {}
-+
-+ void setUp()
-+ {}
-+
-+ void tearDown()
-+ {}
-+
-+ void test()
-+ {
-+ double fAlpha;
-+ std::ptrdiff_t nIndex;
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(-1.0);
-+ CPPUNIT_ASSERT_MESSAGE("-1.0", nIndex==0 && fAlpha==0.0);
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.1);
-+ CPPUNIT_ASSERT_MESSAGE("0.1", nIndex==0 && fAlpha==0.0);
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.3);
-+ CPPUNIT_ASSERT_MESSAGE("0.3", nIndex==0 && fTools::equal(fAlpha,0.5));
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.5);
-+ CPPUNIT_ASSERT_MESSAGE("0.5", nIndex==0 && fTools::equal(fAlpha,1.0));
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.51);
-+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,0.025));
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(0.9);
-+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,1.0));
-+
-+ tie(nIndex,fAlpha) = maKeyStops.lerp(1.0);
-+ CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fAlpha==1.0);
-+ }
-+
-+ // Change the following lines only, if you add, remove or rename
-+ // member functions of the current class,
-+ // because these macros are need by auto register mechanism.
-+
-+ CPPUNIT_TEST_SUITE(KeyStopLerpTest);
-+ CPPUNIT_TEST(test);
-+ CPPUNIT_TEST_SUITE_END();
-+};
-+
-+// -----------------------------------------------------------------------------
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfxtools::KeyStopLerpTest, "basegfxtools");
-+} // namespace basegfxtools
-+
-+
-+// -----------------------------------------------------------------------------
-+
-+// this macro creates an empty function, which will called by the RegisterAllFunctions()
-+// to let the user the possibility to also register some functions by hand.
-+// NOADDITIONAL;
-+
-diff --git basegfx/test/makefile.mk basegfx/test/makefile.mk
-index 710d194..252c887 100644
---- basegfx/test/makefile.mk
-+++ basegfx/test/makefile.mk
-@@ -46,6 +46,7 @@ SHL1OBJS= \
- $(SLO)$/basegfx1d.obj \
- $(SLO)$/basegfx2d.obj \
- $(SLO)$/basegfx3d.obj \
-+ $(SLO)$/basegfxtools.obj \
- $(SLO)$/testtools.obj
-
- # linking statically against basegfx parts
-diff --git canvas/inc/canvas/base/graphicdevicebase.hxx canvas/inc/canvas/base/graphicdevicebase.hxx
-index 52bd86c..2dd2967 100644
---- canvas/inc/canvas/base/graphicdevicebase.hxx
-+++ canvas/inc/canvas/base/graphicdevicebase.hxx
-@@ -33,11 +33,11 @@
-
- #include <rtl/ref.hxx>
- #include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/util/XUpdatable.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XColorSpace.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <canvas/parametricpolypolygon.hxx>
- #include <canvas/propertysethelper.hxx>
-@@ -50,8 +50,7 @@ namespace canvas
- /** Helper template base class for XGraphicDevice implementations.
-
- This base class provides partial implementations of the
-- XGraphicDevice-related interface, such as
-- XParametricPolyPolygon2DFactory and XColorSpace.
-+ XGraphicDevice-related interface, such as XColorSpace.
-
- This template basically interposes itself between the full
- interface you implement (i.e. not restricted to XGraphicDevice
-@@ -249,7 +248,7 @@ namespace canvas
- return maDeviceHelper.createVolatileAlphaBitmap( this, size );
- }
-
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2DFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return this;
- }
-@@ -268,79 +267,26 @@ namespace canvas
- return maDeviceHelper.enterFullScreenMode( bEnter );
- }
-
-- // XParametricPolyPolygon2DFactory
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-+ // XMultiServiceFactory
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
- {
-- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-- ParametricPolyPolygon::createLinearHorizontalGradient( this,
-- colors,
-- stops ) );
-+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-+ ParametricPolyPolygon::create(this,
-+ aServiceSpecifier,
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
- }
-
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
- {
-- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-- ParametricPolyPolygon::createAxialHorizontalGradient( this,
-- colors,
-- stops ) );
-+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-+ ParametricPolyPolygon::create(this,
-+ aServiceSpecifier,
-+ Arguments));
- }
-
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
- {
-- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-- ParametricPolyPolygon::createEllipticalGradient( this,
-- colors,
-- stops,
-- boundRect ) );
-- }
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-- {
-- return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
-- ParametricPolyPolygon::createRectangularGradient( this,
-- colors,
-- stops,
-- boundRect ) );
-- }
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createVerticalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftColor*/,
-- const ::com::sun::star::uno::Sequence< double >& /*rightColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-- {
-- // TODO(F1): hatch factory NYI
-- return ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
-- }
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createOrthogonalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftTopColor*/,
-- const ::com::sun::star::uno::Sequence< double >& /*rightBottomColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-- {
-- // TODO(F1): hatch factory NYI
-- return ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
-- }
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createThreeCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
-- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-- {
-- // TODO(F1): hatch factory NYI
-- return ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
-- }
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createFourCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/,
-- const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException,
-- ::com::sun::star::uno::RuntimeException)
-- {
-- // TODO(F1): hatch factory NYI
-- return ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XParametricPolyPolygon2D >();
-+ return ParametricPolyPolygon::getAvailableServiceNames();
- }
-
-
-diff --git canvas/inc/canvas/canvastools.hxx canvas/inc/canvas/canvastools.hxx
-index 3b1e827..0a1275c 100644
---- canvas/inc/canvas/canvastools.hxx
-+++ canvas/inc/canvas/canvastools.hxx
-@@ -417,28 +417,6 @@ namespace canvas
- */
- ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
-
-- /** This method clamps the given value to the specified range
--
-- @param val
-- The value to clamp
--
-- @param minVal
-- The minimal value val is allowed to attain
--
-- @param maxVal
-- The maximal value val is allowed to attain
--
-- @return the clamped value
-- */
-- template< typename T > T clamp( T val,
-- T minVal,
-- T maxVal )
-- {
-- return ::std::max( minVal,
-- ::std::min( maxVal,
-- val ) );
-- }
--
- /** Retrieve various internal properties of the actual canvas implementation.
-
- This method retrieves a bunch of internal, implementation-
-diff --git canvas/inc/canvas/parametricpolypolygon.hxx canvas/inc/canvas/parametricpolypolygon.hxx
-index e88028b..c9aa9bf 100644
---- canvas/inc/canvas/parametricpolypolygon.hxx
-+++ canvas/inc/canvas/parametricpolypolygon.hxx
-@@ -33,7 +33,7 @@
-
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
- #include <cppuhelper/compbase2.hxx>
- #include <comphelper/broadcasthelper.hxx>
- #include <basegfx/polygon/b2dpolygon.hxx>
-@@ -62,7 +62,6 @@ namespace canvas
- enum GradientType
- {
- GRADIENT_LINEAR,
-- GRADIENT_AXIAL,
- GRADIENT_ELLIPTICAL,
- GRADIENT_RECTANGULAR
- };
-@@ -103,24 +102,11 @@ namespace canvas
- const GradientType meType;
- };
-
-- static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-- const ::com::sun::star::uno::Sequence< double >& stops );
-- static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-- const ::com::sun::star::uno::Sequence< double >& stops );
-- static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-- const ::com::sun::star::uno::Sequence< double >& stops,
-- const ::com::sun::star::geometry::RealRectangle2D& boundRect );
-- static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
-- ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-- const ::com::sun::star::uno::Sequence< double >& stops,
-- const ::com::sun::star::geometry::RealRectangle2D& boundRect );
-+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getAvailableServiceNames();
-+ static ParametricPolyPolygon* create(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::rtl::OUString& rServiceName,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs );
-
- /// Dispose all internal references
- virtual void SAL_CALL disposing();
-@@ -143,6 +129,20 @@ namespace canvas
- ~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves.
-
- private:
-+ static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-+ const ::com::sun::star::uno::Sequence< double >& stops );
-+ static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-+ const ::com::sun::star::uno::Sequence< double >& stops,
-+ double fAspect );
-+ static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
-+ const ::com::sun::star::uno::Sequence< double >& stops,
-+ double fAspect );
-
- /// Private, because objects can only be created from the static factories
- ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
-diff --git canvas/source/cairo/cairo_canvas.hxx canvas/source/cairo/cairo_canvas.hxx
-index 62185d4..7528e2f 100644
---- canvas/source/cairo/cairo_canvas.hxx
-+++ canvas/source/cairo/cairo_canvas.hxx
-@@ -44,7 +44,6 @@
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XBufferController.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <cppuhelper/compbase7.hxx>
- #include <comphelper/uno3.hxx>
-@@ -68,7 +67,7 @@ namespace cairocanvas
- typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
-- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
-+ ::com::sun::star::lang::XMultiServiceFactory,
- ::com::sun::star::util::XUpdatable,
- ::com::sun::star::beans::XPropertySet,
- ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
-diff --git canvas/source/cairo/cairo_canvashelper.cxx canvas/source/cairo/cairo_canvashelper.cxx
-index 5ca2a96..d24febb 100644
---- canvas/source/cairo/cairo_canvashelper.cxx
-+++ canvas/source/cairo/cairo_canvashelper.cxx
-@@ -56,6 +56,8 @@
- #include <basegfx/polygon/b2dpolypolygon.hxx>
- #include <basegfx/polygon/b2dpolygontools.hxx>
- #include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/tools/keystoplerp.hxx>
-+#include <basegfx/tools/lerp.hxx>
-
- #include <comphelper/sequence.hxx>
- #include <cppuhelper/compbase1.hxx>
-@@ -73,6 +75,7 @@
- #include "cairo_canvashelper.hxx"
- #include "cairo_canvasbitmap.hxx"
-
-+#include <boost/tuple/tuple.hpp>
- #include <algorithm>
-
- using namespace ::cairo;
-@@ -122,9 +125,29 @@ namespace cairocanvas
- mpCairo = pSurface->getCairo();
- }
-
-+ static void setColor( Cairo* pCairo,
-+ const uno::Sequence<double>& rColor )
-+ {
-+ if( rColor.getLength() > 3 )
-+ {
-+ const double alpha = rColor[3];
-+
-+ cairo_set_source_rgba( pCairo,
-+ alpha*rColor[0],
-+ alpha*rColor[1],
-+ alpha*rColor[2],
-+ alpha );
-+ }
-+ else if( rColor.getLength() == 3 )
-+ cairo_set_source_rgb( pCairo,
-+ rColor[0],
-+ rColor[1],
-+ rColor[2] );
-+ }
-+
- void CanvasHelper::useStates( const rendering::ViewState& viewState,
- const rendering::RenderState& renderState,
-- bool setColor )
-+ bool bSetColor )
- {
- Matrix aViewMatrix;
- Matrix aRenderMatrix;
-@@ -158,19 +181,8 @@ namespace cairocanvas
- OSL_TRACE ("render clip END");
- }
-
-- if( setColor ) {
-- if( renderState.DeviceColor.getLength() > 3 )
-- cairo_set_source_rgba( mpCairo.get(),
-- renderState.DeviceColor [0],
-- renderState.DeviceColor [1],
-- renderState.DeviceColor [2],
-- renderState.DeviceColor [3] );
-- else if (renderState.DeviceColor.getLength() == 3)
-- cairo_set_source_rgb( mpCairo.get(),
-- renderState.DeviceColor [0],
-- renderState.DeviceColor [1],
-- renderState.DeviceColor [2] );
-- }
-+ if( bSetColor )
-+ setColor(mpCairo.get(),renderState.DeviceColor);
-
- cairo_operator_t compositingMode( CAIRO_OPERATOR_OVER );
- switch( renderState.CompositeOperation )
-@@ -665,11 +677,33 @@ namespace cairocanvas
- double alpha = rColor[3];
- // cairo expects premultiplied alpha
- cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0]*alpha, rColor[1]*alpha, rColor[2]*alpha, alpha );
-- //cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0], rColor[1], rColor[2], alpha );
- }
- }
- }
-
-+ static uno::Sequence<double> lerp(const uno::Sequence<double>& rLeft, const uno::Sequence<double>& rRight, double fAlpha)
-+ {
-+ if( rLeft.getLength() == 3 )
-+ {
-+ uno::Sequence<double> aRes(3);
-+ aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha);
-+ aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha);
-+ aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha);
-+ return aRes;
-+ }
-+ else if( rLeft.getLength() == 4 )
-+ {
-+ uno::Sequence<double> aRes(4);
-+ aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha);
-+ aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha);
-+ aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha);
-+ aRes[3] = basegfx::tools::lerp(rLeft[3],rRight[3],fAlpha);
-+ return aRes;
-+ }
-+
-+ return uno::Sequence<double>();
-+ }
-+
- static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon )
- {
- Pattern* pPattern = NULL;
-@@ -678,7 +712,6 @@ namespace cairocanvas
-
- // undef macros from vclenum.hxx which conflicts with GradientType enum values
- #undef GRADIENT_LINEAR
--#undef GRADIENT_AXIAL
- #undef GRADIENT_ELLIPTICAL
-
- switch( aValues.meType ) {
-@@ -691,26 +724,17 @@ namespace cairocanvas
- addColorStops( pPattern, aValues.maColors, aValues.maStops );
- break;
-
-- // FIXME: NYI
-- case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
-- case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
-- x0 = 0;
-- y0 = 0;
-- x1 = 1;
-- y1 = 0;
-- pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
-- addColorStops( pPattern, aValues.maColors, aValues.maStops );
-- break;
--
- case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
-- cx = 0.5;
-- cy = 0.5;
-+ cx = 0;
-+ cy = 0;
- r0 = 0;
-- r1 = 0.5;
-+ r1 = 1;
-
-- pPattern = cairo_pattern_create_radial( cx, cy, r0, cx, cy, r1 );
-+ pPattern = cairo_pattern_create_radial( cx, cy, r0, cy, cy, r1 );
- addColorStops( pPattern, aValues.maColors, aValues.maStops, true );
- break;
-+ default:
-+ break;
- }
-
- return pPattern;
-@@ -719,7 +743,8 @@ namespace cairocanvas
- static void doOperation( Operation aOperation,
- Cairo* pCairo,
- const uno::Sequence< rendering::Texture >* pTextures,
-- const SurfaceProviderRef& pDevice )
-+ const SurfaceProviderRef& pDevice,
-+ const basegfx::B2DRange& rBounds )
- {
- switch( aOperation ) {
- case Fill:
-@@ -790,21 +815,72 @@ namespace cairocanvas
- cairo_matrix_init( &aTextureMatrix,
- aTransform.m00, aTransform.m10, aTransform.m01,
- aTransform.m11, aTransform.m02, aTransform.m12);
-- Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
-+ if( pPolyImpl->getValues().meType == canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR )
-+ {
-+ // no general path gradient yet in cairo; emulate then
-+ cairo_save( pCairo );
-+ cairo_clip( pCairo );
-+
-+ // fill bound rect with start color
-+ cairo_rectangle( pCairo, rBounds.getMinX(), rBounds.getMinY(),
-+ rBounds.getWidth(), rBounds.getHeight() );
-+ setColor(pCairo,pPolyImpl->getValues().maColors[0]);
-+ cairo_fill(pCairo);
-+
-+ cairo_transform( pCairo, &aTextureMatrix );
-+
-+ // longest line in gradient bound rect
-+ const unsigned int nGradientSize(
-+ static_cast<unsigned int>(
-+ ::basegfx::B2DVector(rBounds.getMinimum() - rBounds.getMaximum()).getLength() + 1.0 ) );
-+
-+ // typical number for pixel of the same color (strip size)
-+ const unsigned int nStripSize( nGradientSize < 50 ? 2 : 4 );
-+
-+ // use at least three steps, and at utmost the number of color
-+ // steps
-+ const unsigned int nStepCount(
-+ ::std::max(
-+ 3U,
-+ ::std::min(
-+ nGradientSize / nStripSize,
-+ 128U )) + 1 );
-+
-+ const uno::Sequence<double>* pColors=&pPolyImpl->getValues().maColors[0];
-+ basegfx::tools::KeyStopLerp aLerper(pPolyImpl->getValues().maStops);
-+ for( unsigned int i=1; i<nStepCount; ++i )
-+ {
-+ const double fT( i/double(nStepCount) );
-
-- if( pPattern ) {
-- OSL_TRACE( "filling with pattern" );
-+ std::ptrdiff_t nIndex;
-+ double fAlpha;
-+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
-
-- cairo_save( pCairo );
-+ setColor(pCairo, lerp(pColors[nIndex], pColors[nIndex+1], fAlpha));
-+ cairo_rectangle( pCairo, -1+fT, -1+fT, 2-2*fT, 2-2*fT );
-+ cairo_fill(pCairo);
-+ }
-
-- cairo_transform( pCairo, &aTextureMatrix );
-- cairo_set_source( pCairo, pPattern );
-- cairo_fill( pCairo );
-- cairo_restore( pCairo );
-+ cairo_restore( pCairo );
-+ }
-+ else
-+ {
-+ Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
-
-- cairo_pattern_destroy( pPattern );
-- }
-+ if( pPattern ) {
-+ OSL_TRACE( "filling with pattern" );
-+
-+ cairo_save( pCairo );
-+
-+ cairo_transform( pCairo, &aTextureMatrix );
-+ cairo_set_source( pCairo, pPattern );
-+ cairo_fill( pCairo );
-+ cairo_restore( pCairo );
-+
-+ cairo_pattern_destroy( pPattern );
-+ }
- }
-+ }
- }
- } else
- cairo_fill( pCairo );
-@@ -935,7 +1011,7 @@ namespace cairocanvas
-
- if( aOperation == Fill && pTextures ) {
- cairo_set_matrix( pCairo, &aOrigMatrix );
-- doOperation( aOperation, pCairo, pTextures, pDevice );
-+ doOperation( aOperation, pCairo, pTextures, pDevice, aPolyPolygon.getB2DRange() );
- cairo_set_matrix( pCairo, &aIdentityMatrix );
- }
- } else {
-@@ -948,7 +1024,7 @@ namespace cairocanvas
- }
- }
- if( bOpToDo && ( aOperation != Fill || !pTextures ) )
-- doOperation( aOperation, pCairo, pTextures, pDevice );
-+ doOperation( aOperation, pCairo, pTextures, pDevice, aPolyPolygon.getB2DRange() );
-
- cairo_set_matrix( pCairo, &aOrigMatrix );
-
-@@ -1171,12 +1247,12 @@ namespace cairocanvas
- const rendering::ViewState& viewState,
- const rendering::RenderState& renderState,
- const geometry::IntegerSize2D& rSize,
-- bool /*bModulateColors*/,
-+ bool bModulateColors,
- bool bHasAlpha )
- {
- SurfaceSharedPtr pSurface=pInputSurface;
- uno::Reference< rendering::XCachedPrimitive > rv = uno::Reference< rendering::XCachedPrimitive >(NULL);
-- geometry::IntegerSize2D aBitmapSize = rSize;
-+ geometry::IntegerSize2D aBitmapSize = rSize;
-
- if( mpCairo ) {
- cairo_save( mpCairo.get() );
-@@ -1198,38 +1274,38 @@ namespace cairocanvas
- ::rtl::math::approxEqual( aMatrix.y0, 0 ) &&
- basegfx::fround( rSize.Width * aMatrix.xx ) > 8 &&
- basegfx::fround( rSize.Height* aMatrix.yy ) > 8 )
-- {
-- double dWidth, dHeight;
--
-- dWidth = basegfx::fround( rSize.Width * aMatrix.xx );
-- dHeight = basegfx::fround( rSize.Height* aMatrix.yy );
-- aBitmapSize.Width = static_cast<sal_Int32>( dWidth );
-- aBitmapSize.Height = static_cast<sal_Int32>( dHeight );
--
-- SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface(
-- ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ),
-- bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR );
-- CairoSharedPtr pCairo = pScaledSurface->getCairo();
--
-- cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE );
-- // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders
-- cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height );
-- cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 );
-- cairo_paint( pCairo.get() );
--
-- pSurface = pScaledSurface;
--
-- aMatrix.xx = aMatrix.yy = 1;
-- cairo_set_matrix( mpCairo.get(), &aMatrix );
--
-- rv = uno::Reference< rendering::XCachedPrimitive >(
-- new CachedBitmap( pSurface, viewState, renderState,
-- // cast away const, need to
-- // change refcount (as this is
-- // ~invisible to client code,
-- // still logically const)
-- const_cast< rendering::XCanvas* >(pCanvas)) );
-- }
-+ {
-+ double dWidth, dHeight;
-+
-+ dWidth = basegfx::fround( rSize.Width * aMatrix.xx );
-+ dHeight = basegfx::fround( rSize.Height* aMatrix.yy );
-+ aBitmapSize.Width = static_cast<sal_Int32>( dWidth );
-+ aBitmapSize.Height = static_cast<sal_Int32>( dHeight );
-+
-+ SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface(
-+ ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ),
-+ bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR );
-+ CairoSharedPtr pCairo = pScaledSurface->getCairo();
-+
-+ cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE );
-+ // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders
-+ cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height );
-+ cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 );
-+ cairo_paint( pCairo.get() );
-+
-+ pSurface = pScaledSurface;
-+
-+ aMatrix.xx = aMatrix.yy = 1;
-+ cairo_set_matrix( mpCairo.get(), &aMatrix );
-+
-+ rv = uno::Reference< rendering::XCachedPrimitive >(
-+ new CachedBitmap( pSurface, viewState, renderState,
-+ // cast away const, need to
-+ // change refcount (as this is
-+ // ~invisible to client code,
-+ // still logically const)
-+ const_cast< rendering::XCanvas* >(pCanvas)) );
-+ }
-
- if( !bHasAlpha && mbHaveAlpha )
- {
-@@ -1270,7 +1346,11 @@ namespace cairocanvas
- cairo_set_operator( mpCairo.get(), CAIRO_OPERATOR_SOURCE );
- cairo_rectangle( mpCairo.get(), 0, 0, aBitmapSize.Width, aBitmapSize.Height );
- cairo_clip( mpCairo.get() );
-- cairo_paint( mpCairo.get() );
-+
-+ if( bModulateColors )
-+ cairo_paint_with_alpha( mpCairo.get(), renderState.DeviceColor[3] );
-+ else
-+ cairo_paint( mpCairo.get() );
- cairo_restore( mpCairo.get() );
- } else
- OSL_TRACE ("CanvasHelper called after it was disposed");
-@@ -1309,15 +1389,35 @@ namespace cairocanvas
- return rv;
- }
-
-- uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* ,
-- const uno::Reference< rendering::XBitmap >& /*xBitmap*/,
-- const rendering::ViewState& /*viewState*/,
-- const rendering::RenderState& /*renderState*/ )
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas,
-+ const uno::Reference< rendering::XBitmap >& xBitmap,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
- {
-- // TODO(F3): Implement modulated bitmap!
-+#ifdef CAIRO_CANVAS_PERF_TRACE
-+ struct timespec aTimer;
-+ mxDevice->startPerfTrace( &aTimer );
-+#endif
-
-- // TODO(P1): Provide caching here.
-- return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ uno::Reference< rendering::XCachedPrimitive > rv;
-+ unsigned char* data = NULL;
-+ bool bHasAlpha = false;
-+ SurfaceSharedPtr pSurface = surfaceFromXBitmap( xBitmap, mpSurfaceProvider, data, bHasAlpha );
-+ geometry::IntegerSize2D aSize = xBitmap->getSize();
-+
-+ if( pSurface ) {
-+ rv = implDrawBitmapSurface( pCanvas, pSurface, viewState, renderState, aSize, true, bHasAlpha );
-+
-+ if( data )
-+ free( data );
-+ } else
-+ rv = uno::Reference< rendering::XCachedPrimitive >(NULL);
-+
-+#ifdef CAIRO_CANVAS_PERF_TRACE
-+ mxDevice->stopPerfTrace( &aTimer, "drawBitmap" );
-+#endif
-+
-+ return rv;
- }
-
- uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice()
-diff --git canvas/source/cairo/cairo_spritecanvas.hxx canvas/source/cairo/cairo_spritecanvas.hxx
-index 86cbf00..f308277 100644
---- canvas/source/cairo/cairo_spritecanvas.hxx
-+++ canvas/source/cairo/cairo_spritecanvas.hxx
-@@ -42,7 +42,6 @@
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XBufferController.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <cppuhelper/compbase9.hxx>
- #include <comphelper/uno3.hxx>
-@@ -66,7 +65,7 @@ namespace cairocanvas
- typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
-- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
-+ ::com::sun::star::lang::XMultiServiceFactory,
- ::com::sun::star::rendering::XBufferController,
- ::com::sun::star::awt::XWindowListener,
- ::com::sun::star::util::XUpdatable,
-diff --git canvas/source/null/null_spritecanvas.hxx canvas/source/null/null_spritecanvas.hxx
-index c65add5..f304b6b 100644
---- canvas/source/null/null_spritecanvas.hxx
-+++ canvas/source/null/null_spritecanvas.hxx
-@@ -41,7 +41,7 @@
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XBufferController.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
- #include <cppuhelper/compbase8.hxx>
- #include <comphelper/uno3.hxx>
-@@ -60,7 +60,7 @@ namespace nullcanvas
- typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
-- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
-+ ::com::sun::star::lang::XMultiServiceFactory,
- ::com::sun::star::rendering::XBufferController,
- ::com::sun::star::awt::XWindowListener,
- ::com::sun::star::beans::XPropertySet,
-diff --git canvas/source/tools/parametricpolypolygon.cxx canvas/source/tools/parametricpolypolygon.cxx
-index 134fe2d..4925cb7 100644
---- canvas/source/tools/parametricpolypolygon.cxx
-+++ canvas/source/tools/parametricpolypolygon.cxx
-@@ -53,68 +53,126 @@ using namespace ::com::sun::star;
-
- namespace canvas
- {
-- ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient(
-- const uno::Reference< rendering::XGraphicDevice >& rDevice,
-- const uno::Sequence< uno::Sequence< double > >& colors,
-- const uno::Sequence< double >& stops )
-+ uno::Sequence<rtl::OUString> ParametricPolyPolygon::getAvailableServiceNames()
- {
-- // TODO(P2): hold gradient brush statically, and only setup
-- // the colors
-- return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
-+ uno::Sequence<rtl::OUString> aRet(3);
-+ aRet[0] = rtl::OUString::createFromAscii("LinearGradient");
-+ aRet[1] = rtl::OUString::createFromAscii("EllipticalGradient");
-+ aRet[2] = rtl::OUString::createFromAscii("RectangularGradient");
-+
-+ return aRet;
-+ }
-+
-+ ParametricPolyPolygon* ParametricPolyPolygon::create(
-+ const uno::Reference< rendering::XGraphicDevice >& rDevice,
-+ const ::rtl::OUString& rServiceName,
-+ const uno::Sequence< uno::Any >& rArgs )
-+ {
-+ uno::Sequence< uno::Sequence< double > > colorSequence(2);
-+ uno::Sequence< double > colorStops(2);
-+ double fAspectRatio=1.0;
-+
-+ // defaults
-+ uno::Sequence< rendering::RGBColor > rgbColors(1);
-+ rgbColors[0] = rendering::RGBColor(0,0,0);
-+ colorSequence[0] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
-+ rgbColors[0] = rendering::RGBColor(1,1,1);
-+ colorSequence[1] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors);
-+ colorStops[0] = 0;
-+ colorStops[1] = 1;
-+
-+ // extract args
-+ for( sal_Int32 i=0; i<rArgs.getLength(); ++i )
-+ {
-+ beans::PropertyValue aProp;
-+ if( (rArgs[i] >>= aProp) )
-+ {
-+ if( aProp.Name.equalsAscii("Colors") )
-+ {
-+ aProp.Value >>= colorSequence;
-+ }
-+ else if( aProp.Name.equalsAscii("Stops") )
-+ {
-+ aProp.Value >>= colorStops;
-+ }
-+ else if( aProp.Name.equalsAscii("AspectRatio") )
-+ {
-+ aProp.Value >>= fAspectRatio;
-+ }
-+ }
-+ }
-+
-+ if( rServiceName.equalsAscii("LinearGradient") )
-+ {
-+ return createLinearHorizontalGradient(rDevice, colorSequence, colorStops);
-+ }
-+ else if( rServiceName.equalsAscii("EllipticalGradient") )
-+ {
-+ return createEllipticalGradient(rDevice, colorSequence, colorStops, fAspectRatio);
-+ }
-+ else if( rServiceName.equalsAscii("RectangularGradient") )
-+ {
-+ return createRectangularGradient(rDevice, colorSequence, colorStops, fAspectRatio);
-+ }
-+ else if( rServiceName.equalsAscii("VerticalLineHatch") )
-+ {
-+ // TODO: NYI
-+ }
-+ else if( rServiceName.equalsAscii("OrthogonalLinesHatch") )
-+ {
-+ // TODO: NYI
-+ }
-+ else if( rServiceName.equalsAscii("ThreeCrossingLinesHatch") )
-+ {
-+ // TODO: NYI
-+ }
-+ else if( rServiceName.equalsAscii("FourCrossingLinesHatch") )
-+ {
-+ // TODO: NYI
-+ }
-+
-+ return NULL;
- }
-
-- ParametricPolyPolygon* ParametricPolyPolygon::createAxialHorizontalGradient(
-+ ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient(
- const uno::Reference< rendering::XGraphicDevice >& rDevice,
- const uno::Sequence< uno::Sequence< double > >& colors,
- const uno::Sequence< double >& stops )
- {
- // TODO(P2): hold gradient brush statically, and only setup
- // the colors
-- return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, colors, stops );
-- }
--
-- namespace
-- {
-- double calcAspectRatio( const geometry::RealRectangle2D& rBoundRect )
-- {
-- const double nWidth( rBoundRect.X2 - rBoundRect.X1 );
-- const double nHeight( rBoundRect.Y2 - rBoundRect.Y1 );
--
-- return ::basegfx::fTools::equalZero( nHeight ) ? 1.0 : fabs( nWidth / nHeight );
-- }
-+ return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
- }
-
- ParametricPolyPolygon* ParametricPolyPolygon::createEllipticalGradient(
- const uno::Reference< rendering::XGraphicDevice >& rDevice,
- const uno::Sequence< uno::Sequence< double > >& colors,
- const uno::Sequence< double >& stops,
-- const geometry::RealRectangle2D& boundRect )
-+ double fAspectRatio )
- {
- // TODO(P2): hold gradient polygon statically, and only setup
- // the colors
- return new ParametricPolyPolygon(
- rDevice,
- ::basegfx::tools::createPolygonFromCircle(
-- ::basegfx::B2DPoint( 0.5, 0.5), 0.5 ),
-+ ::basegfx::B2DPoint(0,0), 1 ),
- GRADIENT_ELLIPTICAL,
-- colors, stops,
-- calcAspectRatio( boundRect ) );
-+ colors, stops, fAspectRatio );
- }
-
- ParametricPolyPolygon* ParametricPolyPolygon::createRectangularGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice,
- const uno::Sequence< uno::Sequence< double > >& colors,
- const uno::Sequence< double >& stops,
-- const geometry::RealRectangle2D& boundRect )
-+ double fAspectRatio )
- {
- // TODO(P2): hold gradient polygon statically, and only setup
- // the colors
- return new ParametricPolyPolygon(
- rDevice,
- ::basegfx::tools::createPolygonFromRect(
-- ::basegfx::B2DRectangle( 0.0, 0.0, 1.0, 1.0 ) ),
-+ ::basegfx::B2DRectangle( -1, -1, 1, 1 ) ),
- GRADIENT_RECTANGULAR,
-- colors, stops,
-- calcAspectRatio( boundRect ) );
-+ colors, stops, fAspectRatio );
- }
-
- void SAL_CALL ParametricPolyPolygon::disposing()
-diff --git canvas/source/vcl/canvas.hxx canvas/source/vcl/canvas.hxx
-index dcee24e..e80d2fb 100644
---- canvas/source/vcl/canvas.hxx
-+++ canvas/source/vcl/canvas.hxx
-@@ -41,7 +41,6 @@
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XBufferController.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <cppuhelper/compbase7.hxx>
- #include <comphelper/uno3.hxx>
-@@ -63,7 +62,7 @@ namespace vclcanvas
- typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
-- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
-+ ::com::sun::star::lang::XMultiServiceFactory,
- ::com::sun::star::util::XUpdatable,
- ::com::sun::star::beans::XPropertySet,
- ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
-diff --git canvas/source/vcl/canvashelper_texturefill.cxx canvas/source/vcl/canvashelper_texturefill.cxx
-index 7c4ad96..be4425d 100644
---- canvas/source/vcl/canvashelper_texturefill.cxx
-+++ canvas/source/vcl/canvashelper_texturefill.cxx
-@@ -57,6 +57,8 @@
- #include <basegfx/polygon/b2dpolypolygontools.hxx>
- #include <basegfx/polygon/b2dlinegeometry.hxx>
- #include <basegfx/tools/tools.hxx>
-+#include <basegfx/tools/lerp.hxx>
-+#include <basegfx/tools/keystoplerp.hxx>
- #include <basegfx/tools/canvastools.hxx>
- #include <basegfx/numeric/ftools.hxx>
-
-@@ -65,6 +67,9 @@
- #include <canvas/canvastools.hxx>
- #include <canvas/parametricpolypolygon.hxx>
-
-+#include <boost/bind.hpp>
-+#include <boost/tuple/tuple.hpp>
-+
- #include "spritecanvas.hxx"
- #include "canvashelper.hxx"
- #include "impltools.hxx"
-@@ -118,17 +123,13 @@ namespace vclcanvas
- Since most of the code for linear and axial gradients are
- the same, we've a unified method here
- */
-- void fillGeneralLinearGradient( OutputDevice& rOutDev,
-- const ::basegfx::B2DHomMatrix& rTextureTransform,
-- const ::Rectangle& rBounds,
-- int nStepCount,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
-- bool bFillNonOverlapping,
-- bool bAxialGradient )
-+ void fillLinearGradient( OutputDevice& rOutDev,
-+ const ::basegfx::B2DHomMatrix& rTextureTransform,
-+ const ::Rectangle& rBounds,
-+ unsigned int nStepCount,
-+ const ::canvas::ParametricPolyPolygon::Values& rValues,
-+ const std::vector< ::Color >& rColors )
- {
-- (void)bFillNonOverlapping;
--
- // determine general position of gradient in relation to
- // the bound rect
- // =====================================================
-@@ -207,36 +208,26 @@ namespace vclcanvas
- // iteratively render all other strips
- // -----------------------------------
-
-- // ensure that nStepCount is odd, to have a well-defined
-- // middle index for axial gradients.
-- if( bAxialGradient && !(nStepCount % 2) )
-+ // ensure that nStepCount matches color stop parity, to
-+ // have a well-defined middle color e.g. for axial
-+ // gradients.
-+ if( (rColors.size() % 2) != (nStepCount % 2) )
- ++nStepCount;
-
-- const int nStepCountHalved( nStepCount / 2 );
-+ basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
-
- // only iterate nStepCount-1 steps, as the last strip is
- // explicitely painted below
-- for( int i=0; i<nStepCount-1; ++i )
-+ for( unsigned int i=0; i<nStepCount-1; ++i )
- {
-- // lerp color
-- if( bAxialGradient )
-- {
-- // axial gradient has a triangle-like interpolation function
-- const int iPrime( i<=nStepCountHalved ? i : nStepCount-i-1);
-+ std::ptrdiff_t nIndex;
-+ double fAlpha;
-+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(double(i)/nStepCount);
-
-- rOutDev.SetFillColor(
-- Color( (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetRed() + iPrime*rColor2.GetRed())/nStepCountHalved),
-- (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetGreen() + iPrime*rColor2.GetGreen())/nStepCountHalved),
-- (UINT8)(((nStepCountHalved - iPrime)*rColor1.GetBlue() + iPrime*rColor2.GetBlue())/nStepCountHalved) ) );
-- }
-- else
-- {
-- // linear gradient has a plain lerp between start and end color
-- rOutDev.SetFillColor(
-- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
-- }
-+ rOutDev.SetFillColor(
-+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
-
- // copy right egde of polygon to left edge (and also
- // copy the closing point)
-@@ -283,59 +274,18 @@ namespace vclcanvas
- aTempPoly[3] = ::Point( ::basegfx::fround( rPoint4.getX() ),
- ::basegfx::fround( rPoint4.getY() ) );
-
-- if( bAxialGradient )
-- rOutDev.SetFillColor( rColor1 );
-- else
-- rOutDev.SetFillColor( rColor2 );
-+ rOutDev.SetFillColor( rColors.back() );
-
- rOutDev.DrawPolygon( aTempPoly );
- }
-
--
-- inline void fillLinearGradient( OutputDevice& rOutDev,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
-- const ::basegfx::B2DHomMatrix& rTextureTransform,
-- const ::Rectangle& rBounds,
-- int nStepCount,
-- bool bFillNonOverlapping )
-- {
-- fillGeneralLinearGradient( rOutDev,
-- rTextureTransform,
-- rBounds,
-- nStepCount,
-- rColor1,
-- rColor2,
-- bFillNonOverlapping,
-- false );
-- }
--
-- inline void fillAxialGradient( OutputDevice& rOutDev,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
-- const ::basegfx::B2DHomMatrix& rTextureTransform,
-- const ::Rectangle& rBounds,
-- int nStepCount,
-- bool bFillNonOverlapping )
-- {
-- fillGeneralLinearGradient( rOutDev,
-- rTextureTransform,
-- rBounds,
-- nStepCount,
-- rColor1,
-- rColor2,
-- bFillNonOverlapping,
-- true );
-- }
--
- void fillPolygonalGradient( OutputDevice& rOutDev,
-- const ::canvas::ParametricPolyPolygon::Values& rValues,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
- const ::basegfx::B2DHomMatrix& rTextureTransform,
- const ::Rectangle& rBounds,
-- int nStepCount,
-- bool bFillNonOverlapping )
-+ unsigned int nStepCount,
-+ bool bFillNonOverlapping,
-+ const ::canvas::ParametricPolyPolygon::Values& rValues,
-+ const std::vector< ::Color >& rColors )
- {
- const ::basegfx::B2DPolygon& rGradientPoly( rValues.maGradientPoly );
-
-@@ -369,9 +319,6 @@ namespace vclcanvas
- // apply scaling (possibly anisotrophic) to inner polygon
- // ------------------------------------------------------
-
-- // move center of scaling to origin
-- aInnerPolygonTransformMatrix.translate( -0.5, -0.5 );
--
- // scale inner polygon according to aspect ratio: for
- // wider-than-tall bounds (nAspectRatio > 1.0), the inner
- // polygon, representing the gradient focus, must have
-@@ -396,9 +343,6 @@ namespace vclcanvas
- aInnerPolygonTransformMatrix.scale( 0.0, 0.0 );
- }
-
-- // move origin back to former center of polygon
-- aInnerPolygonTransformMatrix.translate( 0.5, 0.5 );
--
- // and finally, add texture transform to it.
- aInnerPolygonTransformMatrix *= rTextureTransform;
-
-@@ -406,8 +350,8 @@ namespace vclcanvas
- aInnerPoly.transform( aInnerPolygonTransformMatrix );
-
-
-- const sal_Int32 nNumPoints( aOuterPoly.count() );
-- ::Polygon aTempPoly( static_cast<USHORT>(nNumPoints+1) );
-+ const sal_uInt32 nNumPoints( aOuterPoly.count() );
-+ ::Polygon aTempPoly( static_cast<USHORT>(nNumPoints+1) );
-
- // increase number of steps by one: polygonal gradients have
- // the outermost polygon rendered in rColor2, and the
-@@ -425,37 +369,42 @@ namespace vclcanvas
- // color).
- ++nStepCount;
-
-+ basegfx::tools::KeyStopLerp aLerper(rValues.maStops);
-+
- if( !bFillNonOverlapping )
- {
- // fill background
-- rOutDev.SetFillColor( rColor1 );
-+ rOutDev.SetFillColor( rColors.front() );
- rOutDev.DrawRect( rBounds );
-
- // render polygon
- // ==============
-
-- for( int i=1,p; i<nStepCount; ++i )
-+ for( unsigned int i=1,p; i<nStepCount; ++i )
- {
-+ const double fT( i/double(nStepCount) );
-+
-+ std::ptrdiff_t nIndex;
-+ double fAlpha;
-+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
-+
- // lerp color
- rOutDev.SetFillColor(
-- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
-+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
-
- // scale and render polygon, by interpolating between
- // outer and inner polygon.
-
-- // calc interpolation parameter in [0,1] range
-- const double nT( (nStepCount-i)/double(nStepCount) );
--
- for( p=0; p<nNumPoints; ++p )
- {
- const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
- const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
-
- aTempPoly[(USHORT)p] = ::Point(
-- basegfx::fround( (1.0-nT)*rInnerPoint.getX() + nT*rOuterPoint.getX() ),
-- basegfx::fround( (1.0-nT)*rInnerPoint.getY() + nT*rOuterPoint.getY() ) );
-+ basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
-+ basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
- }
-
- // close polygon explicitely
-@@ -489,13 +438,19 @@ namespace vclcanvas
- aTempPolyPoly.Insert( aTempPoly );
- aTempPolyPoly.Insert( aTempPoly2 );
-
-- for( int i=0,p; i<nStepCount; ++i )
-+ for( unsigned int i=0,p; i<nStepCount; ++i )
- {
-+ const double fT( (i+1)/double(nStepCount) );
-+
-+ std::ptrdiff_t nIndex;
-+ double fAlpha;
-+ boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
-+
- // lerp color
- rOutDev.SetFillColor(
-- Color( (UINT8)(((nStepCount - i)*rColor1.GetRed() + i*rColor2.GetRed())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetGreen() + i*rColor2.GetGreen())/nStepCount),
-- (UINT8)(((nStepCount - i)*rColor1.GetBlue() + i*rColor2.GetBlue())/nStepCount) ) );
-+ Color( (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
-+ (UINT8)(basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
-
- #if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0
- if( i && !(i % 10) )
-@@ -506,17 +461,14 @@ namespace vclcanvas
- // calculate the inner polygon, which is actually the
- // start of the _next_ color strip. Thus, i+1
-
-- // calc interpolation parameter in [0,1] range
-- const double nT( (nStepCount-i-1)/double(nStepCount) );
--
- for( p=0; p<nNumPoints; ++p )
- {
- const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
- const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
-
- aTempPoly[(USHORT)p] = ::Point(
-- basegfx::fround( (1.0-nT)*rInnerPoint.getX() + nT*rOuterPoint.getX() ),
-- basegfx::fround( (1.0-nT)*rInnerPoint.getY() + nT*rOuterPoint.getY() ) );
-+ basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
-+ basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
- }
-
- // close polygon explicitely
-@@ -549,46 +501,33 @@ namespace vclcanvas
-
- void doGradientFill( OutputDevice& rOutDev,
- const ::canvas::ParametricPolyPolygon::Values& rValues,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
-+ const std::vector< ::Color >& rColors,
- const ::basegfx::B2DHomMatrix& rTextureTransform,
- const ::Rectangle& rBounds,
-- int nStepCount,
-+ unsigned int nStepCount,
- bool bFillNonOverlapping )
- {
- switch( rValues.meType )
- {
- case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
- fillLinearGradient( rOutDev,
-- rColor1,
-- rColor2,
- rTextureTransform,
- rBounds,
- nStepCount,
-- bFillNonOverlapping );
-+ rValues,
-+ rColors );
- break;
-
-- case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
-- fillAxialGradient( rOutDev,
-- rColor1,
-- rColor2,
-- rTextureTransform,
-- rBounds,
-- nStepCount,
-- bFillNonOverlapping );
-- break;
--
- case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
- // FALLTHROUGH intended
- case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
- fillPolygonalGradient( rOutDev,
-- rValues,
-- rColor1,
-- rColor2,
- rTextureTransform,
- rBounds,
- nStepCount,
-- bFillNonOverlapping );
-+ bFillNonOverlapping,
-+ rValues,
-+ rColors );
- break;
-
- default:
-@@ -597,11 +536,19 @@ namespace vclcanvas
- }
- }
-
-+ int numColorSteps( const ::Color& rColor1, const ::Color& rColor2 )
-+ {
-+ return ::std::max(
-+ labs( rColor1.GetRed() - rColor2.GetRed() ),
-+ ::std::max(
-+ labs( rColor1.GetGreen() - rColor2.GetGreen() ),
-+ labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) );
-+ }
-+
- bool gradientFill( OutputDevice& rOutDev,
- OutputDevice* p2ndOutDev,
- const ::canvas::ParametricPolyPolygon::Values& rValues,
-- const ::Color& rColor1,
-- const ::Color& rColor2,
-+ const std::vector< ::Color >& rColors,
- const PolyPolygon& rPoly,
- const rendering::ViewState& viewState,
- const rendering::RenderState& renderState,
-@@ -646,12 +593,9 @@ namespace vclcanvas
-
- // calc step size
- // --------------
-- const int nColorSteps(
-- ::std::max(
-- labs( rColor1.GetRed() - rColor2.GetRed() ),
-- ::std::max(
-- labs( rColor1.GetGreen() - rColor2.GetGreen() ),
-- labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ) );
-+ int nColorSteps = 0;
-+ for( size_t i=0; i<rColors.size()-1; ++i )
-+ nColorSteps += numColorSteps(rColors[i],rColors[i+1]);
-
- // longest line in gradient bound rect
- const int nGradientSize(
-@@ -690,8 +634,7 @@ namespace vclcanvas
- rOutDev.IntersectClipRegion( aPolygonDeviceRectOrig );
- doGradientFill( rOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -704,8 +647,7 @@ namespace vclcanvas
- p2ndOutDev->IntersectClipRegion( aPolygonDeviceRectOrig );
- doGradientFill( *p2ndOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -723,8 +665,7 @@ namespace vclcanvas
-
- doGradientFill( rOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -737,8 +678,7 @@ namespace vclcanvas
- p2ndOutDev->SetClipRegion( aPolyClipRegion );
- doGradientFill( *p2ndOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -753,8 +693,7 @@ namespace vclcanvas
- rOutDev.SetRasterOp( ROP_XOR );
- doGradientFill( rOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -765,8 +704,7 @@ namespace vclcanvas
- rOutDev.SetRasterOp( ROP_XOR );
- doGradientFill( rOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -779,8 +717,7 @@ namespace vclcanvas
- p2ndOutDev->SetRasterOp( ROP_XOR );
- doGradientFill( *p2ndOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -791,8 +728,7 @@ namespace vclcanvas
- p2ndOutDev->SetRasterOp( ROP_XOR );
- doGradientFill( *p2ndOutDev,
- rValues,
-- rColor1,
-- rColor2,
-+ rColors,
- aTextureTransform,
- aPolygonDeviceRectOrig,
- nStepCount,
-@@ -855,33 +791,41 @@ namespace vclcanvas
- ::canvas::ParametricPolyPolygon* pGradient =
- dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() );
-
-- if( pGradient )
-+ if( pGradient && pGradient->getValues().maColors.getLength() )
- {
- // copy state from Gradient polypoly locally
- // (given object might change!)
- const ::canvas::ParametricPolyPolygon::Values& rValues(
- pGradient->getValues() );
-
-- // TODO: use all the colors and place them on given positions/stops
-- const ::Color aColor1(
-- ::vcl::unotools::stdColorSpaceSequenceToColor(
-- rValues.maColors [0] ) );
-- const ::Color aColor2(
-- ::vcl::unotools::stdColorSpaceSequenceToColor(
-- rValues.maColors [rValues.maColors.getLength () - 1] ) );
--
-- // TODO(E1): Return value
-- // TODO(F1): FillRule
-- gradientFill( mpOutDev->getOutDev(),
-- mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL,
-- rValues,
-- aColor1,
-- aColor2,
-- aPolyPoly,
-- viewState,
-- renderState,
-- textures[0],
-- nTransparency );
-+ if( rValues.maColors.getLength() < 2 )
-+ {
-+ rendering::RenderState aTempState=renderState;
-+ aTempState.DeviceColor = rValues.maColors[0];
-+ fillPolyPolygon(pCanvas, xPolyPolygon, viewState, aTempState);
-+ }
-+ else
-+ {
-+ std::vector< ::Color > aColors(rValues.maColors.getLength());
-+ std::transform(&rValues.maColors[0],
-+ &rValues.maColors[0]+rValues.maColors.getLength(),
-+ aColors.begin(),
-+ boost::bind(
-+ &vcl::unotools::stdColorSpaceSequenceToColor,
-+ _1));
-+
-+ // TODO(E1): Return value
-+ // TODO(F1): FillRule
-+ gradientFill( mpOutDev->getOutDev(),
-+ mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL,
-+ rValues,
-+ aColors,
-+ aPolyPoly,
-+ viewState,
-+ renderState,
-+ textures[0],
-+ nTransparency );
-+ }
- }
- else
- {
-diff --git canvas/source/vcl/spritecanvas.hxx canvas/source/vcl/spritecanvas.hxx
-index 0c56d16..e9e9c8f 100644
---- canvas/source/vcl/spritecanvas.hxx
-+++ canvas/source/vcl/spritecanvas.hxx
-@@ -42,7 +42,6 @@
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/XBufferController.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <cppuhelper/compbase9.hxx>
- #include <comphelper/uno3.hxx>
-@@ -65,7 +64,7 @@ namespace vclcanvas
- typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
- ::com::sun::star::rendering::XIntegerBitmap,
- ::com::sun::star::rendering::XGraphicDevice,
-- ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
-+ ::com::sun::star::lang::XMultiServiceFactory,
- ::com::sun::star::rendering::XBufferController,
- ::com::sun::star::awt::XWindowListener,
- ::com::sun::star::util::XUpdatable,
-diff --git cppcanvas/source/mtfrenderer/emfplus.cxx cppcanvas/source/mtfrenderer/emfplus.cxx
-index a35dbef..6260df1 100644
---- cppcanvas/source/mtfrenderer/emfplus.cxx
-+++ cppcanvas/source/mtfrenderer/emfplus.cxx
-@@ -15,7 +15,6 @@
-
- #include <com/sun/star/rendering/XCanvas.hpp>
- #include <com/sun/star/rendering/TexturingMode.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
-
- #include <bitmapaction.hxx>
- #include <implrenderer.hxx>
-@@ -96,7 +95,7 @@ namespace cppcanvas
- public:
- EMFPPath (sal_Int32 _nPoints, bool bLines = false)
- {
-- if( _nPoints<0 || _nPoints>SAL_MAX_INT32/(2*sizeof(float)) )
-+ if( _nPoints<0L || _nPoints>SAL_MAX_INT32/(2*sal_Int32(sizeof(float))) )
- _nPoints = SAL_MAX_INT32/(2*sizeof(float));
- nPoints = _nPoints;
- pPoints = new float [nPoints*2];
-@@ -133,8 +132,6 @@ namespace cppcanvas
-
- if (pPointTypes)
- for (int i = 0; i < nPoints; i ++) {
-- UINT8 pathType;
--
- s >> pPointTypes [i];
- EMFP_DEBUG (printf ("EMF+\tpoint type: %x\n", pPointTypes [i]));
- }
-@@ -149,8 +146,6 @@ namespace cppcanvas
- ::basegfx::B2DPolyPolygon& GetPolygon (ImplRenderer& rR, bool bMapIt = true)
- {
- ::basegfx::B2DPolygon polygon;
-- sal_Int32 points = nPoints;
--
- aPolygon.clear ();
-
- int last_normal = 0, p = 0;
-@@ -240,7 +235,7 @@ namespace cppcanvas
- EMFP_DEBUG (printf ("EMF+\theader: 0x%08x parts: %d\n", header, parts));
-
- if (parts) {
-- if( parts<0 || parts>SAL_MAX_INT32/sizeof(sal_Int32) )
-+ if( parts<0 || parts>SAL_MAX_INT32/sal_Int32(sizeof(sal_Int32)) )
- parts = SAL_MAX_INT32/sizeof(sal_Int32);
-
- combineMode = new sal_Int32 [parts];
-@@ -354,7 +349,7 @@ namespace cppcanvas
- s >> surroundColorsNumber;
- EMFP_DEBUG (printf ("EMF+\tsurround colors: %d\n", surroundColorsNumber));
-
-- if( surroundColorsNumber<0 || surroundColorsNumber>SAL_MAX_INT32/sizeof(::Color) )
-+ if( surroundColorsNumber<0 || surroundColorsNumber>SAL_MAX_INT32/sal_Int32(sizeof(::Color)) )
- surroundColorsNumber = SAL_MAX_INT32/sizeof(::Color);
-
- surroundColors = new ::Color [surroundColorsNumber];
-@@ -406,7 +401,7 @@ namespace cppcanvas
- if (additionalFlags & 0x08) {
- s >> blendPoints;
- EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints));
-- if( blendPoints<0 || blendPoints>SAL_MAX_INT32/(2*sizeof(float)) )
-+ if( blendPoints<0 || blendPoints>SAL_MAX_INT32/sal_Int32(2*sizeof(float)) )
- blendPoints = SAL_MAX_INT32/(2*sizeof(float));
- blendPositions = new float [2*blendPoints];
- blendFactors = blendPositions + blendPoints;
-@@ -423,9 +418,9 @@ namespace cppcanvas
- if (additionalFlags & 0x04) {
- s >> colorblendPoints;
- EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints));
-- if( colorblendPoints<0 || colorblendPoints>SAL_MAX_INT32/sizeof(float) )
-+ if( colorblendPoints<0 || colorblendPoints>SAL_MAX_INT32/sal_Int32(sizeof(float)) )
- colorblendPoints = SAL_MAX_INT32/sizeof(float);
-- if( colorblendPoints>SAL_MAX_INT32/sizeof(::Color) )
-+ if( colorblendPoints>SAL_MAX_INT32/sal_Int32(sizeof(::Color)) )
- colorblendPoints = SAL_MAX_INT32/sizeof(::Color);
- colorblendPositions = new float [colorblendPoints];
- colorblendColors = new ::Color [colorblendPoints];
-@@ -439,9 +434,9 @@ namespace cppcanvas
- EMFP_DEBUG (printf ("EMF+\tcolor[%d]: 0x%08x\n", i, color));
- }
- }
-- } else
-+ } else {
- EMFP_DEBUG (dumpWords (s, 1024));
--
-+ }
- break;
- }
- // linear gradient
-@@ -481,7 +476,7 @@ namespace cppcanvas
- if (additionalFlags & 0x08) {
- s >> blendPoints;
- EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints));
-- if( blendPoints<0 || blendPoints>SAL_MAX_INT32/(2*sizeof(float)) )
-+ if( blendPoints<0 || blendPoints>SAL_MAX_INT32/sal_Int32(2*sizeof(float)) )
- blendPoints = SAL_MAX_INT32/(2*sizeof(float));
- blendPositions = new float [2*blendPoints];
- blendFactors = blendPositions + blendPoints;
-@@ -498,9 +493,9 @@ namespace cppcanvas
- if (additionalFlags & 0x04) {
- s >> colorblendPoints;
- EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints));
-- if( colorblendPoints<0 || colorblendPoints>SAL_MAX_INT32/sizeof(float) )
-+ if( colorblendPoints<0 || colorblendPoints>SAL_MAX_INT32/sal_Int32(sizeof(float)) )
- colorblendPoints = SAL_MAX_INT32/sizeof(float);
-- if( colorblendPoints>SAL_MAX_INT32/sizeof(::Color) )
-+ if( colorblendPoints>SAL_MAX_INT32/sal_Int32(sizeof(::Color)) )
- colorblendPoints = SAL_MAX_INT32/sizeof(::Color);
- colorblendPositions = new float [colorblendPoints];
- colorblendColors = new ::Color [colorblendPoints];
-@@ -554,7 +549,7 @@ namespace cppcanvas
- rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * rR.MapSize (width, 0)).getX ();
- }
-
-- void Read (SvStream& s, ImplRenderer& rR, sal_Int32 nHDPI, sal_Int32 nVDPI)
-+ void Read (SvStream& s, ImplRenderer& rR, sal_Int32 /*nHDPI*/, sal_Int32 /*nVDPI*/)
- {
- UINT32 header, unknown, penFlags, unknown2;
- int i;
-@@ -603,7 +598,7 @@ namespace cppcanvas
-
- if (penFlags & 256) {
- s >> dashPatternLen;
-- if( dashPatternLen<0 || dashPatternLen>SAL_MAX_INT32/sizeof(float) )
-+ if( dashPatternLen<0 || dashPatternLen>SAL_MAX_INT32/sal_Int32(sizeof(float)) )
- dashPatternLen = SAL_MAX_INT32/sizeof(float);
- dashPattern = new float [dashPatternLen];
- for (i = 0; i < dashPatternLen; i++)
-@@ -618,7 +613,7 @@ namespace cppcanvas
-
- if (penFlags & 1024) {
- s >> compoundArrayLen;
-- if( compoundArrayLen<0 || compoundArrayLen>SAL_MAX_INT32/sizeof(float) )
-+ if( compoundArrayLen<0 || compoundArrayLen>SAL_MAX_INT32/sal_Int32(sizeof(float)) )
- compoundArrayLen = SAL_MAX_INT32/sizeof(float);
- compoundArray = new float [compoundArrayLen];
- for (i = 0; i < compoundArrayLen; i++)
-@@ -845,10 +840,7 @@ namespace cppcanvas
- ::basegfx::B2DHomMatrix aWorldTransformation;
- ::basegfx::B2DHomMatrix aBaseTransformation;
- rendering::Texture aTexture;
-- double nRotation( 0.0 );
- const ::basegfx::B2DRectangle aBounds( ::basegfx::tools::getRange( localPolygon ) );
-- const double nScale( ::basegfx::pruneScaleValue( fabs( aBounds.getHeight()*sin(nRotation) ) +
-- fabs( aBounds.getWidth()*cos(nRotation) )));
-
- aWorldTransformation.set (0, 0, aWorldTransform.eM11);
- aWorldTransformation.set (0, 1, aWorldTransform.eM21);
-@@ -896,7 +888,7 @@ namespace cppcanvas
- aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
- aTexture.Alpha = 1.0;
-
-- uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory(
-+ uno::Reference< lang::XMultiServiceFactory> xFactory(
- rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() );
-
- if( xFactory.is() ) {
-@@ -957,15 +949,26 @@ namespace cppcanvas
- }
- }
-
-+ uno::Sequence<uno::Any> args(2);
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString::createFromAscii("Colors");
-+ aProp.Value <<= aColors;
-+ args[0] <<= aProp;
-+ aProp.Name = rtl::OUString::createFromAscii("Stops");
-+ aProp.Value <<= aStops;
-+ args[1] <<= aProp;
-+
- EMFP_DEBUG (printf ("EMF+\t\tset gradient\n"));
- if (brush->type == 4)
-- aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors,
-- aStops );
-+ aTexture.Gradient.set(
-+ xFactory->createInstanceWithArguments(
-+ rtl::OUString::createFromAscii("LinearGradient"), args),
-+ uno::UNO_QUERY);
- else {
-- geometry::RealRectangle2D aBoundsRectangle (0, 0, 1, 1);
-- aTexture.Gradient = xFactory->createEllipticalGradient( aColors,
-- aStops,
-- aBoundsRectangle);
-+ aTexture.Gradient.set(
-+ xFactory->createInstanceWithArguments(
-+ rtl::OUString::createFromAscii("EllipticalGradient"), args),
-+ uno::UNO_QUERY);
- }
- }
-
-@@ -995,7 +998,6 @@ namespace cppcanvas
-
- void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, UINT16 flags)
- {
-- UINT32 objectLen;
- sal_uInt32 index;
-
- EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
-@@ -1078,7 +1080,7 @@ namespace cppcanvas
-
- EMFP_DEBUG (printf ("EMF+ record size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
-
-- if (type == EmfPlusRecordTypeObject && (mbMultipart && flags & 0x7fff == mMFlags & 0x7fff || flags & 0x8000)) {
-+ if (type == EmfPlusRecordTypeObject && ((mbMultipart && (flags & 0x7fff) == (mMFlags & 0x7fff)) || flags & 0x8000)) {
- if (!mbMultipart) {
- mbMultipart = true;
- mMFlags = flags;
-@@ -1177,12 +1179,8 @@ namespace cppcanvas
- }
- case EmfPlusRecordTypeFillPolygon:
- {
-- sal_uInt8 index = flags & 0xff;
- sal_uInt32 brushIndexOrColor;
-- sal_Int32 brushIndex;
- sal_Int32 points;
-- UINT32 color;
-- USHORT transparency = 0;
-
- rMF >> brushIndexOrColor;
- rMF >> points;
-@@ -1326,8 +1324,9 @@ namespace cppcanvas
-
- rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1;
- }
-- } else
-+ } else {
- EMFP_DEBUG (printf ("EMF+ DrawImagePoints TODO (fixme)\n"));
-+ }
- }
- break;
- }
-@@ -1407,8 +1406,9 @@ namespace cppcanvas
- // reset clip
- if (region.parts == 0 && region.initialState == EmfPlusRegionInitialStateInfinite) {
- updateClipping (::basegfx::B2DPolyPolygon (), rFactoryParms, false);
-- } else
-+ } else {
- EMFP_DEBUG (printf ("EMF+\tTODO\n"));
-+ }
- break;
- }
- case EmfPlusRecordTypeDrawDriverString:
-diff --git cppcanvas/source/mtfrenderer/implrenderer.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx
-index bf8d831..22f6cf1 100644
---- cppcanvas/source/mtfrenderer/implrenderer.cxx
-+++ cppcanvas/source/mtfrenderer/implrenderer.cxx
-@@ -49,7 +49,6 @@
-
- #include <com/sun/star/rendering/XGraphicDevice.hpp>
- #include <com/sun/star/rendering/TexturingMode.hpp>
--#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
- #include <com/sun/star/uno/Sequence.hxx>
- #include <com/sun/star/geometry/RealPoint2D.hpp>
- #include <com/sun/star/rendering/ViewState.hpp>
-@@ -61,6 +60,7 @@
- #include <com/sun/star/rendering/PathJoinType.hpp>
-
- #include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/tools/gradienttools.hxx>
- #include <basegfx/numeric/ftools.hxx>
- #include <basegfx/polygon/b2dpolypolygontools.hxx>
- #include <basegfx/polygon/b2dpolygontools.hxx>
-@@ -591,13 +591,12 @@ namespace cppcanvas
- // discernible difference should be visible.
- nSteps > 64 )
- {
-- uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory(
-+ uno::Reference< lang::XMultiServiceFactory> xFactory(
- rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() );
-
- if( xFactory.is() )
- {
-- ::basegfx::B2DHomMatrix aTextureTransformation;
-- rendering::Texture aTexture;
-+ rendering::Texture aTexture;
-
- aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
- aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
-@@ -632,245 +631,121 @@ namespace cppcanvas
- uno::Sequence< uno::Sequence < double > > aColors(2);
- uno::Sequence< double > aStops(2);
-
-- aStops[0] = 0.0;
-- aStops[1] = 1.0;
--
-- aColors[0] = aStartColor;
-- aColors[1] = aEndColor;
--
-+ if( rGradient.GetStyle() == GRADIENT_AXIAL )
-+ {
-+ aStops.realloc(3);
-+ aColors.realloc(3);
-
-- // Setup texture transformation
-- // ----------------------------
-+ aStops[0] = 0.0;
-+ aStops[1] = 0.5;
-+ aStops[2] = 1.0;
-
-+ aColors[0] = aEndColor;
-+ aColors[1] = aStartColor;
-+ aColors[2] = aEndColor;
-+ }
-+ else
-+ {
-+ aStops[0] = 0.0;
-+ aStops[1] = 1.0;
-+
-+ aColors[0] = aStartColor;
-+ aColors[1] = aEndColor;
-+ }
-+
- const ::basegfx::B2DRectangle aBounds(
- ::basegfx::tools::getRange(aDevicePoly) );
-+ const ::basegfx::B2DVector aOffset(
-+ rGradient.GetOfsX() / 100.0,
-+ rGradient.GetOfsY() / 100.0);
-+ double fRotation( rGradient.GetAngle() * M_PI / 1800.0 );
-+ const double fBorder( rGradient.GetBorder() / 100.0 );
-
-- // setup rotation angle. VCL rotates
-- // counter-clockwise, while canvas transformation
-- // rotates clockwise
-- double nRotation( -rGradient.GetAngle() * M_PI / 1800.0 );
-+ basegfx::B2DHomMatrix aRot90;
-+ aRot90.rotate(M_PI_2);
-
-+ basegfx::ODFGradientInfo aGradInfo;
-+ rtl::OUString aGradientService;
- switch( rGradient.GetStyle() )
- {
- case GRADIENT_LINEAR:
-- // FALLTHROUGH intended
-+ basegfx::tools::createLinearODFGradientInfo(aGradInfo,
-+ aBounds,
-+ nSteps,
-+ fBorder,
-+ fRotation);
-+ // map odf to svg gradient orientation - x
-+ // instead of y direction
-+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90;
-+ aGradientService = rtl::OUString::createFromAscii("LinearGradient");
-+ break;
-+
- case GRADIENT_AXIAL:
- {
-- // standard orientation for VCL linear
-- // gradient is vertical, thus, rotate 90
-- // degrees
-- nRotation += M_PI/2.0;
--
-- const double nBorder(
-- ::basegfx::pruneScaleValue(
-- (1.0 - rGradient.GetBorder() / 100.0) ) );
--
-- // shrink texture, to account for border
-- // (only in x direction, linear gradient
-- // is constant in y direction, anyway)
-- aTextureTransformation.scale( nBorder,
-- 1.0 );
--
-- // linear gradients don't respect offsets
-- // (they are implicitely assumed to be
-- // 50%). linear gradients don't have
-- // border on both sides, only on the
-- // startColor side, axial gradients have
-- // border on both sides. As both gradients
-- // are invariant in y direction: leave y
-- // offset alone.
-- double nOffsetX( rGradient.GetBorder() / 200.0 );
--
-- // determine type of gradient (and necessary
-- // transformation matrix, should it be emulated by a
-- // generic gradient)
-- switch( rGradient.GetStyle() )
-- {
-- case GRADIENT_LINEAR:
-- nOffsetX = rGradient.GetBorder() / 100.0;
-- aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors,
-- aStops );
-- break;
--
-- case GRADIENT_AXIAL:
-- // vcl considers center color as start color
-- ::std::swap(aColors[0],aColors[1]);
-- aTexture.Gradient = xFactory->createAxialHorizontalGradient( aColors,
-- aStops );
-- break;
--
-- default: // other cases can't happen
-- break;
-- }
--
-- // apply border offset values
-- aTextureTransformation.translate( nOffsetX,
-- 0.0 );
--
-- // rotate texture according to gradient rotation
-- aTextureTransformation.translate( -0.5, -0.5 );
-- aTextureTransformation.rotate( nRotation );
--
-- // to let the first strip of a rotated
-- // gradient start at the _edge_ of the
-- // bound rect (and not, due to rotation,
-- // slightly inside), slightly enlarge the
-- // gradient:
-- //
-- // y/2 sin(alpha) + x/2 cos(alpha)
-- //
-- // (values to change are not actual
-- // gradient scales, but original bound
-- // rect dimensions. Since we still want
-- // the border setting to apply after that,
-- // we multiply with that as above for
-- // nScaleX)
-- const double nScale(
-- ::basegfx::pruneScaleValue(
-- fabs( aBounds.getHeight()*sin(nRotation) ) +
-- fabs( aBounds.getWidth()*cos(nRotation) )));
--
-- aTextureTransformation.scale( nScale, nScale );
--
-- // translate back origin to center of
-- // primitive
-- aTextureTransformation.translate( 0.5*aBounds.getWidth(),
-- 0.5*aBounds.getHeight() );
-+ basegfx::tools::createLinearODFGradientInfo(aGradInfo,
-+ aBounds,
-+ nSteps,
-+ fBorder,
-+ fRotation);
-+ // map odf to svg gradient orientation - x
-+ // instead of y direction
-+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90;
-+
-+ // map odf axial gradient to 3-stop linear
-+ // gradient - shift left by 0.5
-+ basegfx::B2DHomMatrix aShift;
-+ aShift.translate(-0.5,0);
-+ aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aShift;
-+
-+ aGradientService = rtl::OUString::createFromAscii("LinearGradient");
-+ break;
- }
-- break;
-
- case GRADIENT_RADIAL:
-- // FALLTHROUGH intended
-- case GRADIENT_ELLIPTICAL:
-- // FALLTHROUGH intended
-- case GRADIENT_SQUARE:
-- // FALLTHROUGH intended
-- case GRADIENT_RECT:
-- {
-- // determine scale factors for the gradient (must
-- // be scaled up from [0,1]x[0,1] rect to object
-- // bounds). Will potentially changed in switch
-- // statement below.
-- // Respect border value, while doing so, the VCL
-- // gradient's border will effectively shrink the
-- // resulting gradient.
-- double nScaleX( aBounds.getWidth() * (1.0 - rGradient.GetBorder() / 100.0) );
-- double nScaleY( aBounds.getHeight()* (1.0 - rGradient.GetBorder() / 100.0) );
--
-- // determine offset values. Since the border is
-- // divided half-by-half to both sides of the
-- // gradient, divide translation offset by an
-- // additional 2. Also respect offset here, but
-- // since VCL gradients have their center at [0,0]
-- // for zero offset, but canvas gradients have
-- // their top, left edge aligned with the
-- // primitive, and offset of 50% effectively must
-- // yield zero shift. Both values will potentially
-- // be adapted in switch statement below.
-- double nOffsetX( aBounds.getWidth() *
-- (2.0 * rGradient.GetOfsX() - 100.0 + rGradient.GetBorder()) / 200.0 );
-- double nOffsetY( aBounds.getHeight() *
-- (2.0 * rGradient.GetOfsY() - 100.0 + rGradient.GetBorder()) / 200.0 );
--
-- // determine type of gradient (and necessary
-- // transformation matrix, should it be emulated by a
-- // generic gradient)
-- switch( rGradient.GetStyle() )
-- {
-- case GRADIENT_RADIAL:
-- {
-- // create isotrophic scaling
-- if( nScaleX > nScaleY )
-- {
-- nOffsetY -= (nScaleX - nScaleY) * 0.5;
-- nScaleY = nScaleX;
-- }
-- else
-- {
-- nOffsetX -= (nScaleY - nScaleX) * 0.5;
-- nScaleX = nScaleY;
-- }
--
-- // enlarge gradient to match bound rect diagonal
-- aTextureTransformation.translate( -0.5, -0.5 );
-- const double nScale( hypot(aBounds.getWidth(), aBounds.getHeight()) / nScaleX );
-- aTextureTransformation.scale( nScale, nScale );
-- aTextureTransformation.translate( 0.5, 0.5 );
--
-- aTexture.Gradient = xFactory->createEllipticalGradient( aColors,
-- aStops,
-- geometry::RealRectangle2D(0.0,0.0,
-- 1.0,1.0) );
-- }
-- break;
--
-- case GRADIENT_ELLIPTICAL:
-- {
-- // enlarge gradient slightly
-- aTextureTransformation.translate( -0.5, -0.5 );
-- const double nSqrt2( sqrt(2.0) );
-- aTextureTransformation.scale( nSqrt2,nSqrt2 );
-- aTextureTransformation.translate( 0.5, 0.5 );
--
-- aTexture.Gradient = xFactory->createEllipticalGradient(
-- aColors,
-- aStops,
-- ::basegfx::unotools::rectangle2DFromB2DRectangle(
-- aBounds ));
-- }
-- break;
--
-- case GRADIENT_SQUARE:
-- // create isotrophic scaling
-- if( nScaleX > nScaleY )
-- {
-- nOffsetY -= (nScaleX - nScaleY) * 0.5;
-- nScaleY = nScaleX;
-- }
-- else
-- {
-- nOffsetX -= (nScaleY - nScaleX) * 0.5;
-- nScaleX = nScaleY;
-- }
--
-- aTexture.Gradient = xFactory->createRectangularGradient( aColors,
-- aStops,
-- geometry::RealRectangle2D(0.0,0.0,
-- 1.0,1.0) );
-- break;
--
-- case GRADIENT_RECT:
-- aTexture.Gradient = xFactory->createRectangularGradient(
-- aColors,
-- aStops,
-- ::basegfx::unotools::rectangle2DFromB2DRectangle(
-- aBounds ) );
-- break;
--
-- default: // other cases can't happen
-- break;
-- }
-+ basegfx::tools::createRadialODFGradientInfo(aGradInfo,
-+ aBounds,
-+ aOffset,
-+ nSteps,
-+ fBorder);
-+ aGradientService = rtl::OUString::createFromAscii("EllipticalGradient");
-+ break;
-
-- nScaleX = ::basegfx::pruneScaleValue( nScaleX );
-- nScaleY = ::basegfx::pruneScaleValue( nScaleY );
-+ case GRADIENT_ELLIPTICAL:
-+ basegfx::tools::createEllipticalODFGradientInfo(aGradInfo,
-+ aBounds,
-+ aOffset,
-+ nSteps,
-+ fBorder,
-+ fRotation);
-+ aGradientService = rtl::OUString::createFromAscii("EllipticalGradient");
-+ break;
-
-- aTextureTransformation.scale( nScaleX, nScaleY );
-+ case GRADIENT_SQUARE:
-+ basegfx::tools::createSquareODFGradientInfo(aGradInfo,
-+ aBounds,
-+ aOffset,
-+ nSteps,
-+ fBorder,
-+ fRotation);
-+ aGradientService = rtl::OUString::createFromAscii("RectangularGradient");
-+ break;
-
-- // rotate texture according to gradient rotation
-- aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY );
-- aTextureTransformation.rotate( nRotation );
-- aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY );
--
-- aTextureTransformation.translate( nOffsetX, nOffsetY );
-- }
-- break;
-+ case GRADIENT_RECT:
-+ basegfx::tools::createRectangularODFGradientInfo(aGradInfo,
-+ aBounds,
-+ aOffset,
-+ nSteps,
-+ fBorder,
-+ fRotation);
-+ aGradientService = rtl::OUString::createFromAscii("RectangularGradient");
-+ break;
-
- default:
- ENSURE_OR_THROW( false,
-- "ImplRenderer::createGradientAction(): Unexpected gradient type" );
-+ "ImplRenderer::createGradientAction(): Unexpected gradient type" );
- break;
- }
--
-+
- // As the texture coordinate space is relative to
- // the polygon coordinate space (NOT to the
- // polygon itself), move gradient to the start of
-@@ -878,31 +753,49 @@ namespace cppcanvas
- // gradient will always display at the origin, and
- // not within the polygon bound (which might be
- // miles away from the origin).
-- aTextureTransformation.translate( aBounds.getMinX(),
-- aBounds.getMinY() );
--
-+ aGradInfo.maTextureTransform.translate( aBounds.getMinX(),
-+ aBounds.getMinY() );
- ::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform,
-- aTextureTransformation );
--
-- ActionSharedPtr pPolyAction(
-- internal::PolyPolyActionFactory::createPolyPolyAction(
-- aDevicePoly,
-- rParms.mrCanvas,
-- getState( rParms.mrStates ),
-- aTexture ) );
--
-- if( pPolyAction )
-+ aGradInfo.maTextureTransform );
-+
-+ uno::Sequence<uno::Any> args(3);
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString::createFromAscii("Colors");
-+ aProp.Value <<= aColors;
-+ args[0] <<= aProp;
-+ aProp.Name = rtl::OUString::createFromAscii("Stops");
-+ aProp.Value <<= aStops;
-+ args[1] <<= aProp;
-+ aProp.Name = rtl::OUString::createFromAscii("AspectRatio");
-+ aProp.Value <<= aGradInfo.mfAspectRatio;
-+ args[2] <<= aProp;
-+
-+ aTexture.Gradient.set(
-+ xFactory->createInstanceWithArguments(aGradientService,
-+ args),
-+ uno::UNO_QUERY);
-+ if( aTexture.Gradient.is() )
- {
-- maActions.push_back(
-- MtfAction(
-- pPolyAction,
-- rParms.mrCurrActionIndex ) );
-+ ActionSharedPtr pPolyAction(
-+ internal::PolyPolyActionFactory::createPolyPolyAction(
-+ aDevicePoly,
-+ rParms.mrCanvas,
-+ getState( rParms.mrStates ),
-+ aTexture ) );
-+
-+ if( pPolyAction )
-+ {
-+ maActions.push_back(
-+ MtfAction(
-+ pPolyAction,
-+ rParms.mrCurrActionIndex ) );
-
-- rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
-- }
-+ rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
-+ }
-
-- // done, using native gradients
-- return;
-+ // done, using native gradients
-+ return;
-+ }
- }
- }
-
-@@ -1910,7 +1803,7 @@ namespace cppcanvas
- if (count == -1) {
- count = 0;
- char *env;
-- if (env = getenv ("EMF_PLUS_LIMIT")) {
-+ if( (env=getenv ("EMF_PLUS_LIMIT")) ) {
- limit = atoi (env);
- EMFP_DEBUG (printf ("EMF+ records limit: %d\n", limit));
- }
-diff --git drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
-index 7248f27..311ccf9 100644
---- drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
-+++ drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
-@@ -62,16 +62,6 @@ namespace drawinglayer
- basegfx::B2DPolygon aUnitPolygon;
- sal_uInt32 nSteps(maFillGradient.getSteps());
-
-- if(attribute::GRADIENTSTYLE_RADIAL == aGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == aGradientStyle)
-- {
-- const basegfx::B2DPoint aCircleCenter(0.5, 0.5);
-- aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
-- }
-- else
-- {
-- aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
-- }
--
- // make sure steps is not too high/low
- const basegfx::BColor aStart(maFillGradient.getStartColor());
- const basegfx::BColor aEnd(maFillGradient.getEndColor());
-@@ -96,16 +86,18 @@ namespace drawinglayer
- {
- case attribute::GRADIENTSTYLE_LINEAR:
- {
-- texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle());
-+ texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0, 0, 1, 1));
- break;
- }
- case attribute::GRADIENTSTYLE_AXIAL:
- {
-- texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle());
-+ texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
- break;
- }
- case attribute::GRADIENTSTYLE_RADIAL:
-@@ -113,27 +105,31 @@ namespace drawinglayer
- texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(0,0), 1, 1);
- break;
- }
- case attribute::GRADIENTSTYLE_ELLIPTICAL:
- {
-- texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
-+ texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(0,0), 1, 1);
- break;
- }
- case attribute::GRADIENTSTYLE_SQUARE:
- {
-- texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
-+ texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
- break;
- }
- case attribute::GRADIENTSTYLE_RECT:
- {
-- texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle());
-+ texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), maFillGradient.getAngle());
- aGradient.appendTransformations(aMatrices);
- aGradient.appendColors(aColors);
-+ aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
- break;
- }
- }
-diff --git drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
-index 4716f35..188c6c9 100644
---- drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
-+++ drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
-@@ -59,7 +59,7 @@ namespace drawinglayer
- {
- // create hatch
- const basegfx::BColor aHatchColor(maFillHatch.getColor());
-- const double fAngle(-maFillHatch.getAngle());
-+ const double fAngle(maFillHatch.getAngle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
-
- // get hatch transformations
-@@ -68,7 +68,7 @@ namespace drawinglayer
- case attribute::HATCHSTYLE_TRIPLE:
- {
- // rotated 45 degrees
-- texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI4);
-+ texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle - F_PI4);
- aHatch.appendTransformations(aMatrices);
-
- // fall-through by purpose
-@@ -76,7 +76,7 @@ namespace drawinglayer
- case attribute::HATCHSTYLE_DOUBLE:
- {
- // rotated 90 degrees
-- texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI2);
-+ texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle - F_PI2);
- aHatch.appendTransformations(aMatrices);
-
- // fall-through by purpose
-diff --git drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
-index 02a07ac..05f748c 100644
---- drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
-+++ drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
-@@ -155,7 +155,7 @@ namespace drawinglayer
- // get 2d range of texture coordinates
- const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
- const basegfx::BColor aHatchColor(getHatch().getColor());
-- const double fAngle(-getHatch().getAngle());
-+ const double fAngle(getHatch().getAngle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
-
- // get hatch transformations
-@@ -164,13 +164,13 @@ namespace drawinglayer
- case attribute::HATCHSTYLE_TRIPLE:
- {
- // rotated 45 degrees
-- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI4);
-+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI4);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_DOUBLE:
- {
- // rotated 90 degrees
-- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle + F_PI2);
-+ texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_SINGLE:
-diff --git drawinglayer/source/processor2d/vclprocessor2d.cxx drawinglayer/source/processor2d/vclprocessor2d.cxx
-index 54a26b9..a7adce2 100644
---- drawinglayer/source/processor2d/vclprocessor2d.cxx
-+++ drawinglayer/source/processor2d/vclprocessor2d.cxx
-@@ -609,7 +609,7 @@ namespace drawinglayer
- impDrawGradientToOutDev(
- *mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(),
- aStartColor, aEndColor, rGradient.getBorder(),
-- -rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false);
-+ rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false);
- }
- }
-
-diff --git drawinglayer/source/processor3d/defaultprocessor3d.cxx drawinglayer/source/processor3d/defaultprocessor3d.cxx
-index b5f3b3f..5d3fc27 100644
---- drawinglayer/source/processor3d/defaultprocessor3d.cxx
-+++ drawinglayer/source/processor3d/defaultprocessor3d.cxx
-@@ -106,12 +106,12 @@ namespace drawinglayer
- {
- case attribute::GRADIENTSTYLE_LINEAR:
- {
-- pNewTex = new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle());
-+ pNewTex = new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle());
- break;
- }
- case attribute::GRADIENTSTYLE_AXIAL:
- {
-- pNewTex = new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle());
-+ pNewTex = new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle());
- break;
- }
- case attribute::GRADIENTSTYLE_RADIAL:
-@@ -121,17 +121,17 @@ namespace drawinglayer
- }
- case attribute::GRADIENTSTYLE_ELLIPTICAL:
- {
-- pNewTex = new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle());
-+ pNewTex = new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle());
- break;
- }
- case attribute::GRADIENTSTYLE_SQUARE:
- {
-- pNewTex = new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle());
-+ pNewTex = new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle());
- break;
- }
- case attribute::GRADIENTSTYLE_RECT:
- {
-- pNewTex = new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle());
-+ pNewTex = new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle());
- break;
- }
- }
-diff --git drawinglayer/source/texture/texture.cxx drawinglayer/source/texture/texture.cxx
-index 075699b..00d7a32 100644
---- drawinglayer/source/texture/texture.cxx
-+++ drawinglayer/source/texture/texture.cxx
-@@ -165,15 +165,10 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fTop(mfBorder);
-- const double fStripeWidth((1.0 - fTop) / maGradientInfo.mnSteps);
--
-+ const double fStripeWidth(1.0 / maGradientInfo.mnSteps);
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
-- const double fOffsetUpper(fStripeWidth * (double)a);
--
-- // create matrix
-- const basegfx::B2DRange aRect(0.0, fTop + fOffsetUpper, 1.0, 1.0);
-+ const basegfx::B2DRange aRect(0.0, fStripeWidth * a, 1.0, 1.0);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -225,17 +220,10 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fHalfBorder(mfBorder * 0.5);
-- double fTop(fHalfBorder);
-- double fBottom(1.0 - fHalfBorder);
-- const double fStripeWidth((fBottom - fTop) / ((maGradientInfo.mnSteps * 2L) - 1L));
--
-- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
-+ const double fStripeWidth=1.0 / (maGradientInfo.mnSteps - 1L);
-+ for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a != 0; a--)
- {
-- const double fOffset(fStripeWidth * (double)a);
--
-- // create matrix
-- const basegfx::B2DRange aRect(0.0, fTop + fOffset, 1.0, fBottom - fOffset);
-+ const basegfx::B2DRange aRect(0, 0, 1.0, fStripeWidth * a);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -287,34 +275,10 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fHalfBorder((1.0 - mfBorder) * 0.5);
-- double fLeft(0.5 - fHalfBorder);
-- double fTop(0.5 - fHalfBorder);
-- double fRight(0.5 + fHalfBorder);
-- double fBottom(0.5 + fHalfBorder);
-- double fIncrementX, fIncrementY;
--
-- if(maGradientInfo.mfAspectRatio > 1.0)
-- {
-- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
-- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
-- }
-- else
-- {
-- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
-- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
-- }
--
-+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
-- // next step
-- fLeft += fIncrementX;
-- fRight -= fIncrementX;
-- fTop += fIncrementY;
-- fBottom -= fIncrementY;
--
-- // create matrix
-- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
-+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -359,34 +323,29 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fHalfBorder((1.0 - mfBorder) * 0.5);
-- double fLeft(0.5 - fHalfBorder);
-- double fTop(0.5 - fHalfBorder);
-- double fRight(0.5 + fHalfBorder);
-- double fBottom(0.5 + fHalfBorder);
-+ double fWidth(1);
-+ double fHeight(1);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
-- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
-+ fIncrementY = fHeight / maGradientInfo.mnSteps;
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
- else
- {
-- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
-+ fIncrementX = fWidth / maGradientInfo.mnSteps;
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
-- fLeft += fIncrementX;
-- fRight -= fIncrementX;
-- fTop += fIncrementY;
-- fBottom -= fIncrementY;
-+ fWidth -= fIncrementX;
-+ fHeight -= fIncrementY;
-
- // create matrix
-- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
-+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -431,42 +390,10 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fHalfBorder((1.0 - mfBorder) * 0.5);
-- double fLeft(0.5 - fHalfBorder);
-- double fTop(0.5 - fHalfBorder);
-- double fRight(0.5 + fHalfBorder);
-- double fBottom(0.5 + fHalfBorder);
-- double fIncrementX, fIncrementY;
--
-- if(maGradientInfo.mfAspectRatio > 1.0)
-- {
-- const double fWidth(fRight - fLeft);
-- const double fHalfAspectExpansion(((maGradientInfo.mfAspectRatio - 1.0) * 0.5) * fWidth);
-- fTop -= fHalfAspectExpansion;
-- fBottom += fHalfAspectExpansion;
-- fIncrementX = fWidth / (double)(maGradientInfo.mnSteps * 2L);
-- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
-- }
-- else
-- {
-- const double fHeight(fBottom - fTop);
-- const double fHalfAspectExpansion((((1.0 / maGradientInfo.mfAspectRatio) - 1.0) * 0.5) * fHeight);
-- fLeft -= fHalfAspectExpansion;
-- fRight += fHalfAspectExpansion;
-- fIncrementY = fHeight / (double)(maGradientInfo.mnSteps * 2L);
-- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
-- }
--
-+ const double fStepSize=1.0 / maGradientInfo.mnSteps;
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
-- // next step
-- fLeft += fIncrementX;
-- fRight -= fIncrementX;
-- fTop += fIncrementY;
-- fBottom -= fIncrementY;
--
-- // create matrix
-- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
-+ const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -511,34 +438,29 @@ namespace drawinglayer
- {
- if(maGradientInfo.mnSteps)
- {
-- const double fHalfBorder((1.0 - mfBorder) * 0.5);
-- double fLeft(0.5 - fHalfBorder);
-- double fTop(0.5 - fHalfBorder);
-- double fRight(0.5 + fHalfBorder);
-- double fBottom(0.5 + fHalfBorder);
-+ double fWidth(1);
-+ double fHeight(1);
- double fIncrementX, fIncrementY;
-
- if(maGradientInfo.mfAspectRatio > 1.0)
- {
-- fIncrementY = (fBottom - fTop) / (double)(maGradientInfo.mnSteps * 2L);
-+ fIncrementY = fHeight / maGradientInfo.mnSteps;
- fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio;
- }
- else
- {
-- fIncrementX = (fRight - fLeft) / (double)(maGradientInfo.mnSteps * 2L);
-+ fIncrementX = fWidth / maGradientInfo.mnSteps;
- fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio;
- }
-
- for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++)
- {
- // next step
-- fLeft += fIncrementX;
-- fRight -= fIncrementX;
-- fTop += fIncrementY;
-- fBottom -= fIncrementY;
-+ fWidth -= fIncrementX;
-+ fHeight -= fIncrementY;
-
- // create matrix
-- const basegfx::B2DRange aRect(fLeft, fTop, fRight, fBottom);
-+ const basegfx::B2DRange aRect(0, 0, fWidth, fHeight);
- impAppendMatrix(rMatrices, aRect);
- }
- }
-@@ -574,6 +496,8 @@ namespace drawinglayer
- double fTargetOffsetX(rTargetRange.getMinX());
- double fTargetOffsetY(rTargetRange.getMinY());
-
-+ fAngle = -fAngle;
-+
- // add object expansion
- if(0.0 != fAngle)
- {
-diff --git drawinglayer/source/texture/texture3d.cxx drawinglayer/source/texture/texture3d.cxx
-index 4b8aa96..89be257 100644
---- drawinglayer/source/texture/texture3d.cxx
-+++ drawinglayer/source/texture/texture3d.cxx
-@@ -198,7 +198,7 @@ namespace drawinglayer
- {
- const attribute::FillHatchAttribute& rHatch(rPrimitive.getHatch());
- const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
-- const double fAngleA(-rHatch.getAngle());
-+ const double fAngleA(rHatch.getAngle());
- maColor = rHatch.getColor();
- mbFillBackground = rHatch.isFillBackground();
- mp0 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA);
-diff --git offapi/com/sun/star/rendering/XGraphicDevice.idl offapi/com/sun/star/rendering/XGraphicDevice.idl
-index b94f097..6a46714 100644
---- offapi/com/sun/star/rendering/XGraphicDevice.idl
-+++ offapi/com/sun/star/rendering/XGraphicDevice.idl
-@@ -51,8 +51,8 @@
- #ifndef __com_sun_star_rendering_XParametricPolyPolygon2DFactory_idl__
- #include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl>
- #endif
--#ifndef __com_sun_star_rendering_XColorSpace_idl__
--#include <com/sun/star/rendering/XColorSpace.idl>
-+#ifndef __com_sun_star_lang_XMultiServiceFactory_idl__
-+#include <com/sun/star/lang/XMultiServiceFactory.idl>
- #endif
-
- module com { module sun { module star { module rendering {
-@@ -220,8 +220,67 @@ interface XGraphicDevice : ::com::sun::star::uno::XInterface
- this is not advisable: each canvas implementation is free to
- internally generate optimized parametric polygons, which can
- be used more directly for e.g. texturing operations.
-+
-+ <pre>
-+ Available services (all canvas implementations should provide
-+ this minimal set, though are free to add more; just check the
-+ getAvailableServiceNames() on the returned interface):
-+
-+ - Gradients - all gradients need to support two construction
-+ parameters, "Colors" being a <type>sequence<Color></type>
-+ and "Stops" being a <type>sequence<double></type>. Both must
-+ have the same length, and at least two elements. See
-+ http://www.w3.org/TR/SVG11/pservers.html#GradientStops for
-+ the semantics of gradient stops and colors.
-+ Required gradient services:
-+
-+ * "LinearGradient" - the gradient varies linearly between
-+ the given colors. without coordinate system
-+ transformation, the color interpolation happens in
-+ increasing x direction, and is constant in y
-+ direction. Equivalent to svg linear gradient
-+ http://www.w3.org/TR/SVG11/pservers.html#LinearGradients
-+
-+ * "EllipticalGradient" - this gradient has zeroth color
-+ index in the middle, and varies linearly between center
-+ and final color. The services takes an additional
-+ parameter named "AspectRatio" of <type>double</type>
-+ (width divided by height), if this aspect ratio is 1, the
-+ gradient is circular. If it's not 1, the gradient is
-+ elliptical, with the special twist that the aspect ratio
-+ is maintained also for the center color: the gradient will
-+ not collapse into a single point, but become a line of
-+ center color. If "AspectRatio" is missing, or equal to 1,
-+ this gradient yields similar results as the svg radial
-+ gradient
-+ http://www.w3.org/TR/SVG11/pservers.html#RadialGradients
-+
-+ * "RectangularGradient" - this gradient has zeroth color
-+ index in the middle, and varies linearly between center
-+ and final color via rectangular boxes
-+ around the center point. The services takes an additional
-+ parameter named "AspectRatio" of <type>double</type>
-+ (width divided by height), if this aspect ratio is 1, the
-+ gradient is quadratic. If it's not 1, the gradient is
-+ rectangular, with the special twist that the aspect ratio
-+ is maintained also for the center color: the gradient will
-+ not collapse into a single point, but become a line of
-+ center color.
-+
-+ - Hatch patterns - Required hatch services:
-+
-+ * "VerticalLineHatch" - this hatching consists of vertical lines
-+ * "OrthogonalLinesHatch" - this hatching consists of
-+ crossing vertical and horizontal lines
-+ * "ThreeCrossingLinesHatch" - this hatching consists of
-+ vertical and horizontal lines plus diagonal lines from
-+ left, top to bottom, right.
-+ * "FourCrossingLinesHatch" - this hatching consists of
-+ vertical and horizontal lines plus diagonal lines in both
-+ directions.
-+ </pre>
- */
-- XParametricPolyPolygon2DFactory getParametricPolyPolygonFactory();
-+ com::sun::star::lang::XMultiServiceFactory getParametricPolyPolygonFactory();
-
- //-------------------------------------------------------------------------
-
-diff --git offapi/com/sun/star/rendering/makefile.mk offapi/com/sun/star/rendering/makefile.mk
-index 8466a1e..d4979ed 100644
---- offapi/com/sun/star/rendering/makefile.mk
-+++ offapi/com/sun/star/rendering/makefile.mk
-@@ -109,7 +109,6 @@ IDLFILES=\
- XIntegerReadOnlyBitmap.idl \
- XLinePolyPolygon2D.idl \
- XParametricPolyPolygon2D.idl \
-- XParametricPolyPolygon2DFactory.idl \
- XPolyPolygon2D.idl \
- XSimpleCanvas.idl \
- XSprite.idl \
-diff --git slideshow/source/engine/activities/activitybase.cxx slideshow/source/engine/activities/activitybase.cxx
-index 97eeb6c..b0ca84a 100644
---- slideshow/source/engine/activities/activitybase.cxx
-+++ slideshow/source/engine/activities/activitybase.cxx
-@@ -162,7 +162,7 @@ namespace slideshow
- // ================================
-
- // clamp nT to permissible [0,1] range
-- nT = ::canvas::tools::clamp( nT, 0.0, 1.0 );
-+ nT = ::basegfx::clamp( nT, 0.0, 1.0 );
-
- // take acceleration/deceleration into account. if the sum
- // of mnAccelerationFraction and mnDecelerationFraction
-diff --git slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
-index 4306967..554f1ce 100644
---- slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
-+++ slideshow/source/engine/activities/continuouskeytimeactivitybase.cxx
-@@ -38,6 +38,7 @@
-
- #include <continuouskeytimeactivitybase.hxx>
-
-+#include <boost/tuple/tuple.hpp>
- #include <algorithm>
- #include <iterator>
-
-@@ -48,34 +49,14 @@ namespace slideshow
- {
- ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase( const ActivityParameters& rParms ) :
- SimpleContinuousActivityBase( rParms ),
-- maKeyTimes( rParms.maDiscreteTimes ),
-- mnLastIndex( 0 )
-+ maLerper( rParms.maDiscreteTimes )
- {
-- ENSURE_OR_THROW( maKeyTimes.size() > 1,
-+ ENSURE_OR_THROW( rParms.maDiscreteTimes.size() > 1,
- "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector must have two entries or more" );
--
--#ifdef DBG_UTIL
-- // check parameters: rKeyTimes must be sorted in
-- // ascending order, and contain values only from the range
-- // [0,1]
-- for( ::std::size_t i=1, len=maKeyTimes.size(); i<len; ++i )
-- {
-- if( maKeyTimes[i] < 0.0 ||
-- maKeyTimes[i] > 1.0 ||
-- maKeyTimes[i-1] < 0.0 ||
-- maKeyTimes[i-1] > 1.0 )
-- {
-- ENSURE_OR_THROW( false, "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): time values not within [0,1] range!" );
-- }
--
-- if( maKeyTimes[i-1] > maKeyTimes[i] )
-- {
-- ENSURE_OR_THROW( false, "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): time vector is not sorted in ascending order!" );
-- }
-- }
--
-- // TODO(E2): check this also in production code?
--#endif
-+ ENSURE_OR_THROW( rParms.maDiscreteTimes.front() == 0.0,
-+ "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector first entry must be zero" );
-+ ENSURE_OR_THROW( rParms.maDiscreteTimes.back() <= 1.0,
-+ "ContinuousKeyTimeActivityBase::ContinuousKeyTimeActivityBase(): key times vector last entry must be less or equal 1" );
- }
-
- void ContinuousKeyTimeActivityBase::simplePerform( double nSimpleTime,
-@@ -84,40 +65,14 @@ namespace slideshow
- // calc simple time from global time - sweep through the
- // array multiple times for repeated animations (according to
- // SMIL spec).
-- const double nT( calcAcceleratedTime( nSimpleTime ) );
--
-- // determine position within key times vector from
-- // current simple time
--
-- // shortcut: cached value still okay?
-- if( maKeyTimes[ mnLastIndex ] < nT ||
-- maKeyTimes[ mnLastIndex+1 ] >= nT )
-- {
-- // nope, find new index
-- mnLastIndex = ::std::min< ::std::ptrdiff_t >(
-- maKeyTimes.size()-2,
-- // range is ensured by max below
-- ::std::max< ::std::ptrdiff_t >(
-- 0,
-- ::std::distance( maKeyTimes.begin(),
-- ::std::lower_bound( maKeyTimes.begin(),
-- maKeyTimes.end(),
-- nT ) ) - 1 ) );
-- }
--
-- OSL_ENSURE( mnLastIndex+1 < maKeyTimes.size(),
-- "ContinuousKeyTimeActivityBase::simplePerform(): index out of range" );
--
-- // mnLastIndex is now valid and up-to-date
-+ double fAlpha( calcAcceleratedTime( nSimpleTime ) );
-+ std::ptrdiff_t nIndex;
-
-- // calc current simple time, as a fractional value ([0,1] range).
-- // I.e. the relative position between the two index times.
-- const double nCurrFractionalSimplTime( (nT - maKeyTimes[ mnLastIndex ]) /
-- (maKeyTimes[ mnLastIndex+1 ] - maKeyTimes[ mnLastIndex ]) );
-+ boost::tuples::tie(nIndex,fAlpha) = maLerper.lerp(fAlpha);
-
- perform(
-- mnLastIndex,
-- nCurrFractionalSimplTime,
-+ nIndex,
-+ fAlpha,
- nRepeatCount );
- }
- }
-diff --git slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
-index 9d767ea..4e06ec1 100644
---- slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
-+++ slideshow/source/engine/activities/continuouskeytimeactivitybase.hxx
-@@ -32,6 +32,8 @@
- #define INCLUDED_SLIDESHOW_CONTINUOUSKEYTIMEACTIVITYBASE_HXX
-
- #include "simplecontinuousactivitybase.hxx"
-+
-+#include <basegfx/tools/keystoplerp.hxx>
- #include <vector>
-
-
-@@ -76,10 +78,7 @@ namespace slideshow
- sal_uInt32 nRepeatCount ) const;
-
- private:
-- const ::std::vector< double > maKeyTimes;
--
-- /// last active index in maKeyTimes (to avoid frequent searching)
-- mutable ::std::size_t mnLastIndex;
-+ const ::basegfx::tools::KeyStopLerp maLerper;
- };
- }
- }
-diff --git slideshow/source/engine/activities/interpolation.hxx slideshow/source/engine/activities/interpolation.hxx
-index 5327c4a..5c4289b 100644
---- slideshow/source/engine/activities/interpolation.hxx
-+++ slideshow/source/engine/activities/interpolation.hxx
-@@ -31,11 +31,11 @@
- #ifndef INCLUDED_SLIDESHOW_INTERPOLATION_HXX
- #define INCLUDED_SLIDESHOW_INTERPOLATION_HXX
-
--#include "lerp.hxx"
-+#include <basegfx/tools/lerp.hxx>
-
--namespace slideshow
-+namespace basegfx
- {
-- namespace internal
-+ namespace tools
- {
- // Interpolator specializations
- // ============================
-@@ -45,9 +45,10 @@ namespace slideshow
- // not-straight-forward-interpolatable types
-
- /// Specialization for RGBColor, to employ color-specific interpolator
-- template<> RGBColor lerp< RGBColor >( const RGBColor& rFrom,
-- const RGBColor& rTo,
-- double t )
-+ template<> ::slideshow::internal::RGBColor lerp< ::slideshow::internal::RGBColor >(
-+ const ::slideshow::internal::RGBColor& rFrom,
-+ const ::slideshow::internal::RGBColor& rTo,
-+ double t )
- {
- return interpolate( rFrom, rTo, t );
- }
-@@ -81,14 +82,20 @@ namespace slideshow
- "lerp<bool> called" );
- return rTo;
- }
-+ }
-+}
-
-+namespace slideshow
-+{
-+ namespace internal
-+ {
- template< typename ValueType > struct Interpolator
- {
- ValueType operator()( const ValueType& rFrom,
- const ValueType& rTo,
- double t ) const
- {
-- return lerp( rFrom, rTo, t );
-+ return basegfx::tools::lerp( rFrom, rTo, t );
- }
- };
-
-diff --git slideshow/source/engine/shapes/viewshape.cxx slideshow/source/engine/shapes/viewshape.cxx
-index 61e07ed..84094db 100644
---- slideshow/source/engine/shapes/viewshape.cxx
-+++ slideshow/source/engine/shapes/viewshape.cxx
-@@ -59,7 +59,6 @@
-
- #include "viewshape.hxx"
- #include "tools.hxx"
--#include "lerp.hxx"
-
- #include <boost/bind.hpp>
-
-@@ -463,9 +462,9 @@ namespace slideshow
- if( mbForceUpdate || (nUpdateFlags & ALPHA) )
- {
- mpSprite->setAlpha( (pAttr && pAttr->isAlphaValid()) ?
-- ::canvas::tools::clamp(pAttr->getAlpha(),
-- 0.0,
-- 1.0) :
-+ ::basegfx::clamp(pAttr->getAlpha(),
-+ 0.0,
-+ 1.0) :
- 1.0 );
- }
- if( mbForceUpdate || (nUpdateFlags & CLIP) )
-diff --git slideshow/source/engine/tools.cxx slideshow/source/engine/tools.cxx
-index b4caa0a..ecac060 100644
---- slideshow/source/engine/tools.cxx
-+++ slideshow/source/engine/tools.cxx
-@@ -51,10 +51,10 @@
- #include <basegfx/vector/b2ivector.hxx>
- #include <basegfx/matrix/b2dhommatrix.hxx>
- #include <basegfx/numeric/ftools.hxx>
-+#include <basegfx/tools/lerp.hxx>
-
- #include <cppcanvas/basegfxfactory.hxx>
-
--#include "lerp.hxx"
- #include "unoview.hxx"
- #include "smilfunctionparser.hxx"
- #include "tools.hxx"
-@@ -641,18 +641,18 @@ namespace slideshow
- const ::basegfx::B2DRange& rShapeBounds )
- {
- return ::basegfx::B2DRectangle(
-- lerp( rShapeBounds.getMinX(),
-- rShapeBounds.getMaxX(),
-- rUnitBounds.getMinX() ),
-- lerp( rShapeBounds.getMinY(),
-- rShapeBounds.getMaxY(),
-- rUnitBounds.getMinY() ),
-- lerp( rShapeBounds.getMinX(),
-- rShapeBounds.getMaxX(),
-- rUnitBounds.getMaxX() ),
-- lerp( rShapeBounds.getMinY(),
-- rShapeBounds.getMaxY(),
-- rUnitBounds.getMaxY() ) );
-+ basegfx::tools::lerp( rShapeBounds.getMinX(),
-+ rShapeBounds.getMaxX(),
-+ rUnitBounds.getMinX() ),
-+ basegfx::tools::lerp( rShapeBounds.getMinY(),
-+ rShapeBounds.getMaxY(),
-+ rUnitBounds.getMinY() ),
-+ basegfx::tools::lerp( rShapeBounds.getMinX(),
-+ rShapeBounds.getMaxX(),
-+ rUnitBounds.getMaxX() ),
-+ basegfx::tools::lerp( rShapeBounds.getMinY(),
-+ rShapeBounds.getMaxY(),
-+ rUnitBounds.getMaxY() ) );
- }
-
- ::basegfx::B2DRectangle getShapePosSize( const ::basegfx::B2DRectangle& rOrigBounds,
-diff --git slideshow/source/inc/lerp.hxx slideshow/source/inc/lerp.hxx
-deleted file mode 100644
-index 83f3da0..0000000
---- slideshow/source/inc/lerp.hxx
-+++ /dev/null
-@@ -1,62 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: lerp.hxx,v $
-- * $Revision: 1.6 $
-- *
-- * 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 INCLUDED_SLIDESHOW_LERP_HXX
--#define INCLUDED_SLIDESHOW_LERP_HXX
--
--#include <sal/types.h>
--
--namespace slideshow
--{
-- namespace internal
-- {
--
-- /** Generic linear interpolator
--
-- @tpl ValueType
-- Must have operator+ and operator* defined, and should
-- have value semantics.
--
-- @param t
-- As usual, t must be in the [0,1] range
-- */
-- template< typename ValueType > ValueType lerp( const ValueType& rFrom,
-- const ValueType& rTo,
-- double t )
-- {
-- // This is only to suppress a double->int warning. All other
-- // types should be okay here.
-- return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
-- }
--
-- }
--}
--
--#endif /* INCLUDED_SLIDESHOW_LERP_HXX */
diff --git a/patches/test/chart-stacked-category-labels-chart2.diff b/patches/test/chart-stacked-category-labels-chart2.diff
deleted file mode 100644
index d9b0bd51a..000000000
--- a/patches/test/chart-stacked-category-labels-chart2.diff
+++ /dev/null
@@ -1,386 +0,0 @@
-Only in chart2: output.log
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/tools/CommonConverters.cxx chart2/source/tools/CommonConverters.cxx
---- chart2.clean/source/tools/CommonConverters.cxx 2008-02-15 09:45:06.000000000 -0500
-+++ chart2/source/tools/CommonConverters.cxx 2008-02-15 18:17:38.000000000 -0500
-@@ -816,6 +816,12 @@ uno::Sequence< rtl::OUString > DataSeque
- if( xTextualDataSequence.is() )
- {
- aResult = xTextualDataSequence->getTextualData();
-+ for (sal_Int16 i = 0; i < aResult.getLength(); ++i)
-+ {
-+ fprintf(stdout, "chart::DataSequenceToStringSequence: string = '%s'\n",
-+ rtl::OUStringToOString(aResult[i], RTL_TEXTENCODING_UTF8).getStr());
-+ fflush(stdout);
-+ }
- }
- else
- {
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/view/axes/VCartesianAxis.cxx chart2/source/view/axes/VCartesianAxis.cxx
---- chart2.clean/source/view/axes/VCartesianAxis.cxx 2008-02-15 09:45:05.000000000 -0500
-+++ chart2/source/view/axes/VCartesianAxis.cxx 2008-02-18 23:16:39.000000000 -0500
-@@ -74,7 +74,7 @@
-
- #include <algorithm>
- #include <memory>
--
-+#include <stdio.h>
- //.............................................................................
- namespace chart
- {
-@@ -637,6 +637,7 @@ bool VCartesianAxis::createTextShapes(
- , AxisLabelProperties& rAxisLabelProperties
- , TickmarkHelper_2D* pTickmarkHelper )
- {
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: --begin\n");fflush(stdout);
- //returns true if the text shapes have been created succesfully
- //otherwise false - in this case the AxisLabelProperties have changed
- //and contain new instructions for the next try for text shape creation
-@@ -652,6 +653,9 @@ bool VCartesianAxis::createTextShapes(
-
- B2DVector aTextToTickDistance( pTickmarkHelper->getDistanceTickToText( m_aAxisProperties ) );
-
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: text to tick distance: (%g,%g)\n",
-+ aTextToTickDistance.getX(), aTextToTickDistance.getY());fflush(stdout);
-+
- TickInfo* pPreviousVisibleTickInfo = NULL;
- TickInfo* pPREPreviousVisibleTickInfo = NULL;
- TickInfo* pLastVisibleNeighbourTickInfo = NULL;
-@@ -699,6 +703,7 @@ bool VCartesianAxis::createTextShapes(
- ; pTickInfo
- ; pTickInfo = rTickIter.nextInfo(), nTick++ )
- {
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: --- tick ---\n");fflush(stdout);
- pLastVisibleNeighbourTickInfo = bIsStaggered ?
- pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo;
-
-@@ -757,6 +762,9 @@ bool VCartesianAxis::createTextShapes(
- else
- aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
-
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: label = '%s'\n",
-+ rtl::OUStringToOString(aLabel, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+
- if(pColorAny)
- *pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
-
-@@ -766,6 +774,9 @@ bool VCartesianAxis::createTextShapes(
- static_cast<sal_Int32>(aTickScreenPos2D.getX())
- ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
-
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: anchor screen pos: (%ld,%ld)\n",
-+ aAnchorScreenPosition2D.X, aAnchorScreenPosition2D.Y);fflush(stdout);
-+
- //create single label
- if(!pTickInfo->xTextShape.is())
- pTickInfo->xTextShape = createSingleLabel( m_xShapeFactory, xTarget
-@@ -777,6 +788,14 @@ bool VCartesianAxis::createTextShapes(
-
- recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
-
-+// if (aTextToTickDistance.getY() > 200)
-+// {
-+// aAnchorScreenPosition2D.Y += 1000;
-+// uno::Any aATransformation = ShapeFactory::makeTransformation( aAnchorScreenPosition2D, 0.0 );
-+// Reference< drawing::XShape > xShape2DText = ShapeFactory(m_xShapeFactory).createText(
-+// xTarget, rtl::OUString::createFromAscii("Foo"), aPropNames, aPropValues, aATransformation );
-+// }
-+
- //if NO OVERLAP -> remove overlapping shapes
- if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
- {
-@@ -813,6 +832,8 @@ bool VCartesianAxis::createTextShapes(
- pPREPreviousVisibleTickInfo = pPreviousVisibleTickInfo;
- pPreviousVisibleTickInfo = pTickInfo;
- }
-+ fprintf(stdout, "VCartesianAxis::createTextShapes: --end [max = (%d,%d)]\n",
-+ m_nMaximumTextWidthSoFar, m_nMaximumTextHeightSoFar);fflush(stdout);
- return true;
- }
-
-@@ -1064,6 +1085,7 @@ void SAL_CALL VCartesianAxis::createMaxi
-
- void SAL_CALL VCartesianAxis::updatePositions()
- {
-+ fprintf(stdout, "VCartesianAxis::updatePositions: --begin\n");fflush(stdout);
- //-----------------------------------------
- //update positions of labels
- if( m_aAxisProperties.m_bDisplayLabels )
-@@ -1090,8 +1112,12 @@ void SAL_CALL VCartesianAxis::updatePosi
- if( xShape2DText.is() )
- {
- B2DVector aTextToTickDistance( pTickmarkHelper2D->getDistanceTickToText( m_aAxisProperties ) );
-+ fprintf(stdout, "VCartesianAxis::updatePositions: text-to-tick distance = (%g,%g)\n",
-+ aTextToTickDistance.getX(), aTextToTickDistance.getY());fflush(stdout);
- B2DVector aTickScreenPos2D( pTickInfo->aTickScreenPosition );
- aTickScreenPos2D += aTextToTickDistance;
-+ fprintf(stdout, "VCartesianAxis::updatePositions: tick pos = (%g,%g)\n",
-+ aTickScreenPos2D.getX(), aTickScreenPos2D.getY());fflush(stdout);
- awt::Point aAnchorScreenPosition2D(
- static_cast<sal_Int32>(aTickScreenPos2D.getX())
- ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
-@@ -1123,6 +1149,7 @@ void SAL_CALL VCartesianAxis::updatePosi
-
- doStaggeringOfLabels( m_aAxisLabelProperties, pTickmarkHelper2D );
- }
-+ fprintf(stdout, "VCartesianAxis::updatePositions: --end\n");fflush(stdout);
- }
-
- void SAL_CALL VCartesianAxis::createShapes()
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/view/axes/VCartesianCoordinateSystem.cxx chart2/source/view/axes/VCartesianCoordinateSystem.cxx
---- chart2.clean/source/view/axes/VCartesianCoordinateSystem.cxx 2008-02-15 09:45:05.000000000 -0500
-+++ chart2/source/view/axes/VCartesianCoordinateSystem.cxx 2008-02-18 23:17:11.000000000 -0500
-@@ -139,9 +139,13 @@ void VCartesianCoordinateSystem::createV
-
- for( nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
- {
-+ fprintf(stdout, "VCartesianCoordinateSystem::createVAxisList: dim = %ld\n", nDimensionIndex);fflush(stdout);
-+
- sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
- for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
- {
-+ fprintf(stdout, "VCartesianCoordinateSystem::createVAxisList: axis = %ld\n", nAxisIndex);fflush(stdout);
-+
- Reference< XAxis > xAxis = this->getAxisByDimension(nDimensionIndex,nAxisIndex);
- if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
- continue;
-@@ -168,6 +172,7 @@ void VCartesianCoordinateSystem::createV
- apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
- }
- }
-+ fprintf(stdout, "VCartesianCoordinateSystem::createVAxisList: --end\n");fflush(stdout);
- }
-
- void VCartesianCoordinateSystem::initVAxisInList()
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/view/axes/VCoordinateSystem.cxx chart2/source/view/axes/VCoordinateSystem.cxx
---- chart2.clean/source/view/axes/VCoordinateSystem.cxx 2008-02-15 09:45:05.000000000 -0500
-+++ chart2/source/view/axes/VCoordinateSystem.cxx 2008-02-18 17:54:33.000000000 -0500
-@@ -485,6 +485,7 @@ void VCoordinateSystem::setExplicitScale
-
- void VCoordinateSystem::createMaximumAxesLabels()
- {
-+ fprintf(stdout, "VCoordinateSystem::createMaximumAxesLabels: --begin\n");fflush(stdout);
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
-@@ -497,6 +498,7 @@ void VCoordinateSystem::createMaximumAxe
- pVAxis->createMaximumLabels();
- }
- }
-+ fprintf(stdout, "VCoordinateSystem::createMaximumAxesLabels: --end\n");fflush(stdout);
- }
- void VCoordinateSystem::createAxesLabels()
- {
-@@ -504,6 +506,7 @@ void VCoordinateSystem::createAxesLabels
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
- {
-+ fprintf(stdout, "VCoordinateSystem::createAxesLabels: --- axis ---\n");fflush(stdout);
- VAxisBase* pVAxis = aIt->second.get();
- if( pVAxis )
- {
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/view/diagram/VDiagram.cxx chart2/source/view/diagram/VDiagram.cxx
---- chart2.clean/source/view/diagram/VDiagram.cxx 2008-02-15 09:45:05.000000000 -0500
-+++ chart2/source/view/diagram/VDiagram.cxx 2008-02-18 03:04:41.000000000 -0500
-@@ -788,11 +788,30 @@ void VDiagram::reduceToMimimumSize()
- awt::Point aNewPos( m_aCurrentPosWithoutAxes );
- awt::Size aNewSize( m_aCurrentSizeWithoutAxes );
-
-+ fprintf(stdout, "VDiagram::adjustInnerSize: consumed outer (x = %ld, y = %ld, w = %ld, h = %ld)\n",
-+ rConsumedOuterRect.getMinX(), rConsumedOuterRect.getMinY(),
-+ static_cast<sal_Int32>(rConsumedOuterRect.getWidth()),
-+ static_cast<sal_Int32>(rConsumedOuterRect.getHeight()));fflush(stdout);
-+ fprintf(stdout, "VDiagram::adjustInnerSize: current shape (x = %ld, y = %ld, w = %ld, h = %ld)\n",
-+ aNewPos.X, aNewPos.Y, aNewSize.Width, aNewSize.Height);
-+ fprintf(stdout, "VDiagram::adjustInnerSize: available area (x = %ld, y = %ld, w = %ld, h = %ld)\n",
-+ m_aAvailablePosIncludingAxes.X, m_aAvailablePosIncludingAxes.Y,
-+ m_aAvailableSizeIncludingAxes.Width, m_aAvailableSizeIncludingAxes.Height);
-+ fflush(stdout);
-+// return adjustPosAndSize(m_aAvailablePosIncludingAxes, m_aAvailableSizeIncludingAxes);
-+// return adjustPosAndSize( aNewPos, aNewSize );
-+
- ::basegfx::B2IRectangle rAvailableOuterRect(
- BaseGFXHelper::makeRectangle(m_aAvailablePosIncludingAxes,m_aAvailableSizeIncludingAxes) );
-+ fprintf(stdout, "VDiagram::adjustInnerSize: available outer (x = %ld, y = %ld, w = %ld, h = %ld)\n",
-+ rAvailableOuterRect.getMinX(), rAvailableOuterRect.getMinY(),
-+ static_cast<sal_Int32>(rAvailableOuterRect.getWidth()),
-+ static_cast<sal_Int32>(rAvailableOuterRect.getHeight()));fflush(stdout);
-
- sal_Int32 nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth() - rConsumedOuterRect.getWidth());
- sal_Int32 nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight() - rConsumedOuterRect.getHeight());
-+ fprintf(stdout, "VDiagram::adjustInnerSize: 1 delta width = %ld delta height = %ld\n",
-+ nDeltaWidth, nDeltaHeight);fflush(stdout);
- if( (aNewSize.Width + nDeltaWidth) < rAvailableOuterRect.getWidth()/3 )
- nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth()/3 - aNewSize.Width);
- aNewSize.Width += nDeltaWidth;
-@@ -800,6 +819,8 @@ void VDiagram::reduceToMimimumSize()
- if( (aNewSize.Height + nDeltaHeight) < rAvailableOuterRect.getHeight()/3 )
- nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight()/3 - aNewSize.Height);
- aNewSize.Height += nDeltaHeight;
-+ fprintf(stdout, "VDiagram::adjustInnerSize: 2 delta width = %ld delta height = %ld\n",
-+ nDeltaWidth, nDeltaHeight);fflush(stdout);
-
- sal_Int32 nDiffLeft = rConsumedOuterRect.getMinX() - rAvailableOuterRect.getMinX();
- sal_Int32 nDiffRight = rAvailableOuterRect.getMaxX() - rConsumedOuterRect.getMaxX();
-@@ -829,6 +850,9 @@ void VDiagram::reduceToMimimumSize()
- aNewPos.Y += abs(nDeltaHeight);
- }
-
-+ fprintf(stdout, "VDiagram::adjustInnerSize: new shape (x = %ld, y = %ld, w = %ld, h = %ld)\n",
-+ aNewPos.X, aNewPos.Y, aNewSize.Width, aNewSize.Height);fflush(stdout);
-+
- return adjustPosAndSize( aNewPos, aNewSize );
- }
-
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=chart2.vpj chart2.clean/source/view/main/ChartView.cxx chart2/source/view/main/ChartView.cxx
---- chart2.clean/source/view/main/ChartView.cxx 2008-02-15 09:45:05.000000000 -0500
-+++ chart2/source/view/main/ChartView.cxx 2008-02-18 23:20:59.000000000 -0500
-@@ -158,7 +158,7 @@
- #ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
- #include <com/sun/star/util/NumberFormat.hpp>
- #endif
--
-+#include <stdio.h>
- //.............................................................................
- namespace chart
- {
-@@ -1079,12 +1079,14 @@ void ChartView::impl_createDiagramAndCon
- , const awt::Size& rAvailableSize
- , const awt::Size& rPageSize )
- {
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: --begin ++++++++++++++++++++++++++++++\n");fflush(stdout);
- // sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
- if( !xDiagram.is())
- return;
-
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: dimension count = %ld\n", nDimensionCount);fflush(stdout);
- if(!nDimensionCount)
- {
- //@todo handle mixed dimension
-@@ -1093,9 +1095,16 @@ void ChartView::impl_createDiagramAndCon
-
- ::basegfx::B2IRectangle aAvailableOuterRect( BaseGFXHelper::makeRectangle(rAvailablePos,rAvailableSize) );
-
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: available outer: [ min: (%ld,%ld); max (%ld,%ld) ]\n",
-+ aAvailableOuterRect.getMinX(), aAvailableOuterRect.getMinY(),
-+ aAvailableOuterRect.getMaxX(), aAvailableOuterRect.getMaxY());
-+
- const std::vector< VCoordinateSystem* >& rVCooSysList( rSeriesPlotterContainer.getCooSysList() );
- const std::vector< VSeriesPlotter* >& rSeriesPlotterList( rSeriesPlotterContainer.getSeriesPlotterList() );
-
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: coordinate system size = %ld\n", rVCooSysList.size());
-+ fflush(stdout);
-+
- //create VAxis, so they can give necessary information for automatic scaling
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( m_xChartModel, uno::UNO_QUERY );
- size_t nC = 0;
-@@ -1134,12 +1143,24 @@ void ChartView::impl_createDiagramAndCon
- }
-
- uno::Reference< drawing::XShapes > xTextTargetShapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxes_Shapes) );
--
-+ {
-+ uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY );
-+
-+ ::basegfx::B2IRectangle aFirstConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) );
-+
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: check %d: [ min: (%ld,%ld); max (%ld,%ld); width %ld; height %ld ]\n",
-+ __LINE__,
-+ aFirstConsumedOuterRect.getMinX(), aFirstConsumedOuterRect.getMinY(),
-+ aFirstConsumedOuterRect.getMaxX(), aFirstConsumedOuterRect.getMaxY(),
-+ static_cast<sal_Int32>(aFirstConsumedOuterRect.getWidth()),
-+ static_cast<sal_Int32>(aFirstConsumedOuterRect.getHeight()));
-+ }
- // - create axis and grids for all coordinate systems
-
- //init all coordinate systems
- for( nC=0; nC < rVCooSysList.size(); nC++)
- {
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: coordinate %d\n", nC);fflush(stdout);
- VCoordinateSystem* pVCooSys = rVCooSysList[nC];
- pVCooSys->initPlottingTargets(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory);
-
-@@ -1159,11 +1180,29 @@ void ChartView::impl_createDiagramAndCon
-
- ::basegfx::B2IRectangle aFirstConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) );
-
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: initial: [ min: (%ld,%ld); max (%ld,%ld); width %ld; height %ld ]\n",
-+ aFirstConsumedOuterRect.getMinX(), aFirstConsumedOuterRect.getMinY(),
-+ aFirstConsumedOuterRect.getMaxX(), aFirstConsumedOuterRect.getMaxY(),
-+ static_cast<sal_Int32>(aFirstConsumedOuterRect.getWidth()),
-+ static_cast<sal_Int32>(aFirstConsumedOuterRect.getHeight()));
-+
- VCoordinateSystem* pVCooSys = rVCooSysList[0];
- pVCooSys->createMaximumAxesLabels();
-
- ::basegfx::B2IRectangle aConsumedOuterRect( ShapeFactory::getRectangleOfShape(xBoundingShape) );
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: after axis labels: [ min: (%ld,%ld); max (%ld,%ld); width %ld; height %ld ]\n",
-+ aConsumedOuterRect.getMinX(), aConsumedOuterRect.getMinY(),
-+ aConsumedOuterRect.getMaxX(), aConsumedOuterRect.getMaxY(),
-+ static_cast<sal_Int32>(aConsumedOuterRect.getWidth()),
-+ static_cast<sal_Int32>(aConsumedOuterRect.getHeight()));
-+
- ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.adjustInnerSize( aConsumedOuterRect ) );
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: first adjustment: [ min: (%ld,%ld); max (%ld,%ld); width %ld; height %ld ]\n",
-+ aNewInnerRect.getMinX(), aNewInnerRect.getMinY(),
-+ aNewInnerRect.getMaxX(), aNewInnerRect.getMaxY(),
-+ static_cast<sal_Int32>(aNewInnerRect.getWidth()),
-+ static_cast<sal_Int32>(aNewInnerRect.getHeight()));
-+ fflush(stdout);
-
- pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
- createTransformationSceneToScreen( aNewInnerRect ) ));
-@@ -1189,11 +1228,18 @@ void ChartView::impl_createDiagramAndCon
- if( bLessSpaceConsumedThanExpected )
- {
- aVDiagram.adjustInnerSize( aConsumedOuterRect );
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: second adjustment: [ min: (%ld,%ld); max (%ld,%ld); width %ld; height %ld ]\n",
-+ aConsumedOuterRect.getMinX(), aConsumedOuterRect.getMinY(),
-+ aConsumedOuterRect.getMaxX(), aConsumedOuterRect.getMaxY(),
-+ static_cast<sal_Int32>(aConsumedOuterRect.getWidth()),
-+ static_cast<sal_Int32>(aConsumedOuterRect.getHeight()));
- pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
- createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
- pVCooSys->updatePositions();
- }
- }
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: --end ++++++++++++++++++++++++++++++\n");fflush(stdout);
-+ return;
-
- //create axes and grids for the final size
- for( nC=0; nC < rVCooSysList.size(); nC++)
-@@ -1298,6 +1344,7 @@ void ChartView::impl_createDiagramAndCon
- pSeriesPlotter->rearrangeLabelToAvoidOverlapIfRequested( rPageSize );
- }
- }
-+ fprintf(stdout, "ChartView::impl_createDiagramAndContent: --end\n");fflush(stdout);
- }
-
- //-------------------------------------------------------------
-@@ -2061,6 +2108,7 @@ void ChartView::impl_refreshAddIn()
-
- void ChartView::createShapes()
- {
-+ fprintf(stdout, "ChartView::createShapes: --begin\n");fflush(stdout);
- #if OSL_DEBUG_LEVEL > 0
- clock_t nStart = clock();
- OSL_TRACE( "\nPPPPPPPPP>>>>>>>>>>>> chart view :: createShapes()" );
-@@ -2107,6 +2155,9 @@ void ChartView::createShapes()
- //create the group shape for diagram and axes first to have title and legends on top of it
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
- rtl::OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) ) );//todo: other index if more than one diagram is possible
-+ fprintf(stdout, "ChartView::createShapes: diagram CID = '%s'\n",
-+ rtl::OUStringToOString(aDiagramCID, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+
- uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xPageShapes,aDiagramCID) );
- uno::Reference< drawing::XShape > xDiagramPlusAxes_MarkHandles( ShapeFactory(m_xShapeFactory).createInvisibleRectangle(
- xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
-@@ -2197,6 +2248,7 @@ void ChartView::createShapes()
-
- OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< chart view :: createShapes():: needed %f msec", fDuration );
- #endif
-+ fprintf(stdout, "ChartView::createShapes: --end\n");fflush(stdout);
- }
-
- //-----------------------------------------------------------------
diff --git a/patches/test/chart-stacked-category-labels-sc.diff b/patches/test/chart-stacked-category-labels-sc.diff
deleted file mode 100644
index 33a32087f..000000000
--- a/patches/test/chart-stacked-category-labels-sc.diff
+++ /dev/null
@@ -1,95 +0,0 @@
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/filter/inc/fdumper.hxx sc/source/filter/inc/fdumper.hxx
---- sc.clean/source/filter/inc/fdumper.hxx 2008-02-05 11:16:59.000000000 -0500
-+++ sc/source/filter/inc/fdumper.hxx 2008-02-15 11:13:21.000000000 -0500
-@@ -36,7 +36,7 @@
- #ifndef SC_FDUMPER_HXX
- #define SC_FDUMPER_HXX
-
--#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0)
-+#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0
-
- #if SCF_INCL_DUMPER
-
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
---- sc.clean/source/ui/unoobj/chart2uno.cxx 2008-02-05 11:16:58.000000000 -0500
-+++ sc/source/ui/unoobj/chart2uno.cxx 2008-02-18 23:12:51.000000000 -0500
-@@ -80,6 +80,8 @@
- #include <rtl/math.hxx>
- #endif
-
-+#include <stdio.h>
-+
- SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider",
- "com.sun.star.chart2.data.DataProvider")
- SC_SIMPLE_SERVICE_INFO( ScChart2DataSource, "ScChart2DataSource",
-@@ -92,6 +94,9 @@ SC_SIMPLE_SERVICE_INFO( ScChart2EmptyDat
- "com.sun.star.chart2.data.DataSequence")
-
- using namespace ::com::sun::star;
-+using ::com::sun::star::uno::Sequence;
-+using ::rtl::OUString;
-+using ::std::vector;
-
- namespace
- {
-@@ -1597,6 +1602,52 @@ uno::Sequence< double > SAL_CALL ScChart
-
- uno::Sequence< rtl::OUString > SAL_CALL ScChart2DataSequence::getTextualData( ) throw (uno::RuntimeException)
- {
-+#if 1
-+ ScUnoGuard aGuard;
-+ if (!m_pDocument)
-+ throw uno::RuntimeException();
-+
-+ const OUString LB = OUString::createFromAscii("-- endline --");
-+ const OUString CONT = OUString::createFromAscii("-- cont --");
-+
-+ vector<OUString> aStrList;
-+ for (ScRangePtr p = m_xRanges->First(); p; p = m_xRanges->Next())
-+ {
-+ fprintf(stdout, "ScChart2DataSequence::getTextualData: range: tab: %d; (%d, %d) - (%d, %d)\n",
-+ p->aStart.Tab(), p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row());
-+ fflush(stdout);
-+ const ScAddress& rStart = p->aStart;
-+ const ScAddress& rEnd = p->aEnd;
-+ for (SCTAB nTab = rStart.Tab(); nTab <= rEnd.Tab(); ++nTab)
-+ {
-+ for (SCCOL nCol = rStart.Col(); nCol <= rEnd.Col(); ++nCol)
-+ {
-+ for (SCROW nRow = rStart.Row(); nRow <= rEnd.Row(); ++nRow)
-+ {
-+ String aStr;
-+ m_pDocument->GetString(nCol, nRow, nTab, aStr);
-+ bool bMerged = m_pDocument->HasAttrib(nCol,nRow,nTab,nCol,nRow,nTab, HASATTR_MERGED);
-+ bool bOverlap = m_pDocument->HasAttrib(nCol,nRow,nTab,nCol,nRow,nTab, HASATTR_OVERLAPPED);
-+ fprintf(stdout, "ScChart2DataSequence::getTextualData: tab: %d; cell: (%d, %ld) - (merged %d; overlapped: %d) : '%s'\n",
-+ nTab, nCol, nRow, bMerged, bOverlap,
-+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+ if (bOverlap)
-+ aStrList.push_back(CONT);
-+ else
-+ aStrList.push_back(aStr);
-+ }
-+ aStrList.push_back(LB);
-+ }
-+ aStrList.push_back(LB);
-+ }
-+ aStrList.push_back(LB);
-+ }
-+
-+ Sequence<OUString> aSeq(aStrList.size());
-+ for (sal_Int32 i = 0; i < aSeq.getLength(); ++i)
-+ aSeq[i] = aStrList[i];
-+ return aSeq;
-+#else
- ScUnoGuard aGuard;
- if ( !m_pDocument)
- throw uno::RuntimeException();
-@@ -1645,6 +1696,7 @@ uno::Sequence< rtl::OUString > SAL_CALL
- }
- }
- return aSeq;
-+#endif
- }
-
- ::rtl::OUString SAL_CALL ScChart2DataSequence::getSourceRangeRepresentation()
diff --git a/patches/test/chartapisnappshot.tar b/patches/test/chartapisnappshot.tar
deleted file mode 100644
index 98d14c6da..000000000
--- a/patches/test/chartapisnappshot.tar
+++ /dev/null
Binary files differ
diff --git a/patches/test/clipstate.diff b/patches/test/clipstate.diff
deleted file mode 100644
index 08c2ad967..000000000
--- a/patches/test/clipstate.diff
+++ /dev/null
@@ -1,1416 +0,0 @@
-A clipstate object, performing lazy updates of clip polygon
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- basegfx/inc/basegfx/range/b2dpolyrange.hxx | 6
- basegfx/inc/basegfx/tools/b2dclipstate.hxx | 119 +++++
- basegfx/prj/d.lst | 3
- basegfx/qa/mkpolygons.pl | 0
- basegfx/source/range/b2dpolyrange.cxx | 40 ++
- basegfx/source/tools/b2dclipstate.cxx | 662 ++++++++++++++++++++++++++++
- basegfx/source/tools/makefile.mk | 3
- basegfx/test/basegfx2d.cxx | 6
- basegfx/test/clipstate.cxx | 187 ++++++++
- basegfx/test/genericclipper.cxx | 168 +++++++
- basegfx/test/makefile.mk | 8
- slideshow/source/engine/slide/layer.cxx | 11
- slideshow/source/engine/slide/layer.hxx | 6
- 13 files changed, 1206 insertions(+), 13 deletions(-)
- create mode 100644 basegfx/inc/basegfx/tools/b2dclipstate.hxx
- mode change 100644 => 100755 basegfx/qa/mkpolygons.pl
- create mode 100644 basegfx/source/tools/b2dclipstate.cxx
- create mode 100644 basegfx/test/clipstate.cxx
- create mode 100644 basegfx/test/genericclipper.cxx
-
-
-diff --git basegfx/inc/basegfx/range/b2dpolyrange.hxx basegfx/inc/basegfx/range/b2dpolyrange.hxx
-index 0c07dc2..ad53552 100644
---- basegfx/inc/basegfx/range/b2dpolyrange.hxx
-+++ basegfx/inc/basegfx/range/b2dpolyrange.hxx
-@@ -131,6 +131,12 @@ namespace basegfx
- */
- B2DPolyPolygon solveCrossovers() const;
-
-+ // element iterators
-+ const B2DRange* begin() const;
-+ const B2DRange* end() const;
-+ B2DRange* begin();
-+ B2DRange* end();
-+
- private:
- o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
- };
-diff --git basegfx/inc/basegfx/tools/b2dclipstate.hxx basegfx/inc/basegfx/tools/b2dclipstate.hxx
-new file mode 100644
-index 0000000..92b1578
---- /dev/null
-+++ basegfx/inc/basegfx/tools/b2dclipstate.hxx
-@@ -0,0 +1,119 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: rectcliptools.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 _BGFX_TOOLS_CLIPSTATE_HXX
-+#define _BGFX_TOOLS_CLIPSTATE_HXX
-+
-+#include <sal/types.h>
-+#include <o3tl/cow_wrapper.hxx>
-+
-+//////////////////////////////////////////////////////////////////////////////
-+
-+namespace basegfx
-+{
-+ class B2DRange;
-+ class B2DPolyRange;
-+ class B2DPolygon;
-+ class B2DPolyPolygon;
-+
-+ namespace tools
-+ {
-+ class ImplB2DClipState;
-+
-+ /** This class provides an optimized, symbolic clip state for graphical output
-+
-+ Having a current 'clip' state is a common attribute of
-+ almost all graphic output APIs, most of which internally
-+ represent it via a list of rectangular bands. In contrast,
-+ this implementation purely uses symbolic clips, but in a
-+ quite efficient manner, deferring actual evaluation until
-+ a clip representation is requested, and using faster code
-+ paths for common special cases (like all-rectangle clips)
-+ */
-+ class B2DClipState
-+ {
-+ public:
-+ typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
-+
-+ private:
-+ ImplType mpImpl;
-+
-+ public:
-+ /// Init clip, in 'cleared' state - everything is visible
-+ B2DClipState();
-+ ~B2DClipState();
-+ B2DClipState( const B2DClipState& );
-+ explicit B2DClipState( const B2DRange& );
-+ explicit B2DClipState( const B2DPolygon& );
-+ explicit B2DClipState( const B2DPolyPolygon& );
-+ B2DClipState& operator=( const B2DClipState& );
-+
-+ /// unshare this poly-range with all internally shared instances
-+ void makeUnique();
-+
-+ /// Set clip to 'null' - nothing is visible
-+ void makeNull();
-+ /// returns true when clip is 'null' - nothing is visible
-+ bool isNull() const;
-+
-+ /// Set clip 'cleared' - everything is visible
-+ void makeClear();
-+ /// returns true when clip is 'cleared' - everything is visible
-+ bool isCleared() const;
-+
-+ bool operator==(const B2DClipState&) const;
-+ bool operator!=(const B2DClipState&) const;
-+
-+ void unionRange(const B2DRange& );
-+ void unionPolygon(const B2DPolygon& );
-+ void unionPolyPolygon(const B2DPolyPolygon& );
-+ void unionClipState(const B2DClipState& );
-+
-+ void intersectRange(const B2DRange& );
-+ void intersectPolygon(const B2DPolygon& );
-+ void intersectPolyPolygon(const B2DPolyPolygon& );
-+ void intersectClipState(const B2DClipState& );
-+
-+ void subtractRange(const B2DRange& );
-+ void subtractPolygon(const B2DPolygon& );
-+ void subtractPolyPolygon(const B2DPolyPolygon& );
-+ void subtractClipState(const B2DClipState& );
-+
-+ void xorRange(const B2DRange& );
-+ void xorPolygon(const B2DPolygon& );
-+ void xorPolyPolygon(const B2DPolyPolygon& );
-+ void xorClipState(const B2DClipState& );
-+
-+ B2DPolyPolygon getClipPoly() const;
-+ };
-+ }
-+}
-+
-+#endif // _BGFX_TOOLS_CLIPSTATE_HXX
-diff --git basegfx/prj/d.lst basegfx/prj/d.lst
-index 9dd6085..9c54511 100644
---- basegfx/prj/d.lst
-+++ basegfx/prj/d.lst
-@@ -27,7 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\range
- ..\inc\basegfx\range\basicrange.hxx %_DEST%\inc%_EXT%\basegfx\range\basicrange.hxx
- ..\inc\basegfx\range\basicbox.hxx %_DEST%\inc%_EXT%\basegfx\range\basicbox.hxx
- ..\inc\basegfx\range\b1drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b1drange.hxx
--..\inc\basegfx\range\b2dmultirange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dmultirange.hxx
-+..\inc\basegfx\range\b2dpolyrange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dpolyrange.hxx
- ..\inc\basegfx\range\b2drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drange.hxx
- ..\inc\basegfx\range\b2drectangle.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drectangle.hxx
- ..\inc\basegfx\range\b2dconnectedranges.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dconnectedranges.hxx
-@@ -90,6 +90,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tuple
- mkdir: %_DEST%\inc%_EXT%\basegfx\tools
- ..\inc\basegfx\tools\canvastools.hxx %_DEST%\inc%_EXT%\basegfx\tools\canvastools.hxx
- ..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx
-+..\inc\basegfx\tools\b2dclipstate.hxx %_DEST%\inc%_EXT%\basegfx\tools\b2dclipstate.hxx
- ..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx
- ..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx
- ..\inc\basegfx\tools\gradienttools.hxx %_DEST%\inc%_EXT%\basegfx\tools\gradienttools.hxx
-diff --git basegfx/qa/mkpolygons.pl basegfx/qa/mkpolygons.pl
-old mode 100644
-new mode 100755
-diff --git basegfx/source/range/b2dpolyrange.cxx basegfx/source/range/b2dpolyrange.cxx
-index ae94f14..a69cd5b 100644
---- basegfx/source/range/b2dpolyrange.cxx
-+++ basegfx/source/range/b2dpolyrange.cxx
-@@ -227,6 +227,26 @@ namespace basegfx
- return tools::solveCrossovers(maRanges,maOrient);
- }
-
-+ const B2DRange* begin() const
-+ {
-+ return &maRanges.front();
-+ }
-+
-+ const B2DRange* end() const
-+ {
-+ return &maRanges[maRanges.size()];
-+ }
-+
-+ B2DRange* begin()
-+ {
-+ return &maRanges.front();
-+ }
-+
-+ B2DRange* end()
-+ {
-+ return &maRanges[maRanges.size()];
-+ }
-+
- private:
- B2DRange maBounds;
- std::vector<B2DRange> maRanges;
-@@ -366,6 +386,26 @@ namespace basegfx
- return mpImpl->solveCrossovers();
- }
-
-+ const B2DRange* B2DPolyRange::begin() const
-+ {
-+ return mpImpl->begin();
-+ }
-+
-+ const B2DRange* B2DPolyRange::end() const
-+ {
-+ return mpImpl->end();
-+ }
-+
-+ B2DRange* B2DPolyRange::begin()
-+ {
-+ return mpImpl->begin();
-+ }
-+
-+ B2DRange* B2DPolyRange::end()
-+ {
-+ return mpImpl->end();
-+ }
-+
- } // end of namespace basegfx
-
- // eof
-diff --git basegfx/source/tools/b2dclipstate.cxx basegfx/source/tools/b2dclipstate.cxx
-new file mode 100644
-index 0000000..f203d4f
---- /dev/null
-+++ basegfx/source/tools/b2dclipstate.cxx
-@@ -0,0 +1,662 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dmultirange.cxx,v $
-+ * $Revision: 1.8 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+#include <basegfx/tools/b2dclipstate.hxx>
-+
-+#include <basegfx/range/b2drange.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <basegfx/range/b2drangeclipper.hxx>
-+#include <basegfx/polygon/b2dpolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-+
-+namespace basegfx
-+{
-+namespace tools
-+{
-+ struct ImplB2DClipState
-+ {
-+ public:
-+ enum Operation {UNION, INTERSECT, XOR, SUBTRACT};
-+
-+ ImplB2DClipState() :
-+ maPendingPolygons(),
-+ maPendingRanges(),
-+ maClipPoly(),
-+ mePendingOps(UNION)
-+ {}
-+
-+ explicit ImplB2DClipState( const B2DRange& rRange ) :
-+ maPendingPolygons(),
-+ maPendingRanges(),
-+ maClipPoly(
-+ tools::createPolygonFromRect(rRange)),
-+ mePendingOps(UNION)
-+ {}
-+
-+ explicit ImplB2DClipState( const B2DPolygon& rPoly ) :
-+ maPendingPolygons(),
-+ maPendingRanges(),
-+ maClipPoly(rPoly),
-+ mePendingOps(UNION)
-+ {}
-+
-+ explicit ImplB2DClipState( const B2DPolyPolygon& rPoly ) :
-+ maPendingPolygons(),
-+ maPendingRanges(),
-+ maClipPoly(rPoly),
-+ mePendingOps(UNION)
-+ {}
-+
-+ bool isCleared() const
-+ {
-+ return !maClipPoly.count()
-+ && !maPendingPolygons.count()
-+ && !maPendingRanges.count();
-+ }
-+
-+ void makeClear()
-+ {
-+ maPendingPolygons.clear();
-+ maPendingRanges.clear();
-+ maClipPoly.clear();
-+ mePendingOps = UNION;
-+ }
-+
-+ bool isNullClipPoly() const
-+ {
-+ return maClipPoly.count() == 1
-+ && !maClipPoly.getB2DPolygon(0).count();
-+ }
-+
-+ bool isNull() const
-+ {
-+ return !maPendingPolygons.count()
-+ && !maPendingRanges.count()
-+ && isNullClipPoly();
-+ }
-+
-+ void makeNull()
-+ {
-+ maPendingPolygons.clear();
-+ maPendingRanges.clear();
-+ maClipPoly.clear();
-+ maClipPoly.append(B2DPolygon());
-+ mePendingOps = UNION;
-+ }
-+
-+ bool operator==(const ImplB2DClipState& rRHS) const
-+ {
-+ return maPendingPolygons == rRHS.maPendingPolygons
-+ && maPendingRanges == rRHS.maPendingRanges
-+ && maClipPoly == rRHS.maClipPoly
-+ && mePendingOps == rRHS.mePendingOps;
-+ }
-+
-+ void addRange(const B2DRange& rRange, Operation eOp)
-+ {
-+ if( rRange.isEmpty() )
-+ return;
-+
-+ commitPendingPolygons();
-+ if( mePendingOps != eOp )
-+ commitPendingRanges();
-+
-+ mePendingOps = eOp;
-+ maPendingRanges.appendElement(
-+ rRange,
-+ ORIENTATION_POSITIVE);
-+ }
-+
-+ void addPolygon(B2DPolygon aPoly, Operation eOp)
-+ {
-+ commitPendingRanges();
-+ if( mePendingOps != eOp )
-+ commitPendingPolygons();
-+
-+ mePendingOps = eOp;
-+ maPendingPolygons.append(aPoly);
-+ }
-+
-+ void addPolyPolygon(B2DPolyPolygon aPoly, Operation eOp)
-+ {
-+ commitPendingRanges();
-+ if( mePendingOps != eOp )
-+ commitPendingPolygons();
-+
-+ mePendingOps = eOp;
-+ maPendingPolygons.append(aPoly);
-+ }
-+
-+ void addClipState(const ImplB2DClipState& rOther, Operation eOp)
-+ {
-+ if( rOther.mePendingOps == mePendingOps
-+ && !rOther.maClipPoly.count()
-+ && !rOther.maPendingPolygons.count() )
-+ {
-+ maPendingRanges.appendPolyRange( rOther.maPendingRanges );
-+ }
-+ else
-+ {
-+ commitPendingRanges();
-+ commitPendingPolygons();
-+ rOther.commitPendingRanges();
-+ rOther.commitPendingPolygons();
-+
-+ maPendingPolygons = rOther.maClipPoly;
-+ mePendingOps = eOp;
-+ }
-+ }
-+
-+ void unionRange(const B2DRange& rRange)
-+ {
-+ if( isCleared() )
-+ return;
-+
-+ addRange(rRange,UNION);
-+ }
-+
-+ void unionPolygon(const B2DPolygon& rPoly)
-+ {
-+ if( isCleared() )
-+ return;
-+
-+ addPolygon(rPoly,UNION);
-+ }
-+
-+ void unionPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ if( isCleared() )
-+ return;
-+
-+ addPolyPolygon(rPolyPoly,UNION);
-+ }
-+
-+ void unionClipState(const ImplB2DClipState& rOther)
-+ {
-+ if( isCleared() )
-+ return;
-+
-+ addClipState(rOther, UNION);
-+ }
-+
-+ void intersectRange(const B2DRange& rRange)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addRange(rRange,INTERSECT);
-+ }
-+
-+ void intersectPolygon(const B2DPolygon& rPoly)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addPolygon(rPoly,INTERSECT);
-+ }
-+
-+ void intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addPolyPolygon(rPolyPoly,INTERSECT);
-+ }
-+
-+ void intersectClipState(const ImplB2DClipState& rOther)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addClipState(rOther, INTERSECT);
-+ }
-+
-+ void subtractRange(const B2DRange& rRange )
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addRange(rRange,SUBTRACT);
-+ }
-+
-+ void subtractPolygon(const B2DPolygon& rPoly)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addPolygon(rPoly,SUBTRACT);
-+ }
-+
-+ void subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addPolyPolygon(rPolyPoly,SUBTRACT);
-+ }
-+
-+ void subtractClipState(const ImplB2DClipState& rOther)
-+ {
-+ if( isNull() )
-+ return;
-+
-+ addClipState(rOther, SUBTRACT);
-+ }
-+
-+ void xorRange(const B2DRange& rRange)
-+ {
-+ addRange(rRange,XOR);
-+ }
-+
-+ void xorPolygon(const B2DPolygon& rPoly)
-+ {
-+ addPolygon(rPoly,XOR);
-+ }
-+
-+ void xorPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ addPolyPolygon(rPolyPoly,XOR);
-+ }
-+
-+ void xorClipState(const ImplB2DClipState& rOther)
-+ {
-+ addClipState(rOther, XOR);
-+ }
-+
-+ B2DPolyPolygon getClipPoly() const
-+ {
-+ commitPendingRanges();
-+ commitPendingPolygons();
-+
-+ return maClipPoly;
-+ }
-+
-+ private:
-+ void commitPendingPolygons() const
-+ {
-+ if( !maPendingPolygons.count() )
-+ return;
-+
-+ // assumption: maClipPoly has kept polygons prepared for
-+ // clipping; i.e. no neutral polygons & correct
-+ // orientation
-+ maPendingPolygons = tools::prepareForPolygonOperation(maPendingPolygons);
-+ const bool bIsEmpty=isNullClipPoly();
-+ const bool bIsCleared=!maClipPoly.count();
-+ switch(mePendingOps)
-+ {
-+ case UNION:
-+ OSL_ASSERT( !bIsCleared );
-+
-+ if( bIsEmpty )
-+ maClipPoly = maPendingPolygons;
-+ else
-+ maClipPoly = tools::solvePolygonOperationOr(
-+ maClipPoly,
-+ maPendingPolygons);
-+ break;
-+ case INTERSECT:
-+ OSL_ASSERT( !bIsEmpty );
-+
-+ if( bIsCleared )
-+ maClipPoly = maPendingPolygons;
-+ else
-+ maClipPoly = tools::solvePolygonOperationAnd(
-+ maClipPoly,
-+ maPendingPolygons);
-+ break;
-+ case XOR:
-+ if( bIsEmpty )
-+ maClipPoly = maPendingPolygons;
-+ else if( bIsCleared )
-+ {
-+ // not representable, strictly speaking,
-+ // using polygons with the common even/odd
-+ // or nonzero winding number fill rule. If
-+ // we'd want to represent it, fill rule
-+ // would need to be "non-negative winding
-+ // number" (and we then would return
-+ // 'holes' here)
-+
-+ // going for an ugly hack meanwhile
-+ maClipPoly = tools::solvePolygonOperationXor(
-+ B2DPolyPolygon(
-+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
-+ maPendingPolygons);
-+ }
-+ else
-+ maClipPoly = tools::solvePolygonOperationXor(
-+ maClipPoly,
-+ maPendingPolygons);
-+ break;
-+ case SUBTRACT:
-+ OSL_ASSERT( !bIsEmpty );
-+
-+ // first union all pending ones, subtract en bloc then
-+ maPendingPolygons = solveCrossovers(maPendingPolygons);
-+ maPendingPolygons = stripNeutralPolygons(maPendingPolygons);
-+ maPendingPolygons = stripDispensablePolygons(maPendingPolygons, false);
-+
-+ if( bIsCleared )
-+ {
-+ // not representable, strictly speaking,
-+ // using polygons with the common even/odd
-+ // or nonzero winding number fill rule. If
-+ // we'd want to represent it, fill rule
-+ // would need to be "non-negative winding
-+ // number" (and we then would return
-+ // 'holes' here)
-+
-+ // going for an ugly hack meanwhile
-+ maClipPoly = tools::solvePolygonOperationDiff(
-+ B2DPolyPolygon(
-+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
-+ maPendingPolygons);
-+ }
-+ else
-+ maClipPoly = tools::solvePolygonOperationDiff(
-+ maClipPoly,
-+ maPendingPolygons);
-+ break;
-+ }
-+
-+ maPendingPolygons.clear();
-+ mePendingOps = UNION;
-+ }
-+
-+ void commitPendingRanges() const
-+ {
-+ if( !maPendingRanges.count() )
-+ return;
-+
-+ // use the specialized range clipper for the win
-+ B2DPolyPolygon aCollectedRanges;
-+ const bool bIsEmpty=isNullClipPoly();
-+ const bool bIsCleared=!maClipPoly.count();
-+ switch(mePendingOps)
-+ {
-+ case UNION:
-+ OSL_ASSERT( !bIsCleared );
-+
-+ aCollectedRanges = maPendingRanges.solveCrossovers();
-+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
-+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false);
-+ if( bIsEmpty )
-+ maClipPoly = aCollectedRanges;
-+ else
-+ maClipPoly = tools::solvePolygonOperationOr(
-+ maClipPoly,
-+ aCollectedRanges);
-+ break;
-+ case INTERSECT:
-+ OSL_ASSERT( !bIsEmpty );
-+
-+ aCollectedRanges = maPendingRanges.solveCrossovers();
-+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
-+ if( maPendingRanges.count() > 1 )
-+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, true);
-+
-+ if( bIsCleared )
-+ maClipPoly = aCollectedRanges;
-+ else
-+ maClipPoly = tools::solvePolygonOperationAnd(
-+ maClipPoly,
-+ aCollectedRanges);
-+ break;
-+ case XOR:
-+ aCollectedRanges = maPendingRanges.solveCrossovers();
-+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
-+ aCollectedRanges = correctOrientations(aCollectedRanges);
-+
-+ if( bIsEmpty )
-+ maClipPoly = aCollectedRanges;
-+ else if( bIsCleared )
-+ {
-+ // not representable, strictly speaking,
-+ // using polygons with the common even/odd
-+ // or nonzero winding number fill rule. If
-+ // we'd want to represent it, fill rule
-+ // would need to be "non-negative winding
-+ // number" (and we then would return
-+ // 'holes' here)
-+
-+ // going for an ugly hack meanwhile
-+ maClipPoly = tools::solvePolygonOperationXor(
-+ B2DPolyPolygon(
-+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
-+ aCollectedRanges);
-+ }
-+ else
-+ maClipPoly = tools::solvePolygonOperationXor(
-+ maClipPoly,
-+ aCollectedRanges);
-+ break;
-+ case SUBTRACT:
-+ OSL_ASSERT( !bIsEmpty );
-+
-+ // first union all pending ranges, subtract en bloc then
-+ aCollectedRanges = maPendingRanges.solveCrossovers();
-+ aCollectedRanges = stripNeutralPolygons(aCollectedRanges);
-+ aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false);
-+
-+ if( bIsCleared )
-+ {
-+ // not representable, strictly speaking,
-+ // using polygons with the common even/odd
-+ // or nonzero winding number fill rule. If
-+ // we'd want to represent it, fill rule
-+ // would need to be "non-negative winding
-+ // number" (and we then would return
-+ // 'holes' here)
-+
-+ // going for an ugly hack meanwhile
-+ maClipPoly = tools::solvePolygonOperationDiff(
-+ B2DPolyPolygon(
-+ tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))),
-+ aCollectedRanges);
-+ }
-+ else
-+ maClipPoly = tools::solvePolygonOperationDiff(
-+ maClipPoly,
-+ aCollectedRanges);
-+ break;
-+ }
-+
-+ maPendingRanges.clear();
-+ mePendingOps = UNION;
-+ }
-+
-+ mutable B2DPolyPolygon maPendingPolygons;
-+ mutable B2DPolyRange maPendingRanges;
-+ mutable B2DPolyPolygon maClipPoly;
-+ mutable Operation mePendingOps;
-+ };
-+
-+ B2DClipState::B2DClipState() :
-+ mpImpl()
-+ {}
-+
-+ B2DClipState::~B2DClipState()
-+ {}
-+
-+ B2DClipState::B2DClipState( const B2DClipState& rOrig ) :
-+ mpImpl(rOrig.mpImpl)
-+ {}
-+
-+ B2DClipState::B2DClipState( const B2DRange& rRange ) :
-+ mpImpl( ImplB2DClipState(rRange) )
-+ {}
-+
-+ B2DClipState::B2DClipState( const B2DPolygon& rPoly ) :
-+ mpImpl( ImplB2DClipState(rPoly) )
-+ {}
-+
-+ B2DClipState::B2DClipState( const B2DPolyPolygon& rPolyPoly ) :
-+ mpImpl( ImplB2DClipState(rPolyPoly) )
-+ {}
-+
-+ B2DClipState& B2DClipState::operator=( const B2DClipState& rRHS )
-+ {
-+ mpImpl = rRHS.mpImpl;
-+ return *this;
-+ }
-+
-+ void B2DClipState::makeUnique()
-+ {
-+ mpImpl.make_unique();
-+ }
-+
-+ void B2DClipState::makeNull()
-+ {
-+ mpImpl->makeNull();
-+ }
-+
-+ bool B2DClipState::isNull() const
-+ {
-+ return mpImpl->isNull();
-+ }
-+
-+ void B2DClipState::makeClear()
-+ {
-+ mpImpl->makeClear();
-+ }
-+
-+ bool B2DClipState::isCleared() const
-+ {
-+ return mpImpl->isCleared();
-+ }
-+
-+ bool B2DClipState::operator==(const B2DClipState& rRHS) const
-+ {
-+ if(mpImpl.same_object(rRHS.mpImpl))
-+ return true;
-+
-+ return ((*mpImpl) == (*rRHS.mpImpl));
-+ }
-+
-+ bool B2DClipState::operator!=(const B2DClipState& rRHS) const
-+ {
-+ return !(*this == rRHS);
-+ }
-+
-+ void B2DClipState::unionRange(const B2DRange& rRange)
-+ {
-+ mpImpl->unionRange(rRange);
-+ }
-+
-+ void B2DClipState::unionPolygon(const B2DPolygon& rPoly)
-+ {
-+ mpImpl->unionPolygon(rPoly);
-+ }
-+
-+ void B2DClipState::unionPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ mpImpl->unionPolyPolygon(rPolyPoly);
-+ }
-+
-+ void B2DClipState::unionClipState(const B2DClipState& rState)
-+ {
-+ mpImpl->unionClipState(*rState.mpImpl);
-+ }
-+
-+ void B2DClipState::intersectRange(const B2DRange& rRange)
-+ {
-+ mpImpl->intersectRange(rRange);
-+ }
-+
-+ void B2DClipState::intersectPolygon(const B2DPolygon& rPoly)
-+ {
-+ mpImpl->intersectPolygon(rPoly);
-+ }
-+
-+ void B2DClipState::intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ mpImpl->intersectPolyPolygon(rPolyPoly);
-+ }
-+
-+ void B2DClipState::intersectClipState(const B2DClipState& rState)
-+ {
-+ mpImpl->intersectClipState(*rState.mpImpl);
-+ }
-+
-+ void B2DClipState::subtractRange(const B2DRange& rRange)
-+ {
-+ mpImpl->subtractRange(rRange);
-+ }
-+
-+ void B2DClipState::subtractPolygon(const B2DPolygon& rPoly)
-+ {
-+ mpImpl->subtractPolygon(rPoly);
-+ }
-+
-+ void B2DClipState::subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ mpImpl->subtractPolyPolygon(rPolyPoly);
-+ }
-+
-+ void B2DClipState::subtractClipState(const B2DClipState& rState)
-+ {
-+ mpImpl->subtractClipState(*rState.mpImpl);
-+ }
-+
-+ void B2DClipState::xorRange(const B2DRange& rRange)
-+ {
-+ mpImpl->xorRange(rRange);
-+ }
-+
-+ void B2DClipState::xorPolygon(const B2DPolygon& rPoly)
-+ {
-+ mpImpl->xorPolygon(rPoly);
-+ }
-+
-+ void B2DClipState::xorPolyPolygon(const B2DPolyPolygon& rPolyPoly)
-+ {
-+ mpImpl->xorPolyPolygon(rPolyPoly);
-+ }
-+
-+ void B2DClipState::xorClipState(const B2DClipState& rState)
-+ {
-+ mpImpl->xorClipState(*rState.mpImpl);
-+ }
-+
-+ B2DPolyPolygon B2DClipState::getClipPoly() const
-+ {
-+ return mpImpl->getClipPoly();
-+ }
-+
-+} // end of namespace tools
-+} // end of namespace basegfx
-+
-+// eof
-diff --git basegfx/source/tools/makefile.mk basegfx/source/tools/makefile.mk
-index 1bede8b..01a6818 100755
---- basegfx/source/tools/makefile.mk
-+++ basegfx/source/tools/makefile.mk
-@@ -41,7 +41,8 @@ ENABLE_EXCEPTIONS=TRUE
-
- # --- Files -------------------------------------
-
--SLOFILES= $(SLO)$/canvastools.obj \
-+SLOFILES= $(SLO)$/b2dclipstate.obj \
-+ $(SLO)$/canvastools.obj \
- $(SLO)$/gradienttools.obj \
- $(SLO)$/debugplotter.obj \
- $(SLO)$/liangbarsky.obj \
-diff --git basegfx/test/basegfx2d.cxx basegfx/test/basegfx2d.cxx
-index 8b1d659..ef49c2e 100644
---- basegfx/test/basegfx2d.cxx
-+++ basegfx/test/basegfx2d.cxx
-@@ -319,6 +319,12 @@ public:
- aRange.getElement(0).head == B2DRange(0,0,1,1));
- CPPUNIT_ASSERT_MESSAGE("simple poly range - second element",
- aRange.getElement(1).head == B2DRange(2,2,3,3));
-+
-+ // B2DPolyRange relies on correctly orientated rects
-+ const B2DRange aRect(0,0,1,1);
-+ CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation",
-+ tools::getOrientation(
-+ tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE );
- }
-
- // Change the following lines only, if you add, remove or rename
-diff --git basegfx/test/clipstate.cxx basegfx/test/clipstate.cxx
-new file mode 100644
-index 0000000..aeb7cfc
---- /dev/null
-+++ basegfx/test/clipstate.cxx
-@@ -0,0 +1,187 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: basegfx2d.cxx,v $
-+ * $Revision: 1.14 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+// autogenerated file with codegen.pl
-+
-+#include <cppunit/simpleheader.hxx>
-+
-+#include <basegfx/tools/b2dclipstate.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <basegfx/polygon/b2dpolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/numeric/ftools.hxx>
-+
-+#include <boost/bind.hpp>
-+
-+using namespace ::basegfx;
-+
-+
-+namespace basegfx2d
-+{
-+
-+class clipstate : public CppUnit::TestFixture
-+{
-+private:
-+ tools::B2DClipState aUnion1;
-+ tools::B2DClipState aUnion2;
-+ tools::B2DClipState aIntersect;
-+ tools::B2DClipState aXor;
-+ tools::B2DClipState aSubtract;
-+
-+public:
-+ void setUp()
-+ {
-+ B2DRange aCenter(100, 100, -100, -100);
-+ B2DRange aNorth(-10, -110, 10, -90);
-+ B2DRange aWest(-110, -10, -90, 10);
-+ B2DRange aSouth(-10, 110, 10, 90);
-+ B2DRange aEast(110, -10, 90, 10);
-+
-+ aUnion1.unionRange(aCenter);
-+ aUnion1.unionRange(aNorth);
-+ aUnion1.unionRange(aWest);
-+ aUnion1.unionRange(aSouth);
-+ aUnion1.unionRange(aEast);
-+
-+ aUnion2.makeNull();
-+ aUnion2.unionRange(aCenter);
-+ aUnion2.unionRange(aNorth);
-+ aUnion2.unionRange(aWest);
-+ aUnion2.unionRange(aSouth);
-+ aUnion2.unionRange(aEast);
-+
-+ aIntersect.intersectRange(aCenter);
-+ aIntersect.intersectRange(aNorth);
-+ aIntersect.intersectRange(aWest);
-+ aIntersect.intersectRange(aSouth);
-+ aIntersect.intersectRange(aEast);
-+
-+ aXor.makeNull();
-+ aXor.xorRange(aCenter);
-+ aXor.xorRange(aNorth);
-+ aXor.xorRange(aWest);
-+ aXor.xorRange(aSouth);
-+ aXor.xorRange(aEast);
-+
-+ aSubtract.intersectRange(aCenter);
-+ aSubtract.subtractRange(aNorth);
-+ aSubtract.subtractRange(aWest);
-+ aSubtract.subtractRange(aSouth);
-+ aSubtract.subtractRange(aEast);
-+ }
-+
-+ void tearDown()
-+ {}
-+
-+ void verifyPoly(const char* sName, const char* sSvg, const tools::B2DClipState& toTest)
-+ {
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
-+ sName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(toTest.getClipPoly()),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ B2DPolyPolygon aTmp1;
-+ CPPUNIT_ASSERT_MESSAGE(sName,
-+ tools::importFromSvgD(
-+ aTmp1,
-+ rtl::OUString::createFromAscii(sSvg)));
-+
-+ const rtl::OUString aSvg=
-+ tools::exportToSvgD(toTest.getClipPoly());
-+ B2DPolyPolygon aTmp2;
-+ CPPUNIT_ASSERT_MESSAGE(sName,
-+ tools::importFromSvgD(
-+ aTmp2,
-+ aSvg));
-+
-+ CPPUNIT_ASSERT_MESSAGE(
-+ sName,
-+ aTmp2 == aTmp1);
-+ }
-+
-+ void verifySimpleRange()
-+ {
-+ const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
-+ const char* intersectSvg="m-100 10v-20h10v20zm80 90v-10h20v10zm-20-190v-10h20v10zm80 100v-20h10v20z";
-+ const char* xorSvg="m-100 10h10v-20h-10zm90 110h20v-10h-20zm0-180h20v-10h-20zm100 110h10v-20h-10zm10 20v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
-+ const char* subtractSvg="m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z";
-+
-+ CPPUNIT_ASSERT_MESSAGE("cleared clip stays empty under union operation",
-+ aUnion1.isCleared());
-+ verifyPoly("union", unionSvg, aUnion2);
-+ verifyPoly("intersect", intersectSvg, aIntersect);
-+ verifyPoly("xor", xorSvg, aXor);
-+ verifyPoly("subtract", subtractSvg, aSubtract);
-+ }
-+
-+ void verifyMixedClips()
-+ {
-+ tools::B2DClipState aMixedClip;
-+
-+ const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
-+
-+ B2DPolyPolygon aTmp1;
-+ tools::importFromSvgD(
-+ aTmp1,
-+ rtl::OUString::createFromAscii(unionSvg));
-+
-+ aMixedClip.intersectPolyPolygon(aTmp1);
-+ aMixedClip.subtractRange(B2DRange(-20,-150,20,0));
-+ aMixedClip.subtractRange(B2DRange(-150,-20,0,20));
-+ aMixedClip.xorRange(B2DRange(-150,-150,150,150));
-+
-+ const char* mixedClipSvg="m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-40-20v-80h-80v80zm-50 170v-300h300v300z";
-+ verifyPoly("mixed clip", mixedClipSvg, aMixedClip);
-+ }
-+
-+ CPPUNIT_TEST_SUITE(clipstate);
-+ CPPUNIT_TEST(verifySimpleRange);
-+ CPPUNIT_TEST(verifyMixedClips);
-+ CPPUNIT_TEST_SUITE_END();
-+};
-+
-+// -----------------------------------------------------------------------------
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::clipstate, "clipstate");
-+} // namespace basegfx2d
-+
-+
-+// -----------------------------------------------------------------------------
-+
-+// this macro creates an empty function, which will called by the RegisterAllFunctions()
-+// to let the user the possibility to also register some functions by hand.
-+// NOADDITIONAL;
-+
-diff --git basegfx/test/genericclipper.cxx basegfx/test/genericclipper.cxx
-new file mode 100644
-index 0000000..70455fd
---- /dev/null
-+++ basegfx/test/genericclipper.cxx
-@@ -0,0 +1,168 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: basegfx2d.cxx,v $
-+ * $Revision: 1.14 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basegfx.hxx"
-+// autogenerated file with codegen.pl
-+
-+#include <cppunit/simpleheader.hxx>
-+
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/curve/b2dcubicbezier.hxx>
-+#include <basegfx/curve/b2dbeziertools.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
-+#include <basegfx/polygon/b2dpolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-+#include <basegfx/polygon/b2dpolygonclipper.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/numeric/ftools.hxx>
-+
-+#include <boost/bind.hpp>
-+
-+using namespace ::basegfx;
-+
-+
-+namespace basegfx2d
-+{
-+
-+class genericclipper : public CppUnit::TestFixture
-+{
-+private:
-+ B2DPolygon aSelfIntersecting;
-+ B2DPolygon aShiftedRectangle;
-+
-+public:
-+ // initialise your test code values here.
-+ void setUp()
-+ {
-+ aSelfIntersecting.append(B2DPoint(0, 0));
-+ aSelfIntersecting.append(B2DPoint(0, 100));
-+ aSelfIntersecting.append(B2DPoint(75, 100));
-+ aSelfIntersecting.append(B2DPoint(75, 50));
-+ aSelfIntersecting.append(B2DPoint(25, 50));
-+ aSelfIntersecting.append(B2DPoint(25, 150));
-+ aSelfIntersecting.append(B2DPoint(100,150));
-+ aSelfIntersecting.append(B2DPoint(100,0));
-+ aSelfIntersecting.setClosed(true);
-+
-+ aShiftedRectangle = tools::createPolygonFromRect(
-+ B2DRange(0,90,20,150));
-+ }
-+
-+ void tearDown()
-+ {}
-+
-+ void validate(const char* pName,
-+ const char* pValidSvgD,
-+ B2DPolyPolygon (*pFunc)(const B2DPolyPolygon&, const B2DPolyPolygon&))
-+ {
-+ const B2DPolyPolygon aSelfIntersect(
-+ tools::prepareForPolygonOperation(aSelfIntersecting));
-+ const B2DPolyPolygon aRect(
-+ tools::prepareForPolygonOperation(aShiftedRectangle));
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(
-+ aSelfIntersect),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+ fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(
-+ aRect),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ const B2DPolyPolygon aRes=
-+ pFunc(aSelfIntersect, aRect);
-+
-+#if defined(VERBOSE)
-+ fprintf(stderr, "%s - svg:d=\"%s\"\n",
-+ pName, rtl::OUStringToOString(
-+ basegfx::tools::exportToSvgD(aRes),
-+ RTL_TEXTENCODING_UTF8).getStr() );
-+#endif
-+
-+ rtl::OUString aValid=rtl::OUString::createFromAscii(pValidSvgD);
-+
-+ CPPUNIT_ASSERT_MESSAGE(pName,
-+ basegfx::tools::exportToSvgD(aRes) == aValid);
-+ }
-+
-+ void validateOr()
-+ {
-+ const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 10v-50h-50v50z";
-+ validate("validateOr", pValid, &tools::solvePolygonOperationOr);
-+ }
-+
-+ void validateXor()
-+ {
-+ const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 10h20v-10h-20zm75 10v-50h-50v50z";
-+ validate("validateXor", pValid, &tools::solvePolygonOperationXor);
-+ }
-+
-+ void validateAnd()
-+ {
-+ const char* pValid="m0 100v-10h20v10z";
-+ validate("validateAnd", pValid, &tools::solvePolygonOperationAnd);
-+ }
-+
-+ void validateDiff()
-+ {
-+ const char* pValid="m0 90v-90h100v150h-75v-50h-5v-10zm55 10v-50h-50v50z";
-+ validate("validateDiff", pValid, &tools::solvePolygonOperationDiff);
-+ }
-+
-+ // Change the following lines only, if you add, remove or rename
-+ // member functions of the current class,
-+ // because these macros are need by auto register mechanism.
-+
-+ CPPUNIT_TEST_SUITE(genericclipper);
-+ CPPUNIT_TEST(validateOr);
-+ CPPUNIT_TEST(validateXor);
-+ CPPUNIT_TEST(validateAnd);
-+ CPPUNIT_TEST(validateDiff);
-+ CPPUNIT_TEST_SUITE_END();
-+};
-+
-+// -----------------------------------------------------------------------------
-+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::genericclipper, "genericclipper");
-+} // namespace basegfx2d
-+
-+
-+// -----------------------------------------------------------------------------
-+
-+// this macro creates an empty function, which will called by the RegisterAllFunctions()
-+// to let the user the possibility to also register some functions by hand.
-+// NOADDITIONAL;
-+
-diff --git basegfx/test/makefile.mk basegfx/test/makefile.mk
-index 320bd0c..31ea7f8 100644
---- basegfx/test/makefile.mk
-+++ basegfx/test/makefile.mk
-@@ -43,10 +43,12 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Common ----------------------------------------------------------
-
- SHL1OBJS= \
-- $(SLO)$/basegfx1d.obj \
-- $(SLO)$/basegfx2d.obj \
-- $(SLO)$/basegfx3d.obj \
-+ $(SLO)$/basegfx1d.obj \
-+ $(SLO)$/basegfx2d.obj \
-+ $(SLO)$/basegfx3d.obj \
- $(SLO)$/boxclipper.obj \
-+ $(SLO)$/clipstate.obj \
-+ $(SLO)$/genericclipper.obj \
- $(SLO)$/testtools.obj
-
- # linking statically against basegfx parts
-diff --git slideshow/source/engine/slide/layer.cxx slideshow/source/engine/slide/layer.cxx
-index f56de72..f9d35b6 100644
---- slideshow/source/engine/slide/layer.cxx
-+++ slideshow/source/engine/slide/layer.cxx
-@@ -36,7 +36,7 @@
-
- #include <basegfx/range/b2drange.hxx>
- #include <basegfx/range/b1drange.hxx>
--#include <basegfx/range/b2dmultirange.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
- #include <basegfx/matrix/b2dhommatrix.hxx>
- #include <basegfx/polygon/b2dpolypolygon.hxx>
-
-@@ -202,7 +202,8 @@ namespace slideshow
- {
- // TODO(Q1): move this to B2DMultiRange
- if( !rUpdateRange.isEmpty() )
-- maUpdateAreas.addRange( rUpdateRange );
-+ maUpdateAreas.appendElement( rUpdateRange,
-+ basegfx::ORIENTATION_POSITIVE );
- }
-
- void Layer::updateBounds( ShapeSharedPtr const& rShape )
-@@ -248,7 +249,7 @@ namespace slideshow
-
- void Layer::clearUpdateRanges()
- {
-- maUpdateAreas.reset();
-+ maUpdateAreas.clear();
- }
-
- void Layer::clearContent()
-@@ -284,12 +285,12 @@ namespace slideshow
-
- Layer::EndUpdater Layer::beginUpdate()
- {
-- if( !maUpdateAreas.isEmpty() )
-+ if( maUpdateAreas.count() )
- {
- // perform proper layer update. That means, setup proper
- // clipping, and render each shape that intersects with
- // the calculated update area
-- ::basegfx::B2DPolyPolygon aClip( maUpdateAreas.getPolyPolygon() );
-+ ::basegfx::B2DPolyPolygon aClip( maUpdateAreas.solveCrossovers() );
-
- // actually, if there happen to be shapes with zero
- // update area in the maUpdateAreas vector, the
-diff --git slideshow/source/engine/slide/layer.hxx slideshow/source/engine/slide/layer.hxx
-index 619f1e9..3f293ca 100644
---- slideshow/source/engine/slide/layer.hxx
-+++ slideshow/source/engine/slide/layer.hxx
-@@ -31,7 +31,7 @@
- #ifndef INCLUDED_SLIDESHOW_LAYER_HXX
- #define INCLUDED_SLIDESHOW_LAYER_HXX
-
--#include <basegfx/range/b2dmultirange.hxx>
-+#include <basegfx/range/b2dpolyrange.hxx>
- #include <cppcanvas/spritecanvas.hxx>
-
- #include "view.hxx"
-@@ -187,7 +187,7 @@ namespace slideshow
- @return true, if any non-empty addUpdateRange() calls
- have been made since the last render()/update() call.
- */
-- bool isUpdatePending() const { return !maUpdateAreas.isEmpty(); }
-+ bool isUpdatePending() const { return maUpdateAreas.count()!=0; }
-
- /** Update layer bound rect from shape bounds
- */
-@@ -297,7 +297,7 @@ namespace slideshow
- typedef ::std::vector< ViewEntry > ViewEntryVector;
-
- ViewEntryVector maViewEntries;
-- basegfx::B2DMultiRange maUpdateAreas;
-+ basegfx::B2DPolyRange maUpdateAreas;
- basegfx::B2DRange maBounds;
- basegfx::B2DRange maNewBounds;
- const basegfx::B2DRange maMaxBounds; // maBounds is clipped against this
diff --git a/patches/test/configmgr-lesslock.diff b/patches/test/configmgr-lesslock.diff
deleted file mode 100644
index a33655515..000000000
--- a/patches/test/configmgr-lesslock.diff
+++ /dev/null
@@ -1,86 +0,0 @@
-Index: configmgr/source/data/segmentheap.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/segmentheap.cxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 segmentheap.cxx
---- configmgr/source/data/segmentheap.cxx 8 Sep 2005 03:39:41 -0000 1.2
-+++ configmgr/source/data/segmentheap.cxx 7 Mar 2006 22:21:03 -0000
-@@ -54,16 +54,16 @@ namespace configmgr
-
- SegmentHeap::~SegmentHeap()
- {
-- m_heap.destroyLock(m_lock);
-+// m_heap.destroyLock(m_lock);
- }
- // -------------------------------------------------------------------------
-
- void SegmentHeap::init()
- {
-- m_lock = m_heap.createLock();
-+// m_lock = m_heap.createLock();
- m_base = m_heap.base();
-
-- OSL_ENSURE(m_lock,"Could not create heap lock");
-+// OSL_ENSURE(m_lock,"Could not create heap lock");
- }
- // -------------------------------------------------------------------------
-
-Index: configmgr/source/inc/segment.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/segment.hxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 segment.hxx
---- configmgr/source/inc/segment.hxx 8 Sep 2005 03:55:04 -0000 1.4
-+++ configmgr/source/inc/segment.hxx 7 Mar 2006 22:21:03 -0000
-@@ -79,27 +79,27 @@ namespace configmgr
-
- Heap& acquireWriteAccess()
- {
-- this->lock().acquireWriteAccess();
-+// this->lock().acquireWriteAccess();
- return this->heap();
- }
-
- void releaseWriteAccess(Heap&)
- {
-- this->lock().releaseWriteAccess();
-+// this->lock().releaseWriteAccess();
- }
-
- void const * acquireReadAccess() const
- {
-- this->lock().acquireReadAccess();
-+// this->lock().acquireReadAccess();
- return base();
- }
- void releaseReadAccess (void const * ) const
- {
-- this->lock().releaseReadAccess();
-+// this->lock().releaseReadAccess();
- }
- private:
- Heap & heap() { return m_heap; }
-- Lock & lock() const { return m_heap.lock(); }
-+// Lock & lock() const { return m_heap.lock(); }
- void * base() const { return m_heap.base(); }
- };
- // -------------------------------------------------------------------------
-Index: configmgr/source/inc/segmentheap.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/segmentheap.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 segmentheap.hxx
---- configmgr/source/inc/segmentheap.hxx 8 Sep 2005 03:55:20 -0000 1.3
-+++ configmgr/source/inc/segmentheap.hxx 7 Mar 2006 22:21:03 -0000
-@@ -56,9 +56,9 @@ namespace configmgr
-
- Heap m_heap;
- void * m_base;
-- Lock * m_lock;
-+// Lock * m_lock;
-
-- Lock & lock() const { return *m_lock; }
-+// Lock & lock() const { return *m_lock; }
- public:
- typedef Heap::HeapId HeapId;
- typedef Heap::HeapIdParam HeapIdParam;
diff --git a/patches/test/configmgr-profile.diff b/patches/test/configmgr-profile.diff
deleted file mode 100644
index c4bbeb816..000000000
--- a/patches/test/configmgr-profile.diff
+++ /dev/null
@@ -1,316 +0,0 @@
-? configmgr/workben/testapp.cxx
-Index: configmgr/workben/makefile.mk
-===================================================================
-RCS file: /cvs/util/configmgr/workben/makefile.mk,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 makefile.mk
---- configmgr/workben/makefile.mk 8 Sep 2005 04:44:54 -0000 1.3
-+++ configmgr/workben/makefile.mk 23 May 2006 09:45:00 -0000
-@@ -73,35 +73,7 @@ USE_LDUMP2=TRUE
- # CFGDEMO
- #
- APP1TARGET= cfgdemo
--APP1OBJS=\
-- $(OBJ)$/treetests.obj \
-- $(SLO)$/xmltreebuilder.obj \
-- $(SLO)$/xmlformater.obj \
-- $(SLO)$/attributes.obj \
-- $(SLO)$/changes.obj \
-- $(SLO)$/confname.obj \
-- $(SLO)$/typeconverter.obj \
-- $(SLO)$/synchronize.obj \
-- $(SLO)$/cmtree.obj \
-- $(SLO)$/cmtreemodel.obj \
-- $(SLO)$/localsession.obj \
-- $(SLO)$/mergeupdates.obj \
-- $(SLO)$/oslstream.obj \
-- $(SLO)$/saxtools.obj \
-- $(SLO)$/configsession.obj \
-- $(SLO)$/strimpl.obj \
-- $(SLO)$/tracer.obj \
-- $(SLO)$/confchangesset.obj \
-- $(SLO)$/filehelper.obj \
-- $(SLO)$/strconverter.obj \
-- $(SLO)$/updatedom.obj \
-- $(SLO)$/valuehandler.obj \
-- $(SLO)$/dataconverter.obj \
--
--# $(OBJ)$/cmxmlexport.obj \
--# $(OBJ)$/cmxmlimport.obj \
--
--#APP1RES= $(RES)$/ucbdemo.res
-+APP1OBJS= $(OBJ)$/testapp.obj
-
- APP1STDLIBS=\
- $(SALLIB) \
---- /dev/null 2006-04-23 09:28:32.000000000 +0100
-+++ configmgr/workben/testapp.cxx 2006-05-23 10:30:21.000000000 +0100
-@@ -0,0 +1,268 @@
-+#include <stdio.h>
-+#include <sys/time.h>
-+#include <memory>
-+#include <vector>
-+
-+#include <iostream>
-+
-+#ifndef _SV_SVAPP_HXX //autogen
-+#include <vcl/svapp.hxx>
-+#endif
-+
-+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
-+#include <cppuhelper/servicefactory.hxx>
-+#endif
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/bootstrap.hxx>
-+
-+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
-+#include <comphelper/processfactory.hxx>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
-+#include <com/sun/star/uno/Reference.h>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
-+#include <com/sun/star/beans/PropertyValue.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#endif
-+
-+#include <com/sun/star/beans/XMultiPropertySet.hpp>
-+
-+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
-+#include <com/sun/star/container/XContainer.hpp>
-+#endif
-+#include <com/sun/star/container/XContainerListener.hpp>
-+
-+#ifndef _UTL_CONFIGMGR_HXX_
-+#include <unotools/configmgr.hxx>
-+#endif
-+
-+#ifndef _STREAM_HXX //autogen wg. SvStream
-+#include <tools/stream.hxx>
-+#endif
-+
-+#include <rtl/ustring.hxx>
-+
-+#ifndef _UTL_STREAM_WRAPPER_HXX_
-+#include <unotools/streamwrap.hxx>
-+#endif
-+
-+#include <tools/urlobj.hxx>
-+#include <osl/diagnose.h>
-+#include <cppuhelper/implbase1.hxx>
-+
-+// #include <icmp_oustring.hxx>
-+
-+#ifndef _COM_SUN_STAR_UNO_ANY_H_
-+#include <com/sun/star/uno/Any.h>
-+#endif
-+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
-+#include <com/sun/star/uno/Sequence.h>
-+#endif
-+
-+// using namespace vos;
-+using namespace rtl;
-+using namespace com::sun::star::uno;
-+using namespace com::sun::star::lang;
-+using namespace com::sun::star::beans;
-+using namespace com::sun::star::container;
-+using namespace std;
-+
-+#define ASCII(x) OUString::createFromAscii(x)
-+
-+class DumpEvents : public ::cppu::WeakImplHelper1<XContainerListener>
-+{
-+public:
-+ DumpEvents() {}
-+ virtual ~DumpEvents() {}
-+
-+ virtual void SAL_CALL elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException)
-+ {
-+ fprintf (stderr, "elementInserted\n");
-+ }
-+ virtual void SAL_CALL elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException)
-+ {
-+ fprintf (stderr, "elementRemoved\n");
-+ }
-+ virtual void SAL_CALL elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException)
-+ {
-+ fprintf (stderr, "elementReplaced\n");
-+ }
-+ // lang.XEventListener
-+ virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException)
-+ {
-+// fprintf (stderr, "listener: disposing\n");
-+ }
-+};
-+
-+static void
-+doTest( Reference< XMultiServiceFactory > xFac, Reference< XContainerListener > xDumpEvents )
-+{
-+ bool bSlow = xDumpEvents.is();
-+
-+ // uicommanddescription code:
-+ static const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.Office.UI.";
-+ static const char CONFIGURATION_POP_ELEMENT_ACCESS[] = "/UserInterface/Commands";
-+static const char CONFIGURATION_PROPERTY_LABEL[] = "Label";
-+static const char CONFIGURATION_PROPERTY_CONTEXT_LABEL[] = "ContextLabel";
-+static const char PROPSET_LABEL[] = "Label";
-+static const char PROPSET_NAME[] = "Name";
-+static const char PROPSET_POPUP[] = "Popup";
-+static const char PROPSET_PROPERTIES[] = "Properties";
-+
-+ rtl::OUString m_aConfigPopupAccess( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_ROOT_ACCESS ) );
-+ Reference< XMultiServiceFactory > m_xConfigProviderPopups;
-+ Reference< XNameAccess > m_xConfigAccessPopups;
-+ rtl::OUString m_aPropUILabel( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_PROPERTY_LABEL ));
-+ rtl::OUString m_aPropUIContextLabel( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_PROPERTY_CONTEXT_LABEL ));
-+ rtl::OUString m_aPropLabel( RTL_CONSTASCII_USTRINGPARAM( PROPSET_LABEL ));
-+ rtl::OUString m_aPropName( RTL_CONSTASCII_USTRINGPARAM( PROPSET_NAME ));
-+ rtl::OUString m_aPropPopup( RTL_CONSTASCII_USTRINGPARAM( PROPSET_POPUP ));
-+ rtl::OUString m_aPropProperties( RTL_CONSTASCII_USTRINGPARAM( PROPSET_PROPERTIES ));
-+
-+ m_aConfigPopupAccess += ASCII("GenericCommands");
-+ m_aConfigPopupAccess += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_POP_ELEMENT_ACCESS ));
-+ m_xConfigProviderPopups = Reference< XMultiServiceFactory >( xFac->createInstance(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "com.sun.star.configuration.ConfigurationProvider" ))),
-+ UNO_QUERY );
-+
-+
-+ PropertyValue aPropValue;
-+ Sequence< Any > aArgs( 1 );
-+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
-+ aPropValue.Value = makeAny( m_aConfigPopupAccess );
-+ aArgs[0] <<= aPropValue;
-+ m_xConfigAccessPopups = Reference< XNameAccess >( m_xConfigProviderPopups->createInstanceWithArguments(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "com.sun.star.configuration.ConfigurationAccess" )),
-+ aArgs ),
-+ UNO_QUERY );
-+#if 0
-+ if ( m_xConfigAccessPopups.is() && xDumpEvents.is() )
-+ {
-+ // Add as container listener
-+ Reference< XContainer > xContainer( m_xConfigAccessPopups, UNO_QUERY );
-+ if ( xContainer.is() )
-+ xContainer->addContainerListener( xDumpEvents );
-+ else
-+ fprintf (stderr, "no listening\n");
-+ }
-+#endif
-+
-+ sal_Int32 i( 0 );
-+ Any a;
-+ std::vector< OUString > aImageCommandVector;
-+ std::vector< OUString > aImageRotateVector;
-+ std::vector< OUString > aImageMirrorVector;
-+ Sequence< OUString > aNameSeq;
-+
-+ if ( m_xConfigAccessPopups.is() )
-+ {
-+ aNameSeq = m_xConfigAccessPopups->getElementNames();
-+ fprintf (stderr, "Element names: %d\n", aNameSeq.getLength());
-+ for ( i = 0; i < aNameSeq.getLength(); i++ )
-+ {
-+ try
-+ {
-+ if (1) // bSlow)
-+ {
-+ Reference< XNameAccess > xNameAccess;
-+ // This is the slow bit ! ...
-+ // Creating the @#$@#$ing XNameAccess object [ 650 times ]
-+ // which we then use to 'getByName' etc.
-+ a = m_xConfigAccessPopups->getByName( aNameSeq[i] );
-+ if ( a >>= xNameAccess )
-+ {
-+ a = xNameAccess->getByName( m_aPropUILabel );
-+ a = xNameAccess->getByName( m_aPropUIContextLabel );
-+ a = xNameAccess->getByName( m_aPropProperties );
-+ }
-+ }
-+ else
-+ {
-+ // getAsProperty !?
-+ Reference< XMultiPropertySet > xMPS;
-+ Sequence< OUString > aPropNames(3);
-+ aPropNames[0] = m_aPropUILabel;
-+ aPropNames[1] = m_aPropUIContextLabel;
-+ aPropNames[2] = m_aPropProperties;
-+ a = m_xConfigAccessPopups->getByName( aNameSeq[i] );
-+ if ( a >>= xMPS )
-+ {
-+ Sequence<Any> aVals;
-+ aVals = xMPS->getPropertyValues (aPropNames);
-+ }
-+ else
-+ fprintf (stderr, "not an MPS\n");
-+ }
-+ }
-+ catch ( com::sun::star::lang::WrappedTargetException& )
-+ {
-+ }
-+ catch ( com::sun::star::container::NoSuchElementException& )
-+ {
-+ }
-+ }
-+ }
-+}
-+
-+static void
-+doTestRun( Reference< XMultiServiceFactory > xMSF, Reference< XContainerListener > xDumpEvents, int niter )
-+{
-+ struct timeval start, end;
-+ gettimeofday (&start, NULL);
-+
-+ for (int i = 0; i < niter; i++)
-+ doTest (xMSF, xDumpEvents);
-+
-+ gettimeofday (&end, NULL);
-+ static sal_Int64 usecs = 0;
-+ usecs += 1000000 * (end.tv_sec - start.tv_sec);
-+ usecs += end.tv_usec - start.tv_usec;
-+ usecs /= niter;
-+ fprintf (stderr, "(per iteration) %d.%0.6d\n", (int) (usecs / 1000000),
-+ (int)(usecs % 1000000));
-+}
-+
-+int main( int argc, char **argv )
-+{
-+ Reference<XComponentContext> xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
-+ Reference<XMultiServiceFactory> xMSF(xComponentContext->getServiceManager(), UNO_QUERY);
-+ if( !xMSF.is() )
-+ fprintf( stderr, "Failed to bootstrap\n" );
-+ ::comphelper::setProcessServiceFactory( xMSF );
-+
-+ Reference< XMultiServiceFactory > xStayLoaded;
-+ xStayLoaded = Reference< XMultiServiceFactory >(
-+ xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "com.sun.star.configuration.ConfigurationProvider" ))),
-+ UNO_QUERY );
-+
-+ Reference< XContainerListener > xDumpEvents;
-+
-+ doTestRun (xMSF, xDumpEvents, 10);
-+
-+// xDumpEvents = new DumpEvents();
-+
-+// doTestRun (xMSF, xDumpEvents, 10);
-+
-+ return 0;
-+}
diff --git a/patches/test/configmgr-refactor.diff b/patches/test/configmgr-refactor.diff
deleted file mode 100644
index c9df5fc3f..000000000
--- a/patches/test/configmgr-refactor.diff
+++ /dev/null
@@ -1,9060 +0,0 @@
-? configmgr/workben/testapp.cxx
-Index: configmgr/source/api2/apinodeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apinodeaccess.cxx,v
-retrieving revision 1.13
-diff -u -p -u -r1.13 apinodeaccess.cxx
---- configmgr/source/api2/apinodeaccess.cxx 16 Sep 2006 14:54:31 -0000 1.13
-+++ configmgr/source/api2/apinodeaccess.cxx 5 Jan 2007 22:25:40 -0000
-@@ -77,7 +77,7 @@ configuration::TreeRef NodeAccess::getTr
- }
- //-----------------------------------------------------------------------------
-
--configuration::Tree NodeAccess::getTree(data::Accessor const & _aAccessor) const
-+configuration::Tree NodeAccess::getTree(memory::Accessor const & _aAccessor) const
- {
- return configuration::Tree(_aAccessor,getApiTree().getTree());
- }
-@@ -216,7 +216,7 @@ SetElement* findSetElement(Factory& rFac
- }
- //-----------------------------------------------------------------------------
-
--configuration::SetElementInfo NodeSetInfoAccess::getElementInfo(data::Accessor const& _aAccessor) const
-+configuration::SetElementInfo NodeSetInfoAccess::getElementInfo(memory::Accessor const& _aAccessor) const
- {
- using configuration::SetElementInfo;
- using configuration::TemplateHolder;
-@@ -242,7 +242,7 @@ NodeReadGuardImpl::~NodeReadGuardImpl()
- }
- //-----------------------------------------------------------------------------
-
--configuration::Tree NodeReadGuardImpl::getTree(data::Accessor const& _aAccessor) const
-+configuration::Tree NodeReadGuardImpl::getTree(memory::Accessor const& _aAccessor) const
- {
- return this->get().getTree(_aAccessor);
- }
-Index: configmgr/source/api2/apinodeaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apinodeaccess.hxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 apinodeaccess.hxx
---- configmgr/source/api2/apinodeaccess.hxx 4 Aug 2006 10:01:32 -0000 1.10
-+++ configmgr/source/api2/apinodeaccess.hxx 5 Jan 2007 22:25:40 -0000
-@@ -82,7 +82,7 @@ namespace configmgr
- typedef uno::XInterface UnoInterface;
- typedef uno::Any UnoAny;
-
-- // API object implementation wrappers
-+ // API object implementation wrappers
- // these objects just provide the pieces needed to navigate and manipulate trees and nodes
-
- // The common part of all nodes, provides all you need to read and listen
-@@ -167,8 +167,9 @@ namespace configmgr
- /// finds a existing <type>SetElement</type> for a given <type scope='configmgr::configuration'>ElementTree</type>
- SetElement* findSetElement(Factory& rFactory, configuration::ElementRef const& aElementTree);
-
-- // Guarding and locking implementations
-- /// guards a NodeAccess; provides an object (read) lock, ensures object was not disposed
-+ // Guarding and locking implementations
-+ /// guards a NodeAccess; provides an object (read) lock,
-+ /// ensures object was not disposed
- class NodeReadGuardImpl : Noncopyable
- {
- osl::MutexGuard m_aLock;
-@@ -197,7 +198,8 @@ namespace configmgr
- };
- typedef GuardedNode<NodeAccess> GuardedNodeAccess;
-
-- /// wraps a NodeAccess; provides both object and provider (read) locks, ensures object was not disposed
-+ /// wraps a NodeAccess; provides both object and provider (read) locks,
-+ // ensures object was not disposed
- template <class Access>
- class GuardedNodeData
- {
-Index: configmgr/source/api2/apinodeupdate.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apinodeupdate.cxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 apinodeupdate.cxx
---- configmgr/source/api2/apinodeupdate.cxx 16 Sep 2006 14:54:45 -0000 1.11
-+++ configmgr/source/api2/apinodeupdate.cxx 5 Jan 2007 22:25:40 -0000
-@@ -75,19 +75,19 @@ NodeGroupAccess& withDefaultData(NodeGro
- }
- //-----------------------------------------------------------------------------
-
--configuration::GroupUpdater NodeGroupAccess::getNodeUpdater(data::Accessor const& _aAccessor)
-+configuration::GroupUpdater NodeGroupAccess::getNodeUpdater(memory::Accessor const& _aAccessor)
- {
- return configuration::GroupUpdater(getTree(_aAccessor),getNodeRef(), getApiTree().getProvider().getTypeConverter());
- }
- //-----------------------------------------------------------------------------
-
--configuration::GroupDefaulter NodeGroupAccess::getNodeDefaulter(data::Accessor const& _aAccessor)
-+configuration::GroupDefaulter NodeGroupAccess::getNodeDefaulter(memory::Accessor const& _aAccessor)
- {
- return configuration::GroupDefaulter(getTree(_aAccessor),getNodeRef(), getApiTree().getDefaultProvider());
- }
- //-----------------------------------------------------------------------------
-
--configuration::SetElementFactory NodeTreeSetAccess::getElementFactory(data::Accessor const& _aAccessor)
-+configuration::SetElementFactory NodeTreeSetAccess::getElementFactory(memory::Accessor const& _aAccessor)
- {
- using namespace configuration;
- TemplateProvider aProvider = SetElementFactory::findTemplateProvider(getTree(_aAccessor),getNodeRef());
-@@ -95,20 +95,20 @@ configuration::SetElementFactory NodeTre
- }
- //-----------------------------------------------------------------------------
-
--configuration::SetDefaulter NodeSetAccess::getNodeDefaulter(data::Accessor const& _aAccessor)
-+configuration::SetDefaulter NodeSetAccess::getNodeDefaulter(memory::Accessor const& _aAccessor)
- {
- return configuration::SetDefaulter(getTree(_aAccessor),getNodeRef(), getApiTree().getDefaultProvider());
- }
- //-----------------------------------------------------------------------------
-
--configuration::TreeSetUpdater NodeTreeSetAccess::getNodeUpdater(data::Accessor const& _aAccessor)
-+configuration::TreeSetUpdater NodeTreeSetAccess::getNodeUpdater(memory::Accessor const& _aAccessor)
- {
- return configuration::TreeSetUpdater(getTree(_aAccessor),getNodeRef(),getElementInfo(_aAccessor));
- }
- //-----------------------------------------------------------------------------
-
-
--configuration::ValueSetUpdater NodeValueSetAccess::getNodeUpdater(data::Accessor const& _aAccessor)
-+configuration::ValueSetUpdater NodeValueSetAccess::getNodeUpdater(memory::Accessor const& _aAccessor)
- {
- return configuration::ValueSetUpdater(getTree(_aAccessor),getNodeRef(),getElementInfo(_aAccessor), getApiTree().getProvider().getTypeConverter());
- }
-Index: configmgr/source/api2/apitreeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apitreeaccess.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 apitreeaccess.cxx
---- configmgr/source/api2/apitreeaccess.cxx 16 Sep 2006 14:55:24 -0000 1.9
-+++ configmgr/source/api2/apitreeaccess.cxx 5 Jan 2007 22:25:40 -0000
-@@ -58,7 +58,7 @@ void NodeElement::checkAlive() const
- }
- //-----------------------------------------------------------------------------
-
--configuration::Tree TreeElement::getTree(data::Accessor const& _aAccessor) const
-+configuration::Tree TreeElement::getTree(memory::Accessor const& _aAccessor) const
- {
- return configuration::Tree(_aAccessor, this->getTreeRef());
- }
-Index: configmgr/source/api2/apitreeimplobj.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apitreeimplobj.cxx,v
-retrieving revision 1.41
-diff -u -p -u -r1.41 apitreeimplobj.cxx
---- configmgr/source/api2/apitreeimplobj.cxx 16 Sep 2006 14:55:43 -0000 1.41
-+++ configmgr/source/api2/apitreeimplobj.cxx 5 Jan 2007 22:25:40 -0000
-@@ -345,8 +345,8 @@ public:
-
- // Interfaces
- virtual void disposing(IConfigBroadcaster* pSource);
-- virtual void nodeChanged(data::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* pSource);
-- virtual void nodeDeleted(data::Accessor const& _aChangedDataAccessor, AbsolutePath const& sPath, IConfigBroadcaster* pSource);
-+ virtual void nodeChanged(memory::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* pSource);
-+ virtual void nodeDeleted(memory::Accessor const& _aChangedDataAccessor, AbsolutePath const& sPath, IConfigBroadcaster* pSource);
- };
-
- //-------------------------------------------------------------------------
-@@ -514,7 +514,7 @@ bool ApiTreeImpl::disposeTree(bool bForc
- if (!isAlive())
- return false;
-
-- data::Accessor aSourceAccessor( getSourceData() );
-+ memory::Accessor aSourceAccessor( getSourceData() );
-
- osl::MutexGuard aLocalGuard(getDataLock());
- if (!bForce)
-@@ -540,7 +540,7 @@ bool ApiTreeImpl::disposeTreeNow()
- CFG_TRACE_INFO("ApiTreeImpl: Disposing Tree Now (unless disposed)");
- if (isAlive() )
- {
-- data::Accessor aSourceAccessor( getSourceData() );
-+ memory::Accessor aSourceAccessor( getSourceData() );
-
- osl::MutexGuard aLocalGuard(getDataLock());
-
-@@ -576,7 +576,7 @@ bool ApiRootTreeImpl::disposeTree()
- return bDisposed;
- }
- //-------------------------------------------------------------------------
--bool ApiTreeImpl::implDisposeTree(data::Accessor const& _aAccessor)
-+bool ApiTreeImpl::implDisposeTree(memory::Accessor const& _aAccessor)
- {
- OSL_ENSURE(m_pParentTree == 0,"WARNING: Disposing a tree that still has a parent tree set");
-
-@@ -626,7 +626,7 @@ void ApiTreeImpl::disposeNode(NodeRef co
- {
- if (isAlive())
- {
-- data::Accessor aSourceAccessor( getSourceData() );
-+ memory::Accessor aSourceAccessor( getSourceData() );
- if (isAlive())
- {
- osl::MutexGuard aLocalGuard(getDataLock());
-@@ -636,7 +636,7 @@ void ApiTreeImpl::disposeNode(NodeRef co
- }
- }
- //-------------------------------------------------------------------------
--void ApiTreeImpl::implDisposeNode(data::Accessor const & _anAccessor, NodeRef const& aNode, UnoInterface* )
-+void ApiTreeImpl::implDisposeNode(memory::Accessor const & _anAccessor, NodeRef const& aNode, UnoInterface* )
- {
- CFG_TRACE_INFO("ApiTreeImpl: Disposing a single node.");
- OSL_ENSURE(aNode.isValid(),"INTERNAL ERROR: Disposing NULL node");
-@@ -925,7 +925,7 @@ void disposeRemovedNodes(configuration::
- }
- // ---------------------------------------------------------------------------------------------------
- //INodeListener : IConfigListener
--void ApiRootTreeImpl::NodeListener::nodeChanged(data::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* _pSource)
-+void ApiRootTreeImpl::NodeListener::nodeChanged(memory::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* _pSource)
- {
- osl::ClearableMutexGuard aGuard(mutex);
-
-@@ -943,7 +943,7 @@ void ApiRootTreeImpl::NodeListener::node
- // ---------------------------------------------------------------------------------------------------
-
- //INodeListener : IConfigListener
--void ApiRootTreeImpl::nodeChanged(data::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& aChangePath, IConfigBroadcaster* /*pSource*/)
-+void ApiRootTreeImpl::nodeChanged(memory::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& aChangePath, IConfigBroadcaster* /*pSource*/)
- {
- using configuration::AnyNodeRef;
- using configuration::NodeChanges;
-@@ -1049,7 +1049,7 @@ void ApiRootTreeImpl::nodeChanged(data::
- }
- // ---------------------------------------------------------------------------------------------------
-
--void ApiRootTreeImpl::NodeListener::nodeDeleted(data::Accessor const& _aChangedDataAccessor, AbsolutePath const& _aPath, IConfigBroadcaster* _pSource)
-+void ApiRootTreeImpl::NodeListener::nodeDeleted(memory::Accessor const& _aChangedDataAccessor, AbsolutePath const& _aPath, IConfigBroadcaster* _pSource)
- {
- osl::ClearableMutexGuard aGuard(mutex);
-
-@@ -1065,7 +1065,7 @@ void ApiRootTreeImpl::NodeListener::node
- }
- }
- // ---------------------------------------------------------------------------------------------------
--void ApiRootTreeImpl::nodeDeleted(data::Accessor const& /*_aChangedDataAccessor*/, AbsolutePath const& _aDeletedPath, IConfigBroadcaster* /*pSource*/)
-+void ApiRootTreeImpl::nodeDeleted(memory::Accessor const& /*_aChangedDataAccessor*/, AbsolutePath const& _aDeletedPath, IConfigBroadcaster* /*pSource*/)
- {
- { (void)_aDeletedPath; }
-
-Index: configmgr/source/api2/apitreeimplobj.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/apitreeimplobj.hxx,v
-retrieving revision 1.25
-diff -u -p -u -r1.25 apitreeimplobj.hxx
---- configmgr/source/api2/apitreeimplobj.hxx 8 Sep 2005 03:09:54 -0000 1.25
-+++ configmgr/source/api2/apitreeimplobj.hxx 5 Jan 2007 22:25:40 -0000
-@@ -183,8 +183,8 @@ namespace configmgr
- void setParentTree(ApiTreeImpl* pNewParentTree);
- void deinit();
-
-- bool implDisposeTree(data::Accessor const& _aAccessor);
-- void implDisposeNode(data::Accessor const & _anAccessor, configuration::NodeRef const& aNode, UnoInterface* pInstance);
-+ bool implDisposeTree(memory::Accessor const& _aAccessor);
-+ void implDisposeNode(memory::Accessor const & _anAccessor, configuration::NodeRef const& aNode, UnoInterface* pInstance);
-
- friend class ComponentAdapter;
- void disposing(com::sun::star::lang::EventObject const& rEvt) throw();
-@@ -227,8 +227,8 @@ namespace configmgr
- // IConfigListener
- void disposing(IConfigBroadcaster* pSource) ;
- //INodeListener : IConfigListener
-- void nodeChanged(data::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
-- void nodeDeleted(data::Accessor const& _aChangedDataAccessor, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
-+ void nodeChanged(memory::Accessor const& _aChangedDataAccessor, Change const& aChange, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
-+ void nodeDeleted(memory::Accessor const& _aChangedDataAccessor, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
-
- private:
- ApiTreeImpl m_aTreeImpl;
-Index: configmgr/source/api2/notifierimpl.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/notifierimpl.hxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 notifierimpl.hxx
---- configmgr/source/api2/notifierimpl.hxx 19 Jun 2006 23:16:03 -0000 1.8
-+++ configmgr/source/api2/notifierimpl.hxx 5 Jan 2007 22:25:40 -0000
-@@ -80,15 +80,15 @@ namespace configmgr
- };
- struct SubNodeToIndex
- {
-- typedef data::Accessor const & KeyFinder;
-+ typedef memory::Accessor const & KeyFinder;
- configuration::TreeRef aTree;
-
- SubNodeToIndex( configuration::TreeRef const& rTree ) : aTree(rTree) {}
-
-- bool findKeysForIndex(KeyFinder _anAccessor, NodeOffset nNode, SubNodeList& aList)
-+ bool findKeysForIndex(KeyFinder _anAccessor, NodeOffset nNode, SubNodeList& aList)
- {
-- using configuration::getAllChildrenHelper;
-- using configuration::findNodeFromIndex;
-+ using configuration::getAllChildrenHelper;
-+ using configuration::findNodeFromIndex;
- aList.clear();
- getAllChildrenHelper(_anAccessor,findNodeFromIndex(aTree,nNode), aList);
- return !aList.empty();
-Index: configmgr/source/api2/propsetaccessimpl.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/propsetaccessimpl.cxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 propsetaccessimpl.cxx
---- configmgr/source/api2/propsetaccessimpl.cxx 16 Sep 2006 14:59:10 -0000 1.21
-+++ configmgr/source/api2/propsetaccessimpl.cxx 5 Jan 2007 22:25:40 -0000
-@@ -299,7 +299,7 @@ public:
- {
- }
-
-- static NodePropertySetInfo* create(NodeGroupInfoAccess& _rNode, data::Accessor const& _aDataAccessor, sal_Bool _bReadonly ) throw(RuntimeException);
-+ static NodePropertySetInfo* create(NodeGroupInfoAccess& _rNode, memory::Accessor const& _aDataAccessor, sal_Bool _bReadonly ) throw(RuntimeException);
- Property const* begin() const throw() { return m_aProperties.getConstArray(); }
- Property const* end() const throw() { return m_aProperties.getConstArray() + m_aProperties.getLength(); }
-
-@@ -313,7 +313,7 @@ public:
-
- //-----------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------
--NodePropertySetInfo* NodePropertySetInfo::create(NodeGroupInfoAccess& _rNode, data::Accessor const& _aDataAccessor, sal_Bool _bReadonly ) throw(RuntimeException)
-+NodePropertySetInfo* NodePropertySetInfo::create(NodeGroupInfoAccess& _rNode, memory::Accessor const& _aDataAccessor, sal_Bool _bReadonly ) throw(RuntimeException)
- {
- osl::MutexGuard aGuard(_rNode.getDataLock());
-
-Index: configmgr/source/api2/translatechanges.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/translatechanges.cxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 translatechanges.cxx
---- configmgr/source/api2/translatechanges.cxx 16 Sep 2006 15:00:31 -0000 1.10
-+++ configmgr/source/api2/translatechanges.cxx 5 Jan 2007 22:25:41 -0000
-@@ -154,11 +154,11 @@ bool resolveChangeLocation(RelativePath&
-
- // ---------------------------------------------------------------------------------------------------
- // change path and base settings to start from the given base
--bool rebaseChange(data::Accessor const& _aAccessor, NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef)
-+bool rebaseChange(memory::Accessor const& _aAccessor, NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef)
- {
- return rebaseChange(_aAccessor, aChange,_aBaseTreeRef,_aBaseTreeRef.getRootNode());
- }
--bool rebaseChange(data::Accessor const& _aAccessor, NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef, NodeRef const& aBaseNode)
-+bool rebaseChange(memory::Accessor const& _aAccessor, NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef, NodeRef const& aBaseNode)
- {
- OSL_ENSURE(aChange.isValidLocation(_aAccessor), "Trying to rebase change location that wasn't set up properly");
-
-Index: configmgr/source/api2/updateimpl.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/api2/updateimpl.cxx,v
-retrieving revision 1.13
-diff -u -p -u -r1.13 updateimpl.cxx
---- configmgr/source/api2/updateimpl.cxx 16 Sep 2006 15:00:59 -0000 1.13
-+++ configmgr/source/api2/updateimpl.cxx 5 Jan 2007 22:25:41 -0000
-@@ -715,7 +715,7 @@ Reference< uno::XInterface > implCreateE
- {
- GuardedNodeData<NodeSetAccess> lock( rNode ); // no provider lock needed ? => if template lock is separate - OK
-
-- data::Accessor aDataAccess = lock.getDataAccessor();
-+ memory::Accessor aDataAccess = lock.getDataAccessor();
- ElementTree aNewElement( rNode.getElementFactory(aDataAccess).instantiateTemplate(rNode.getElementInfo(aDataAccess).getTemplate()) );
-
- Any aAny = configapi::makeElement( rNode.getFactory(), aNewElement );
-Index: configmgr/source/data/accessor.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/accessor.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 accessor.cxx
---- configmgr/source/data/accessor.cxx 16 Sep 2006 15:09:26 -0000 1.7
-+++ configmgr/source/data/accessor.cxx 5 Jan 2007 22:25:41 -0000
-@@ -58,20 +58,13 @@ namespace configmgr
- : m_segment(segment)
- , m_refs(1)
- {
-- void const * base = m_segment ? m_segment->acquireReadAccess() : NULL;
-- m_base = static_cast<char const *>(base);
-- }
-- // -------------------------------------------------------------------------
-- Accessor::Impl::Impl(Segment const * segment, void const * base)
-- : m_segment(segment)
-- , m_base(static_cast<char const *>(base))
-- , m_refs(1)
-- {
-+ if (m_segment)
-+ m_segment->acquireReadAccess();
- }
- // -------------------------------------------------------------------------
- Accessor::Impl::~Impl()
- {
-- if (m_segment) m_segment->releaseReadAccess(m_base);
-+ if (m_segment) m_segment->releaseReadAccess();
- }
- // -------------------------------------------------------------------------
- /// Copies an Accessor
-@@ -93,42 +86,28 @@ namespace configmgr
- {
- if (m_impl->is())
- {
-- Impl * pNewImpl = new Impl(0,0);
-+ Impl * pNewImpl = new Impl(0);
- releaseImpl();
- m_impl = pNewImpl;
- }
- OSL_POSTCOND(!this->is(),"Accessor::clear: Could not clear");
- }
-
-- // -------------------------------------------------------------------------
-- void * Accessor::failNull()
-- {
-- OSL_ENSURE(false,"Unexpected NULL Address or Accessor");
-- return NULL;
-- }
-- // -------------------------------------------------------------------------
-+ bool Segment::countLocks = false;
-+ oslInterlockedCount Segment::numLocks = 0;
-
-- #if OSL_DEBUG_LEVEL > 0
-- void const * Accessor::resolve(AddressType _p) const
-- {
-- OSL_ENSURE( !_p.is() || segment_()->isValidAddress(_p.value()), "Address does not belong to this segment");
-- return _p.is() ? base_() + _p.value() : NULL;
-+ void Segment::acquireWriteAccess()
-+ {
-+ m_mutex.acquire();
-+ if (countLocks)
-+ osl_incrementInterlockedCount(&numLocks);
- }
-
-- Pointer Accessor::reduce(void const * _p) const
-+ void Segment::releaseWriteAccess()
- {
-- if (_p)
-- {
-- Pointer::RawAddress addr = static_cast<char const *>(_p) - base_();
-- OSL_ENSURE( segment_()->isValidAddress(addr), "Pointer does not belong to this segment");
-- return Pointer(addr);
-- }
-- else
-- return Pointer();
-+ m_mutex.release();
- }
-- #endif // OSL_DEBUG_LEVEL
-
-- // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/data/anydata.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/anydata.cxx,v
-retrieving revision 1.4.12.1
-diff -u -p -u -r1.4.12.1 anydata.cxx
---- configmgr/source/data/anydata.cxx 3 Nov 2006 11:34:29 -0000 1.4.12.1
-+++ configmgr/source/data/anydata.cxx 5 Jan 2007 22:25:41 -0000
-@@ -61,7 +61,6 @@ namespace configmgr
- namespace Type = data::Type;
- namespace uno = ::com::sun::star::uno;
- typedef AnyData::TypeCode TypeCode;
-- using memory::Pointer;
- //-----------------------------------------------------------------------------
-
- TypeCode getTypeCode(uno::Type const & _aType)
-@@ -200,7 +199,7 @@ uno::Type getUnoType( TypeCode _aType)
- //-----------------------------------------------------------------------------
-
- static
--AnyData allocSimpleData(memory::Allocator const& _anAllocator, TypeCode _aSimpleType, uno::Any const & _aAny)
-+AnyData allocSimpleData(TypeCode _aSimpleType, uno::Any const & _aAny)
- {
- OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
-
-@@ -234,9 +233,7 @@ AnyData allocSimpleData(memory::Allocato
- sal_Int64 nValue;
- OSL_VERIFY(_aAny >>= nValue);
-
-- Address aStorage = _anAllocator.allocate( sizeof nValue );
-- *static_cast<sal_Int64*>( _anAllocator.access(aStorage) ) = nValue;
-- aResult.longValue = aStorage;
-+ aResult.longValue = new sal_Int64( nValue );
- }
- break;
-
-@@ -245,9 +242,7 @@ AnyData allocSimpleData(memory::Allocato
- double dValue;
- OSL_VERIFY(_aAny >>= dValue);
-
-- Address aStorage = _anAllocator.allocate( sizeof dValue );
-- *static_cast<double*>( _anAllocator.access(aStorage) ) = dValue;
-- aResult.doubleValue = aStorage;
-+ aResult.doubleValue = new double( dValue );
- }
- break;
-
-@@ -255,7 +250,7 @@ AnyData allocSimpleData(memory::Allocato
- {
- uno::Sequence<sal_Int8> aValue;
- OSL_VERIFY(_aAny >>= aValue);
-- aResult.binaryValue = allocBinary(_anAllocator,aValue);
-+ aResult.binaryValue = allocBinary(aValue);
- }
- break;
-
-@@ -290,7 +285,7 @@ sal_Sequence const * extractSequenceData
- //-----------------------------------------------------------------------------
-
- static
--AnyData allocSequenceData(memory::Allocator const& _anAllocator, TypeCode _aSimpleType, uno::Any const & _aAny)
-+AnyData allocSequenceData(TypeCode _aSimpleType, uno::Any const & _aAny)
- {
- OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
-
-@@ -302,7 +297,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<rtl::OUString> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -310,7 +305,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<sal_Bool> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -318,7 +313,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<sal_Int16> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -326,7 +321,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<sal_Int32> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -334,7 +329,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<sal_Int64> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -342,7 +337,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<double> aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -350,7 +345,7 @@ AnyData allocSequenceData(memory::Alloca
- {
- uno::Sequence<uno::Sequence<sal_Int8> > aSeqValue;
- if (sal_Sequence const * pData = extractSequenceData(aSeqValue,_aAny))
-- aSequence = allocSequence(_anAllocator,_aSimpleType,pData);
-+ aSequence = allocSequence(_aSimpleType,pData);
- }
- break;
-
-@@ -366,28 +361,20 @@ AnyData allocSequenceData(memory::Alloca
- }
- //-----------------------------------------------------------------------------
-
--AnyData allocData(memory::Allocator const& _anAllocator, TypeCode _aType, uno::Any const & _aAny)
-+AnyData allocData(TypeCode _aType, uno::Any const & _aAny)
- {
- OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
- OSL_ENSURE( _aType == getTypeCode(_aAny.getValueType()), "Type code does not match value" );
-
- if (_aType & Type::flag_sequence)
-- return allocSequenceData(_anAllocator,TypeCode( _aType & Type::mask_basetype),_aAny);
--
-+ return allocSequenceData(TypeCode( _aType & Type::mask_basetype),_aAny);
- else
-- return allocSimpleData(_anAllocator,_aType,_aAny);
--}
--//-----------------------------------------------------------------------------
--/*
--AnyData copyData(memory::Allocator const& _anAllocator, TypeCode _aType, AnyData _aData)
--{
-- OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
-+ return allocSimpleData(_aType,_aAny);
- }
--*/
- //-----------------------------------------------------------------------------
-
- static
--void freeSimpleData(memory::Allocator const& _anAllocator, TypeCode _aSimpleType, AnyData const & _aData)
-+void freeSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
- {
- OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
-
-@@ -405,15 +392,15 @@ void freeSimpleData(memory::Allocator co
-
- // free memory for oversized values
- case Type::value_long:
-- _anAllocator.deallocate(_aData.longValue);
-+ delete _aData.longValue;
- break;
-
- case Type::value_double:
-- _anAllocator.deallocate(_aData.doubleValue);
-+ delete _aData.doubleValue;
- break;
-
- case Type::value_binary:
-- freeBinary(_anAllocator, _aData.binaryValue);
-+ freeBinary(_aData.binaryValue);
- break;
-
- case Type::value_any:
-@@ -427,20 +414,20 @@ void freeSimpleData(memory::Allocator co
- }
- //-----------------------------------------------------------------------------
-
--void freeData(memory::Allocator const& _anAllocator, TypeCode _aType, AnyData _aData)
-+void freeData(TypeCode _aType, AnyData _aData)
- {
- OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
-
- if (_aType & Type::flag_sequence)
-- freeSequence(_anAllocator,TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
-+ freeSequence(TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
-
- else
-- freeSimpleData(_anAllocator,_aType,_aData);
-+ freeSimpleData(_aType,_aData);
- }
- //-----------------------------------------------------------------------------
-
- static
--uno::Any readSimpleData(memory::Accessor const& _anAccessor, TypeCode _aSimpleType, AnyData const & _aData)
-+uno::Any readSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
- {
- OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
-
-@@ -462,22 +449,14 @@ uno::Any readSimpleData(memory::Accessor
- return uno::makeAny( _aData.intValue );
-
- case Type::value_long:
-- {
-- void const * pStorage = _anAccessor.validate( Pointer(_aData.longValue) );
-- sal_Int64 const * pValue = static_cast<sal_Int64 const *>(pStorage);
-- return uno::makeAny( *pValue );
-- }
-+ return uno::makeAny( *_aData.longValue );
-
- case Type::value_double:
-- {
-- void const * pStorage = _anAccessor.validate( Pointer(_aData.doubleValue) );
-- double const * pValue = static_cast<double const *>(pStorage);
-- return uno::makeAny( *pValue );
-- }
-+ return uno::makeAny( *_aData.doubleValue );
-
- case Type::value_binary:
- {
-- uno::Sequence<sal_Int8> aValue = readBinary( _anAccessor, _aData.binaryValue );
-+ uno::Sequence<sal_Int8> aValue = readBinary( _aData.binaryValue );
- return uno::makeAny( aValue );
- }
-
-@@ -491,15 +470,15 @@ uno::Any readSimpleData(memory::Accessor
- }
- //-----------------------------------------------------------------------------
-
--uno::Any readData(memory::Accessor const& _anAccessor, TypeCode _aType, AnyData _aData)
-+uno::Any readData(TypeCode _aType, AnyData _aData)
- {
- OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
-
- if (_aType & Type::flag_sequence)
-- return readAnySequence(_anAccessor,TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
-+ return readAnySequence(TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
-
- else
-- return readSimpleData(_anAccessor,_aType,_aData);
-+ return readSimpleData(_aType,_aData);
- }
-
- //-----------------------------------------------------------------------------
-Index: configmgr/source/data/heap.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/heap.cxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 heap.cxx
---- configmgr/source/data/heap.cxx 16 Sep 2006 15:09:54 -0000 1.4
-+++ configmgr/source/data/heap.cxx 5 Jan 2007 22:25:41 -0000
-@@ -42,61 +42,5 @@
- #include <osl/diagnose.h>
- #endif
-
--// -----------------------------------------------------------------------------
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- const Heap::Size c_nDefaultSize = 4096;
-- // -------------------------------------------------------------------------
-- Heap::Heap(HeapManager& _impl)
-- : m_impl(_impl)
-- , m_heap(_impl.createHeap(c_nDefaultSize))
-- , m_size(c_nDefaultSize)
-- {
-- }
-- // -------------------------------------------------------------------------
--
-- Heap::Heap(HeapManager& _impl, Size _nInitialSize)
-- : m_impl(_impl)
-- , m_heap(_impl.createHeap(_nInitialSize))
-- , m_size(_nInitialSize)
-- {
-- }
-- // -------------------------------------------------------------------------
--
-- Heap::Heap(HeapManager& _impl, HeapId const & _anId)
-- : m_impl(_impl)
-- , m_size(0)
-- {
-- m_heap = _impl.attachHeap(_anId,m_size);
-- }
-- // -------------------------------------------------------------------------
--
-- Heap::~Heap()
-- {
-- m_impl.destroyHeap(m_heap);
-- }
-- // -------------------------------------------------------------------------
--
-- Heap::Size Heap::grow(Size _nReqSize) // returns the (possibly new) base
-- {
-- Size nNewSize = m_impl.growHeap(m_heap, _nReqSize);
--
-- if (nNewSize)
-- {
-- OSL_ENSURE(nNewSize >= _nReqSize, "Error: Heapmanager returns invalid size from grow method");
-- m_size = nNewSize;
-- }
--
-- return nNewSize;
-- }
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
-
-
-Index: configmgr/source/data/segmentheap.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/segmentheap.cxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 segmentheap.cxx
---- configmgr/source/data/segmentheap.cxx 16 Sep 2006 15:10:09 -0000 1.3
-+++ configmgr/source/data/segmentheap.cxx 5 Jan 2007 22:25:41 -0000
-@@ -36,73 +36,3 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_configmgr.hxx"
-
--#include "segmentheap.hxx"
--
--#ifndef _OSL_DIAGNOSE_H_
--#include <osl/diagnose.h>
--#endif
--
--// -----------------------------------------------------------------------------
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- const Heap::Size c_nMaxHeapSize = 0x40000000;
-- const Heap::Size c_nGrowFactor = 2;
--
-- // -------------------------------------------------------------------------
--
-- SegmentHeap::~SegmentHeap()
-- {
-- m_heap.destroyLock(m_lock);
-- }
-- // -------------------------------------------------------------------------
--
-- void SegmentHeap::init()
-- {
-- m_lock = m_heap.createLock();
-- m_base = m_heap.base();
--
-- OSL_ENSURE(m_lock,"Could not create heap lock");
-- }
-- // -------------------------------------------------------------------------
--
-- Heap::Address SegmentHeap::allocateMore(Size _sz)
-- {
-- Size nCurSize = m_heap.size();
--
-- OSL_ENSURE(_sz <= c_nMaxHeapSize,"Cannot allocate: Allocation request too large");
-- if (_sz > c_nMaxHeapSize) return 0;
--
-- Size nCurSizeLimit = (c_nMaxHeapSize-_sz)/c_nGrowFactor;
-- OSL_ENSURE(nCurSize < nCurSizeLimit,"Allocation will reach heap limit");
--
-- Size nNewSize = (nCurSize < nCurSizeLimit )
-- ? nCurSize * c_nGrowFactor + _sz
-- : c_nMaxHeapSize;
--
-- if (m_heap.grow(nNewSize))
-- {
-- m_base = m_heap.base();
--
-- Address aResult = m_heap.allocate(_sz);
--
-- OSL_ENSURE(aResult,"Cannot allocate even after growing heap");
--
-- return aResult;
-- }
-- else
-- {
-- OSL_ENSURE(false,"Cannot allocate: Heap could not be grown");
-- return 0;
-- }
-- }
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--
-Index: configmgr/source/data/sequence.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/sequence.cxx,v
-retrieving revision 1.6.12.1
-diff -u -p -u -r1.6.12.1 sequence.cxx
---- configmgr/source/data/sequence.cxx 3 Nov 2006 11:34:42 -0000 1.6.12.1
-+++ configmgr/source/data/sequence.cxx 5 Jan 2007 22:25:41 -0000
-@@ -64,9 +64,7 @@ namespace configmgr
- namespace Type = data::Type;
- namespace uno = ::com::sun::star::uno;
- typedef AnyData::TypeCode TypeCode;
-- using memory::Allocator;
- using memory::Accessor;
-- using memory::Pointer;
- //-----------------------------------------------------------------------------
- static
- sal_uInt32 implGetElementSize(TypeCode _aElementType)
-@@ -108,32 +106,20 @@ sal_uInt32 implGetHeaderSize(sal_uInt32
- //-----------------------------------------------------------------------------
- static
- inline
--sal_Int32& implGetSize(Allocator const& _anAllocator, Sequence _aSeq)
-+sal_Int32& implGetSize(Sequence _aSeq)
- {
-- OSL_ASSERT(_aSeq != 0);
-- void * pBase = _anAllocator.access(_aSeq);
-- return * static_cast<sal_Int32 *>(pBase);
-+ return * (sal_Int32 *) _aSeq;
- }
-
- //-----------------------------------------------------------------------------
- static
--inline
--sal_Int32 implGetSize(Accessor const& _anAccessor, Sequence _aSeq)
--{
-- OSL_ASSERT(_aSeq != 0);
-- void const * pBase = _anAccessor.access( Pointer(_aSeq) );
-- return * static_cast<sal_Int32 const *>(pBase);
--}
--
--//-----------------------------------------------------------------------------
--static
--Sequence implSeqAlloc(Allocator const& _anAllocator, sal_Int32 _nElements, sal_uInt32 _nElemSize)
-+Sequence implSeqAlloc(sal_Int32 _nElements, sal_uInt32 _nElemSize)
- {
- sal_uInt32 nTotalSize = implGetHeaderSize(_nElemSize) + _nElements * _nElemSize;
-
-- Sequence aResult = _anAllocator.allocate(nTotalSize);
-+ Sequence aResult = (Sequence) (new sal_uInt8[nTotalSize]);
-
-- implGetSize(_anAllocator,aResult) = _nElements;
-+ implGetSize(aResult) = _nElements;
-
- return aResult;
- }
-@@ -141,7 +127,7 @@ Sequence implSeqAlloc(Allocator const& _
- //-----------------------------------------------------------------------------
-
- static
--void allocSeqData(Allocator const& _anAllocator, Address _aDestAddr,
-+void allocSeqData(sal_uInt8 *_pDestAddr,
- TypeCode _aElementType,
- sal_Int32 _nElements, sal_uInt32 _nElementSize,
- void const * _pSourceData)
-@@ -155,7 +141,7 @@ void allocSeqData(Allocator const& _anAl
- case Type::value_int:
- case Type::value_long:
- case Type::value_double:
-- ::memcpy(_anAllocator.access(_aDestAddr),_pSourceData,_nElements * _nElementSize);
-+ ::memcpy(_pDestAddr,_pSourceData,_nElements * _nElementSize);
- break;
-
- case Type::value_string:
-@@ -168,11 +154,11 @@ void allocSeqData(Allocator const& _anAl
- {
- String aElement = allocString(*pSource);
-
-- String * pDest = static_cast<String*>( _anAllocator.access(_aDestAddr) );
-+ String * pDest = reinterpret_cast<String*>(_pDestAddr);
- *pDest = aElement;
-
- ++pSource;
-- _aDestAddr += sizeof *pDest;
-+ _pDestAddr += sizeof *pDest;
- }
- }
- break;
-@@ -186,13 +172,13 @@ void allocSeqData(Allocator const& _anAl
-
- while (--_nElements >= 0)
- {
-- Vector aElement = allocBinary(_anAllocator,*pSource);
-+ Vector aElement = allocBinary(*pSource);
-
-- Vector * pDest = static_cast<Vector*>( _anAllocator.access(_aDestAddr) );
-+ Vector * pDest = (Vector *) _pDestAddr;
- *pDest = aElement;
-
- ++pSource;
-- _aDestAddr += sizeof *pDest;
-+ _pDestAddr += sizeof *pDest;
- }
- }
- break;
-@@ -205,7 +191,7 @@ void allocSeqData(Allocator const& _anAl
- }
-
- //-----------------------------------------------------------------------------
--Sequence allocSequence(Allocator const& _anAllocator, TypeCode _aElementType, ::sal_Sequence const * _pSeqData)
-+Sequence allocSequence(TypeCode _aElementType, ::sal_Sequence const * _pSeqData)
- {
- OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
-
-@@ -218,10 +204,10 @@ Sequence allocSequence(Allocator const&
- sal_uInt32 const nElementSize = implGetElementSize(_aElementType);
- sal_Int32 const nElements = _pSeqData->nElements;
-
-- Sequence aResult = implSeqAlloc(_anAllocator,nElements,nElementSize);
-+ Sequence aResult = implSeqAlloc(nElements,nElementSize);
-
- if (aResult)
-- allocSeqData( _anAllocator, aResult + implGetHeaderSize(nElementSize),
-+ allocSeqData( aResult + implGetHeaderSize(nElementSize),
- _aElementType, nElements, nElementSize,
- _pSeqData->elements);
-
-@@ -229,31 +215,25 @@ Sequence allocSequence(Allocator const&
- }
-
- //-----------------------------------------------------------------------------
--Sequence allocBinary(Allocator const& _anAllocator, uno::Sequence<sal_Int8> const & _aBinaryValue)
-+Sequence allocBinary(uno::Sequence<sal_Int8> const & _aBinaryValue)
- {
- sal_uInt32 const nElementSize = 1;
- sal_Int32 const nLength = _aBinaryValue.getLength();
-
-- Sequence aResult = implSeqAlloc(_anAllocator,nLength,nElementSize);
-+ Sequence aResult = implSeqAlloc(nLength,nElementSize);
-
- if (aResult)
- {
-- Address aElementBaseAddr = aResult + implGetHeaderSize(nElementSize);
-- ::memcpy(_anAllocator.access(aElementBaseAddr), _aBinaryValue.getConstArray(), nLength);
-+ sal_uInt8 *pElementBaseAddr = aResult + implGetHeaderSize(nElementSize);
-+ ::memcpy(pElementBaseAddr, _aBinaryValue.getConstArray(), nLength);
- }
-
- return aResult;
- }
-
- //-----------------------------------------------------------------------------
--// Sequence copySequence(Allocator const& _anAllocator, TypeCode _aElementType, Sequence _aSeq)
--
--//-----------------------------------------------------------------------------
--// Sequence copyBinary(Allocator const& _anAllocator, Sequence _aSeq)
--
--//-----------------------------------------------------------------------------
- static
--void freeSeqData(Allocator const& _anAllocator, Address _aDataAddr,
-+void freeSeqData(sal_uInt8 *_pDataAddr,
- TypeCode _aElementType, sal_Int32 _nElements)
- {
- OSL_ASSERT(_aElementType == (_aElementType & Type::mask_basetype));
-@@ -270,7 +250,7 @@ void freeSeqData(Allocator const& _anAll
-
- case Type::value_string:
- {
-- String * pElements = static_cast<String*>( _anAllocator.access(_aDataAddr) );
-+ String * pElements = reinterpret_cast<String*>( _pDataAddr );
-
- for (sal_Int32 i = 0; i < _nElements; ++i)
- {
-@@ -281,11 +261,11 @@ void freeSeqData(Allocator const& _anAll
-
- case Type::value_binary:
- {
-- Vector * pElements = static_cast<Vector*>( _anAllocator.access(_aDataAddr) );
-+ Vector * pElements = reinterpret_cast<Vector*>( _pDataAddr );
-
- for (sal_Int32 i = 0; i < _nElements; ++i)
- {
-- freeBinary(_anAllocator,pElements[i]);
-+ freeBinary(pElements[i]);
- }
- }
- break;
-@@ -298,7 +278,7 @@ void freeSeqData(Allocator const& _anAll
- }
-
- //-----------------------------------------------------------------------------
--void freeSequence(Allocator const& _anAllocator, TypeCode _aElementType, Sequence _aSeq)
-+void freeSequence(TypeCode _aElementType, Sequence _aSeq)
- {
- OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
-
-@@ -310,18 +290,18 @@ void freeSequence(Allocator const& _anAl
-
- sal_uInt32 nHeaderSize = implGetHeaderSize( implGetElementSize( _aElementType ) );
-
-- freeSeqData(_anAllocator,_aSeq + nHeaderSize, _aElementType, implGetSize(_anAllocator,_aSeq));
-+ freeSeqData(_aSeq + nHeaderSize, _aElementType, implGetSize(_aSeq));
-
-- _anAllocator.deallocate(_aSeq);
-+ delete[] (sal_uInt8 *)_aSeq;
- }
-
- //-----------------------------------------------------------------------------
--void freeBinary(memory::Allocator const& _anAllocator, Sequence _aSeq)
-+void freeBinary(Sequence _aSeq)
- {
- OSL_ENSURE(_aSeq, "ERROR: Trying to free a NULL sequence");
- if (_aSeq == 0) return;
-
-- _anAllocator.deallocate(_aSeq);
-+ delete[] (sal_uInt8 *)_aSeq;
- }
-
- //-----------------------------------------------------------------------------
-@@ -342,11 +322,11 @@ sal_Sequence * implCreateSequence(void c
-
- //-----------------------------------------------------------------------------
- static
--sal_Sequence * readSeqData(Accessor const & _anAccessor, Address _aDataAddr, TypeCode _aElementType, sal_Int32 _nElements)
-+sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_Int32 _nElements)
- {
- OSL_ASSERT(_aElementType == (_aElementType & Type::mask_basetype));
-
-- void const * pElementData = _anAccessor.validate( Pointer(_aDataAddr) );
-+ void const * pElementData = (void const *)_pDataAddr;
- switch (_aElementType)
- {
- case Type::value_boolean:
-@@ -384,7 +364,7 @@ sal_Sequence * readSeqData(Accessor cons
-
- for (sal_Int32 i = 0; i < _nElements; ++i)
- {
-- pResult[i] = readBinary(_anAccessor,pElements[i]);
-+ pResult[i] = readBinary(pElements[i]);
- }
-
- sal_Sequence * pRet = aResult.get();
-@@ -401,7 +381,7 @@ sal_Sequence * readSeqData(Accessor cons
-
- //-----------------------------------------------------------------------------
-
--::sal_Sequence * readSequence(Accessor const& _anAccessor, TypeCode _aElementType, Sequence _aSeq)
-+::sal_Sequence * readSequence(TypeCode _aElementType, Sequence _aSeq)
- {
- OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
-
-@@ -413,13 +393,14 @@ sal_Sequence * readSeqData(Accessor cons
-
- sal_uInt32 nHeaderSize = implGetHeaderSize( implGetElementSize( _aElementType ) );
-
-- return readSeqData(_anAccessor,_aSeq + nHeaderSize, _aElementType, implGetSize(_anAccessor,_aSeq));
-+ // URG - accidentally removed an accessor instead of an allocator ... :-)
-+ return readSeqData(_aSeq + nHeaderSize, _aElementType, implGetSize(_aSeq));
- }
-
- //-----------------------------------------------------------------------------
--uno::Any readAnySequence(Accessor const& _anAccessor, TypeCode _aElementType, Sequence _aSeq)
-+uno::Any readAnySequence(TypeCode _aElementType, Sequence _aSeq)
- {
-- sal_Sequence * pRawSequence = readSequence(_anAccessor, _aElementType, _aSeq);
-+ sal_Sequence * pRawSequence = readSequence(_aElementType, _aSeq);
-
- uno::Any aResult;
-
-@@ -487,20 +468,13 @@ uno::Any readAnySequence(Accessor const&
- }
-
- //-----------------------------------------------------------------------------
--uno::Sequence<sal_Int8> readBinary(Accessor const& _anAccessor, Sequence _aSeq)
-+uno::Sequence<sal_Int8> readBinary(Sequence _aSeq)
- {
- OSL_ENSURE(_aSeq, "ERROR: Trying to read from a NULL sequence");
- if (_aSeq == 0) return uno::Sequence<sal_Int8>();
-
-- sal_Int32 const nElements = implGetSize(_anAccessor,_aSeq);
--
-- void const * const pElementData = _anAccessor.validate( Pointer(_aSeq + implGetHeaderSize(1)) );
--
-- sal_Int8 const * const pBinaryData = static_cast<sal_Int8 const *>(pElementData);
--
-- uno::Sequence< sal_Int8 > aSequence(pBinaryData,nElements);
--
-- return aSequence;
-+ return uno::Sequence< sal_Int8 >((const sal_Int8 *)(_aSeq + implGetHeaderSize(1)),
-+ implGetSize(_aSeq));
- }
-
- //-----------------------------------------------------------------------------
-Index: configmgr/source/data/simpleheap.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/simpleheap.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 simpleheap.cxx
---- configmgr/source/data/simpleheap.cxx 16 Sep 2006 15:10:36 -0000 1.8
-+++ configmgr/source/data/simpleheap.cxx 5 Jan 2007 22:25:41 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -57,418 +58,3 @@
- #include <map>
- #define INCLUDED_MAP
- #endif
--
--#ifdef _MSC_VER
--#pragma warning( disable : 4355 )
--#endif
--
--// -----------------------------------------------------------------------------
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- extern HeapManager & localHeap();
-- // -------------------------------------------------------------------------
-- struct OrderByHeapId
-- {
-- typedef HeapManager::HeapIdParam HeapIdParam;
--
-- bool operator()(HeapIdParam lhs, HeapIdParam rhs) const
-- {
-- return lhs.compareTo(rhs) < 0;
-- }
-- };
-- // -------------------------------------------------------------------------
-- struct HeapSet
-- {
-- typedef HeapManager::HeapIdParam HeapIdParam;
-- typedef HeapManager::HeapId HeapId;
-- typedef HeapManager::Handle Heap;
--
-- typedef std::map<HeapId,Heap,OrderByHeapId> Map;
--
-- HeapSet(HeapManager & _mgr) : m_mgr(_mgr) {}
--
-- Heap add(Heap _aHeap) { return m_heaps[m_mgr.id(_aHeap)] = _aHeap; }
-- void remove(Heap _aHeap) { m_heaps.erase(m_mgr.id(_aHeap)); }
--
-- Heap heap(HeapIdParam _anId) const
-- {
-- Map::const_iterator it = m_heaps.find(_anId);
-- return it != m_heaps.end() ? it->second : NULL;
-- }
-- private:
-- HeapManager & m_mgr;
-- Map m_heaps;
-- };
-- // -------------------------------------------------------------------------
-- class SimpleHeapManagerBase : public HeapManager
-- {
-- static void * ptr(Address _address) { return reinterpret_cast<void*>(_address); }
-- static Address address(void * _ptr) { return reinterpret_cast<Address>(_ptr); }
-- // if this static assertion breaks, a less simple heap manager is needed (-> 64 bit ports)
-- static char address_can_hold_any_pointer[sizeof(Address) - sizeof(void*) + 1];
--
-- virtual void * base(Handle _aHeap);
-- protected:
-- SimpleHeapManagerBase() : m_heaps( *(HeapManager*)this) {}
-- virtual ~SimpleHeapManagerBase() {}
--
-- Handle addHeap(Handle _aHeap) { return m_heaps.add(_aHeap); }
-- void removeHeap(Handle _aHeap) { m_heaps.remove(_aHeap); }
--
-- Handle findHeap( HeapId _anId )
-- {
-- osl::MutexGuard aGuard(m_mutex);
-- return m_heaps.heap(_anId);
-- }
--
-- osl::Mutex & getHeapListMutex() { return m_mutex; }
-- protected:
-- Address allocateMemory(Size _sz);
-- Address reallocateMemory(Address _p, Size _sz);
-- void deallocateMemory(Address _p);
--
-- protected:
-- virtual Lock * createHeapLock(Handle _aHeap);
-- virtual void destroyHeapLock(Handle _aHeap, Lock * _pLock);
--
-- private:
-- osl::Mutex m_mutex;
-- HeapSet m_heaps;
-- };
-- // -------------------------------------------------------------------------
-- class SimpleCheckingHeapManager : public SimpleHeapManagerBase
-- {
-- struct HeapData
-- {
-- HeapId id;
--
-- oslInterlockedCount refs;
--
-- Size requested;
-- Size allocated;
--
-- Size available() const { return requested-allocated; }
--
-- typedef std::map<Address, Size> Map;
-- Map allocations;
-- };
--
-- static HeapData * heap(Handle _handle) { return reinterpret_cast<HeapData*>(_handle); }
-- static Handle handle(HeapData * _data) { return reinterpret_cast<Handle>(_data); }
--
-- static void makeNewId(HeapData * _data);
-- public:
-- virtual Handle createHeap(Size _sInitialSize);
-- virtual Handle attachHeap(HeapIdParam _anId, Size & _rInitialSize);
-- virtual Size growHeap(Handle _aHeap, Size _sNewSize);
-- virtual void destroyHeap(Handle _aHeap);
--
-- virtual HeapId id(Handle _aHeap);
--
-- virtual Address allocate(Handle _aHeap, Size _sNewSize);
-- virtual Address reallocate(Handle _aHeap, Address _aOldAddress, Size _sNewSize);
-- virtual void deallocate(Handle _aHeap, Address _aAddress);
-- virtual bool didAllocate(Handle _aHeap, Address _aAddress);
-- };
-- // -------------------------------------------------------------------------
-- class SimpleHeapLock : public DataLock
-- {
-- osl::Mutex m_mutex;
-- public:
-- virtual void acquireReadAccess() { m_mutex.acquire(); }
-- virtual void releaseReadAccess() { m_mutex.release(); }
--
-- virtual void acquireWriteAccess() { m_mutex.acquire(); }
-- virtual void releaseWriteAccess() { m_mutex.release(); }
-- };
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
-- HeapManager & cacheHeap()
-- {
-- static SimpleCheckingHeapManager aInstance;
-- return aInstance;
-- }
-- // -------------------------------------------------------------------------
-- HeapManager & localHeap()
-- {
-- static SimpleCheckingHeapManager aInstance;
-- return aInstance;
-- }
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
--
-- HeapManager::Address SimpleHeapManagerBase::allocateMemory(Size _sz)
-- {
-- void * p = ::rtl_allocateMemory(_sz);
--
-- OSL_ENSURE(p,"Could not allocate: std::malloc failed");
--
-- return address(p);
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Address SimpleHeapManagerBase::reallocateMemory(Address _p, Size _sz)
-- {
-- void * pOld = ptr(_p);
--
-- void * pNew = ::rtl_reallocateMemory(pOld,_sz);
--
-- OSL_ENSURE(pNew,"Could not reallocate: std::realloc failed");
--
-- return address(pNew);
-- }
-- // -------------------------------------------------------------------------
--
-- void SimpleHeapManagerBase::deallocateMemory(Address _p)
-- {
-- void * p = ptr(_p);
--
-- ::rtl_freeMemory(p);
-- }
-- // -------------------------------------------------------------------------
--
-- void * SimpleHeapManagerBase::base(Handle /*_aHeap*/)
-- {
-- return NULL;
-- }
-- // -------------------------------------------------------------------------
--
-- DataLock * SimpleHeapManagerBase::createHeapLock(Handle )
-- {
-- return new SimpleHeapLock();
-- }
-- // -------------------------------------------------------------------------
--
-- void SimpleHeapManagerBase::destroyHeapLock(Handle , DataLock * _pLock)
-- {
-- if (SimpleHeapLock* pMyLock = /*dynamic_*/ static_cast<SimpleHeapLock*>(_pLock))
-- {
-- delete pMyLock;
-- }
-- }
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
--
-- void SimpleCheckingHeapManager::makeNewId(HeapData * _data)
-- {
-- OSL_PRECOND( _data, "Internal Error: NULL data");
--
-- sal_Int64 nData = reinterpret_cast<sal_Int64>(_data);
--
-- HeapId aNewId = HeapId::valueOf(nData,16);
--
-- _data->id = aNewId;
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::HeapId SimpleCheckingHeapManager::id(Handle _aHeap)
-- {
-- if (_aHeap == 0) return HeapId();
--
-- HeapData * data = heap(_aHeap);
--
-- return data->id;
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Handle SimpleCheckingHeapManager::createHeap(Size _sInitialSize)
-- {
-- // need to have 4-byte pointers for this implementation
-- OSL_ASSERT(sizeof(void *) == sizeof(Address));
--
-- HeapData * pHeap = new HeapData();
--
-- pHeap->refs = 1;
--
-- pHeap->requested = _sInitialSize;
-- pHeap->allocated = 0;
--
-- osl::MutexGuard aGuard( getHeapListMutex() );
--
-- makeNewId( pHeap );
--
-- OSL_ENSURE( ! findHeap(pHeap->id), "Internal Error: New heap id already registered");
--
-- return addHeap(handle(pHeap) );
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Handle SimpleCheckingHeapManager::attachHeap(HeapIdParam _anId, Size & _rInitialSize)
-- {
-- osl::MutexGuard aGuard( getHeapListMutex() );
--
-- Handle aHeap = findHeap(_anId);
--
-- OSL_ENSURE( aHeap, "Error: No such Heap");
--
-- if (aHeap != 0)
-- {
-- HeapData * data = heap(aHeap);
--
-- OSL_ENSURE( data->id == _anId, "Internal error: Inconsistent heap id");
--
-- _rInitialSize = data->requested;
--
-- ++data->refs;
-- }
-- else
-- _rInitialSize = 0;
--
-- return aHeap;
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Size SimpleCheckingHeapManager::growHeap(Handle _aHeap, Size _sNewSize)
-- {
-- OSL_PRECOND( _aHeap, "Error: NULL data");
--
-- HeapData * data = heap(_aHeap);
--
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- if (data->requested < _sNewSize) data->requested = _sNewSize;
--
-- return data->requested;
-- }
-- // -------------------------------------------------------------------------
--
-- void SimpleCheckingHeapManager::destroyHeap(Handle _aHeap)
-- {
-- OSL_PRECOND( _aHeap, "Error: NULL data");
--
-- HeapData * data = heap(_aHeap);
--
-- osl::MutexGuard aGuard( getHeapListMutex() );
--
-- if (0 == --data->refs)
-- {
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- // OSL_ENSURE(data->allocations.empty(), "Memory leaks found");
-- for (HeapData::Map::iterator it = data->allocations.begin();
-- it != data->allocations.end();
-- ++it)
-- {
-- deallocateMemory(it->first);
-- data->allocated -= it->second;
--
-- }
-- OSL_ENSURE(data->allocated == 0, "Memory tracking error detected");
--
-- removeHeap(_aHeap);
--
-- delete data;
-- }
-- }
-- // -------------------------------------------------------------------------
--
-- bool SimpleCheckingHeapManager::didAllocate(Handle _aHeap, Address _aAddress)
-- {
-- OSL_PRECOND( _aHeap, "Error: NULL data");
-- OSL_PRECOND( _aAddress, "Warning: checking NULL address - will fail");
--
-- HeapData * data = heap(_aHeap);
--
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- /* Condition is:
-- allocationAddress <= _aAddress &&
-- _aAddress <= allocationAddress + allocationSize
-- (<= to allow past-the-end pointer)
-- */
--
-- HeapData::Map::iterator it = data->allocations.upper_bound(_aAddress);
--
-- if (it == data->allocations.begin())
-- return false;
--
-- --it; // Now it is the last iterator that is less than or equal to _aAddress
--
-- OSL_ASSERT( it->first <= _aAddress ); // first part of condition handled by map
--
-- return _aAddress <= it->first + it->second;
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Address SimpleCheckingHeapManager::allocate(Handle _aHeap, Size _nSize)
-- {
-- OSL_PRECOND( _aHeap, "Error: NULL data");
--
-- HeapData * data = heap(_aHeap);
--
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- if (_nSize > data->available())
-- return 0;
--
-- Address p = allocateMemory(_nSize);
-- if (p)
-- {
-- data->allocations[p] = _nSize;
-- data->allocated += _nSize;
-- }
-- return p;
-- }
-- // -------------------------------------------------------------------------
--
-- HeapManager::Address SimpleCheckingHeapManager::reallocate(Handle _aHeap, Address _aOld, Size _nNewSize)
-- {
-- if (_aOld == 0) return allocate(_aHeap,_nNewSize);
--
-- OSL_PRECOND( _aHeap, "Error: NULL data");
--
-- HeapData * data = heap(_aHeap);
--
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- OSL_ENSURE( data->allocations.count(_aOld), "Error: pointer being reallocated is not from this data");
--
-- Size nOldSize = data->allocations[_aOld];
--
-- if (nOldSize >= _nNewSize)
-- return _aOld;
--
-- if (_nNewSize-nOldSize > data->available())
-- return 0;
--
-- Address aNew = reallocateMemory(_aOld,_nNewSize);
-- if (aNew)
-- {
-- if (aNew != _aOld) data->allocations.erase(_aOld);
--
-- data->allocations[aNew] = _nNewSize;
-- data->allocated += _nNewSize - nOldSize;
-- }
--
-- return aNew;
-- }
-- // -------------------------------------------------------------------------
--
-- void SimpleCheckingHeapManager::deallocate(Handle _aHeap, Address _p)
-- {
-- OSL_PRECOND( _aHeap, "Error: NULL data");
-- OSL_PRECOND( _p, "Error: Trying to free NULL address");
--
-- HeapData * data = heap(_aHeap);
--
-- OSL_ENSURE( findHeap(data->id) == _aHeap, "Internal error: Inconsistent heap id");
--
-- OSL_ENSURE( data->allocations.count(_p), "Error: pointer being freed is not from this data");
--
-- Size freed = data->allocations[_p];
-- data->allocated -= freed;
-- data->allocations.erase(_p);
--
-- deallocateMemory(_p);
-- }
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--
-Index: configmgr/source/data/updateaccessor.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/data/updateaccessor.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 updateaccessor.cxx
---- configmgr/source/data/updateaccessor.cxx 16 Sep 2006 15:11:05 -0000 1.7
-+++ configmgr/source/data/updateaccessor.cxx 5 Jan 2007 22:25:41 -0000
-@@ -57,13 +57,13 @@ namespace configmgr
- UpdateAccessor::UpdateAccessor(Segment * segment)
- : m_segment(segment)
- {
-- m_heap = (m_segment) ? &m_segment->acquireWriteAccess() : 0;
-- OSL_ASSERT( m_heap || !m_segment );
-+ m_segment->acquireWriteAccess();
- }
- // -------------------------------------------------------------------------
- UpdateAccessor::~UpdateAccessor()
- {
-- if (m_segment) m_segment->releaseWriteAccess(*m_heap);
-+ if (m_segment)
-+ m_segment->releaseWriteAccess();
- }
- // -------------------------------------------------------------------------
- Accessor UpdateAccessor::accessor() const
-@@ -75,15 +75,14 @@ namespace configmgr
- Accessor UpdateAccessor::downgrade()
- {
- Segment * segment = m_segment;
-- void const * base = NULL;
-+
- if (m_segment)
- {
-- base = m_segment->acquireReadAccess();
-- m_segment->releaseWriteAccess(*m_heap);
-+ m_segment->downgradeAccess();
- m_segment = 0;
- }
-
-- return Accessor(segment, base, SAL_NO_ACQUIRE);
-+ return Accessor(segment, SAL_NO_ACQUIRE);
- }
-
- // -------------------------------------------------------------------------
-@@ -91,79 +90,10 @@ namespace configmgr
- {
- if (m_segment)
- {
-- m_segment->releaseWriteAccess(*m_heap);
-+ m_segment->releaseWriteAccess();
- m_segment = NULL;
- }
- }
--
-- // -------------------------------------------------------------------------
-- char * UpdateAccessor::heap_base() const
-- {
-- return static_cast<char *>(m_heap ? m_heap->base() : NULL);
-- }
--
-- // -------------------------------------------------------------------------
-- char * Allocator::heap_base() const
-- {
-- return static_cast<char *>(m_heap ? m_heap->base() : NULL);
-- }
--
-- // -------------------------------------------------------------------------
-- Allocator::Address Allocator::allocate(Size _sz) const
-- {
-- OSL_ENSURE(m_heap,"Cannot allocate: Invalid heap");
-- return m_heap ? m_heap->allocate(_sz) : Allocator::Address();
-- }
--
-- // -------------------------------------------------------------------------
-- void Allocator::deallocate(Address _addr) const
-- {
-- OSL_ENSURE(m_heap,"Cannot deallocate: Invalid heap");
-- if (m_heap) m_heap->deallocate(_addr);
-- }
--
-- // -------------------------------------------------------------------------
--
-- #if OSL_DEBUG_LEVEL > 0
-- void * UpdateAccessor::resolve(AddressType _p) const
-- {
-- OSL_ENSURE( !_p.is() || m_segment->isValidAddress(_p.value()), "Address does not belong to this segment");
-- return _p.is() ? heap_base() + _p.value() : NULL;
-- }
--
-- Pointer UpdateAccessor::reduce(void const * _p) const
-- {
-- if (_p)
-- {
-- Pointer::RawAddress addr = static_cast<char const *>(_p) - heap_base();
-- OSL_ENSURE( m_segment->isValidAddress(addr), "Pointer does not belong to this segment");
-- return Pointer(addr);
-- }
-- else
-- return Pointer();
-- }
--
-- void * Allocator::access(Address _addr) const
-- {
-- OSL_ENSURE( !_addr || m_heap->isValidAddress(_addr), "Address does not belong to this segment");
-- return _addr ? heap_base() + _addr : NULL;
-- }
--
--
-- Allocator::Address Allocator::address(void const * _p) const
-- {
-- if (_p)
-- {
-- Address addr = static_cast<char const *>(_p) - heap_base();
-- OSL_ENSURE( m_heap->isValidAddress(addr), "Pointer does not belong to this segment");
-- return addr;
-- }
-- else
-- return 0;
-- }
-- #endif // OSL_DEBUG_LEVEL
--
-- // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/inc/accessor.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/accessor.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 accessor.hxx
---- configmgr/source/inc/accessor.hxx 8 Sep 2005 03:41:00 -0000 1.5
-+++ configmgr/source/inc/accessor.hxx 5 Jan 2007 22:25:41 -0000
-@@ -36,10 +36,6 @@
- #ifndef CONFIGMGR_ACCESSOR_HXX
- #define CONFIGMGR_ACCESSOR_HXX
-
--#ifndef CONFIGMGR_POINTER_HXX
--#include "pointer.hxx"
--#endif
--
- #ifndef _OSL_INTERLOCK_H_
- #include <osl/interlck.h>
- #endif
-@@ -57,14 +53,11 @@ namespace configmgr
- struct Impl
- {
- Impl(Segment const * segment);
-- Impl(Segment const * segment, void const * base);
--
- ~Impl();
-
- bool is() const { return m_segment != NULL; }
-
- Segment const * m_segment;
-- char const * m_base;
- oslInterlockedCount m_refs;
- private:
- // disallow copying
-@@ -78,9 +71,6 @@ namespace configmgr
-
- Impl * m_impl;
- public:
-- /// type of addresses used in the Segment
-- typedef Pointer AddressType;
--
- /// constructs an accessor on the given Segment
- explicit Accessor(Segment const * _pSegment) : m_impl(new Impl(_pSegment)) {}
-
-@@ -90,45 +80,12 @@ namespace configmgr
-
- ~Accessor() { releaseImpl(); }
-
-- void swap(Accessor & _rOther);
--
- bool is() const { return m_impl->is(); }
- void clear();
--
-- AddressType address(void const * _p) const
-- { return (this->is()) ? reduce(_p) : Pointer();}
--
-- void const * access(AddressType _p) const
-- { return (this->is()) ? resolve(_p) : failNull();}
--
-- void const * validate(AddressType _p) const
-- { return (this->is() && _p.is()) ? resolve(_p) : failNull(); }
--
- private:
-- char const * base_() const { return m_impl->m_base; }
-- Segment const * segment_() const { return m_impl->m_segment; }
--
-- void const * resolve(AddressType _p) const;
-- AddressType reduce(void const * _p) const;
--
- friend class UpdateAccessor;
-- Accessor(Segment * _s, void const * _b, __sal_NoAcquire) : m_impl(new Impl(_s,_b)) {}
-- static void * failNull();
-+ Accessor(Segment * _s, __sal_NoAcquire) : m_impl(new Impl(_s)) {}
- };
--
-- // -------------------------------------------------------------------------
--
-- #if OSL_DEBUG_LEVEL == 0
-- inline
-- void const * Accessor::resolve(AddressType _p) const
-- { return _p.is() ? this->base_() + _p.value() : NULL; }
--
-- inline
-- Pointer Accessor::reduce(void const * _p) const
-- { return _p ? Pointer(static_cast<char const *>(_p) - this->base_()) : Pointer(); }
-- #endif // OSL_DEBUG_LEVEL
--
-- // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/inc/anydata.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/anydata.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 anydata.hxx
---- configmgr/source/inc/anydata.hxx 8 Sep 2005 03:41:13 -0000 1.2
-+++ configmgr/source/inc/anydata.hxx 5 Jan 2007 22:25:41 -0000
-@@ -51,28 +51,25 @@ namespace configmgr
- {
- //-----------------------------------------------------------------------------
-
-- namespace memory { class Allocator; class Accessor; }
-- //-----------------------------------------------------------------------------
-+ namespace memory { class Accessor; };
-
- namespace sharable
- {
- //-----------------------------------------------------------------------------
-
-- //typedef Address AnyData; // data that fits is stored inline
- union AnyData
- {
-- typedef Byte TypeCode;
-+ typedef sal_uInt8 TypeCode;
-
-- Address data;
- sal_Bool boolValue;
- sal_Int16 shortValue;
- sal_Int32 intValue;
-- Address longValue; // points to sal_Int64
-- Address doubleValue; // points to double (IEEE 8-bit) ...
-- // float floatValue; // ... or should we use float (IEEE 4-bit) ?
-+ sal_Int64 *longValue;
-+ double *doubleValue;
- Vector binaryValue; // points to counted sal_(u)Int8 []
- String stringValue; // points to counted sal_Unicode []
- Vector sequenceValue; // points to counted AnyData [] (or SomeType [] ?)
-+ void *data; // used to initialize to 0
- };
-
- //-----------------------------------------------------------------------------
-@@ -80,10 +77,9 @@ namespace configmgr
- AnyData::TypeCode getTypeCode(::com::sun::star::uno::Type const & _aType);
- ::com::sun::star::uno::Type getUnoType( AnyData::TypeCode _aType);
-
-- AnyData allocData(memory::Allocator const& _anAllocator, AnyData::TypeCode _aType, ::com::sun::star::uno::Any const & _aAny);
-- // AnyData copyData(memory::Allocator const& _anAllocator, AnyData::TypeCode _aType, AnyData _aData);
-- void freeData(memory::Allocator const& _anAllocator, AnyData::TypeCode _aType, AnyData _aData);
-- ::com::sun::star::uno::Any readData(memory::Accessor const& _anAccessor, AnyData::TypeCode _aType, AnyData _aData);
-+ AnyData allocData(AnyData::TypeCode _aType, ::com::sun::star::uno::Any const & _aAny);
-+ void freeData(AnyData::TypeCode _aType, AnyData _aData);
-+ ::com::sun::star::uno::Any readData(AnyData::TypeCode _aType, AnyData _aData);
-
- //-----------------------------------------------------------------------------
- }
-Index: configmgr/source/inc/builddata.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/builddata.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 builddata.hxx
---- configmgr/source/inc/builddata.hxx 8 Sep 2005 03:43:35 -0000 1.2
-+++ configmgr/source/inc/builddata.hxx 5 Jan 2007 22:25:41 -0000
-@@ -36,6 +36,9 @@
- #ifndef CONFIGMGR_BUILDDATA_HXX
- #define CONFIGMGR_BUILDDATA_HXX
-
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
- #ifndef INCLUDED_MEMORY
- #define INCLUDED_MEMORY
- #include <memory>
-@@ -52,10 +55,10 @@ namespace configmgr
- //-----------------------------------------------------------------------------
- namespace memory { class Accessor; class UpdateAccessor; }
- //-----------------------------------------------------------------------------
-+ namespace sharable { struct TreeFragment; }
- namespace data
- {
- //-----------------------------------------------------------------------------
-- class TreeAddress;
- class TreeAccessor;
- //-----------------------------------------------------------------------------
- TreeAddress buildTree(memory::UpdateAccessor& _aTargetMemory, TreeAccessor const& _aTree);
-Index: configmgr/source/inc/cacheddataprovider.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/cacheddataprovider.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 cacheddataprovider.hxx
---- configmgr/source/inc/cacheddataprovider.hxx 8 Sep 2005 03:43:49 -0000 1.5
-+++ configmgr/source/inc/cacheddataprovider.hxx 5 Jan 2007 22:25:41 -0000
-@@ -51,7 +51,9 @@
- #ifndef CONFIGMGR_UTILITY_HXX_
- #include "utility.hxx"
- #endif
--
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
- #ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
- #include <salhelper/simplereferenceobject.hxx>
- #endif
-@@ -65,13 +67,7 @@ namespace configmgr
- namespace backend
- {
- // ---------------------------------------------------------------------------
-- struct CacheLocation
-- {
-- memory::SegmentAddress segment;
-- memory::SegmentHeap::Address address;
--
-- bool isNull() const { return segment.isNull() || address == 0; }
-- };
-+ typedef data::TreeAddress CacheLocation;
- // ---------------------------------------------------------------------------
- struct IDirectDataProvider;
- struct ICachedDataNotifier;
-Index: configmgr/source/inc/change.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/change.hxx,v
-retrieving revision 1.25
-diff -u -p -u -r1.25 change.hxx
---- configmgr/source/inc/change.hxx 25 Sep 2006 12:48:57 -0000 1.25
-+++ configmgr/source/inc/change.hxx 5 Jan 2007 22:25:41 -0000
-@@ -45,9 +45,6 @@
- #ifndef CONFIGMGR_TREESEGMENT_HXX
- #include "treesegment.hxx"
- #endif
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
--#endif
-
- #ifndef _SAL_TYPES_H_
- #include <sal/types.h>
-@@ -242,7 +239,7 @@ namespace configmgr
- bool isReplacing() const { return m_bReplacing; }
-
- /// has this been applied and inserted
-- bool wasInserted() const { return m_aInsertedTree.is(); }
-+ bool wasInserted() const { return m_aInsertedTree != NULL; }
-
- /** returns the node this change represents, even if this node does not own the new Node object any more.
- This is somewhat dangerous if the node referenced by this object dies before the object itself does.<BR>
-Index: configmgr/source/inc/configset.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/configset.hxx,v
-retrieving revision 1.15
-diff -u -p -u -r1.15 configset.hxx
---- configmgr/source/inc/configset.hxx 8 Sep 2005 03:46:23 -0000 1.15
-+++ configmgr/source/inc/configset.hxx 5 Jan 2007 22:25:41 -0000
-@@ -107,7 +107,7 @@ namespace configmgr
-
- TemplateHolder getTemplate() const;
-
-- ElementTree getElementTree(data::Accessor const& _accessor) const;
-+ ElementTree getElementTree(memory::Accessor const& _accessor) const;
- osl::Mutex& getTreeLock() const;
-
- TreeRef getTreeRef() const;
-@@ -120,12 +120,12 @@ namespace configmgr
- class ElementTree
- {
- ElementTreeHolder m_aTreeHolder;
-- data::Accessor m_accessor;
-+ memory::Accessor m_accessor;
- public:
- static ElementTree emptyElement() { return ElementTree(); }
-
-- ElementTree(data::Accessor const& _accessor, ElementTreeImpl* pTree);
-- ElementTree(data::Accessor const& _accessor, ElementTreeHolder const& pTree);
-+ ElementTree(memory::Accessor const& _accessor, ElementTreeImpl* pTree);
-+ ElementTree(memory::Accessor const& _accessor, ElementTreeHolder const& pTree);
- ElementTree(ElementTree const& aOther);
- ElementTree& operator=(ElementTree const& aOther);
- ~ElementTree();
-@@ -171,16 +171,16 @@ namespace configmgr
- class SetElementInfo
- {
- TemplateInfo m_aTemplateInfo;
-- data::Accessor m_aSetAccessor;
-+ memory::Accessor m_aSetAccessor;
- public:
-- SetElementInfo(data::Accessor const& _aSetAccessor, TemplateHolder const& aTemplate);
-+ SetElementInfo(memory::Accessor const& _aSetAccessor, TemplateHolder const& aTemplate);
-
- TemplateHolder getTemplate() const;
- TemplateInfo getTemplateInfo() const;
-
- UnoType getElementType() const { return m_aTemplateInfo.getType(); }
-
-- data::Accessor getSetDataAccessor() const { return m_aSetAccessor; }
-+ memory::Accessor getSetDataAccessor() const { return m_aSetAccessor; }
-
- static TemplateHolder extractElementInfo(Tree const& aTree, NodeRef const& aNode);
- };
-@@ -189,11 +189,11 @@ namespace configmgr
- class SetElementFactory
- {
- TemplateProvider m_aProvider;
-- data::Accessor m_aDataAccessor;
-+ memory::Accessor m_aDataAccessor;
-
-- data::Accessor const& getDataAccessor() const { return m_aDataAccessor; };
-+ memory::Accessor const& getDataAccessor() const { return m_aDataAccessor; };
- public:
-- SetElementFactory(data::Accessor const& _aDataAccessor, TemplateProvider const& aProvider);
-+ SetElementFactory(memory::Accessor const& _aDataAccessor, TemplateProvider const& aProvider);
- SetElementFactory(SetElementFactory const& aOther);
- SetElementFactory& operator=(SetElementFactory const& aOther);
- ~SetElementFactory();
-Index: configmgr/source/inc/datalock.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/datalock.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 datalock.hxx
---- configmgr/source/inc/datalock.hxx 8 Sep 2005 03:46:50 -0000 1.3
-+++ configmgr/source/inc/datalock.hxx 5 Jan 2007 22:25:41 -0000
-@@ -33,31 +33,3 @@
- *
- ************************************************************************/
-
--#ifndef CONFIGMGR_DATALOCK_HXX
--#define CONFIGMGR_DATALOCK_HXX
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
--
-- /// class controlling access to a memory::Segment
-- struct DataLock
-- {
-- virtual void acquireReadAccess() = 0;
-- virtual void releaseReadAccess() = 0;
--
-- virtual void acquireWriteAccess() = 0;
-- virtual void releaseWriteAccess() = 0;
-- protected:
-- virtual ~DataLock() {}
-- };
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--#endif // CONFIGMGR_DATALOCK_HXX
--
-Index: configmgr/source/inc/groupnodeaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/groupnodeaccess.hxx,v
-retrieving revision 1.5.74.1
-diff -u -p -u -r1.5.74.1 groupnodeaccess.hxx
---- configmgr/source/inc/groupnodeaccess.hxx 3 Nov 2006 11:35:17 -0000 1.5.74.1
-+++ configmgr/source/inc/groupnodeaccess.hxx 5 Jan 2007 22:25:41 -0000
-@@ -51,27 +51,20 @@ namespace configmgr
- public:
- typedef NodeAccess::Name Name;
- typedef NodeAccess::Attributes Attributes;
-- typedef GroupNodeAddress NodeAddressType;
-- typedef GroupNodeAddress::AddressType AddressType;
-- typedef GroupNodeAddress::DataType const DataType;
-- typedef DataType * NodePointerType;
- typedef NodeAddress ChildAddressType;
- typedef NodeAccessRef ChildAccessType;
-
-- GroupNodeAccess(Accessor const& _aAccessor, NodeAddressType const& _aNodeRef)
-+ GroupNodeAccess(memory::Accessor const& _aAccessor, const sharable::GroupNode *_pNodeRef)
- : m_aAccessor(_aAccessor)
-- , m_pData(_aNodeRef.m_pData)
-- {}
--
-- GroupNodeAccess(Accessor const& _aAccessor, NodePointerType _pNode)
-- : m_aAccessor(_aAccessor)
-- , m_pData(check(_aAccessor,_pNode))
-+ , m_pData((GroupNodeAddress)_pNodeRef)
-+ , m_pCache(NULL)
- {}
-
- explicit
- GroupNodeAccess(NodeAccess const & _aNode)
- : m_aAccessor(_aNode.accessor())
- , m_pData(check(_aNode))
-+ , m_pCache(NULL)
- {
- }
-
-@@ -79,8 +72,10 @@ namespace configmgr
- GroupNodeAccess(NodeAccessRef const & _aNode)
- : m_aAccessor(_aNode.accessor())
- , m_pData(check(_aNode))
-+ , m_pCache(NULL)
- {
- }
-+ ~GroupNodeAccess();
-
- static bool isInstance(NodeAccessRef const & _aNode)
- {
-@@ -95,31 +90,30 @@ namespace configmgr
- bool isDefault() const;
-
- bool hasChild(Name const& _aName) const
-- { return implGetChild(_aName).is(); }
-+ { return implGetChild(_aName) != NULL; }
-
- bool hasChildren() const;
-
- ChildAccessType getChildNode(Name const& _aName) const
- { return NodeAccessRef(&m_aAccessor, implGetChild(_aName)); }
-
-- NodeAddressType address() const { return NodeAddressType(m_pData); }
-- Accessor const& accessor() const { return m_aAccessor; }
-+ memory::Accessor const& accessor() const { return m_aAccessor; }
-
- operator NodeAccessRef() const { return NodeAccessRef(&m_aAccessor,NodeAddress(m_pData)); }
-
-- DataType& data() const { return *static_cast<NodePointerType>(m_aAccessor.validate(m_pData)); }
-+ sharable::GroupNode& data() const { return *m_pData; }
-+ operator GroupNodeAddress () const { return (GroupNodeAddress)m_pData; }
-
- private:
-- static AddressType check(NodeAccessRef const&);
-- static AddressType check(Accessor const&, NodePointerType);
-+ static GroupNodeAddress check(NodeAccessRef const&);
-
- ChildAddressType implGetChild(Name const& _aName) const;
-
-- Accessor m_aAccessor;
-- AddressType m_pData;
-+ memory::Accessor m_aAccessor;
-+ GroupNodeAddress m_pData;
-+ mutable const sharable::Node *m_pCache;
- };
-
-- GroupNodeAddress toGroupNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr);
- GroupNodeAddress toGroupNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr);
- // -------------------------------------------------------------------------
- inline
-Index: configmgr/source/inc/heap.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/heap.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 heap.hxx
---- configmgr/source/inc/heap.hxx 28 Dec 2005 17:29:58 -0000 1.5
-+++ configmgr/source/inc/heap.hxx 5 Jan 2007 22:25:41 -0000
-@@ -46,50 +46,5 @@
- #include <rtl/string.hxx>
- #endif
-
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- class Heap : Noncopyable
-- {
-- HeapManager & m_impl;
-- HeapManager::Handle m_heap;
-- HeapManager::Size m_size;
-- public:
-- typedef HeapManager::Lock Lock;
-- typedef HeapManager::Size Size;
-- typedef HeapManager::HeapId HeapId;
-- typedef HeapManager::HeapIdParam HeapIdParam;
-- typedef HeapManager::Address Address;
--
-- Heap(HeapManager& _impl);
-- Heap(HeapManager& _impl, Size _nInitialSize);
-- Heap(HeapManager& _impl, HeapIdParam _anId);
-- ~Heap();
--
-- Size size() const { return m_size; }
--
-- Size grow(Size _nReqSize);
--
-- void * base() const { return m_impl.base(m_heap); }
-- HeapId id() const { return m_impl.id(m_heap); }
--
-- Address allocate(Size _sNewSize) { return m_impl.allocate(m_heap, _sNewSize); }
-- Address reallocate(Address _aOldAddress, Size _sNewSize)
-- { return m_impl.reallocate(m_heap, _aOldAddress, _sNewSize); }
-- void deallocate(Address _aAddress) { m_impl.deallocate(m_heap, _aAddress); }
-- bool didAllocate(Address _aAddress) const
-- { return m_impl.didAllocate(m_heap, _aAddress); }
--
-- Lock * createLock() { return m_impl.createHeapLock(m_heap); }
-- void destroyLock(Lock * _pLock) { m_impl.destroyHeapLock(m_heap,_pLock); }
-- };
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
- #endif // CONFIGMGR_DATAHEAP_HXX
-
-Index: configmgr/source/inc/heapfactory.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/heapfactory.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 heapfactory.hxx
---- configmgr/source/inc/heapfactory.hxx 8 Sep 2005 03:48:33 -0000 1.2
-+++ configmgr/source/inc/heapfactory.hxx 5 Jan 2007 22:25:41 -0000
-@@ -36,21 +36,5 @@
- #ifndef CONFIGMGR_HEAPFACTORY_HXX
- #define CONFIGMGR_HEAPFACTORY_HXX
-
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- class HeapManager;
--
-- HeapManager & localHeap();
-- HeapManager & cacheHeap();
--
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
- #endif // CONFIGMGR_HEAPFACTORY_HXX
-
-Index: configmgr/source/inc/heapmanager.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/heapmanager.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 heapmanager.hxx
---- configmgr/source/inc/heapmanager.hxx 28 Dec 2005 17:30:19 -0000 1.5
-+++ configmgr/source/inc/heapmanager.hxx 5 Jan 2007 22:25:41 -0000
-@@ -36,9 +36,6 @@
- #ifndef CONFIGMGR_DATAHEAPMANAGER_HXX
- #define CONFIGMGR_DATAHEAPMANAGER_HXX
-
--#ifndef CONFIGMGR_MEMORYMODEL_HXX
--#include "memorymodel.hxx"
--#endif
- #ifndef CONFIGMGR_DATALOCK_HXX
- #include "datalock.hxx"
- #endif
-@@ -50,45 +47,7 @@
- #include <rtl/string.hxx>
- #endif
-
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- class HeapManager
-- {
-- public:
-- typedef struct Opaque_ * Handle;
--
-- typedef memory::HeapSize Size;
-- typedef memory::Address Address;
-- typedef rtl::OString HeapId;
-- typedef rtl::OString const & HeapIdParam;
--
-- // virtual HeapId newHeapId() = 0;
-- virtual Handle createHeap(/*HeapIdParam _anId, */Size _sInitialSize) = 0;
-- virtual Handle attachHeap(HeapIdParam _anId, Size & _rInitialSize) = 0;
-- virtual Size growHeap(Handle _aHeap, Size _sNewSize) = 0;
-- virtual void destroyHeap(Handle _aHeap) = 0;
--
-- virtual void * base(Handle _aHeap) = 0;
-- virtual HeapId id(Handle _aHeap) = 0;
--
-- virtual Address allocate(Handle _aHeap, Size _sNewSize) = 0;
-- virtual Address reallocate(Handle _aHeap, Address _aOldAddress, Size _sNewSize) = 0;
-- virtual void deallocate(Handle _aHeap, Address _aAddress) = 0;
-- virtual bool didAllocate(Handle _aHeap, Address _aAddress) = 0;
--
-- typedef DataLock Lock;
--
-- virtual Lock * createHeapLock(Handle _aHeap) = 0;
-- virtual void destroyHeapLock(Handle _aHeap, Lock * _pLock) = 0;
-- };
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
-+#include <osl/mutex.hxx>
-
- #endif // CONFIGMGR_DATAHEAPMANAGER_HXX
-
-Index: configmgr/source/inc/memorymodel.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/memorymodel.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 memorymodel.hxx
---- configmgr/source/inc/memorymodel.hxx 28 Dec 2005 17:30:28 -0000 1.2
-+++ configmgr/source/inc/memorymodel.hxx 5 Jan 2007 22:25:41 -0000
-@@ -1,69 +1 @@
--/*************************************************************************
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: memorymodel.hxx,v $
-- *
-- * $Revision$
-- *
-- * last change: $Author$ $Date$
-- *
-- * The Contents of this file are made available subject to
-- * the terms of GNU Lesser General Public License Version 2.1.
-- *
-- *
-- * GNU Lesser General Public License Version 2.1
-- * =============================================
-- * Copyright 2005 by Sun Microsystems, Inc.
-- * 901 San Antonio Road, Palo Alto, CA 94303, USA
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License version 2.1, as published by the Free Software Foundation.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-- * MA 02111-1307 USA
-- *
-- ************************************************************************/
--
--#ifndef CONFIGMGR_MEMORYMODEL_HXX
--#define CONFIGMGR_MEMORYMODEL_HXX
--
--#ifndef _SAL_TYPES_H_
--#include <sal/types.h>
--#endif
--
--//-----------------------------------------------------------------------------
--// no full heap implementation available yet - storing pointer value in Address
--#define CFG_ADDRESS_HOLDS_POINTER
--//-----------------------------------------------------------------------------
--
--namespace configmgr
--{
--//-----------------------------------------------------------------------------
--
-- namespace memory
-- {
-- //-----------------------------------------------------------------------------
-- // some base types that describe our memory model
--#ifndef CFG_ADDRESS_HOLDS_POINTER
-- typedef sal_uInt32 Address; // points to relative location in memory segment
--#else
-- typedef sal_uIntPtr Address; // points to absolute location in memory
--#endif
-- typedef sal_uInt32 HeapSize; // memory block size within private heap
-- typedef sal_uInt8 Byte;
-- //-----------------------------------------------------------------------------
-- }
--//-----------------------------------------------------------------------------
--}
--
--
--#endif // CONFIGMGR_MEMORYMODEL_HXX
-+#error Do not include me ...
-Index: configmgr/source/inc/mergechange.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/mergechange.hxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 mergechange.hxx
---- configmgr/source/inc/mergechange.hxx 8 Sep 2005 03:49:58 -0000 1.8
-+++ configmgr/source/inc/mergechange.hxx 5 Jan 2007 22:25:41 -0000
-@@ -51,7 +51,7 @@ namespace configmgr
- {
- // -----------------------------------------------------------------------------
- namespace memory { class UpdateAccessor; }
-- namespace data { class NodeAddress; }
-+// namespace data { class NodeAddress; }
-
- // method that applies changes on a existing subtree
- void applyUpdateWithAdjustment(TreeChangeList & _anUpdate, memory::UpdateAccessor& _aUpdateAccess, data::NodeAddress const & _aBaseAddress);
-Index: configmgr/source/inc/node.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/node.hxx,v
-retrieving revision 1.4.74.1
-diff -u -p -u -r1.4.74.1 node.hxx
---- configmgr/source/inc/node.hxx 3 Nov 2006 11:35:30 -0000 1.4.74.1
-+++ configmgr/source/inc/node.hxx 5 Jan 2007 22:25:41 -0000
-@@ -93,35 +93,35 @@ namespace configmgr
-
- Node * getFirstChild();
- Node * getNextChild(Node * _pChild);
--
- Node const * getFirstChild() const;
- Node const * getNextChild(Node const * _pChild) const;
-+
- };
- //-----------------------------------------------------------------------------
-+ typedef sal_uInt8 * SetElementAddress;
- struct SetNode
- {
-+
- NodeInfo info;
-- Address elementType; // points to template
-+ SetElementAddress elementType; // points to template [MM:SetNode *?]
- List elements; // points to first element (TreeFragmentHeader)
-
- bool isLocalizedValue() const;
-
-- rtl::OUString getElementTemplateName (memory::Accessor const & _anAccessor) const;
-- rtl::OUString getElementTemplateModule(memory::Accessor const & _anAccessor) const;
-+ rtl::OUString getElementTemplateName() const;
-+ rtl::OUString getElementTemplateModule() const;
-
-- TreeFragment const * getFirstElement(memory::Accessor const & _anAccessor) const;
-- TreeFragment const * getNextElement(memory::Accessor const & _anAccessor, TreeFragment const * _pElement) const;
-+ TreeFragment const * getFirstElement() const;
-+ TreeFragment const * getNextElement(TreeFragment const * _pElement) const;
-
- // low-level helper for template data abstraction
- static
-- Address allocTemplateData(memory::Allocator const & _anAllocator,
-- const rtl::OUString &rName,
-+ SetElementAddress allocTemplateData(const rtl::OUString &rName,
- const rtl::OUString &rModule);
- static
-- Address copyTemplateData(memory::Allocator const & _anAllocator,
-- Address _aTemplateData);
-+ SetElementAddress copyTemplateData(SetElementAddress _aTemplateData);
- static
-- void releaseTemplateData(memory::Allocator const & _anAllocator, Address _aTemplateData);
-+ void releaseTemplateData(SetElementAddress _aTemplateData);
- };
- //-----------------------------------------------------------------------------
- struct ValueNode
-@@ -134,10 +134,10 @@ namespace configmgr
- bool isNull() const;
- bool hasUsableDefault() const;
-
-- uno::Type getValueType() const;
-- uno::Any getValue(memory::Accessor const & _aAccessor) const;
-- uno::Any getUserValue(memory::Accessor const & _aAccessor) const;
-- uno::Any getDefaultValue(memory::Accessor const & _aAccessor) const;
-+ uno::Any getValue() const;
-+ uno::Type getValueType() const;
-+ uno::Any getUserValue() const;
-+ uno::Any getDefaultValue() const;
- };
- //-----------------------------------------------------------------------------
- // TODO: optimized representation of localized values (now as set; mapping locale->element-name)
-@@ -209,6 +209,13 @@ namespace configmgr
- { return reinterpret_cast<Node const&>(pNode); }
- //-----------------------------------------------------------------------------
- }
-+
-+ namespace data {
-+ typedef sharable::Node * NodeAddress;
-+ typedef sharable::ValueNode * ValueNodeAddress;
-+ typedef sharable::GroupNode * GroupNodeAddress;
-+ typedef sharable::SetNode * SetNodeAddress;
-+ };
- //-----------------------------------------------------------------------------
- }
-
-Index: configmgr/source/inc/nodeaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/nodeaccess.hxx,v
-retrieving revision 1.5.74.1
-diff -u -p -u -r1.5.74.1 nodeaccess.hxx
---- configmgr/source/inc/nodeaccess.hxx 3 Nov 2006 11:35:43 -0000 1.5.74.1
-+++ configmgr/source/inc/nodeaccess.hxx 5 Jan 2007 22:25:41 -0000
-@@ -36,13 +36,12 @@
- #ifndef CONFIGMGR_NODEACCESS_HXX
- #define CONFIGMGR_NODEACCESS_HXX
-
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#include "nodeaddress.hxx"
-+#ifndef INCLUDED_SHARABLE_NODE_HXX
-+#include "node.hxx"
- #endif
- #ifndef CONFIGMGR_ACCESSOR_HXX
- #include "accessor.hxx"
- #endif
--
- #ifndef _CONFIGMGR_TREE_VALUENODE_HXX
- #include "valuenode.hxx"
- #endif
-@@ -53,118 +52,97 @@
- namespace configmgr
- {
- // -----------------------------------------------------------------------------
-+ namespace memory { class UpdateAccessor; class Accessor; }
-+
- namespace data
- {
-- // -------------------------------------------------------------------------
-- using memory::Accessor;
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
- class NodeAccess
-- {
-+ {
- public:
-- typedef configuration::Name Name;
-- typedef node::Attributes Attributes;
--
-- typedef NodeAddress NodeAddressType;
-- typedef NodeAddress::AddressType AddressType;
-- typedef NodeAddress::DataType const DataType;
-- typedef DataType * NodePointerType;
-+ typedef configuration::Name Name;
-+ typedef node::Attributes Attributes;
-
- static NodeAccess emptyNode() { return NodeAccess(); }
-
-- NodeAccess(Accessor const& _aAccessor, NodeAddressType const& _aNodeRef)
-+ NodeAccess(memory::Accessor const& _aAccessor, NodeAddress const& _aNodeRef)
- : m_aAccessor(_aAccessor)
-- , m_pData(_aNodeRef.m_pData)
-+ , m_pData(_aNodeRef)
- {}
-
-- NodeAccess(Accessor const& _aAccessor, NodePointerType _pNode)
-+ NodeAccess(memory::Accessor const& _aAccessor, const sharable::Node *_pNode)
- : m_aAccessor(_aAccessor)
-- , m_pData(_aAccessor.address(_pNode))
-+ , m_pData(_pNode)
- {}
-
-- bool isValid() const { return m_pData.is(); }
-- bool isLocalRoot() const { return data().isFragmentRoot(); }
--
-- Name getName() const { return wrapName( data().getName() ); }
-- Attributes getAttributes() const { return data().getAttributes(); }
-+ bool isValid() const { return m_pData != NULL; }
-+ bool isLocalRoot() const { return m_pData->isFragmentRoot(); }
-
-- bool isDefault() const { return data().isDefault(); }
-- bool isLocalized() const { return data().isLocalized(); }
-+ Name getName() const { return wrapName( m_pData->getName() ); }
-+ Attributes getAttributes() const { return m_pData->getAttributes(); }
-
-- NodeAddressType address() const { return NodeAddressType(m_pData); }
-- Accessor const& accessor() const { return m_aAccessor; }
-+ bool isDefault() const { return m_pData->isDefault(); }
-+ bool isLocalized() const { return m_pData->isLocalized(); }
-
-- DataType& data() const { return *static_cast<NodePointerType>(m_aAccessor.validate(m_pData)); }
-- NodePointerType getDataPtr() const { return static_cast<NodePointerType>(m_aAccessor.access(m_pData)); }
--
-- AddressType rawAddress() const { return m_pData; }
-+ memory::Accessor const& accessor() const { return m_aAccessor; }
-+ sharable::Node const & data() const { return *m_pData; }
-
- static Name wrapName(rtl::OUString const& _aNameString)
-- { return configuration::makeName( _aNameString, Name::NoValidate() ); }
-+ { return configuration::makeName( _aNameString, Name::NoValidate() ); }
-
-- static NodeAddress::DataType* access(NodeAddressType const& _aNodeRef, memory::UpdateAccessor& _rUpdateAccess);
-- static NodeAddress::DataType const* access(NodeAddressType const& _aNodeRef, Accessor const& _rReaderAccess)
-- { return static_cast<NodePointerType>(_rReaderAccess.access(_aNodeRef.m_pData)); }
-+ operator sharable::Node *() const { return (sharable::Node *)m_pData; }
-+ operator const sharable::Node * () const { return m_pData; }
-+ bool operator ==(const sharable::Node *pNode) const { return m_pData == pNode; }
- private:
-- NodeAccess() : m_aAccessor(NULL), m_pData() {}
-+ NodeAccess() : m_aAccessor(NULL), m_pData(NULL) {}
-
-- Accessor m_aAccessor;
-- AddressType m_pData;
-+ memory::Accessor m_aAccessor;
-+ const sharable::Node * m_pData;
- };
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
- class NodeAccessRef
-- {
-+ {
- public:
-- typedef NodeAccess::Name Name;
-- typedef NodeAccess::Attributes Attributes;
--
-- typedef NodeAccess::NodeAddressType NodeAddressType;
-- typedef NodeAccess::AddressType AddressType;
-- typedef NodeAccess::DataType DataType;
-- typedef NodeAccess::NodePointerType NodePointerType;
-+ typedef configuration::Name Name;
-+ typedef node::Attributes Attributes;
-
- NodeAccessRef(NodeAccess const& _aNodeAccess)
- : m_pAccessor(&_aNodeAccess.accessor())
-- , m_pData(_aNodeAccess.rawAddress())
-+ , m_pData(_aNodeAccess)
- {}
-
-- NodeAccessRef(Accessor const * _pAccessor, NodeAddressType const& _aNodeRef)
-+ NodeAccessRef(memory::Accessor const * _pAccessor, NodeAddress const& _aNodeRef)
- : m_pAccessor(_pAccessor)
-- , m_pData(_aNodeRef.m_pData)
-+ , m_pData(_aNodeRef)
- {}
-
-- NodeAccessRef(Accessor const * _pAccessor, NodePointerType _pNode)
-+ NodeAccessRef(memory::Accessor const * _pAccessor, sharable::Node const *_pNode)
- : m_pAccessor(_pAccessor)
-- , m_pData(_pAccessor->address(_pNode))
-+ , m_pData((sharable::Node *)_pNode)
- {}
-
-- NodeAccess toNodeAccess () const { return NodeAccess(accessor(),address()); }
--
-- bool isValid() const { return m_pData.is(); }
-- bool isLocalRoot() const { return data().isFragmentRoot(); }
--
-- Name getName() const { return NodeAccess::wrapName( data().getName() ); }
-- Attributes getAttributes() const { return data().getAttributes(); }
-+ NodeAccess toNodeAccess () const { return NodeAccess(accessor(),m_pData); }
-
-- bool isDefault() const { return data().isDefault(); }
-- bool isLocalized() const { return data().isLocalized(); }
-+ bool isValid() const { return m_pData != NULL; }
-+ bool isLocalRoot() const { return m_pData->isFragmentRoot(); }
-+ bool isDefault() const { return m_pData->isDefault(); }
-+ bool isLocalized() const { return m_pData->isLocalized(); }
-
-- NodeAddressType address() const { return NodeAddressType(m_pData); }
-- Accessor const& accessor() const { return *m_pAccessor; }
-+ Name getName() const { return NodeAccess::wrapName( m_pData->getName() ); }
-+ Attributes getAttributes() const { return m_pData->getAttributes(); }
-
-- DataType& data() const { return *static_cast<NodePointerType>(m_pAccessor->validate(m_pData)); }
-- NodePointerType getDataPtr() const { return static_cast<NodePointerType>(m_pAccessor->access(m_pData)); }
-+ memory::Accessor const& accessor() const { return *m_pAccessor; }
-
-- AddressType rawAddress() const { return m_pData; }
-+ sharable::Node const & data() const { return *m_pData; }
-+ operator NodeAddress () const { return (NodeAddress)m_pData; }
-
- private:
-- Accessor const * m_pAccessor;
-- AddressType m_pData;
-+ memory::Accessor const *m_pAccessor;
-+ NodeAddress m_pData;
- };
- // -------------------------------------------------------------------------
- // helper - finds child or element
- NodeAccess getSubnode(NodeAccessRef const & _aNode, NodeAccess::Name const & _aName);
-- NodeAddress getSubnodeAddress(memory::Accessor const& _aAccess, NodeAddress const & _aNodeAddress, NodeAccess::Name const & _aName);
- NodeAddress getSubnodeAddress(memory::UpdateAccessor& _aAccess, NodeAddress const & _aNodeAddress, NodeAccess::Name const & _aName);
- // -------------------------------------------------------------------------
- }
-Index: configmgr/source/inc/nodeaddress.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/nodeaddress.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 nodeaddress.hxx
---- configmgr/source/inc/nodeaddress.hxx 19 Jan 2006 17:53:30 -0000 1.5
-+++ configmgr/source/inc/nodeaddress.hxx 5 Jan 2007 22:25:41 -0000
-@@ -1,153 +1 @@
--/*************************************************************************
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: nodeaddress.hxx,v $
-- *
-- * $Revision$
-- *
-- * last change: $Author$ $Date$
-- *
-- * The Contents of this file are made available subject to
-- * the terms of GNU Lesser General Public License Version 2.1.
-- *
-- *
-- * GNU Lesser General Public License Version 2.1
-- * =============================================
-- * Copyright 2005 by Sun Microsystems, Inc.
-- * 901 San Antonio Road, Palo Alto, CA 94303, USA
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License version 2.1, as published by the Free Software Foundation.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-- * MA 02111-1307 USA
-- *
-- ************************************************************************/
--
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#define CONFIGMGR_NODEADDRESS_HXX
--
--#ifndef CONFIGMGR_POINTER_HXX
--#include "pointer.hxx"
--#endif
--
--#ifndef INCLUDED_SHARABLE_NODE_HXX
--#include "node.hxx"
--#endif
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory { class Accessor; }
--// -----------------------------------------------------------------------------
-- namespace data
-- {
-- // -------------------------------------------------------------------------
-- using memory::Accessor;
-- // -------------------------------------------------------------------------
-- class NodeAddress
-- {
-- friend class NodeAccess;
-- friend class NodeAccessRef;
-- public:
-- typedef sharable::Node DataType;
-- typedef memory::Pointer AddressType;
--
-- public:
-- NodeAddress() : m_pData() {}
--
-- explicit
-- NodeAddress(AddressType _aNodeData) : m_pData(_aNodeData) {}
--
-- bool is() const { return m_pData.is(); }
-- bool isNull() const { return m_pData.isNull(); }
--
-- AddressType::RawAddress addressValue() const { return m_pData.value(); }
--
-- friend bool operator == (NodeAddress const& lhs, NodeAddress const& rhs);
--
-- friend bool operator != (NodeAddress const& lhs, NodeAddress const& rhs);
--
-- private:
-- AddressType m_pData;
-- };
--
-- inline bool operator == (NodeAddress const& lhs, NodeAddress const& rhs)
-- { return lhs.m_pData == rhs.m_pData; }
--
-- inline bool operator != (NodeAddress const& lhs, NodeAddress const& rhs)
-- { return lhs.m_pData != rhs.m_pData; }
-- // -------------------------------------------------------------------------
--
-- class ValueNodeAddress
-- {
-- friend class ValueNodeAccess;
-- public:
-- typedef sharable::ValueNode DataType;
-- typedef memory::Pointer AddressType;
--
-- bool is() const { return m_pData.is(); }
-- bool isNull() const { return m_pData.isNull(); }
--
-- operator NodeAddress() const { return NodeAddress(m_pData); }
-- private:
-- explicit
-- ValueNodeAddress(AddressType _aNodeData) : m_pData(_aNodeData) {}
--
-- AddressType m_pData;
-- };
-- // -------------------------------------------------------------------------
--
-- class GroupNodeAddress
-- {
-- friend class GroupNodeAccess;
-- public:
-- typedef sharable::GroupNode DataType;
-- typedef memory::Pointer AddressType;
--
-- bool is() const { return m_pData.is(); }
-- bool isNull() const { return m_pData.isNull(); }
--
-- operator NodeAddress() const { return NodeAddress(m_pData); }
-- private:
-- explicit
-- GroupNodeAddress(AddressType _aNodeData) : m_pData(_aNodeData) {}
--
-- AddressType m_pData;
-- };
-- // -------------------------------------------------------------------------
--
-- class SetNodeAddress
-- {
-- friend class SetNodeAccess;
-- public:
-- typedef sharable::SetNode DataType;
-- typedef memory::Pointer AddressType;
--
-- bool is() const { return m_pData.is(); }
-- bool isNull() const { return m_pData.isNull(); }
--
-- operator NodeAddress() const { return NodeAddress(m_pData); }
-- private:
-- explicit
-- SetNodeAddress(AddressType _aNodeData) : m_pData(_aNodeData) {}
--
-- AddressType m_pData;
-- };
-- // -------------------------------------------------------------------------
-- }
--
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--#endif // CONFIGMGR_NODEADDRESS_HXX
--
-+#warning Don't include me ...
-Index: configmgr/source/inc/nodechangeinfo.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/nodechangeinfo.hxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 nodechangeinfo.hxx
---- configmgr/source/inc/nodechangeinfo.hxx 25 Sep 2006 12:49:10 -0000 1.9
-+++ configmgr/source/inc/nodechangeinfo.hxx 5 Jan 2007 22:25:42 -0000
-@@ -128,8 +128,8 @@ namespace configmgr
-
- //-------------------------------------------------
- // wrapper object creation
-- Tree getNewElementTree(data::Accessor const& aAccessor) const;
-- Tree getOldElementTree(data::Accessor const& aAccessor) const;
-+ Tree getNewElementTree(memory::Accessor const& aAccessor) const;
-+ Tree getOldElementTree(memory::Accessor const& aAccessor) const;
-
- NodeRef getNewElementNodeRef() const;
- NodeRef getOldElementNodeRef() const;
-@@ -166,19 +166,19 @@ namespace configmgr
- bool isValidData() const;
-
- /// check whether the location is for a valid object
-- bool isValidLocation(data::Accessor const& aAccessor) const;
-+ bool isValidLocation(memory::Accessor const& aAccessor) const;
-
- //-------------------------------------------------
- /// retrieve the path from the base node to the changed node (which might be a child of the affected node)
- RelativePath getAccessor() const { return m_path; }
-
- /// retrieve the tree where the change is actually initiated/reported
-- Tree getBaseTree(data::Accessor const& aAccessor) const;
-+ Tree getBaseTree(memory::Accessor const& aAccessor) const;
- /// retrieve the node where the change is actually initiated/reported
- NodeRef getBaseNode() const;
-
- /// retrieve the tree where the change is actually taking place (may be Empty, if the tree has never been accessed)
-- Tree getAffectedTree(data::Accessor const& aAccessor) const;
-+ Tree getAffectedTree(memory::Accessor const& aAccessor) const;
- /// retrieve the tree where the change is actually taking place (may be Empty, if the tree has never been accessed)
- TreeRef getAffectedTreeRef() const;
- /// retrieve the node where the change is actually taking place (if the affected Tree is not empty)
-@@ -220,14 +220,14 @@ namespace configmgr
- public:
- //-------------------------------------------------
- explicit
-- NodeChangeInformation(data::Accessor const& _accessor)
-+ NodeChangeInformation(memory::Accessor const& _accessor)
- : accessor(_accessor)
- , change()
- , location()
- {
- }
- //-------------------------------------------------
-- data::Accessor accessor;
-+ memory::Accessor accessor;
- NodeChangeData change;
- NodeChangeLocation location;
-
-Index: configmgr/source/inc/noderef.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/noderef.hxx,v
-retrieving revision 1.18
-diff -u -p -u -r1.18 noderef.hxx
---- configmgr/source/inc/noderef.hxx 19 Jan 2006 17:53:48 -0000 1.18
-+++ configmgr/source/inc/noderef.hxx 5 Jan 2007 22:25:43 -0000
-@@ -53,18 +53,18 @@
-
- namespace configmgr
- {
-- class INode;
-+ class INode;
-
-- namespace data { using memory::Accessor; class TreeAccessor; }
-- namespace view { class ViewTreeAccess; }
-- namespace configapi { class Factory; }
-- namespace node { struct Attributes; }
-- namespace configuration
-- {
-- //-------------------------------------------------------------------------
-- class Name;
-- class AbsolutePath;
-- class RelativePath;
-+ namespace data { class TreeAccessor; }
-+ namespace view { class ViewTreeAccess; }
-+ namespace configapi { class Factory; }
-+ namespace node { struct Attributes; }
-+ namespace configuration
-+ {
-+ //-------------------------------------------------------------------------
-+ class Name;
-+ class AbsolutePath;
-+ class RelativePath;
- namespace Path { class Component; }
-
- class NodeChange;
-@@ -222,9 +222,9 @@ namespace configmgr
- typedef node::Attributes NodeAttributes;
- public:
- /// create a tree with a given implementation
-- Tree(data::Accessor const& _accessor, TreeImpl* pImpl);
-+ Tree(memory::Accessor const& _accessor, TreeImpl* pImpl);
- /// create a tree with a given implementation
-- Tree(data::Accessor const& _accessor, TreeRef const& _aTree);
-+ Tree(memory::Accessor const& _accessor, TreeRef const& _aTree);
-
- /// checks, if this refers to an existing tree
- bool isValid() const
-@@ -467,18 +467,18 @@ namespace configmgr
-
- // view & data layer binding
- public:
-- data::Accessor const & getDataAccessor() const { return m_accessor; }
-+ memory::Accessor const & getDataAccessor() const { return m_accessor; }
-
- view::ViewTreeAccess getView() const;
-
-- void rebind(data::Accessor const& _aAccessor);
-+ void rebind(memory::Accessor const& _aAccessor);
- void unbind();
- // Comparison
- public:
- friend bool equalTree(Tree const& lhs, Tree const& rhs) { return equalTreeRef(lhs.m_ref, rhs.m_ref); }
- private:
- friend class TreeImplHelper;
-- data::Accessor m_accessor;
-+ memory::Accessor m_accessor;
- TreeRef m_ref;
- };
- //-------------------------------------------------------------------------
-Index: configmgr/source/inc/pointer.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/pointer.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 pointer.hxx
---- configmgr/source/inc/pointer.hxx 28 Dec 2005 17:30:54 -0000 1.5
-+++ configmgr/source/inc/pointer.hxx 5 Jan 2007 22:25:43 -0000
-@@ -32,59 +32,3 @@
- * MA 02111-1307 USA
- *
- ************************************************************************/
--
--#ifndef CONFIGMGR_POINTER_HXX
--#define CONFIGMGR_POINTER_HXX
--
--#ifndef CONFIGMGR_MEMORYMODEL_HXX
--#include "memorymodel.hxx"
--#endif
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- class Accessor;
-- class UpdateAccessor;
-- // -------------------------------------------------------------------------
-- /// class mediating read-only access to a memory::Segment
-- class Pointer
-- {
-- friend class Accessor;
-- friend class UpdateAccessor;
--
-- typedef memory::Address AddressType;
--
-- AddressType m_value;
--
-- struct Opaque_;
-- public:
-- typedef AddressType RawAddress;
--
-- Pointer() : m_value(0) {}
-- explicit Pointer(AddressType p) : m_value(p) {}
--
-- RawAddress value() const { return m_value; }
--
-- bool isNull() const { return m_value == 0; }
-- bool is() const { return m_value != 0; }
--
-- operator Opaque_ const * () const { return reinterpret_cast<Opaque_ const *>(m_value); }
--
-- friend bool operator == (Pointer lhs, Pointer rhs)
-- { return lhs.value() == rhs.value(); }
--
-- friend bool operator != (Pointer lhs, Pointer rhs)
-- { return lhs.value() != rhs.value(); }
-- };
--
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--// -----------------------------------------------------------------------------
--
--#endif // CONFIGMGR_POINTER_HXX
--
-Index: configmgr/source/inc/segment.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/segment.hxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 segment.hxx
---- configmgr/source/inc/segment.hxx 8 Sep 2005 03:55:04 -0000 1.4
-+++ configmgr/source/inc/segment.hxx 5 Jan 2007 22:25:43 -0000
-@@ -36,16 +36,18 @@
- #ifndef CONFIGMGR_SEGMENT_HXX
- #define CONFIGMGR_SEGMENT_HXX
-
-+#ifndef _OSL_INTERLOCK_H_
-+#include <osl/interlck.h>
-+#endif
- #ifndef CONFIGMGR_DATALOCK_HXX
- #include "datalock.hxx"
- #endif
--#ifndef CONFIGMGR_SEGMENTHEAP_HXX
--#include "segmentheap.hxx"
--#endif
- #ifndef _RTL_STRING_HXX_
- #include <rtl/string.hxx>
- #endif
-
-+#include <osl/mutex.hxx>
-+
- namespace configmgr
- {
- // -----------------------------------------------------------------------------
-@@ -54,65 +56,22 @@ namespace configmgr
- // -------------------------------------------------------------------------
- class Segment
- {
-- SegmentHeap m_heap;
-+ osl::Mutex m_mutex;
- public:
-- typedef SegmentHeap Heap;
-- typedef Heap::Lock Lock;
-- typedef rtl::OString Id;
--
-- public:
-- explicit Segment(HeapManager & _aHeapImpl)
-- : m_heap(_aHeapImpl) {}
--
-- explicit Segment(HeapManager & _aHeapImpl, Heap::Size _aInitialSize)
-- : m_heap(_aHeapImpl,_aInitialSize) {}
-+ explicit Segment()
-+ : m_mutex() {}
-
-- explicit Segment(HeapManager & _aHeapImpl, Id const & _anId)
-- : m_heap(_aHeapImpl,_anId) {}
--
-- Id getId() const { return m_heap.id(); }
--
-- bool isValidAddress(Heap::Address _aAddress) const
-- {
-- return m_heap.isValidAddress(_aAddress);
-- }
--
-- Heap& acquireWriteAccess()
-- {
-- this->lock().acquireWriteAccess();
-- return this->heap();
-- }
--
-- void releaseWriteAccess(Heap&)
-- {
-- this->lock().releaseWriteAccess();
-- }
--
-- void const * acquireReadAccess() const
-- {
-- this->lock().acquireReadAccess();
-- return base();
-- }
-- void releaseReadAccess (void const * ) const
-- {
-- this->lock().releaseReadAccess();
-- }
-- private:
-- Heap & heap() { return m_heap; }
-- Lock & lock() const { return m_heap.lock(); }
-- void * base() const { return m_heap.base(); }
-+ void acquireWriteAccess();
-+ void releaseWriteAccess();
-+ void downgradeAccess() {}
-+
-+ void acquireReadAccess() const { ((Segment *)this)->acquireWriteAccess(); }
-+ void releaseReadAccess() const { ((Segment *)this)->acquireReadAccess(); }
-+
-+ // debugging
-+ static bool countLocks;
-+ static oslInterlockedCount numLocks;
- };
-- // -------------------------------------------------------------------------
-- typedef Segment::Id SegmentID;
-- // -------------------------------------------------------------------------
-- struct SegmentAddress
-- {
-- SegmentID id;
-- SegmentHeap::Address base;
--
-- bool isNull() const { return base == 0; }
-- };
-- // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/inc/segmentheap.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/segmentheap.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 segmentheap.hxx
---- configmgr/source/inc/segmentheap.hxx 8 Sep 2005 03:55:20 -0000 1.3
-+++ configmgr/source/inc/segmentheap.hxx 5 Jan 2007 22:25:43 -0000
-@@ -32,82 +32,3 @@
- * MA 02111-1307 USA
- *
- ************************************************************************/
--
--#ifndef CONFIGMGR_SEGMENTHEAP_HXX
--#define CONFIGMGR_SEGMENTHEAP_HXX
--
--#ifndef CONFIGMGR_DATAHEAP_HXX
--#include "heap.hxx"
--#endif
--#ifndef CONFIGMGR_UTILITY_HXX_
--#include "utility.hxx"
--#endif
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace memory
-- {
-- // -------------------------------------------------------------------------
-- class SegmentHeap : Noncopyable
-- {
-- friend class Segment;
-- typedef Heap::Lock Lock;
--
-- Heap m_heap;
-- void * m_base;
-- Lock * m_lock;
--
-- Lock & lock() const { return *m_lock; }
-- public:
-- typedef Heap::HeapId HeapId;
-- typedef Heap::HeapIdParam HeapIdParam;
-- typedef Heap::Size Size;
-- typedef Heap::Address Address;
--
-- SegmentHeap(HeapManager & _rImpl)
-- : m_heap(_rImpl)
-- { init(); }
--
-- SegmentHeap(HeapManager & _rImpl, Size _aInitialSize)
-- : m_heap(_rImpl,_aInitialSize)
-- { init(); }
--
-- SegmentHeap(HeapManager & _rImpl, HeapIdParam _anId)
-- : m_heap(_rImpl,_anId)
-- { init(); }
--
-- ~SegmentHeap();
--
-- // PRE: lock must be acquired
-- void* base() const { return m_base; }
-- HeapId id() const { return m_heap.id(); }
--
-- Address allocate(Size _sz)
-- {
-- Address aResult = m_heap.allocate(_sz);
-- if (!aResult)
-- aResult = this->allocateMore(_sz);
-- return aResult;
-- }
--
-- void deallocate(Address _addr)
-- {
-- m_heap.deallocate(_addr);
-- }
--
-- bool isValidAddress(Address _addr) const
-- {
-- return m_heap.didAllocate(_addr);
-- }
-- private:
-- void init();
-- Address allocateMore(Size _sz);
-- };
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--#endif // CONFIGMGR_SEGMENT_HXX
--
-Index: configmgr/source/inc/sequence.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/sequence.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 sequence.hxx
---- configmgr/source/inc/sequence.hxx 8 Sep 2005 03:55:37 -0000 1.2
-+++ configmgr/source/inc/sequence.hxx 5 Jan 2007 22:25:43 -0000
-@@ -56,19 +56,17 @@ namespace configmgr
- typedef Vector Sequence; // alternative name
- //-----------------------------------------------------------------------------
-
-- Sequence allocSequence(memory::Allocator const& _anAllocator, AnyData::TypeCode _aElementType, ::sal_Sequence const * _pSeqData);
-- // Sequence copySequence(memory::Allocator const& _anAllocator, AnyData::TypeCode _aElementType, Sequence _aSeq);
-- void freeSequence(memory::Allocator const& _anAllocator, AnyData::TypeCode _aElementType, Sequence _aSeq);
-+ Sequence allocSequence(AnyData::TypeCode _aElementType, ::sal_Sequence const * _pSeqData);
-+ void freeSequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
-
-- ::sal_Sequence * readSequence(memory::Accessor const& _anAccessor, AnyData::TypeCode _aElementType, Sequence _aSeq);
-- ::com::sun::star::uno::Any readAnySequence(memory::Accessor const& _anAccessor, AnyData::TypeCode _aElementType, Sequence _aSeq);
-+ ::sal_Sequence * readSequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
-+ ::com::sun::star::uno::Any readAnySequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
- //-----------------------------------------------------------------------------
-
-- Sequence allocBinary(memory::Allocator const& _anAllocator, ::com::sun::star::uno::Sequence<sal_Int8> const & _aBinaryValue);
-- // Sequence copyBinary(memory::Allocator const& _anAllocator, Sequence _aSeq);
-- void freeBinary(memory::Allocator const& _anAllocator, Sequence _aSeq);
-+ Sequence allocBinary(::com::sun::star::uno::Sequence<sal_Int8> const & _aBinaryValue);
-+ void freeBinary(Sequence _aSeq);
-
-- ::com::sun::star::uno::Sequence<sal_Int8> readBinary(memory::Accessor const& _anAccessor, Sequence _aSeq);
-+ ::com::sun::star::uno::Sequence<sal_Int8> readBinary(Sequence _aSeq);
- //-----------------------------------------------------------------------------
-
- template <class ET>
-@@ -80,11 +78,11 @@ namespace configmgr
- }
-
- template <class ET>
-- Sequence allocSequence(memory::Allocator const& _anAllocator, ::com::sun::star::uno::Sequence<ET> const & _aSeq)
-+ Sequence allocSequence(::com::sun::star::uno::Sequence<ET> const & _aSeq)
- {
- AnyData::TypeCode aTC = getElementTypeCode(_aSeq);
- ::sal_Sequence const * pSeqData = _aSeq.get();
-- return allocSequence(_anAllocator, aTC, pSeqData);
-+ return allocSequence(aTC, pSeqData);
- }
-
- template <class ET>
-@@ -92,7 +90,7 @@ namespace configmgr
- {
- AnyData::TypeCode aElementType = getElementTypeCode(_rSeq);
-
-- ::sal_Sequence * pNewSequence = readSequence(_anAccessor, aElementType, _aSeq);
-+ ::sal_Sequence * pNewSequence = readSequence(aElementType, _aSeq);
-
- if (!pNewSequence) return;
-
-@@ -106,7 +104,7 @@ namespace configmgr
- {
- if (getElementTypeCode(_rSeq) != _aElementType) return false;
-
-- ::sal_Sequence * pNewSequence = readSequence(_anAccessor, _aElementType, _aSeq);
-+ ::sal_Sequence * pNewSequence = readSequence(_aElementType, _aSeq);
-
- if (!pNewSequence) return false;
-
-Index: configmgr/source/inc/setnodeaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/setnodeaccess.hxx,v
-retrieving revision 1.4.74.1
-diff -u -p -u -r1.4.74.1 setnodeaccess.hxx
---- configmgr/source/inc/setnodeaccess.hxx 3 Nov 2006 11:35:56 -0000 1.4.74.1
-+++ configmgr/source/inc/setnodeaccess.hxx 5 Jan 2007 22:25:43 -0000
-@@ -39,6 +39,9 @@
- #ifndef CONFIGMGR_NODEACCESS_HXX
- #include "nodeaccess.hxx"
- #endif
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
-
- namespace configmgr
- {
-@@ -46,7 +49,6 @@ namespace configmgr
- namespace data
- {
- // -------------------------------------------------------------------------
-- class TreeAddress;
- class TreeAccessor;
- // -------------------------------------------------------------------------
- /** class that mediates access to the data of a Set node
-@@ -57,21 +59,12 @@ namespace configmgr
- public:
- typedef NodeAccess::Name Name;
- typedef NodeAccess::Attributes Attributes;
-- typedef SetNodeAddress NodeAddressType;
-- typedef SetNodeAddress::AddressType AddressType;
-- typedef SetNodeAddress::DataType const DataType;
-- typedef DataType * NodePointerType;
- typedef TreeAddress ElementAddress;
- typedef TreeAccessor ElementAccess;
-
-- SetNodeAccess(Accessor const& _aAccessor, NodeAddressType const& _aNodeRef)
-+ SetNodeAccess(memory::Accessor const& _aAccessor, const sharable::SetNode *_pNodeRef)
- : m_aAccessor(_aAccessor)
-- , m_pData(_aNodeRef.m_pData)
-- {}
--
-- SetNodeAccess(Accessor const& _aAccessor, NodePointerType _pNode)
-- : m_aAccessor(_aAccessor)
-- , m_pData(check(_aAccessor,_pNode))
-+ , m_pData((SetNodeAddress)_pNodeRef)
- {}
-
- explicit
-@@ -108,26 +101,25 @@ namespace configmgr
- bool hasElement (Name const& _aName) const;
- ElementAccess getElementTree (Name const& _aName) const;
-
-- NodeAddressType address() const { return NodeAddressType(m_pData); }
-- Accessor const& accessor() const { return m_aAccessor; }
-+ memory::Accessor const& accessor() const { return m_aAccessor; }
-
- operator NodeAccessRef() const { return NodeAccessRef(&m_aAccessor,NodeAddress(m_pData)); }
-
-- DataType& data() const { return *static_cast<NodePointerType>(m_aAccessor.validate(m_pData)); }
-+ sharable::SetNode & data() const { return *m_pData; }
-+ operator SetNodeAddress () const { return (SetNodeAddress)m_pData; }
-+ operator NodeAddress () const { return (NodeAddress)m_pData; }
-
-- static void addElement(memory::UpdateAccessor & _aAccessor, SetNodeAddress _aSetAddress, ElementAddress _aNewElement);
-- static ElementAddress removeElement(memory::UpdateAccessor & _aAccessor, SetNodeAddress _aSetAddress, Name const & _aName);
-+ static void addElement(SetNodeAddress _aSetAddress, ElementAddress _aNewElement);
-+ static ElementAddress removeElement(SetNodeAddress _aSetAddress, Name const & _aName);
- private:
-- static AddressType check(NodeAccessRef const&);
-- static AddressType check(Accessor const&, NodePointerType);
-+ static SetNodeAddress check(NodeAccessRef const&);
-
- ElementAddress implGetElement(Name const& _aName) const;
-
-- Accessor m_aAccessor;
-- AddressType m_pData;
-+ memory::Accessor m_aAccessor;
-+ SetNodeAddress m_pData;
- };
-
-- SetNodeAddress toSetNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr);
- SetNodeAddress toSetNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr);
- // -------------------------------------------------------------------------
- inline
-@@ -136,11 +128,11 @@ namespace configmgr
-
- inline
- NodeAccess::Name SetNodeAccess::getElementTemplateName() const
-- { return NodeAccess::wrapName( data().getElementTemplateName(m_aAccessor) ); }
-+ { return NodeAccess::wrapName( data().getElementTemplateName() ); }
-
- inline
- NodeAccess::Name SetNodeAccess::getElementTemplateModule() const
-- { return NodeAccess::wrapName( data().getElementTemplateModule(m_aAccessor) ); }
-+ { return NodeAccess::wrapName( data().getElementTemplateModule() ); }
-
- inline
- NodeAccess::Attributes SetNodeAccess::getAttributes() const
-Index: configmgr/source/inc/treeaccessor.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/treeaccessor.hxx,v
-retrieving revision 1.5.74.1
-diff -u -p -u -r1.5.74.1 treeaccessor.hxx
---- configmgr/source/inc/treeaccessor.hxx 3 Nov 2006 11:36:16 -0000 1.5.74.1
-+++ configmgr/source/inc/treeaccessor.hxx 5 Jan 2007 22:25:43 -0000
-@@ -36,20 +36,23 @@
- #ifndef CONFIGMGR_TREEACCESSOR_HXX
- #define CONFIGMGR_TREEACCESSOR_HXX
-
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
--#endif
- #ifndef CONFIGMGR_ACCESSOR_HXX
- #include "accessor.hxx"
- #endif
- #ifndef CONFIGMGR_NODEACCESS_HXX
- #include "nodeaccess.hxx"
- #endif
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
-
- #ifndef INCLUDED_CSTDDEF
- #include <cstddef>
- #define INCLUDED_CSTDDEF
- #endif
-+#ifndef CONFIGMGR_BUILDDATA_HXX
-+#include <builddata.hxx>
-+#endif
-
- namespace configmgr
- {
-@@ -73,70 +76,62 @@ namespace configmgr
- public:
- typedef configuration::Name Name;
- typedef node::Attributes Attributes;
-- typedef TreeAddress DataAddressType;
-- typedef TreeAddress::DataType const DataType;
-- typedef DataType * DataPointerType;
-
- static TreeAccessor emptyTree() { return TreeAccessor(); }
-
-- TreeAccessor(Accessor const& _aAccessor, DataAddressType const& _aTreeRef)
-+ TreeAccessor(Accessor const& _aAccessor, TreeAddress const& _aTreeRef)
- : m_aAccessor(_aAccessor)
-- , m_pBase(_aTreeRef.m_pData)
-+ , m_pBase(_aTreeRef)
- {}
-
-- TreeAccessor(Accessor const& _aAccessor, DataPointerType _pTree)
-+ TreeAccessor(Accessor const& _aAccessor, const sharable::TreeFragment * _pTree)
- : m_aAccessor(_aAccessor)
-- , m_pBase(_aAccessor.address(_pTree))
-+ , m_pBase((sharable::TreeFragment *)_pTree)
- {}
-
-- bool isValid() const { return m_pBase.is(); }
--
-- bool isDefault() const { return data().isDefault(); }
-+ bool isValid() const { return m_pBase != NULL; }
-
-- Attributes getAttributes() const { return data().getAttributes(); }
-+ Attributes getAttributes() const { return m_pBase->getAttributes(); }
- Name getName() const;
-
- NodeAccessRef getRootNode() const { return NodeAccessRef(&m_aAccessor,rootAddress(m_pBase)); }
-
-- DataAddressType address() const { return m_pBase; }
- Accessor const& accessor() const { return m_aAccessor; }
-
-- DataType& data() const { return *static_cast<DataPointerType>(m_aAccessor.validate(m_pBase.m_pData)); }
-- DataPointerType getDataPtr() const { return access(m_pBase,m_aAccessor); }
--
-- TreeAddress copyTree(memory::UpdateAccessor & _aTargetSpace) const;
-- static void freeTree(memory::UpdateAccessor & _aTargetSpace, TreeAddress _aTree);
-+ sharable::TreeFragment& data() const { return *m_pBase; }
-+ operator sharable::TreeFragment *() const { return (sharable::TreeFragment *)m_pBase; }
-+ sharable::TreeFragment* operator->() const { return m_pBase; }
-
- static Name wrapName(rtl::OUString const& _aNameString)
-- { return configuration::makeName( _aNameString, Name::NoValidate() ); }
-+ { return configuration::makeName( _aNameString, Name::NoValidate() ); }
-+// static sharable::TreeFragment* access(TreeAddress const& _aTreeRef) { return _aTreeRef; }
-+ TreeAddress copyTree(memory::UpdateAccessor & _aTargetSpace) const
-+ { return data::buildTree(_aTargetSpace, *this); }
-+ static void freeTree(memory::UpdateAccessor & _aTargetSpace, TreeAddress _aTree)
-+ { data::destroyTree(_aTargetSpace,_aTree); }
-
-- static TreeAddress::DataType* access(DataAddressType const& _aTreeRef, memory::UpdateAccessor& _rUpdateAccess);
-- static TreeAddress::DataType const* access(DataAddressType const& _aTreeRef, Accessor const& _rReaderAccess)
-- { return static_cast<DataPointerType>(_rReaderAccess.access(_aTreeRef.m_pData)); }
- private:
-- NodeAddress rootAddress(DataAddressType const& p) const;
-+ NodeAddress rootAddress(TreeAddress const& p) const;
-+ TreeAccessor() : m_aAccessor(NULL), m_pBase(NULL) { }
-
-- TreeAccessor();
-- private:
-- Accessor m_aAccessor;
-- DataAddressType m_pBase;
-+ Accessor m_aAccessor;
-+ TreeAddress m_pBase;
- };
- // -------------------------------------------------------------------------
- // -------------------------------------------------------------------------
- inline
- TreeAccessor::Name TreeAccessor::getName() const
- {
-- return wrapName( data().getName() );
-+ return wrapName( m_pBase->getName() );
- }
- // -------------------------------------------------------------------------
- inline
-- NodeAddress TreeAccessor::rootAddress(DataAddressType const& p) const
-+ NodeAddress TreeAccessor::rootAddress(TreeAddress const& p) const
- {
-- sharable::Address aAddr = p.addressValue();
--
-- if (aAddr) aAddr += offsetof(TreeAddress::DataType,nodes);
--
-- return NodeAddress( memory::Pointer(aAddr) );
-+ if (p == NULL)
-+ return NULL;
-+ sharable::TreeFragment const *pFrag = p;
-+ return const_cast<NodeAddress>(pFrag->nodes);
- }
- // -------------------------------------------------------------------------
- }
-Index: configmgr/source/inc/treeaddress.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/treeaddress.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 treeaddress.hxx
---- configmgr/source/inc/treeaddress.hxx 8 Sep 2005 03:58:45 -0000 1.3
-+++ configmgr/source/inc/treeaddress.hxx 5 Jan 2007 22:25:43 -0000
-@@ -1,88 +1,2 @@
--/*************************************************************************
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: treeaddress.hxx,v $
-- *
-- * $Revision$
-- *
-- * last change: $Author$ $Date$
-- *
-- * The Contents of this file are made available subject to
-- * the terms of GNU Lesser General Public License Version 2.1.
-- *
-- *
-- * GNU Lesser General Public License Version 2.1
-- * =============================================
-- * Copyright 2005 by Sun Microsystems, Inc.
-- * 901 San Antonio Road, Palo Alto, CA 94303, USA
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License version 2.1, as published by the Free Software Foundation.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-- * MA 02111-1307 USA
-- *
-- ************************************************************************/
--
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#define CONFIGMGR_TREEADDRESS_HXX
--
--#ifndef CONFIGMGR_POINTER_HXX
--#include "pointer.hxx"
--#endif
--
--#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
--#include "treefragment.hxx"
--#endif
--
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- class INode;
--// -----------------------------------------------------------------------------
-- namespace data
-- {
-- // -------------------------------------------------------------------------
-- class TreeAddress
-- {
-- friend class TreeAccessor;
-- public:
-- typedef sharable::TreeFragment DataType;
-- typedef memory::Pointer AddressType;
-- public:
-- TreeAddress() : m_pData() {}
--
-- explicit
-- TreeAddress(AddressType _aNodeData) : m_pData(_aNodeData) {}
--
-- bool is() const { return m_pData.is(); }
-- bool isNull() const { return m_pData.isNull(); }
--
-- AddressType::RawAddress addressValue() const { return m_pData.value(); }
--
-- friend bool operator == (TreeAddress const& lhs, TreeAddress const& rhs)
-- { return lhs.m_pData == rhs.m_pData; }
--
-- friend bool operator != (TreeAddress const& lhs, TreeAddress const& rhs)
-- { return lhs.m_pData != rhs.m_pData; }
--
-- private:
-- AddressType m_pData;
-- };
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--#endif // CONFIGMGR_TREEADDRESS_HXX
--
-+/* cvs remove me ... */
-+#error do not include me...
-Index: configmgr/source/inc/treefragment.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/treefragment.hxx,v
-retrieving revision 1.4.74.1
-diff -u -p -u -r1.4.74.1 treefragment.hxx
---- configmgr/source/inc/treefragment.hxx 3 Nov 2006 11:36:29 -0000 1.4.74.1
-+++ configmgr/source/inc/treefragment.hxx 5 Jan 2007 22:25:43 -0000
-@@ -79,16 +79,16 @@ namespace configmgr
- */
- struct TreeFragmentHeader
- {
-- List next; // next sibling set element or template
-- String name; // element-name/template name
-+ struct TreeFragment *next; // next sibling set element or template
-+ String name; // element-name/template name
- union // context
- {
-- Address parent; // parent node
-- String component; // component name
-+ union Node *parent; // parent node
-+ String component; // component name
- };
-- Offset count; // number of contained nodes
-- State::Field state;
-- Byte reserved;
-+ Offset count; // number of contained nodes
-+ State::Field state;
-+ sal_uInt8 reserved;
- };
- //-----------------------------------------------------------------------------
- /* a tree fragment is stored as a variable-sized struct
-@@ -138,9 +138,16 @@ namespace configmgr
-
- rtl::OUString getName() const;
- configmgr::node::Attributes getAttributes()const;
-+
-+ static TreeFragment *allocate(sal_uInt32 nFragments);
-+ static void free_shallow( TreeFragment *pFragment );
- };
- //-----------------------------------------------------------------------------
-+
- }
-+ namespace data {
-+ typedef sharable::TreeFragment * TreeAddress;
-+ }
- //-----------------------------------------------------------------------------
- }
-
-Index: configmgr/source/inc/treemanager.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/treemanager.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 treemanager.hxx
---- configmgr/source/inc/treemanager.hxx 8 Sep 2005 03:59:42 -0000 1.5
-+++ configmgr/source/inc/treemanager.hxx 5 Jan 2007 22:25:43 -0000
-@@ -104,12 +104,10 @@ namespace configmgr
- /** ctor
- */
- explicit
-- TreeManager(BackendCacheRef const & _xBackend, memory::HeapManager & _rCacheHeapManager);
-+ TreeManager(BackendCacheRef const & _xBackend);
-
- // disposing the cache before destroying
- void dispose();
--
-- memory::HeapManager & getCacheHeapManager() const;
-
- // ITreeManager
- virtual memory::Segment* getDataSegment(AbsolutePath const& _rAccessor,
-Index: configmgr/source/inc/treesegment.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/treesegment.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 treesegment.hxx
---- configmgr/source/inc/treesegment.hxx 8 Sep 2005 04:00:27 -0000 1.5
-+++ configmgr/source/inc/treesegment.hxx 5 Jan 2007 22:25:43 -0000
-@@ -43,12 +43,15 @@
- #ifndef _RTL_REF_HXX_
- #include <rtl/ref.hxx>
- #endif
--
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
- #ifndef INCLUDED_MEMORY
- #include <memory>
- #define INCLUDED_MEMORY
- #endif // INCLUDED_MEMORY
-
-+
- // -----------------------------------------------------------------------------
- namespace rtl { class OUString; }
- // -----------------------------------------------------------------------------
-@@ -70,7 +73,6 @@ namespace configmgr
- namespace data
- {
- // -------------------------------------------------------------------------
-- class TreeAddress;
- class TreeAccessor;
- // -------------------------------------------------------------------------
- class TreeSegment
-Index: configmgr/source/inc/types.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/types.hxx,v
-retrieving revision 1.3.58.1
-diff -u -p -u -r1.3.58.1 types.hxx
---- configmgr/source/inc/types.hxx 3 Nov 2006 11:36:43 -0000 1.3.58.1
-+++ configmgr/source/inc/types.hxx 5 Jan 2007 22:25:43 -0000
-@@ -36,10 +36,6 @@
- #ifndef INCLUDED_SHARABLE_BASETYPES_HXX
- #define INCLUDED_SHARABLE_BASETYPES_HXX
-
--#ifndef CONFIGMGR_MEMORYMODEL_HXX
--#include "memorymodel.hxx"
--#endif
--
- #ifndef _SAL_TYPES_H_
- #include <sal/types.h>
- #endif
-@@ -55,35 +51,31 @@ namespace configmgr
- {
- namespace sharable
- {
-- //-----------------------------------------------------------------------------
-- // some base types
-- typedef memory::Address Address; // points to absolute location in memory segment
-- typedef memory::HeapSize HeapSize; // size of memory block within heap
-+ //-----------------------------------------------------------------------------
-+ // some base types
- typedef sal_uInt16 Offset; // Offset relative to 'this' in array of nodes
-- typedef sal_uInt8 Byte;
-
-- // some derived types
-+ // some derived types
- typedef rtl_uString * Name;
- typedef rtl_uString * String;
-- typedef Address List; // singly linked intrusive, used for set elements
-- typedef Address Vector; // points to counted sequence of some type
-+ typedef struct TreeFragment * List; // singly linked intrusive, used for set elements
-+ typedef sal_uInt8 * Vector; // points to counted sequence of some type
-
-- //-----------------------------------------------------------------------------
-+ //-----------------------------------------------------------------------------
-
- Name allocName(::rtl::OUString const & _sString);
- void freeName(Name _aName);
- ::rtl::OUString readName(Name _aName);
-
-- //-----------------------------------------------------------------------------
-+ //-----------------------------------------------------------------------------
-
- String allocString(::rtl::OUString const & _sString);
- void freeString(String _aString);
- ::rtl::OUString readString(String _aString);
-
-- //-----------------------------------------------------------------------------
-+ //-----------------------------------------------------------------------------
- }
- //-----------------------------------------------------------------------------
- }
-
--
- #endif // INCLUDED_SHARABLE_BASETYPES_HXX
-Index: configmgr/source/inc/updateaccessor.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/updateaccessor.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 updateaccessor.hxx
---- configmgr/source/inc/updateaccessor.hxx 28 Dec 2005 17:31:29 -0000 1.5
-+++ configmgr/source/inc/updateaccessor.hxx 5 Jan 2007 22:25:43 -0000
-@@ -39,9 +39,6 @@
- #ifndef CONFIGMGR_UTILITY_HXX_
- #include "utility.hxx"
- #endif
--#ifndef CONFIGMGR_MEMORYMODEL_HXX
--#include "memorymodel.hxx"
--#endif
- #ifndef CONFIGMGR_ACCESSOR_HXX
- #include "accessor.hxx"
- #endif
-@@ -54,87 +51,22 @@ namespace configmgr
- // -------------------------------------------------------------------------
- class Segment;
- class SegmentHeap;
-- // -------------------------------------------------------------------------
--
-- class Allocator
-- {
-- SegmentHeap * m_heap;
--
-- public:
-- typedef memory::Address Address;
-- typedef memory::HeapSize Size;
--
-- Address allocate(Size _sz) const;
-- void deallocate(Address _addr) const;
--
-- void * access(Address _addr) const;
-- Address address(void const * _p) const;
-
-- private:
-- friend class UpdateAccessor;
--
-- Allocator(SegmentHeap * _heap) : m_heap(_heap) {}
-- char * heap_base() const;
-- };
- // -------------------------------------------------------------------------
- class UpdateAccessor : Noncopyable
- {
- Segment * m_segment;
-- SegmentHeap * m_heap;
- public:
-- typedef Accessor::AddressType AddressType;
--
- /// constructs an accessor on the given Segment
- explicit UpdateAccessor(Segment * segment);
- ~UpdateAccessor();
-
- bool is() const { return m_segment != 0; }
-
-- // Warning: The accessor and any addresses validated by it
-- // will be valid only until the next call on this->allocator()
- Accessor accessor() const;
- Accessor downgrade(); // return accessor and clear
- void clear();
--
-- AddressType address(void const * _p) const
-- { return (this->is()) ? reduce(_p) : Pointer();}
--
-- void * access(AddressType _p) const
-- { return (this->is()) ? resolve(_p) : Accessor::failNull();}
--
-- void * validate(AddressType _p) const
-- { return (this->is() && _p.is()) ? resolve(_p) : Accessor::failNull(); }
--
-- // allocation support
-- Allocator allocator() const { return Allocator(m_heap); }
-- private:
-- char * heap_base() const;
-- void * resolve(AddressType _p) const;
-- AddressType reduce(void const * _p) const;
- };
-- // -------------------------------------------------------------------------
--
-- #if OSL_DEBUG_LEVEL == 0
-- inline
-- void * UpdateAccessor::resolve(AddressType _p) const
-- { return _p.is() ? heap_base() + _p.value() : NULL; }
--
-- inline
-- Pointer UpdateAccessor::reduce(void const * _p) const
-- { return _p ? Pointer(static_cast<char const *>(_p) - heap_base()) : Pointer(); }
-- #endif // OSL_DEBUG_LEVEL
--
-- #if OSL_DEBUG_LEVEL == 0
-- inline
-- void * Allocator::access(Address _addr) const
-- { return _addr ? heap_base() + _addr : NULL; }
--
-- inline
-- Allocator::Address Allocator::address(void const * _p) const
-- { return _p ? (static_cast<char const *>(_p) - heap_base()) : 0; }
-- #endif // OSL_DEBUG_LEVEL
--
-- // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/inc/updatehelper.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/updatehelper.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 updatehelper.hxx
---- configmgr/source/inc/updatehelper.hxx 8 Sep 2005 04:01:35 -0000 1.5
-+++ configmgr/source/inc/updatehelper.hxx 5 Jan 2007 22:25:43 -0000
-@@ -45,7 +45,7 @@ namespace configmgr
- {
- //..........................................................................
- namespace memory { class UpdateAccessor; }
-- namespace data { class NodeAddress; class NodeAccessRef; }
-+ namespace data { /* class NodeAddress; */ class NodeAccessRef; }
-
- //..........................................................................
-
-Index: configmgr/source/inc/valuenodeaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/valuenodeaccess.hxx,v
-retrieving revision 1.4.74.1
-diff -u -p -u -r1.4.74.1 valuenodeaccess.hxx
---- configmgr/source/inc/valuenodeaccess.hxx 3 Nov 2006 11:36:56 -0000 1.4.74.1
-+++ configmgr/source/inc/valuenodeaccess.hxx 5 Jan 2007 22:25:43 -0000
-@@ -51,34 +51,20 @@ namespace configmgr
- public:
- typedef NodeAccess::Name Name;
- typedef NodeAccess::Attributes Attributes;
-- typedef ValueNodeAddress NodeAddressType;
-- typedef ValueNodeAddress::AddressType AddressType;
-- typedef ValueNodeAddress::DataType const DataType;
-- typedef DataType * NodePointerType;
--
-- ValueNodeAccess(Accessor const& _aAccessor, NodeAddressType const& _aNodeRef)
-- : m_aAccessor(_aAccessor)
-- , m_pData(_aNodeRef.m_pData)
-- {}
--
-- ValueNodeAccess(Accessor const& _aAccessor, NodePointerType _pNode)
-- : m_aAccessor(_aAccessor)
-- , m_pData(check(_aAccessor,_pNode))
-- {}
-
-+ ValueNodeAccess(memory::Accessor const& _aAccessor, const sharable::ValueNode *_pNodeRef)
-+ : m_aAccessor(_aAccessor)
-+ , m_pData((ValueNodeAddress)_pNodeRef) {}
-+
- explicit
- ValueNodeAccess(NodeAccess const & _aNode)
-- : m_aAccessor(_aNode.accessor())
-- , m_pData(check(_aNode))
-- {
-- }
-+ : m_aAccessor(_aNode.accessor())
-+ , m_pData(check(_aNode)) {}
-
- explicit
- ValueNodeAccess(NodeAccessRef const & _aNode)
-- : m_aAccessor(_aNode.accessor())
-- , m_pData(check(_aNode))
-- {
-- }
-+ : m_aAccessor(_aNode.accessor())
-+ , m_pData(check(_aNode)) {}
-
- static bool isInstance(NodeAccessRef const & _aNode)
- {
-@@ -103,26 +89,25 @@ namespace configmgr
- uno::Any getUserValue() const;
- uno::Any getDefaultValue() const;
-
-- static void setValue(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue);
-- static void setToDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode);
-- static void changeDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue);
-+ static void setValue(memory::UpdateAccessor & _aUpdater, ValueNodeAddress _aValueNode, uno::Any const& _aValue);
-+ static void setToDefault(memory::UpdateAccessor & _aUpdater, ValueNodeAddress _aValueNode);
-+ static void changeDefault(memory::UpdateAccessor & _aUpdater, ValueNodeAddress _aValueNode, uno::Any const& _aValue);
-
-- NodeAddressType address() const { return NodeAddressType(m_pData); }
-- Accessor const& accessor() const { return m_aAccessor; }
-+ memory::Accessor const& accessor() const { return m_aAccessor; }
-
-- DataType& data() const { return *static_cast<NodePointerType>(m_aAccessor.validate(m_pData)); }
-+ sharable::ValueNode& data() const { return *m_pData; }
-+ operator ValueNodeAddress () const { return (ValueNodeAddress)m_pData; }
-
- operator NodeAccessRef() const { return NodeAccessRef(&m_aAccessor,NodeAddress(m_pData)); }
-+ bool operator == (const NodeAddress &rAddr) const { return NodeAddress(m_pData) == rAddr; }
-+ bool operator == (const ValueNodeAddress &rAddr) const { return m_pData == rAddr; }
- private:
-- static AddressType check(Accessor const& _acc, NodePointerType _p) { return _acc.address(_p); }
-- static AddressType check(NodeAccessRef const& _aNodeData);
-+ static ValueNodeAddress check(NodeAccessRef const& _aNodeData);
-
-- Accessor m_aAccessor;
-- AddressType m_pData;
-+ memory::Accessor m_aAccessor;
-+ ValueNodeAddress m_pData;
- };
-
-- ValueNodeAddress toValueNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr);
-- ValueNodeAddress toValueNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr);
- // -------------------------------------------------------------------------
-
- inline
-@@ -143,15 +128,15 @@ namespace configmgr
-
- inline
- uno::Any ValueNodeAccess::getValue() const
-- { return data().getValue(m_aAccessor); }
-+ { return data().getValue(); }
-
- inline
- uno::Any ValueNodeAccess::getUserValue() const
-- { return data().getUserValue(m_aAccessor); }
-+ { return data().getUserValue(); }
-
- inline
- uno::Any ValueNodeAccess::getDefaultValue() const
-- { return data().getDefaultValue(m_aAccessor); }
-+ { return data().getDefaultValue(); }
-
- // -------------------------------------------------------------------------
- }
-Index: configmgr/source/inc/valueref.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/valueref.hxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 valueref.hxx
---- configmgr/source/inc/valueref.hxx 8 Sep 2005 04:02:40 -0000 1.4
-+++ configmgr/source/inc/valueref.hxx 5 Jan 2007 22:25:43 -0000
-@@ -125,7 +125,7 @@ namespace configmgr
- // checking
- bool isEmpty() const;
- // checking
-- bool isValidNode(data::Accessor const& _accessor) const;
-+ bool isValidNode(memory::Accessor const& _accessor) const;
- // hashing
- size_t hashCode() const;
- // containing node this
-@@ -141,7 +141,7 @@ namespace configmgr
- //-------------------------------------------------------------------------
-
- typedef std::vector<SubNodeID> SubNodeIDList;
-- void getAllChildrenHelper(data::Accessor const& _aAccessor, NodeID const& aNode, SubNodeIDList& aList);
-+ void getAllChildrenHelper(memory::Accessor const& _aAccessor, NodeID const& aNode, SubNodeIDList& aList);
-
- //-------------------------------------------------------------------------
- inline bool operator!=(SubNodeID const& lhs, SubNodeID const& rhs)
-Index: configmgr/source/localbe/localfilehelper.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localfilehelper.cxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 localfilehelper.cxx
---- configmgr/source/localbe/localfilehelper.cxx 16 Sep 2006 15:11:34 -0000 1.4
-+++ configmgr/source/localbe/localfilehelper.cxx 5 Jan 2007 22:25:43 -0000
-@@ -164,6 +164,10 @@ namespace configmgr
- if (_sURL.getLength() == 0)
- return false;
-
-+ // This method has no right to be so under-performing to
-+ // achieve so, so little of any usefulness.
-+ return true;
-+
- DirectoryItem aDirItem;
-
- DirectoryItem::RC rc = DirectoryItem::get(_sURL, aDirItem);
-Index: configmgr/source/localbe/localmultistratum.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localmultistratum.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 localmultistratum.cxx
---- configmgr/source/localbe/localmultistratum.cxx 16 Sep 2006 15:12:17 -0000 1.8
-+++ configmgr/source/localbe/localmultistratum.cxx 5 Jan 2007 22:25:43 -0000
-@@ -110,7 +110,7 @@ uno::Sequence< rtl::OUString > SAL_CALL
- rtl::OUString const aComponentUrl = aLayerUrl + componentToPath(aComponent);
-
- using namespace osl;
-- const sal_uInt32 k_STATUS_FIELDS = FileStatusMask_Type | FileStatusMask_FileName;
-+ const sal_uInt32 k_STATUS_FIELDS = FileStatusMask_FileName;
- Directory aComponentDirectory(aComponentUrl);
- DirectoryItem aItem;
- std::vector< rtl::OUString > aResult;
-@@ -135,13 +135,12 @@ uno::Sequence< rtl::OUString > SAL_CALL
- OSL_TRACE("Reading Component Directory - Error (%u) getting status of directory item.\n", unsigned(errcode));
- break;
- }
--
-- OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_Type), "Could not get type of directory item");
-- if (aItemDescriptor.getFileType() != FileStatus::Regular)
-- continue;
-
- OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get Name of component found");
- OUString const aFileName = aItemDescriptor.getFileName();
-+
-+ // It is reasonable to assume a .xcu file is not a directory & =>
-+ // not stat each directory entry at considerable cost.
- if (!aFileName.endsWithIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(kLocalDataSuffix)))
- continue;
-
-Index: configmgr/source/misc/filehelper.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/filehelper.cxx,v
-retrieving revision 1.17
-diff -u -p -u -r1.17 filehelper.cxx
---- configmgr/source/misc/filehelper.cxx 16 Sep 2006 15:15:25 -0000 1.17
-+++ configmgr/source/misc/filehelper.cxx 5 Jan 2007 22:25:43 -0000
-@@ -146,9 +146,22 @@ namespace configmgr
- static const TimeValue k_NullTime = {0,0};
- sal_uInt64 aSize = 0;
- rModifyTime = k_NullTime;
-+ rtl::OUString aURL;
-
-- DirectoryItem aItem;
-- if (osl::FileBase::E_None == DirectoryItem::get(_sURL, aItem))
-+ DirectoryItem aItem;
-+
-+#ifndef STAT_LOTS_OF_UNUSED_FILES
-+ // Statting every file takes way to long - we can use the directory
-+ // time-stamp & size instead, if we need to provoke an update
-+ // a simple cat > foo; rm foo will do that.
-+ // The dir size is (hopefully) non-0 and a good enough proxy value.
-+
-+ aURL = FileHelper::getParentDir(_sURL);
-+#else
-+ aURL = _sURL;
-+#endif
-+
-+ if (osl::FileBase::E_None == DirectoryItem::get(aURL, aItem))
- {
- FileStatus aStatus(osl_FileStatus_Mask_ModifyTime|osl_FileStatus_Mask_Type|osl_FileStatus_Mask_FileSize);
- if (osl::FileBase::E_None == aItem.getFileStatus(aStatus))
-Index: configmgr/source/misc/mergechange.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/mergechange.cxx,v
-retrieving revision 1.24
-diff -u -p -u -r1.24 mergechange.cxx
---- configmgr/source/misc/mergechange.cxx 16 Sep 2006 15:16:11 -0000 1.24
-+++ configmgr/source/misc/mergechange.cxx 5 Jan 2007 22:25:43 -0000
-@@ -95,7 +95,7 @@ namespace configmgr
- // TODO: check name match
- void applyUpdateWithAdjustment(TreeChangeList & _anUpdate, memory::UpdateAccessor& _aUpdateAccess, data::NodeAddress const & _aBaseAddress)
- {
-- OSL_ASSERT(_aBaseAddress.is());
-+ OSL_ASSERT(_aBaseAddress != NULL);
-
- applyUpdateWithAdjustmentToTree(_anUpdate.root,_aUpdateAccess,_aBaseAddress);
- }
-@@ -104,7 +104,7 @@ namespace configmgr
- // TODO: check name match
- bool adjustUpdate(TreeChangeList & _anUpdate, memory::UpdateAccessor& _aUpdateAccess, data::NodeAddress const & _aBaseAddress)
- {
-- OSL_ASSERT(_aBaseAddress.is());
-+ OSL_ASSERT(_aBaseAddress != NULL);
-
- return adjustUpdateToTree(_anUpdate.root,_aUpdateAccess,_aBaseAddress);
- }
-Index: configmgr/source/tree/builddata.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/builddata.cxx,v
-retrieving revision 1.9.12.1
-diff -u -p -u -r1.9.12.1 builddata.cxx
---- configmgr/source/tree/builddata.cxx 3 Nov 2006 11:37:09 -0000 1.9.12.1
-+++ configmgr/source/tree/builddata.cxx 5 Jan 2007 22:25:43 -0000
-@@ -38,9 +38,6 @@
-
- #include "builddata.hxx"
-
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
--#endif
- #ifndef CONFIGMGR_TREEACCESSOR_HXX
- #include "treeaccessor.hxx"
- #endif
-@@ -100,9 +97,7 @@ namespace configmgr
- {
- //-------------------------------------------------------------------------
- using namespace sharable;
-- using memory::Pointer;
- using memory::Accessor;
-- using memory::Allocator;
- using memory::UpdateAccessor;
- //-----------------------------------------------------------------------------
-
-@@ -110,20 +105,18 @@ namespace configmgr
- inline
- NodeAddress offsetNodeBy(NodeAddress _aNode, Offset _nOffset)
- {
-- Address aRawAddr = _aNode.addressValue() + _nOffset * sizeof(Node);
--
-- return NodeAddress(Pointer(aRawAddr));
-+ sharable::Node *pNode = _aNode;
-+ pNode += _nOffset;
-+ return NodeAddress(pNode);
- }
-
- static
- inline
- NodeAddress addressOfNodeAt(TreeAddress _aTree, Offset _nOffset)
- {
-- Address aRawAddr = _aTree.addressValue() +
-- offsetof(TreeFragment,nodes) +
-- _nOffset * sizeof(Node);
--
-- return NodeAddress(Pointer(aRawAddr));
-+ sharable::TreeFragment *pRaw = _aTree;
-+// return NodeAddress( (memory::Address)( pRaw->nodes + _nOffset ));
-+ return &pRaw->nodes[_nOffset];
- }
-
- //-----------------------------------------------------------------------------
-@@ -152,7 +145,7 @@ namespace configmgr
- Offset startGroup( Name _aName, Flags::Field _aFlags );
- void endGroup( Offset _nPos );
-
-- void addSet( Name _aName, Flags::Field _aFlags, Address _aElementType );
-+ void addSet( Name _aName, Flags::Field _aFlags, SetElementAddress _aElementType );
-
- void addValue( Name _aName, Flags::Field _aFlags,
- AnyData::TypeCode _aValueType,
-@@ -163,7 +156,7 @@ namespace configmgr
- class LinkSetNodes;
-
- private:
-- TreeAddress allocTreeFragment(UpdateAccessor & _anUpdater);
-+ TreeAddress allocTreeFragment();
- void linkTreeFragment(UpdateAccessor & _anUpdater, TreeAddress _aTreeAddr);
-
- Offset addNode(Name _aName, Flags::Field _aFlags, Type::Field _aType);
-@@ -178,7 +171,8 @@ namespace configmgr
- public:
- explicit
- CollectSetElements(UpdateAccessor & _anUpdater)
-- : m_updater(_anUpdater)
-+ : m_updater(_anUpdater)
-+ , m_head(NULL)
- {
- }
-
-@@ -198,7 +192,7 @@ namespace configmgr
- explicit
- LinkSetNodes(UpdateAccessor & _anUpdater)
- : m_updater(_anUpdater)
-- , m_aParentAddr()
-+ , m_aParentAddr(NULL)
- {
- }
-
-@@ -228,7 +222,6 @@ namespace configmgr
- TreeNodeBuilder& builder() { return m_builder; }
- UpdateAccessor & updater() const { return m_updater; }
- Accessor accessor() const { return m_updater.accessor(); }
-- Allocator allocator() const { return m_updater.allocator(); }
- private:
- UpdateAccessor & m_updater;
- TreeNodeBuilder m_builder;
-@@ -253,7 +246,7 @@ namespace configmgr
- virtual void handle(ISubtree const & _aNode);
- virtual void handle(OValueNode const & _aNode);
-
-- Address makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule);
-+ SetElementAddress makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule);
-
- Name allocName(INode const & _aNode);
- State::Field makeState(node::Attributes const & _aAttributes);
-@@ -275,7 +268,7 @@ namespace configmgr
- , m_bWithDefaults()
- {}
-
-- List buildElementList(ISubtree const & _aSet, bool _bWithDefaults);
-+ TreeFragment *buildElementList(ISubtree const & _aSet, bool _bWithDefaults);
- private:
- void handleNode(INode const & _aSourceNode);
-
-@@ -304,7 +297,7 @@ namespace configmgr
- Result handle(GroupNodeAccess const & _aNode);
- Result handle(SetNodeAccess const & _aNode);
-
-- Address makeTemplateData(Address _aSourceTemplate);
-+ SetElementAddress makeTemplateData(SetElementAddress _aSourceTemplate);
- };
- //-----------------------------------------------------------------------------
-
-@@ -399,7 +392,6 @@ namespace configmgr
- protected:
- UpdateAccessor & updater() const { return m_updater; }
- Accessor accessor() const { return m_updater.accessor(); }
-- Allocator allocator() const { return m_updater.allocator(); }
- private:
- UpdateAccessor & m_updater;
- };
-@@ -427,7 +419,6 @@ namespace configmgr
- private:
- UpdateAccessor & updater() const { return m_updater; }
- Accessor accessor() const { return m_updater.accessor(); }
-- Allocator allocator() const { return m_updater.allocator(); }
- private:
- UpdateAccessor & m_updater;
- };
-@@ -493,25 +484,25 @@ std::auto_ptr<INode> convertTree(TreeAcc
- inline
- void TreeNodeBuilder::CollectSetElements::resetElementList()
- {
-- OSL_ENSURE(m_head.isNull(), "Joining to a element list that was forgotten");
-+ OSL_ENSURE(m_head == NULL, "Joining to a element list that was forgotten");
- }
- //-----------------------------------------------------------------------------
-
- inline
- List TreeNodeBuilder::CollectSetElements::getElementListAndClear()
- {
-- List aResult = m_head.addressValue();
-- m_head = TreeAddress();
-+ List aResult = m_head;
-+ m_head = NULL;
- return aResult;
- }
- //-----------------------------------------------------------------------------
-
- void TreeNodeBuilder::CollectSetElements::addElement(TreeAddress _aNewElement)
- {
-- if (TreeFragment * pNewFragment = TreeAccessor::access(_aNewElement,m_updater))
-+ if (TreeFragment * pNewFragment = _aNewElement)
- {
- pNewFragment->header.parent = 0; // data not available here
-- pNewFragment->header.next = m_head.addressValue();
-+ pNewFragment->header.next = m_head;
-
- m_head = _aNewElement;
- }
-@@ -528,7 +519,7 @@ NodeVisitor::Result TreeNodeBuilder::Lin
- TreeFragment const & rTreeData = aTreeAccess.data();
-
- NodeAddress aOldParent = m_aParentAddr;
-- m_aParentAddr = NodeAddress();
-+ m_aParentAddr = NULL;
-
- Result eResult = CONTINUE;
-
-@@ -549,12 +540,12 @@ NodeVisitor::Result TreeNodeBuilder::Lin
-
- NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::linkSet(SetNodeAccess const & _aSet)
- {
-- OSL_ENSURE(m_aParentAddr.isNull(),"Linking set data already in progress");
-- m_aParentAddr = _aSet.address();
-+ OSL_ENSURE(m_aParentAddr == NULL,"Linking set data already in progress");
-+ m_aParentAddr = _aSet;
-
- Result aResult = this->visitElements(_aSet);
-
-- m_aParentAddr = NodeAddress();
-+ m_aParentAddr = NULL;
-
- return aResult;
- }
-@@ -562,11 +553,12 @@ NodeVisitor::Result TreeNodeBuilder::Lin
-
- NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::handle(TreeAccessor const & _aSourceTree)
- {
-- OSL_ENSURE(m_aParentAddr.is(),"Cannot link set element without parent address");
-+ OSL_ENSURE(m_aParentAddr != NULL,"Cannot link set element without parent address");
-
-- TreeFragment * pFragment = _aSourceTree.access(_aSourceTree.address(), m_updater);
-+ // TreeFragment * pFragment = _aSourceTree;
-
-- pFragment->header.parent = m_aParentAddr.addressValue();
-+ // pFragment->header.parent = m_aParentAddr;
-+ _aSourceTree->header.parent = m_aParentAddr;
-
- return CONTINUE;
- }
-@@ -638,25 +630,15 @@ void TreeNodeBuilder::resetTreeFragment(
- }
- //-----------------------------------------------------------------------------
-
--TreeAddress TreeNodeBuilder::allocTreeFragment(UpdateAccessor & _anUpdater)
-+TreeAddress TreeNodeBuilder::allocTreeFragment()
- {
- OSL_ENSURE(m_nodes.size() == m_header.count, "TreeNodeBuilder: node count mismatch");
-
-- sal_uInt32 const nFragmentSize = sizeof(TreeFragment) + (m_header.count-1)*sizeof(Node);
--
-- OSL_ASSERT(nFragmentSize >= sizeof m_header + m_header.count*sizeof(Node));
--
-- Address aBaseAddress = _anUpdater.allocator().allocate(nFragmentSize);
-+ TreeFragment *pFragment = TreeFragment::allocate(m_header.count);
-+ pFragment->header = m_header;
-+ std::copy(m_nodes.begin(),m_nodes.end(),pFragment->nodes);
-
-- TreeAddress aResult = TreeAddress( memory::Pointer(aBaseAddress) );
--
-- if (TreeFragment * pFragment = TreeAccessor::access(aResult,_anUpdater))
-- {
-- pFragment->header = m_header;
-- std::copy(m_nodes.begin(),m_nodes.end(),pFragment->nodes);
-- }
--
-- return aResult;
-+ return TreeAddress( pFragment );
- }
- //-----------------------------------------------------------------------------
-
-@@ -668,9 +650,9 @@ void TreeNodeBuilder::linkTreeFragment(U
-
- TreeAddress TreeNodeBuilder::createTreeFragment(UpdateAccessor & _anUpdater)
- {
-- TreeAddress aResult = allocTreeFragment(_anUpdater);
-+ TreeAddress aResult = allocTreeFragment();
-
-- if (aResult.is())
-+ if (aResult != NULL)
- {
- linkTreeFragment(_anUpdater,aResult);
-
-@@ -708,7 +690,7 @@ void TreeNodeBuilder::endGroup( Offset _
- }
- //-----------------------------------------------------------------------------
-
--void TreeNodeBuilder::addSet( Name _aName, Flags::Field _aFlags, Address _aElementType )
-+void TreeNodeBuilder::addSet( Name _aName, Flags::Field _aFlags, SetElementAddress _aElementType )
- {
- addNode(_aName,_aFlags,Type::nodetype_set);
-
-@@ -739,7 +721,7 @@ void TreeNodeBuilder::addValue( Name _aN
- TreeAddress CopyingDataTreeBuilder::buildTree(TreeAccessor const & _aSourceTree)
- {
- OSL_ENSURE(_aSourceTree.isValid(), "Trying to build a tree from NULL data");
-- if (!_aSourceTree.isValid()) return TreeAddress();
-+ if (!_aSourceTree.isValid()) return NULL;
-
- TreeFragment const & aSrc = _aSourceTree.data();
-
-@@ -763,12 +745,12 @@ NodeVisitor::Result CopyingDataTreeBuild
-
- AnyData aNewValue, aNewDefault;
- if (aFlags & Flags::valueAvailable)
-- aNewValue = allocData(allocator(), aType, aSrc.getUserValue(_aNode.accessor()));
-+ aNewValue = allocData(aType, aSrc.getUserValue());
- else
- aNewValue.data = 0;
-
- if (aFlags & Flags::defaultAvailable)
-- aNewDefault = allocData(allocator(), aType, aSrc.getDefaultValue(_aNode.accessor()));
-+ aNewDefault = allocData(aType, aSrc.getDefaultValue());
- else
- aNewDefault.data = 0;
-
-@@ -799,7 +781,7 @@ NodeVisitor::Result CopyingDataTreeBuild
-
- sharable::Name aNodeName = allocName( aSrc.info.getName());
- Flags::Field aFlags = aSrc.info.flags;
-- Address aTemplate = this->makeTemplateData(aSrc.elementType);
-+ SetElementAddress aTemplate = this->makeTemplateData(aSrc.elementType);
-
- this->builder().addSet(aNodeName,aFlags,aTemplate);
-
-@@ -812,9 +794,9 @@ NodeVisitor::Result CopyingDataTreeBuild
- }
- //-----------------------------------------------------------------------------
-
--Address CopyingDataTreeBuilder::makeTemplateData(Address _aSourceTemplate)
-+SetElementAddress CopyingDataTreeBuilder::makeTemplateData(SetElementAddress _aSourceTemplate)
- {
-- return SetNode::copyTemplateData(allocator(), _aSourceTemplate);
-+ return SetNode::copyTemplateData(_aSourceTemplate);
- }
- //-----------------------------------------------------------------------------
-
-@@ -892,7 +874,8 @@ void ConvertingDataTreeBuilder::handle(I
-
- if (_aNode.isSetNode())
- {
-- Address aTemplate = this->makeTemplateData(_aNode.getElementTemplateName(),_aNode.getElementTemplateModule());
-+ SetElementAddress aTemplate = this->makeTemplateData(_aNode.getElementTemplateName(),
-+ _aNode.getElementTemplateModule());
-
- this->builder().addSet(aNodeName,aFlags,aTemplate);
-
-@@ -927,7 +910,7 @@ void ConvertingDataTreeBuilder::handle(O
- uno::Any aValue = _aNode.getValue();
- if (aValue.hasValue())
- {
-- aNewValue = allocData(allocator(), aType, aValue);
-+ aNewValue = allocData(aType, aValue);
- aFlags |= Flags::valueAvailable;
- }
- }
-@@ -937,7 +920,7 @@ void ConvertingDataTreeBuilder::handle(O
- uno::Any aDefault = _aNode.getDefault();
- if (aDefault.hasValue())
- {
-- aNewDefault = allocData(allocator(), aType, aDefault);
-+ aNewDefault = allocData(aType, aDefault);
- aFlags |= Flags::defaultAvailable;
- }
- }
-@@ -1002,9 +985,9 @@ Flags::Field ConvertingDataTreeBuilder::
- }
- //-----------------------------------------------------------------------------
-
--Address ConvertingDataTreeBuilder::makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule)
-+SetElementAddress ConvertingDataTreeBuilder::makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule)
- {
-- return SetNode::allocTemplateData(allocator(), _aTemplateName, _aTemplateModule );
-+ return SetNode::allocTemplateData(_aTemplateName, _aTemplateModule );
- }
- //-----------------------------------------------------------------------------
-
-@@ -1188,9 +1171,9 @@ void DataTreeDefaultMerger::handle(OValu
-
- TreeAddress DataTreeCleanup::destroyTree(TreeAddress _aBaseAddress)
- {
-- TreeFragment * pData = TreeAccessor::access(_aBaseAddress,updater());
-+ TreeFragment *pData = _aBaseAddress;
-
-- List aNext = pData->header.next;
-+ TreeFragment *pNext = pData->header.next;
-
- Offset const nCount = pData->header.count;
-
-@@ -1201,15 +1184,15 @@ TreeAddress DataTreeCleanup::destroyTree
- destroyNode( addressOfNodeAt(_aBaseAddress,i) );
- }
-
-- allocator().deallocate( _aBaseAddress.addressValue() );
-+ TreeFragment::free_shallow( pData );
-
-- return TreeAddress( Pointer(aNext) );
-+ return TreeAddress( pNext );
- }
- //-----------------------------------------------------------------------------
-
- void DataTreeCleanup::destroyNode(NodeAddress _aNodeAddress)
- {
-- Node * pNode = NodeAccess::access(_aNodeAddress,updater());
-+ Node * pNode = _aNodeAddress;
-
- Type::Field aTypeTag = pNode->node.info.type;
- switch ( aTypeTag & Type::mask_nodetype )
-@@ -1250,16 +1233,16 @@ void DataTreeCleanup::destroyData(NodeIn
-
- void DataTreeCleanup::destroyData(sharable::SetNode * _pNode)
- {
-- TreeAddress aElement( Pointer( _pNode->elements ) );
-+ TreeAddress aElement( _pNode->elements );
-
-- Address aTemplate = _pNode->elementType;;
-+ SetElementAddress aTemplate = _pNode->elementType;;
-
- destroyData(&_pNode->info);
-
-- while (aElement.is())
-+ while (aElement != NULL)
- aElement = destroyTree(aElement);
-
-- SetNode::releaseTemplateData( allocator(), aTemplate );
-+ SetNode::releaseTemplateData( aTemplate );
- }
- //-----------------------------------------------------------------------------
-
-@@ -1278,10 +1261,10 @@ void DataTreeCleanup::destroyData(sharab
- destroyData(&_pNode->info);
-
- if (aFlags & Flags::valueAvailable)
-- freeData( allocator(), aValueType, _pNode->value );
-+ freeData( aValueType, _pNode->value );
-
- if (aFlags & Flags::defaultAvailable)
-- freeData( allocator(), aValueType, _pNode->defaultValue );
-+ freeData( aValueType, _pNode->defaultValue );
-
- }
- //-----------------------------------------------------------------------------
-Index: configmgr/source/tree/changes.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/changes.cxx,v
-retrieving revision 1.19
-diff -u -p -u -r1.19 changes.cxx
---- configmgr/source/tree/changes.cxx 16 Sep 2006 15:20:06 -0000 1.19
-+++ configmgr/source/tree/changes.cxx 5 Jan 2007 22:25:44 -0000
-@@ -259,7 +259,7 @@ AddNode::AddNode(TreeSegment const & _aA
- :Change(_rName,_bToDefault)
- ,m_aOwnNewNode(_aAddedTree)
- ,m_aOwnOldNode()
-- ,m_aInsertedTree()
-+ ,m_aInsertedTree(NULL)
- ,m_bReplacing(false)
- {
- }
-@@ -288,7 +288,7 @@ std::auto_ptr<Change> AddNode::clone() c
- //--------------------------------------------------------------------------
- void AddNode::setInsertedAddress(data::TreeAddress const & _aInsertedTree)
- {
-- OSL_ENSURE( !m_aInsertedTree.is(), "AddNode already was applied - inserted a second time ?");
-+ OSL_ENSURE( m_aInsertedTree == NULL, "AddNode already was applied - inserted a second time ?");
- m_aInsertedTree = _aInsertedTree;
- }
- //--------------------------------------------------------------------------
-Index: configmgr/source/tree/cmtree.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/cmtree.cxx,v
-retrieving revision 1.37.12.1
-diff -u -p -u -r1.37.12.1 cmtree.cxx
---- configmgr/source/tree/cmtree.cxx 3 Nov 2006 11:37:26 -0000 1.37.12.1
-+++ configmgr/source/tree/cmtree.cxx 5 Jan 2007 22:25:44 -0000
-@@ -253,7 +253,7 @@ namespace configmgr
- {
- INode* pINode = *it2;
- OUString aName2 = pINode->getName();
-- volatile int dummy;
-+ volatile int dummy = 0;
- dummy = 0;
- }
- #endif
-Index: configmgr/source/tree/groupnodeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/groupnodeaccess.cxx,v
-retrieving revision 1.6.12.1
-diff -u -p -u -r1.6.12.1 groupnodeaccess.cxx
---- configmgr/source/tree/groupnodeaccess.cxx 3 Nov 2006 11:37:40 -0000 1.6.12.1
-+++ configmgr/source/tree/groupnodeaccess.cxx 5 Jan 2007 22:25:44 -0000
-@@ -50,23 +50,13 @@ namespace configmgr
- namespace data
- {
- // -------------------------------------------------------------------------
-- using memory::Pointer;
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
-
-- Pointer GroupNodeAccess::check(Accessor const& _aAccessor, sharable::GroupNode const* pInnerNode)
-+ GroupNodeAddress GroupNodeAccess::check(NodeAccessRef const& _aNode)
- {
-- return _aAccessor.address(pInnerNode);
-- }
-- // -------------------------------------------------------------------------
--
-- Pointer GroupNodeAccess::check(NodeAccessRef const& _aNode)
-- {
-- if (sharable::Node const* pNode = _aNode.getDataPtr())
-- return check(_aNode.accessor(), pNode->groupData());
--
-+ if (sharable::Node const* pNode = _aNode)
-+ return const_cast<GroupNodeAddress>(pNode->groupData());
- else
-- return Pointer();
-+ return NULL;
- }
- // -------------------------------------------------------------------------
- bool GroupNodeAccess::hasChildren() const
-@@ -76,21 +66,61 @@ namespace configmgr
- return aNode.numDescendants > 0 ? true:false;
- }
-
--
- // -------------------------------------------------------------------------
-
-+ GroupNodeAccess::~GroupNodeAccess()
-+ {
-+ fprintf (stderr, "~GroupNodeAccess %p\n", this);
-+ }
-+
- NodeAddress GroupNodeAccess::implGetChild(Name const& _aName) const
- {
- using namespace sharable;
-+ rtl::OUString aNodeName = _aName.toString();
-+ fprintf (stderr, "implGetChild %p '%s' ", this,
-+ rtl::OUStringToOString(aNodeName,
-+ RTL_TEXTENCODING_UTF8).getStr());
-+ fprintf (stderr, "cache '%s'\n",
-+ m_pCache ? rtl::OUStringToOString(m_pCache->getName(),
-+ RTL_TEXTENCODING_UTF8).getStr()
-+ : "<null>");
-+
- GroupNode const & aNode = data();
-+#warning Abhortive cache here needs removing ...
-+#if 0
-+ if (m_pCache)
-+ {
-+ fprintf (stderr, "\t compare '%s'\n",
-+ rtl::OUStringToOString(m_pCache->getName(),
-+ RTL_TEXTENCODING_UTF8).getStr());
-+ if (m_pCache->isNamed(aNodeName))
-+ return NodeAccessRef(&m_aAccessor, m_pCache);
-+
-+ m_pCache = aNode.getNextChild(m_pCache);
-+
-+ if (m_pCache && m_pCache->isNamed(aNodeName))
-+ {
-+ fprintf (stderr, "\t compare '%s'\n",
-+ rtl::OUStringToOString(m_pCache->getName(),
-+ RTL_TEXTENCODING_UTF8).getStr());
-+ return NodeAccessRef(&m_aAccessor, m_pCache);
-+ }
-+ m_pCache = NULL;
-+ }
-+#endif
-+
- for (Node const * pChild = aNode.getFirstChild();
- pChild != NULL;
- pChild = aNode.getNextChild(pChild))
- {
-- if (pChild->isNamed(_aName.toString()))
-+ fprintf (stderr, "\t compare '%s'\n",
-+ rtl::OUStringToOString(pChild->getName(),
-+ RTL_TEXTENCODING_UTF8).getStr());
-+ if (pChild->isNamed(aNodeName))
- {
- NodeAccessRef aChildNode(&m_aAccessor,pChild);
-- return aChildNode.address();
-+ m_pCache = pChild;
-+ return aChildNode;
- }
- }
- return NodeAddress();
-Index: configmgr/source/tree/makefile.mk
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/makefile.mk,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 makefile.mk
---- configmgr/source/tree/makefile.mk 8 Mar 2006 14:01:27 -0000 1.11
-+++ configmgr/source/tree/makefile.mk 5 Jan 2007 22:25:44 -0000
-@@ -57,7 +57,6 @@ SLOFILES=\
- $(SLO)$/treesegment.obj \
- $(SLO)$/nodevisitor.obj \
- $(SLO)$/nodeaccess.obj \
-- $(SLO)$/treeaccessor.obj \
- $(SLO)$/valuenodeaccess.obj \
- $(SLO)$/groupnodeaccess.obj \
- $(SLO)$/setnodeaccess.obj \
-Index: configmgr/source/tree/node.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/node.cxx,v
-retrieving revision 1.8.12.1
-diff -u -p -u -r1.8.12.1 node.cxx
---- configmgr/source/tree/node.cxx 3 Nov 2006 11:37:53 -0000 1.8.12.1
-+++ configmgr/source/tree/node.cxx 5 Jan 2007 22:25:44 -0000
-@@ -226,68 +226,55 @@ struct SetNodeTemplateData
- };
- //-----------------------------------------------------------------------------
- static inline
--SetNodeTemplateData * readTemplateData(memory::Allocator const & _anAllocator, Address _aTemplateData)
-+SetNodeTemplateData * readTemplateData(SetElementAddress _aTemplateData)
- {
-- return static_cast<SetNodeTemplateData *>( _anAllocator.access(_aTemplateData) );
--}
--//-----------------------------------------------------------------------------
--static inline
--SetNodeTemplateData const * readTemplateData(memory::Accessor const & _anAccessor, Address _aTemplateData)
--{
-- return static_cast<SetNodeTemplateData const*>( _anAccessor.access(memory::Pointer(_aTemplateData)) );
-+ return reinterpret_cast<SetNodeTemplateData *>( _aTemplateData );
- }
- //-----------------------------------------------------------------------------
-
--Address SetNode::allocTemplateData(memory::Allocator const & _anAllocator,
-- const rtl::OUString &rName,
-+SetElementAddress SetNode::allocTemplateData(const rtl::OUString &rName,
- const rtl::OUString &rModule)
- {
-- Address aData = _anAllocator.allocate(sizeof(SetNodeTemplateData));
-+ SetNodeTemplateData * pData = new SetNodeTemplateData();
-
-- if (aData)
-- {
-- SetNodeTemplateData * pData = readTemplateData(_anAllocator,aData);
--
-- OSL_ENSURE(pData, "Creating template data: unexpected NULL data");
-+ OSL_ENSURE(pData, "Creating template data: unexpected NULL data");
-
-- pData->name = allocName(rName);
-- pData->module = allocName(rModule);
-- }
-- return aData;
-+ pData->name = allocName(rName);
-+ pData->module = allocName(rModule);
-+
-+ return reinterpret_cast<SetElementAddress>( pData );
- }
-
--Address SetNode::copyTemplateData(memory::Allocator const & _anAllocator,
-- Address _aTemplateData)
-+SetElementAddress SetNode::copyTemplateData(SetElementAddress _aTemplateData)
- {
-- SetNodeTemplateData const * pData = readTemplateData(_anAllocator,_aTemplateData);
-+ SetNodeTemplateData const * pData = readTemplateData(_aTemplateData);
-
- OSL_ENSURE(pData, "Copying template data: unexpected NULL data");
-
-- return allocTemplateData(_anAllocator, readName(pData->name),
-- readName(pData->module));
-+ return allocTemplateData(readName(pData->name), readName(pData->module));
- }
-
- //-----------------------------------------------------------------------------
-
--void SetNode::releaseTemplateData(memory::Allocator const & _anAllocator, Address _aTemplateData)
-+void SetNode::releaseTemplateData(SetElementAddress _aTemplateData)
- {
- if (!_aTemplateData) return;
-
-- SetNodeTemplateData const * pData = readTemplateData(_anAllocator,_aTemplateData);
-+ SetNodeTemplateData const * pData = readTemplateData(_aTemplateData);
-
- OSL_ENSURE(pData, "Freeing template data: unexpected NULL data");
-
- freeName(pData->name);
- freeName(pData->module);
-
-- _anAllocator.deallocate(_aTemplateData);
-+ delete pData;
- }
-
- //-----------------------------------------------------------------------------
-
--rtl::OUString SetNode::getElementTemplateName(memory::Accessor const & _anAccessor) const
-+rtl::OUString SetNode::getElementTemplateName() const
- {
-- SetNodeTemplateData const * pData = readTemplateData(_anAccessor,this->elementType);
-+ SetNodeTemplateData const * pData = readTemplateData(this->elementType);
-
- OSL_ENSURE(pData, "ERROR: No template data found for set");
-
-@@ -295,9 +282,9 @@ rtl::OUString SetNode::getElementTemplat
- }
- //-----------------------------------------------------------------------------
-
--rtl::OUString SetNode::getElementTemplateModule(memory::Accessor const & _anAccessor) const
-+rtl::OUString SetNode::getElementTemplateModule() const
- {
-- SetNodeTemplateData const * pData = readTemplateData(_anAccessor,this->elementType);
-+ SetNodeTemplateData const * pData = readTemplateData(this->elementType);
-
- OSL_ENSURE(pData, "ERROR: No template data found for set");
-
-@@ -306,25 +293,25 @@ rtl::OUString SetNode::getElementTemplat
- //-----------------------------------------------------------------------------
-
- static inline
--TreeFragment const * implGetFragmentFromList(memory::Accessor const & _anAccessor, List _aListEntry)
-+TreeFragment const * implGetFragmentFromList(List _aListEntry)
- {
-- return static_cast<TreeFragment const *>(_anAccessor.access(memory::Pointer(_aListEntry)));
-+ return reinterpret_cast<TreeFragment const *>(_aListEntry);
- }
- //-----------------------------------------------------------------------------
-
--TreeFragment const * SetNode::getFirstElement(memory::Accessor const & _anAccessor) const
-+TreeFragment const * SetNode::getFirstElement() const
- {
-- return implGetFragmentFromList(_anAccessor, this->elements);
-+ return implGetFragmentFromList(this->elements);
- }
- //-----------------------------------------------------------------------------
-
--TreeFragment const * SetNode::getNextElement(memory::Accessor const & _anAccessor, TreeFragment const * _pElement) const
-+TreeFragment const * SetNode::getNextElement(TreeFragment const * _pElement) const
- {
- OSL_PRECOND(_pElement, "getNextElement: previous element must not be NULL");
-- OSL_PRECOND(_pElement->header.parent == _anAccessor.address(this).value(),
-+ OSL_PRECOND(_pElement->header.parent == (Node *)this,
- "getNextElement: not an element of this node");
-
-- return implGetFragmentFromList(_anAccessor, _pElement->header.next);
-+ return implGetFragmentFromList(_pElement->header.next);
- }
- //-----------------------------------------------------------------------------
-
-@@ -353,7 +340,7 @@ bool ValueNode::hasUsableDefault() const
- }
- //-----------------------------------------------------------------------------
-
--uno::Type ValueNode::getValueType() const
-+uno::Type ValueNode::getValueType() const
- {
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
-
-@@ -361,36 +348,36 @@ uno::Type ValueNode::getValueType() c
- }
- //-----------------------------------------------------------------------------
-
--uno::Any ValueNode::getValue(memory::Accessor const & _aAccessor) const
-+uno::Any ValueNode::getValue() const
- {
- if (info.flags & Flags::defaulted)
-- return getDefaultValue(_aAccessor);
-+ return getDefaultValue();
-
- else
-- return getUserValue(_aAccessor);
-+ return getUserValue();
- }
- //-----------------------------------------------------------------------------
-
--uno::Any ValueNode::getUserValue(memory::Accessor const & _aAccessor) const
-+uno::Any ValueNode::getUserValue() const
- {
- if (info.flags & Flags::valueAvailable)
- {
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
-
-- return readData(_aAccessor,aType,this->value);
-+ return readData(aType,this->value);
- }
- else
- return uno::Any();
- }
- //-----------------------------------------------------------------------------
-
--uno::Any ValueNode::getDefaultValue(memory::Accessor const & _aAccessor) const
-+uno::Any ValueNode::getDefaultValue() const
- {
- if (info.flags & Flags::defaultAvailable)
- {
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
-
-- return readData(_aAccessor,aType,this->defaultValue);
-+ return readData(aType,this->defaultValue);
- }
- else
- return uno::Any();
-Index: configmgr/source/tree/nodeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/nodeaccess.cxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 nodeaccess.cxx
---- configmgr/source/tree/nodeaccess.cxx 16 Sep 2006 15:21:45 -0000 1.4
-+++ configmgr/source/tree/nodeaccess.cxx 5 Jan 2007 22:25:44 -0000
-@@ -66,13 +66,7 @@ namespace configmgr
- // -----------------------------------------------------------------------------
- namespace data
- {
-- // -------------------------------------------------------------------------
--
-- NodeAddress::DataType* NodeAccess::access(NodeAddressType const& _aNodeRef, memory::UpdateAccessor& _rUpdateAccess)
-- {
-- return static_cast<NodeAddress::DataType*>(_rUpdateAccess.access(_aNodeRef.m_pData));
-- }
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
-
- NodeAccess getSubnode(NodeAccessRef const & _aParent, NodeAccess::Name const & _aName)
- {
-@@ -92,62 +86,28 @@ namespace configmgr
- return NodeAccess::emptyNode();
- }
- }
-- // -------------------------------------------------------------------------
--
-- NodeAddress getSubnodeAddress(memory::Accessor const& _aAccess, NodeAddress const & _aNodeAddress, NodeAccess::Name const & _aName)
-- {
-- return getSubnode( NodeAccessRef(&_aAccess,_aNodeAddress), _aName ).address();
-- }
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
-
- NodeAddress getSubnodeAddress(memory::UpdateAccessor& _aAccess, NodeAddress const & _aNodeAddress, NodeAccess::Name const & _aName)
- {
- memory::Accessor aAccess = _aAccess.accessor();
-- return getSubnode( NodeAccessRef(&aAccess,_aNodeAddress), _aName ).address();
-+ return getSubnode( NodeAccessRef(&aAccess,_aNodeAddress), _aName );
- }
-- // -------------------------------------------------------------------------
--
-- SetNodeAddress toSetNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr)
-- {
-- SetNodeAccess aNodeAccess( NodeAccessRef(&_aAccess,_aNodeAddr) );
-- return aNodeAccess.address();
-- }
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
-
- SetNodeAddress toSetNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr)
- {
- SetNodeAccess aNodeAccess( NodeAccess(_aAccess.accessor(),_aNodeAddr) );
-- return aNodeAccess.address();
-+ return aNodeAccess;
- }
-- // -------------------------------------------------------------------------
--
-- GroupNodeAddress toGroupNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr)
-- {
-- GroupNodeAccess aNodeAccess( NodeAccess(_aAccess,_aNodeAddr) );
-- return aNodeAccess.address();
-- }
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
-
- GroupNodeAddress toGroupNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr)
- {
- GroupNodeAccess aNodeAccess( NodeAccess(_aAccess.accessor(),_aNodeAddr) );
-- return aNodeAccess.address();
-- }
-- // -------------------------------------------------------------------------
--
-- ValueNodeAddress toValueNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr)
-- {
-- ValueNodeAccess aNodeAccess( NodeAccess(_aAccess,_aNodeAddr) );
-- return aNodeAccess.address();
-- }
-- // -------------------------------------------------------------------------
--
-- ValueNodeAddress toValueNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr)
-- {
-- ValueNodeAccess aNodeAccess( NodeAccess(_aAccess.accessor(),_aNodeAddr) );
-- return aNodeAccess.address();
-+ return aNodeAccess;
- }
-- // -------------------------------------------------------------------------
-+ // -------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
- } // namespace configmgr
-Index: configmgr/source/tree/nodevisitor.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/nodevisitor.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 nodevisitor.cxx
---- configmgr/source/tree/nodevisitor.cxx 16 Sep 2006 15:22:12 -0000 1.6
-+++ configmgr/source/tree/nodevisitor.cxx 5 Jan 2007 22:25:44 -0000
-@@ -108,7 +108,7 @@ typedef NodeVisitor::Result Result;
- void applyToTree(sharable::TreeFragment const & _aElement);
- void applyToElements(sharable::SetNode const & _aNode);
-
-- Result dispatch(sharable::TreeFragment const& _aElement);
-+ Result dispatch(sharable::TreeFragment const & _aElement);
- };
-
- // -------------------------------------------------------------------------
-@@ -138,7 +138,9 @@ typedef NodeVisitor::Result Result;
- inline
- Result SetVisitor::Dispatcher::dispatch(sharable::TreeFragment const& _aElement)
- {
-- return m_target.handle( TreeAccessor(m_accessor, &_aElement) );
-+ return m_target.handle
-+ (TreeAccessor(m_accessor,
-+ (sharable::TreeFragment *)(& _aElement )));
- }
- // -------------------------------------------------------------------------
-
-@@ -169,9 +171,9 @@ typedef NodeVisitor::Result Result;
- void SetVisitor::Dispatcher::applyToElements(sharable::SetNode const & _aNode)
- {
- using sharable::TreeFragment;
-- for (TreeFragment const * pElement = _aNode.getFirstElement(m_accessor);
-+ for (TreeFragment const * pElement = _aNode.getFirstElement();
- pElement != NULL && m_result != NodeVisitor::DONE;
-- pElement = _aNode.getNextElement(m_accessor,pElement) )
-+ pElement = _aNode.getNextElement(pElement) )
- m_result = dispatch(*pElement);
-
- }
-Index: configmgr/source/tree/setnodeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/setnodeaccess.cxx,v
-retrieving revision 1.5.12.1
-diff -u -p -u -r1.5.12.1 setnodeaccess.cxx
---- configmgr/source/tree/setnodeaccess.cxx 3 Nov 2006 11:38:06 -0000 1.5.12.1
-+++ configmgr/source/tree/setnodeaccess.cxx 5 Jan 2007 22:25:44 -0000
-@@ -56,23 +56,12 @@ namespace configmgr
- // -----------------------------------------------------------------------------
- namespace data
- {
-- // -------------------------------------------------------------------------
-- using memory::Pointer;
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
-- Pointer SetNodeAccess::check(Accessor const& _aAccessor, sharable::SetNode const* pInnerNode)
-+ SetNodeAddress SetNodeAccess::check(NodeAccessRef const& _aNode)
- {
-- return _aAccessor.address(pInnerNode);
-- }
-- // -------------------------------------------------------------------------
--
-- Pointer SetNodeAccess::check(NodeAccessRef const& _aNode)
-- {
-- if (sharable::Node const* pNode = _aNode.getDataPtr())
-- return check(_aNode.accessor(),pNode->setData());
--
-+ if (sharable::Node const* pNode = _aNode)
-+ return const_cast<SetNodeAddress>(pNode->setData());
- else
-- return Pointer();
-+ return NULL;
- }
- // -------------------------------------------------------------------------
-
-@@ -80,55 +69,51 @@ namespace configmgr
- {
- using namespace sharable;
- SetNode const & aNode = data();
-- for (TreeFragment const * pElement = aNode.getFirstElement(m_aAccessor);
-- pElement != NULL;
-- pElement = aNode.getNextElement(m_aAccessor, pElement))
-+ for (TreeFragment const * pElement = aNode.getFirstElement();
-+ pElement != NULL;
-+ pElement = aNode.getNextElement(pElement))
- {
- if (pElement->isNamed(_aName.toString()))
-- {
-- TreeAccessor aElementTree(m_aAccessor,pElement);
-- return aElementTree.address();
-- }
-+ return (TreeAddress)pElement;
- }
-- return TreeAddress();
-+ return NULL;
- }
- // -------------------------------------------------------------------------*/
-
-- void SetNodeAccess::addElement(memory::UpdateAccessor & _aAccessor, SetNodeAddress _aSetAddress, ElementAddress _aNewElement)
-+ void SetNodeAccess::addElement(SetNodeAddress _aSetAddress,
-+ ElementAddress _aNewElement)
- {
- using namespace sharable;
-
-- SetNode * pNode = static_cast<SetNode *>( _aAccessor.access( _aSetAddress.m_pData) );
-+ SetNode * pNode = _aSetAddress;
- OSL_ENSURE(pNode, "ERROR: Trying to add an element to a NULL set node");
-
- // To do (?): insert sorted - find location here
-- TreeFragment * pElement = TreeAccessor::access(_aNewElement, _aAccessor);
-+ TreeFragment * pElement = _aNewElement;
- OSL_ENSURE(pElement, "ERROR: Trying to add a NULL element to a set node");
-
- pElement->header.next = pNode->elements;
-- pElement->header.parent = _aSetAddress.m_pData.value();
-+ pElement->header.parent = reinterpret_cast<Node *>(pNode);
-
-- pNode->elements = _aNewElement.addressValue();
-+ pNode->elements = _aNewElement;
- }
- // -------------------------------------------------------------------------*/
-
-- TreeAddress SetNodeAccess::removeElement(memory::UpdateAccessor & _aAccessor, SetNodeAddress _aSetAddress, Name const & _aName)
-+ TreeAddress SetNodeAccess::removeElement(SetNodeAddress _aSetAddress, Name const & _aName)
- {
- using namespace sharable;
-- using memory::Pointer;
-
-- SetNode * pNode = static_cast<SetNode *>( _aAccessor.access( _aSetAddress.m_pData) );
-+ SetNode * pNode = _aSetAddress;
- OSL_ENSURE(pNode, "ERROR: Trying to add an element to a NULL set node");
-
-- TreeAddress aRemoved;
-+ TreeAddress aRemoved = NULL;
-
- List * pLink = & pNode->elements;
-- while( TreeFragment * pElement = static_cast<TreeFragment *>(_aAccessor.access(Pointer(*pLink))) )
-+ while( TreeFragment * pElement = reinterpret_cast<TreeFragment *>(*pLink) )
- {
- if (pElement->isNamed(_aName.toString()))
- {
-- aRemoved = TreeAddress( Pointer(*pLink) );
-- // aRemoved = TreeAccessor(_aReadAccessor,pElement).address();
-+ aRemoved = *pLink;
-
- *pLink = pElement->header.next;
- pElement->header.next = 0;
-@@ -149,7 +134,7 @@ namespace configmgr
-
- bool SetNodeAccess::hasElement(Name const& _aName) const
- {
-- return SetNodeAccess::implGetElement(_aName).is();
-+ return SetNodeAccess::implGetElement(_aName) != NULL;
- }
- // -------------------------------------------------------------------------
-
-Index: configmgr/source/tree/treeaccessor.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/treeaccessor.cxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 treeaccessor.cxx
---- configmgr/source/tree/treeaccessor.cxx 16 Sep 2006 15:22:40 -0000 1.3
-+++ configmgr/source/tree/treeaccessor.cxx 5 Jan 2007 22:25:44 -0000
-@@ -1,87 +1 @@
--/*************************************************************************
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: treeaccessor.cxx,v $
-- *
-- * $Revision$
-- *
-- * last change: $Author$ $Date$
-- *
-- * The Contents of this file are made available subject to
-- * the terms of GNU Lesser General Public License Version 2.1.
-- *
-- *
-- * GNU Lesser General Public License Version 2.1
-- * =============================================
-- * Copyright 2005 by Sun Microsystems, Inc.
-- * 901 San Antonio Road, Palo Alto, CA 94303, USA
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License version 2.1, as published by the Free Software Foundation.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-- * MA 02111-1307 USA
-- *
-- ************************************************************************/
--
--// MARKER(update_precomp.py): autogen include statement, do not remove
--#include "precompiled_configmgr.hxx"
--
--#include "treeaccessor.hxx"
--
--#ifndef CONFIGMGR_UPDATEACCESSOR_HXX
--#include "updateaccessor.hxx"
--#endif
--#ifndef CONFIGMGR_BUILDDATA_HXX
--#include "builddata.hxx"
--#endif
--
--#ifndef _OSL_DIAGNOSE_H_
--#include <osl/diagnose.h>
--#endif
--
--// -----------------------------------------------------------------------------
--
--namespace configmgr
--{
--// -----------------------------------------------------------------------------
-- namespace data
-- {
-- // -------------------------------------------------------------------------
-- TreeAccessor::TreeAccessor()
-- : m_aAccessor(NULL)
-- , m_pBase( memory::Pointer() )
-- {
-- }
--
-- // -------------------------------------------------------------------------
--
-- TreeAddress::DataType* TreeAccessor::access(DataAddressType const& _aTreeRef, memory::UpdateAccessor& _rUpdateAccess)
-- {
-- return static_cast<TreeAddress::DataType*>(_rUpdateAccess.access(_aTreeRef.m_pData));
-- }
-- // -------------------------------------------------------------------------
-- TreeAddress TreeAccessor::copyTree(memory::UpdateAccessor & _aTargetSpace) const
-- {
-- return buildTree(_aTargetSpace, *this);
-- }
-- // -------------------------------------------------------------------------
-- void TreeAccessor::freeTree(memory::UpdateAccessor & _aTargetSpace, TreeAddress _aTree)
-- {
-- destroyTree(_aTargetSpace,_aTree);
-- }
-- // -------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
--} // namespace configmgr
--
--
-+#error Do not compile me
-Index: configmgr/source/tree/treefragment.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/treefragment.cxx,v
-retrieving revision 1.5.12.1
-diff -u -p -u -r1.5.12.1 treefragment.cxx
---- configmgr/source/tree/treefragment.cxx 3 Nov 2006 11:38:18 -0000 1.5.12.1
-+++ configmgr/source/tree/treefragment.cxx 5 Jan 2007 22:25:44 -0000
-@@ -127,6 +127,19 @@ configmgr::node::Attributes TreeFragment
- return aResult;
- }
-
-+TreeFragment *TreeFragment::allocate(sal_uInt32 nFragments)
-+{
-+ sal_uInt32 nSize = sizeof(TreeFragment) + sizeof(Node) * (nFragments-1);
-+ sal_uInt8 *pMem = new sal_uInt8 [nSize];
-+ memset (pMem, 0, nSize);
-+ return reinterpret_cast<TreeFragment *>(pMem);
-+}
-+
-+void TreeFragment::free_shallow(TreeFragment *pFragment )
-+{
-+ delete[] (sal_uInt8 *) pFragment;
-+}
-+
- //-----------------------------------------------------------------------------
- } // namespace sharable
- //-----------------------------------------------------------------------------
-Index: configmgr/source/tree/treesegment.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/treesegment.cxx,v
-retrieving revision 1.5.12.1
-diff -u -p -u -r1.5.12.1 treesegment.cxx
---- configmgr/source/tree/treesegment.cxx 3 Nov 2006 11:38:31 -0000 1.5.12.1
-+++ configmgr/source/tree/treesegment.cxx 5 Jan 2007 22:25:44 -0000
-@@ -72,23 +72,14 @@ namespace configmgr
- namespace data
- {
- // -----------------------------------------------------------------------------
--
--// typedef std::auto_ptr<INode> RawTreeData;
--// typedef configuration::Name Name;
-- using memory::Pointer;
--
--// -----------------------------------------------------------------------------
--// -----------------------------------------------------------------------------
- struct TreeSegment::Impl : salhelper::SimpleReferenceObject
- {
-- Impl() : data( memory::localHeap() ), base() {}
-+ Impl() : data(), base() {}
- ~Impl();
-
- memory::Segment data;
- data::TreeAddress base;
- };
--// -----------------------------------------------------------------------------
--// -----------------------------------------------------------------------------
-
- // -----------------------------------------------------------------------------
- TreeSegment::TreeSegment()
-@@ -148,7 +139,7 @@ TreeAccessor TreeSegment::getTreeAcce
- // -----------------------------------------------------------------------------
- TreeSegment::Impl::~Impl()
- {
-- if (base.is())
-+ if (base != NULL)
- {
- memory::UpdateAccessor aAccess( & this->data );
- destroyTree(aAccess,base);
-@@ -166,7 +157,7 @@ TreeSegment::Impl* TreeSegment::createNe
-
- aNewImpl->base = buildElementTree(aNewAccess,*_aTree,_aTypeName,false); // no defaults for set element trees
-
-- if (!aNewImpl->base.is()) aNewImpl.reset();
-+ if (aNewImpl->base == NULL) aNewImpl.reset();
-
- return aNewImpl.release();
- }
-@@ -182,7 +173,7 @@ TreeSegment::Impl* TreeSegment::createNe
-
- aNewImpl->base = buildTree(aNewAccess,_aTreeName,*_aTree,false); // no defaults for set element trees
-
-- if (!aNewImpl->base.is()) aNewImpl.reset();
-+ if (aNewImpl->base == NULL) aNewImpl.reset();
-
- return aNewImpl.release();
- }
-@@ -199,7 +190,7 @@ TreeSegment::Impl* TreeSegment::createNe
-
- aNewImpl->base = _aTree.copyTree(aNewAccess);
-
-- if (!aNewImpl->base.is()) aNewImpl.reset();
-+ if (aNewImpl->base == NULL) aNewImpl.reset();
-
- return aNewImpl.release();
- }
-@@ -221,7 +212,7 @@ TreeSegment TreeSegment::cloneSegment()
- // -----------------------------------------------------------------------------
- bool TreeSegment::is() const
- {
-- return hasData() && m_pImpl->base.is();
-+ return hasData() && m_pImpl->base != NULL;
- }
-
- // -----------------------------------------------------------------------------
-@@ -266,7 +257,7 @@ void TreeSegment::markRemovable()
- // -----------------------------------------------------------------------------
- TreeAddress TreeSegment::getBaseAddress() const
- {
-- return hasData() ? m_pImpl->base : TreeAddress();
-+ return hasData() ? m_pImpl->base : NULL;
- }
-
- // -----------------------------------------------------------------------------
-@@ -274,7 +265,7 @@ TreeSegment::TreeDataPtr TreeSegment::ge
- {
- if (!is()) return NULL;
-
-- return TreeAccessor::access(m_pImpl->base, this->getAccessor());
-+ return m_pImpl->base;
- }
-
- // -----------------------------------------------------------------------------
-@@ -285,7 +276,7 @@ TreeSegment::TreeDataUpdatePtr TreeSegme
-
- if (!is()) return NULL;
-
-- return TreeAccessor::access(m_pImpl->base,_anUpdater);
-+ return m_pImpl->base;
- }
-
- // -----------------------------------------------------------------------------
-Index: configmgr/source/tree/updatehelper.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/updatehelper.cxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 updatehelper.cxx
---- configmgr/source/tree/updatehelper.cxx 16 Sep 2006 15:24:10 -0000 1.11
-+++ configmgr/source/tree/updatehelper.cxx 5 Jan 2007 22:25:44 -0000
-@@ -455,35 +455,35 @@ void ApplyValueChange::apply(ValueChange
-
- void ApplyUpdate::handle(ValueChange& _rChange)
- {
-- // Change a Value
-- OSL_ENSURE(m_aCurrentNode.is(),"Cannot apply ValueChange without node");
-+ // Change a Value
-+ OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply ValueChange without node");
-
- data::NodeAddress aChildNodeAddr = data::getSubnodeAddress(m_rUpdateAccess, m_aCurrentNode, getChangeNodeName(_rChange));
-- OSL_ENSURE(aChildNodeAddr.is(),"Cannot apply Change: No node to change");
-+ OSL_ENSURE(aChildNodeAddr != NULL,"Cannot apply Change: No node to change");
-
-- data::ValueNodeAddress aValueAddr = data::toValueNodeAddress(m_rUpdateAccess, aChildNodeAddr);
-- OSL_ENSURE(aValueAddr.is(),"Cannot apply ValueChange: Node is not a value");
-+ data::ValueNodeAddress aValueAddr = aChildNodeAddr->valueData();
-+ OSL_ENSURE(aValueAddr != NULL,"Cannot apply ValueChange: Node is not a value");
-
-- if (aValueAddr.is())
-- ApplyValueChange::apply(_rChange,m_rUpdateAccess,aValueAddr);
-+ if (aValueAddr != NULL)
-+ ApplyValueChange::apply(_rChange,m_rUpdateAccess,aValueAddr);
- }
- //--------------------------------------------------------------------------
-
- void ApplyUpdate::handle(SubtreeChange& _rChange)
- {
-- // handle traversion
-- OSL_ENSURE(m_aCurrentNode.is(),"Cannot apply SubtreeChange without node");
-+ // handle traversion
-+ OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply SubtreeChange without node");
-
- data::NodeAddress aChildNodeAddr = data::getSubnodeAddress(m_rUpdateAccess, m_aCurrentNode, getChangeNodeName(_rChange));
-- OSL_ENSURE(aChildNodeAddr.is(),"Cannot apply Change: No node to change");
-+ OSL_ENSURE(aChildNodeAddr != NULL,"Cannot apply Change: No node to change");
-
-- OSL_ENSURE( data::toGroupNodeAddress(m_rUpdateAccess, aChildNodeAddr).is() ||
-- data::toSetNodeAddress(m_rUpdateAccess, aChildNodeAddr).is() ,
-+ OSL_ENSURE( data::toGroupNodeAddress(m_rUpdateAccess, aChildNodeAddr) != NULL ||
-+ data::toSetNodeAddress(m_rUpdateAccess, aChildNodeAddr) != NULL ,
- "Cannot Apply SubtreeChange: Node is not an inner node");
-
-- if (aChildNodeAddr.is())
-+ if (aChildNodeAddr != NULL)
- {
-- data::NodeAccess::access(aChildNodeAddr, m_rUpdateAccess)->node.info.markAsDefault( _rChange.isToDefault() );
-+ aChildNodeAddr->node.info.markAsDefault( _rChange.isToDefault() );
-
- data::NodeAddress aOldNode = m_aCurrentNode;
- m_aCurrentNode = aChildNodeAddr;
-@@ -497,29 +497,29 @@ void ApplyUpdate::handle(SubtreeChange&
-
- void ApplyUpdate::handle(AddNode& _rChange)
- {
-- OSL_ENSURE(m_aCurrentNode.is(),"Cannot apply AddNode without node");
-+ OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply AddNode without node");
-
- data::SetNodeAddress aSetNodeAddr = data::toSetNodeAddress(m_rUpdateAccess, m_aCurrentNode);
-- OSL_ENSURE(aSetNodeAddr.is(),"Cannot apply AddNode: Node is not a set node");
-+ OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply AddNode: Node is not a set node");
-
-- // Add a new element
-- if (aSetNodeAddr.is())
-+ // Add a new element
-+ if (aSetNodeAddr != NULL)
-+ {
-+ if (_rChange.isReplacing())
- {
-- if (_rChange.isReplacing())
-- {
- data::TreeAddress aOldNodeAddr =
-- data::SetNodeAccess::removeElement(m_rUpdateAccess,aSetNodeAddr,getChangeNodeName(_rChange));
-+ data::SetNodeAccess::removeElement(aSetNodeAddr,getChangeNodeName(_rChange));
-
-- OSL_ENSURE(aOldNodeAddr.is(), "ApplyUpdate: AddNode: can't recover node being replaced");
-+ OSL_ENSURE(aOldNodeAddr != NULL, "ApplyUpdate: AddNode: can't recover node being replaced");
-
- data::TreeAccessor aOldNodeAccess(m_rUpdateAccess.accessor(),aOldNodeAddr);
- _rChange.takeReplacedTree( data::TreeSegment::createNew(aOldNodeAccess) );
- }
-
- data::TreeAddress aNewAddress = data::buildTree(m_rUpdateAccess, _rChange.getNewTree().getTreeAccess());
-- OSL_ENSURE(aNewAddress.is(), "ApplyUpdate: AddNode: could not create new element");
-+ OSL_ENSURE(aNewAddress != NULL, "ApplyUpdate: AddNode: could not create new element");
-
-- data::SetNodeAccess::addElement(m_rUpdateAccess,aSetNodeAddr,aNewAddress);
-+ data::SetNodeAccess::addElement(aSetNodeAddr,aNewAddress);
-
- _rChange.setInsertedAddress( aNewAddress );
- }
-@@ -528,18 +528,18 @@ void ApplyUpdate::handle(AddNode& _rChan
-
- void ApplyUpdate::handle(RemoveNode& _rChange)
- {
-- OSL_ENSURE(m_aCurrentNode.is(),"Cannot apply RemoveNode without node");
-+ OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply RemoveNode without node");
-
- data::SetNodeAddress aSetNodeAddr = data::toSetNodeAddress(m_rUpdateAccess, m_aCurrentNode);
-- OSL_ENSURE(aSetNodeAddr.is(),"Cannot apply RemoveNode: Node is not a set node");
-+ OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply RemoveNode: Node is not a set node");
-
-- // Remove an element
-- if (aSetNodeAddr.is())
-- {
-+ // Remove an element
-+ if (aSetNodeAddr != NULL)
-+ {
- data::TreeAddress aOldNodeAddr =
-- data::SetNodeAccess::removeElement(m_rUpdateAccess,aSetNodeAddr,getChangeNodeName(_rChange));
-+ data::SetNodeAccess::removeElement(aSetNodeAddr,getChangeNodeName(_rChange));
-
-- OSL_ENSURE(aOldNodeAddr.is(), "ApplyUpdate: Remove: can't recover node being removed");
-+ OSL_ENSURE(aOldNodeAddr != NULL, "ApplyUpdate: Remove: can't recover node being removed");
-
- data::TreeAccessor aOldNodeAccess(m_rUpdateAccess.accessor(),aOldNodeAddr);
- _rChange.takeRemovedTree( data::TreeSegment::createNew(aOldNodeAccess) );
-Index: configmgr/source/tree/valuenodeaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/tree/valuenodeaccess.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 valuenodeaccess.cxx
---- configmgr/source/tree/valuenodeaccess.cxx 16 Sep 2006 15:24:22 -0000 1.6
-+++ configmgr/source/tree/valuenodeaccess.cxx 5 Jan 2007 22:25:44 -0000
-@@ -53,30 +53,20 @@ namespace configmgr
- // -----------------------------------------------------------------------------
- namespace data
- {
-- // -------------------------------------------------------------------------
-- using memory::Pointer;
-- // -------------------------------------------------------------------------
-- static
-- ValueNodeAddress::DataType* accessValue(Pointer const& _p, memory::UpdateAccessor& _rUpdateAccess)
-+ ValueNodeAddress ValueNodeAccess::check(NodeAccessRef const& _aNode)
- {
-- return static_cast<ValueNodeAddress::DataType*>( _rUpdateAccess.validate(_p) );
-- }
-- // -------------------------------------------------------------------------
-- // -------------------------------------------------------------------------
--
-- Pointer ValueNodeAccess::check(NodeAccessRef const& _aNode)
-- {
-- if (sharable::Node const* pNode = _aNode.getDataPtr())
-- return _aNode.accessor().address(pNode->valueData());
--
-+ if (sharable::Node const* pNode = _aNode)
-+ return const_cast<ValueNodeAddress>(pNode->valueData());
- else
-- return Pointer();
-+ return NULL;
- }
- // -------------------------------------------------------------------------
-
--void ValueNodeAccess::setValue(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue)
-+void ValueNodeAccess::setValue(memory::UpdateAccessor &,
-+ ValueNodeAddress _aValueNode,
-+ uno::Any const& _aValue)
- {
-- sharable::ValueNode * node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
-@@ -86,8 +76,8 @@ void ValueNodeAccess::setValue(memory::U
- {
- OSL_ASSERT(aType != Type::value_any);
-
-- freeData(_aUpdater.allocator(),aType,node->value);
-- node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ freeData(aType,node->value);
-+ node = _aValueNode;
-
- node->value.data = 0;
- node->info.flags ^= Flags::valueAvailable;
-@@ -114,8 +104,8 @@ void ValueNodeAccess::setValue(memory::U
- if (aType == aNewType)
- {
- // store the data
-- sharable::AnyData aNewData = allocData(_aUpdater.allocator(),aType,_aValue);
-- node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ sharable::AnyData aNewData = allocData(aType,_aValue);
-+ node = _aValueNode;
-
- node->value = aNewData;
- node->info.flags |= Flags::valueAvailable;
-@@ -125,9 +115,10 @@ void ValueNodeAccess::setValue(memory::U
- }
- //-----------------------------------------------------------------------------
-
--void ValueNodeAccess::setToDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode)
-+void ValueNodeAccess::setToDefault(memory::UpdateAccessor &,
-+ ValueNodeAddress _aValueNode)
- {
-- sharable::ValueNode * node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- OSL_ENSURE(node->hasUsableDefault(), "ERROR: setToDefault() - Value does not have a default");
-@@ -138,8 +129,8 @@ void ValueNodeAccess::setToDefault(memor
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
- OSL_ASSERT(aType != Type::value_any);
-
-- freeData(_aUpdater.allocator(),aType,node->value);
-- node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ freeData(aType,node->value);
-+ node = _aValueNode;
-
- node->value.data = 0;
- node->info.flags ^= Flags::valueAvailable;
-@@ -149,9 +140,11 @@ void ValueNodeAccess::setToDefault(memor
- }
- //-----------------------------------------------------------------------------
-
--void ValueNodeAccess::changeDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue)
-+void ValueNodeAccess::changeDefault(memory::UpdateAccessor &,
-+ ValueNodeAddress _aValueNode,
-+ uno::Any const& _aValue)
- {
-- sharable::ValueNode * node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
-@@ -161,8 +154,8 @@ void ValueNodeAccess::changeDefault(memo
- {
- OSL_ASSERT(aType != Type::value_any);
-
-- freeData(_aUpdater.allocator(),aType,node->defaultValue);
-- node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ freeData(aType,node->defaultValue);
-+ node = _aValueNode;
-
- node->defaultValue.data = 0;
- node->info.flags ^= Flags::defaultAvailable;
-@@ -189,8 +182,8 @@ void ValueNodeAccess::changeDefault(memo
- if (aType == aNewType)
- {
- // store the data
-- sharable::AnyData aNewData = allocData(_aUpdater.allocator(),aType,_aValue);
-- node = accessValue(_aValueNode.m_pData,_aUpdater);
-+ sharable::AnyData aNewData = allocData(aType,_aValue);
-+ node = _aValueNode;
-
- node->defaultValue = aNewData;
- node->info.flags |= Flags::defaultAvailable;
-@@ -198,32 +191,7 @@ void ValueNodeAccess::changeDefault(memo
- }
- }
-
--//-----------------------------------------------------------------------------
--/*
--void ValueNode::clearData(data::Allocator const & _aAlloc)
--{
-- AnyData::TypeCode aType = info.type & Type::mask_valuetype;
--
-- if (info.flags & Flags::valueAvailable)
-- {
-- OSL_ASSERT(aType != Type::value_any);
-- freeData(_aAlloc,aType,this->value);
-- info.flags ^= Flags::valueAvailable;
-- this->value.data = 0;
-- }
--
-- if (info.flags & Flags::defaultAvailable)
-- {
-- OSL_ASSERT(aType != Type::value_any);
-- freeData(_aAlloc,aType,this->defaultValue);
-- info.flags ^= Flags::defaultAvailable;
-- this->defaultValue.data = 0;
-- }
--}
--*/
--//-----------------------------------------------------------------------------
-- }
--// -----------------------------------------------------------------------------
-+ } // namespace data
- } // namespace configmgr
-
-
-Index: configmgr/source/treecache/cacheaccess.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cacheaccess.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 cacheaccess.cxx
---- configmgr/source/treecache/cacheaccess.cxx 16 Sep 2006 15:24:36 -0000 1.9
-+++ configmgr/source/treecache/cacheaccess.cxx 5 Jan 2007 22:25:44 -0000
-@@ -41,9 +41,6 @@
- #ifndef CONFIGMGR_ACCESSOR_HXX
- #include "accessor.hxx"
- #endif
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#include "nodeaddress.hxx"
--#endif
- #ifndef CONFIGMGR_NODEACCESS_HXX
- #include "nodeaccess.hxx"
- #endif
-@@ -62,10 +59,8 @@ namespace configmgr
-
- // -------------------------------------------------------------------------
-
--CacheClientAccess::CacheClientAccess(memory::HeapManager & _rHeapManager,
-- ConfigChangeBroadcastHelper * _pBroadcastHelper)
-+CacheClientAccess::CacheClientAccess(ConfigChangeBroadcastHelper * _pBroadcastHelper)
- : m_aMutex()
--, m_aData(_rHeapManager)
- , m_pBroadcastHelper( _pBroadcastHelper )
- {
- }
-@@ -87,7 +82,7 @@ ConfigChangeBroadcastHelper * CacheClie
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path - creates if necessary
--memory::Segment * CacheLoadingAccess::createNewDataSegment(ModuleName const & _aModule)
-+memory::Segment * CacheLoadingAccess::createNewDataSegment(CacheLine::Name const & _aModule)
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-@@ -96,24 +91,24 @@ memory::Segment * CacheLoadingAccess::cr
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path - creates if necessary
--memory::Segment * CacheClientAccess::attachDataSegment(const memory::SegmentAddress & _aSegment, const Path& _aLocation)
-+memory::Segment * CacheClientAccess::attachDataSegment(data::TreeAddress _aSegment, const CacheLine::Path& _aLocation)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
- return this->m_aData.attachDataSegment(_aSegment,_aLocation.getModuleName());
- }
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path if exists
--memory::Segment * CacheClientAccess::getDataSegment(const Path& _aLocation)
-+memory::Segment * CacheClientAccess::getDataSegment(const CacheLine::Path& _aLocation)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
- return this->m_aData.getDataSegment(_aLocation.getModuleName());
- }
- // -------------------------------------------------------------------------
-
--bool CacheClientAccess::hasModule(const Path& _aLocation)
-+bool CacheClientAccess::hasModule(const CacheLine::Path& _aLocation)
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-@@ -121,7 +116,7 @@ bool CacheClientAccess::hasModule(const
- }
- // -------------------------------------------------------------------------
-
--bool CacheClientAccess::hasModuleDefaults(memory::Accessor const& _aAccessor, Path const& _aLocation)
-+bool CacheClientAccess::hasModuleDefaults(memory::Accessor const& _aAccessor, CacheLine::Path const& _aLocation)
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-@@ -129,7 +124,7 @@ bool CacheClientAccess::hasModuleDefault
- }
- // -------------------------------------------------------------------------
-
--data::NodeAddress CacheClientAccess::acquireNode(memory::Accessor const& _aAccessor, Path const& rLocation )
-+data::NodeAddress CacheClientAccess::acquireNode(memory::Accessor const& _aAccessor, CacheLine::Path const& rLocation )
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-@@ -137,7 +132,7 @@ data::NodeAddress CacheClientAccess::acq
-
- data::NodeAddress aResult = this->m_aData.acquireNode(_aAccessor,rLocation);
-
-- if (aResult.is())
-+ if (aResult != NULL)
- {
- CFG_TRACE_INFO_NI("- Data is available - returning Subtree");
- }
-@@ -148,13 +143,13 @@ data::NodeAddress CacheClientAccess::acq
- }
- // -------------------------------------------------------------------------
-
--CacheLine::RefCount CacheClientAccess::releaseNode( Path const& rLocation )
-+oslInterlockedCount CacheClientAccess::releaseNode( CacheLine::Path const& rLocation )
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
- CFG_TRACE_INFO("Tree Info: Releasing subtree data for path '%s'", OUSTRING2ASCII(rLocation.toString()) );
-
-- Module::RefCount nRet = this->m_aData.releaseModule(rLocation.getModuleName(),false);
-+ oslInterlockedCount nRet = this->m_aData.releaseModule(rLocation.getModuleName(),false);
-
- return nRet;
- }
-@@ -170,13 +165,13 @@ void CacheClientAccess::applyUpdate(memo
- }
-
- // -----------------------------------------------------------------------------
--data::NodeAddress CacheClientAccess::findInnerNode( data::Accessor const& _aAccess, Path const& aComponentName )
-+data::NodeAddress CacheClientAccess::findInnerNode( memory::Accessor const& _aAccess, CacheLine::Path const& aComponentName )
- {
-- osl::MutexGuard aGuard( this->m_aMutex ); // needed to protect the map access in the Tree
-+ osl::MutexGuard aGuard( this->m_aMutex ); // needed to protect the map access in the Tree
-
- data::NodeAddress aNode = this->m_aData.getNode(_aAccess, aComponentName);
-
-- if (aNode.is() && data::NodeAccessRef(&_aAccess,aNode).data().isValue() )
-+ if (aNode != NULL && data::NodeAccessRef(&_aAccess,aNode).data().isValue() )
- aNode = data::NodeAddress();
-
- return aNode;
-@@ -199,7 +194,7 @@ bool CacheClientAccess::isEmpty()
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-- Data::ModuleList& rModules = this->m_aData.accessModuleList();
-+ CacheData::ModuleList& rModules = this->m_aData.accessModuleList();
-
- bool bRet = rModules.empty();
-
-@@ -210,9 +205,8 @@ bool CacheClientAccess::isEmpty()
- // -------------------------------------------------------------------------
- // -------------------------------------------------------------------------
-
--CacheLoadingAccess::CacheLoadingAccess(memory::HeapManager & _rHeapManager)
-+CacheLoadingAccess::CacheLoadingAccess()
- : m_aMutex()
--, m_aData(_rHeapManager)
- , m_aDeadModules()
- {
- }
-@@ -224,67 +218,67 @@ CacheLoadingAccess::~CacheLoadingAccess(
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path - creates if necessary
--memory::Segment * CacheLoadingAccess::attachDataSegment(const memory::SegmentAddress & _aSegment, ModuleName const & _aModule)
-+memory::Segment * CacheLoadingAccess::attachDataSegment(data::TreeAddress _aSegment, CacheLine::Name const & _aModule)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
- return this->m_aData.attachDataSegment(_aSegment,_aModule);
- }
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path if exists
--memory::Segment * CacheLoadingAccess::getDataSegment(ModuleName const & _aModule)
-+memory::Segment * CacheLoadingAccess::getDataSegment(CacheLine::Name const & _aModule)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
- return this->m_aData.getDataSegment(_aModule);
- }
- // -------------------------------------------------------------------------
-
--/// gets a data segment reference for the given path if exists
--memory::SegmentAddress CacheLoadingAccess::getDataSegmentAddress(ModuleName const & _aModule)
-+/// gets a tree reference for the given path if exists
-+data::TreeAddress CacheLoadingAccess::getTreeAddress(CacheLine::Name const & _aModule)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
-- return this->m_aData.getDataSegmentAddress(_aModule);
-+ return this->m_aData.getTreeAddress(_aModule);
- }
- // -------------------------------------------------------------------------
-
--bool CacheLoadingAccess::hasModule(ModuleName const & _aModule)
-+bool CacheLoadingAccess::hasModule(CacheLine::Name const & _aModule)
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
- return this->m_aData.hasModule(_aModule);
- }
- // -------------------------------------------------------------------------
-
--data::TreeAddress CacheLoadingAccess::acquireModule(ModuleName const & _aModule )
-+bool CacheLoadingAccess::acquireModule(CacheLine::Name const & _aModule )
- {
-- osl::MutexGuard aGuard( this->m_aMutex );
--
-- CFG_TRACE_INFO("Tree Info: Requesting data for module '%s'", OUSTRING2ASCII(_aModule.toString()) );
-+ osl::MutexGuard aGuard( this->m_aMutex );
-
-- data::TreeAddress aResult = this->m_aData.acquireModule(_aModule);
-+ CFG_TRACE_INFO("Tree Info: Requesting data for module '%s'", OUSTRING2ASCII(_aModule.toString()) );
-
-- if (aResult.is())
-- {
-- m_aDeadModules.erase( _aModule );
-- CFG_TRACE_INFO_NI("- Data is available - returning Subtree");
-- }
-- else
-- CFG_TRACE_INFO_NI("- Data is not available - returning NULL");
--
-- return aResult;
-+ if (this->m_aData.acquireModule(_aModule))
-+ {
-+ m_aDeadModules.erase( _aModule );
-+ CFG_TRACE_INFO_NI("- Data is available - returning Subtree");
-+ return true;
-+ }
-+ else
-+ {
-+ CFG_TRACE_INFO_NI("- Data is not available - returning NULL");
-+ return false;
-+ }
- }
- // -------------------------------------------------------------------------
-
--CacheLine::RefCount CacheLoadingAccess::releaseModule( ModuleName const & _aModule )
-+oslInterlockedCount CacheLoadingAccess::releaseModule( CacheLine::Name const & _aModule )
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
- CFG_TRACE_INFO("Tree Info: Releasing data for module '%s'", OUSTRING2ASCII(_aModule.toString()) );
-
-- Module::RefCount nRet = this->m_aData.releaseModule(_aModule,true); // keep
-+ oslInterlockedCount nRet = this->m_aData.releaseModule(_aModule,true); // keep
- if (nRet == 0)
- {
- m_aDeadModules[ _aModule ] = TimeStamp::getCurrentTime();
-@@ -305,7 +299,7 @@ void CacheLoadingAccess::applyUpdate(mem
- }
-
- // -----------------------------------------------------------------------------
--data::NodeAddress CacheLoadingAccess::findNode( data::Accessor const& _aAccess, Path const& aComponentName )
-+data::NodeAddress CacheLoadingAccess::findNode( memory::Accessor const& _aAccess, CacheLine::Path const& aComponentName )
- {
- osl::MutexGuard aGuard( this->m_aMutex ); // needed to protect the map access in the Tree
-
-@@ -320,7 +314,7 @@ bool CacheLoadingAccess::isEmpty()
- {
- osl::MutexGuard aGuard( this->m_aMutex );
-
-- Data::ModuleList& rModules = this->m_aData.accessModuleList();
-+ ExtendedCacheData::ModuleList& rModules = this->m_aData.accessModuleList();
-
- bool bRet = rModules.empty();
-
-@@ -342,7 +336,7 @@ data::TreeAddress CacheLoadingAccess::ad
- _bIncludesDefaults ? "Data includes defaults." : "Data does not include defaults." );
-
- data::TreeAddress aResult = this->m_aData.addComponentData(_aAccessToken, _aComponentInstance, _bIncludesDefaults);
-- if (aResult.is())
-+ if (aResult != NULL)
- {
- m_aDeadModules.erase( _aComponentInstance.component() );
- CFG_TRACE_INFO_NI("- Data added successfully - returning Subtree");
-@@ -366,7 +360,7 @@ void CacheLoadingAccess::addChangesToPen
- }
-
- // -----------------------------------------------------------------------------
--std::auto_ptr<SubtreeChange> CacheLoadingAccess::releasePendingChanges(ModuleName const& _aComponentName)
-+std::auto_ptr<SubtreeChange> CacheLoadingAccess::releasePendingChanges(CacheLine::Name const& _aComponentName)
- {
- osl::MutexGuard aGuard( this->m_aMutex ); // needed to protect the map access in the Data
- CFG_TRACE_INFO("Tree Info: extract pending changes from subtree '%s'", OUSTRING2ASCII(_aComponentName.toString()) );
-@@ -374,7 +368,7 @@ std::auto_ptr<SubtreeChange> CacheLoadin
- }
-
- // -----------------------------------------------------------------------------
--bool CacheLoadingAccess::findPendingChangedModules( Data::PendingModuleList & _rPendingList )
-+bool CacheLoadingAccess::findPendingChangedModules( ExtendedCacheData::PendingModuleList & _rPendingList )
- {
- osl::MutexGuard aGuard( this->m_aMutex ); // needed to protect the map access in the Data
- this->m_aData.findPendingModules(_rPendingList);
-@@ -388,7 +382,7 @@ void CacheLoadingAccess::clearData(Dispo
-
- CFG_TRACE_INFO("Tree Info: Removing all module trees for cleanup" );
-
-- typedef Data::ModuleList ModuleList;
-+ typedef ExtendedCacheData::ModuleList ModuleList;
-
- ModuleList& rModules = this->m_aData.accessModuleList();
-
-@@ -413,7 +407,7 @@ TimeStamp CacheLoadingAccess::collectDis
-
- CFG_TRACE_INFO("Tree Info: Collecting disposable module trees for cleanup" );
-
-- Data::ModuleList& rActiveModules = this->m_aData.accessModuleList();
-+ ExtendedCacheData::ModuleList& rActiveModules = this->m_aData.accessModuleList();
-
- DeadModuleList::iterator it = m_aDeadModules.begin();
-
-@@ -429,11 +423,11 @@ TimeStamp CacheLoadingAccess::collectDis
- TimeStamp aExpireTime = current->second + _aDelay;
- if (aExpireTime <= _aLimitTime)
- {
-- Data::ModuleList::iterator itModule = rActiveModules.find( current->first );
-+ ExtendedCacheData::ModuleList::iterator itModule = rActiveModules.find( current->first );
-
- if (itModule != rActiveModules.end())
- {
-- ModuleRef xModule = itModule->second;
-+ CacheLineRef xModule = itModule->second;
-
- bool bHandled = false;
-
-Index: configmgr/source/treecache/cacheaccess.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cacheaccess.hxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 cacheaccess.hxx
---- configmgr/source/treecache/cacheaccess.hxx 8 Sep 2005 04:21:46 -0000 1.6
-+++ configmgr/source/treecache/cacheaccess.hxx 5 Jan 2007 22:25:44 -0000
-@@ -69,21 +69,14 @@ namespace configmgr
-
- class CacheClientAccess : public salhelper::SimpleReferenceObject, Noncopyable
- {
-- public:
-- typedef CacheData Data;
-- typedef Data::Module Module;
-- typedef Data::ModuleRef ModuleRef;
-- typedef Data::ModuleName ModuleName;
-- typedef Data::Path Path;
- private:
-- osl::Mutex m_aMutex;
-- Data m_aData;
-+ osl::Mutex m_aMutex;
-+ CacheData m_aData;
-
- ConfigChangeBroadcastHelper* m_pBroadcastHelper;
- public:
- explicit
-- CacheClientAccess(memory::HeapManager & _rHeapManager,
-- ConfigChangeBroadcastHelper* _pBroadcastHelper);
-+ CacheClientAccess(ConfigChangeBroadcastHelper* _pBroadcastHelper);
-
- ~CacheClientAccess();
-
-@@ -95,20 +88,20 @@ namespace configmgr
- ConfigChangeBroadcastHelper * releaseBroadcaster();
-
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * attachDataSegment(const memory::SegmentAddress & _aSegment, const Path& _aLocation);
-+ memory::Segment * attachDataSegment(data::TreeAddress _aSegment, const CacheLine::Path& _aLocation);
- /// gets a data segment reference for the given path if exists
-- memory::Segment * getDataSegment(const Path& _aLocation);
-+ memory::Segment * getDataSegment(const CacheLine::Path& _aLocation);
-
- /// return TRUE if there is no data (left) in this object's cache data
- bool isEmpty();
-
- /// check if the given module exists already (and is not empty)
-- bool hasModule(const Path& _aLocation);
-+ bool hasModule(const CacheLine::Path& _aLocation);
- /// checks if the given module exists and has defaults available
-- bool hasModuleDefaults(memory::Accessor const & _aAccessor, Path const & _aLocation);
-+ bool hasModuleDefaults(memory::Accessor const & _aAccessor, CacheLine::Path const & _aLocation);
-
- /// retrieve the subtree at _aPath (maybe if it has the requested defaults) and clientAcquire() it
-- data::NodeAddress acquireNode(memory::Accessor const& _aAccessToken, Path const& _aPath);
-+ data::NodeAddress acquireNode(memory::Accessor const& _aAccessToken, CacheLine::Path const& _aPath);
-
- /** add or merge the given subtree at the given location,
- return <TRUE/> if the tree has defaults then
-@@ -116,10 +109,10 @@ namespace configmgr
- bool insertDefaults(memory::UpdateAccessor& _aUpdateToken, backend::NodeInstance const & _aDefaultData ) CFG_UNO_THROW_RTE( );
-
- /// clientRelease() the tree at aComponentName, and return the resulting reference count
-- CacheLine::RefCount releaseNode( Path const& _aPath );
-+ oslInterlockedCount releaseNode( CacheLine::Path const& _aPath );
-
- /// retrieve the given subtree without changing its ref count
-- data::NodeAddress findInnerNode(memory::Accessor const& _aAccessToken, Path const& _aPath );
-+ data::NodeAddress findInnerNode(memory::Accessor const& _aAccessToken, CacheLine::Path const& _aPath );
-
- /// merge the given change list into this tree - reflects old data to _aUpdate
- void applyUpdate(memory::UpdateAccessor& _aUpdateToken, backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( );
-@@ -130,50 +123,44 @@ namespace configmgr
-
- class CacheLoadingAccess : public salhelper::SimpleReferenceObject, Noncopyable
- {
-- public:
-- typedef ExtendedCacheData Data;
-- typedef Data::Module Module;
-- typedef Data::ModuleRef ModuleRef;
-- typedef Data::ModuleName ModuleName;
-- typedef Data::Path Path;
--
-- typedef std::vector< ModuleRef > DisposeList;
-+ public:
-+ typedef std::vector< CacheLineRef > DisposeList;
- friend class backend::CacheController;
- private:
- friend class CacheDisposeScheduler;
-- typedef std::map< ModuleName, TimeStamp > DeadModuleList;
-+ typedef std::map< CacheLine::Name, TimeStamp > DeadModuleList;
-
- osl::Mutex m_aMutex;
-- Data m_aData;
-+ ExtendedCacheData m_aData;
- DeadModuleList m_aDeadModules; /// list of nodes which are registered for throwing away
- public:
- explicit
-- CacheLoadingAccess(memory::HeapManager & _rHeapManager);
-+ CacheLoadingAccess();
- ~CacheLoadingAccess();
-
- /// gets a data segment reference for the given path if exists
-- memory::Segment * createNewDataSegment(ModuleName const & _aModule);
-+ memory::Segment * createNewDataSegment(CacheLine::Name const & _aModule);
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * attachDataSegment(const memory::SegmentAddress & _aSegment, ModuleName const & _aModule);
-+ memory::Segment * attachDataSegment(data::TreeAddress _aSegment, CacheLine::Name const & _aModule);
- /// gets a data segment reference for the given path if exists
-- memory::Segment * getDataSegment(ModuleName const & _aModule);
-- /// gets a data segment address for the given module if it exists
-- memory::SegmentAddress getDataSegmentAddress(ModuleName const & _aModule);
-+ memory::Segment * getDataSegment(CacheLine::Name const & _aModule);
-+ /// gets a tree address for the given module if it exists
-+ data::TreeAddress getTreeAddress(CacheLine::Name const & _aModule);
-
- /// return TRUE if there is no data (left) in this object's cache data
- bool isEmpty();
-
- /// check if the given module exists already (and is not empty)
-- bool hasModule(ModuleName const & _aLocation);
-+ bool hasModule(CacheLine::Name const & _aLocation);
-
-- /// retrieve the subtree at aComponentName and clientAcquire() it
-- data::TreeAddress acquireModule(ModuleName const & _aModule);
-+ /// retrieve the subtree at aComponentName and clientAcquire() it, true if succeeded
-+ bool acquireModule(CacheLine::Name const & _aModule);
-
- /// clientRelease() the tree at aComponentName, and return the resulting reference count
-- CacheLine::RefCount releaseModule( ModuleName const & _aModule );
-+ oslInterlockedCount releaseModule( CacheLine::Name const & _aModule );
-
- /// retrieve the given subtree without changing its ref count
-- data::NodeAddress findNode(memory::Accessor const& _aAccessToken, Path const& _aPath );
-+ data::NodeAddress findNode(memory::Accessor const& _aAccessToken, CacheLine::Path const& _aPath );
-
- /// merge the given change list into this tree - reflects old data to _aUpdate
- void applyUpdate(memory::UpdateAccessor& _aUpdateToken, backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( );
-@@ -198,10 +185,10 @@ namespace configmgr
- /// merge the given change list into the pending change list of this tree
- void addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) CFG_UNO_THROW_RTE( );
- /// retrieve accumulated pending changes
-- std::auto_ptr<SubtreeChange> releasePendingChanges(ModuleName const& _aModule);
-+ std::auto_ptr<SubtreeChange> releasePendingChanges(CacheLine::Name const& _aModule);
-
- /// find the modules having pending changes
-- bool findPendingChangedModules( Data::PendingModuleList & _rPendingList );
-+ bool findPendingChangedModules( ExtendedCacheData::PendingModuleList & _rPendingList );
-
- /// get a local lock for this cache line
- osl::Mutex & mutex() { return m_aMutex; }
-Index: configmgr/source/treecache/cachecontroller.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachecontroller.cxx,v
-retrieving revision 1.18
-diff -u -p -u -r1.18 cachecontroller.cxx
---- configmgr/source/treecache/cachecontroller.cxx 16 Sep 2006 15:24:50 -0000 1.18
-+++ configmgr/source/treecache/cachecontroller.cxx 5 Jan 2007 22:25:44 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -51,9 +52,6 @@
- #ifndef CONFIGMGR_UPDATEACCESSOR_HXX
- #include "updateaccessor.hxx"
- #endif
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
--#endif
- #ifndef CONFIGMGR_TREEACCESSOR_HXX
- #include "treeaccessor.hxx"
- #endif
-@@ -142,43 +140,37 @@ OCacheWriteScheduler* CacheController::c
-
- CacheController::CacheRef CacheController::getCacheAlways(RequestOptions const & _aOptions)
- {
-- osl::MutexGuard aGuard( m_aCacheList.mutex() );
-+ osl::MutexGuard aGuard( m_aCacheMap.mutex() );
-
-- CacheRef aResult = m_aCacheList.get(_aOptions);
-+ CacheRef aResult = m_aCacheMap.get(_aOptions);
- if (!aResult.is())
- {
-- CacheRef aNewCache( new Cache(getCacheHeapManager()) );
-- aResult = m_aCacheList.insert(_aOptions,aNewCache);
-+ CacheRef aNewCache( new Cache() );
-+ aResult = m_aCacheMap.insert(_aOptions,aNewCache);
- }
- return aResult;
- }
-
- // -------------------------------------------------------------------------
-
--memory::HeapManager & CacheController::getCacheHeapManager() const
--{
-- return m_aTemplates.getHeapManager();
--}
--// -------------------------------------------------------------------------
--
- // disposing
- // -------------------------------------------------------------------------
- void CacheController::disposeAll(bool _bFlushRemainingUpdates)
- {
- CFG_TRACE_INFO("CacheController: Disposing all data" );
-- CacheList::Map aReleaseList;
-+ CacheMap::Map aReleaseList;
-
- if (m_pDisposer)
- {
- osl::MutexGuard aShotGuard(m_pDisposer->getShotMutex());
-- osl::MutexGuard aGuard(m_aCacheList.mutex());
-+ osl::MutexGuard aGuard(m_aCacheMap.mutex());
- m_pDisposer->stopAndClearTasks();
-- m_aCacheList.swap(aReleaseList); // move data out of m_aCacheList and empty m_aCacheList
-+ m_aCacheMap.swap(aReleaseList); // move data out of m_aCacheMap and empty m_aCacheMap
- }
-
- if (_bFlushRemainingUpdates)
- {
-- for (CacheList::Map::iterator it = aReleaseList.begin(); it != aReleaseList.end(); ++it)
-+ for (CacheMap::Map::iterator it = aReleaseList.begin(); it != aReleaseList.end(); ++it)
- saveAllPendingChanges(it->second,it->first);
- }
- // free all the trees
-@@ -203,7 +195,7 @@ void CacheController::dispose() CFG_UNO_
- // -------------------------------------------------------------------------
- void CacheController::disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates)
- {
-- osl::ClearableMutexGuard aGuard(m_aCacheList.mutex());
-+ osl::ClearableMutexGuard aGuard(m_aCacheMap.mutex());
-
- CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo for user '%s' with locale '%s'",
- OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) );
-@@ -218,7 +210,7 @@ void CacheController::disposeOne(Request
- CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding.");
- }
-
-- CacheRef aRemoved = m_aCacheList.remove(_aOptions);
-+ CacheRef aRemoved = m_aCacheMap.remove(_aOptions);
-
- if (aRemoved.is())
- {
-@@ -233,7 +225,7 @@ void CacheController::disposeOne(Request
- // -------------------------------------------------------------------------
- void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates)
- {
-- osl::ClearableMutexGuard aGuard(m_aCacheList.mutex());
-+ osl::ClearableMutexGuard aGuard(m_aCacheMap.mutex());
-
- CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo(s) for user '%s'",
- OUSTRING2ASCII(_aUserOptions.getEntity()) );
-@@ -250,14 +242,14 @@ void CacheController::disposeUser(Reques
- // so that all options belonging to one user are together
- // (and that options with only a user set, sort first)
-
-- CacheList::Map aCacheData;
-- m_aCacheList.swap(aCacheData);
-+ CacheMap::Map aCacheData;
-+ m_aCacheMap.swap(aCacheData);
-
- // find the lower_bound of all options for the user
-- CacheList::Map::iterator const aFirst = aCacheData.lower_bound(_aUserOptions);
-+ CacheMap::Map::iterator const aFirst = aCacheData.lower_bound(_aUserOptions);
-
- // find the upper_bound of all options for the user (using the lower one)
-- CacheList::Map::iterator aLast = aFirst;
-+ CacheMap::Map::iterator aLast = aFirst;
- while (aLast != aCacheData.end() && aLast->first.getEntity() == sUser)
- ++aLast;
-
-@@ -267,7 +259,7 @@ void CacheController::disposeUser(Reques
-
- bool bHasPendingChanges = false;
-
-- for (CacheList::Map::iterator it = aFirst; it != aLast; ++it)
-+ for (CacheMap::Map::iterator it = aFirst; it != aLast; ++it)
- {
- CFG_TRACE_INFO_NI("- Found TreeInfo for locale '%s'", OUSTRING2ASCII(it->first.getLocale()) );
- m_pDisposer->clearTasks(it->first);
-@@ -295,7 +287,7 @@ void CacheController::disposeUser(Reques
- CFG_TRACE_INFO_NI("- No affected TreeInfo found" );
-
- // replace the data into the map
-- m_aCacheList.swap(aCacheData);
-+ m_aCacheMap.swap(aCacheData);
- }
-
- // got all out of external reach - now dispose/notify without lock
-@@ -343,12 +335,11 @@ void CacheController::implDisposeOne(Cac
-
- // -------------------------------------------------------------------------
- CacheController::CacheController(BackendRef const & _xBackend,
-- memory::HeapManager & _rCacheHeapManager,
- const uno::Reference<uno::XComponentContext>& xContext)
- : m_aNotifier()
- , m_xBackend(_xBackend)
--, m_aCacheList()
--, m_aTemplates(_rCacheHeapManager)
-+, m_aCacheMap()
-+, m_aTemplates()
- , m_pDisposer()
- , m_pCacheWriter()
- , m_bDisposing(false)
-@@ -406,22 +397,7 @@ std::auto_ptr<ISubtree> reduceSubtreeFor
- return aRet;
- }
- #endif
--// -------------------------------------------------------------------------
--
--static
--CacheLocation makeCacheLocation(memory::SegmentAddress const & _aSegment, memory::Heap::Address const & _anAddress)
--{
-- OSL_PRECOND(!_aSegment.isNull() || _anAddress == 0,"ERROR: Got Non-null address for NULL segment ?!");
-
-- CacheLocation aResult;
--
-- aResult.segment = _aSegment;
-- aResult.address = _anAddress;
--
-- OSL_ASSERT(!_aSegment.isNull() || aResult.isNull());
--
-- return aResult;
--}
- // -------------------------------------------------------------------------
- CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
- {
-@@ -436,7 +412,6 @@ CacheLocation CacheController::loadCompo
-
- osl::MutexGuard aCacheLineGuard(aCache->mutex());
-
-- data::TreeAddress aResultAddress;
- data::TreeAddress aTemplateResultAdddress;
-
- OSL_ENSURE(!_aRequest.isForcingReload(),"CacheController: No support for forced requests");
-@@ -447,7 +422,7 @@ CacheLocation CacheController::loadCompo
- {
- refreshComponent(_aRequest);
- }
-- aResultAddress = aCache->acquireModule(_aRequest.getComponentName());
-+ aCache->acquireModule(_aRequest.getComponentName());
- }
- else
- {
-@@ -459,18 +434,15 @@ CacheLocation CacheController::loadCompo
-
- memory::UpdateAccessor aTargetSpace( aCache->createNewDataSegment(_aRequest.getComponentName()) );
-
-- aResultAddress = aCache->addComponentData(aTargetSpace, aData.instance(), bWithDefaults);
-+ aCache->addComponentData(aTargetSpace, aData.instance(), bWithDefaults);
- if (aData.instance().templateData().get()!=NULL)
-- {
-- aTemplateResultAdddress = addTemplates(aData.mutableInstance().componentTemplateData () );
-- }
-+ aTemplateResultAdddress = addTemplates(aData.mutableInstance().componentTemplateData() );
-+
- // notify the new data to all clients
- m_aNotifier.notifyCreated(_aRequest);
- }
-
-- return makeCacheLocation( aCache->getDataSegmentAddress(_aRequest.getComponentName()),
-- aResultAddress.addressValue());
--
-+ return aCache->getTreeAddress(_aRequest.getComponentName());
- }
- // -------------------------------------------------------------------------
-
-@@ -478,11 +450,10 @@ ComponentResult CacheController::getComp
- bool _bAddListenter ) CFG_UNO_THROW_ALL()
- {
- // TODO: Insert check here, if the data is in the cache already - and then clone
-- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getComponentData()");
-- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "component: %s", RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
-+ RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getComponentData()");
-+ RTL_LOGFILE_CONTEXT_TRACE1(aLog, "component: %s", RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
-
--
-- ComponentResult aRet = this->loadDirectly(_aRequest, _bAddListenter);
-+ ComponentResult aRet = this->loadDirectly(_aRequest, _bAddListenter);
-
- return aRet;
- }
-@@ -491,8 +462,8 @@ ComponentResult CacheController::getComp
- NodeResult CacheController::getDefaultData(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( )
- {
- // TODO: Insert check here, if the data is in the cache already - and then clone
-- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getDefaultData()");
-- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "path: %s", RTL_LOGFILE_OU2A(_aRequest.getPath().toString()) );
-+ RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getDefaultData()");
-+ RTL_LOGFILE_CONTEXT_TRACE1(aLog, "path: %s", RTL_LOGFILE_OU2A(_aRequest.getPath().toString()) );
-
- NodeResult aRet = this->loadDefaultsDirectly(_aRequest);
-
-@@ -514,7 +485,7 @@ AbsolutePath CacheController::encodeTemp
- aResult.prepend(aTemplateModule);
- // aResult.prepend(aTemplateRoot);
-
-- return AbsolutePath(aResult);
-+ return AbsolutePath(aResult);
- }
- // -------------------------------------------------------------------------
- #if 0
-@@ -564,7 +535,7 @@ data::TreeAddress CacheController::addTe
- {
- OSL_PRECOND(_aComponentInstance.data.get(), "addTemplates: Data must not be NULL");
- osl::MutexGuard aGuard(m_aTemplatesMutex);
-- TemplateCacheData::ModuleName aModuleName = _aComponentInstance.name;
-+ CacheLine::Name aModuleName = _aComponentInstance.name;
- memory::UpdateAccessor aTemplatesUpdater( m_aTemplates.createDataSegment(aModuleName) );
- AbsolutePath aTemplateLocation = AbsolutePath::makeModulePath(_aComponentInstance.name , AbsolutePath::NoValidate());
- data::TreeAddress aTemplateAddr;
-@@ -573,7 +544,7 @@ data::TreeAddress CacheController::addTe
- CFG_TRACE_INFO_NI("CacheController: cache miss for that template - loading from backend");
- aTemplateAddr = m_aTemplates.addTemplates(aTemplatesUpdater, _aComponentInstance );
- }
-- OSL_ASSERT (aTemplateAddr.is());
-+ OSL_ASSERT (aTemplateAddr != NULL);
- return aTemplateAddr;
- }
- // -------------------------------------------------------------------------
-@@ -591,7 +562,7 @@ CacheLocation CacheController::loadTempl
-
- AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
-
-- TemplateCacheData::ModuleName aModuleName = aTemplateLocation.getModuleName();
-+ CacheLine::Name aModuleName = aTemplateLocation.getModuleName();
- osl::MutexGuard aGuard(m_aTemplatesMutex);
- memory::Accessor aTemplatesAccessor( m_aTemplates.getDataSegment(aModuleName) );
- AbsolutePath aTemplateParent (aTemplateLocation.getParentPath());
-@@ -609,24 +580,23 @@ CacheLocation CacheController::loadTempl
-
- }
- memory::Accessor aTemplateAccessor( m_aTemplates.getDataSegment(aModuleName) );
-+#warning unwind locking implications here too ... 'getTemplateTree' ...
- data::TreeAddress aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateAccessor,aTemplateLocation);
-- if (aTemplateAddr.isNull())
-- throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
-+ if (aTemplateAddr == NULL)
-+ throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
-
-- return makeCacheLocation( m_aTemplates.getDataSegmentAddress(aTemplateLocation.getModuleName()) , aTemplateAddr.addressValue());
-+ return m_aTemplates.getTreeAddress(aTemplateLocation.getModuleName());
- }
- // -----------------------------------------------------------------------------
-
- TemplateResult CacheController::getTemplateData(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL()
- {
-- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getTemplateData()");
-- RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
-- RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) ,
-- _aRequest.isComponentRequest() ?
-- "*" : RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
--
--
-+ RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getTemplateData()");
-+ RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
-+ RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) ,
-+ _aRequest.isComponentRequest() ?
-+ "*" : RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
-
- AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
-
-@@ -638,8 +608,8 @@ TemplateResult CacheController::getTempl
- memory::Accessor aTemplatesAccessor( pTemplatesSegment );
-
- data::TreeAddress aTemplateAddr = m_aTemplates.getTemplateTree(aTemplatesAccessor,aTemplateLocation);
-- if (aTemplateAddr.isNull())
-- throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
-+ if (aTemplateAddr == NULL)
-+ throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
-
- data::TreeAccessor aTemplateTree(aTemplatesAccessor,aTemplateAddr);
-
-@@ -661,7 +631,7 @@ void CacheController::saveAndNotify(Upda
- // caller must own a read lock on this cache line
- CFG_TRACE_INFO("CacheController: saving an update for '%s'",OUSTRING2ASCII(_anUpdate.getUpdateRoot().toString()));
-
-- CacheRef aCache = m_aCacheList.get(_anUpdate.getOptions());
-+ CacheRef aCache = m_aCacheMap.get(_anUpdate.getOptions());
-
- OSL_ENSURE(aCache.is(), "No cache data to update in saveAndNotify");
-
-@@ -697,11 +667,11 @@ void CacheController::saveAndNotify(Upda
-
- void CacheController::flushPendingUpdates()CFG_UNO_THROW_ALL()
- {
-- osl::ClearableMutexGuard aGuard(m_aCacheList.mutex());
-- CacheList::Map aFlushList = m_aCacheList.copy();
-+ osl::ClearableMutexGuard aGuard(m_aCacheMap.mutex());
-+ CacheMap::Map aFlushList = m_aCacheMap.copy();
- aGuard.clear();
-
-- for (CacheList::Map::iterator it = aFlushList.begin(); it != aFlushList.end(); ++it)
-+ for (CacheMap::Map::iterator it = aFlushList.begin(); it != aFlushList.end(); ++it)
- saveAllPendingChanges(it->second,it->first);
- }
-
-@@ -754,13 +724,13 @@ bool CacheController::normalizeResult(st
-
- ComponentResult CacheController::loadDirectly(ComponentRequest const & _aRequest, bool _bAddListenter) CFG_UNO_THROW_ALL( )
- {
-- CFG_TRACE_INFO("CacheController: loading data for component '%s' from the backend", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
-+ CFG_TRACE_INFO("CacheController: loading data for component '%s' from the backend", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
-
- AbsolutePath aRequestPath = AbsolutePath::makeModulePath(_aRequest.getComponentName(), AbsolutePath::NoValidate());
-
- NodeRequest aNodeRequest(aRequestPath, _aRequest.getOptions());
-
-- ComponentResult aResult = m_xBackend->getNodeData(_aRequest, this, _bAddListenter?this:NULL);
-+ ComponentResult aResult = m_xBackend->getNodeData(_aRequest, this, _bAddListenter?this:NULL);
-
- OSL_PRECOND(aResult.mutableInstance().mutableData().get(), "loadDirectly: Data must not be NULL");
-
-@@ -768,7 +738,7 @@ ComponentResult CacheController::loadDir
-
- if (!normalizeResult( aResult.mutableInstance().mutableData(),_aRequest.getOptions()))
- {
-- CFG_TRACE_ERROR_NI(" - cannot normalized result: failing");
-+ CFG_TRACE_ERROR_NI(" - cannot normalized result: failing");
-
- OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("Requested data at '"));
- sMsg += aRequestPath.toString();
-@@ -777,7 +747,7 @@ ComponentResult CacheController::loadDir
- throw com::sun::star::container::NoSuchElementException(sMsg,NULL);
- }
-
-- CFG_TRACE_INFO_NI(" - returning normalized defaults");
-+ CFG_TRACE_INFO_NI(" - returning normalized defaults");
-
- return aResult;
- }
-@@ -785,15 +755,15 @@ ComponentResult CacheController::loadDir
-
- NodeResult CacheController::loadDefaultsDirectly(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( )
- {
-- CFG_TRACE_INFO("CacheController: loading defaults for '%s' from the backend", OUSTRING2ASCII(_aRequest.getPath().toString()));
-+ CFG_TRACE_INFO("CacheController: loading defaults for '%s' from the backend", OUSTRING2ASCII(_aRequest.getPath().toString()));
-
- NodeResult aResult = m_xBackend->getDefaultData(_aRequest);
-
-- CFG_TRACE_INFO_NI("- loading defaultscompleted - normalizing result");
-+ CFG_TRACE_INFO_NI("- loading defaultscompleted - normalizing result");
-
- normalizeResult(aResult.mutableInstance().mutableData(),_aRequest.getOptions());
-
-- CFG_TRACE_INFO_NI(" - returning normalized defaults");
-+ CFG_TRACE_INFO_NI(" - returning normalized defaults");
-
- return aResult;
- }
-@@ -801,23 +771,23 @@ NodeResult CacheController::loadDefaults
-
- void CacheController::saveDirectly(UpdateRequest const & _anUpdate) CFG_UNO_THROW_ALL( )
- {
-- m_xBackend->updateNodeData(_anUpdate);
-+ m_xBackend->updateNodeData(_anUpdate);
- }
- // -----------------------------------------------------------------------------
-
- void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequest const & _aComponent) CFG_UNO_THROW_ALL( )
- {
-- CFG_TRACE_INFO("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
-+ CFG_TRACE_INFO("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
-
-- try
-- {
-- CFG_TRACE_INFO2("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
-+ try
-+ {
-+ CFG_TRACE_INFO2("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
-
-- std::auto_ptr<SubtreeChange> aChangeData = _aCache->releasePendingChanges(_aComponent.getComponentName());
-+ std::auto_ptr<SubtreeChange> aChangeData = _aCache->releasePendingChanges(_aComponent.getComponentName());
-
- if (aChangeData.get())
- {
-- CFG_TRACE_INFO_NI("- found changes - sending to backend");
-+ CFG_TRACE_INFO_NI("- found changes - sending to backend");
-
- AbsolutePath aRootPath = AbsolutePath::makeModulePath(_aComponent.getComponentName(), AbsolutePath::NoValidate());
-
-@@ -827,23 +797,23 @@ void CacheController::savePendingChanges
-
- this->saveDirectly(anUpdateSpec);
-
-- CFG_TRACE_INFO_NI("- saving changes completed successfully");
-+ CFG_TRACE_INFO_NI("- saving changes completed successfully");
- }
- else
-- CFG_TRACE_WARNING_NI("- no changes found - cannot save");
-- }
-- catch(uno::Exception& e)
-- {
-- (void)e;
-- CFG_TRACE_ERROR_NI("CacheController: saving tree '%s' failed: %s",
-- OUSTRING2ASCII(_aComponent.getComponentName().toString()),
-- OUSTRING2ASCII(e.Message) );
-+ CFG_TRACE_WARNING_NI("- no changes found - cannot save");
-+ }
-+ catch(uno::Exception& e)
-+ {
-+ (void)e;
-+ CFG_TRACE_ERROR_NI("CacheController: saving tree '%s' failed: %s",
-+ OUSTRING2ASCII(_aComponent.getComponentName().toString()),
-+ OUSTRING2ASCII(e.Message) );
-
-- this->invalidateComponent(_aComponent);
-- CFG_TRACE_INFO_NI("- component data invalidated");
-+ this->invalidateComponent(_aComponent);
-+ CFG_TRACE_INFO_NI("- component data invalidated");
-
-- throw;
-- }
-+ throw;
-+ }
- }
- // -----------------------------------------------------------------------------
-
-@@ -853,7 +823,7 @@ bool CacheController::saveAllPendingChan
- CFG_TRACE_INFO("CacheController: Saving all pending changes for cache line");
- OSL_ASSERT(_aCache.is());
-
-- typedef Cache::Data::PendingModuleList PMList;
-+ typedef ExtendedCacheData::PendingModuleList PMList;
-
- PMList aPendingModules;
- _aCache->findPendingChangedModules(aPendingModules);
-@@ -890,7 +860,7 @@ void CacheController::freeComponent(Comp
- OUSTRING2ASCII(_aRequest.getOptions().getEntity()),
- OUSTRING2ASCII(_aRequest.getOptions().getLocale()) );
-
-- CacheRef aCache = m_aCacheList.get(_aRequest.getOptions());
-+ CacheRef aCache = m_aCacheMap.get(_aRequest.getOptions());
-
- OSL_ENSURE(aCache.is(), "Releasing a nonexisting module");
-
-@@ -911,11 +881,11 @@ void CacheController::dataChanged(const
- // -----------------------------------------------------------------------------
- void CacheController::refreshAllComponents() CFG_UNO_THROW_ALL()
- {
-- osl::ClearableMutexGuard aGuard(m_aCacheList.mutex());
-- CacheList::Map aRefreshList = m_aCacheList.copy();
-+ osl::ClearableMutexGuard aGuard(m_aCacheMap.mutex());
-+ CacheMap::Map aRefreshList = m_aCacheMap.copy();
- aGuard.clear();
-
-- for (CacheList::Map::iterator i = aRefreshList.begin();
-+ for (CacheMap::Map::iterator i = aRefreshList.begin();
- i != aRefreshList.end(); ++i)
- {
- if (!i->second->isEmpty())
-Index: configmgr/source/treecache/cachecontroller.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachecontroller.hxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 cachecontroller.hxx
---- configmgr/source/treecache/cachecontroller.hxx 8 Sep 2005 04:22:14 -0000 1.10
-+++ configmgr/source/treecache/cachecontroller.hxx 5 Jan 2007 22:25:44 -0000
-@@ -85,7 +85,7 @@ namespace configmgr
-
- : public ICachedDataProvider
- , public IDirectDataProvider // Refcounted
-- , public INodeDataListener
-+ , public INodeDataListener
- {
- typedef backend::IMergedDataProvider Backend;
- typedef rtl::Reference< Backend > BackendRef;
-@@ -96,7 +96,6 @@ namespace configmgr
- */
- explicit
- CacheController(BackendRef const & _xBackend,
-- memory::HeapManager & _rCacheHeapManager,
- const uno::Reference<uno::XComponentContext>& xContext);
-
- // ICachedDataProvider implementation
-@@ -309,8 +308,6 @@ namespace configmgr
- protected:
- // ref counted, that's why no public dtor
- ~CacheController();
--
-- memory::HeapManager & getCacheHeapManager() const;
- // implementation
- private:
- typedef CacheLoadingAccess Cache;
-@@ -364,15 +361,12 @@ namespace configmgr
-
- void closeModules(Cache::DisposeList & _aList, RequestOptions const & _aOptions);
- private:
-- typedef AutoReferenceMap<RequestOptions,Cache,lessRequestOptions> CacheList;
-- typedef TemplateCacheData TemplateCache;
--
-+ typedef AutoReferenceMap<RequestOptions,Cache,lessRequestOptions> CacheMap;
-
- CacheChangeMulticaster m_aNotifier;
-- BackendRef m_xBackend;
--
-- CacheList m_aCacheList; // Map
-- TemplateCache m_aTemplates;
-+ BackendRef m_xBackend;
-+ CacheMap m_aCacheMap;
-+ TemplateCacheData m_aTemplates;
-
- osl::Mutex m_aTemplatesMutex;
-
-Index: configmgr/source/treecache/cachedata.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachedata.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 cachedata.cxx
---- configmgr/source/treecache/cachedata.cxx 16 Sep 2006 15:25:09 -0000 1.7
-+++ configmgr/source/treecache/cachedata.cxx 5 Jan 2007 22:25:44 -0000
-@@ -44,11 +44,8 @@
- #ifndef CONFIGMGR_UPDATEACCESSOR_HXX
- #include "updateaccessor.hxx"
- #endif
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#include "nodeaddress.hxx"
--#endif
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
-+#ifndef INCLUDED_SHARABLE_NODE_HXX
-+#include "node.hxx"
- #endif
- #ifndef CONFIGMGR_NODEACCESS_HXX
- #include "nodeaccess.hxx"
-@@ -120,15 +117,14 @@ namespace configmgr
- };
-
- // -----------------------------------------------------------------------------
-- static inline CacheData::ModuleName implExtractModuleName(CacheData::Path const& aConfigPath)
-+ static inline CacheLine::Name implExtractModuleName(CacheLine::Path const& aConfigPath)
- {
- return aConfigPath.getModuleName();
- }
-
- // -----------------------------------------------------------------------------
-
-- CacheData::CacheData(memory::HeapManager & _rHeapManager)
-- : m_rHeapManager(_rHeapManager)
-+ CacheData::CacheData()
- {
- }
- // -----------------------------------------------------------------------------
-@@ -139,13 +135,13 @@ namespace configmgr
- }
- // -----------------------------------------------------------------------------
-
-- CacheData::ModuleName CacheData::extractModuleName(Path const& _aPath)
-+ CacheLine::Name CacheData::extractModuleName(CacheLine::Path const& _aPath)
- {
- return implExtractModuleName(_aPath);
- }
- // -----------------------------------------------------------------------------
- inline
-- CacheLineRef CacheData::internalGetModule(const ModuleName& _aModuleName ) const
-+ CacheLineRef CacheData::internalGetModule(const CacheLine::Name& _aModuleName ) const
- {
- OSL_ASSERT(!_aModuleName.isEmpty());
-
-@@ -155,14 +151,14 @@ namespace configmgr
- }
- // -----------------------------------------------------------------------------
- inline
-- CacheLineRef CacheData::internalGetModule(const Path& _aPath) const
-+ CacheLineRef CacheData::internalGetModule(const CacheLine::Path& _aPath) const
- {
- return internalGetModule( implExtractModuleName(_aPath) );
- }
- // -----------------------------------------------------------------------------
-
- inline
-- void CacheData::internalAddModule(const ModuleName& _aName, const ModuleRef & _aModule)
-+ void CacheData::internalAddModule(const CacheLine::Name& _aName, const CacheLineRef & _aModule)
- {
- //OSL_PRECOND(m_aModules.find(_aName) == m_aModules.end(), "ERROR: Module already present in CacheData");
-
-@@ -173,9 +169,9 @@ namespace configmgr
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
-- CacheLineRef CacheData::internalAttachModule(const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( )
-+ CacheLineRef CacheData::internalAttachModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
- {
-- CacheLineRef aNewModule = doCreateAttachedModule(this->internalHeapManager(), _aLocation,_aName);
-+ CacheLineRef aNewModule = doCreateAttachedModule(_aLocation,_aName);
-
- internalAddModule( _aName, aNewModule );
-
-@@ -184,7 +180,7 @@ namespace configmgr
- // -----------------------------------------------------------------------------
-
- /// creates a new data segment reference for the given path - creates if necessary
-- memory::Segment * CacheData::attachDataSegment(memory::SegmentAddress const & _aLocation, ModuleName const & _aModule)
-+ memory::Segment * CacheData::attachDataSegment(data::TreeAddress _aLocation, CacheLine::Name const & _aModule)
- {
- CacheLineRef aModule = this->internalAttachModule(_aLocation,_aModule);
-
-@@ -192,14 +188,14 @@ namespace configmgr
- }
- // -------------------------------------------------------------------------
-
-- CacheLineRef CacheData::doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( )
-+ CacheLineRef CacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
- {
-- return CacheLine::createAttached( _aName, _rHeapManager, _aLocation );
-+ return CacheLine::createAttached( _aName, _aLocation );
- }
- // -----------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path if exists
-- memory::Segment * CacheData::getDataSegment(const ModuleName & _aModule)
-+ memory::Segment * CacheData::getDataSegment(const CacheLine::Name & _aModule)
- {
- CacheLineRef aModule = internalGetModule(_aModule);
-
-@@ -208,15 +204,15 @@ namespace configmgr
- // -------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path if exists
-- memory::SegmentAddress CacheData::getDataSegmentAddress(const ModuleName & _aModule) const
-+ data::TreeAddress CacheData::getTreeAddress(const CacheLine::Name & _aModule) const
- {
- CacheLineRef aModule = internalGetModule(_aModule);
-
-- return aModule.is() ? aModule->getDataSegmentAddress() : memory::SegmentAddress();
-+ return aModule.is() ? aModule->getTreeAddress() : NULL;
- }
- // -------------------------------------------------------------------------
-
-- bool CacheData::hasModule(const ModuleName & _aModule) const
-+ bool CacheData::hasModule(const CacheLine::Name & _aModule) const
- {
- CacheLineRef aModule = internalGetModule(_aModule);
-
-@@ -224,7 +220,7 @@ namespace configmgr
- }
- // -------------------------------------------------------------------------
-
-- bool CacheData::hasModuleDefaults(memory::Accessor const & _aAccessor, const ModuleName & _aModule) const
-+ bool CacheData::hasModuleDefaults(memory::Accessor const & _aAccessor, const CacheLine::Name & _aModule) const
- {
- CacheLineRef aModule = internalGetModule(_aModule);
-
-@@ -232,19 +228,19 @@ namespace configmgr
- }
- // -------------------------------------------------------------------------
-
-- data::TreeAddress CacheData::internalGetPartialTree(memory::Accessor const & _aAccessor, const Path& aComponentName ) const
-- {
-- CacheLineRef xModule = internalGetModule(aComponentName);
-+ data::TreeAddress CacheData::internalGetPartialTree(memory::Accessor const & _aAccessor, const CacheLine::Path& aComponentName ) const
-+ {
-+ CacheLineRef xModule = internalGetModule(aComponentName);
-
-- if ( !xModule.is() )
-- return data::TreeAddress();
-+ if ( !xModule.is() )
-+ return NULL;
-
- data::TreeAddress pSubtree = xModule->getPartialTree(_aAccessor,aComponentName);
-
-- OSL_ENSURE( pSubtree.isNull() || xModule->clientReferences() != 0 ,
-+ OSL_ENSURE( pSubtree == NULL || xModule->clientReferences() != 0 ,
- "WARNING: returning subtree from module without clients\n" );
- #ifdef CFG_ENABLE_TRACING
-- if( pSubtree.is() && xModule->clientReferences() == 0)
-+ if( pSubtree != NULL && xModule->clientReferences() == 0)
- {
- CFG_TRACE_WARNING("CacheData data: returning subtree %s from module without clients", OUSTRING2ASCII( aComponentName.toString() ) );
- }
-@@ -253,7 +249,7 @@ namespace configmgr
- return pSubtree;
- }
- // -----------------------------------------------------------------------------
-- data::NodeAddress CacheData::internalGetNode(memory::Accessor const & _aAccessor, const Path& aComponentName ) const
-+ data::NodeAddress CacheData::internalGetNode(memory::Accessor const & _aAccessor, const CacheLine::Path& aComponentName ) const
- {
- CacheLineRef xModule = internalGetModule(aComponentName);
-
-@@ -265,10 +261,10 @@ namespace configmgr
-
- data::NodeAddress pNode = xModule->getNode(_aAccessor,aComponentName);
-
-- OSL_ENSURE( pNode.isNull() || xModule->clientReferences() != 0,
-+ OSL_ENSURE( pNode == NULL || xModule->clientReferences() != 0,
- "WARNING: returning node from module without clients\n" );
- #ifdef CFG_ENABLE_TRACING
-- if( pNode.is() && xModule->clientReferences() == 0)
-+ if( pNode != NULL && xModule->clientReferences() == 0)
- {
- CFG_TRACE_WARNING("CacheData data: returning node %s from module without clients", OUSTRING2ASCII( aComponentName.toString() ) );
- }
-@@ -278,35 +274,34 @@ namespace configmgr
- }
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-- data::TreeAddress CacheData::acquireModule(ModuleName const & _aModule)
-- {
-+ bool CacheData::acquireModule(CacheLine::Name const & _aModule)
-+ {
- CacheLineRef xModule = internalGetModule(_aModule);
-
-- CacheLineClientRef aClientRef(xModule);
--
-- data::TreeAddress aModuleAddr = xModule.is() ? xModule->getModuleRootAddress() : data::TreeAddress();
--
-- if (aModuleAddr.is())
-+ if (xModule.is())
-+ {
-+ CacheLineClientRef aClientRef(xModule);
- aClientRef.keep();
--
-- return aModuleAddr;
-- }
-+ }
-+
-+ return xModule.is();
-+ }
- // -----------------------------------------------------------------------------
-- data::NodeAddress CacheData::acquireNode(memory::Accessor const & _aAccessor, Path const& _aPath)
-- {
-- CacheLineClientRef aClientRef(internalGetModule(_aPath));
-+ data::NodeAddress CacheData::acquireNode(memory::Accessor const & _aAccessor, CacheLine::Path const& _aPath)
-+ {
-+ CacheLineClientRef aClientRef(internalGetModule(_aPath));
-
- data::NodeAddress aNodeAddr = internalGetNode(_aAccessor,_aPath);
-
-- if (sharable::Node const * pNode = data::NodeAccess::access(aNodeAddr,_aAccessor))
-- {
-+ if (sharable::Node const * pNode = aNodeAddr)
-+ {
- if (pNode->isValue())
- aNodeAddr = data::NodeAddress(); // invalid: cannot acquire single value
-- }
-+ }
- else
-- OSL_ASSERT( !aNodeAddr.is() );
-+ OSL_ASSERT( aNodeAddr == NULL );
-
-- if (aNodeAddr.is())
-+ if (aNodeAddr != NULL)
- aClientRef.keep();
-
- return aNodeAddr;
-@@ -327,12 +322,12 @@ namespace configmgr
- if (!xModule.is()) return false;
-
- // make sure to keep the module alive
-- CacheLineClientRef( xModule ).keep();
-+ CacheLineClientRef( xModule ).keep();
-
-- data::TreeAddress aResultTree = xModule->insertDefaults(_aAccessToken, _aDefaultInstance);
-+ data::TreeAddress aResultTree = xModule->insertDefaults(_aAccessToken, _aDefaultInstance);
-
-- return aResultTree.is();
-- }
-+ return aResultTree != NULL;
-+ }
- // -----------------------------------------------------------------------------
-
- void CacheData::applyUpdate(memory::UpdateAccessor & _aAccessToken, backend::UpdateInstance & _anUpdate ) CFG_UNO_THROW_RTE( )
-@@ -340,7 +335,7 @@ namespace configmgr
- // request the subtree, atleast one level must exist!
- data::NodeAddress aNodeAddr = internalGetNode(_aAccessToken.accessor(),_anUpdate.root().location());
-
-- if (aNodeAddr.is())
-+ if (aNodeAddr != NULL)
- {
- applyUpdateToTree(*_anUpdate.data(),_aAccessToken,aNodeAddr);
- }
-@@ -355,18 +350,18 @@ namespace configmgr
- }
- }
- // -----------------------------------------------------------------------------
-- CacheLine::RefCount CacheData::releaseModule( ModuleName const & _aModule, bool _bKeepDeadModule )
-+ oslInterlockedCount CacheData::releaseModule( CacheLine::Name const & _aModule, bool _bKeepDeadModule )
- {
- CacheLineRef xModule = internalGetModule(_aModule);
-
-- const CacheLine::RefCount c_nErrorCount = -1;
-+ const oslInterlockedCount c_nErrorCount = -1;
-
- OSL_ENSURE( xModule.is(), "ERROR: Releasing non-existent subtree");
- if ( !xModule.is()) return c_nErrorCount;
-
- OSL_ENSURE( xModule->clientReferences() > 0, "ERROR: Releasing non-referenced subtree");
-
-- CacheLine::RefCount nResult = xModule->clientRelease();
-+ oslInterlockedCount nResult = xModule->clientRelease();
-
- if (nResult == 0 && !_bKeepDeadModule)
- {
-@@ -376,25 +371,25 @@ namespace configmgr
- }
-
- // -----------------------------------------------------------------------------
-- data::TreeAddress CacheData::getTemplateTree( memory::Accessor const & _aAccessor, Path const& aTemplateName ) const
-+ data::TreeAddress CacheData::getTemplateTree( memory::Accessor const & _aAccessor, CacheLine::Path const& aTemplateName ) const
- {
- return internalGetPartialTree(_aAccessor,aTemplateName);
- }
- // -----------------------------------------------------------------------------
-- data::NodeAddress CacheData::getNode(memory::Accessor const & _aAccessor, const Path& _rPath)
-+ data::NodeAddress CacheData::getNode(memory::Accessor const & _aAccessor, const CacheLine::Path& _rPath)
- {
- return internalGetNode(_aAccessor,_rPath);
- }
- // -----------------------------------------------------------------------------
-- bool CacheData::hasNode(memory::Accessor const & _aAccessor, const Path& _rPath) const
-+ bool CacheData::hasNode(memory::Accessor const & _aAccessor, const CacheLine::Path& _rPath) const
- {
-- return internalGetNode(_aAccessor,_rPath).is();
-+ return internalGetNode(_aAccessor,_rPath) != NULL;
- }
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * TemplateCacheData::createDataSegment(ModuleName const & _aModule)
-+ memory::Segment * TemplateCacheData::createDataSegment(CacheLine::Name const & _aModule)
- {
- CacheLineRef aModule = implNewCacheLine(_aModule);
-
-@@ -407,12 +402,12 @@ namespace configmgr
- {
- OSL_PRECOND(_aComponentInstance.data.get(), "addTemplates: Data must not be NULL");
- // we should already have the module in cache !
-- ModuleName aModuleName ( _aComponentInstance.name);
-+ CacheLine::Name aModuleName ( _aComponentInstance.name);
- CacheLineRef xModule = internalGetModule(aModuleName);
-
- OSL_ENSURE( xModule.is(), "ExtendedCacheData::addTemplates: No module to add the templates to - where did the data segment come from ?");
-
-- if (!xModule.is()) return data::TreeAddress();
-+ if (!xModule.is()) return NULL;
-
- // make sure to keep the module alive
- CacheLineClientRef( xModule ).keep();
-@@ -423,25 +418,23 @@ namespace configmgr
-
- data::TreeAddress aResult = xModule->setComponentData(_aUpdateToken, _aComponentInstance, true);
-
-- OSL_ASSERT(aResult.is());
-+ OSL_ASSERT(aResult != NULL);
-
-- return aResult;
-- }
-+ return aResult;
-+ }
- // -----------------------------------------------------------------------------
-
-- CacheLineRef TemplateCacheData::doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( )
-+ CacheLineRef TemplateCacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
- {
-- CacheLineRef aNewModule =
-- CacheLine::createAttached(_aName, _rHeapManager, _aLocation);
-+ CacheLineRef aNewModule = CacheLine::createAttached(_aName, _aLocation);
-
- return aNewModule.get();
- }
- // -----------------------------------------------------------------------------
-
-- CacheLineRef TemplateCacheData::implNewCacheLine(const ModuleName& _aModule) CFG_UNO_THROW_RTE( )
-+ CacheLineRef TemplateCacheData::implNewCacheLine(const CacheLine::Name& _aModule) CFG_UNO_THROW_RTE( )
- {
-- CacheLineRef aNewModule =
-- CacheLine::createNew(_aModule, this->internalHeapManager());
-+ CacheLineRef aNewModule = CacheLine::createNew(_aModule);
-
- internalAddModule( _aModule, aNewModule.get() );
-
-@@ -459,19 +452,18 @@ namespace configmgr
-
- // -----------------------------------------------------------------------------
-
-- CacheLineRef ExtendedCacheData::doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( )
-+ CacheLineRef ExtendedCacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
- {
- ExtendedCacheLineRef aNewModule =
-- ExtendedCacheLine::createAttached(_aName, _rHeapManager, _aLocation);
-+ ExtendedCacheLine::createAttached(_aName, _aLocation);
-
- return CacheLineRef( aNewModule.get() );
- }
- // -----------------------------------------------------------------------------
-
-- ExtendedCacheLineRef ExtendedCacheData::implNewCacheLine(const ModuleName& _aModule) CFG_UNO_THROW_RTE( )
-+ ExtendedCacheLineRef ExtendedCacheData::implNewCacheLine(const CacheLine::Name& _aModule) CFG_UNO_THROW_RTE( )
- {
-- ExtendedCacheLineRef aNewModule =
-- ExtendedCacheLine::createNew(_aModule, this->internalHeapManager());
-+ ExtendedCacheLineRef aNewModule = ExtendedCacheLine::createNew(_aModule);
-
- internalAddModule( _aModule, aNewModule.get() );
-
-@@ -480,7 +472,7 @@ namespace configmgr
- // -----------------------------------------------------------------------------
-
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * ExtendedCacheData::createDataSegment(ModuleName const & _aModule)
-+ memory::Segment * ExtendedCacheData::createDataSegment(CacheLine::Name const & _aModule)
- {
- ExtendedCacheLineRef aModule = implNewCacheLine(_aModule);
-
-@@ -499,18 +491,18 @@ namespace configmgr
-
- OSL_ENSURE( xModule.is(), "ExtendedCacheData::addComponentData: No module to add the subtree to - where did the data segment come from ?");
-
-- if (!xModule.is()) return data::TreeAddress();
-+ if (!xModule.is()) return NULL;
-
- CacheLineClientRef aClientRef( xModule );
-
- data::TreeAddress aResult = xModule->setComponentData(_aUpdateToken,_aComponentInstance.componentNodeData(), _bWithDefaults);
-
-- OSL_ASSERT(aResult.is());
-+ OSL_ASSERT(aResult != NULL);
-
-- if (aResult.is()) aClientRef.keep();
-+ if (aResult != NULL) aClientRef.keep();
-
-- return aResult;
-- }
-+ return aResult;
-+ }
- // -----------------------------------------------------------------------------
-
- void ExtendedCacheData::addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE( )
-@@ -529,7 +521,7 @@ namespace configmgr
- }
- // -----------------------------------------------------------------------------
-
-- std::auto_ptr<SubtreeChange> ExtendedCacheData::releasePending(ModuleName const& _aModule)
-+ std::auto_ptr<SubtreeChange> ExtendedCacheData::releasePending(CacheLine::Name const& _aModule)
- {
- ExtendedCacheLineRef xModule = implExtended(internalGetModule(_aModule));
-
-@@ -548,12 +540,13 @@ namespace configmgr
- }
- // -----------------------------------------------------------------------------
-
-- bool ExtendedCacheData::hasPending(ModuleName const & _aModule)
-+ bool ExtendedCacheData::hasPending(CacheLine::Name const & _aModule)
- {
-- ExtendedCacheLineRef xModule = implExtended(internalGetModule(_aModule));
-+ ExtendedCacheLineRef xModule = implExtended(internalGetModule(_aModule));
-
-- return xModule.is() && xModule->hasPending();
-+ return xModule.is() && xModule->hasPending();
- }
-+
- // -----------------------------------------------------------------------------
-
- void ExtendedCacheData::findPendingModules( PendingModuleList & _rPendingList )
-Index: configmgr/source/treecache/cachedata.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachedata.hxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 cachedata.hxx
---- configmgr/source/treecache/cachedata.hxx 8 Sep 2005 04:22:46 -0000 1.7
-+++ configmgr/source/treecache/cachedata.hxx 5 Jan 2007 22:25:44 -0000
-@@ -53,7 +53,7 @@
- namespace configmgr
- {
- ////////////////////////////////////////////////////////////////////////////////
-- using ::rtl::OUString;
-+ using ::rtl::OUString;
-
- namespace backend
- {
-@@ -70,43 +70,38 @@ namespace configmgr
- class CacheData
- {
- public:
-- typedef CacheLine Module;
-- typedef CacheLineRef ModuleRef;
-- typedef CacheLine::Path Path;
-- typedef CacheLine::Name ModuleName;
-- public:
-- CacheData(memory::HeapManager & _rHeapManager);
-+ CacheData();
- virtual ~CacheData();
-
- /// retrieve the module tree name for the given path
-- static ModuleName extractModuleName(Path const& _aPath);
-+ static CacheLine::Name extractModuleName(CacheLine::Path const& _aPath);
-
- /// check if the given module exists already (and is not empty)
-- bool hasModule(ModuleName const & _aModule) const;
-+ bool hasModule(CacheLine::Name const & _aModule) const;
- /// checks if the given module exists and has defaults available
-- bool hasModuleDefaults(memory::Accessor const & _aAccessor, ModuleName const & _aModule) const;
-+ bool hasModuleDefaults(memory::Accessor const & _aAccessor, CacheLine::Name const & _aModule) const;
-
- /// creates a new data segment reference for the given path if exists
-- memory::Segment * attachDataSegment(memory::SegmentAddress const & _aLocation, ModuleName const & _aModule);
-+ memory::Segment * attachDataSegment(data::TreeAddress _aLocation, CacheLine::Name const & _aModule);
- /// gets a data segment reference for the given path if it exists
-- memory::Segment * getDataSegment(ModuleName const & _aModule);
-- /// gets a data segment address for the given module if it exists
-- memory::SegmentAddress getDataSegmentAddress(ModuleName const & _aModule) const;
-+ memory::Segment * getDataSegment(CacheLine::Name const & _aModule);
-+ /// gets a tree address for the given module if it exists
-+ data::TreeAddress getTreeAddress(CacheLine::Name const & _aModule) const;
-
- /// checks whether a certain node exists in the tree
-- bool hasNode(memory::Accessor const & _aAccessor, Path const & _aLocation) const;
-+ bool hasNode(memory::Accessor const & _aAccessor, CacheLine::Path const & _aLocation) const;
-
- /// retrieve the given node without changing its ref count
-- data::NodeAddress getNode(memory::Accessor const & _aAccessor, Path const & _rPath);
-+ data::NodeAddress getNode(memory::Accessor const & _aAccessor, CacheLine::Path const & _rPath);
- /// retrieve the given template tree without changing its ref count
-- data::TreeAddress getTemplateTree(memory::Accessor const & _aAccessor, Path const & aTemplateName ) const;
-+ data::TreeAddress getTemplateTree(memory::Accessor const & _aAccessor, CacheLine::Path const & aTemplateName ) const;
-
- /// retrieve the subtree at _aPath and clientAcquire() it
-- data::NodeAddress acquireNode(memory::Accessor const & _aAccessor, Path const & _aPath );
-- /// retrieve the subtree at _aPath and clientAcquire() it
-- data::TreeAddress acquireModule( ModuleName const & _aModule );
-+ data::NodeAddress acquireNode(memory::Accessor const & _aAccessor, CacheLine::Path const & _aPath );
-+ /// retrieve the subtree at _aPath and clientAcquire() it, return true on success
-+ bool acquireModule( CacheLine::Name const & _aModule );
- /// clientRelease() the tree at aComponentName, and return the resulting reference count
-- CacheLine::RefCount releaseModule( ModuleName const & _aModule, bool _bKeepDeadModule = false );
-+ oslInterlockedCount releaseModule( CacheLine::Name const & _aModule, bool _bKeepDeadModule = false );
-
- bool insertDefaults( memory::UpdateAccessor& _aAccessToken,
- backend::NodeInstance const & _aDefaultInstance
-@@ -117,27 +112,23 @@ namespace configmgr
- backend::UpdateInstance & _anUpdate) CFG_UNO_THROW_RTE( );
-
- // low-level interface for cache management
-- typedef std::map<ModuleName, ModuleRef> ModuleList;
-+ typedef std::map<CacheLine::Name, CacheLineRef> ModuleList;
- ModuleList& accessModuleList() { return m_aModules; }
-
-- memory::HeapManager & getHeapManager() const { return m_rHeapManager; }
- protected:
-- virtual ModuleRef doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( );
-+ virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
-
-- data::TreeAddress internalGetPartialTree(memory::Accessor const & _aAccessor, Path const & _aPath ) const;
-- data::NodeAddress internalGetNode(memory::Accessor const & _aAccessor, const Path& _rPath) const;
-+ data::TreeAddress internalGetPartialTree(memory::Accessor const & _aAccessor, CacheLine::Path const & _aPath ) const;
-+ data::NodeAddress internalGetNode(memory::Accessor const & _aAccessor, const CacheLine::Path& _rPath) const;
-
-- ModuleRef internalAttachModule(const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( );
-- void internalAddModule(ModuleName const & _aName, ModuleRef const & _aModule);
-+ CacheLineRef internalAttachModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
-+ void internalAddModule(CacheLine::Name const & _aName, CacheLineRef const & _aModule);
-
-- ModuleRef internalGetModule(const ModuleName& _aName) const;
-- ModuleRef internalGetModule(const Path& _aLocation) const;
-+ CacheLineRef internalGetModule(const CacheLine::Name& _aName) const;
-+ CacheLineRef internalGetModule(const CacheLine::Path& _aLocation) const;
-
-- memory::HeapManager & internalHeapManager() { return m_rHeapManager; }
- private:
- ModuleList m_aModules;
--
-- memory::HeapManager & m_rHeapManager;
- };
- ////////////////////////////////////////////////////////////////////////////////
- /** A collection of CacheLines for templates
-@@ -146,13 +137,12 @@ namespace configmgr
- class TemplateCacheData : public CacheData
- {
- public:
-- TemplateCacheData(memory::HeapManager & _rHeapManager)
-- : CacheData(_rHeapManager)
-+ TemplateCacheData() : CacheData()
- {
- }
-
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * createDataSegment(ModuleName const & _aModule);
-+ memory::Segment * createDataSegment(CacheLine::Name const & _aModule);
-
- /** add the given template tree at the given location,
- return the tree that is now pertinent and clientAcquire() it once
-@@ -162,9 +152,9 @@ namespace configmgr
- ) CFG_UNO_THROW_RTE();
-
- private:
-- virtual ModuleRef doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( );
-+ virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
-
-- CacheLineRef implNewCacheLine(ModuleName const & _aModule) CFG_UNO_THROW_RTE( );
-+ CacheLineRef implNewCacheLine(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE( );
- };
- //-----------------------------------------------------------------------------
- /** A collection of CacheLines
-@@ -173,13 +163,12 @@ namespace configmgr
- class ExtendedCacheData : public CacheData
- {
- public:
-- ExtendedCacheData(memory::HeapManager & _rHeapManager)
-- : CacheData(_rHeapManager)
-+ ExtendedCacheData() : CacheData()
- {
- }
-
- /// gets a data segment reference for the given path - creates if necessary
-- memory::Segment * createDataSegment(ModuleName const & _aModule);
-+ memory::Segment * createDataSegment(CacheLine::Name const & _aModule);
-
- /** add the given subtree at the given location,
- return the tree that is now pertinent and clientAcquire() it once
-@@ -189,22 +178,22 @@ namespace configmgr
- bool _bWithDefaults
- ) CFG_UNO_THROW_RTE();
-
-- typedef std::vector< ModuleName > PendingModuleList;
-+ typedef std::vector< CacheLine::Name > PendingModuleList;
- /// find the modules having pending changes
-- bool hasPending(ModuleName const & _aModule);
-+ bool hasPending(CacheLine::Name const & _aModule);
- /// find the modules having pending changes
- void findPendingModules( PendingModuleList & _rPendingList );
-
- /// add or merge the given subtreechange at the given location
- void addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE( );
- /// remove and return pending changes for the given component
-- std::auto_ptr<SubtreeChange> releasePending(ModuleName const & _aModule) CFG_UNO_THROW_RTE( );
-+ std::auto_ptr<SubtreeChange> releasePending(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE( );
- private:
-- virtual ModuleRef doCreateAttachedModule(memory::HeapManager & _rHeapManager, const memory::SegmentAddress & _aLocation, const ModuleName& _aName) CFG_UNO_THROW_RTE( );
-+ virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
-
-- ExtendedCacheLineRef implNewCacheLine(ModuleName const & _aModule) CFG_UNO_THROW_RTE( );
-+ ExtendedCacheLineRef implNewCacheLine(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE( );
-
-- ExtendedCacheLineRef implExtended(ModuleRef const & _aSimpleRef) const;
-+ ExtendedCacheLineRef implExtended(CacheLineRef const & _aSimpleRef) const;
- };
- //-----------------------------------------------------------------------------
-
-Index: configmgr/source/treecache/cachefactory.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachefactory.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 cachefactory.cxx
---- configmgr/source/treecache/cachefactory.cxx 16 Sep 2006 15:25:24 -0000 1.8
-+++ configmgr/source/treecache/cachefactory.cxx 5 Jan 2007 22:25:44 -0000
-@@ -66,12 +66,10 @@ namespace configmgr
-
- if (_xBackend.is())
- {
-- memory::HeapManager & rHeap = memory::cacheHeap();
--
- rtl::Reference< backend::ICachedDataProvider > xLoader
-- = new backend::CacheController(_xBackend.get(),rHeap, _xContext);
-+ = new backend::CacheController(_xBackend.get(), _xContext);
-
-- xCache.set( new TreeManager(xLoader.get(),rHeap) );
-+ xCache.set( new TreeManager(xLoader.get()) );
- }
-
- return xCache;
-Index: configmgr/source/treecache/cacheline.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cacheline.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 cacheline.cxx
---- configmgr/source/treecache/cacheline.cxx 16 Sep 2006 15:25:36 -0000 1.9
-+++ configmgr/source/treecache/cacheline.cxx 5 Jan 2007 22:25:45 -0000
-@@ -80,48 +80,35 @@ namespace configmgr
-
- // -----------------------------------------------------------------------------
-
-- CacheLine::CacheLine(Name const & _aModuleName, memory::HeapManager & _rHeapImpl)
-- : m_storage(_rHeapImpl )
-- , m_base()
-+ CacheLine::CacheLine(Name const & _aModuleName)
-+ : m_storage()
-+ , m_base(NULL)
- , m_name(_aModuleName)
- , m_nDataRefs(0)
- {
- }
- // -----------------------------------------------------------------------------
--
-- CacheLine::CacheLine(Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aSegment)
-- : m_storage(_rHeapImpl,_aSegment.id)
-- , m_base( memory::Pointer(_aSegment.base) )
-+
-+ CacheLine::CacheLine(Name const & _aModuleName, data::TreeAddress _pSegment)
-+ : m_storage()
-+ , m_base(_pSegment)
- , m_name(_aModuleName)
- , m_nDataRefs(0)
- {
- }
--// -----------------------------------------------------------------------------
--
-- memory::SegmentAddress CacheLine::getDataSegmentAddress() const
-- {
-- memory::SegmentAddress aResult;
--
-- aResult.id = m_storage.getId();
-- aResult.base = m_base.addressValue();
--
-- return aResult;
-- }
-
- // -----------------------------------------------------------------------------
-
- void CacheLine::setBase(data::TreeAddress _base)
-- {
-- OSL_PRECOND(!m_base.is(), "CacheLine: Data base address was already set");
-- OSL_PRECOND( _base.is(), "CacheLine: Cannot set NULL base address");
-+ {
-+ OSL_PRECOND(m_base == NULL, "CacheLine: Data base address was already set");
-+ OSL_PRECOND( _base != NULL, "CacheLine: Cannot set NULL base address");
- m_base = _base;
- }
- // -----------------------------------------------------------------------------
-
- CacheLineRef CacheLine::createAttached( Name const & _aModuleName,
-- memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aSegment
-+ data::TreeAddress _aSegment
- ) CFG_UNO_THROW_RTE( )
- {
- if (_aModuleName.isEmpty())
-@@ -129,20 +116,19 @@ namespace configmgr
- OSL_ENSURE(false, "Cannot make a cache line without a name");
- return NULL;
- }
-- if (_aSegment.isNull())
-+ if (_aSegment == NULL)
- {
- OSL_ENSURE(false, "Cannot attach a cache line to a NULL segment");
- return NULL;
- }
-
-- CacheLineRef xResult = new CacheLine(_aModuleName,_rHeapImpl,_aSegment);
-+ CacheLineRef xResult = new CacheLine(_aModuleName,_aSegment);
-
- return xResult;
- }
- // -----------------------------------------------------------------------------
-
-- CacheLineRef CacheLine::createNew( Name const & _aModuleName,
-- memory::HeapManager & _rHeapImpl
-+ CacheLineRef CacheLine::createNew( Name const & _aModuleName
- ) CFG_UNO_THROW_RTE( )
- {
- if (_aModuleName.isEmpty())
-@@ -151,7 +137,7 @@ namespace configmgr
- return NULL;
- }
-
-- CacheLineRef xResult = new CacheLine(_aModuleName,_rHeapImpl);
-+ CacheLineRef xResult = new CacheLine(_aModuleName);
-
- return xResult;
- }
-@@ -168,25 +154,25 @@ namespace configmgr
- data::SetNodeAccess aParentSet( internalGetNode(_aAccessor, aConfigName.getParentPath()) );
-
- if (aParentSet.isValid())
-- return aParentSet.getElementTree(aConfigName.getLocalName().getName()).address();
-+ return aParentSet.getElementTree(aConfigName.getLocalName().getName());
- else
-- return data::TreeAddress();
-+ return NULL;
- }
- // -----------------------------------------------------------------------------
-
- bool CacheLine::hasDefaults(memory::Accessor const & _anAccessor) const
-- {
-- if ( !m_base.is() ) return false; // cannot get defaults without data
-+ {
-+ if ( m_base != NULL ) return false; // cannot get defaults without data
-
- data::TreeAccessor aModuleTree(_anAccessor, m_base);
-- OSL_ASSERT( aModuleTree.isValid());
-+ OSL_ASSERT( aModuleTree.isValid());
-
- return aModuleTree.data().hasDefaultsAvailable();
- }
- // -----------------------------------------------------------------------------
- data::NodeAccess CacheLine::internalGetNode(memory::Accessor const & _anAccessor, Path const& aConfigName) const
-- {
-- OSL_ENSURE( m_base.is(), "Cannot get a node from a dataless module");
-+ {
-+ OSL_ENSURE( m_base != NULL, "Cannot get a node from a dataless module");
-
- data::TreeAccessor aModuleTree(_anAccessor, m_base);
- OSL_ASSERT( aModuleTree.isValid());
-@@ -196,7 +182,7 @@ namespace configmgr
-
- Path::Iterator it = aConfigName.begin();
- OSL_ENSURE( it != aConfigName.end(), "Empty Path can't match any module");
-- OSL_ENSURE( aNode.getName() == it->getInternalName(), "Module part in config path does not match selected CacheLine");
-+ OSL_ENSURE( aNode.isValid() && aNode.getName() == it->getInternalName(), "Module part in config path does not match selected CacheLine");
-
- // find child of node
- // might be done using a visitor
-@@ -209,10 +195,10 @@ namespace configmgr
- // -----------------------------------------------------------------------------
-
- data::NodeAddress CacheLine::getNode(memory::Accessor const & _aAccessor, Path const& aConfigName) const
-- {
-+ {
- data::NodeAccess aNode = internalGetNode(_aAccessor, aConfigName);
-- return aNode.address();
-- }
-+ return aNode;
-+ }
- // -------------------------------------------------------------------------
-
- data::TreeAddress CacheLine::setComponentData( memory::UpdateAccessor& _aAccessToken,
-@@ -223,9 +209,9 @@ namespace configmgr
- OSL_PRECOND(_aComponentInstance.data.get(), "CacheLine::insertDefaults: inserting NULL defaults !");
- OSL_PRECOND(_aComponentInstance.name == this->getModuleName(),"Data location does not match module");
-
-- OSL_PRECOND(!base().is(), "Data is already loaded");
-+ OSL_PRECOND(base() == NULL, "Data is already loaded");
-
-- if (!base().is()) // no data yet
-+ if (base() == NULL) // no data yet
- {
- this->setBase( data::buildTree(_aAccessToken, _aComponentInstance.data->getName(), *_aComponentInstance.data, _bWithDefaults) );
- }
-@@ -242,9 +228,9 @@ namespace configmgr
- OSL_PRECOND(_aDefaultInstance.root().isModuleRoot(), "Should have complete component to fill tree with defaults");
- OSL_PRECOND(_aDefaultInstance.root().getModuleName() == this->getModuleName(),"Data location does not match module");
-
-- OSL_PRECOND(m_base.is(), "Data must already be loaded to insert defaults");
-+ OSL_PRECOND(m_base != NULL, "Data must already be loaded to insert defaults");
-
-- if (m_base.is())
-+ if (m_base != NULL)
- {
- data::mergeDefaults(_aAccessToken,m_base,*_aDefaultInstance.data());
- }
-@@ -254,17 +240,17 @@ namespace configmgr
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
-- ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName, memory::HeapManager & _rHeapImpl)
-- : CacheLine(_aModuleName,_rHeapImpl)
-+ ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName)
-+ : CacheLine(_aModuleName)
- , m_pPending()
- {
- }
-
- // -----------------------------------------------------------------------------
-
-- ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aSegment)
-- : CacheLine(_aModuleName,_rHeapImpl,_aSegment)
-+ ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName,
-+ data::TreeAddress _aSegment)
-+ : CacheLine(_aModuleName,_aSegment)
- , m_pPending()
- {
- }
-@@ -272,8 +258,7 @@ namespace configmgr
- // -----------------------------------------------------------------------------
-
- ExtendedCacheLineRef ExtendedCacheLine::createAttached( Name const & _aModuleName,
-- memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aSegment
-+ data::TreeAddress _aSegment
- ) CFG_UNO_THROW_RTE( )
- {
- if (_aModuleName.isEmpty())
-@@ -281,20 +266,19 @@ namespace configmgr
- OSL_ENSURE(false, "Cannot make a cache line without a name");
- return NULL;
- }
-- if (_aSegment.isNull())
-+ if (_aSegment == NULL)
- {
- OSL_ENSURE(false, "Cannot attach a cache line to a NULL segment");
- return NULL;
- }
-
-- ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName,_rHeapImpl,_aSegment);
-+ ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName,_aSegment);
-
- return xResult;
- }
- // -----------------------------------------------------------------------------
-
-- ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName,
-- memory::HeapManager & _rHeapImpl
-+ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName
- ) CFG_UNO_THROW_RTE( )
- {
- if (_aModuleName.isEmpty())
-@@ -303,7 +287,7 @@ namespace configmgr
- return NULL;
- }
-
-- ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName,_rHeapImpl);
-+ ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName);
-
- return xResult;
- }
-Index: configmgr/source/treecache/cacheline.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cacheline.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 cacheline.hxx
---- configmgr/source/treecache/cacheline.hxx 8 Sep 2005 04:23:30 -0000 1.5
-+++ configmgr/source/treecache/cacheline.hxx 5 Jan 2007 22:25:45 -0000
-@@ -36,9 +36,6 @@
- #ifndef CONFIGMGR_CACHELINE_HXX
- #define CONFIGMGR_CACHELINE_HXX
-
--#ifndef CONFIGMGR_TREEADDRESS_HXX
--#include "treeaddress.hxx"
--#endif
- #ifndef CONFIGMGR_SEGMENT_HXX
- #include "segment.hxx"
- #endif
-@@ -51,6 +48,9 @@
- #ifndef CONFIGMGR_UTILITY_HXX_
- #include "utility.hxx"
- #endif
-+#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-+#include "treefragment.hxx"
-+#endif
-
- #ifndef _OSL_INTERLOCK_H_
- #include <osl/interlck.h>
-@@ -67,37 +67,31 @@ namespace configmgr
- ////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
-- namespace data { class NodeAddress; class TreeAddress; class NodeAccess; }
-+ namespace data {
-+ /* class NodeAddress; */ class NodeAccess;
-+ }
- ////////////////////////////////////////////////////////////////////////////////
- /** This object represents a cache line for a single configuration tree
- */
- class CacheLine : public salhelper::SimpleReferenceObject, Noncopyable
- {
- public:
-- typedef oslInterlockedCount RefCount;
--
- typedef configuration::Name Name;
- typedef configuration::AbsolutePath Path;
-
- // create a new CacheLine for the given component name
- static rtl::Reference<CacheLine>
-- createNew( Name const & _aModuleName, memory::HeapManager & _rHeapImpl );
-+ createNew( Name const & _aModuleName );
-
- // create a new CacheLine attached to the given memory location
- static rtl::Reference<CacheLine>
-- createAttached( Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aLocation );
--
-- memory::Segment * getDataSegment();
--
-- memory::SegmentAddress getDataSegmentAddress() const;
--
-- bool isEmpty() const { return m_base.isNull(); }
-+ createAttached( Name const & _aModuleName, data::TreeAddress _aLocation );
-
- bool hasDefaults(memory::Accessor const & _aAccessor) const;
-
-- data::TreeAddress getModuleRootAddress( ) const { return m_base; }
--
-+ bool isEmpty() const { return m_base == NULL; }
-+ memory::Segment *getDataSegment() { return &m_storage; }
-+ data::TreeAddress getTreeAddress() const { return m_base; }
- data::TreeAddress getPartialTree(memory::Accessor const & _aAccessor, Path const & _aTemplatePath ) const;
- data::NodeAddress getNode(memory::Accessor const & _aAccessor, Path const & _aPath) const;
-
-@@ -114,21 +108,20 @@ namespace configmgr
- Name getModuleName() const;
-
- /// add a client for this module's data
-- RefCount clientReferences() const { return m_nDataRefs; }
-+ oslInterlockedCount clientReferences() const { return m_nDataRefs; }
- /// add a client for this modules data
-- RefCount clientAcquire() { return osl_incrementInterlockedCount(&m_nDataRefs); }
-+ oslInterlockedCount clientAcquire() { return osl_incrementInterlockedCount(&m_nDataRefs); }
- /// subtract a client for this modules data
-- RefCount clientRelease() { return osl_decrementInterlockedCount(&m_nDataRefs); }
-+ oslInterlockedCount clientRelease() { return osl_decrementInterlockedCount(&m_nDataRefs); }
-
- protected:
- // create a new CacheLine attached to the given memory location
- explicit
-- CacheLine( Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aLocation );
-+ CacheLine( Name const & _aModuleName, data::TreeAddress _pLocation );
-
- // create a new empty CacheLine for the given component name
- explicit
-- CacheLine( Name const & _aModuleName, memory::HeapManager & _rHeapImpl );
-+ CacheLine( Name const & _aModuleName );
-
- data::NodeAccess internalGetNode(memory::Accessor const & _anAccessor, Path const & _rPath) const;
-
-@@ -152,12 +145,12 @@ namespace configmgr
- public:
- // create a new CacheLine for the given component name
- static rtl::Reference<ExtendedCacheLine>
-- createNew( Name const & _aModuleName, memory::HeapManager & _rHeapImpl );
-+ createNew( Name const & _aModuleName );
-
- // create a new CacheLine attached to the given memory location
- static rtl::Reference<ExtendedCacheLine>
-- createAttached( Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aLocation );
-+ createAttached( Name const & _aModuleName,
-+ data::TreeAddress _aLocation );
-
- // management of pending changes
- bool hasPending() const {return m_pPending.get() != NULL;}
-@@ -168,24 +161,17 @@ namespace configmgr
- private:
- // create a new empty CacheLine for the given component name
- explicit
-- ExtendedCacheLine( Name const & _aModuleName, memory::HeapManager & _rHeapImpl );
-+ ExtendedCacheLine( Name const & _aModuleName );
-
- // create a new CacheLine attached to the given memory location
- explicit
-- ExtendedCacheLine( Name const & _aModuleName, memory::HeapManager & _rHeapImpl,
-- memory::SegmentAddress const & _aLocation );
-+ ExtendedCacheLine( Name const & _aModuleName,
-+ data::TreeAddress _aLocation );
-
- private:
- std::auto_ptr<SubtreeChange> m_pPending;
- };
- typedef rtl::Reference<ExtendedCacheLine> ExtendedCacheLineRef;
--////////////////////////////////////////////////////////////////////////////////
--
-- inline
-- memory::Segment * CacheLine::getDataSegment()
-- { return &m_storage; }
--
--////////////////////////////////////////////////////////////////////////////////
-
- } // namespace configmgr
-
-Index: configmgr/source/treecache/cachewritescheduler.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachewritescheduler.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 cachewritescheduler.cxx
---- configmgr/source/treecache/cachewritescheduler.cxx 16 Sep 2006 15:26:03 -0000 1.8
-+++ configmgr/source/treecache/cachewritescheduler.cxx 5 Jan 2007 22:25:45 -0000
-@@ -147,12 +147,14 @@ void OCacheWriteScheduler::runWriter()
- // -----------------------------------------------------------------------------
- void OCacheWriteScheduler::writeOneTreeFoundByOption(RequestOptions const& _aOptions) CFG_UNO_THROW_ALL( )
- {
-- CFG_TRACE_INFO("Writeing one cache tree for user '%s' with locale '%s'",
-- OUSTRING2ASCII(_aOptions.getEntity()),
-- OUSTRING2ASCII(_aOptions.getLocale()));
-+ CFG_TRACE_INFO("Writeing one cache tree for user '%s' with locale '%s'",
-+ OUSTRING2ASCII(_aOptions.getEntity()),
-+ OUSTRING2ASCII(_aOptions.getLocale()));
-+
-+ // PRE: m_aUpdateMutex of TreeMgr must be acuired
-+ backend::CacheController::CacheRef aCache;
-+ aCache = m_rTreeManager.m_aCacheMap.get(_aOptions);
-
-- // PRE: m_aUpdateMutex of TreeMgr must be acuired
-- CacheManager::CacheRef aCache = m_rTreeManager.m_aCacheList.get(_aOptions);
- if (aCache.is())
- {
- CFG_TRACE_INFO_NI("- Found matching data container - starting write task");
-Index: configmgr/source/treecache/cachewritescheduler.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/cachewritescheduler.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 cachewritescheduler.hxx
---- configmgr/source/treecache/cachewritescheduler.hxx 8 Sep 2005 04:24:23 -0000 1.5
-+++ configmgr/source/treecache/cachewritescheduler.hxx 5 Jan 2007 22:25:45 -0000
-@@ -73,7 +73,6 @@ namespace configmgr
- class OCacheWriteScheduler
- {
- typedef std::set< RequestOptions, lessRequestOptions > CacheWriteList; // fire and forget!
-- typedef backend::CacheController CacheManager;
-
- class Timer : public vos::OTimer
- {
-@@ -98,18 +97,16 @@ namespace configmgr
- };
- friend void Timer::onShot();
- private:
-- mutable osl::Mutex m_aMutex;
-- vos::ORef<Timer> m_xTimer;
-- CacheManager& m_rTreeManager;
--
-- CacheWriteList m_aWriteList;
--
-- TimeInterval m_aWriteInterval;
-+ mutable osl::Mutex m_aMutex;
-+ vos::ORef<Timer> m_xTimer;
-+ backend::CacheController &m_rTreeManager;
-+ CacheWriteList m_aWriteList;
-+ TimeInterval m_aWriteInterval;
-
- public:
- //-------- Construction and destruction -----------------------------------
- explicit
-- OCacheWriteScheduler(CacheManager& _rTreeManager, TimeInterval const& _aWriteInterval)
-+ OCacheWriteScheduler(backend::CacheController& _rTreeManager, TimeInterval const& _aWriteInterval)
- : m_rTreeManager(_rTreeManager)
- , m_aWriteInterval(_aWriteInterval)
- {
-Index: configmgr/source/treecache/disposetimer.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/disposetimer.cxx,v
-retrieving revision 1.22
-diff -u -p -u -r1.22 disposetimer.cxx
---- configmgr/source/treecache/disposetimer.cxx 16 Sep 2006 15:26:19 -0000 1.22
-+++ configmgr/source/treecache/disposetimer.cxx 5 Jan 2007 22:25:45 -0000
-@@ -205,10 +205,10 @@ void OTreeDisposeScheduler::onTimerShot(
- // this really should be a member of the TreeManager (see TreeManager::disposeOne etc.)
- TimeStamp OTreeDisposeScheduler::runDisposer(TimeStamp const& _aActualTime)
- {
-- TimeStamp aNextTime = TimeStamp::never();
-- OSL_ASSERT(aNextTime.isNever());
-+ TimeStamp aNextTime = TimeStamp::never();
-+ OSL_ASSERT(aNextTime.isNever());
-
-- osl::ClearableMutexGuard aGuard( m_rTreeManager.m_aCacheList.mutex() );
-+ osl::ClearableMutexGuard aGuard( m_rTreeManager.m_aCacheMap.mutex() );
-
- Task aTask = this->getTask( _aActualTime, aNextTime );
- if (aTask.first)
-@@ -219,7 +219,7 @@ TimeStamp OTreeDisposeScheduler::runDisp
- OUSTRING2ASCII(rTaskOptions.getEntity()),
- OUSTRING2ASCII(rTaskOptions.getLocale()));
-
-- CacheManager::CacheRef aCache = m_rTreeManager.m_aCacheList.get(rTaskOptions);
-+ CacheManager::CacheRef aCache = m_rTreeManager.m_aCacheMap.get(rTaskOptions);
- if (aCache.is())
- {
- CFG_TRACE_INFO_NI("- Found matching data container (TreeInfo) - collecting data");
-Index: configmgr/source/treecache/invalidatetree.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/invalidatetree.cxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 invalidatetree.cxx
---- configmgr/source/treecache/invalidatetree.cxx 16 Sep 2006 15:26:33 -0000 1.21
-+++ configmgr/source/treecache/invalidatetree.cxx 5 Jan 2007 22:25:45 -0000
-@@ -193,11 +193,11 @@ void CacheController::invalidateComponen
-
- CacheLocation CacheController::refreshComponent(ComponentRequest const & _aRequest) CFG_UNO_THROW_ALL()
- {
-- if (m_bDisposing) return CacheLocation();
-+ if (m_bDisposing) return NULL;
-
- CacheRef aCache = this->getCacheAlways(_aRequest.getOptions());
-
-- if (!aCache.is()) return CacheLocation();
-+ if (!aCache.is()) return NULL;
-
- osl::MutexGuard aCacheLineGuard(aCache->mutex());
-
-@@ -210,37 +210,35 @@ CacheLocation CacheController::refreshCo
- NodeInstance aNodeInstance(aLoadedInstance.mutableInstance().mutableData(),aRequestPath) ;
- NodeResult aLoadedNodeInstance(aNodeInstance) ;
-
-- CacheLocation aResult;
-- if (aLoadedNodeInstance.is())
-- {
-+ data::TreeAddress aResult = NULL;
-+ if (aLoadedNodeInstance.is())
-+ {
- Name aModuleName = aLoadedNodeInstance->root().getModuleName();
-
- memory::UpdateAccessor aChangingAccessor( aCache->getDataSegment(aModuleName) );
- OSL_ENSURE(aChangingAccessor.is(), "No existing cache line for tree being refreshed");
-
-- data::TreeAddress aCachedTreeAddress = aCache->acquireModule(aModuleName);
--
-- aResult.segment = aCache->getDataSegmentAddress(aModuleName);
-- aResult.address = aCachedTreeAddress.addressValue();
-+ bool bAcquired = aCache->acquireModule(aModuleName);
-+ aResult = CacheLocation( aCache->getTreeAddress(aModuleName) );
-
-- if (aCachedTreeAddress.is())
-+ if (bAcquired)
- try
-- {
-+ {
- std::auto_ptr<SubtreeChange> aTreeChanges;
- data::NodeAddress aRootAddress;
-
- {
-- data::TreeAccessor aTreeAccess(aChangingAccessor.accessor(),aCachedTreeAddress);
-+ data::TreeAccessor aTreeAccess(aChangingAccessor.accessor(),aResult);
- data::NodeAccessRef aRootNode = aTreeAccess.getRootNode();
-
- aTreeChanges = createDiffs(aRootNode, aLoadedNodeInstance->data().get(), aLoadedNodeInstance->root().location());
-- aRootAddress = aRootNode.address();
-+ aRootAddress = aRootNode;
- }
-
- if (aTreeChanges.get() != NULL)
- {
-- // change all Values... found in the Subtree in the CacheTree
-- applyUpdateWithAdjustmentToTree(*aTreeChanges, aChangingAccessor, aRootAddress);
-+ // change all Values... found in the Subtree in the CacheTree
-+ applyUpdateWithAdjustmentToTree(*aTreeChanges, aChangingAccessor, aRootAddress);
-
- data::Accessor aNotifyLock = aChangingAccessor.downgrade(); // keep a read lock during notification
-
-@@ -251,15 +249,14 @@ CacheLocation CacheController::refreshCo
-
- m_aNotifier.notifyChanged(anUpdateReq);
- }
--
-- aCache->releaseModule(aModuleName);
-+ aCache->releaseModule(aModuleName);
- }
- catch (...)
- {
-- aCache->releaseModule(aModuleName);
-+ aCache->releaseModule(aModuleName);
- throw;
- }
-- }
-+ }
- return aResult;
- }
-
-Index: configmgr/source/treecache/treemanager.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treecache/treemanager.cxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 treemanager.cxx
---- configmgr/source/treecache/treemanager.cxx 16 Sep 2006 15:27:00 -0000 1.11
-+++ configmgr/source/treecache/treemanager.cxx 5 Jan 2007 22:25:45 -0000
-@@ -241,10 +241,10 @@ ConfigChangeBroadcastHelper* TreeManager
-
-
- // -------------------------------------------------------------------------
--TreeManager::TreeManager(BackendCacheRef const & _xBackend, memory::HeapManager & _rCacheHeapManager)
-+TreeManager::TreeManager(BackendCacheRef const & _xBackend)
- : m_xCacheController(_xBackend)
- , m_aCacheList()
--, m_aTemplates(new CacheData(_rCacheHeapManager))
-+, m_aTemplates(new CacheData())
- , m_bEnableAsync(true)
- {
- OSL_PRECOND(_xBackend.is(),"Trying to create a TreeManager without a backend");
-@@ -293,12 +293,6 @@ void TreeManager::disposeBackendCache()
-
- // -------------------------------------------------------------------------
-
--memory::HeapManager & TreeManager::getCacheHeapManager() const
--{
-- return m_aTemplates.get()->getHeapManager();
--}
--// -------------------------------------------------------------------------
--
- TreeManager::CacheRef TreeManager::getCacheAlways(RequestOptions const & _aOptions)
- {
- osl::MutexGuard aGuard( m_aCacheList.mutex() );
-@@ -306,7 +300,7 @@ TreeManager::CacheRef TreeManager::getCa
- CacheRef aResult = m_aCacheList.get(_aOptions);
- if (!aResult.is())
- {
-- CacheRef aNewCache( new Cache(getCacheHeapManager(), ConfigChangeBroadcaster::newBroadcastHelper()) );
-+ CacheRef aNewCache( new Cache(ConfigChangeBroadcaster::newBroadcastHelper()) );
- aResult = m_aCacheList.insert(_aOptions,aNewCache);
- }
- return aResult;
-@@ -329,37 +323,37 @@ memory::Segment* TreeManager::getDataSeg
- // -------------------------------------------------------------------------
-
- data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
-- const RequestOptions& _aOptions)
-- CFG_UNO_THROW_ALL( )
-+ const RequestOptions& _aOptions)
-+ CFG_UNO_THROW_ALL()
- {
-- CFG_TRACE_INFO("TreeManager: request for subtree '%s'", OUSTRING2ASCII(aSubtreePath.toString()));
-+ CFG_TRACE_INFO("TreeManager: request for subtree '%s'", OUSTRING2ASCII(aSubtreePath.toString()));
-
- CacheRef aCache = getCacheAlways(_aOptions);
-- OSL_ENSURE(aCache.is(),"TreeManager: Cannot create cache access for loading node");
-+ OSL_ENSURE(aCache.is(),"TreeManager: Cannot create cache access for loading node");
-
- data::Accessor aAccessor(NULL);
-
- if (!aCache->hasModule(aSubtreePath))
- {
-- CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the node");
-+ CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the node");
- backend::ComponentRequest aQuery( aSubtreePath.getModuleName(), _aOptions );
-
- backend::CacheLocation aLoadedLocation = getCacheLoader()->loadComponent(aQuery);
-- if (aLoadedLocation.isNull())
-+ if (aLoadedLocation == NULL)
- {
-- CFG_TRACE_WARNING_NI("TreeManager: requested component not found");
-+ CFG_TRACE_WARNING_NI("TreeManager: requested component not found");
- throw com::sun::star::container::
- NoSuchElementException( MAKEUSTRING("Requested component not found"), NULL);
- }
-
-- CFG_TRACE_INFO_NI("TreeManager: attaching loaded cache segment ");
-+ CFG_TRACE_INFO_NI("TreeManager: attaching loaded cache segment ");
-
-- aAccessor = data::Accessor(aCache->attachDataSegment(aLoadedLocation.segment,aSubtreePath));
-+ aAccessor = data::Accessor(aCache->attachDataSegment(aLoadedLocation,aSubtreePath));
- OSL_ENSURE(aAccessor.is(),"Cannot attach to loaded component");
- }
- else
-- {
-- CFG_TRACE_INFO_NI("TreeManager: found node in cache");
-+ {
-+ CFG_TRACE_INFO_NI("TreeManager: found node in cache");
- if (_aOptions.isRefreshEnabled())
- {
- backend::ComponentRequest aRequest( aSubtreePath.getModuleName(), _aOptions );
-@@ -368,7 +362,6 @@ data::NodeAccess TreeManager::requestSub
-
- aAccessor = data::Accessor(aCache->getDataSegment(aSubtreePath));
- OSL_ENSURE(aAccessor.is(),"Cannot get accessor for existing component");
--
- }
-
- data::NodeAddress aResultAddress = aCache->acquireNode(aAccessor,aSubtreePath);
-@@ -380,28 +373,28 @@ data::NodeAccess TreeManager::requestSub
- void TreeManager::fetchSubtree(AbsolutePath const& aSubtreePath, const RequestOptions& ) CFG_NOTHROW()
- {
- (void) aSubtreePath; // avoid warning about unused parameter
-- CFG_TRACE_WARNING("TreeManager: Prefetching not implemented. (Request to prefetch component %s.", OUSTRING2ASCII(aSubtreePath.toString()));
-+ CFG_TRACE_WARNING("TreeManager: Prefetching not implemented. (Request to prefetch component %s.", OUSTRING2ASCII(aSubtreePath.toString()));
- }
-
- // -------------------------------------------------------------------------
- sal_Bool TreeManager::fetchDefaultData( memory::UpdateAccessor& _aAccessToken,
- AbsolutePath const& aSubtreePath,
-- const RequestOptions& _aOptions
-- ) CFG_UNO_THROW_ALL( )
-+ const RequestOptions& _aOptions
-+ ) CFG_UNO_THROW_ALL()
- {
-- CFG_TRACE_INFO("tree manager: checking the cache for defaults");
-+ CFG_TRACE_INFO("tree manager: checking the cache for defaults");
-
- CacheRef aCache = m_aCacheList.get(_aOptions);
-
- if (!aCache.is())
- {
-- OSL_ENSURE(aCache.is(),"TreeManager: Cache access to fetch defaults for does not exist ! Where does the node access come from ?");
-+ OSL_ENSURE(aCache.is(),"TreeManager: Cache access to fetch defaults for does not exist ! Where does the node access come from ?");
- return false;
- }
-
- if (aCache->hasModuleDefaults(_aAccessToken.accessor(),aSubtreePath))
- {
-- CFG_TRACE_INFO_NI("TreeManager: found default data in cache");
-+ CFG_TRACE_INFO_NI("TreeManager: found default data in cache");
- return true;
- }
-
-@@ -412,15 +405,15 @@ sal_Bool TreeManager::fetchDefaultData(
- backend::NodeResult aDefaults = getCacheLoader()->getDirectDataProvider().getDefaultData( aRequest );
-
- if (!aDefaults.is())
-- {
-- CFG_TRACE_INFO_NI("TreeManager: merging loaded defaults into cache");
-+ {
-+ CFG_TRACE_INFO_NI("TreeManager: merging loaded defaults into cache");
- return aCache->insertDefaults(_aAccessToken,aDefaults.instance());
-- }
-- else
-- {
-+ }
-+ else
-+ {
- CFG_TRACE_WARNING_NI("TreeManager: cannot load defaults: no data available or not supported");
- return false;
-- }
-+ }
- }
-
- // -------------------------------------------------------------------------
-@@ -429,7 +422,7 @@ std::auto_ptr<ISubtree> TreeManager::req
- ) CFG_UNO_THROW_ALL( )
- {
- // to do: check cache for existing default data (?!)
-- CFG_TRACE_INFO_NI("TreeManager: loading default data directly");
-+ CFG_TRACE_INFO_NI("TreeManager: loading default data directly");
-
- backend::NodeRequest aRequest(aSubtreePath,_aOptions);
-
-@@ -453,7 +446,7 @@ AbsolutePath TreeManager::encodeTemplate
- aResult.prepend(aTemplateModule);
- // aResult.prepend(aTemplateRoot);
-
-- return AbsolutePath(aResult);
-+ return AbsolutePath(aResult);
- }
-
- // -------------------------------------------------------------------------
-@@ -476,33 +469,33 @@ data::TreeAccessor TreeManager::requestT
- {
- aTemplatesAccessor.clear();
-
-- CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the template");
-+ CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the template");
- backend::TemplateRequest aQuery( _rName, _rModule );
-
- backend::CacheLocation aLoadedLocation = getCacheLoader()->loadTemplate(aQuery);
-- if (aLoadedLocation.isNull())
-+ if (aLoadedLocation == NULL)
- {
-- CFG_TRACE_ERROR_NI("TreeManager: requested template module not found");
-+ CFG_TRACE_ERROR_NI("TreeManager: requested template module not found");
- throw com::sun::star::container::
- NoSuchElementException( MAKEUSTRING("Requested template module not found"), NULL);
- }
-
-- CFG_TRACE_INFO_NI("TreeManager: attaching to loaded template module");
-+ CFG_TRACE_INFO_NI("TreeManager: attaching to loaded template module");
-
-- aTemplatesAccessor = data::Accessor(getTemplates().attachDataSegment(aLoadedLocation.segment,aCacheModule));
-+ aTemplatesAccessor = data::Accessor(getTemplates().attachDataSegment(aLoadedLocation,aCacheModule));
- OSL_ENSURE(aTemplatesAccessor.is(),"Cannot attach to loaded component");
-
- // create a client ref count on the template module
- getTemplates().acquireNode(aTemplatesAccessor,aTemplateLocation);
- }
- else
-- {
-- CFG_TRACE_INFO_NI("TreeManager: template module found in cache");
-+ {
-+ CFG_TRACE_INFO_NI("TreeManager: template module found in cache");
- OSL_ENSURE(aTemplatesAccessor.is(),"No accessor for existing data ?");
- }
-
- data::TreeAddress aTemplateAddr = getTemplates().getTemplateTree(aTemplatesAccessor,aTemplateLocation);
-- if (aTemplateAddr.isNull())
-+ if (aTemplateAddr == NULL)
- {
- CFG_TRACE_ERROR_NI("TreeManager: template not found in module");
- throw com::sun::star::container::
-@@ -635,31 +628,31 @@ void TreeManager::disposeData(const Requ
- // ----------------------------------------------------------------------------
- void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
- {
-- CFG_TRACE_INFO("TreeManager: nodeUpdated");
-- try
-- {
-- CacheRef aCache = m_aCacheList.get(_rChanges.getOptions());
-+ CFG_TRACE_INFO("TreeManager: nodeUpdated");
-+ try
-+ {
-+ CacheRef aCache = m_aCacheList.get(_rChanges.getOptions());
-
-- if (aCache.is())
-- {
-- // first approve the changes and merge them with the current tree
-- AbsolutePath aSubtreeName = _rChanges.getRootNodePath();
-+ if (aCache.is())
-+ {
-+ // first approve the changes and merge them with the current tree
-+ AbsolutePath aSubtreeName = _rChanges.getRootNodePath();
-
- memory::Accessor aAccessor( aCache->getDataSegment(aSubtreeName) );
- OSL_ENSURE(aAccessor.is(), "TreeManager::nodeUpdated : cannot access cache !");
-
- data::NodeAddress aCacheTree = aCache->findInnerNode(aAccessor,aSubtreeName);
-- OSL_ENSURE(aCacheTree.is(), "TreeManager::nodeUpdated : node not found in cache!");
-+ OSL_ENSURE(aCacheTree != NULL, "TreeManager::nodeUpdated : node not found in cache!");
-
-- if (aCacheTree.is())
-- this->fireChanges(aAccessor,_rChanges,false);
-- }
-- }
-- catch (uno::RuntimeException&)
-- {
-- CFG_TRACE_ERROR_NI("TreeManager::nodeUpdated : could not notify !");
-- }
-- CFG_TRACE_INFO_NI("TreeManager: nodeUpdated done");
-+ if (aCacheTree != NULL)
-+ this->fireChanges(aAccessor,_rChanges,false);
-+ }
-+ }
-+ catch (uno::RuntimeException&)
-+ {
-+ CFG_TRACE_ERROR_NI("TreeManager::nodeUpdated : could not notify !");
-+ }
-+ CFG_TRACE_INFO_NI("TreeManager: nodeUpdated done");
- }
-
- // ----------------------------------------------------------------------------
-Index: configmgr/source/treemgr/groupnodeimpl.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/groupnodeimpl.hxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 groupnodeimpl.hxx
---- configmgr/source/treemgr/groupnodeimpl.hxx 8 Sep 2005 04:29:29 -0000 1.6
-+++ configmgr/source/treemgr/groupnodeimpl.hxx 5 Jan 2007 22:25:45 -0000
-@@ -89,15 +89,15 @@ namespace configmgr
- class GroupNodeImpl : public NodeImpl
- {
- public:
-- explicit GroupNodeImpl(data::GroupNodeAddress const& _aNodeRef);
-+ explicit GroupNodeImpl(data::GroupNodeAddress _pNodeRef);
-
- typedef data::GroupNodeAccess DataAccess;
-
-- DataAccess getDataAccess(data::Accessor const& _aAccessor) const;
-+ DataAccess getDataAccess(memory::Accessor const& _aAccessor) const;
-
-- bool areValueDefaultsAvailable(data::Accessor const& _aAccessor) const;
-+ bool areValueDefaultsAvailable(memory::Accessor const& _aAccessor) const;
-
-- data::ValueNodeAccess getOriginalValueNode(data::Accessor const& _aAccessor, Name const& aName) const;
-+ data::ValueNodeAccess getOriginalValueNode(memory::Accessor const& _aAccessor, Name const& aName) const;
-
- ValueMemberNode makeValueMember(data::ValueNodeAccess const& _aValueNode);
- };
-Index: configmgr/source/treemgr/nodefactory.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/nodefactory.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 nodefactory.cxx
---- configmgr/source/treemgr/nodefactory.cxx 16 Sep 2006 15:30:03 -0000 1.7
-+++ configmgr/source/treemgr/nodefactory.cxx 5 Jan 2007 22:25:45 -0000
-@@ -97,19 +97,19 @@ namespace
-
- NodeImplHolder BasicNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
- {
-- return new configuration::ValueElementNodeImpl(_aNodeAccess.address());
-+ return new configuration::ValueElementNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder BasicNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
- {
-- return new configuration::GroupNodeImpl(_aNodeAccess.address());
-+ return new configuration::GroupNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder BasicNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
- {
-- return new configuration::SetNodeImpl(_aNodeAccess.address(),pTemplate);
-+ return new configuration::SetNodeImpl(_aNodeAccess,pTemplate);
- }
- //-------------------------------------------------------------------------
-
-@@ -125,22 +125,22 @@ namespace
-
- NodeImplHolder DirectNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
- {
-- return new DirectValueElementNodeImpl(_aNodeAccess.address());
-+ return new DirectValueElementNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder DirectNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
- {
-- return new DirectGroupNodeImpl(_aNodeAccess.address());
-+ return new DirectGroupNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder DirectNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
- {
- if (isTreeSet(_aNodeAccess,pTemplate))
-- return new DirectTreeSetNodeImpl(_aNodeAccess.address(),pTemplate);
-+ return new DirectTreeSetNodeImpl(_aNodeAccess,pTemplate);
- else
-- return new DirectValueSetNodeImpl(_aNodeAccess.address(),pTemplate);
-+ return new DirectValueSetNodeImpl(_aNodeAccess,pTemplate);
- }
- //-------------------------------------------------------------------------
- */
-@@ -148,28 +148,28 @@ namespace
-
- struct DeferredNodeFactory : NodeFactory
- {
-- NodeImplHolder makeValueNode(ValueNodeAccess const& _aNodeAccess);
-- NodeImplHolder makeGroupNode(GroupNodeAccess const& _aNodeAccess);
-- NodeImplHolder makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate);
-+ NodeImplHolder makeValueNode(ValueNodeAccess const& _aNodeAccess);
-+ NodeImplHolder makeGroupNode(GroupNodeAccess const& _aNodeAccess);
-+ NodeImplHolder makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate);
- };
- //-------------------------------------------------------------------------
-
- NodeImplHolder DeferredNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
- {
- // OSL_ENSURE(false, "Wrong factory for value elements - should be immutable (=read-only)");
-- return new configuration::ValueElementNodeImpl(_aNodeAccess.address());
-+ return new configuration::ValueElementNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder DeferredNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
- {
-- return new configuration::DeferredGroupNodeImpl(_aNodeAccess.address());
-+ return new configuration::DeferredGroupNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- NodeImplHolder DeferredNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
- {
-- return new configuration::DeferredSetNodeImpl(_aNodeAccess.address(),pTemplate);
-+ return new configuration::DeferredSetNodeImpl(_aNodeAccess,pTemplate);
- }
- //-------------------------------------------------------------------------
-
-Index: configmgr/source/treemgr/nodeimpl.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/nodeimpl.cxx,v
-retrieving revision 1.24
-diff -u -p -u -r1.24 nodeimpl.cxx
---- configmgr/source/treemgr/nodeimpl.cxx 16 Sep 2006 15:30:17 -0000 1.24
-+++ configmgr/source/treemgr/nodeimpl.cxx 5 Jan 2007 22:25:45 -0000
-@@ -91,7 +91,7 @@ namespace configmgr
- /// provide access to the data of the underlying node
- data::NodeAccessRef NodeImpl::getOriginalNodeAccessRef(data::Accessor const * _pAccessor) const
- {
-- return data::NodeAccessRef(_pAccessor,m_aNodeRef_);
-+ return data::NodeAccessRef(_pAccessor,m_pNodeRef);
- }
- //-----------------------------------------------------------------------------
-
-@@ -117,8 +117,8 @@ data::GroupNodeAccess GroupNodeImpl::get
- }
- //-----------------------------------------------------------------------------
-
--GroupNodeImpl::GroupNodeImpl(data::GroupNodeAddress const& _aNodeRef)
--: NodeImpl(_aNodeRef)
-+GroupNodeImpl::GroupNodeImpl(data::GroupNodeAddress _pNodeRef)
-+: NodeImpl(reinterpret_cast<data::NodeAddress>(_pNodeRef))
- {
- }
- //-----------------------------------------------------------------------------
-@@ -167,7 +167,7 @@ data::ValueNodeAccess ValueElementNodeIm
- //-----------------------------------------------------------------------------
-
- ValueElementNodeImpl::ValueElementNodeImpl(data::ValueNodeAddress const& _aNodeRef)
--: NodeImpl(_aNodeRef)
-+ : NodeImpl(reinterpret_cast<data::NodeAddress>(_aNodeRef))
- {
- }
- //-----------------------------------------------------------------------------
-Index: configmgr/source/treemgr/nodeimpl.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/nodeimpl.hxx,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 nodeimpl.hxx
---- configmgr/source/treemgr/nodeimpl.hxx 8 Sep 2005 04:31:49 -0000 1.14
-+++ configmgr/source/treemgr/nodeimpl.hxx 5 Jan 2007 22:25:45 -0000
-@@ -39,8 +39,8 @@
- #ifndef CONFIGMGR_CONFIGURATION_ATTRIBUTES_HXX_
- #include "attributes.hxx"
- #endif
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#include "nodeaddress.hxx"
-+#ifndef INCLUDED_SHARABLE_NODE_HXX
-+#include "node.hxx"
- #endif
-
- #ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
-@@ -57,48 +57,44 @@ namespace configmgr
- namespace data { class NodeAccessRef; }
- namespace view { class ViewStrategy; }
- //-----------------------------------------------------------------------------
-- namespace configuration
-- {
--//-----------------------------------------------------------------------------
-- typedef unsigned int NodeOffset;
--
-- class TreeImpl;
-+ namespace configuration
-+ {
-+ //-----------------------------------------------------------------------------
-+ typedef unsigned int NodeOffset;
-+
-+ class TreeImpl;
-+
-+ class Name;
-+
-+ class NodeChange;
-+ class NodeChanges;
-+ class NodeChangesInformation;
-
-- class Name;
--
-- class NodeChange;
-- class NodeChanges;
-- class NodeChangesInformation;
- //-----------------------------------------------------------------------------
--
- // Specific types of nodes
- //-----------------------------------------------------------------------------
-
- class NodeImpl;
-- typedef rtl::Reference<NodeImpl> NodeImplHolder;
-+ typedef rtl::Reference<NodeImpl> NodeImplHolder;
-+ struct INodeHandler;
-
-- struct INodeHandler;
--
-- // Almost an interface, but derives from concrete OReference
-- class NodeImpl : public salhelper::SimpleReferenceObject
-- {
-- friend class view::ViewStrategy;
-- data::NodeAddress m_aNodeRef_;
-- public:
-- NodeImpl(data::NodeAddress const & _aNodeRef)
-- : m_aNodeRef_(_aNodeRef)
-- {}
--
-- public:
--// void directCommitChanges(memory::Accessor const& _aAccessor) { doCommitChanges(_aAccessor); }
--
-- /// provide access to the address of the underlying node
-- data::NodeAddress getOriginalNodeAddress() const
-- { return m_aNodeRef_; }
--
-- /// provide access to the data of the underlying node
-- data::NodeAccessRef getOriginalNodeAccessRef(memory::Accessor const * _pAccessor) const;
-- };
-+ // Almost an interface, but derives from concrete OReference
-+ class NodeImpl : public salhelper::SimpleReferenceObject
-+ {
-+ friend class view::ViewStrategy;
-+ data::NodeAddress m_pNodeRef;
-+ public:
-+ NodeImpl(data::NodeAddress _pNodeRef)
-+ : m_pNodeRef(_pNodeRef) {}
-+
-+ public:
-+ /// provide access to the address of the underlying node
-+ data::NodeAddress getOriginalNodeAddress() const
-+ { return m_pNodeRef; }
-+
-+ /// provide access to the data of the underlying node
-+ data::NodeAccessRef getOriginalNodeAccessRef(memory::Accessor const * _pAccessor) const;
-+ };
-
- //-----------------------------------------------------------------------------
- class ValueElementNodeImpl;
-Index: configmgr/source/treemgr/nodeimplobj.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/nodeimplobj.cxx,v
-retrieving revision 1.24
-diff -u -p -u -r1.24 nodeimplobj.cxx
---- configmgr/source/treemgr/nodeimplobj.cxx 16 Sep 2006 15:30:31 -0000 1.24
-+++ configmgr/source/treemgr/nodeimplobj.cxx 5 Jan 2007 22:25:46 -0000
-@@ -201,24 +201,6 @@ DeferredGroupNodeImpl::MemberChange Defe
- }
-
- //-----------------------------------------------------------------------------
--/*
--void DeferredGroupNodeImpl::doCommitChanges(data::Accessor const& _aAccessor)
--{
-- for (ValueChanges::iterator pos = m_aChanges.begin(); pos != m_aChanges.end(); )
-- {
-- ValueChanges::iterator it = pos++; // this is used to allow erasing below
-- if (it->second.is())
-- {
-- it->second->commitDirect(_aAccessor);
-- m_aChanges.erase(it); // this goes here to ensure exception safety
-- }
-- else
-- OSL_ASSERT(it->first.isEmpty());
-- }
-- m_aChanges.clear();
--}
--*/
--//-----------------------------------------------------------------------------
-
- std::auto_ptr<SubtreeChange> DeferredGroupNodeImpl::preCommitValueChanges(data::Accessor const& _aAccessor)
- {
-@@ -512,7 +494,7 @@ void DeferredSetNodeImpl::collectElement
- if (m_aChangedData.getElement(it->first) == 0)
- {
- OSL_ASSERT(it->second.isValid());
-- view::ViewTreeAccess aElementView(_aAccessor, *it->second);
-+ view::ViewTreeAccess aElementView(_aAccessor, *it->second);
-
- if (aElementView.hasChanges())
- aElementView.collectChanges(rChanges);
-@@ -876,8 +858,8 @@ void DeferredSetNodeImpl::failedCommit(d
-
- if (rAddNode.wasInserted())
- { // it has been integrated into the master tree
-- OSL_ENSURE(getDataAccess(_aAccessor).getElementTree(aElementName).address() == rAddNode.getInsertedTree(),
-- "Internal Error: Inserted tree address does not match actual data");
-+ OSL_ENSURE(getDataAccess(_aAccessor).getElementTree(aElementName) == rAddNode.getInsertedTree(),
-+ "Internal Error: Inserted tree address does not match actual data");
-
- // so add it
- if (aOriginal.isValid())
-Index: configmgr/source/treemgr/nodeimplobj.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/nodeimplobj.hxx,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 nodeimplobj.hxx
---- configmgr/source/treemgr/nodeimplobj.hxx 19 Jun 2006 23:33:36 -0000 1.14
-+++ configmgr/source/treemgr/nodeimplobj.hxx 5 Jan 2007 22:25:46 -0000
-@@ -36,6 +36,9 @@
- #ifndef CONFIGMGR_NODEIMPLOBJECTS_HXX_
- #define CONFIGMGR_NODEIMPLOBJECTS_HXX_
-
-+#ifndef INCLUDED_SHARABLE_NODE_HXX
-+#include "node.hxx"
-+#endif
- #ifndef CONFIGMGR_CONFIGNODEBEHAVIOR_HXX_
- #include "nodeimpl.hxx"
- #endif
-@@ -48,9 +51,6 @@
- #ifndef CONFIGMGR_VALUENODEBEHAVIOR_HXX_
- #include "valuenodeimpl.hxx"
- #endif
--#ifndef CONFIGMGR_NODEADDRESS_HXX
--#include "nodeaddress.hxx"
--#endif
-
- #ifndef _SALHELPER_SIMPLEREFERENCEOBJECT_HXX_
- #include <salhelper/simplereferenceobject.hxx>
-@@ -63,8 +63,8 @@
-
- namespace configmgr
- {
-- namespace configuration
-- {
-+ namespace configuration
-+ {
- //-----------------------------------------------------------------------------
-
- // Specific types of nodes for direct or read only access
-@@ -74,21 +74,21 @@ namespace configmgr
- //-----------------------------------------------------------------------------
-
- class ValueMemberNode::DeferredImpl : public salhelper::SimpleReferenceObject
-- {
-+ {
- data::ValueNodeAddress m_aValueRef;
-
- UnoAny m_aNewValue;
- bool m_bToDefault;
- bool m_bChange;
- public:
-- explicit DeferredImpl(data::ValueNodeAccess const& _aValueNode) ;
-+ explicit DeferredImpl(data::ValueNodeAccess const& _aValueNode);
-
- /// does this wrap a change
- bool isChange() const { return m_bChange; }
-
- /// retrieve the underlying (original) node location
- data::ValueNodeAddress getOriginalNodeAddress() const
-- { return m_aValueRef; }
-+ { return m_aValueRef; }
-
- /// retrieve the underlying (original) node
- data::ValueNodeAccess getOriginalNode(data::Accessor const& _aAccessor) const
-Index: configmgr/source/treemgr/setnodeimpl.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/setnodeimpl.cxx,v
-retrieving revision 1.24
-diff -u -p -u -r1.24 setnodeimpl.cxx
---- configmgr/source/treemgr/setnodeimpl.cxx 16 Sep 2006 15:31:34 -0000 1.24
-+++ configmgr/source/treemgr/setnodeimpl.cxx 5 Jan 2007 22:25:46 -0000
-@@ -374,8 +374,8 @@ view::ViewTreeAccess SetEntry::getTreeVi
- // class SetNodeImpl
- //-------------------------------------------------------------------------
-
--SetNodeImpl::SetNodeImpl(data::SetNodeAddress const& _aNodeRef,Template* pTemplate)
--: NodeImpl(_aNodeRef)
-+SetNodeImpl::SetNodeImpl(data::SetNodeAddress _pNodeRef,Template* pTemplate)
-+: NodeImpl(reinterpret_cast<NodeAddress>(_pNodeRef))
- ,m_aTemplate(pTemplate)
- ,m_aTemplateProvider()
- ,m_pParentTree(0)
-@@ -870,7 +870,7 @@ Element SetNodeImpl::makeAdditionalEleme
-
- data::TreeAddress aAddedTree = aAddNodeChange.getInsertedTree();
- // need 'unsafe', because ownership would be gone when notifications are sent
-- if (aAddedTree.is())
-+ if (aAddedTree != NULL)
- {
- // OSL_ENSURE( pNode->ISA(ISubtree), "Type mismatch when adjusting to update: value element found in tree set");
-
-Index: configmgr/source/treemgr/setnodeimpl.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/setnodeimpl.hxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 setnodeimpl.hxx
---- configmgr/source/treemgr/setnodeimpl.hxx 8 Sep 2005 04:33:57 -0000 1.11
-+++ configmgr/source/treemgr/setnodeimpl.hxx 5 Jan 2007 22:25:46 -0000
-@@ -214,7 +214,7 @@ namespace configmgr
- //-------------------------------------------------------------------------
-
- class SetNodeImpl : public NodeImpl
-- {
-+ {
- friend class view::ViewStrategy;
- ElementSet m_aDataSet;
- TemplateHolder m_aTemplate;
-@@ -228,7 +228,7 @@ namespace configmgr
- public:
- typedef ElementSet::Element Element;
-
-- SetNodeImpl(data::SetNodeAddress const& _aNodeRef, Template* pTemplate);
-+ SetNodeImpl(data::SetNodeAddress _pNodeRef, Template* pTemplate);
-
- typedef data::SetNodeAccess DataAccess;
- DataAccess getDataAccess(data::Accessor const& _aAccessor) const;
-Index: configmgr/source/treemgr/treeimpl.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/treeimpl.cxx,v
-retrieving revision 1.30
-diff -u -p -u -r1.30 treeimpl.cxx
---- configmgr/source/treemgr/treeimpl.cxx 16 Sep 2006 15:32:13 -0000 1.30
-+++ configmgr/source/treemgr/treeimpl.cxx 5 Jan 2007 22:25:46 -0000
-@@ -780,7 +780,7 @@ ElementTreeImpl::ElementTreeImpl( rtl::R
- : TreeImpl()
- , m_aInstanceInfo(aTemplateInfo)
- , m_aElementName(_aCacheTree.getName())
--, m_aDataAddress(_aCacheTree.address())
-+, m_aDataAddress(_aCacheTree)
- , m_aOwnData()
- {
- TreeImpl::build( _xStrategy, _aCacheTree.getRootNode(), nDepth, aTemplateProvider );
-@@ -795,7 +795,7 @@ ElementTreeImpl::ElementTreeImpl( rtl::R
- : TreeImpl( rParentTree, nParentNode )
- , m_aInstanceInfo(aTemplateInfo)
- , m_aElementName(_aCacheTree.getName())
--, m_aDataAddress(_aCacheTree.address())
-+, m_aDataAddress(_aCacheTree)
- , m_aOwnData()
- {
- TreeImpl::build( _xStrategy, _aCacheTree.getRootNode(), nDepth, aTemplateProvider );
-@@ -885,7 +885,7 @@ Path::Component ElementTreeImpl::makeExt
- void ElementTreeImpl::rebuild(rtl::Reference<view::ViewStrategy> const & _aStrategy, data::TreeAccessor const & _aNewTree, data::Accessor const& _aOldAccessor)
- {
- TreeImpl::rebuild(_aStrategy,_aNewTree.getRootNode(),_aOldAccessor);
-- m_aDataAddress = _aNewTree.address();
-+ m_aDataAddress = _aNewTree;
- m_aElementName = _aNewTree.getName();
- }
-
-@@ -922,7 +922,7 @@ void ElementTreeImpl::attachTo(data::Set
- // copy over to the new segment
- data::TreeAddress aNewElement = m_aOwnData.getTreeAccess().copyTree(aTargetAccessor);
-
-- data::SetNodeAccess::addElement(aTargetAccessor,aOwningSet.address(), aNewElement);
-+ data::SetNodeAccess::addElement(aOwningSet, aNewElement);
-
- data::TreeAccessor aNewAccessor(aTargetAccessor.downgrade(),aNewElement);
-
-@@ -963,8 +963,8 @@ void ElementTreeImpl::detachFrom(data::S
-
- memory::UpdateAccessor aTargetAccessor(pTargetSpace);
-
-- TreeAddress aOldElement = data::SetNodeAccess::removeElement(aTargetAccessor,aOwningSet.address(), aElementName );
-- OSL_ENSURE(aOldElement.is(),"ERROR: Detached node not found in the given subtree");
-+ TreeAddress aOldElement = data::SetNodeAccess::removeElement(aOwningSet, aElementName );
-+ OSL_ENSURE(aOldElement != NULL,"ERROR: Detached node not found in the given subtree");
-
- TreeAccessor::freeTree(aTargetAccessor,aOldElement);
- }
-Index: configmgr/source/treemgr/valuemembernode.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/valuemembernode.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 valuemembernode.cxx
---- configmgr/source/treemgr/valuemembernode.cxx 16 Sep 2006 15:32:27 -0000 1.9
-+++ configmgr/source/treemgr/valuemembernode.cxx 5 Jan 2007 22:25:46 -0000
-@@ -144,7 +144,7 @@ ValueMemberNode::~ValueMemberNode()
- bool ValueMemberNode::isValid() const
- {
- OSL_ASSERT( !m_xDeferredOperation.is() ||
-- m_xDeferredOperation->getOriginalNodeAddress() == m_aNodeRef.address() );
-+ m_aNodeRef == m_xDeferredOperation->getOriginalNodeAddress());
-
- return m_aNodeRef.isValid();
- }
-@@ -220,7 +220,7 @@ void ValueMemberUpdate::setValue(UnoAny
- else if (memory::Segment * pUpdatableSegment = m_pStrategy->getDataSegmentForUpdate())
- {
- memory::UpdateAccessor aUpdater(pUpdatableSegment);
-- setOriginalValue( aUpdater, m_aMemberNode.m_aNodeRef.address(), aNewValue );
-+ setOriginalValue( aUpdater, m_aMemberNode.m_aNodeRef, aNewValue );
- }
- }
- //-----------------------------------------------------------------------------
-@@ -233,7 +233,7 @@ void ValueMemberUpdate::setDefault()
- else if (memory::Segment * pUpdatableSegment = m_pStrategy->getDataSegmentForUpdate())
- {
- memory::UpdateAccessor aUpdater(pUpdatableSegment);
-- setOriginalToDefault( aUpdater, m_aMemberNode.m_aNodeRef.address() );
-+ setOriginalToDefault( aUpdater, m_aMemberNode.m_aNodeRef );
- }
- }
-
-@@ -242,7 +242,7 @@ void ValueMemberUpdate::setDefault()
- //-----------------------------------------------------------------------------
-
- ValueMemberNode::DeferredImpl::DeferredImpl(data::ValueNodeAccess const& _aValueNode)
--: m_aValueRef(_aValueNode.address())
-+: m_aValueRef(_aValueNode)
- , m_aNewValue(_aValueNode.getValue())
- , m_bToDefault(false)
- , m_bChange(false)
-@@ -251,7 +251,7 @@ ValueMemberNode::DeferredImpl::DeferredI
-
- void ValueMemberNode::DeferredImpl::setValue(UnoAny const& aNewValue, data::ValueNodeAccess const& _aOriginalNode)
- {
-- OSL_ENSURE(_aOriginalNode.address() == m_aValueRef, "Incorrect original node passed");
-+ OSL_ENSURE(_aOriginalNode == m_aValueRef, "Incorrect original node passed");
-
- m_aNewValue = aNewValue;
- m_bToDefault = false;
-@@ -262,7 +262,7 @@ void ValueMemberNode::DeferredImpl::setV
-
- void ValueMemberNode::DeferredImpl::setValueToDefault(data::ValueNodeAccess const& _aOriginalNode)
- {
-- OSL_ENSURE(_aOriginalNode.address() == m_aValueRef, "Incorrect original node passed");
-+ OSL_ENSURE(_aOriginalNode == m_aValueRef, "Incorrect original node passed");
-
- m_aNewValue = _aOriginalNode.getDefaultValue();
- m_bToDefault = true;
-Index: configmgr/source/treemgr/valuemembernode.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/valuemembernode.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 valuemembernode.hxx
---- configmgr/source/treemgr/valuemembernode.hxx 8 Sep 2005 04:35:43 -0000 1.5
-+++ configmgr/source/treemgr/valuemembernode.hxx 5 Jan 2007 22:25:46 -0000
-@@ -68,7 +68,7 @@ namespace configmgr
- /// create a ValueMemberNode for a given node
- explicit ValueMemberNode(data::ValueNodeAccess const& _aNodeAccess);
- /// create a deferred ValueMemberNode (xOriginal must not be empty)
-- ValueMemberNode(data::Accessor const& _aAccessor, DeferredImplRef const& _xDeferred);
-+ ValueMemberNode(memory::Accessor const& _aAccessor, DeferredImplRef const& _xDeferred);
- public:
- ValueMemberNode(ValueMemberNode const& rOriginal);
- ValueMemberNode& operator=(ValueMemberNode const& rOriginal);
-Index: configmgr/source/treemgr/valuenodeimpl.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/valuenodeimpl.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 valuenodeimpl.hxx
---- configmgr/source/treemgr/valuenodeimpl.hxx 8 Sep 2005 04:35:58 -0000 1.3
-+++ configmgr/source/treemgr/valuenodeimpl.hxx 5 Jan 2007 22:25:46 -0000
-@@ -42,10 +42,7 @@
-
- namespace configmgr
- {
--//-----------------------------------------------------------------------------
--
-- class ValueChange;
--//-----------------------------------------------------------------------------
-+ class ValueChange;
-
- namespace data
- {
-@@ -54,17 +51,11 @@ namespace configmgr
- }
- //-----------------------------------------------------------------------------
-
-- namespace configuration
-- {
--//-----------------------------------------------------------------------------
-- typedef com::sun::star::uno::Any UnoAny;
-- typedef com::sun::star::uno::Type UnoType;
--
-- class ValueChangeImpl;
--
-- class Name;
-+ namespace configuration
-+ {
-+ typedef com::sun::star::uno::Any UnoAny;
-+ typedef com::sun::star::uno::Type UnoType;
- //-----------------------------------------------------------------------------
--
- // Another types of node
- //-----------------------------------------------------------------------------
-
-@@ -72,29 +63,27 @@ namespace configmgr
- <p> This is an immutable value (changes are done by adding/replacing/removing set elements)
- </p>
- */
-- class ValueElementNodeImpl : public NodeImpl
-- {
-- public:
-+ class ValueElementNodeImpl : public NodeImpl
-+ {
-+ public:
- explicit ValueElementNodeImpl(data::ValueNodeAddress const& _aNodeRef) ;
-
-- // the following delegate directly to the original node
-- public:
-- /// Does this node assume its default value
-- /// retrieve the current value of this node
-- UnoAny getValue(data::Accessor const& _aAccessor) const;
--
-- /// get the type of this value
-- UnoType getValueType(data::Accessor const& _aAccessor) const;
--
-- typedef data::ValueNodeAccess DataAccess;
-- DataAccess getDataAccess(data::Accessor const& _aAccessor) const;
-- };
-+ // the following delegate directly to the original node
-+ public:
-+ /// Does this node assume its default value
-+ /// retrieve the current value of this node
-+ UnoAny getValue(memory::Accessor const& _aAccessor) const;
-+
-+ /// get the type of this value
-+ UnoType getValueType(memory::Accessor const& _aAccessor) const;
-+
-+ typedef data::ValueNodeAccess DataAccess;
-+ DataAccess getDataAccess(memory::Accessor const& _aAccessor) const;
-+ };
-
--//-----------------------------------------------------------------------------
-- // domain-specific 'dynamic_cast' replacement
-- ValueElementNodeImpl& AsValueNode(NodeImpl& rNode);
--//-----------------------------------------------------------------------------
-- }
-+ // domain-specific 'dynamic_cast' replacement
-+ ValueElementNodeImpl& AsValueNode(NodeImpl& rNode);
-+ }
- }
-
- #endif // CONFIGMGR_VALUENODEBEHAVIOR_HXX_
-Index: configmgr/source/treemgr/viewnode.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/viewnode.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 viewnode.hxx
---- configmgr/source/treemgr/viewnode.hxx 8 Sep 2005 04:37:13 -0000 1.3
-+++ configmgr/source/treemgr/viewnode.hxx 5 Jan 2007 22:25:46 -0000
-@@ -71,8 +71,6 @@ namespace configmgr
- data::Accessor const& accessor() const // has a Accessor
- { return m_accessor; }
-
-- // data::TreeAccessor getAccess() const; // has a TreeAccessor
--
- private:
- data::Accessor m_accessor; // has a TreeAccessor
- TreeData * m_addr; // has a TreeAddress or NodeAddress
-Index: configmgr/source/treemgr/viewstrategy.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/viewstrategy.cxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 viewstrategy.cxx
---- configmgr/source/treemgr/viewstrategy.cxx 16 Sep 2006 15:33:07 -0000 1.10
-+++ configmgr/source/treemgr/viewstrategy.cxx 5 Jan 2007 22:25:47 -0000
-@@ -84,8 +84,6 @@ namespace configmgr
- using configuration::ElementList;
- using configuration::GroupMemberVisitor;
- using configuration::SetNodeVisitor;
--//-----------------------------------------------------------------------------
--// virtual void doInitElements( data::SetNodeAccess const& _aNode, TreeDepth nDepth);
-
- static
- inline
-@@ -148,62 +146,11 @@ namespace configmgr
- }
- }
-
--//-----------------------------------------------------------------------------
-- data::NodeAddress::DataType * ViewStrategy::getDataForUpdate(data::NodeAccessRef const & _aNode)
-- {
-- typedef data::NodeAddress::DataType DataType;
-- DataType * pResult = implAccessForUpdate(_aNode);
-- OSL_ASSERT(!pResult || _aNode.getDataPtr() == pResult);
-- return pResult;
-- }
--
-- data::SetNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::SetNodeAccess const & _aNode)
-- {
-- typedef data::SetNodeAddress::DataType DataType;
--
-- sharable::Node * pNode = implAccessForUpdate(_aNode);
-- DataType * pResult = pNode ? pNode->setData() : 0;
--
-- OSL_ASSERT(!pResult || &_aNode.data() == pResult);
-- return pResult;
-- }
--
-- data::GroupNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::GroupNodeAccess const & _aNode)
-- {
-- typedef data::GroupNodeAddress::DataType DataType;
--
-- sharable::Node * pNode = implAccessForUpdate(_aNode);
-- DataType * pResult = pNode ? pNode->groupData() : 0;
--
-- OSL_ASSERT(!pResult || &_aNode.data() == pResult);
-- return pResult;
-- }
--
-- data::ValueNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::ValueNodeAccess const & _aNode)
-+ data::SetNodeAddress ViewStrategy::getDataForUpdate(data::SetNodeAccess const & _aNode)
- {
-- typedef data::ValueNodeAddress::DataType DataType;
--
-- sharable::Node * pNode = implAccessForUpdate(_aNode);
-- DataType * pResult = pNode ? pNode->valueData() : 0;
--
-- OSL_ASSERT(!pResult || &_aNode.data() == pResult);
-- return pResult;
-- }
--
--//-----------------------------------------------------------------------------
-- data::NodeAddress::DataType * ViewStrategy::implAccessForUpdate(data::NodeAccessRef const & _aNode)
-- {
-- if (memory::Segment * pUpdatableSegment = doGetDataSegmentForUpdate())
-- {
-- void * p = memory::UpdateAccessor(pUpdatableSegment).validate(_aNode.rawAddress());
--
-- OSL_ASSERT(const_cast<const void *>(p) == _aNode.getDataPtr());
--
-- return static_cast<data::NodeAddress::DataType*>(p);
-- }
--
-- else
-- return NULL;
-+ if (doGetDataSegmentForUpdate())
-+ return _aNode;
-+ return NULL;
- }
-
- //-----------------------------------------------------------------------------
-@@ -702,48 +649,6 @@ namespace configmgr
- }
-
- //-----------------------------------------------------------------------------
--/* // virtual rtl::Reference<ViewStrategy> doCloneIndirect(); // fails* /
-- rtl::Reference<ViewStrategy> ViewStrategy::makeIndirect(Tree const& _aTree)
-- {
-- _aTree->makeIndirect(true);
-- return this;
-- }
--
-- void ViewStrategy::doCommitChanges(Node const& _aNode)
-- {
-- // nothing to do
-- }
--
-- // TODO: move this to deferred impl
-- void ViewStrategy::implCommitDirectIn(data::TreeAccessor const& _aPlaceHolder, Node const& _aNode)
-- {
-- if (this->hasChanges(_aNode) )
-- {
-- this->doCommitChanges(_aNode);
--
-- GroupNode aGroup(_aNode);
--
-- for (Node aChild = aGroup.getFirstChild(); aChild.is(); aChild = aGroup.getNextChild(aChild) )
-- {
-- implCommitDirectIn(_aPlaceHolder, aChild);
-- }
-- }
-- }
--
-- void ViewStrategy::commitDirectly(data::TreeAccessor const& _aPlaceHolder, Tree const& _aTree)
-- {
-- implCommitDirectIn( _aPlaceHolder, getRootNode(_aTree) );
-- }
--
-- // virtual rtl::Reference<ViewStrategy> doCloneDirect(); // returns 'this'
-- rtl::Reference<ViewStrategy> ViewStrategy::makeDirect (Tree const& _aTree)
-- {
-- commitDirectly(_aTree.accessor(), _aTree);
-- _aTree->makeIndirect(false);
-- return this;
-- }
--*/
--//-----------------------------------------------------------------------------
- data::NodeAccessRef ViewStrategy::getNodeAccessRef(Node const& _aNode) const
- {
- checkInstance(_aNode.tree());
-Index: configmgr/source/treemgr/viewstrategy.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/viewstrategy.hxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 viewstrategy.hxx
---- configmgr/source/treemgr/viewstrategy.hxx 8 Sep 2005 04:37:43 -0000 1.6
-+++ configmgr/source/treemgr/viewstrategy.hxx 5 Jan 2007 22:25:47 -0000
-@@ -202,10 +202,7 @@ namespace configmgr
- memory::Segment const * getDataSegment() const;
- memory::Segment * getDataSegmentForUpdate();
-
-- data::NodeAddress ::DataType * getDataForUpdate(data::NodeAccessRef const & _aNode);
-- data::SetNodeAddress::DataType * getDataForUpdate(data::SetNodeAccess const & _aNode);
-- data::GroupNodeAddress::DataType * getDataForUpdate(data::GroupNodeAccess const & _aNode);
-- data::ValueNodeAddress::DataType * getDataForUpdate(data::ValueNodeAccess const & _aNode);
-+ data::SetNodeAddress getDataForUpdate(data::SetNodeAccess const & _aNode);
-
- // access to node innards
- protected:
-@@ -250,7 +247,6 @@ namespace configmgr
- virtual void doReleaseDataSegment() = 0;
-
- // special support for direct changes to underlying data - default is no support
-- virtual data::NodeAddress::DataType * implAccessForUpdate(data::NodeAccessRef const & _aDataAccess);
- virtual memory::Segment const * doGetDataSegment() const = 0;
- virtual memory::Segment * doGetDataSegmentForUpdate();
-
-@@ -275,12 +271,7 @@ namespace configmgr
- // set element access
- virtual void doInsertElement(SetNode const& _aNode, Name const& aName, SetNodeEntry const& aNewEntry) = 0;
- virtual void doRemoveElement(SetNode const& _aNode, Name const& aName) = 0;
--
-- // strategy change support
--/* virtual void doCommitChanges(Node const& _aNode);
-- virtual rtl::Reference<ViewStrategy> doCloneDirect() = 0;
-- virtual rtl::Reference<ViewStrategy> doCloneIndirect() = 0;
--*/ };
-+ };
-
- //-----------------------------------------------------------------------------
- inline Name ViewStrategy::getName(Node const& _aNode) const
-Index: configmgr/util/makefile.mk
-===================================================================
-RCS file: /cvs/util/configmgr/util/makefile.mk,v
-retrieving revision 1.19
-diff -u -p -u -r1.19 makefile.mk
---- configmgr/util/makefile.mk 8 Sep 2005 04:44:27 -0000 1.19
-+++ configmgr/util/makefile.mk 5 Jan 2007 22:25:49 -0000
-@@ -49,7 +49,7 @@ SHL1TARGET= $(CFGMGR_TARGET)$(CFGMGR_MAJ
- .IF "$(OS)"=="MACOSX"
- #SHL1VERSIONMAP= $(TARGET).$(DLLPOSTFIX).map
- .ELSE
--SHL1VERSIONMAP= $(TARGET).map
-+#SHL1VERSIONMAP= $(TARGET).map
- .ENDIF
- SHL1OBJS=$(SLOFILES)
- SHL1STDLIBS=\
-@@ -91,7 +91,7 @@ SHL2TARGET= $(CFGMGR_TARGET)$(CFGMGR_MAJ
- .IF "$(OS)"=="MACOSX"
- #SHL2VERSIONMAP= $(TARGET).$(DLLPOSTFIX).map
- .ELSE
--SHL2VERSIONMAP= $(TARGET)l.map
-+#SHL2VERSIONMAP= $(TARGET)l.map
- .ENDIF
- SHL2OBJS=$(SLOFILES)
- SHL2STDLIBS=\
-Index: configmgr/workben/makefile.mk
-===================================================================
-RCS file: /cvs/util/configmgr/workben/makefile.mk,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 makefile.mk
---- configmgr/workben/makefile.mk 8 Mar 2006 14:02:03 -0000 1.4
-+++ configmgr/workben/makefile.mk 5 Jan 2007 22:25:49 -0000
-@@ -55,35 +55,7 @@ USE_LDUMP2=TRUE
- # CFGDEMO
- #
- APP1TARGET= cfgdemo
--APP1OBJS=\
-- $(OBJ)$/treetests.obj \
-- $(SLO)$/xmltreebuilder.obj \
-- $(SLO)$/xmlformater.obj \
-- $(SLO)$/attributes.obj \
-- $(SLO)$/changes.obj \
-- $(SLO)$/confname.obj \
-- $(SLO)$/typeconverter.obj \
-- $(SLO)$/synchronize.obj \
-- $(SLO)$/cmtree.obj \
-- $(SLO)$/cmtreemodel.obj \
-- $(SLO)$/localsession.obj \
-- $(SLO)$/mergeupdates.obj \
-- $(SLO)$/oslstream.obj \
-- $(SLO)$/saxtools.obj \
-- $(SLO)$/configsession.obj \
-- $(SLO)$/strimpl.obj \
-- $(SLO)$/tracer.obj \
-- $(SLO)$/confchangesset.obj \
-- $(SLO)$/filehelper.obj \
-- $(SLO)$/strconverter.obj \
-- $(SLO)$/updatedom.obj \
-- $(SLO)$/valuehandler.obj \
-- $(SLO)$/dataconverter.obj \
--
--# $(OBJ)$/cmxmlexport.obj \
--# $(OBJ)$/cmxmlimport.obj \
--
--#APP1RES= $(RES)$/ucbdemo.res
-+APP1OBJS= $(OBJ)$/testapp.obj
-
- APP1STDLIBS=\
- $(SALLIB) \
-@@ -95,7 +67,8 @@ APP1STDLIBS=\
- $(TOOLSLIB) \
- $(UUILIB) \
- $(SVTOOLLIB) \
-- $(SVLIB)
-+ $(SVLIB) \
-+ -lconfigmgr2.uno
-
- .IF "$(GUI)"=="WNT"
- APP1STDLIBS+=$(LIBCIMT)
diff --git a/patches/test/dbbe.diff b/patches/test/dbbe.diff
deleted file mode 100644
index 1067c74a4..000000000
--- a/patches/test/dbbe.diff
+++ /dev/null
@@ -1,84 +0,0 @@
-Index: configmgr/prj/build.lst
-===================================================================
-RCS file: /cvs/util/configmgr/prj/build.lst,v
-retrieving revision 1.14
-diff -u -p -r1.14 build.lst
---- configmgr/prj/build.lst 30 Mar 2004 14:52:16 -0000 1.14
-+++ configmgr/prj/build.lst 27 Apr 2006 18:19:04 -0000
-@@ -14,6 +14,7 @@ cg configmgr\source\api2 nmake - all
- cg configmgr\source\treemgr nmake - all cg_treemgr cg_cppugen NULL
- cg configmgr\source\registry nmake - all cg_reg cg_cppugen NULL
- cg configmgr\source\platformbe nmake - all cg_platformbe cg_cppugen NULL
--cg configmgr\util nmake - all cg_util cg_platformbe cg_api cg_api2 cg_cmdtools cg_misc cg_reg cg_trcache cg_data cg_tree cg_treemgr cg_xml cg_backend cg_localbe NULL
-+cg configmgr\source\dbbe nmake - all cg_dbbe cg_cppugen NULL
-+cg configmgr\source\dbbe\util nmake - all cg_dbutil cg_dbbe cg_cppugen NULL
- cg configmgr\source\localbe nmake - all cg_localbe cg_cppugen NULL
-
-Index: configmgr/prj/d.lst
-===================================================================
-RCS file: /cvs/util/configmgr/prj/d.lst,v
-retrieving revision 1.13
-diff -u -p -r1.13 d.lst
---- configmgr/prj/d.lst 29 Apr 2005 08:50:26 -0000 1.13
-+++ configmgr/prj/d.lst 27 Apr 2006 18:19:15 -0000
-@@ -11,4 +11,6 @@ mkdir: %_DEST%\inc%_EXT%\configmgr
-
- ..\%__SRC%\misc\configmgr2.uno.xml %_DEST%\xml%_EXT%\configmgr2.uno.xml
-
-+..\%__SRC%\bin\util %_DEST%\bin%_EXT%\util
-+
- dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
-Index: configmgr/util/makefile.mk
-===================================================================
-RCS file: /cvs/util/configmgr/util/makefile.mk,v
-retrieving revision 1.19
-diff -u -p -r1.19 makefile.mk
---- configmgr/util/makefile.mk 8 Sep 2005 04:44:27 -0000 1.19
-+++ configmgr/util/makefile.mk 27 Apr 2006 18:19:22 -0000
-@@ -60,7 +60,8 @@ SHL1STDLIBS=\
- $(OSLLIB) \
- $(SALHELPERLIB) \
- $(SALLIB) \
-- $(CPPRTLLIB)
-+ $(CPPRTLLIB) \
-+ -ldb_cxx
-
- # $(UNOTOOLSLIB) \
- # $(ZLIB3RDLIB) \
-@@ -77,7 +78,8 @@ SHL1LIBS= $(SLB)$/registry.lib \
- $(SLB)$/api2.lib \
- $(SLB)$/api.lib \
- $(SLB)$/data.lib \
-- $(SLB)$/cm.lib
-+ $(SLB)$/cm.lib \
-+ $(SLB)$/dbbe.lib
-
- SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-@@ -116,7 +118,7 @@ SHL2LIBS= $(SLB)$/registry.lib \
- $(SLB)$/api2.lib \
- $(SLB)$/api.lib \
- $(SLB)$/data.lib \
-- $(SLB)$/cm.lib
-+ $(SLB)$/cm.lib \
-
- SHL2DEF= $(MISC)$/$(SHL2TARGET).def
-
-Index: configmgr/source/misc/configunoreg.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/configunoreg.cxx,v
-retrieving revision 1.29
-diff -u -p -r1.29 configunoreg.cxx
---- configmgr/source/misc/configunoreg.cxx 8 Sep 2005 04:09:30 -0000 1.29
-+++ configmgr/source/misc/configunoreg.cxx 27 Apr 2006 18:19:43 -0000
-@@ -272,6 +272,10 @@ extern "C" sal_Bool SAL_CALL component_w
- RegisterService(configmgr::localbe::getLocalReadonlyStratumServiceInfo(), xKey) ;
- RegisterService(configmgr::localbe::getLocalResourceStratumServiceInfo(), xKey) ;
- RegisterService(configmgr::localbe::getLocalMultiStratumServiceInfo(), xKey) ;
-+ //dbbe
-+ RegisterService(configmgr::dbbe::getSingleStratumServiceInfo(), xKey) ;
-+ RegisterService(configmgr::dbbe::getMultiStratumServiceInfo(), xKey) ;
-+
-
- // im/export
- RegisterService(configmgr::backend::getMergeImportServiceInfo(), xKey);
diff --git a/patches/test/dir.reader.cxx b/patches/test/dir.reader.cxx
deleted file mode 100644
index de1c8003a..000000000
--- a/patches/test/dir.reader.cxx
+++ /dev/null
@@ -1,494 +0,0 @@
-// Cutn'pasting this into msvbasicdir ( from ooobuild/patches/test/vba-export-dir.diff should work
-// the reader class DirDumper ( at the end of this file ) is not complete, still some records to go :-(
-
-// also _VBA_PROJECT_VDPI can be used to create a usable
-// ( and much smaller ) "_VBA_PROJECT" stream
-
-// _VBA_PROJECT Stream Version Dependant Project Information
-// _VBA_PROJECT Stream Version Dependant Project Information
-class _VBA_PROJECT_VDPI
-{
-public:
-sal_Int16 Reserved1;
-sal_Int16 Version;
-sal_Int8 Reserved2;
-sal_Int16 Reserved3;
-sal_Int8* PerformanceCache;
-sal_Int32 PerformanceCacheSize;
-_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCache(0), PerformanceCacheSize(0) {}
-~_VBA_PROJECT_VDPI()
-{
- if ( PerformanceCache )
- delete [] PerformanceCache;
- PerformanceCache = 0;
- PerformanceCacheSize = 0;
-}
-void read(){}
-void write( SvStream* pStream )
-{
- *pStream << Reserved1 << Version << Reserved2 << Reserved3;
- for( sal_Int32 i = 0; PerformanceCache && i < PerformanceCacheSize; ++i )
- {
- *pStream >> PerformanceCache[ i ];
- }
-}
-};
-
-class ProjectSysKindRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int32 SysKind;
-ProjectSysKindRecord(): Id(0x1), Size(0x4), SysKind( 0x1 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> SysKind;
-}
-};
-
-class ProjectLcidRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int32 Lcid;
-
-ProjectLcidRecord() : Id( 0x2 ), Size( 0x4 ), Lcid( 0x409 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> Lcid;
-}
-};
-
-class ProjectLcidInvokeRecord
-{
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int32 LcidInvoke;
-public:
-ProjectLcidInvokeRecord() : Id( 0x14 ), Size( 0x4 ), LcidInvoke( 0x409 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> LcidInvoke;
-}
-};
-
-class ProjectCodePageRecord
-{
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int16 CodePage;
-public:
-// #FIXME get a better default for the CodePage
-ProjectCodePageRecord() : Id( 0x03 ), Size( 0x2 ), CodePage( 0x0 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> CodePage;
-}
-};
-class ProjectNameRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 SizeOfProjectName;
-sal_Int8* ProjectName;
-ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ), ProjectName(0) {}
-~ProjectNameRecord()
-{
- delete [] ProjectName;
- ProjectName = 0;
-}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeOfProjectName;
- if ( ProjectName )
- delete [] ProjectName;
-
- ProjectName = new sal_Int8[ SizeOfProjectName ];
- for( sal_Int32 nIndex = 0; nIndex < SizeOfProjectName; ++nIndex )
- {
- *pStream >> ProjectName[ nIndex ];
- }
-}
-};
-
-class ProjectDocStringRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 SizeOfDocString;
-sal_Int8* DocString;
-sal_Int16 Reserved;
-sal_Int32 SizeOfDocStringUnicode;
-sal_Int8* DocStringUnicode;
-
-ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), DocString( 0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ), DocStringUnicode( 0 ) {}
-
-~ProjectDocStringRecord()
-{
- delete [] DocString;
- delete [] DocStringUnicode;
- DocString = 0;
- DocStringUnicode = 0;
-}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeOfDocString;
-
- if ( DocString )
- delete [] DocString;
-
- pStream->Read( DocString, SizeOfDocString );
-
- if ( SizeOfDocStringUnicode )
- delete [] DocStringUnicode;
-
- *pStream >> Reserved >> SizeOfDocStringUnicode;
-
- if ( DocStringUnicode )
- delete [] DocStringUnicode;
-
- DocStringUnicode = new sal_Int8[ SizeOfDocStringUnicode ];
-
- pStream->Read( DocStringUnicode, SizeOfDocStringUnicode );
-}
-
-};
-
-class ProjectHelpFilePath
-{
-public:
-sal_Int16 Id;
-sal_Int32 SizeOfHelpFile1;
-sal_Int8* HelpFile1;
-sal_Int16 Reserved;
-sal_Int32 SizeOfHelpFile2;
-sal_Int8* HelpFile2;
-
-ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), HelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0), HelpFile2(0) {}
-~ProjectHelpFilePath()
-{
- if ( HelpFile1 )
- delete [] HelpFile1;
- if ( HelpFile2 )
- delete [] HelpFile2;
- HelpFile1 = 0;
- HelpFile2 = 0;
-}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeOfHelpFile1;
-
- if ( HelpFile1 )
- delete HelpFile1;
-
- HelpFile1 = new sal_Int8[ SizeOfHelpFile1 ];
- pStream->Read( HelpFile1, SizeOfHelpFile1 );
-
- *pStream >> Reserved >> SizeOfHelpFile2;
-
- if ( HelpFile2 )
- delete HelpFile2;
-
- HelpFile2 = new sal_Int8[ SizeOfHelpFile2 ];
- pStream->Read( HelpFile2, SizeOfHelpFile2 );
-
-}
-};
-
-class ProjectHelpContextRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int32 HelpContext;
-
-ProjectHelpContextRecord() : Id( 0x7 ), Size( 0x4 ), HelpContext( 0 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> HelpContext;
-}
-
-};
-
-class ProjectLibFlagsRecord
-{
-sal_Int16 Id;
-sal_Int32 Size;
-sal_Int32 ProjectLibFlags;
-
-public:
-ProjectLibFlagsRecord() : Id( 0x8 ), Size( 0x4 ), ProjectLibFlags( 0x0 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Size >> ProjectLibFlags;
-}
-};
-
-class ProjectVersionRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 Reserved;
-sal_Int32 VersionMajor;
-sal_Int16 VersionMinor;
-ProjectVersionRecord() : Id( 0x9 ), Reserved( 0x4 ), VersionMajor( 0x1 ), VersionMinor( 0 ) {}
-void read( SvStream* pStream )
-{
- *pStream >> Id >> Reserved >> VersionMajor >> VersionMinor;
-}
-};
-
-class ProjectConstantsRecord
-{
-sal_Int16 Id;
-sal_Int32 SizeOfConstants;
-sal_Int8* Constants;
-sal_Int16 Reserved;
-sal_Int32 SizeOfConstantsUnicode;
-sal_Int8* ConstantsUnicode;
-public:
-ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
-
-~ProjectConstantsRecord()
-{
- delete [] Constants;
- Constants = 0;
- delete [] ConstantsUnicode;
- ConstantsUnicode = 0;
-}
-
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeOfConstants;
- if ( Constants )
- delete [] Constants;
- Constants = new sal_Int8[ SizeOfConstants ];
- pStream->Read( Constants, SizeOfConstants );
-
- if ( ConstantsUnicode )
- delete [] ConstantsUnicode;
- ConstantsUnicode = new sal_Int8[ SizeOfConstantsUnicode ];
- pStream->Read( ConstantsUnicode, SizeOfConstantsUnicode );
-}
-
-};
-
-class ReferenceNameRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 SizeOfName;
-sal_Int8* Name;
-sal_Int16 Reserved;
-sal_Int32 SizeOfNameUnicode;
-sal_Int8* NameUnicode;
-
-ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Name( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ), NameUnicode( 0 ) {}
-~ReferenceNameRecord()
-{
- delete [] Name;
- Name = 0;
- delete [] NameUnicode;
- NameUnicode = 0;
-}
-
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeOfName;
-
- if ( Name )
- delete [] Name;
-
- pStream->Read( Name, SizeOfName );
-
- *pStream >> Reserved >> SizeOfNameUnicode;
-
- if ( NameUnicode )
- delete [] Name;
-
- pStream->Read( NameUnicode, SizeOfNameUnicode );
-}
-
-};
-
-// Baseclass for ReferenceControlRecord, ReferenceRegisteredRecord, ReferenceProjectRecord
-class BaseReferenceRecord
-{
-public:
-virtual ~BaseReferenceRecord(){}
-virtual void read( SvStream* pStream ) = 0;
-};
-
-class ReferenceControlRecord : public BaseReferenceRecord
-{
-public:
-sal_Int16 Id;
-sal_Int32 SizeTwiddled;
-sal_Int32 SizeOfLibidTwiddled;
-sal_Int8* LibidTwiddled;
-sal_Int32 Reserved1;
-sal_Int16 Reserved2;
-ReferenceNameRecord* NameRecordExtended;// Optional
-sal_Int16 Reserved3;
-sal_Int32 SizeExtended;
-sal_Int32 SizeOfLibidExtended;
-sal_Int8* LibidExtended;
-sal_Int32 Reserved4;
-sal_Int16 Reserved5;
-sal_Int8 OriginalTypeLib[ 16 ];
-sal_Int32 Cookie;
-
-ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), LibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), NameRecordExtended( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), LibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
-{
- for( int i = 0; i < 16; ++i )
- OriginalTypeLib[ i ] = 0;
-}
-
-~ReferenceControlRecord()
-{
- delete LibidTwiddled;
- delete NameRecordExtended;
- delete [] LibidExtended;
- LibidTwiddled = 0;
- NameRecordExtended = 0;
- LibidExtended = 0;
-}
-
-void read( SvStream* pStream )
-{
- *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
- pStream->Read( LibidTwiddled, SizeOfLibidTwiddled );
-
- *pStream >> Reserved1 >> Reserved2;
-
- long nPos = pStream->Tell();
- // peek at the id for optional NameRecord
- sal_Int16 nTmpId;
- *pStream >> nTmpId;
- if ( nTmpId == 0x30 )
- {
- Reserved3 = 0x30;
- }
- else
- {
- pStream->Seek( nPos );
- NameRecordExtended = new ReferenceNameRecord();
- NameRecordExtended->read( pStream );
- }
-}
-
-};
-
-class ReferenceRecord
-{
-public:
-// NameRecord is Optional
-ReferenceNameRecord* NameRecord;
-BaseReferenceRecord* aReferenceRecord;
-ReferenceRecord(): NameRecord(0), aReferenceRecord(0) {}
-~ReferenceRecord()
-{
- if ( NameRecord )
- delete NameRecord;
- if ( aReferenceRecord )
- delete aReferenceRecord;
-}
-
-// false return would mean failed to read Record e.g. end of array encountered
-// Note: this read routine will make sure the stream is pointing to where it was the
-// method was called )
-
-bool read( SvStream* pStream )
-{
- bool bResult = true;
- long nPos = pStream->Tell();
- // Peek at the ID
- sal_Int16 Id;
- *pStream >> Id;
- pStream->Seek( nPos ); // place back before Id
- if ( Id == 0x16 ) // Optional NameRecord
- {
- NameRecord = new ReferenceNameRecord();
- NameRecord->read( pStream );
- }
-
- nPos = pStream->Tell(); // peek at next
- *pStream >> Id;
- pStream->Seek( nPos ); // place back before Id
-
- switch( Id )
- {
- case 0x0:
- bResult = false;
- break;
-/* #FIXME haven't got as far as coding the following records yet :-( oh hackweek
-why aren't you longer :-(((
- case 0x0D:
- aReferenceRecord = new ReferenceRegisteredRecord();
- break;
- case 0x0E:
- aReferenceRecord = new ReferenceProjectRecord();
- break;
- case 0x2F:
- case 0x33:
- aReferenceRecord = new ReferenceControlRecord();
- break;
-*/
- default:
- bResult = false;
- OSL_TRACE("Big fat error, unknown ID 0x%x", Id);
- break;
- aReferenceRecord->read( pStream );
- }
- return bResult;
-}
-
-};
-
-class DirDumper
-{
-public:
-ProjectSysKindRecord mSysKindRec;
-ProjectLcidRecord mLcidRec;
-ProjectLcidInvokeRecord mLcidInvokeRec;
-ProjectCodePageRecord mCodePageRec;
-ProjectNameRecord mProjectNameRec;
-ProjectDocStringRecord mDocStringRec;
-ProjectHelpFilePath mHelpFileRec;
-ProjectHelpContextRecord mHelpContextRec;
-ProjectLibFlagsRecord mLibFlagsRec;
-ProjectVersionRecord mVersionRec;
-std::vector< ReferenceRecord > ReferenceArray;
-
-DirDumper() {}
-
-void read( SvStream* pStream )
-{
- readProjectInformation( pStream );
- readProjectReferenceInformation( pStream );
-}
-
-void readProjectReferenceInformation( SvStream* pStream )
-{
- ReferenceRecord aRef;
- while( aRef.read( pStream ) )
- ReferenceArray.push_back( aRef );
-}
-
-void readProjectInformation( SvStream* pStream )
-{
- mSysKindRec.read( pStream );
- mLcidRec.read( pStream );
- mLcidInvokeRec.read( pStream );
- mCodePageRec.read( pStream );
- mProjectNameRec.read( pStream );
- mDocStringRec.read( pStream );
- mHelpFileRec.read( pStream );
- mHelpContextRec.read( pStream );
- mLibFlagsRec.read( pStream );
- mVersionRec.read( pStream );
-}
-
-};
diff --git a/patches/test/font-debug.diff b/patches/test/font-debug.diff
deleted file mode 100644
index 6beef07bb..000000000
--- a/patches/test/font-debug.diff
+++ /dev/null
@@ -1,256 +0,0 @@
-Index: vcl/source/gdi/outdev3.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/outdev3.cxx,v
-retrieving revision 1.209
-diff -u -p -u -r1.209 outdev3.cxx
---- vcl/source/gdi/outdev3.cxx 2 Nov 2005 14:41:10 -0000 1.209
-+++ vcl/source/gdi/outdev3.cxx 24 Jan 2006 17:56:21 -0000
-@@ -1531,32 +1531,43 @@ bool ImplFontData::IsBetterMatch( const
- }
- }
-
-+ bool bBetter;
-+
- if( rStatus.mnFaceMatch > nMatch )
-- return false;
-+ bBetter = false;
- else if( rStatus.mnFaceMatch < nMatch )
- {
- rStatus.mnFaceMatch = nMatch;
- rStatus.mnHeightMatch = nHeightMatch;
- rStatus.mnWidthMatch = nWidthMatch;
-- return true;
-+ bBetter = true;
- }
-
- // when two fonts are still competing prefer the
- // one with the best matching height
-- if( rStatus.mnHeightMatch > nHeightMatch )
-- return false;
-+ else if( rStatus.mnHeightMatch > nHeightMatch )
-+ bBetter = false;
- else if( rStatus.mnHeightMatch < nHeightMatch )
- {
- rStatus.mnHeightMatch = nHeightMatch;
- rStatus.mnWidthMatch = nWidthMatch;
-- return true;
-+ bBetter = true;
- }
--
-- if( rStatus.mnWidthMatch > nWidthMatch )
-- return false;
--
-- rStatus.mnWidthMatch = nWidthMatch;
-- return true;
-+ else if( rStatus.mnWidthMatch > nWidthMatch )
-+ bBetter = false;
-+ else
-+ {
-+ rStatus.mnWidthMatch = nWidthMatch;
-+ bBetter = true;
-+ }
-+ if (bBetter)
-+ {
-+ fprintf (stderr, "'%s' is a better match",
-+ rtl::OUStringToOString(rFontName, RTL_TEXTENCODING_UTF8).getStr());
-+ fprintf (stderr, "for '%s'\n",
-+ rtl::OUStringToOString(rFontName, RTL_TEXTENCODING_UTF8).getStr());
-+ }
-+ return bBetter;
- }
-
- // =======================================================================
-@@ -1714,7 +1725,10 @@ ImplFontData* ImplDevFontListData::FindB
- if( !mpFirst )
- return NULL;
- if( !mpFirst->GetNextFace() )
-+ {
-+ fprintf (stderr, "getnextface => ");
- return mpFirst;
-+ }
-
- // FontName+StyleName should map to FamilyName+StyleName
- const String& rSearchName = rFSD.maTargetName;
-@@ -2663,6 +2677,9 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- {
- String aSearchName = rFont.GetName();
-
-+ fprintf (stderr, "FontCache::Get '%s' => ",
-+ rtl::OUStringToOString(aSearchName, RTL_TEXTENCODING_UTF8).getStr());
-+
- // TODO: also add device specific name caching
- if( !pDevSpecific )
- {
-@@ -2671,7 +2688,10 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- FontNameList::const_iterator it_name = maFontNameList.find( aSearchName );
- if( it_name != maFontNameList.end() )
- if( !(*it_name).second.EqualsAscii( "hg", 0, 2) )
-+ {
- aSearchName = (*it_name).second;
-+ fprintf (stderr, "already known => ");
-+ }
- }
-
- // initialize internal font request object
-@@ -2688,7 +2708,10 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- {
- FontInstanceList::iterator it = maFontInstanceList.find( aFontSelData );
- if( it != maFontInstanceList.end() )
-+ {
- pEntry = (*it).second;
-+ fprintf (stderr, "direct cache hit => ");
-+ }
- }
-
- if( !pEntry ) // no direct cache hit
-@@ -2698,12 +2721,15 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- DBG_ASSERT( (pFontFamily != NULL), "ImplFontCache::Get() No logical font found!" );
- aFontSelData.maSearchName = pFontFamily->GetSearchName();
-
-+ fprintf (stderr, " implfindbyfont => ");
-+
- // check if an indirectly matching logical font instance is already cached
- FontInstanceList::iterator it = maFontInstanceList.find( aFontSelData );
- if( it != maFontInstanceList.end() )
- {
- // we have an indirect cache hit
- pEntry = (*it).second;
-+ fprintf (stderr, "(in)direct cache hit => ");
- // cache the requested and the selected font names
- // => next time there is a good chance for a direct cache hit
- // don't allow the cache to grow too big
-@@ -2729,6 +2755,7 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- ImplFontData* pFontData = pFontFamily->FindBestFontFace( aFontSelData );
- aFontSelData.mpFontData = pFontData;
-
-+ fprintf (stderr, "create new font instance => ");
- // create a new logical font instance from this physical font face
- pEntry = pFontData->CreateFontInstance( aFontSelData );
-
-@@ -2741,6 +2768,11 @@ ImplFontEntry* ImplFontCache::Get( ImplD
- maFontInstanceList[ aFontSelData ] = pEntry;
- }
-
-+ fprintf (stderr, "'%s'\n",
-+ pEntry ?
-+ rtl::OUStringToOString(pEntry->maFontSelData.maSearchName, RTL_TEXTENCODING_UTF8).getStr()
-+ : "<null>");
-+
- mpFirstEntry = pEntry;
- return pEntry;
- }
-@@ -2794,7 +2826,10 @@ ImplDevFontListData* ImplDevFontList::Im
- }
- ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "found by search name => ");
- return pFoundData;
-+ }
-
- // break after last font token
- if( nTokenPos == STRING_NOTFOUND)
-@@ -2820,7 +2855,10 @@ ImplDevFontListData* ImplDevFontList::Im
- ImplFontSubstitute( aSearchName, 0, pDevSpecific );
- ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "found by iterating list => ");
- return pFoundData;
-+ }
- }
-
- // if no font with a directly matching name is available use the
-@@ -2881,9 +2919,18 @@ ImplDevFontListData* ImplDevFontList::Im
- // try the font substitutions suggested by the fallback info
- if( pFontAttr )
- {
-+ fprintf (stderr, "found fallbck '%s' ",
-+ rtl::OUStringToOString(aSearchShortName, RTL_TEXTENCODING_UTF8).getStr());
-+ fprintf (stderr, " '%s' ",
-+ rtl::OUStringToOString(aSearchFamilyName, RTL_TEXTENCODING_UTF8).getStr());
-+ fprintf (stderr, " '%s' ",
-+ rtl::OUStringToOString(aSearchName, RTL_TEXTENCODING_UTF8).getStr());
- ImplDevFontListData* pFoundData = ImplFindBySubstFontAttr( *pFontAttr );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "found from fallback list => ");
- return pFoundData;
-+ }
- }
- }
-
-@@ -2894,7 +2941,10 @@ ImplDevFontListData* ImplDevFontList::Im
- aSearchName = DefaultFontConfigItem::get()->getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL );
- ImplDevFontListData* pFoundData = ImplFindByTokenNames( aSearchName );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "default symbol font => ");
- return pFoundData;
-+ }
- }
-
- // now try the other font name tokens
-@@ -2920,7 +2970,10 @@ ImplDevFontListData* ImplDevFontList::Im
- {
- ImplDevFontListData* pFoundData = ImplFindBySearchName( aTempShortName );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "shortened token name match => ");
- return pFoundData;
-+ }
- }
-
- // use a font name from font fallback list to determine font attributes
-@@ -2939,7 +2992,10 @@ ImplDevFontListData* ImplDevFontList::Im
- {
- ImplDevFontListData* pFoundData = ImplFindBySubstFontAttr( *pTempFontAttr );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "shortened token name subst match => ");
- return pFoundData;
-+ }
- if( !pFontAttr )
- pFontAttr = pTempFontAttr;
- }
-@@ -2950,7 +3006,10 @@ ImplDevFontListData* ImplDevFontList::Im
- {
- ImplDevFontListData* pFoundData = ImplFindByAliasName( rFSD.maTargetName, aSearchShortName );
- if( pFoundData )
-+ {
-+ fprintf (stderr, "use alias name => ");
- return pFoundData;
-+ }
- }
-
- // if still needed use the font request's attributes to find a good match
-@@ -3008,6 +3067,8 @@ ImplDevFontListData* ImplDevFontList::Im
- pFoundData = FindDefaultFont();
- }
-
-+ fprintf (stderr, "quit with default => ");
-+
- return pFoundData;
- }
-
-Index: vcl/source/gdi/fontcfg.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/fontcfg.cxx,v
-retrieving revision 1.36
-diff -u -p -u -r1.36 fontcfg.cxx
---- vcl/source/gdi/fontcfg.cxx 9 Sep 2005 11:57:35 -0000 1.36
-+++ vcl/source/gdi/fontcfg.cxx 24 Jan 2006 17:56:21 -0000
-@@ -1207,7 +1207,13 @@ const FontNameAttr* FontSubstConfigItem:
- // because the list is sorted this will also find fontnames of the form searchfontname*
- ::std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.begin(), lang->second.end(), aSearchAttr, StrictStringSort() );
- if( it != lang->second.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL )
-+ {
-+ fprintf (stderr, " getSubstInfo '%s' == ",
-+ rtl::OUStringToOString(it->Name, RTL_TEXTENCODING_UTF8).getStr());
-+ fprintf (stderr, " '%s' ",
-+ rtl::OUStringToOString(aSearchFont, RTL_TEXTENCODING_UTF8).getStr());
- return &(*it);
-+ }
- }
- // gradually become more unspecific
- if( aLocale.Variant.getLength() )
diff --git a/patches/test/gcc-pltabs.diff b/patches/test/gcc-pltabs.diff
deleted file mode 100644
index 24f2913dd..000000000
--- a/patches/test/gcc-pltabs.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-Index: gcc/varasm.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/varasm.c,v
-retrieving revision 1.477.6.11
-diff -u -r1.477.6.11 varasm.c
---- gcc/varasm.c 17 May 2005 07:03:33 -0000 1.477.6.11
-+++ gcc/varasm.c 18 Jul 2005 16:38:50 -0000
-@@ -3730,6 +3740,13 @@
-
- ALIGN is the alignment of the data in bits. */
-
-+#define DEFTREECODE(SYM, STRING, TYPE, NARGS) STRING,
-+static const char *foo_codes[] =
-+{
-+#include "tree.def"
-+};
-+#undef DEFTREECODE
-+
- void
- output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
- {
-@@ -3785,10 +3802,37 @@
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
-- if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
-- EXPAND_INITIALIZER),
-- MIN (size, thissize), align, 0))
-- error ("initializer for integer value is too complicated");
-+ {
-+ rtx expanded;
-+ tree fn;
-+
-+ expanded = expand_expr (exp, NULL_RTX, VOIDmode,
-+ EXPAND_INITIALIZER);
-+
-+ if (getenv("VTPLT") && TREE_CODE(exp) == ADDR_EXPR &&
-+ TREE_CODE((fn = TREE_OPERAND(exp, 0))) == FUNCTION_DECL &&
-+ DECL_VIRTUAL_P(fn) && !DECL_IS_BUILTIN(fn))
-+ {
-+ const char *op = integer_asm_op(MIN(size,thissize), align);
-+ fputs(op, asm_out_file);
-+ output_addr_const (asm_out_file, expanded); // FIXME: here
-+ fputs("@PLTABS\n", asm_out_file);
-+ }
-+ else
-+ {
-+ if (! assemble_integer (expanded,
-+ MIN (size, thissize), align, 0))
-+ error ("initializer for integer value is too complicated");
-+ }
-+ /* {
-+ tree fn = TREE_OPERAND(exp, 0);
-+ if (TREE_CODE
-+
-+ fprintf( stderr, "assemble_integer '%s' '%s' '%s' (%d)\n",
-+ foo_codes[code], foo_codes[TREE_CODE(exp)],
-+ foo_codes[TREE_CODE(fn)], BINFO_VIRTUAL_P(fn));
-+ }*/
-+ }
- break;
-
- case REAL_TYPE:
diff --git a/patches/test/gcc-stubhack.diff b/patches/test/gcc-stubhack.diff
deleted file mode 100644
index 0aadfd9d7..000000000
--- a/patches/test/gcc-stubhack.diff
+++ /dev/null
@@ -1,182 +0,0 @@
-Index: varasm.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/varasm.c,v
-retrieving revision 1.477.6.11
-diff -u -r1.477.6.11 varasm.c
---- varasm.c 17 May 2005 07:03:33 -0000 1.477.6.11
-+++ varasm.c 21 Jul 2005 16:50:49 -0000
-@@ -1517,6 +1517,8 @@
- int reloc = 0;
- rtx decl_rtl;
-
-+ // warning ("assemble variable %qD ", decl);
-+
- if (lang_hooks.decls.prepare_assemble_variable)
- lang_hooks.decls.prepare_assemble_variable (decl);
-
-@@ -1688,10 +1690,17 @@
-
- /* Output any data that we will need to use the address of. */
- if (DECL_INITIAL (decl) == error_mark_node)
-+ {
- reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
-+ warning ("value of contains_pointers_p %qD is %d ", decl, reloc);
-+ }
- else if (DECL_INITIAL (decl))
- {
- reloc = compute_reloc_for_constant (DECL_INITIAL (decl));
-+
-+ // warning ("value of compute_reloc_for_constant %qD is %d ",
-+ // decl, reloc);
-+
- output_addressed_constants (DECL_INITIAL (decl));
- }
-
-@@ -1888,7 +1897,7 @@
- If we know a method will be emitted in other TU and no new
- functions can be marked reachable, just use the external
- definition. */
-- struct cgraph_node *node = cgraph_node (decl);
-+ struct cgraph_node *node = cgraph_node (decl);
- if (!DECL_EXTERNAL (decl)
- && (!node->local.vtable_method || !cgraph_global_info_ready
- || !node->local.finalized))
-@@ -2090,6 +2099,7 @@
- int aligned_p ATTRIBUTE_UNUSED)
- {
- const char *op = integer_asm_op (size, aligned_p);
-+ // fprintf (stderr, "default_assemble_integer '%s'\n", op);
- /* Avoid GAS bugs for large values. Specifically negative values whose
- absolute value fits in a bfd_vma, but not in a bfd_signed_vma. */
- if (size > UNITS_PER_WORD && size > POINTER_SIZE / BITS_PER_UNIT)
-@@ -3730,6 +3740,15 @@
-
- ALIGN is the alignment of the data in bits. */
-
-+#define DEFTREECODE(SYM, STRING, TYPE, NARGS) STRING,
-+static const char *foo_codes[] =
-+{
-+#include "tree.def"
-+};
-+#undef DEFTREECODE
-+
-+char **glob_slots = NULL;
-+
- void
- output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
- {
-@@ -3785,10 +3804,60 @@
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
-- if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
-- EXPAND_INITIALIZER),
-- MIN (size, thissize), align, 0))
-- error ("initializer for integer value is too complicated");
-+ {
-+ rtx expanded;
-+ tree fn;
-+
-+ expanded = expand_expr (exp, NULL_RTX, VOIDmode,
-+ EXPAND_INITIALIZER);
-+
-+ if (getenv("VTPLT") && TREE_CODE(exp) == ADDR_EXPR &&
-+ TREE_CODE((fn = TREE_OPERAND(exp, 0))) == FUNCTION_DECL &&
-+ DECL_VIRTUAL_P(fn) && !DECL_IS_BUILTIN(fn) &&
-+ GET_CODE (expanded) == SYMBOL_REF)
-+ {
-+ int i;
-+ const char *p;
-+ const char *op = integer_asm_op(MIN(size,thissize), align);
-+ const char *buf = targetm.strip_name_encoding (XSTR (expanded, 0));
-+ fprintf (stderr, "vmethod: '%s'...\n", buf);
-+
-+ fputs(op, asm_out_file);
-+ output_addr_const (asm_out_file, expanded); // FIXME: here
-+ fputs("Slot\n", asm_out_file);
-+ if (!glob_slots)
-+ {
-+ glob_slots = xmalloc (sizeof (char *));
-+ glob_slots[0] = NULL;
-+ }
-+ for (i = 0; (p = glob_slots[i]); i++)
-+ {
-+ if (!strcmp (buf, p))
-+ break;
-+ }
-+ if (!glob_slots[i])
-+ {
-+ glob_slots = xrealloc (glob_slots, (i + 2) * sizeof (char *));
-+ glob_slots[i] = xstrdup (buf);
-+ glob_slots[i+1] = NULL;
-+ }
-+ fprintf( stderr, "Added\n");
-+ }
-+ else
-+ {
-+ if (! assemble_integer (expanded,
-+ MIN (size, thissize), align, 0))
-+ error ("initializer for integer value is too complicated");
-+ }
-+ /* {
-+ tree fn = TREE_OPERAND(exp, 0);
-+ if (TREE_CODE
-+
-+ fprintf( stderr, "assemble_integer '%s' '%s' '%s' (%d)\n",
-+ foo_codes[code], foo_codes[TREE_CODE(exp)],
-+ foo_codes[TREE_CODE(fn)], BINFO_VIRTUAL_P(fn));
-+ }*/
-+ }
- break;
-
- case REAL_TYPE:
-@@ -3823,6 +3892,8 @@
- tree link;
- unsigned int nalign;
- enum machine_mode inner;
-+
-+ warning ("assemble_vector_cst"); // %qD", code);
-
- inner = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
- nalign = MIN (align, GET_MODE_ALIGNMENT (inner));
-Index: toplev.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/toplev.c,v
-retrieving revision 1.944.2.4
-diff -u -r1.944.2.4 toplev.c
---- toplev.c 26 Apr 2005 00:30:16 -0000 1.944.2.4
-+++ toplev.c 21 Jul 2005 16:50:50 -0000
-@@ -2038,6 +2038,8 @@
-
- /* Clean up: close opened files, etc. */
-
-+extern char **glob_slots;
-+
- static void
- finalize (void)
- {
-@@ -2057,6 +2059,24 @@
- {
- if (ferror (asm_out_file) != 0)
- fatal_error ("error writing to %s: %m", asm_file_name);
-+ /* The world's grossest hack ? */
-+ if (glob_slots)
-+ {
-+ int i;
-+ const char *p;
-+
-+ fprintf( stderr, "Build out section\n");
-+ fprintf (asm_out_file, ".section text.stubs,\"ax\",@progbits\n.align 2\n");
-+
-+ for (i = 0; (p = glob_slots[i]); i++)
-+ {
-+ fprintf (asm_out_file, p);
-+ fprintf (asm_out_file, "Slot:\n\tjmp\t");
-+ fprintf (asm_out_file, p);
-+ fprintf (asm_out_file, "@plt\n");
-+ }
-+ fprintf( stderr, "Build out section donme\n");
-+ }
- if (fclose (asm_out_file) != 0)
- fatal_error ("error closing %s: %m", asm_file_name);
- }
diff --git a/patches/test/gcc-vt-copy-2.diff b/patches/test/gcc-vt-copy-2.diff
deleted file mode 100644
index 1ed2c17cf..000000000
--- a/patches/test/gcc-vt-copy-2.diff
+++ /dev/null
@@ -1,887 +0,0 @@
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cgraph.c gcc-4.2.1-simple/gcc/cgraph.c
---- pristine-gcc-4.2.1-simple/gcc/cgraph.c 2007-03-13 10:38:31.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cgraph.c 2008-01-15 16:49:44.000000000 +0000
-@@ -928,6 +928,11 @@
- void
- cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node)
- {
-+ if (getenv ("DEBUG")) {
-+ fprintf (stderr, "Mark node '%s' as needed\n",
-+ cgraph_varpool_node_name (node));
-+ dump_cgraph_varpool_node (stderr, node);
-+ }
- if (!node->needed && node->finalized
- && !TREE_ASM_WRITTEN (node->decl))
- cgraph_varpool_enqueue_needed_node (node);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/collect2.c gcc-4.2.1-simple/gcc/collect2.c
---- pristine-gcc-4.2.1-simple/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c 2008-01-10 12:20:49.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/class.c gcc-4.2.1-simple/gcc/cp/class.c
---- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-15 16:56:50.000000000 +0000
-@@ -136,7 +136,7 @@
- static tree fixed_type_or_null (tree, int *, int *);
- static tree build_simple_base_path (tree expr, tree binfo);
- static tree build_vtbl_ref_1 (tree, tree);
--static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
-+static tree build_vtbl_initializer (tree, tree, tree, tree, int *, tree *);
- static int count_fields (tree);
- static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
- static void check_bitfield_decl (tree);
-@@ -180,11 +180,11 @@
- tree, tree, splay_tree);
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
--static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
-+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree, tree *);
- static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+ tree, tree *);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
--static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
-+static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *, unsigned *);
- static void clone_constructors_and_destructors (tree);
- static tree build_clone (tree, tree);
- static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
-@@ -6355,6 +6355,51 @@
- return decl;
- }
-
-+/* Returns the VAR_DECL for the vtable copy relocation entries associated
-+ with BINFO. */
-+
-+tree get_vtreloc_decl (tree t, tree slot_relocs)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtreloc_for_type (t);
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ /* FIXME: 'nslot' calc duplicated in building
-+ inits - should we do that now instead ? */
-+ int nslots = list_length (slot_relocs);
-+ tree atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (nslots)));
-+ layout_type (atype);
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_VTRELOC_INIT(d) = 1;
-+ DECL_SECTION_NAME(d) = build_string (strlen (".vtrelocs"), ".vtrelocs");
-+ SET_DECL_ASSEMBLER_NAME (d, name);
-+ /* Remember the type it is for. */
-+ TREE_TYPE (name) = t;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_COMDAT (d) = 1;
-+ /* Mark the variable as undefined -- but remember that we can
-+ define it later if we need to do so. */
-+ DECL_EXTERNAL (d) = 0;
-+ DECL_NOT_REALLY_EXTERN (d) = 1;
-+ set_linkage_according_to_type (t, d);
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+
-+ /* Add decl to the global array of tinfo decls. */
-+ /* VEC_safe_push (tree, gc, unemitted_tinfo_decls, d); */
-+ }
-+
-+ /* FIXME: adding this screws with inheritance badly ! */
-+ return d;
-+}
-
- /* Returns the binfo for the primary base of BINFO. If the resulting
- BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6637,6 +6682,25 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+/* List of vtable copy slot data, keyed by type */
-+/*
-+ * toplevel: purpose - type
-+ * value - [slot relocs]
-+ * slot relocs: purpose - original binfo
-+ * value - initializers [ bit-mask list ]
-+ */
-+tree vtable_copy_slots;
-+
-+/* Register vtreloc for a given type, and return a decl
-+ for this type's vtrelocs */
-+static tree
-+register_vtreloc_decl (tree t, tree slot_relocs)
-+{
-+ vtable_copy_slots = tree_cons (t, slot_relocs,
-+ vtable_copy_slots);
-+ return get_vtreloc_decl (t, slot_relocs);
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-@@ -6647,19 +6711,33 @@
- tree list;
- tree vbase;
-
-+ tree slot_relocs = NULL_TREE;
- /* We lay out the primary and secondary vtables in one contiguous
- vtable. The primary vtable is first, followed by the non-virtual
- secondary vtables in inheritance graph order. */
- list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
- accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
-- TYPE_BINFO (t), t, list);
-+ TYPE_BINFO (t), t, list, &slot_relocs);
-
- /* Then come the virtual bases, also in inheritance graph order. */
- for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
- {
- if (!BINFO_VIRTUAL_P (vbase))
- continue;
-- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
-+ accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list, &slot_relocs);
-+ }
-+
-+ /* So ... we have a hack here - we append a reference to
-+ the vtable to ourselves, in order to stop us getting GC'd */
-+ if (slot_relocs)
-+ {
-+ tree decl, init;
-+ decl = build_address (register_vtreloc_decl (t, slot_relocs));
-+ /* Convert the declaration to a type that can be stored in the
-+ vtable. */
-+ init = build_nop (vfunc_ptr_type_node, decl);
-+ TREE_VALUE (list) = chainon (TREE_VALUE (list),
-+ build_tree_list (NULL_TREE, init));
- }
-
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-@@ -6676,6 +6754,10 @@
- layout_vtable_decl (binfo, list_length (inits));
- decl = get_vtbl_decl_for_binfo (binfo);
- initialize_artificial_var (decl, inits);
-+/* mark_used (decl); */ /* Wasteful - but necessary -
-+ otherwise we need to build
-+ .vtrelocs data as we emit
-+ such a var_decl */
- dump_vtable (BINFO_TYPE (binfo), binfo, decl);
- }
-
-@@ -6945,6 +7027,7 @@
- tree inits;
- tree id;
- tree vbase;
-+ tree slot_relocs;
-
- /* See if we've already created this construction vtable group. */
- id = mangle_ctor_vtbl_for_type (t, binfo);
-@@ -6955,11 +7038,13 @@
- /* Build a version of VTBL (with the wrong type) for use in
- constructing the addresses of secondary vtables in the
- construction vtable group. */
-+
- vtbl = build_vtable (t, id, ptr_type_node);
- DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
- list = build_tree_list (vtbl, NULL_TREE);
-+ slot_relocs = NULL_TREE;
- accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
-- binfo, t, list);
-+ binfo, t, list, NULL /* &slot_relocs */);
-
- /* Add the vtables for each of our virtual bases using the vbase in T
- binfo. */
-@@ -6973,7 +7058,7 @@
- continue;
- b = copied_binfo (vbase, binfo);
-
-- accumulate_vtbl_inits (b, vbase, binfo, t, list);
-+ accumulate_vtbl_inits (b, vbase, binfo, t, list, NULL /* &slot_relocs */);
- }
- inits = TREE_VALUE (list);
-
-@@ -6986,6 +7071,11 @@
- CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
- initialize_artificial_var (vtbl, inits);
- dump_vtable (t, binfo, vtbl);
-+
-+/* Construction vtables cause serious grief:
-+ determining overriding is tough - and we get the
-+ wrong vtable names for our fixups (etc.)
-+ append_slot_relocs (t, slot_relocs); */
- }
-
- /* Add the vtbl initializers for BINFO (and its bases other than
-@@ -7003,7 +7093,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree inits)
-+ tree inits,
-+ tree *slot_relocs)
- {
- int i;
- tree base_binfo;
-@@ -7026,7 +7117,7 @@
- TREE_VALUE (inits)
- = chainon (TREE_VALUE (inits),
- dfs_accumulate_vtbl_inits (binfo, orig_binfo,
-- rtti_binfo, t, inits));
-+ rtti_binfo, t, inits, slot_relocs));
-
- /* Walk the BINFO and its bases. We walk in preorder so that as we
- initialize each vtable we can figure out at what offset the
-@@ -7041,7 +7132,7 @@
- accumulate_vtbl_inits (base_binfo,
- BINFO_BASE_BINFO (orig_binfo, i),
- rtti_binfo, t,
-- inits);
-+ inits, slot_relocs);
- }
- }
-
-@@ -7053,7 +7144,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree l)
-+ tree l,
-+ tree *slot_relocs)
- {
- tree inits = NULL_TREE;
- tree vtbl = NULL_TREE;
-@@ -7120,7 +7212,7 @@
-
- /* Compute the initializer for this vtable. */
- inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
-- &non_fn_entries);
-+ &non_fn_entries, slot_relocs);
-
- /* Figure out the position to which the VPTR should point. */
- vtbl = TREE_PURPOSE (l);
-@@ -7154,6 +7246,40 @@
- return inits;
- }
-
-+#ifdef REALLY_BROKEN_NOW
-+static void
-+dump_slot_relocs (tree t, tree slot_relocs)
-+{
-+ tree st;
-+ fprintf (stderr, "Copy data for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+
-+ for (st = slot_relocs; st; st = TREE_CHAIN(st))
-+ {
-+ /* This is not correct anymore - not a binfo ... */
-+ tree orig_binfo = TREE_PURPOSE(st);
-+ tree init_list = TREE_VALUE(st);
-+ tree v;
-+ fprintf (stderr, "\tfrom %s (%d) entries\n",
-+ type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER),
-+ list_length (init_list));
-+ for (v = init_list; v; v = TREE_CHAIN(v))
-+ {
-+ if (!TREE_VALUE(v))
-+ fprintf (stderr, "\t\tNULL\n");
-+ else
-+ {
-+ tree fn = TREE_VALUE(v);
-+ fprintf (stderr, "\t\t%s ",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "[ %s ]\n",
-+ expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+ }
-+ }
-+ }
-+}
-+#endif
-+
- static GTY(()) tree abort_fndecl_addr;
-
- /* Construct the initializer for BINFO's virtual function table. BINFO
-@@ -7184,7 +7310,8 @@
- tree orig_binfo,
- tree t,
- tree rtti_binfo,
-- int* non_fn_entries_p)
-+ int* non_fn_entries_p,
-+ tree *slot_relocs)
- {
- tree v, b;
- tree vfun_inits;
-@@ -7192,6 +7319,8 @@
- unsigned ix;
- tree vbinfo;
- VEC(tree,gc) *vbases;
-+ tree slot_reloc_data;
-+ unsigned num_inits, num_parent_inits;
-
- /* Initialize VID. */
- memset (&vid, 0, sizeof (vid));
-@@ -7213,7 +7342,7 @@
- signature, we share the vcall offsets. */
- vid.fns = VEC_alloc (tree, gc, 32);
- /* Add the vcall and vbase offset entries. */
-- build_vcall_and_vbase_vtbl_entries (binfo, &vid);
-+ build_vcall_and_vbase_vtbl_entries (binfo, &vid, &num_parent_inits);
-
- /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
- build_vbase_offset_vtbl_entries. */
-@@ -7240,18 +7369,52 @@
- }
- }
-
-+ num_inits = list_length (vid.inits);
- if (non_fn_entries_p)
-- *non_fn_entries_p = list_length (vid.inits);
-+ *non_fn_entries_p = num_inits;
-+
-+ /* If we have non-function entries not present in a parent vtable,
-+ insert a bogus slot reloc copy from a NULL parent to pad that
-+ out */
-+ slot_reloc_data = NULL_TREE;
-+ if (slot_relocs && num_inits > num_parent_inits)
-+ {
-+ unsigned i;
-+ for (i = 0; i < num_inits - num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (NULL_TREE, slot_reloc_data, NULL));
-+ slot_reloc_data = NULL_TREE;
-+ }
-
- /* Go through all the ordinary virtual functions, building up
- initializers. */
- vfun_inits = NULL_TREE;
-+
-+ fprintf (stderr, "Init vtable idx %d: ",
-+ slot_relocs ? list_length (*slot_relocs) : -1);
-+ fprintf (stderr, " (%s)",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s)",
-+ type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (rtti_binfo, TFF_PLAIN_IDENTIFIER));
-+ if (get_primary_binfo (binfo))
-+ fprintf (stderr, " (%s)",
-+ type_as_string (get_primary_binfo (binfo), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "** %d inits **\n", num_inits);
-+
- for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
- {
- tree delta;
- tree vcall_index;
- tree fn, fn_original;
- tree init = NULL_TREE;
-+ tree slot_fn = NULL_TREE;
-+ tree first_overrider = NULL_TREE;
-
- fn = BV_FN (v);
- fn_original = fn;
-@@ -7281,7 +7444,10 @@
- {
- /* We found a defn before a lost primary; go ahead as normal. */
- if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
-- break;
-+ {
-+ first_overrider = TYPE_BINFO (BINFO_TYPE (b));
-+ break;
-+ }
-
- /* The nearest definition is from a lost primary; clear the
- slot. */
-@@ -7299,6 +7465,9 @@
- delta = BV_DELTA (v);
- vcall_index = BV_VCALL_INDEX (v);
-
-+/* fprintf (stderr, "\tVfn: %s\n",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER)); */
-+
- gcc_assert (TREE_CODE (delta) == INTEGER_CST);
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
-
-@@ -7319,9 +7488,40 @@
- if (!DECL_NAME (fn))
- finish_thunk (fn);
- }
-- /* Take the address of the function, considering it to be of an
-- appropriate generic type. */
-- init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+ else if (slot_relocs && first_overrider
-+ && BINFO_TYPE (first_overrider) != t
-+ /* necessary for virtual inheritance */
-+ && BINFO_TYPE (first_overrider) != binfo)
-+ {
-+ /* accumulate information about overriding */
-+ gcc_assert (BINFO_VTABLE (first_overrider));
-+ slot_fn = fn;
-+ init = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+/* fprintf (stderr, " %s : ",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s !=? ",
-+ type_as_string (BINFO_TYPE (first_overrider), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s %p !=? %p !=? %p !=? %p !=? %p\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER),
-+ BINFO_TYPE (first_overrider), t,
-+ binfo, orig_binfo, rtti_binfo);
-+ fprintf (stderr, "%p !=? %p !=? %p !=? %p !=? %p\n",
-+ BINFO_INHERITANCE_CHAIN (first_overrider),
-+ BINFO_INHERITANCE_CHAIN (t),
-+ BINFO_INHERITANCE_CHAIN (binfo),
-+ BINFO_INHERITANCE_CHAIN (orig_binfo),
-+ BINFO_INHERITANCE_CHAIN (rtti_binfo)); */
-+
-+ if (!init)
-+ {
-+ /* Take the address of the function, considering it to be of an
-+ appropriate generic type. */
-+ init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+ }
- }
- }
-
-@@ -7346,8 +7546,34 @@
- }
- else
- vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
-+
-+ /* Accumulate overriding information for subequent construction
-+ of copy-vtable initialisers */
-+ if (slot_relocs)
-+ {
-+ slot_reloc_data = tree_cons (NULL_TREE, slot_fn, slot_reloc_data);
-+ }
- }
-
-+ /* Write details about vtable inheritance, if we have any parent entries */
-+ if (slot_relocs)
-+ {
-+ unsigned i;
-+ tree copy_parent = orig_binfo;
-+ if (orig_binfo == TYPE_BINFO (t))
-+ copy_parent = get_primary_binfo (orig_binfo);
-+
-+ slot_reloc_data = nreverse (slot_reloc_data);
-+
-+ /* Prepend dummy entries for rtti etc. */
-+ for (i = 0; i < num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (copy_parent, slot_reloc_data, NULL));
-+ }
-+
- /* The initializers for virtual functions were built up in reverse
- order; straighten them out now. */
- vfun_inits = nreverse (vfun_inits);
-@@ -7363,7 +7589,8 @@
- offsets in BINFO, which is in the hierarchy dominated by T. */
-
- static void
--build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
-+build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid,
-+ unsigned *num_parent_inits)
- {
- tree b;
-
-@@ -7371,10 +7598,17 @@
- corresponding to the primary base class. */
- b = get_primary_binfo (binfo);
- if (b)
-- build_vcall_and_vbase_vtbl_entries (b, vid);
-+ build_vcall_and_vbase_vtbl_entries (b, vid, NULL);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-
- /* Add the vbase entries for this base. */
- build_vbase_offset_vtbl_entries (binfo, vid);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-+
- /* Add the vcall entries for this base. */
- build_vcall_offset_vtbl_entries (binfo, vid);
- }
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
---- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-15 13:00:54.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,14 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* foo */
-+extern GTY(()) tree vtable_copy_slots;
-+
-+/* A list of inherited vtable slots which are copies of other slots
-+ The source address is stored in the TREE_VALUE slot and the
-+ destination is stored in the TREE_PURPOSE slot. */
-+/* extern GTY(()) tree vtable_slot_copies; */
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-@@ -3847,6 +3857,7 @@
- extern void maybe_note_name_used_in_class (tree, tree);
- extern void note_name_declared_in_class (tree, tree);
- extern tree get_vtbl_decl_for_binfo (tree);
-+extern tree get_vtreloc_decl (tree, tree);
- extern void debug_class (tree);
- extern void debug_thunks (tree);
- extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4544,7 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtreloc_for_type (tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c 2008-01-10 12:20:49.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmask", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl2.c gcc-4.2.1-simple/gcc/cp/decl2.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl2.c 2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl2.c 2008-01-15 16:46:07.000000000 +0000
-@@ -1530,6 +1530,26 @@
- info. */
- note_debug_info_needed (ctype);
-
-+ fprintf (stderr, "Emit vtable for '%s'",
-+ type_as_string (ctype, TFF_PLAIN_IDENTIFIER));
-+ /* search for our type here:
-+
-+ Find it in the list ... and emit it !
-+
-++tree vtable_copy_slots;
-++
-++static void
-++append_slot_relocs (tree t, tree slot_relocs)
-++{
-++ if (slot_relocs)
-++ vtable_copy_slots = tree_cons (t, slot_relocs,
-++ vtable_copy_slots);
-+
-+ and emit some fun in a .vtreloc section for this vtable:
-+ with a given name, mangled from the type name [!]
-+ */
-+
-+
- return true;
- }
-
-@@ -2910,6 +2930,150 @@
- finish_objects (function_key, priority, body);
- }
-
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+ tree dest_binfo;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest || !bitmap)
-+ return chain;
-+
-+ dest_binfo = TYPE_BINFO (dest);
-+
-+ fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap);
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for_binfo (dest_binfo);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
-+static void
-+generate_vtable_copy_slots (void)
-+{
-+ tree k, decl;
-+
-+ if (!getenv ("VT_SHRINK"))
-+ return;
-+
-+ fprintf (stderr, "Generate_vtable_copy_slots\n");
-+
-+ for (k = vtable_copy_slots; k; k = TREE_CHAIN(k))
-+ {
-+ tree st;
-+ tree t = TREE_PURPOSE(k);
-+ tree slot_relocs = TREE_VALUE(k);
-+ int dest_offset = 0;
-+ tree inits = NULL_TREE;
-+
-+ fprintf (stderr, "Copy data for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ for (st = slot_relocs; st; st = TREE_CHAIN(st))
-+ {
-+ tree orig_binfo = TREE_PURPOSE(st);
-+ tree init_list = TREE_VALUE(st);
-+ tree v;
-+ int bitmap = 0;
-+ unsigned int i = 0;
-+ unsigned int src_offset = 0;
-+ int elide_leading_bits = 1;
-+
-+ fprintf (stderr, "\tfrom %s (%d) entries\n",
-+ orig_binfo ? type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER) : "<null pad>",
-+ list_length (init_list));
-+ for (v = init_list; v; v = TREE_CHAIN(v))
-+ {
-+ if (!TREE_VALUE(v))
-+ fprintf (stderr, "\t%3d\tNULL\n", dest_offset);
-+ else
-+ {
-+ tree fn = TREE_VALUE(v);
-+ elide_leading_bits = 0;
-+ fprintf (stderr, "\t%3d\t%s ", dest_offset,
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "[ %s ]\n",
-+ expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+ bitmap |= 1 << i;
-+ }
-+ /* don't waste space for non-copies */
-+ if (!elide_leading_bits)
-+ i++;
-+ dest_offset++;
-+ src_offset++;
-+ /* FIXME: this sucks - must be a better way to
-+ find target size: 32 or 64 (?) [ assuming elf etc. ] */
-+ if (i == (sizeof (long) * 8)) { /* FIXME ... arch size etc. */
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ i = bitmap = 0;
-+ }
-+ }
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ }
-+
-+ {
-+ tree decl, ctor, atype;
-+
-+ decl = get_vtreloc_decl (t, slot_relocs);
-+ import_export_decl (decl);
-+ if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
-+ {
-+ DECL_EXTERNAL (decl) = 0;
-+ comdat_linkage (decl);
-+ DECL_COMDAT (decl) = 1;
-+ ctor = build_constructor_from_list (TREE_TYPE (decl), inits);
-+ initialize_artificial_var (decl, ctor);
-+ TREE_PUBLIC (decl) = 0;
-+ DECL_WEAK (decl) = 1;
-+ DECL_INTERFACE_KNOWN (decl) = 1;
-+/* mark_used (decl); */
-+/* rest_of_decl_compilation (decl, 1, 1); */
-+ finish_decl (decl, ctor, NULL_TREE);
-+
-+ fprintf (stderr, "Generate vtreloc variable '%s' comdat? %d",
-+ decl_as_string (decl, TFF_PLAIN_IDENTIFIER),
-+ DECL_COMDAT (decl));
-+ }
-+ }
-+ }
-+}
-+
-+
- /* Generate constructor and destructor functions for the priority
- indicated by N. */
-
-@@ -3128,11 +3292,15 @@
- get emitted. */
- for (i = VEC_length (tree, unemitted_tinfo_decls);
- VEC_iterate (tree, unemitted_tinfo_decls, --i, t);)
-+ {
-+ fprintf (stderr, "Emit tinfo decl for '%s'\n",
-+ decl_as_string (t, TFF_PLAIN_IDENTIFIER));
- if (emit_tinfo_decl (t))
- {
- reconsider = true;
- VEC_unordered_remove (tree, unemitted_tinfo_decls, i);
- }
-+ }
-
- /* The list of objects with static storage duration is built up
- in reverse order. We clear STATIC_AGGREGATES so that any new
-@@ -3312,6 +3480,9 @@
- }
- }
-
-+ /* Generate C++ vtable copy data */
-+ generate_vtable_copy_slots ();
-+
- /* We give C linkage to static constructors and destructors. */
- push_lang_context (lang_name_c);
-
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
---- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-14 20:39:41.000000000 +0000
-@@ -2670,6 +2670,13 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+/* Create an identifier for the mangled name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_for_type (const tree type)
-+{
-+ return mangle_special_for_type (type, "VTR");
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/toplev.c gcc-4.2.1-simple/gcc/toplev.c
---- pristine-gcc-4.2.1-simple/gcc/toplev.c 2007-01-30 16:30:21.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/toplev.c 2008-01-14 21:32:26.000000000 +0000
-@@ -781,8 +781,17 @@
- if (needed)
- {
- rest_of_decl_compilation (decl, 1, 1);
-+ fprintf (stderr, "Emit decl:");
-+ print_generic_decl (stderr, decl, 0);
-+ fprintf (stderr, "\n");
- return true;
- }
-+ else
-+ {
-+ fprintf (stderr, "Skip emission of decl:");
-+ print_generic_decl (stderr, decl, 0);
-+ fprintf (stderr, "\n");
-+ }
- }
-
- return false;
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/tree.h gcc-4.2.1-simple/gcc/tree.h
---- pristine-gcc-4.2.1-simple/gcc/tree.h 2008-01-10 09:49:05.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/tree.h 2008-01-10 12:20:49.000000000 +0000
-@@ -2892,6 +2892,7 @@
- unsigned based_on_restrict_p : 1;
- /* Used by C++. Might become a generic decl flag. */
- unsigned shadowed_for_var_p : 1;
-+ unsigned vtreloc_init:1;
-
- /* Don't belong to VAR_DECL exclusively. */
- unsigned in_system_header_flag : 1;
-@@ -2918,6 +2919,9 @@
- is not error_mark_node, then the decl cannot be put in .common. */
- #define DECL_COMMON(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.common_flag)
-
-+/* should we be emitted in a vtreloc section ? */
-+#define DECL_VTRELOC_INIT(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.vtreloc_init)
-+
- /* In a VAR_DECL, nonzero if the decl is a register variable with
- an explicit asm specification. */
- #define DECL_HARD_REGISTER(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.hard_register)
diff --git a/patches/test/gcc-vt-copy-3.diff b/patches/test/gcc-vt-copy-3.diff
deleted file mode 100644
index d4d5b9452..000000000
--- a/patches/test/gcc-vt-copy-3.diff
+++ /dev/null
@@ -1,929 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/collect2.c gcc-4.2.1-simple/gcc/collect2.c
---- pristine-gcc-4.2.1-simple/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c 2008-01-18 14:08:10.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/class.c gcc-4.2.1-simple/gcc/cp/class.c
---- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-18 21:35:34.000000000 +0000
-@@ -136,7 +136,7 @@
- static tree fixed_type_or_null (tree, int *, int *);
- static tree build_simple_base_path (tree expr, tree binfo);
- static tree build_vtbl_ref_1 (tree, tree);
--static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
-+static tree build_vtbl_initializer (tree, tree, tree, tree, int *, tree *);
- static int count_fields (tree);
- static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
- static void check_bitfield_decl (tree);
-@@ -180,11 +180,11 @@
- tree, tree, splay_tree);
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
--static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
-+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree, tree *);
- static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+ tree, tree *);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
--static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
-+static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *, unsigned *);
- static void clone_constructors_and_destructors (tree);
- static tree build_clone (tree, tree);
- static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
-@@ -2013,6 +2013,10 @@
- return;
- }
- overrider_target = overrider_fn = TREE_PURPOSE (overrider);
-+ fprintf (stderr, "override %d %d\n",
-+ TREE_VALUE (overrider) != binfo,
-+ first_defn != binfo);
-+ BV_INHERITED(*virtuals) = TREE_VALUE (overrider) != binfo;
-
- /* Check for adjusting covariant return types. */
- over_return = TREE_TYPE (TREE_TYPE (overrider_target));
-@@ -6355,6 +6359,47 @@
- return decl;
- }
-
-+/* Returns the VAR_DECL for the vtable copy relocation entries associated
-+ with BINFO. */
-+
-+tree get_vtreloc_decl (tree t, tree inits)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtreloc_for_type (t);
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ int nslots = list_length (inits);
-+ tree atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (nslots - 1)));
-+ layout_type (atype);
-+ TYPE_ALIGN (atype) = BITS_PER_UNIT * 4;
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_ALIGN(d) = 1;
-+ DECL_USER_ALIGN(d) = 1;
-+ DECL_SECTION_NAME(d) = mangle_vtreloc_section_for_type (t);
-+ SET_DECL_ASSEMBLER_NAME (d, name);
-+ /* Remember the type it is for. */
-+ TREE_TYPE (name) = t;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_COMDAT (d) = 1;
-+ /* Mark the variable as undefined -- but remember that we can
-+ define it later if we need to do so. */
-+ DECL_EXTERNAL (d) = 0;
-+ DECL_NOT_REALLY_EXTERN (d) = 1;
-+ set_linkage_according_to_type (t, d);
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+ }
-+
-+ return d;
-+}
-
- /* Returns the binfo for the primary base of BINFO. If the resulting
- BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6637,6 +6682,148 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+/* List of vtable copy slot data, keyed by type */
-+/*
-+ * toplevel: purpose - type
-+ * value - [slot relocs]
-+ * slot relocs: purpose - original binfo
-+ * value - init structures: [src, dest, bitmask]
-+ */
-+tree vtable_copy_slots;
-+
-+
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+ tree dest_binfo;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest || !bitmap)
-+ return chain;
-+
-+ dest_binfo = TYPE_BINFO (dest);
-+
-+ fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap);
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for_binfo (dest_binfo);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
-+/* Register vtreloc for a given type, and return a decl
-+ for this type's vtrelocs */
-+static tree
-+build_vtreloc_decl (tree t, tree slot_relocs)
-+{
-+ int dest_offset = 0;
-+ tree inits = NULL_TREE;
-+ tree st;
-+
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Copy data for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ for (st = slot_relocs; st; st = TREE_CHAIN(st))
-+ {
-+ tree orig_binfo = TREE_PURPOSE(st);
-+ tree init_list = TREE_VALUE(st);
-+ tree v;
-+ int bitmap = 0;
-+ unsigned int i = 0;
-+ unsigned int src_offset = 0;
-+ int elide_leading_bits = 1;
-+
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "\tfrom %s (%d) entries\n",
-+ orig_binfo ? type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER) : "<null pad>",
-+ list_length (init_list));
-+ for (v = init_list; v; v = TREE_CHAIN(v))
-+ {
-+ if (!TREE_VALUE(v))
-+ {
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "\t%3d\tNULL\n", dest_offset);
-+ }
-+ else
-+ {
-+ tree fn = TREE_VALUE(v);
-+ elide_leading_bits = 0;
-+ if (getenv ("MOREDEBUG"))
-+ {
-+ fprintf (stderr, "\t%3d\t%s ", dest_offset,
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "[ %s ]\n",
-+ expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+ }
-+ bitmap |= 1 << i;
-+ }
-+ /* don't waste space for non-copies */
-+ if (!elide_leading_bits)
-+ i++;
-+ dest_offset++;
-+ src_offset++;
-+ /* FIXME: this sucks - must be a better way to
-+ find target size: 32 or 64 (?) [ assuming elf etc. ] */
-+ if (i == (sizeof (long) * 8)) { /* FIXME ... arch size etc. */
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ i = bitmap = 0;
-+ }
-+ }
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ }
-+
-+ if (inits)
-+ {
-+ tree decl;
-+
-+ vtable_copy_slots = tree_cons (t, inits, vtable_copy_slots);
-+
-+ decl = get_vtreloc_decl (t, inits);
-+
-+ return build_nop (vfunc_ptr_type_node, build_address (decl));
-+ }
-+ else
-+ return fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xf00df00d));
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-@@ -6647,19 +6834,30 @@
- tree list;
- tree vbase;
-
-+ tree slot_relocs = NULL_TREE;
- /* We lay out the primary and secondary vtables in one contiguous
- vtable. The primary vtable is first, followed by the non-virtual
- secondary vtables in inheritance graph order. */
- list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
- accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
-- TYPE_BINFO (t), t, list);
-+ TYPE_BINFO (t), t, list,
-+ &slot_relocs);
-
- /* Then come the virtual bases, also in inheritance graph order. */
- for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
- {
- if (!BINFO_VIRTUAL_P (vbase))
- continue;
-- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
-+ accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list, &slot_relocs);
-+ }
-+
-+ /* So ... we have a hack here - we append a reference to
-+ the vtable to ourselves, in order to stop us getting GC'd */
-+ if (slot_relocs)
-+ {
-+ tree init = build_vtreloc_decl (t, slot_relocs);
-+ TREE_VALUE (list) = chainon (TREE_VALUE (list),
-+ build_tree_list (NULL_TREE, init));
- }
-
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-@@ -6945,6 +7143,7 @@
- tree inits;
- tree id;
- tree vbase;
-+ tree slot_relocs;
-
- /* See if we've already created this construction vtable group. */
- id = mangle_ctor_vtbl_for_type (t, binfo);
-@@ -6955,11 +7154,13 @@
- /* Build a version of VTBL (with the wrong type) for use in
- constructing the addresses of secondary vtables in the
- construction vtable group. */
-+
- vtbl = build_vtable (t, id, ptr_type_node);
- DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
- list = build_tree_list (vtbl, NULL_TREE);
-+ slot_relocs = NULL_TREE;
- accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
-- binfo, t, list);
-+ binfo, t, list, NULL /* &slot_relocs */);
-
- /* Add the vtables for each of our virtual bases using the vbase in T
- binfo. */
-@@ -6973,7 +7174,7 @@
- continue;
- b = copied_binfo (vbase, binfo);
-
-- accumulate_vtbl_inits (b, vbase, binfo, t, list);
-+ accumulate_vtbl_inits (b, vbase, binfo, t, list, NULL /* &slot_relocs */);
- }
- inits = TREE_VALUE (list);
-
-@@ -6986,6 +7187,11 @@
- CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
- initialize_artificial_var (vtbl, inits);
- dump_vtable (t, binfo, vtbl);
-+
-+/* Construction vtables cause serious grief:
-+ determining overriding is tough - and we get the
-+ wrong vtable names for our fixups (etc.)
-+ append_slot_relocs (t, slot_relocs); */
- }
-
- /* Add the vtbl initializers for BINFO (and its bases other than
-@@ -7003,7 +7209,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree inits)
-+ tree inits,
-+ tree *slot_relocs)
- {
- int i;
- tree base_binfo;
-@@ -7026,7 +7233,7 @@
- TREE_VALUE (inits)
- = chainon (TREE_VALUE (inits),
- dfs_accumulate_vtbl_inits (binfo, orig_binfo,
-- rtti_binfo, t, inits));
-+ rtti_binfo, t, inits, slot_relocs));
-
- /* Walk the BINFO and its bases. We walk in preorder so that as we
- initialize each vtable we can figure out at what offset the
-@@ -7041,7 +7248,7 @@
- accumulate_vtbl_inits (base_binfo,
- BINFO_BASE_BINFO (orig_binfo, i),
- rtti_binfo, t,
-- inits);
-+ inits, slot_relocs);
- }
- }
-
-@@ -7053,7 +7260,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree l)
-+ tree l,
-+ tree *slot_relocs)
- {
- tree inits = NULL_TREE;
- tree vtbl = NULL_TREE;
-@@ -7120,7 +7328,7 @@
-
- /* Compute the initializer for this vtable. */
- inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
-- &non_fn_entries);
-+ &non_fn_entries, slot_relocs);
-
- /* Figure out the position to which the VPTR should point. */
- vtbl = TREE_PURPOSE (l);
-@@ -7184,7 +7392,8 @@
- tree orig_binfo,
- tree t,
- tree rtti_binfo,
-- int* non_fn_entries_p)
-+ int* non_fn_entries_p,
-+ tree *slot_relocs)
- {
- tree v, b;
- tree vfun_inits;
-@@ -7192,6 +7401,8 @@
- unsigned ix;
- tree vbinfo;
- VEC(tree,gc) *vbases;
-+ tree slot_reloc_data;
-+ unsigned num_inits, num_parent_inits;
-
- /* Initialize VID. */
- memset (&vid, 0, sizeof (vid));
-@@ -7213,7 +7424,7 @@
- signature, we share the vcall offsets. */
- vid.fns = VEC_alloc (tree, gc, 32);
- /* Add the vcall and vbase offset entries. */
-- build_vcall_and_vbase_vtbl_entries (binfo, &vid);
-+ build_vcall_and_vbase_vtbl_entries (binfo, &vid, &num_parent_inits);
-
- /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
- build_vbase_offset_vtbl_entries. */
-@@ -7240,20 +7451,57 @@
- }
- }
-
-+ num_inits = list_length (vid.inits);
- if (non_fn_entries_p)
-- *non_fn_entries_p = list_length (vid.inits);
-+ *non_fn_entries_p = num_inits;
-+
-+ /* If we have non-function entries not present in a parent vtable,
-+ insert a bogus slot reloc copy from a NULL parent to pad that
-+ out */
-+ slot_reloc_data = NULL_TREE;
-+ if (slot_relocs && num_inits > num_parent_inits)
-+ {
-+ unsigned i;
-+ for (i = 0; i < num_inits - num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (NULL_TREE, slot_reloc_data, NULL));
-+ slot_reloc_data = NULL_TREE;
-+ }
-
- /* Go through all the ordinary virtual functions, building up
- initializers. */
- vfun_inits = NULL_TREE;
-+
-+ if (getenv ("MOREDEBUG"))
-+ {
-+ fprintf (stderr, "Init vtable idx %d: ",
-+ slot_relocs ? list_length (*slot_relocs) : -1);
-+ fprintf (stderr, " (%s)",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s)",
-+ type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (rtti_binfo, TFF_PLAIN_IDENTIFIER));
-+ if (get_primary_binfo (binfo))
-+ fprintf (stderr, " (%s)",
-+ type_as_string (get_primary_binfo (binfo), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "** %d inits **\n", num_inits);
-+ }
-+
- for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
- {
- tree delta;
- tree vcall_index;
- tree fn, fn_original;
- tree init = NULL_TREE;
-+ tree slot_fn = NULL_TREE;
-+ tree first_overrider = NULL_TREE;
-
-- fn = BV_FN (v);
-+ fn = BV_FN (v); /* v! */
- fn_original = fn;
- if (DECL_THUNK_P (fn))
- {
-@@ -7281,7 +7529,10 @@
- {
- /* We found a defn before a lost primary; go ahead as normal. */
- if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
-- break;
-+ {
-+ first_overrider = TYPE_BINFO (BINFO_TYPE (b));
-+ break;
-+ }
-
- /* The nearest definition is from a lost primary; clear the
- slot. */
-@@ -7299,6 +7550,9 @@
- delta = BV_DELTA (v);
- vcall_index = BV_VCALL_INDEX (v);
-
-+/* fprintf (stderr, "\tVfn: %s\n",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER)); */
-+
- gcc_assert (TREE_CODE (delta) == INTEGER_CST);
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
-
-@@ -7313,15 +7567,81 @@
- }
- else
- {
-- if (!integer_zerop (delta) || vcall_index)
-+#if 0
-+ if (slot_relocs && first_overrider
-+ && BINFO_TYPE (first_overrider) != t
-+ /* necessary for virtual inheritance */
-+ && BINFO_TYPE (first_overrider) != binfo)
-+ {
-+ /* accumulate information about overriding */
-+ gcc_assert (BINFO_VTABLE (first_overrider));
-+ slot_fn = fn;
-+ init = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ else if (!integer_zerop (delta) || vcall_index)
- {
- fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
- if (!DECL_NAME (fn))
- finish_thunk (fn);
- }
-- /* Take the address of the function, considering it to be of an
-- appropriate generic type. */
-- init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+#endif
-+
-+ // FIXME: switched these around !
-+ if (!integer_zerop (delta) || vcall_index)
-+ {
-+ if (BV_INHERITED (v))
-+ {
-+ slot_fn = fn;
-+ init = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadf000));
-+ fprintf (stderr,"inherited thunk!\n");
-+ }
-+ else
-+ {
-+ fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
-+ if (!DECL_NAME (fn))
-+ finish_thunk (fn);
-+ }
-+ }
-+ else if (slot_relocs && first_overrider
-+ && BINFO_TYPE (first_overrider) != t
-+ /* necessary for virtual inheritance */
-+ && BINFO_TYPE (first_overrider) != binfo)
-+ {
-+ /* accumulate information about overriding */
-+ gcc_assert (BINFO_VTABLE (first_overrider));
-+ slot_fn = fn;
-+ init = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ fprintf (stderr, " %s : ",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s !=? ",
-+ type_as_string (BINFO_TYPE (first_overrider), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s %p !=? %p !=? %p !=? %p !=? %p\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER),
-+ BINFO_TYPE (first_overrider), t,
-+ binfo, orig_binfo, rtti_binfo);
-+ fprintf (stderr, "%p !=? %p !=? %p !=? %p !=? %p\n",
-+ BINFO_INHERITANCE_CHAIN (first_overrider),
-+ BINFO_INHERITANCE_CHAIN (t),
-+ BINFO_INHERITANCE_CHAIN (binfo),
-+ BINFO_INHERITANCE_CHAIN (orig_binfo),
-+ BINFO_INHERITANCE_CHAIN (rtti_binfo));
-+
-+ if (!init)
-+ {
-+ /* Take the address of the function, considering it to be of an
-+ appropriate generic type. */
-+ init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+ }
- }
- }
-
-@@ -7346,8 +7666,34 @@
- }
- else
- vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
-+
-+ /* Accumulate overriding information for subequent construction
-+ of copy-vtable initialisers */
-+ if (slot_relocs)
-+ {
-+ slot_reloc_data = tree_cons (NULL_TREE, slot_fn, slot_reloc_data);
-+ }
- }
-
-+ /* Write details about vtable inheritance, if we have any parent entries */
-+ if (slot_relocs)
-+ {
-+ unsigned i;
-+ tree copy_parent = orig_binfo;
-+ if (orig_binfo == TYPE_BINFO (t))
-+ copy_parent = get_primary_binfo (orig_binfo);
-+
-+ slot_reloc_data = nreverse (slot_reloc_data);
-+
-+ /* Prepend dummy entries for rtti etc. */
-+ for (i = 0; i < num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (copy_parent, slot_reloc_data, NULL));
-+ }
-+
- /* The initializers for virtual functions were built up in reverse
- order; straighten them out now. */
- vfun_inits = nreverse (vfun_inits);
-@@ -7363,7 +7709,8 @@
- offsets in BINFO, which is in the hierarchy dominated by T. */
-
- static void
--build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
-+build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid,
-+ unsigned *num_parent_inits)
- {
- tree b;
-
-@@ -7371,10 +7718,17 @@
- corresponding to the primary base class. */
- b = get_primary_binfo (binfo);
- if (b)
-- build_vcall_and_vbase_vtbl_entries (b, vid);
-+ build_vcall_and_vbase_vtbl_entries (b, vid, NULL);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-
- /* Add the vbase entries for this base. */
- build_vbase_offset_vtbl_entries (binfo, vid);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-+
- /* Add the vcall entries for this base. */
- build_vcall_offset_vtbl_entries (binfo, vid);
- }
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
---- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-18 21:18:56.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -1466,6 +1468,9 @@
- /* The function to call. */
- #define BV_FN(NODE) (TREE_VALUE (NODE))
-
-+/* Inherited, rather than implemented by the class itself. */
-+#define BV_INHERITED(NODE) (TREE_THIS_VOLATILE(NODE))
-+
-
- /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
- this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
-@@ -3392,6 +3397,11 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* A list of inherited vtable slots which are copies of other slots
-+ The source address is stored in the TREE_VALUE slot and the
-+ destination is stored in the TREE_PURPOSE slot. */
-+extern GTY(()) tree vtable_copy_slots;
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-@@ -3847,6 +3857,7 @@
- extern void maybe_note_name_used_in_class (tree, tree);
- extern void note_name_declared_in_class (tree, tree);
- extern tree get_vtbl_decl_for_binfo (tree);
-+extern tree get_vtreloc_decl (tree, tree);
- extern void debug_class (tree);
- extern void debug_thunks (tree);
- extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4544,8 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtreloc_for_type (tree);
-+extern tree mangle_vtreloc_section_for_type (tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c 2008-01-18 14:08:10.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmask", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl2.c gcc-4.2.1-simple/gcc/cp/decl2.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl2.c 2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl2.c 2008-01-18 14:08:10.000000000 +0000
-@@ -2910,6 +2910,45 @@
- finish_objects (function_key, priority, body);
- }
-
-+static void
-+generate_vtable_copy_slots (void)
-+{
-+ tree k;
-+
-+ if (!getenv ("VT_SHRINK"))
-+ return;
-+
-+ fprintf (stderr, "Generate_vtable_copy_slots\n");
-+
-+ for (k = vtable_copy_slots; k; k = TREE_CHAIN(k))
-+ {
-+ tree t = TREE_PURPOSE(k);
-+ tree inits = TREE_VALUE(k);
-+ tree decl, ctor;
-+
-+ decl = get_vtreloc_decl (t, inits);
-+ import_export_decl (decl);
-+ if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
-+ {
-+ DECL_EXTERNAL (decl) = 0;
-+ comdat_linkage (decl);
-+ DECL_COMDAT (decl) = 1;
-+ ctor = build_constructor_from_list (TREE_TYPE (decl), inits);
-+ initialize_artificial_var (decl, ctor);
-+/*
-+// TREE_PUBLIC (decl) = 0;
-+// DECL_WEAK (decl) = 1;
-+// DECL_INTERFACE_KNOWN (decl) = 1;
-+*/
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Generate vtreloc variable '%s' comdat? %d\n",
-+ decl_as_string (decl, TFF_PLAIN_IDENTIFIER),
-+ DECL_COMDAT (decl));
-+ }
-+ }
-+}
-+
-+
- /* Generate constructor and destructor functions for the priority
- indicated by N. */
-
-@@ -3312,6 +3351,9 @@
- }
- }
-
-+ /* Generate C++ vtable copy data */
-+ generate_vtable_copy_slots ();
-+
- /* We give C linkage to static constructors and destructors. */
- push_lang_context (lang_name_c);
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
---- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-18 14:08:10.000000000 +0000
-@@ -2670,6 +2670,76 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+/* FIXME: as should be obvious I have no idea what I'm doing here */
-+static int calc_max_depth (const tree binfo)
-+{
-+ int i, max = 0;
-+ tree base;
-+
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base); ++i) {
-+ int depth = calc_max_depth (base);
-+ if (depth > max)
-+ max = depth;
-+ }
-+ return max + 1;
-+}
-+
-+static void write_order_complexity_for_type (const tree type)
-+{
-+ int max_depth = 0;
-+ int i, virts;
-+ tree binfo, vbase, p;
-+ char buffer[128]; /* hack */
-+
-+ binfo = TYPE_BINFO (type);
-+
-+ max_depth = calc_max_depth (binfo);
-+
-+#if 0
-+ /* FIXME: virtual bases ? */
-+ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
-+ virts++;
-+#endif
-+ virts = 0;
-+
-+ sprintf (buffer, "_%.8i_", max_depth + virts);
-+ write_string (buffer);
-+}
-+
-+/*
-+ * In order to get initialization order right, use a metric of
-+ * the maximum 'inheritedness' of a class, ie. a vtable that
-+ * inherits from 5 others, should be initialized after those
-+ * that inherit from 4
-+ */
-+static const char *mangle_vtreloc (const tree type, const char *prefix)
-+{
-+ const char *name;
-+
-+ start_mangling (type, /*ident_p=*/true);
-+ write_string (prefix);
-+ write_order_complexity_for_type (type);
-+ write_type (type);
-+ name = finish_mangling (/*warn=*/false);
-+
-+ return name;
-+}
-+
-+/* Create an identifier for the mangled name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_for_type (const tree type)
-+{
-+ return get_identifier_nocopy (mangle_vtreloc (type, "_ZVTR"));
-+}
-+
-+/* Create an identifier for the section name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_section_for_type (const tree type)
-+{
-+ const char *name = mangle_vtreloc (type, ".vtrelocs._ZVTR");
-+ return build_string (strlen (name), name);
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/method.c gcc-4.2.1-simple/gcc/cp/method.c
---- pristine-gcc-4.2.1-simple/gcc/cp/method.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/method.c 2008-01-18 15:26:30.000000000 +0000
-@@ -169,6 +169,9 @@
- TREE_CHAIN (thunk) = DECL_THUNKS (function);
- DECL_THUNKS (function) = thunk;
-
-+ fprintf (stderr, "make_thunk for '%s'\n",
-+ decl_as_string (function, TFF_PLAIN_IDENTIFIER));
-+
- return thunk;
- }
-
-@@ -426,6 +429,9 @@
- DECL_ARGUMENTS (thunk_fndecl) = a;
- BLOCK_VARS (DECL_INITIAL (thunk_fndecl)) = a;
-
-+ fprintf (stderr, "Generate thunk '%s'\n",
-+ decl_as_string (thunk_fndecl, TFF_PLAIN_IDENTIFIER));
-+
- if (this_adjusting
- && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
- virtual_value, alias))
-@@ -521,6 +527,8 @@
-
- thunk_fndecl = finish_function (0);
- tree_lowering_passes (thunk_fndecl);
-+
-+ // causes emit_associated_thunks to be called ... [hmm ]
- expand_body (thunk_fndecl);
- }
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/semantics.c gcc-4.2.1-simple/gcc/cp/semantics.c
---- pristine-gcc-4.2.1-simple/gcc/cp/semantics.c 2008-01-10 09:49:05.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/semantics.c 2008-01-18 15:39:24.000000000 +0000
-@@ -55,7 +55,7 @@
-
- static tree maybe_convert_cond (tree);
- static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
--static void emit_associated_thunks (tree);
-+void emit_associated_thunks (tree);
- static tree finalize_nrv_r (tree *, int *, void *);
-
-
-@@ -3017,7 +3017,7 @@
-
- /* Emit all thunks to FN that should be emitted when FN is emitted. */
-
--static void
-+void
- emit_associated_thunks (tree fn)
- {
- /* When we use vcall offsets, we emit thunks with the virtual
diff --git a/patches/test/gcc-vt-copy-4-0.diff b/patches/test/gcc-vt-copy-4-0.diff
deleted file mode 100644
index e55c9b965..000000000
--- a/patches/test/gcc-vt-copy-4-0.diff
+++ /dev/null
@@ -1,864 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/collect2.c gcc-4.2.1-simple/gcc/collect2.c
---- pristine-gcc-4.2.1-simple/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c 2008-01-21 19:50:44.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/class.c gcc-4.2.1-simple/gcc/cp/class.c
---- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-22 15:02:56.000000000 +0000
-@@ -181,8 +181,7 @@
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
- static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
--static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
- static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
- static void clone_constructors_and_destructors (tree);
-@@ -6355,6 +6354,49 @@
- return decl;
- }
-
-+/* Returns the VAR_DECL for the vtable copy relocation entries associated
-+ with BINFO. */
-+
-+tree get_vtreloc_decl (tree t, tree inits)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtreloc_for_type (t);
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ int nslots = list_length (inits);
-+ tree atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (nslots - 1)));
-+ layout_type (atype);
-+ TYPE_ALIGN (atype) = BITS_PER_UNIT * 4;
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_ALIGN(d) = 1;
-+ DECL_USER_ALIGN(d) = 1;
-+ DECL_SECTION_NAME(d) = mangle_vtreloc_section_for_type (t);
-+ SET_DECL_ASSEMBLER_NAME (d, name);
-+ /* Remember the type it is for. */
-+ TREE_TYPE (name) = t;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_COMDAT (d) = 1;
-+ /* Mark the variable as undefined -- but remember that we can
-+ define it later if we need to do so. */
-+ DECL_EXTERNAL (d) = 0;
-+ DECL_NOT_REALLY_EXTERN (d) = 1;
-+ set_linkage_according_to_type (t, d);
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+
-+ vtable_copy_slots = tree_cons (t, inits, vtable_copy_slots);
-+ }
-+
-+ return d;
-+}
-
- /* Returns the binfo for the primary base of BINFO. If the resulting
- BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6438,7 +6480,7 @@
- if (indented)
- fprintf (stream, "\n");
-
-- if (!(flags & TDF_SLIM))
-+ if (1) /* !(flags & TDF_SLIM)) */
- {
- int indented = 0;
-
-@@ -6637,12 +6679,100 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+/* List of vtable copy slot data, keyed by type */
-+/*
-+ * toplevel: purpose - type
-+ * value - [slot relocs]
-+ * slot relocs: purpose - original binfo
-+ * value - init structures: [src, dest, bitmap]
-+ */
-+tree vtable_copy_slots;
-+
-+
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+static tree
-+get_local_vtbl_decl_for_binfo (tree binfo)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtbl_for_type_local (BINFO_TYPE (binfo));
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ tree atype;
-+ atype = build_cplus_array_type (vtable_entry_type,
-+ build_index_type (size_int (1)));
-+ layout_type (atype);
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_VISIBILITY (d) = VISIBILITY_HIDDEN;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_EXTERNAL (d) = 0;
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+ }
-+
-+ return d;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest_binfo, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest_binfo || !bitmap)
-+ return chain;
-+
-+ fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap);
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for_binfo (dest_binfo);
-+ dest_decl = get_local_vtbl_decl_for_binfo (dest_binfo);
-+
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-
--static void
--finish_vtbls (tree t)
-+static tree
-+vtbl_get_inits (tree t)
- {
- tree list;
- tree vbase;
-@@ -6662,8 +6792,397 @@
- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
- }
-
-+ return TREE_VALUE (list);
-+}
-+
-+/* List of un-altered vtable inits */
-+/*
-+ * list of: purpose - type
-+ * value - [constructor_list]
-+ */
-+tree vtable_copy_types;
-+
-+/* FIXME: rather a lame search */
-+static VEC(constructor_elt,gc) *
-+get_vtinit_for_binfo (tree binfo, int list_only)
-+{
-+ tree k;
-+ for (k = vtable_copy_types; k; k = TREE_CHAIN(k))
-+ {
-+ if (TREE_PURPOSE(k) == binfo)
-+ return CONSTRUCTOR_ELTS (TREE_VALUE(k));
-+ }
-+ if (list_only)
-+ return NULL;
-+
-+ fprintf (stderr, "vtinit list: type %s not found\n",
-+ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
-+ k = get_vtbl_decl_for_binfo (binfo);
-+ if (k)
-+ return CONSTRUCTOR_ELTS (DECL_INITIAL (k));
-+ else
-+ return NULL;
-+}
-+
-+static void
-+set_vtinit_for_binfo (tree binfo, VEC(constructor_elt,gc) *vtinits)
-+{
-+ /* FIXME: should we search for it first ? */
-+ fprintf (stderr, "vtinit list: add type %s\n",
-+ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
-+ vtable_copy_types = tree_cons (binfo, build_constructor (NULL_TREE, vtinits),
-+ vtable_copy_types);
-+}
-+
-+static void
-+debug_vtable (tree t, tree binfo)
-+{
-+ tree value;
-+ unsigned HOST_WIDE_INT ix;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ fprintf (stderr, "VTable for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+
-+ vtable = get_vtinit_for_binfo (binfo, 0);
-+ if (!vtable)
-+ {
-+ fprintf (stderr, "<none>\n");
-+ return;
-+ }
-+
-+ FOR_EACH_CONSTRUCTOR_VALUE (vtable, ix, value)
-+ {
-+ fprintf (stderr, "\t%-4ld %s\n", (long)ix,
-+ expr_as_string (value, TFF_PLAIN_IDENTIFIER));
-+ }
-+}
-+
-+/* to track a segment of vtable initializer */
-+typedef struct vt_fragment_d GTY(()) {
-+ tree binfo;
-+
-+ /* ptr into the vec decl */
-+ unsigned int offset;
-+ unsigned int size;
-+ VEC(constructor_elt,gc) *vec;
-+} vt_fragment;
-+
-+typedef struct vt_copy_record_d GTY(()) {
-+ vt_fragment *src;
-+ vt_fragment *dest;
-+ unsigned int bitmap;
-+ unsigned int offset;
-+} vt_copy_record;
-+
-+DEF_VEC_O(vt_fragment);
-+DEF_VEC_O(vt_copy_record);
-+DEF_VEC_ALLOC_O(vt_fragment, heap);
-+DEF_VEC_ALLOC_O(vt_copy_record, heap);
-+
-+static void
-+vtdecompose_frags (tree t_binfo, VEC(vt_fragment,heap) **frags)
-+{
-+ unsigned int seek_fn = 1, i;
-+ vt_fragment *frag = NULL;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ vtable = get_vtinit_for_binfo (t_binfo, 0);
-+ if (!vtable)
-+ return;
-+
-+ for (i = 0; i < VEC_length(constructor_elt,vtable); i++)
-+ {
-+ tree fn = VEC_index (constructor_elt, vtable, i)->value;
-+ int is_fn = TREE_CODE (fn) == ADDR_EXPR
-+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL;
-+
-+ if (is_fn && seek_fn)
-+ {
-+ frag = VEC_safe_push (vt_fragment, heap, *frags, NULL);
-+ frag->binfo = t_binfo;
-+ frag->offset = i;
-+ frag->size = VEC_length (constructor_elt, vtable) - i;
-+ frag->vec = vtable;
-+ seek_fn = 0;
-+ }
-+ if (!is_fn && !seek_fn)
-+ {
-+ frag->size = i - frag->offset;
-+ seek_fn = 1;
-+ }
-+ }
-+}
-+
-+static void
-+debug_fragments (VEC(vt_fragment,heap) *frags)
-+{
-+ unsigned int i;
-+ for (i = 0; i < VEC_length(vt_fragment,frags); i++)
-+ {
-+ vt_fragment *frag = VEC_index (vt_fragment, frags, i);
-+ fprintf (stderr, "fragment %d: '%s' offset %d, size %d\n",
-+ i, type_as_string (BINFO_TYPE (frag->binfo), TFF_PLAIN_IDENTIFIER),
-+ frag->offset, frag->size);
-+ }
-+}
-+
-+static void
-+push_vtfrag (VEC(vt_copy_record,heap) **vt_copies,
-+ vt_fragment *src, vt_fragment *dest,
-+ unsigned int bitmap, unsigned int offset)
-+{
-+ vt_copy_record *rec;
-+
-+ /* FIXME: we need to be able to compare these */
-+ /* that is not easy, sadly - so punt for now (?), and hope we don't get too
-+ * many duplicate / overlapping hits */
-+ rec = VEC_safe_push (vt_copy_record, heap, *vt_copies, NULL);
-+ rec->src = src;
-+ rec->dest = dest;
-+ rec->bitmap = bitmap;
-+ rec->offset = offset;
-+ fprintf (stderr, "Push frag 0x%x %d\n", bitmap, offset);
-+}
-+
-+static void
-+debug_vt_copies (VEC(vt_copy_record,heap) *vt_copies)
-+{
-+ unsigned int i;
-+ fprintf (stderr, "vtcopies: %d records\n", VEC_length(vt_copy_record, vt_copies));
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ vt_copy_record *cpy = VEC_index (vt_copy_record, vt_copies, i);
-+ fprintf (stderr, "\tcopy from %s+%d to %s+%d mask 0x%x\n",
-+ type_as_string (BINFO_TYPE (cpy->src->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->src->offset + cpy->offset,
-+ type_as_string (BINFO_TYPE (cpy->dest->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->dest->offset + cpy->offset,
-+ cpy->bitmap);
-+ }
-+}
-+
-+/*
-+ * Compare all src & dest fragments for the best match ...
-+ */
-+static tree
-+compare_build_vtrelocs (tree t, VEC(constructor_elt,gc) *vinits,
-+ VEC(vt_fragment,heap) *dest_frags,
-+ VEC(vt_fragment,heap) *src_frags)
-+{
-+ unsigned int i;
-+ tree cgraph_clobber = NULL_TREE;
-+ VEC(vt_copy_record,heap) *vt_copies;
-+
-+ vt_copies = VEC_alloc(vt_copy_record, heap, VEC_length(vt_fragment, dest_frags));
-+
-+ for (i = 0; i < VEC_length(vt_fragment, dest_frags); i++)
-+ {
-+ unsigned int j;
-+ vt_fragment *dest = VEC_index (vt_fragment, dest_frags, i);
-+
-+ for (j = 0; j < VEC_length(vt_fragment, src_frags); j++)
-+ {
-+ unsigned int cmp;
-+ unsigned int k, bits_set;
-+ unsigned int bitmap;
-+ int elide_leading_zeros = 1;
-+ vt_fragment *src = VEC_index (vt_fragment, src_frags, j);
-+
-+ /* new virtual methods arrive only in the 1st dest fragment */
-+ if (i > 0 && dest->size != src->size)
-+ continue;
-+
-+ cmp = src->size;
-+ if (cmp > dest->size)
-+ cmp = dest->size;
-+
-+ /* FIXME: bin elide_leading_zeros until we have better
-+ * comparison logic ? */
-+ for (bitmap = bits_set = k = 0; k < cmp; k++)
-+ {
-+ tree src_fn = VEC_index (constructor_elt, src->vec, src->offset + k)->value;
-+ tree dest_fn = VEC_index (constructor_elt, dest->vec, dest->offset + k)->value;
-+ src_fn = TREE_OPERAND (src_fn, 0);
-+ dest_fn = TREE_OPERAND (dest_fn, 0);
-+
-+ if (src_fn == dest_fn)
-+ {
-+ bitmap |= (1 << bits_set);
-+ elide_leading_zeros = 0;
-+ }
-+
-+ fprintf (stderr, "compare: %s %s %s (0x%x)\n",
-+ expr_as_string (src_fn, TFF_PLAIN_IDENTIFIER),
-+ src_fn == dest_fn ? "==" : "!=",
-+ expr_as_string (dest_fn, TFF_PLAIN_IDENTIFIER),
-+ bitmap);
-+
-+ if (!elide_leading_zeros)
-+ bits_set++;
-+
-+ if (bits_set == (sizeof (long) * 8)) /* FIXME: arch size etc. urgh ... */
-+ {
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set + 1);
-+ bits_set = bitmap = 0;
-+ elide_leading_zeros = 1;
-+ }
-+ }
-+ if (bitmap != 0)
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
-+ }
-+ }
-+
-+ if (VEC_length(vt_copy_record, vt_copies) > 0)
-+ {
-+ VEC(constructor_elt,gc) *vtable;
-+ unsigned int i;
-+ tree vtreloc_inits = NULL_TREE;
-+
-+ debug_vt_copies (vt_copies);
-+
-+ /*
-+ * Re-write the intializers to remove references in the vtable...
-+ */
-+ vtable = VEC_copy(constructor_elt,gc,vinits);
-+
-+ /* FIXME: copy & backup the original data before we mangle it
-+ for future reference [!] */
-+
-+ fprintf (stderr, "re-writing vtable:\n");
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ unsigned int j, bitmap;
-+ vt_copy_record *vtc = VEC_index(vt_copy_record, vt_copies, i);
-+
-+ /* re-write the existing vtable intializer */
-+ bitmap = vtc->bitmap;
-+ fprintf (stderr, "\tclobber from off %d + %d, bitmap 0x%x\n",
-+ vtc->dest->offset, vtc->offset, bitmap);
-+ for (j = vtc->dest->offset + vtc->offset; bitmap; j++, (bitmap>>=1))
-+ {
-+ if (bitmap & 1)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, j);
-+ fprintf (stderr, "\tclobber '%s' (0x%x)\n",
-+ expr_as_string (elt->value, TFF_PLAIN_IDENTIFIER),
-+ bitmap);
-+
-+ { /* Lengthy Assertion */
-+ constructor_elt *src_elt = VEC_index (constructor_elt, vtc->src->vec,
-+ vtc->src->offset + j - vtc->dest->offset);
-+ gcc_assert (TREE_CODE (elt->value) == INTEGER_CST /* FIXME: strange, but sometimes we overlap */
-+ || TREE_OPERAND (elt->value, 0) == TREE_OPERAND (src_elt->value, 0));
-+ }
-+ elt->value = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ }
-+
-+ /* build vtreloc decls */
-+ vtreloc_inits = build_vtable_copy_slot (vtc->dest->binfo, vtc->dest->offset + vtc->offset,
-+ vtc->src->binfo, vtc->src->offset + vtc->offset,
-+ vtc->bitmap, vtreloc_inits);
-+ }
-+
-+ /* re-build as chain for constructor ... hmm */
-+ for (i = 0; i < VEC_length(constructor_elt, vtable); i++)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, i);
-+ cgraph_clobber = tree_cons (elt->index, elt->value, cgraph_clobber);
-+ }
-+
-+ /* Append a reference to the parent vtable
-+ * to encourage gcc to emit the VTReloc table */
-+ cgraph_clobber = tree_cons (NULL_TREE,
-+ build_nop (vfunc_ptr_type_node,
-+ build_address (get_vtreloc_decl (t, vtreloc_inits))),
-+ cgraph_clobber);
-+ cgraph_clobber = nreverse (cgraph_clobber);
-+ }
-+
-+ vec_heap_free (vt_copies);
-+ return cgraph_clobber;
-+}
-+
-+static VEC(constructor_elt,gc) *
-+build_init_vec (tree inits)
-+{
-+ tree t;
-+ VEC(constructor_elt,gc) *v = NULL;
-+
-+ if (inits)
-+ {
-+ v = VEC_alloc (constructor_elt, gc, list_length (inits));
-+ for (t = inits; t; t = TREE_CHAIN (t))
-+ {
-+ constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
-+ elt->index = TREE_PURPOSE (t);
-+ elt->value = TREE_VALUE (t);
-+ }
-+ }
-+
-+ return v;
-+}
-+
-+static void
-+finish_vtbls (tree t)
-+{
-+ tree inits;
-+
-+ inits = vtbl_get_inits (t);
-+
-+ if (inits && getenv ("VT_SHRINK"))
-+ {
-+ int i;
-+ tree base_binfo;
-+ VEC(vt_fragment,heap) *dest_frags;
-+ VEC(vt_fragment,heap) *src_frags;
-+ VEC(constructor_elt,gc) *vinits = NULL;
-+
-+ vinits = build_init_vec (inits);
-+ if (!get_vtinit_for_binfo (TYPE_BINFO (t), 1))
-+ set_vtinit_for_binfo (TYPE_BINFO (t), vinits);
-+ else
-+ fprintf (stderr, "already set!\n");
-+
-+ debug_vtable (t, TYPE_BINFO (t));
-+
-+ fprintf (stderr, "Inherited from:\n");
-+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
-+ {
-+ tree btype = BINFO_TYPE (base_binfo);
-+ debug_vtable (btype, TYPE_BINFO (btype));
-+ }
-+
-+ src_frags = VEC_alloc(vt_fragment,heap,4);
-+ dest_frags = VEC_alloc(vt_fragment,heap,4);
-+ vtdecompose_frags (TYPE_BINFO (t), &dest_frags);
-+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
-+ vtdecompose_frags (TYPE_BINFO (BINFO_TYPE (base_binfo)), &src_frags);
-+
-+ fprintf (stderr, "dest:\n");
-+ debug_fragments (dest_frags);
-+ fprintf (stderr, "src:\n");
-+ debug_fragments (src_frags);
-+
-+ if (inits) {
-+ tree new_inits = compare_build_vtrelocs (t, vinits, dest_frags, src_frags);
-+ if (new_inits)
-+ {
-+ fprintf (stderr, "Use new inits !\n");
-+ inits = new_inits;
-+ }
-+ }
-+
-+ vec_heap_free (dest_frags);
-+ vec_heap_free (src_frags);
-+ }
-+
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+ initialize_vtable (TYPE_BINFO (t), inits);
- }
-
- /* Initialize the vtable for BINFO with the INITS. */
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
---- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-22 14:27:55.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,14 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* A list of inherited vtable slots which are copies of other slots
-+ The source address is stored in the TREE_VALUE slot and the
-+ destination is stored in the TREE_PURPOSE slot. */
-+extern GTY(()) tree vtable_copy_slots;
-+
-+/* A type mapping of types to un-altered type tables */
-+extern GTY(()) tree vtable_copy_types;
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-@@ -3847,6 +3857,7 @@
- extern void maybe_note_name_used_in_class (tree, tree);
- extern void note_name_declared_in_class (tree, tree);
- extern tree get_vtbl_decl_for_binfo (tree);
-+extern tree get_vtreloc_decl (tree, tree);
- extern void debug_class (tree);
- extern void debug_thunks (tree);
- extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4544,9 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtbl_for_type_local (tree);
-+extern tree mangle_vtreloc_for_type (tree);
-+extern tree mangle_vtreloc_section_for_type (tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c 2008-01-21 19:50:44.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmap", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl2.c gcc-4.2.1-simple/gcc/cp/decl2.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl2.c 2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl2.c 2008-01-21 19:50:44.000000000 +0000
-@@ -2910,6 +2910,40 @@
- finish_objects (function_key, priority, body);
- }
-
-+static void
-+generate_vtable_copy_slots (void)
-+{
-+ tree k;
-+
-+ if (!getenv ("VT_SHRINK"))
-+ return;
-+
-+ fprintf (stderr, "Generate_vtable_copy_slots\n");
-+
-+ for (k = vtable_copy_slots; k; k = TREE_CHAIN(k))
-+ {
-+ tree t = TREE_PURPOSE(k);
-+ tree inits = TREE_VALUE(k);
-+ tree decl, ctor;
-+
-+ decl = get_vtreloc_decl (t, inits);
-+ import_export_decl (decl);
-+ if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
-+ {
-+ DECL_EXTERNAL (decl) = 0;
-+ comdat_linkage (decl);
-+ DECL_COMDAT (decl) = 1;
-+ ctor = build_constructor_from_list (TREE_TYPE (decl), inits);
-+ initialize_artificial_var (decl, ctor);
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Generate vtreloc variable '%s' comdat? %d\n",
-+ decl_as_string (decl, TFF_PLAIN_IDENTIFIER),
-+ DECL_COMDAT (decl));
-+ }
-+ }
-+}
-+
-+
- /* Generate constructor and destructor functions for the priority
- indicated by N. */
-
-@@ -3312,6 +3346,9 @@
- }
- }
-
-+ /* Generate C++ vtable copy data */
-+ generate_vtable_copy_slots ();
-+
- /* We give C linkage to static constructors and destructors. */
- push_lang_context (lang_name_c);
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
---- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-22 14:27:31.000000000 +0000
-@@ -2670,6 +2670,100 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+tree
-+mangle_vtbl_for_type_local (const tree type)
-+{
-+ const char *result;
-+
-+ /* We don't have an actual decl here for the special component, so
-+ we can't just process the <encoded-name>. Instead, fake it. */
-+ start_mangling (type, /*ident_p=*/true);
-+
-+ /* Start the mangling. */
-+ write_string ("_Z");
-+ write_string ("VT");
-+
-+ /* Add the type. */
-+ write_type (type);
-+ write_string ("_local");
-+ result = finish_mangling (/*warn=*/false);
-+
-+ return get_identifier_nocopy (result);
-+}
-+
-+/* FIXME: as should be obvious I have no idea what I'm doing here */
-+static int calc_max_depth (const tree binfo)
-+{
-+ int i, max = 0;
-+ tree base;
-+
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base); ++i) {
-+ int depth = calc_max_depth (base);
-+ if (depth > max)
-+ max = depth;
-+ }
-+ return max + 1;
-+}
-+
-+static void write_order_complexity_for_type (const tree type)
-+{
-+ int max_depth = 0;
-+ int virts;
-+ tree binfo;
-+ char buffer[128]; /* hack */
-+
-+ binfo = TYPE_BINFO (type);
-+
-+ max_depth = calc_max_depth (binfo);
-+
-+#if 0
-+ {
-+ tree vbase;
-+ /* FIXME: virtual bases ? */
-+ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
-+ virts++;
-+ }
-+#endif
-+ virts = 0;
-+
-+ sprintf (buffer, "_%.8i_", max_depth + virts);
-+ write_string (buffer);
-+}
-+
-+/*
-+ * In order to get initialization order right, use a metric of
-+ * the maximum 'inheritedness' of a class, ie. a vtable that
-+ * inherits from 5 others, should be initialized after those
-+ * that inherit from 4
-+ */
-+static const char *mangle_vtreloc (const tree type, const char *prefix)
-+{
-+ const char *name;
-+
-+ start_mangling (type, /*ident_p=*/true);
-+ write_string (prefix);
-+ write_order_complexity_for_type (type);
-+ write_type (type);
-+ name = finish_mangling (/*warn=*/false);
-+
-+ return name;
-+}
-+
-+/* Create an identifier for the mangled name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_for_type (const tree type)
-+{
-+ return get_identifier_nocopy (mangle_vtreloc (type, "_ZVTR"));
-+}
-+
-+/* Create an identifier for the section name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_section_for_type (const tree type)
-+{
-+ const char *name = mangle_vtreloc (type, ".vtrelocs._ZVTR");
-+ return build_string (strlen (name), name);
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/varasm.c gcc-4.2.1-simple/gcc/varasm.c
---- pristine-gcc-4.2.1-simple/gcc/varasm.c 2008-01-10 09:49:03.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/varasm.c 2008-01-22 15:07:57.000000000 +0000
-@@ -1703,6 +1703,16 @@
- ASM_OUTPUT_LABEL (asm_out_file, name);
- #endif /* ASM_DECLARE_OBJECT_NAME */
-
-+ /* We want a locally bound symbol for vtrelocs */
-+ if (DECL_ARTIFICIAL (decl) && DECL_VIRTUAL_P (decl))
-+ {
-+ char *name_local = ACONCAT ((name, "_local", NULL));
-+ fprintf (asm_out_file, "\t.%s\t", "hidden");
-+ assemble_name (asm_out_file, name_local);
-+ fprintf (asm_out_file, "\n");
-+ ASM_OUTPUT_LABEL (asm_out_file, name_local);
-+ }
-+
- if (!dont_output_data)
- {
- if (DECL_INITIAL (decl)
diff --git a/patches/test/gcc-vt-copy-4.diff b/patches/test/gcc-vt-copy-4.diff
deleted file mode 100644
index abe1b2788..000000000
--- a/patches/test/gcc-vt-copy-4.diff
+++ /dev/null
@@ -1,820 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/collect2.c gcc-4.2.1-simple/gcc/collect2.c
---- pristine-gcc-4.2.1-simple/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c 2008-01-21 19:50:44.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/class.c gcc-4.2.1-simple/gcc/cp/class.c
---- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-23 15:48:56.000000000 +0000
-@@ -181,8 +181,7 @@
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
- static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
--static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
- static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
- static void clone_constructors_and_destructors (tree);
-@@ -6355,6 +6354,49 @@
- return decl;
- }
-
-+/* Returns the VAR_DECL for the vtable copy relocation entries associated
-+ with BINFO. */
-+
-+tree get_vtreloc_decl (tree t, tree inits)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtreloc_for_type (t);
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ int nslots = list_length (inits);
-+ tree atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (nslots - 1)));
-+ layout_type (atype);
-+ TYPE_ALIGN (atype) = BITS_PER_UNIT * 4;
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_ALIGN(d) = 1;
-+ DECL_USER_ALIGN(d) = 1;
-+ DECL_SECTION_NAME(d) = mangle_vtreloc_section_for_type (t);
-+ SET_DECL_ASSEMBLER_NAME (d, name);
-+ /* Remember the type it is for. */
-+ TREE_TYPE (name) = t;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_COMDAT (d) = 1;
-+ /* Mark the variable as undefined -- but remember that we can
-+ define it later if we need to do so. */
-+ DECL_EXTERNAL (d) = 0;
-+ DECL_NOT_REALLY_EXTERN (d) = 1;
-+ set_linkage_according_to_type (t, d);
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+
-+ vtable_copy_slots = tree_cons (t, inits, vtable_copy_slots);
-+ }
-+
-+ return d;
-+}
-
- /* Returns the binfo for the primary base of BINFO. If the resulting
- BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6438,7 +6480,7 @@
- if (indented)
- fprintf (stream, "\n");
-
-- if (!(flags & TDF_SLIM))
-+ if (1) /* !(flags & TDF_SLIM)) */
- {
- int indented = 0;
-
-@@ -6637,12 +6679,69 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+/* List of vtable copy slot data, keyed by type */
-+/*
-+ * toplevel: purpose - type
-+ * value - [slot relocs]
-+ * slot relocs: purpose - original binfo
-+ * value - init structures: [src, dest, bitmap]
-+ */
-+tree vtable_copy_slots;
-+
-+
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest_binfo, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest_binfo || !bitmap)
-+ return chain;
-+
-+ /* fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap); */
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for_binfo (dest_binfo);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-
--static void
--finish_vtbls (tree t)
-+static tree
-+vtbl_get_inits (tree t)
- {
- tree list;
- tree vbase;
-@@ -6662,8 +6761,407 @@
- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
- }
-
-+ return TREE_VALUE (list);
-+}
-+
-+/* List of un-altered vtable inits */
-+/*
-+ * list of: purpose - type
-+ * value - [constructor_list]
-+ */
-+tree vtable_copy_types;
-+
-+/* FIXME: rather a lame search */
-+static VEC(constructor_elt,gc) *
-+get_vtinit_for_binfo (tree binfo, int list_only)
-+{
-+ tree k;
-+ for (k = vtable_copy_types; k; k = TREE_CHAIN(k))
-+ {
-+ if (TREE_PURPOSE(k) == binfo)
-+ return CONSTRUCTOR_ELTS (TREE_VALUE(k));
-+ }
-+ if (list_only)
-+ return NULL;
-+
-+ k = get_vtbl_decl_for_binfo (binfo);
-+ if (k)
-+ return CONSTRUCTOR_ELTS (DECL_INITIAL (k));
-+ else
-+ return NULL;
-+}
-+
-+static void
-+set_vtinit_for_binfo (tree binfo, VEC(constructor_elt,gc) *vtinits)
-+{
-+ vtable_copy_types = tree_cons (binfo, build_constructor (NULL_TREE, vtinits),
-+ vtable_copy_types);
-+}
-+
-+static void
-+debug_vtable (tree t, tree binfo)
-+{
-+ tree value;
-+ unsigned HOST_WIDE_INT ix;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ if (!getenv ("MOREDEBUG"))
-+ return;
-+
-+ fprintf (stderr, "VTable for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+
-+ vtable = get_vtinit_for_binfo (binfo, 0);
-+ if (!vtable)
-+ {
-+ fprintf (stderr, "<none>\n");
-+ return;
-+ }
-+
-+ FOR_EACH_CONSTRUCTOR_VALUE (vtable, ix, value)
-+ {
-+ fprintf (stderr, "\t%-4ld %s\n", (long)ix,
-+ expr_as_string (value, TFF_PLAIN_IDENTIFIER));
-+ }
-+}
-+
-+/* to track a segment of vtable initializer */
-+typedef struct vt_fragment_d GTY(()) {
-+ tree binfo;
-+
-+ /* ptr into the vec decl */
-+ unsigned int offset;
-+ unsigned int size;
-+ VEC(constructor_elt,gc) *vec;
-+} vt_fragment;
-+
-+typedef struct vt_copy_record_d GTY(()) {
-+ vt_fragment *src;
-+ vt_fragment *dest;
-+ unsigned int bitmap;
-+ unsigned int offset;
-+} vt_copy_record;
-+
-+DEF_VEC_O(vt_fragment);
-+DEF_VEC_O(vt_copy_record);
-+DEF_VEC_ALLOC_O(vt_fragment, heap);
-+DEF_VEC_ALLOC_O(vt_copy_record, heap);
-+
-+static void
-+vtdecompose_frags (tree t_binfo, VEC(vt_fragment,heap) **frags)
-+{
-+ unsigned int seek_fn = 1, i;
-+ vt_fragment *frag = NULL;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ vtable = get_vtinit_for_binfo (t_binfo, 0);
-+ if (!vtable)
-+ return;
-+
-+ for (i = 0; i < VEC_length(constructor_elt,vtable); i++)
-+ {
-+ tree fn = VEC_index (constructor_elt, vtable, i)->value;
-+ int is_fn = TREE_CODE (fn) == ADDR_EXPR
-+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL;
-+
-+ if (is_fn && seek_fn)
-+ {
-+ frag = VEC_safe_push (vt_fragment, heap, *frags, NULL);
-+ frag->binfo = t_binfo;
-+ frag->offset = i;
-+ frag->size = VEC_length (constructor_elt, vtable) - i;
-+ frag->vec = vtable;
-+ seek_fn = 0;
-+ }
-+ if (!is_fn && !seek_fn)
-+ {
-+ frag->size = i - frag->offset;
-+ seek_fn = 1;
-+ }
-+ }
-+}
-+
-+static void
-+debug_fragments (VEC(vt_fragment,heap) *frags)
-+{
-+ unsigned int i;
-+ for (i = 0; i < VEC_length(vt_fragment,frags); i++)
-+ {
-+ vt_fragment *frag = VEC_index (vt_fragment, frags, i);
-+ fprintf (stderr, "fragment %d: '%s' offset %d, size %d\n",
-+ i, type_as_string (BINFO_TYPE (frag->binfo), TFF_PLAIN_IDENTIFIER),
-+ frag->offset, frag->size);
-+ }
-+}
-+
-+static void
-+push_vtfrag (VEC(vt_copy_record,heap) **vt_copies,
-+ vt_fragment *src, vt_fragment *dest,
-+ unsigned int bitmap, unsigned int offset)
-+{
-+ vt_copy_record *rec;
-+
-+ /* FIXME: we need to be able to compare these */
-+ /* that is not easy, sadly - so punt for now (?), and hope we don't get too
-+ * many duplicate / overlapping hits */
-+ rec = VEC_safe_push (vt_copy_record, heap, *vt_copies, NULL);
-+ rec->src = src;
-+ rec->dest = dest;
-+ rec->bitmap = bitmap;
-+ rec->offset = offset;
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Push frag 0x%x %d\n", bitmap, offset);
-+}
-+
-+static void
-+debug_vt_copies (VEC(vt_copy_record,heap) *vt_copies)
-+{
-+ unsigned int i;
-+
-+ if (!getenv ("MOREDEBUG"))
-+ return;
-+
-+ fprintf (stderr, "vtcopies: %d records\n", VEC_length(vt_copy_record, vt_copies));
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ vt_copy_record *cpy = VEC_index (vt_copy_record, vt_copies, i);
-+ fprintf (stderr, "\tcopy from %s+%d to %s+%d mask 0x%x\n",
-+ type_as_string (BINFO_TYPE (cpy->src->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->src->offset + cpy->offset,
-+ type_as_string (BINFO_TYPE (cpy->dest->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->dest->offset + cpy->offset,
-+ cpy->bitmap);
-+ }
-+}
-+
-+/*
-+ * Compare all src & dest fragments for the best match ...
-+ */
-+static tree
-+compare_build_vtrelocs (tree t, VEC(constructor_elt,gc) *vinits,
-+ VEC(vt_fragment,heap) *dest_frags,
-+ VEC(vt_fragment,heap) *src_frags)
-+{
-+ unsigned int i;
-+ tree cgraph_clobber = NULL_TREE;
-+ VEC(vt_copy_record,heap) *vt_copies;
-+ int verbose_debug = getenv ("MOREDEBUG") != NULL;
-+
-+ vt_copies = VEC_alloc(vt_copy_record, heap, VEC_length(vt_fragment, dest_frags));
-+
-+ for (i = 0; i < VEC_length(vt_fragment, dest_frags); i++)
-+ {
-+ unsigned int j;
-+ vt_fragment *dest = VEC_index (vt_fragment, dest_frags, i);
-+
-+ for (j = 0; j < VEC_length(vt_fragment, src_frags); j++)
-+ {
-+ unsigned int cmp;
-+ unsigned int k, bits_set;
-+ unsigned int bitmap;
-+ int elide_leading_zeros = 1;
-+ vt_fragment *src = VEC_index (vt_fragment, src_frags, j);
-+
-+ /* new virtual methods arrive only in the 1st dest fragment */
-+ if (i > 0 && dest->size != src->size)
-+ continue;
-+
-+ cmp = src->size;
-+ if (cmp > dest->size)
-+ cmp = dest->size;
-+
-+ /* FIXME: bin elide_leading_zeros until we have better
-+ * comparison logic ? */
-+ for (bitmap = bits_set = k = 0; k < cmp; k++)
-+ {
-+ tree src_fn = VEC_index (constructor_elt, src->vec, src->offset + k)->value;
-+ tree dest_fn = VEC_index (constructor_elt, dest->vec, dest->offset + k)->value;
-+ src_fn = TREE_OPERAND (src_fn, 0);
-+ dest_fn = TREE_OPERAND (dest_fn, 0);
-+
-+ if (src_fn == dest_fn && src_fn != abort_fndecl)
-+ {
-+ bitmap |= (1 << bits_set);
-+ elide_leading_zeros = 0;
-+ }
-+
-+ if (verbose_debug)
-+ fprintf (stderr, "compare: %s %s %s (0x%x) [%s]\n",
-+ expr_as_string (src_fn, TFF_PLAIN_IDENTIFIER),
-+ src_fn == dest_fn ? "==" : "!=",
-+ expr_as_string (dest_fn, TFF_PLAIN_IDENTIFIER),
-+ bitmap,
-+ src_fn == abort_fndecl ? "pure-virt" : "non-pure virt");
-+
-+ if (!elide_leading_zeros)
-+ bits_set++;
-+
-+ if (bits_set == (sizeof (long) * 8)) /* FIXME: arch size etc. urgh ... */
-+ {
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set + 1);
-+ bits_set = bitmap = 0;
-+ elide_leading_zeros = 1;
-+ }
-+ }
-+ if (bitmap != 0)
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
-+ }
-+ }
-+
-+ if (VEC_length(vt_copy_record, vt_copies) > 0)
-+ {
-+ VEC(constructor_elt,gc) *vtable;
-+ unsigned int i;
-+ tree vtreloc_inits = NULL_TREE;
-+
-+ debug_vt_copies (vt_copies);
-+
-+ /*
-+ * Re-write the intializers to remove references in the vtable...
-+ */
-+ vtable = VEC_copy(constructor_elt,gc,vinits);
-+
-+ /* FIXME: copy & backup the original data before we mangle it
-+ for future reference [!] */
-+
-+ if (verbose_debug)
-+ fprintf (stderr, "re-writing vtable:\n");
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ unsigned int j, bitmap;
-+ vt_copy_record *vtc = VEC_index(vt_copy_record, vt_copies, i);
-+
-+ /* re-write the existing vtable intializer */
-+ bitmap = vtc->bitmap;
-+ if (verbose_debug)
-+ fprintf (stderr, "\tclobber from off %d + %d, bitmap 0x%x\n",
-+ vtc->dest->offset, vtc->offset, bitmap);
-+ for (j = vtc->dest->offset + vtc->offset; bitmap; j++, (bitmap>>=1))
-+ {
-+ if (bitmap & 1)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, j);
-+ if (verbose_debug)
-+ fprintf (stderr, "\tclobber '%s' (0x%x)\n",
-+ expr_as_string (elt->value, TFF_PLAIN_IDENTIFIER),
-+ bitmap);
-+
-+ { /* Lengthy Assertion */
-+ constructor_elt *src_elt = VEC_index (constructor_elt, vtc->src->vec,
-+ vtc->src->offset + j - vtc->dest->offset);
-+ gcc_assert (TREE_CODE (elt->value) == INTEGER_CST /* FIXME: strange, but sometimes we overlap */
-+ || TREE_OPERAND (elt->value, 0) == TREE_OPERAND (src_elt->value, 0));
-+ }
-+ elt->value = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ }
-+
-+ /* build vtreloc decls */
-+ vtreloc_inits = build_vtable_copy_slot (vtc->dest->binfo, vtc->dest->offset + vtc->offset,
-+ vtc->src->binfo, vtc->src->offset + vtc->offset,
-+ vtc->bitmap, vtreloc_inits);
-+ }
-+
-+ /* re-build as chain for constructor ... hmm */
-+ for (i = 0; i < VEC_length(constructor_elt, vtable); i++)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, i);
-+ cgraph_clobber = tree_cons (elt->index, elt->value, cgraph_clobber);
-+ }
-+
-+ /* Append a reference to the parent vtable
-+ * to encourage gcc to emit the VTReloc table */
-+ cgraph_clobber = tree_cons (NULL_TREE,
-+ build_nop (vfunc_ptr_type_node,
-+ build_address (get_vtreloc_decl (t, vtreloc_inits))),
-+ cgraph_clobber);
-+ cgraph_clobber = nreverse (cgraph_clobber);
-+ }
-+
-+ vec_heap_free (vt_copies);
-+ return cgraph_clobber;
-+}
-+
-+static VEC(constructor_elt,gc) *
-+build_init_vec (tree inits)
-+{
-+ tree t;
-+ VEC(constructor_elt,gc) *v = NULL;
-+
-+ if (inits)
-+ {
-+ v = VEC_alloc (constructor_elt, gc, list_length (inits));
-+ for (t = inits; t; t = TREE_CHAIN (t))
-+ {
-+ constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
-+ elt->index = TREE_PURPOSE (t);
-+ elt->value = TREE_VALUE (t);
-+ }
-+ }
-+
-+ return v;
-+}
-+
-+static void
-+finish_vtbls (tree t)
-+{
-+ tree inits;
-+
-+ inits = vtbl_get_inits (t);
-+
-+ if (inits && getenv ("VT_SHRINK"))
-+ {
-+ int i;
-+ tree base_binfo;
-+ VEC(vt_fragment,heap) *dest_frags;
-+ VEC(vt_fragment,heap) *src_frags;
-+ VEC(constructor_elt,gc) *vinits = NULL;
-+
-+ vinits = build_init_vec (inits);
-+ if (!get_vtinit_for_binfo (TYPE_BINFO (t), 1))
-+ set_vtinit_for_binfo (TYPE_BINFO (t), vinits);
-+ else
-+ fprintf (stderr, "Error: already set!\n");
-+
-+ debug_vtable (t, TYPE_BINFO (t));
-+
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Inherited from:\n");
-+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
-+ {
-+ tree btype = BINFO_TYPE (base_binfo);
-+ debug_vtable (btype, TYPE_BINFO (btype));
-+ }
-+
-+ src_frags = VEC_alloc(vt_fragment,heap,4);
-+ dest_frags = VEC_alloc(vt_fragment,heap,4);
-+ vtdecompose_frags (TYPE_BINFO (t), &dest_frags);
-+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
-+ vtdecompose_frags (TYPE_BINFO (BINFO_TYPE (base_binfo)), &src_frags);
-+
-+ if (getenv ("MOREDEBUG"))
-+ {
-+ fprintf (stderr, "dest:\n");
-+ debug_fragments (dest_frags);
-+ fprintf (stderr, "src:\n");
-+ debug_fragments (src_frags);
-+ }
-+
-+ if (inits) {
-+ tree new_inits = compare_build_vtrelocs (t, vinits, dest_frags, src_frags);
-+ if (new_inits)
-+ inits = new_inits;
-+ }
-+
-+ vec_heap_free (dest_frags);
-+ vec_heap_free (src_frags);
-+ }
-+
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+ initialize_vtable (TYPE_BINFO (t), inits);
- }
-
- /* Initialize the vtable for BINFO with the INITS. */
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
---- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-22 14:27:55.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,14 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* A list of inherited vtable slots which are copies of other slots
-+ The source address is stored in the TREE_VALUE slot and the
-+ destination is stored in the TREE_PURPOSE slot. */
-+extern GTY(()) tree vtable_copy_slots;
-+
-+/* A type mapping of types to un-altered type tables */
-+extern GTY(()) tree vtable_copy_types;
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-@@ -3847,6 +3857,7 @@
- extern void maybe_note_name_used_in_class (tree, tree);
- extern void note_name_declared_in_class (tree, tree);
- extern tree get_vtbl_decl_for_binfo (tree);
-+extern tree get_vtreloc_decl (tree, tree);
- extern void debug_class (tree);
- extern void debug_thunks (tree);
- extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4544,9 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtbl_for_type_local (tree);
-+extern tree mangle_vtreloc_for_type (tree);
-+extern tree mangle_vtreloc_section_for_type (tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c 2008-01-21 19:50:44.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmap", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl2.c gcc-4.2.1-simple/gcc/cp/decl2.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl2.c 2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl2.c 2008-01-23 15:48:29.000000000 +0000
-@@ -2910,6 +2910,38 @@
- finish_objects (function_key, priority, body);
- }
-
-+static void
-+generate_vtable_copy_slots (void)
-+{
-+ tree k;
-+
-+ if (!getenv ("VT_SHRINK"))
-+ return;
-+
-+ for (k = vtable_copy_slots; k; k = TREE_CHAIN(k))
-+ {
-+ tree t = TREE_PURPOSE(k);
-+ tree inits = TREE_VALUE(k);
-+ tree decl, ctor;
-+
-+ decl = get_vtreloc_decl (t, inits);
-+ import_export_decl (decl);
-+ if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
-+ {
-+ DECL_EXTERNAL (decl) = 0;
-+ comdat_linkage (decl);
-+ DECL_COMDAT (decl) = 1;
-+ ctor = build_constructor_from_list (TREE_TYPE (decl), inits);
-+ initialize_artificial_var (decl, ctor);
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Generate vtreloc variable '%s' comdat? %d\n",
-+ decl_as_string (decl, TFF_PLAIN_IDENTIFIER),
-+ DECL_COMDAT (decl));
-+ }
-+ }
-+}
-+
-+
- /* Generate constructor and destructor functions for the priority
- indicated by N. */
-
-@@ -3312,6 +3344,9 @@
- }
- }
-
-+ /* Generate C++ vtable copy data */
-+ generate_vtable_copy_slots ();
-+
- /* We give C linkage to static constructors and destructors. */
- push_lang_context (lang_name_c);
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
---- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-23 15:10:38.000000000 +0000
-@@ -2670,6 +2670,99 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+tree
-+mangle_vtbl_for_type_local (const tree type)
-+{
-+ const char *result;
-+
-+ /* We don't have an actual decl here for the special component, so
-+ we can't just process the <encoded-name>. Instead, fake it. */
-+ start_mangling (type, /*ident_p=*/true);
-+
-+ /* Start the mangling. */
-+ write_string ("_Z");
-+ write_string ("VT");
-+
-+ /* Add the type. */
-+ write_type (type);
-+ write_string ("_local");
-+ result = finish_mangling (/*warn=*/false);
-+
-+ return get_identifier_nocopy (result);
-+}
-+
-+/* FIXME: as should be obvious I have no idea what I'm doing here */
-+static int calc_max_depth (const tree binfo)
-+{
-+ int i, max = 0;
-+ tree base;
-+
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base); ++i) {
-+ int depth = calc_max_depth (base);
-+ if (depth > max)
-+ max = depth;
-+ }
-+ return max + 1;
-+}
-+
-+static void write_order_complexity_for_type (const tree type)
-+{
-+ int max_depth = 0;
-+ int virts;
-+ tree binfo;
-+ char buffer[128]; /* hack */
-+
-+ binfo = TYPE_BINFO (type);
-+
-+ max_depth = calc_max_depth (binfo);
-+
-+ /* FIXME: virtual bases ?
-+ {
-+ tree vbase;
-+ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
-+ virts++;
-+ }
-+ */
-+ virts = 0;
-+
-+ sprintf (buffer, "_%.8i_", max_depth + virts);
-+ write_string (buffer);
-+}
-+
-+/*
-+ * In order to get initialization order right, use a metric of
-+ * the maximum 'inheritedness' of a class, ie. a vtable that
-+ * inherits from 5 others, should be initialized after those
-+ * that inherit from 4
-+ */
-+static const char *mangle_vtreloc (const tree type, const char *prefix)
-+{
-+ const char *name;
-+
-+ start_mangling (type, /*ident_p=*/true);
-+ write_string (prefix);
-+ write_order_complexity_for_type (type);
-+ write_type (type);
-+ name = finish_mangling (/*warn=*/false);
-+
-+ return name;
-+}
-+
-+/* Create an identifier for the mangled name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_for_type (const tree type)
-+{
-+ return get_identifier_nocopy (mangle_vtreloc (type, "_ZVTR"));
-+}
-+
-+/* Create an identifier for the section name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_section_for_type (const tree type)
-+{
-+ const char *name = mangle_vtreloc (type, ".vtrelocs._ZVTR");
-+ return build_string (strlen (name), name);
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
diff --git a/patches/test/gcc-vt-copy.diff b/patches/test/gcc-vt-copy.diff
deleted file mode 100644
index 7c8c2033e..000000000
--- a/patches/test/gcc-vt-copy.diff
+++ /dev/null
@@ -1,719 +0,0 @@
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/collect2.c gcc-4.2.1-20070724/gcc/collect2.c
---- gcc-4.2.1-20070724/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-20070724/gcc/collect2.c 2008-01-09 15:26:55.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/cp/class.c gcc-4.2.1-20070724/gcc/cp/class.c
---- gcc-4.2.1-20070724/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-20070724/gcc/cp/class.c 2008-01-09 15:26:55.000000000 +0000
-@@ -136,7 +136,7 @@
- static tree fixed_type_or_null (tree, int *, int *);
- static tree build_simple_base_path (tree expr, tree binfo);
- static tree build_vtbl_ref_1 (tree, tree);
--static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
-+static tree build_vtbl_initializer (tree, tree, tree, tree, int *, tree *);
- static int count_fields (tree);
- static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
- static void check_bitfield_decl (tree);
-@@ -180,11 +180,11 @@
- tree, tree, splay_tree);
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
--static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
-+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree, tree *);
- static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+ tree, tree *);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
--static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
-+static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *, unsigned *);
- static void clone_constructors_and_destructors (tree);
- static tree build_clone (tree, tree);
- static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
-@@ -6637,6 +6637,16 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+tree vtable_copy_slots;
-+
-+static void
-+append_slot_relocs (tree t, tree slot_relocs)
-+{
-+ if (slot_relocs)
-+ vtable_copy_slots = tree_cons (t, slot_relocs,
-+ vtable_copy_slots);
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-@@ -6647,23 +6657,26 @@
- tree list;
- tree vbase;
-
-+ tree slot_relocs = NULL_TREE;
- /* We lay out the primary and secondary vtables in one contiguous
- vtable. The primary vtable is first, followed by the non-virtual
- secondary vtables in inheritance graph order. */
- list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
- accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
-- TYPE_BINFO (t), t, list);
-+ TYPE_BINFO (t), t, list, &slot_relocs);
-
- /* Then come the virtual bases, also in inheritance graph order. */
- for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
- {
- if (!BINFO_VIRTUAL_P (vbase))
- continue;
-- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
-+ accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list, &slot_relocs);
- }
-
- if (BINFO_VTABLE (TYPE_BINFO (t)))
- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+
-+ append_slot_relocs (t, slot_relocs);
- }
-
- /* Initialize the vtable for BINFO with the INITS. */
-@@ -6676,6 +6689,10 @@
- layout_vtable_decl (binfo, list_length (inits));
- decl = get_vtbl_decl_for_binfo (binfo);
- initialize_artificial_var (decl, inits);
-+ mark_used (decl); /* Wasteful - but necessary -
-+ otherwise we need to build
-+ .vtrelocs data as we emit
-+ such a var_decl */
- dump_vtable (BINFO_TYPE (binfo), binfo, decl);
- }
-
-@@ -6945,6 +6962,7 @@
- tree inits;
- tree id;
- tree vbase;
-+ tree slot_relocs;
-
- /* See if we've already created this construction vtable group. */
- id = mangle_ctor_vtbl_for_type (t, binfo);
-@@ -6955,11 +6973,13 @@
- /* Build a version of VTBL (with the wrong type) for use in
- constructing the addresses of secondary vtables in the
- construction vtable group. */
-+
- vtbl = build_vtable (t, id, ptr_type_node);
- DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
- list = build_tree_list (vtbl, NULL_TREE);
-+ slot_relocs = NULL_TREE;
- accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
-- binfo, t, list);
-+ binfo, t, list, NULL /* &slot_relocs */);
-
- /* Add the vtables for each of our virtual bases using the vbase in T
- binfo. */
-@@ -6973,7 +6993,7 @@
- continue;
- b = copied_binfo (vbase, binfo);
-
-- accumulate_vtbl_inits (b, vbase, binfo, t, list);
-+ accumulate_vtbl_inits (b, vbase, binfo, t, list, NULL /* &slot_relocs */);
- }
- inits = TREE_VALUE (list);
-
-@@ -6986,6 +7006,11 @@
- CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
- initialize_artificial_var (vtbl, inits);
- dump_vtable (t, binfo, vtbl);
-+
-+/* Construction vtables cause serious grief:
-+ determining overriding is tough - and we get the
-+ wrong vtable names for our fixups (etc.)
-+ append_slot_relocs (t, slot_relocs); */
- }
-
- /* Add the vtbl initializers for BINFO (and its bases other than
-@@ -7003,7 +7028,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree inits)
-+ tree inits,
-+ tree *slot_relocs)
- {
- int i;
- tree base_binfo;
-@@ -7026,7 +7052,7 @@
- TREE_VALUE (inits)
- = chainon (TREE_VALUE (inits),
- dfs_accumulate_vtbl_inits (binfo, orig_binfo,
-- rtti_binfo, t, inits));
-+ rtti_binfo, t, inits, slot_relocs));
-
- /* Walk the BINFO and its bases. We walk in preorder so that as we
- initialize each vtable we can figure out at what offset the
-@@ -7041,7 +7067,7 @@
- accumulate_vtbl_inits (base_binfo,
- BINFO_BASE_BINFO (orig_binfo, i),
- rtti_binfo, t,
-- inits);
-+ inits, slot_relocs);
- }
- }
-
-@@ -7053,7 +7079,8 @@
- tree orig_binfo,
- tree rtti_binfo,
- tree t,
-- tree l)
-+ tree l,
-+ tree *slot_relocs)
- {
- tree inits = NULL_TREE;
- tree vtbl = NULL_TREE;
-@@ -7120,7 +7147,7 @@
-
- /* Compute the initializer for this vtable. */
- inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
-- &non_fn_entries);
-+ &non_fn_entries, slot_relocs);
-
- /* Figure out the position to which the VPTR should point. */
- vtbl = TREE_PURPOSE (l);
-@@ -7154,6 +7181,40 @@
- return inits;
- }
-
-+#ifdef REALLY_BROKEN_NOW
-+static void
-+dump_slot_relocs (tree t, tree slot_relocs)
-+{
-+ tree st;
-+ fprintf (stderr, "Copy data for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+
-+ for (st = slot_relocs; st; st = TREE_CHAIN(st))
-+ {
-+ /* This is not correct anymore - not a binfo ... */
-+ tree orig_binfo = TREE_PURPOSE(st);
-+ tree init_list = TREE_VALUE(st);
-+ tree v;
-+ fprintf (stderr, "\tfrom %s (%d) entries\n",
-+ type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER),
-+ list_length (init_list));
-+ for (v = init_list; v; v = TREE_CHAIN(v))
-+ {
-+ if (!TREE_VALUE(v))
-+ fprintf (stderr, "\t\tNULL\n");
-+ else
-+ {
-+ tree fn = TREE_VALUE(v);
-+ fprintf (stderr, "\t\t%s ",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "[ %s ]\n",
-+ expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+ }
-+ }
-+ }
-+}
-+#endif
-+
- static GTY(()) tree abort_fndecl_addr;
-
- /* Construct the initializer for BINFO's virtual function table. BINFO
-@@ -7184,7 +7245,8 @@
- tree orig_binfo,
- tree t,
- tree rtti_binfo,
-- int* non_fn_entries_p)
-+ int* non_fn_entries_p,
-+ tree *slot_relocs)
- {
- tree v, b;
- tree vfun_inits;
-@@ -7192,6 +7254,8 @@
- unsigned ix;
- tree vbinfo;
- VEC(tree,gc) *vbases;
-+ tree slot_reloc_data;
-+ unsigned num_inits, num_parent_inits;
-
- /* Initialize VID. */
- memset (&vid, 0, sizeof (vid));
-@@ -7213,7 +7277,7 @@
- signature, we share the vcall offsets. */
- vid.fns = VEC_alloc (tree, gc, 32);
- /* Add the vcall and vbase offset entries. */
-- build_vcall_and_vbase_vtbl_entries (binfo, &vid);
-+ build_vcall_and_vbase_vtbl_entries (binfo, &vid, &num_parent_inits);
-
- /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
- build_vbase_offset_vtbl_entries. */
-@@ -7240,18 +7304,52 @@
- }
- }
-
-+ num_inits = list_length (vid.inits);
- if (non_fn_entries_p)
-- *non_fn_entries_p = list_length (vid.inits);
-+ *non_fn_entries_p = num_inits;
-+
-+ /* If we have non-function entries not present in a parent vtable,
-+ insert a bogus slot reloc copy from a NULL parent to pad that
-+ out */
-+ slot_reloc_data = NULL_TREE;
-+ if (slot_relocs && num_inits > num_parent_inits)
-+ {
-+ unsigned i;
-+ for (i = 0; i < num_inits - num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (NULL_TREE, slot_reloc_data, NULL));
-+ slot_reloc_data = NULL_TREE;
-+ }
-
- /* Go through all the ordinary virtual functions, building up
- initializers. */
- vfun_inits = NULL_TREE;
-+
-+ fprintf (stderr, "Init vtable idx %d: ",
-+ slot_relocs ? list_length (*slot_relocs) : -1);
-+ fprintf (stderr, " (%s)",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s)",
-+ type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " (%s) -",
-+ type_as_string (rtti_binfo, TFF_PLAIN_IDENTIFIER));
-+ if (get_primary_binfo (binfo))
-+ fprintf (stderr, " (%s)",
-+ type_as_string (get_primary_binfo (binfo), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "** %d inits **\n", num_inits);
-+
- for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
- {
- tree delta;
- tree vcall_index;
- tree fn, fn_original;
- tree init = NULL_TREE;
-+ tree slot_fn = NULL_TREE;
-+ tree first_overrider = NULL_TREE;
-
- fn = BV_FN (v);
- fn_original = fn;
-@@ -7281,7 +7379,10 @@
- {
- /* We found a defn before a lost primary; go ahead as normal. */
- if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
-- break;
-+ {
-+ first_overrider = TYPE_BINFO (BINFO_TYPE (b));
-+ break;
-+ }
-
- /* The nearest definition is from a lost primary; clear the
- slot. */
-@@ -7299,6 +7400,9 @@
- delta = BV_DELTA (v);
- vcall_index = BV_VCALL_INDEX (v);
-
-+/* fprintf (stderr, "\tVfn: %s\n",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER)); */
-+
- gcc_assert (TREE_CODE (delta) == INTEGER_CST);
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
-
-@@ -7319,9 +7423,43 @@
- if (!DECL_NAME (fn))
- finish_thunk (fn);
- }
-- /* Take the address of the function, considering it to be of an
-- appropriate generic type. */
-- init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+ else if (slot_relocs && first_overrider
-+ && BINFO_TYPE (first_overrider) != t
-+ /* necessary for virtual inheritance */
-+ && BINFO_TYPE (first_overrider) != binfo)
-+ {
-+ /* accumulate information about overriding */
-+ gcc_assert (BINFO_VTABLE (first_overrider));
-+ slot_fn = fn;
-+ if (getenv ("VT_SHRINK"))
-+ {
-+ init = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ }
-+/* fprintf (stderr, " %s : ",
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s !=? ",
-+ type_as_string (BINFO_TYPE (first_overrider), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, " %s %p !=? %p !=? %p !=? %p !=? %p\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER),
-+ BINFO_TYPE (first_overrider), t,
-+ binfo, orig_binfo, rtti_binfo);
-+ fprintf (stderr, "%p !=? %p !=? %p !=? %p !=? %p\n",
-+ BINFO_INHERITANCE_CHAIN (first_overrider),
-+ BINFO_INHERITANCE_CHAIN (t),
-+ BINFO_INHERITANCE_CHAIN (binfo),
-+ BINFO_INHERITANCE_CHAIN (orig_binfo),
-+ BINFO_INHERITANCE_CHAIN (rtti_binfo)); */
-+
-+ if (!init)
-+ {
-+ /* Take the address of the function, considering it to be of an
-+ appropriate generic type. */
-+ init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+ }
- }
- }
-
-@@ -7346,8 +7484,34 @@
- }
- else
- vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
-+
-+ /* Accumulate overriding information for subequent construction
-+ of copy-vtable initialisers */
-+ if (slot_relocs)
-+ {
-+ slot_reloc_data = tree_cons (NULL_TREE, slot_fn, slot_reloc_data);
-+ }
- }
-
-+ /* Write details about vtable inheritance, if we have any parent entries */
-+ if (slot_relocs)
-+ {
-+ unsigned i;
-+ tree copy_parent = orig_binfo;
-+ if (orig_binfo == TYPE_BINFO (t))
-+ copy_parent = get_primary_binfo (orig_binfo);
-+
-+ slot_reloc_data = nreverse (slot_reloc_data);
-+
-+ /* Prepend dummy entries for rtti etc. */
-+ for (i = 0; i < num_parent_inits; i++)
-+ slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+ slot_reloc_data);
-+
-+ *slot_relocs = chainon
-+ (*slot_relocs, tree_cons (copy_parent, slot_reloc_data, NULL));
-+ }
-+
- /* The initializers for virtual functions were built up in reverse
- order; straighten them out now. */
- vfun_inits = nreverse (vfun_inits);
-@@ -7363,7 +7527,8 @@
- offsets in BINFO, which is in the hierarchy dominated by T. */
-
- static void
--build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
-+build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid,
-+ unsigned *num_parent_inits)
- {
- tree b;
-
-@@ -7371,10 +7536,17 @@
- corresponding to the primary base class. */
- b = get_primary_binfo (binfo);
- if (b)
-- build_vcall_and_vbase_vtbl_entries (b, vid);
-+ build_vcall_and_vbase_vtbl_entries (b, vid, NULL);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-
- /* Add the vbase entries for this base. */
- build_vbase_offset_vtbl_entries (binfo, vid);
-+
-+ if (num_parent_inits)
-+ *num_parent_inits = list_length (vid->inits);
-+
- /* Add the vcall entries for this base. */
- build_vcall_offset_vtbl_entries (binfo, vid);
- }
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/cp/cp-tree.h gcc-4.2.1-20070724/gcc/cp/cp-tree.h
---- gcc-4.2.1-20070724/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-20070724/gcc/cp/cp-tree.h 2008-01-09 15:26:55.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,14 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* foo */
-+extern GTY(()) tree vtable_copy_slots;
-+
-+/* A list of inherited vtable slots which are copies of other slots
-+ The source address is stored in the TREE_VALUE slot and the
-+ destination is stored in the TREE_PURPOSE slot. */
-+/* extern GTY(()) tree vtable_slot_copies; */
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/cp/decl.c gcc-4.2.1-20070724/gcc/cp/decl.c
---- gcc-4.2.1-20070724/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-20070724/gcc/cp/decl.c 2008-01-09 15:26:55.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmask", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/cp/decl2.c gcc-4.2.1-20070724/gcc/cp/decl2.c
---- gcc-4.2.1-20070724/gcc/cp/decl2.c 2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-20070724/gcc/cp/decl2.c 2008-01-09 15:26:55.000000000 +0000
-@@ -2910,6 +2910,159 @@
- finish_objects (function_key, priority, body);
- }
-
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+ tree dest_binfo;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest || !bitmap)
-+ return chain;
-+
-+ dest_binfo = TYPE_BINFO (dest);
-+
-+ fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap);
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for_binfo (dest_binfo);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
-+static void
-+generate_vtable_copy_slots (void)
-+{
-+ tree k, decl;
-+ tree inits = NULL_TREE;
-+
-+ fprintf (stderr, "Generate_vtable_copy_slots\n");
-+
-+ for (k = vtable_copy_slots; k; k = TREE_CHAIN(k))
-+ {
-+ tree st;
-+ tree t = TREE_PURPOSE(k);
-+ tree slot_relocs = TREE_VALUE(k);
-+ int dest_offset = 0;
-+
-+ fprintf (stderr, "Copy data for '%s'\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ /* FIXME: need to work out if the var has gone away ? */
-+ for (st = slot_relocs; st; st = TREE_CHAIN(st))
-+ {
-+ tree orig_binfo = TREE_PURPOSE(st);
-+ tree init_list = TREE_VALUE(st);
-+ tree v;
-+ int bitmap = 0;
-+ unsigned int i = 0;
-+ unsigned int src_offset = 0;
-+ int elide_leading_bits = 1;
-+
-+ fprintf (stderr, "\tfrom %s (%d) entries\n",
-+ orig_binfo ? type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER) : "<null pad>",
-+ list_length (init_list));
-+ for (v = init_list; v; v = TREE_CHAIN(v))
-+ {
-+ if (!TREE_VALUE(v))
-+ fprintf (stderr, "\t%3d\tNULL\n", dest_offset);
-+ else
-+ {
-+ tree fn = TREE_VALUE(v);
-+ elide_leading_bits = 0;
-+ fprintf (stderr, "\t%3d\t%s ", dest_offset,
-+ expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "[ %s ]\n",
-+ expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+ bitmap |= 1 << i;
-+ }
-+ /* don't waste space for non-copies */
-+ if (!elide_leading_bits)
-+ i++;
-+ dest_offset++;
-+ src_offset++;
-+ /* FIXME: this sucks - must be a better way to
-+ find target size: 32 or 64 (?) [ assuming elf etc. ] */
-+ if (i == (sizeof (long) * 8)) { /* FIXME ... arch size etc. */
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ i = bitmap = 0;
-+ }
-+ }
-+ inits = build_vtable_copy_slot (
-+ t, dest_offset - i, orig_binfo,
-+ src_offset - i, bitmap, inits);
-+ }
-+ }
-+
-+ if (inits)
-+ {
-+ tree atype;
-+ tree ctor;
-+ int n;
-+
-+ /* Termination of the list performed post aggregation in binutils */
-+ n = list_length (inits);
-+ fprintf (stderr, "Emit __vtbl_copy_global %d items\n", n);
-+
-+ atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (n)));
-+ layout_type (atype);
-+
-+ decl = build_lang_decl (VAR_DECL, get_identifier ("__vtbl_copy_global"), atype);
-+ DECL_VTRELOC_INIT(decl) = 1;
-+ DECL_SECTION_NAME(decl) = build_string (strlen (".vtrelocs"), ".vtrelocs");
-+
-+ /* begin black magic */
-+ DECL_ARTIFICIAL (decl) = 1;
-+ TREE_STATIC (decl) = 1;
-+ TREE_READONLY (decl) = 1;
-+ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
-+ DECL_VISIBILITY_SPECIFIED (decl) = 1;
-+
-+ ctor = build_constructor_from_list (atype, inits);
-+ initialize_artificial_var (decl, ctor);
-+ TREE_PUBLIC (decl) = 1;
-+ DECL_WEAK (decl) = 1;
-+ DECL_INTERFACE_KNOWN (decl) = 1;
-+ mark_used (decl);
-+
-+ rest_of_decl_compilation (decl, 1, 1);
-+ /* end black magic */
-+ }
-+}
-+
-+
- /* Generate constructor and destructor functions for the priority
- indicated by N. */
-
-@@ -3312,6 +3465,9 @@
- }
- }
-
-+ /* Generate C++ vtable copy data */
-+ generate_vtable_copy_slots ();
-+
- /* We give C linkage to static constructors and destructors. */
- push_lang_context (lang_name_c);
-
-diff -u -r -x testsuite -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' gcc-4.2.1-20070724/gcc/tree.h gcc-4.2.1-20070724/gcc/tree.h
---- gcc-4.2.1-20070724/gcc/tree.h 2008-01-09 12:33:14.000000000 +0000
-+++ gcc-4.2.1-20070724/gcc/tree.h 2008-01-09 15:27:54.000000000 +0000
-@@ -2892,6 +2892,7 @@
- unsigned based_on_restrict_p : 1;
- /* Used by C++. Might become a generic decl flag. */
- unsigned shadowed_for_var_p : 1;
-+ unsigned vtreloc_init:1;
-
- /* Don't belong to VAR_DECL exclusively. */
- unsigned in_system_header_flag : 1;
-@@ -2918,6 +2919,9 @@
- is not error_mark_node, then the decl cannot be put in .common. */
- #define DECL_COMMON(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.common_flag)
-
-+/* should we be emitted in a vtreloc section ? */
-+#define DECL_VTRELOC_INIT(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.vtreloc_init)
-+
- /* In a VAR_DECL, nonzero if the decl is a register variable with
- an explicit asm specification. */
- #define DECL_HARD_REGISTER(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.hard_register)
diff --git a/patches/test/gcc-ztvd.diff b/patches/test/gcc-ztvd.diff
deleted file mode 100644
index 2cd1acab2..000000000
--- a/patches/test/gcc-ztvd.diff
+++ /dev/null
@@ -1,302 +0,0 @@
-? TAGS.sub
-Index: class.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/class.c,v
-retrieving revision 1.707.2.3
-diff -u -r1.707.2.3 class.c
---- class.c 24 Apr 2005 12:46:26 -0000 1.707.2.3
-+++ class.c 9 Aug 2005 15:45:55 -0000
-@@ -169,6 +169,7 @@
- static void dump_thunk (FILE *, int, tree);
- static tree build_vtable (tree, tree, tree);
- static void initialize_vtable (tree, tree);
-+static void initialize_vtable_description (tree, tree, tree);
- static void layout_nonempty_base_or_field (record_layout_info,
- tree, tree, splay_tree);
- static tree end_of_class (tree, int);
-@@ -6609,7 +6610,10 @@
- }
-
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+ {
-+ initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+ initialize_vtable_description (t, TYPE_BINFO (t), TREE_VALUE (list));
-+ }
- }
-
- /* Initialize the vtable for BINFO with the INITS. */
-@@ -6623,6 +6627,76 @@
- decl = get_vtbl_decl_for_binfo (binfo);
- initialize_artificial_var (decl, inits);
- dump_vtable (BINFO_TYPE (binfo), binfo, decl);
-+}
-+
-+
-+static tree
-+build_string_literal (int len, const char *str)
-+{
-+ tree t, elem, index, type;
-+
-+ t = build_string (len, str);
-+ elem = build_type_variant (char_type_node, 1, 0);
-+ index = build_index_type (build_int_cst (NULL_TREE, len - 1));
-+ type = build_array_type (elem, index);
-+ TREE_TYPE (t) = type;
-+ TREE_CONSTANT (t) = 1;
-+ TREE_INVARIANT (t) = 1;
-+ TREE_READONLY (t) = 1;
-+ TREE_STATIC (t) = 1;
-+
-+ return t;
-+}
-+
-+/* Create initializers for vtable descriptors */
-+static void
-+initialize_vtable_description (tree type, tree binfo, tree vt_inits)
-+{
-+ tree decl, clist, carray, slot;
-+ tree name = mangle_vtbl_descr_for_type (type);
-+
-+ /* create the vtable description variable */
-+ decl = build_vtable (type, name, vtbl_descr_type_node);
-+
-+ /* setup the array type */
-+ carray = build_cplus_array_type (string_type_node,
-+ build_index_type (size_int (list_length (vt_inits) - 1)));
-+ layout_type (carray);
-+
-+ /* layout the descr decl */
-+ TREE_TYPE (decl) = carray;
-+ DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = NULL_TREE;
-+ layout_decl (decl, 0);
-+
-+ /* setup the array contents */
-+ clist = NULL_TREE;
-+ for (slot = vt_inits; slot; slot = TREE_CHAIN (slot))
-+ {
-+ tree elem = TREE_VALUE (slot);
-+ tree value;
-+ if (TREE_CODE (elem) == NOP_EXPR)
-+ value = build_int_cst (NULL_TREE, 0);
-+ else
-+ {
-+ const char *method_name;
-+ gcc_assert (TREE_CODE (elem) == ADDR_EXPR);
-+ tree method = TREE_OPERAND (elem, 0);
-+ method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (method));
-+ value = build_string_literal (strlen (method_name) + 1, method_name);
-+ }
-+ clist = tree_cons (NULL_TREE, value, clist);
-+ }
-+ clist = nreverse (clist);
-+ initialize_artificial_var (decl, clist);
-+
-+ // FIXME: looks broken (?)
-+ if (!CLASSTYPE_VTABLE_DESCRS (type))
-+ CLASSTYPE_VTABLE_DESCRS (type) = decl;
-+ else
-+ {
-+ TREE_CHAIN (decl) = TREE_CHAIN (CLASSTYPE_VTABLE_DESCRS (type));
-+ TREE_CHAIN (CLASSTYPE_VTABLE_DESCRS (type)) = decl;
-+ }
- }
-
- /* Build the VTT (virtual table table) for T.
-Index: cp-tree.h
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/cp-tree.h,v
-retrieving revision 1.1106.2.8
-diff -u -r1.1106.2.8 cp-tree.h
---- cp-tree.h 5 Jun 2005 16:46:53 -0000 1.1106.2.8
-+++ cp-tree.h 9 Aug 2005 15:46:01 -0000
-@@ -484,6 +484,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_DESCR_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -560,6 +561,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_descr_type_node cp_global_trees[CPTI_VTBL_DESCR_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -1052,6 +1054,7 @@
- tree primary_base;
- VEC (tree_pair_s) *vcall_indices;
- tree vtables;
-+ tree vtable_descrs;
- tree typeinfo_var;
- VEC (tree) *vbases;
- binding_table nested_udts;
-@@ -1444,6 +1447,10 @@
- #define CLASSTYPE_VTABLES(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
-
-+/* Vtable descriptions for the class NODE. */
-+#define CLASSTYPE_VTABLE_DESCRS(NODE) \
-+ (LANG_TYPE_CLASS_CHECK (NODE)->vtable_descrs)
-+
- /* The std::type_info variable representing this class, or NULL if no
- such variable has been created. This field is only set for the
- TYPE_MAIN_VARIANT of the class. */
-@@ -4365,6 +4372,7 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtbl_descr_for_type (tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-Index: decl.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/decl.c,v
-retrieving revision 1.1371.2.14
-diff -u -r1.1371.2.14 decl.c
---- decl.c 3 Jun 2005 16:18:26 -0000 1.1371.2.14
-+++ decl.c 9 Aug 2005 15:46:12 -0000
-@@ -142,6 +142,7 @@
-
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-+ tree vtbl_descr_type_node;
-
- Namespaces,
-
-@@ -2984,6 +2985,24 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ vtbl_descr_type_node
-+ = build_cplus_array_type (string_type_node, NULL_TREE);
-+ fprintf (stderr, "Setup vtbl_descr_type_node %p\n", vtbl_descr_type_node);
-+ layout_type (vtbl_descr_type_node);
-+ if (!TYPE_SIZE (vtbl_descr_type_node))
-+ fprintf (stderr, "UNFAIR!\n");
-+ fprintf (stderr, "Setup vtbl_descr_type_node 2 %p\n", vtbl_descr_type_node);
-+ vtbl_descr_type_node = build_qualified_type (vtbl_descr_type_node, TYPE_QUAL_CONST);
-+ if (!TYPE_SIZE (vtbl_descr_type_node))
-+ {
-+ fprintf (stderr, "UNFAIR - take 2 %p %p!\n",
-+ TYPE_SIZE (vtbl_type_node),
-+ TYPE_SIZE (vtbl_descr_type_node));
-+ layout_type (vtbl_descr_type_node);
-+ }
-+ fprintf (stderr, "Setup vtbl_descr_type_node 3 %p\n", vtbl_descr_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_descr_type_node);
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-Index: decl2.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/decl2.c,v
-retrieving revision 1.770.2.2
-diff -u -r1.770.2.2 decl2.c
---- decl2.c 2 Jun 2005 17:31:01 -0000 1.770.2.2
-+++ decl2.c 9 Aug 2005 15:46:16 -0000
-@@ -1514,6 +1514,35 @@
- /* If necessary, write out the vtables for the dynamic class CTYPE.
- Returns true if any vtables were emitted. */
-
-+static void
-+emit_vt_descrs (tree ctype)
-+{
-+ tree vtbl;
-+
-+ for (vtbl = CLASSTYPE_VTABLE_DESCRS (ctype); vtbl; vtbl = TREE_CHAIN (vtbl))
-+ {
-+ tree content;
-+
-+// fprintf (stderr, "Finish TVDecl\n");
-+ TREE_PUBLIC (vtbl) = 1;
-+ DECL_EXTERNAL (vtbl) = 1;
-+ DECL_INTERFACE_KNOWN (vtbl) = 1;
-+ import_export_decl (vtbl);
-+ mark_used (vtbl);
-+
-+ if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)
-+ {
-+ tree expr = store_init_value (vtbl, DECL_INITIAL (vtbl));
-+
-+ /* It had better be all done at compile-time. */
-+ gcc_assert (!expr);
-+ }
-+
-+ DECL_EXTERNAL (vtbl) = 0;
-+ rest_of_decl_compilation (vtbl, 1, 1);
-+ }
-+}
-+
- static bool
- maybe_emit_vtables (tree ctype)
- {
-@@ -1582,6 +1611,8 @@
- /* Since we're writing out the vtable here, also write the debug
- info. */
- note_debug_info_needed (ctype);
-+
-+ emit_vt_descrs (ctype);
-
- return true;
- }
-Index: init.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/init.c,v
-retrieving revision 1.412.2.5
-diff -u -r1.412.2.5 init.c
---- init.c 31 May 2005 18:00:46 -0000 1.412.2.5
-+++ init.c 9 Aug 2005 15:46:19 -0000
-@@ -803,6 +803,25 @@
- /* Assign the vtable to the vptr. */
- vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0);
- finish_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl));
-+
-+#if 1
-+ /* Get pointer to information table */
-+ /* call vtable constructor */
-+ {
-+ tree vtbl_init;
-+ static tree vtbl_init_fndecl = NULL;
-+ if (!vtbl_init_fndecl) {
-+ tree args = build_function_type_list (ptr_type_node, NULL_TREE);
-+ vtbl_init_fndecl = build_decl (FUNCTION_DECL, get_identifier ("__vt_fixup"), args);
-+ TREE_PUBLIC (vtbl_init_fndecl) = 1;
-+ DECL_EXTERNAL (vtbl_init_fndecl) = 1;
-+ pushdecl_top_level (vtbl_init_fndecl);
-+ }
-+
-+ vtbl_init = build_tree_list (NULL_TREE, vtbl);
-+ finish_expr_stmt (build_function_call_expr (vtbl_init_fndecl, vtbl_init));
-+ }
-+#endif
- }
-
- /* If an exception is thrown in a constructor, those base classes already
-Index: mangle.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/cp/mangle.c,v
-retrieving revision 1.116
-diff -u -r1.116 mangle.c
---- mangle.c 24 Feb 2005 21:55:15 -0000 1.116
-+++ mangle.c 9 Aug 2005 15:46:22 -0000
-@@ -2619,6 +2619,14 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+/* Create an identifier for the mangled name of the vtable for TYPE. */
-+
-+tree
-+mangle_vtbl_descr_for_type (const tree type)
-+{
-+ return mangle_special_for_type (type, "TVD");
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
diff --git a/patches/test/glibc-bdirect.diff b/patches/test/glibc-bdirect.diff
deleted file mode 100644
index 94d5ee671..000000000
--- a/patches/test/glibc-bdirect.diff
+++ /dev/null
@@ -1,361 +0,0 @@
---- error - this patch is deprecated; cf. glibc-suse-bdirect.diff
-
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-close.c glibc-2.3/elf/dl-close.c
---- glibc-pristine/elf/dl-close.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-close.c 2005-10-19 21:48:52.000000000 +0100
-@@ -506,6 +506,9 @@
- /* Remove the searchlists. */
- free (imap->l_initfini);
-
-+ /* Remove the dtneeded list */
-+ free (imap->l_dtneeded.r_list);
-+
- /* Remove the scope array if we allocated it. */
- if (imap->l_scope != imap->l_scope_mem)
- free (imap->l_scope);
-Only in glibc-2.3/elf: dl-close.c~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-deps.c glibc-2.3/elf/dl-deps.c
---- glibc-pristine/elf/dl-deps.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-deps.c 2005-11-18 12:50:38.000000000 +0000
-@@ -39,6 +39,9 @@
- #define FILTERTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
- + DT_EXTRATAGIDX (DT_FILTER))
-
-+#ifndef VERSYMIDX
-+# define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
-+#endif
-
- /* When loading auxiliary objects we must ignore errors. It's ok if
- an object is missing. */
-@@ -139,6 +142,65 @@
- __result; })
-
-
-+static void
-+setup_direct (struct link_map *map, struct r_scope_elem *scope)
-+{
-+ if (map->l_info[VERSYMIDX(DT_DIRECT)] && map->l_info[DT_NEEDED])
-+ {
-+ const ElfW(Dyn) *d;
-+ unsigned int i;
-+ const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-+
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf ("** direct linkage section in '%s' **\n",
-+ map->l_name ? map->l_name : "<null>");
-+
-+ map->l_dtneeded.r_nlist = 1;
-+ for (d = map->l_ld; d->d_tag != DT_NULL; ++d)
-+ {
-+ if (__builtin_expect (d->d_tag, DT_NEEDED) == DT_NEEDED)
-+ map->l_dtneeded.r_nlist++;
-+ }
-+
-+ map->l_dtneeded.r_list = (struct link_map **)
-+ malloc (map->l_dtneeded.r_nlist * sizeof (struct link_map *));
-+
-+ map->l_dtneeded.r_list[0] = map;
-+ for (i = 1, d = map->l_ld; d->d_tag != DT_NULL; ++d)
-+ {
-+ const char *name;
-+ unsigned int j;
-+
-+ if (d->d_tag != DT_NEEDED)
-+ continue;
-+
-+ name = expand_dst (map, strtab + d->d_un.d_val, 0);
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf (" direct index %u object '%s'\n", i, name);
-+ for (j = 0; j < scope->r_nlist; j++)
-+ {
-+ if (scope->r_list[j] &&
-+ _dl_name_match_p (name, scope->r_list[j]))
-+ {
-+ map->l_dtneeded.r_list[i] = scope->r_list[j];
-+ break;
-+ }
-+ }
-+ if (!map->l_dtneeded.r_list[i])
-+ _dl_debug_printf (" impossible error - can't find '%s'\n", name);
-+ i++;
-+ }
-+ }
-+ else
-+ {
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf ("no direct linkage section in '%s'\n",
-+ map->l_name ? map->l_name : "<null>");
-+ map->l_dtneeded.r_nlist = 0;
-+ map->l_dtneeded.r_list = NULL;
-+ }
-+}
-+
- void
- internal_function
- _dl_map_object_deps (struct link_map *map,
-@@ -555,6 +617,16 @@
- }
- }
-
-+ if (__builtin_expect (GLRO(dl_direct), 0))
-+ {
-+ /* Setup direct linkage dtneeded table */
-+ for (i = 0; i < nlist; ++i)
-+ setup_direct (map->l_searchlist.r_list[i], &map->l_searchlist);
-+ }
-+ else
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf (" no dl_direct set %u\n", GLRO(dl_direct));
-+
- /* Maybe we can remove some relocation dependencies now. */
- assert (map->l_searchlist.r_list[0] == map);
- for (i = 0; i < map->l_reldepsact; ++i)
-Only in glibc-2.3/elf: dl-deps.c~
-Only in glibc-2.3/elf: dl-load.c~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-lookup.c glibc-2.3/elf/dl-lookup.c
---- glibc-pristine/elf/dl-lookup.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-lookup.c 2005-11-23 11:23:47.000000000 +0000
-@@ -32,6 +32,10 @@
-
- #define VERSTAG(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag))
-
-+#ifndef VERSYMIDX
-+# define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
-+#endif
-+
- /* We need this string more than once. */
- static const char undefined_msg[] = "undefined symbol: ";
-
-@@ -209,6 +213,7 @@
- const unsigned long int hash = _dl_elf_hash (undef_name);
- struct sym_val current_value = { NULL, NULL };
- struct r_scope_elem **scope = symbol_scope;
-+ size_t i = 0;
-
- bump_num_relocations ();
-
-@@ -216,7 +221,81 @@
- up a versioned symbol. */
- assert (version == NULL || flags == 0 || flags == DL_LOOKUP_ADD_DEPENDENCY);
-
-- size_t i = 0;
-+ if (__builtin_expect (undef_map != NULL, 1) &&
-+ __builtin_expect (undef_map->l_dtneeded.r_nlist != NULL, 0) &&
-+ __builtin_expect (*ref != NULL, 1))
-+ {
-+ unsigned int idx, noffset;
-+ const ElfW(Sym) *symtab;
-+ ElfW(Addr) direct;
-+
-+ /* We need a dynsym index ... */
-+ symtab = (const void *) D_PTR (undef_map, l_info[DT_SYMTAB]);
-+ direct = D_PTR (undef_map, l_info[VERSYMIDX(DT_DIRECT)]);
-+
-+ idx = *ref - symtab;
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("dynamic symbol index %u from '%s' for %s base direct 0x%x start 0x%x\n", idx,
-+ undef_map->l_name ? undef_map->l_name : "<noname>",
-+ undef_name ? undef_name : "<undef>",
-+ (int) direct, (int) undef_map->l_map_start);
-+ direct += idx * 2;
-+ if (direct >= undef_map->l_map_end || direct <= undef_map->l_map_start)
-+ _dl_debug_printf ("broken: off end of map 0x%x\n", (int) direct);
-+ else
-+ {
-+ noffset = *(uint16_t *)direct;
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("dynamic symbol offset %u from 0x%x\n", noffset, (int) direct);
-+ if (noffset & DT_DIRECT_VAGUE)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("vague symbol\n");
-+ goto normal_lookup;
-+ }
-+
-+ noffset &= DT_DIRECT_MASK;
-+
-+ if (__builtin_expect (noffset < undef_map->l_dtneeded.r_nlist, 1))
-+ {
-+ int res;
-+ struct r_scope_elem direct_elem;
-+
-+ /* FIXME - requires LD_PRELOAD support ... */
-+ direct_elem.r_list = undef_map->l_dtneeded.r_list + noffset;
-+ direct_elem.r_nlist = 1;
-+
-+ if (direct_elem.r_list[0] == skip_map)
-+ goto normal_lookup; /* FIXME - correct ? */
-+
-+ res = do_lookup_x (undef_name, hash, *ref, &current_value, &direct_elem,
-+ 0, version, flags, skip_map, type_class);
-+ if (res > 0)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("direct lookup ...\n");
-+ goto match;
-+ }
-+ else
-+ _dl_debug_printf ("Error in lookup %u - missing (?) - fallback "
-+ "to deps & then global ? ...\n", res);
-+ }
-+ else if (noffset == DT_DIRECT_UNKNOWN)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("unknown/undefined symbol '%s'\n",
-+ undef_name ? undef_name : "<undef>");
-+ }
-+ else
-+ {
-+ _dl_debug_printf ("Error: foo symbol '%s' 0 < %u < %u\n",
-+ undef_name ? undef_name : "<undef>",
-+ noffset, undef_map->l_dtneeded.r_nlist);
-+ }
-+ }
-+ }
-+ normal_lookup:
-+
- if (__builtin_expect (skip_map != NULL, 0))
- {
- /* Search the relevant loaded objects for a definition. */
-@@ -258,7 +337,7 @@
- return 0;
- }
- }
--
-+ match:
- if (__builtin_expect (current_value.s == NULL, 0))
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
-Only in glibc-2.3/elf: dl-lookup.c~
-Only in glibc-pristine/elf: dl-lookup.c.orig
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-support.c glibc-2.3/elf/dl-support.c
---- glibc-pristine/elf/dl-support.c 2005-11-17 17:40:21.000000000 +0000
-+++ glibc-2.3/elf/dl-support.c 2005-11-17 17:28:30.000000000 +0000
-@@ -41,6 +41,7 @@
-
- int _dl_debug_mask;
- int _dl_lazy;
-+int _dl_direct;
- int _dl_mlock_pages;
- int _dl_madvise;
- ElfW(Addr) _dl_use_load_bias = -2;
-@@ -242,6 +243,8 @@
-
- _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';
-
-+ _dl_direct = *(getenv ("LD_BIND_DIRECT") ?: "") == '\0';
-+
- _dl_madvise = *(getenv ("LD_NOMADVISE") ?: "") == '\0';
-
- _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';
-Only in glibc-2.3/elf: dl-support.c~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dynamic-link.h glibc-2.3/elf/dynamic-link.h
---- glibc-pristine/elf/dynamic-link.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dynamic-link.h 2005-10-19 21:01:06.000000000 +0100
-@@ -94,6 +94,7 @@
- ADJUST_DYN_INFO (DT_PLTGOT);
- ADJUST_DYN_INFO (DT_STRTAB);
- ADJUST_DYN_INFO (DT_SYMTAB);
-+ ADJUST_DYN_INFO (VERSYMIDX(DT_DIRECT));
- # if ! ELF_MACHINE_NO_RELA
- ADJUST_DYN_INFO (DT_RELA);
- # endif
-Only in glibc-2.3/elf: dynamic-link.h~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/elf.h glibc-2.3/elf/elf.h
---- glibc-pristine/elf/elf.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/elf.h 2005-11-23 11:18:29.000000000 +0000
-@@ -714,6 +714,7 @@
- /* The versioning entry types. The next are defined as part of the
- GNU extension. */
- #define DT_VERSYM 0x6ffffff0
-+#define DT_DIRECT 0x6ffffff1 /* FIXME - how are these allocated ? */
-
- #define DT_RELACOUNT 0x6ffffff9
- #define DT_RELCOUNT 0x6ffffffa
-@@ -743,6 +744,11 @@
- #define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
- #define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
-
-+/* Constants for the DT_DIRECT entries. */
-+#define DT_DIRECT_VAGUE (1<<15)
-+#define DT_DIRECT_MASK 0x3ff
-+#define DT_DIRECT_UNKNOWN DT_DIRECT_MASK
-+
- /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
- entry in the dynamic section. */
- #define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
-Only in glibc-2.3/elf: elf.h~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/rtld.c glibc-2.3/elf/rtld.c
---- glibc-pristine/elf/rtld.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/rtld.c 2005-11-18 12:51:38.000000000 +0000
-@@ -123,6 +123,7 @@
- ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID,
- ._dl_hwcap_mask = HWCAP_IMPORTANT,
- ._dl_lazy = 1,
-+ ._dl_direct = 0,
- ._dl_fpu_control = _FPU_DEFAULT,
- ._dl_madvise = 1,
-
-@@ -2056,11 +2057,13 @@
- DL_DEBUG_SYMBOLS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("bindings"), "display information about symbol binding",
- DL_DEBUG_BINDINGS | DL_DEBUG_IMPCALLS },
-+ { LEN_AND_STR ("direct"), "display information about direct binding",
-+ DL_DEBUG_DIRECT | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("versions"), "display version dependencies",
- DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("all"), "all previous options combined",
- DL_DEBUG_LIBS | DL_DEBUG_RELOC | DL_DEBUG_FILES | DL_DEBUG_SYMBOLS
-- | DL_DEBUG_BINDINGS | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
-+ | DL_DEBUG_BINDINGS | DL_DEBUG_DIRECT | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("statistics"), "display relocation statistics",
- DL_DEBUG_STATISTICS },
- { LEN_AND_STR ("unused"), "determined unused DSOs",
-@@ -2230,6 +2233,8 @@
- if (!INTUSE(__libc_enable_secure)
- && memcmp (envline, "ORIGIN_PATH", 11) == 0)
- GLRO(dl_origin_path) = &envline[12];
-+ if (memcmp (envline, "BIND_DIRECT", 11) == 0)
-+ GLRO(dl_direct) = envline[12] != '\0';
- break;
-
- case 12:
-Only in glibc-2.3/elf: rtld.c~
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/include/link.h glibc-2.3/include/link.h
---- glibc-pristine/include/link.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/include/link.h 2005-10-19 21:13:12.000000000 +0100
-@@ -299,6 +299,10 @@
- done. */
- ElfW(Addr) l_relro_addr;
- size_t l_relro_size;
-+
-+ /* Array of DT_NEEDED dependencies in order for use in
-+ direct linkage - l_dtneeded[0] entry is self */
-+ struct r_scope_elem l_dtneeded;
- };
-
- struct dl_phdr_info
-
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/sysdeps/generic/ldsodefs.h glibc-2.3/sysdeps/generic/ldsodefs.h
---- glibc-pristine/sysdeps/generic/ldsodefs.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/sysdeps/generic/ldsodefs.h 2005-11-17 17:27:28.000000000 +0000
-@@ -388,6 +388,7 @@
- /* These two are used only internally. */
- #define DL_DEBUG_HELP (1 << 9)
- #define DL_DEBUG_PRELINK (1 << 10)
-+#define DL_DEBUG_DIRECT (1 << 11)
-
- /* Cached value of `getpagesize ()'. */
- EXTERN size_t _dl_pagesize;
-@@ -413,6 +414,9 @@
- /* Do we do lazy relocations? */
- EXTERN int _dl_lazy;
-
-+ /* Do we do direct relocations? */
-+ EXTERN int _dl_direct;
-+
- /* Should we advise kernel about memory usage? */
- EXTERN int _dl_madvise;
-
diff --git a/patches/test/glibc-suse-bdirect.diff b/patches/test/glibc-suse-bdirect.diff
deleted file mode 100644
index a07ac2d2d..000000000
--- a/patches/test/glibc-suse-bdirect.diff
+++ /dev/null
@@ -1,341 +0,0 @@
-This patch requires glibc-suse-hashvals.diff ...
-
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-close.c glibc-2.3/elf/dl-close.c
---- glibc-pristine/elf/dl-close.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-close.c 2005-10-19 21:48:52.000000000 +0100
-@@ -506,6 +506,9 @@
- /* Remove the searchlists. */
- free (imap->l_initfini);
-
-+ /* Remove the dtneeded list. */
-+ free (imap->l_dtneeded.r_list);
-+
- /* Remove the scope array if we allocated it. */
- if (imap->l_scope != imap->l_scope_mem)
- free (imap->l_scope);
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-deps.c glibc-2.3/elf/dl-deps.c
---- glibc-pristine/elf/dl-deps.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-deps.c 2005-11-18 12:50:38.000000000 +0000
-@@ -39,6 +39,10 @@
- #define FILTERTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
- + DT_EXTRATAGIDX (DT_FILTER))
-
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-
- /* When loading auxiliary objects we must ignore errors. It's ok if
- an object is missing. */
-@@ -139,6 +142,65 @@
- __result; })
-
-
-+static void
-+setup_direct (struct link_map *map, struct r_scope_elem *scope)
-+{
-+ if (map->l_info[SUSEIDX(DT_SUSE_DIRECT)] && map->l_info[DT_NEEDED])
-+ {
-+ const ElfW(Dyn) *d;
-+ unsigned int i;
-+ const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-+
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf ("** direct linkage section in '%s' **\n",
-+ map->l_name ? map->l_name : "<null>");
-+
-+ map->l_dtneeded.r_nlist = 1;
-+ for (d = map->l_ld; d->d_tag != DT_NULL; ++d)
-+ {
-+ if (__builtin_expect (d->d_tag, DT_NEEDED) == DT_NEEDED)
-+ map->l_dtneeded.r_nlist++;
-+ }
-+
-+ map->l_dtneeded.r_list = (struct link_map **)
-+ malloc (map->l_dtneeded.r_nlist * sizeof (struct link_map *));
-+
-+ map->l_dtneeded.r_list[0] = map;
-+ for (i = 1, d = map->l_ld; d->d_tag != DT_NULL; ++d)
-+ {
-+ const char *name;
-+ unsigned int j;
-+
-+ if (d->d_tag != DT_NEEDED)
-+ continue;
-+
-+ name = expand_dst (map, strtab + d->d_un.d_val, 0);
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf (" direct index %u object '%s'\n", i, name);
-+ for (j = 0; j < scope->r_nlist; j++)
-+ {
-+ if (scope->r_list[j] &&
-+ _dl_name_match_p (name, scope->r_list[j]))
-+ {
-+ map->l_dtneeded.r_list[i] = scope->r_list[j];
-+ break;
-+ }
-+ }
-+ if (!map->l_dtneeded.r_list[i])
-+ _dl_debug_printf (" impossible error - can't find '%s'\n", name);
-+ i++;
-+ }
-+ }
-+ else
-+ {
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf ("no direct linkage section in '%s'\n",
-+ map->l_name ? map->l_name : "<null>");
-+ map->l_dtneeded.r_nlist = 0;
-+ map->l_dtneeded.r_list = NULL;
-+ }
-+}
-+
- void
- internal_function
- _dl_map_object_deps (struct link_map *map,
-@@ -555,6 +617,16 @@
- }
- }
-
-+ if (__builtin_expect (GLRO(dl_direct), 0) && npreloads == 0)
-+ {
-+ /* Setup direct linkage dtneeded table. */
-+ for (i = 0; i < nlist; ++i)
-+ setup_direct (map->l_searchlist.r_list[i], &map->l_searchlist);
-+ }
-+ else
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_DIRECT)
-+ _dl_debug_printf (" no dl_direct set %u\n", GLRO(dl_direct));
-+
- /* Maybe we can remove some relocation dependencies now. */
- assert (map->l_searchlist.r_list[0] == map);
- for (i = 0; i < map->l_reldepsact; ++i)
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-lookup.c glibc-2.3/elf/dl-lookup.c
---- glibc-pristine/elf/dl-lookup.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-lookup.c 2005-11-23 11:23:47.000000000 +0000
-@@ -32,6 +32,11 @@
-
- #define VERSTAG(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag))
-
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-+
- /* We need this string more than once. */
- static const char undefined_msg[] = "undefined symbol: ";
-
-@@ -209,6 +213,7 @@
- unsigned long int hash;
- struct sym_val current_value = { NULL, NULL };
- struct r_scope_elem **scope = symbol_scope;
-+ size_t i = 0;
-
- /* This sucks mostly - but people sadly don't pass a symtab index, or hashvals ptr in */
- const Elf_Symndx *hashvals;
-@@ -216,7 +221,80 @@
- up a versioned symbol. */
- assert (version == NULL || flags == 0 || flags == DL_LOOKUP_ADD_DEPENDENCY);
-
-- size_t i = 0;
-+ if (__builtin_expect (undef_map != NULL, 1) &&
-+ __builtin_expect (undef_map->l_dtneeded.r_nlist != NULL, 0) &&
-+ __builtin_expect (*ref != NULL, 1))
-+ {
-+ unsigned int idx, noffset;
-+ const ElfW(Sym) *symtab;
-+ ElfW(Addr) direct;
-+
-+ /* We need a dynsym index. */
-+ symtab = (const void *) D_PTR (undef_map, l_info[DT_SYMTAB]);
-+ direct = D_PTR (undef_map, l_info[SUSEIDX(DT_SUSE_DIRECT)]);
-+
-+ idx = *ref - symtab;
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("dynamic symbol index %u from '%s' for %s base direct 0x%x start 0x%x\n", idx,
-+ undef_map->l_name ? undef_map->l_name : "<noname>",
-+ undef_name ? undef_name : "<undef>",
-+ (int) direct, (int) undef_map->l_map_start);
-+ direct += idx * 2;
-+ if (direct >= undef_map->l_map_end || direct <= undef_map->l_map_start)
-+ _dl_debug_printf ("broken: off end of map 0x%x\n", (int) direct);
-+ else
-+ {
-+ noffset = *(uint16_t *)direct;
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("dynamic symbol offset %u from 0x%x\n", noffset, (int) direct);
-+ if (noffset & DT_SUSE_DIRECT_VAGUE)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("vague symbol\n");
-+ goto normal_lookup;
-+ }
-+
-+ noffset &= DT_SUSE_DIRECT_MASK;
-+
-+ if (__builtin_expect (noffset < undef_map->l_dtneeded.r_nlist, 1))
-+ {
-+ int res;
-+ struct r_scope_elem direct_elem;
-+
-+ direct_elem.r_list = undef_map->l_dtneeded.r_list + noffset;
-+ direct_elem.r_nlist = 1;
-+
-+ if (direct_elem.r_list[0] == skip_map)
-+ goto normal_lookup; /* FIXME - correct ? */
-+
-+ res = do_lookup_x (undef_name, hash, *ref, &current_value, &direct_elem,
-+ 0, version, flags, skip_map, type_class);
-+ if (res > 0)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("direct lookup ...\n");
-+ goto match;
-+ }
-+ else
-+ _dl_debug_printf ("Error in lookup %u - missing (?) - fallback "
-+ "to deps & then global ? ...\n", res);
-+ }
-+ else if (noffset == DT_SUSE_DIRECT_UNKNOWN)
-+ {
-+ if (__builtin_expect ((GLRO(dl_debug_mask) & DL_DEBUG_DIRECT) != 0, 0))
-+ _dl_debug_printf ("unknown/undefined symbol '%s'\n",
-+ undef_name ? undef_name : "<undef>");
-+ }
-+ else
-+ {
-+ _dl_debug_printf ("Error: foo symbol '%s' 0 < %u < %u\n",
-+ undef_name ? undef_name : "<undef>",
-+ noffset, undef_map->l_dtneeded.r_nlist);
-+ }
-+ }
-+ }
-+ normal_lookup:
-+
- if (__builtin_expect (skip_map != NULL, 0))
- {
- /* Search the relevant loaded objects for a definition. */
-@@ -258,7 +337,7 @@
- return 0;
- }
- }
--
-+ match:
- if (__builtin_expect (current_value.s == NULL, 0))
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-support.c glibc-2.3/elf/dl-support.c
---- glibc-pristine/elf/dl-support.c 2005-11-17 17:40:21.000000000 +0000
-+++ glibc-2.3/elf/dl-support.c 2005-11-17 17:28:30.000000000 +0000
-@@ -41,6 +41,7 @@
- int _dl_debug_mask;
- int _dl_lazy;
- int _dl_madvise;
-+int _dl_direct;
- ElfW(Addr) _dl_use_load_bias = -2;
- int _dl_dynamic_weak;
-
-@@ -242,6 +243,8 @@
-
- _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';
-
-+ _dl_direct = *(getenv ("LD_BIND_DIRECT") ?: "") == '\0';
-+
- _dl_madvise = *(getenv ("LD_NOMADVISE") ?: "") == '\0';
-
- _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';
-
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/elf.h glibc-2.3/elf/elf.h
---- glibc-pristine/elf/elf.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/elf.h 2005-11-23 11:18:29.000000000 +0000
-@@ -743,6 +744,11 @@
- #define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
- #define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
-
-+/* Constants for the DT_SUSE_DIRECT entries. */
-+#define DT_SUSE_DIRECT_VAGUE (1<<15)
-+#define DT_SUSE_DIRECT_MASK 0xfff
-+#define DT_SUSE_DIRECT_UNKNOWN DT_SUSE_DIRECT_MASK
-+
- /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
- entry in the dynamic section. */
- #define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/rtld.c glibc-2.3/elf/rtld.c
---- glibc-pristine/elf/rtld.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/rtld.c 2005-11-18 12:51:38.000000000 +0000
-@@ -123,6 +123,7 @@
- ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID,
- ._dl_hwcap_mask = HWCAP_IMPORTANT,
- ._dl_lazy = 1,
-+ ._dl_direct = 0,
- ._dl_fpu_control = _FPU_DEFAULT,
- ._dl_pointer_guard = 1,
- ._dl_madvise = 1,
-@@ -2056,11 +2057,13 @@
- DL_DEBUG_SYMBOLS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("bindings"), "display information about symbol binding",
- DL_DEBUG_BINDINGS | DL_DEBUG_IMPCALLS },
-+ { LEN_AND_STR ("direct"), "display information about direct binding",
-+ DL_DEBUG_DIRECT | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("versions"), "display version dependencies",
- DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("all"), "all previous options combined",
- DL_DEBUG_LIBS | DL_DEBUG_RELOC | DL_DEBUG_FILES | DL_DEBUG_SYMBOLS
-- | DL_DEBUG_BINDINGS | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
-+ | DL_DEBUG_BINDINGS | DL_DEBUG_DIRECT | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
- { LEN_AND_STR ("statistics"), "display relocation statistics",
- DL_DEBUG_STATISTICS },
- { LEN_AND_STR ("unused"), "determined unused DSOs",
-@@ -2230,6 +2233,8 @@
- if (!INTUSE(__libc_enable_secure)
- && memcmp (envline, "ORIGIN_PATH", 11) == 0)
- GLRO(dl_origin_path) = &envline[12];
-+ if (memcmp (envline, "BIND_DIRECT", 11) == 0)
-+ GLRO(dl_direct) = envline[12] != '\0';
- break;
-
- case 12:
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/include/link.h glibc-2.3/include/link.h
---- glibc-pristine/include/link.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/include/link.h 2005-10-19 21:13:12.000000000 +0100
-@@ -299,6 +299,9 @@
- done. */
- ElfW(Addr) l_relro_addr;
- size_t l_relro_size;
-+ /* Array of DT_NEEDED dependencies in order for use in
-+ direct linkage - l_dtneeded[0] entry is self. */
-+ struct r_scope_elem l_dtneeded;
-
- /* Audit information. This array apparent must be the last in the
- structure. Never add something after it. */
-
-
-
-diff -u -r -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/sysdeps/generic/ldsodefs.h glibc-2.3/sysdeps/generic/ldsodefs.h
---- glibc-pristine/sysdeps/generic/ldsodefs.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/sysdeps/generic/ldsodefs.h 2005-11-17 17:27:28.000000000 +0000
-@@ -388,6 +388,7 @@
- /* These two are used only internally. */
- #define DL_DEBUG_HELP (1 << 9)
- #define DL_DEBUG_PRELINK (1 << 10)
-+#define DL_DEBUG_DIRECT (1 << 11)
-
- /* Cached value of `getpagesize ()'. */
- EXTERN size_t _dl_pagesize;
-@@ -413,6 +414,9 @@
- /* Do we do lazy relocations? */
- EXTERN int _dl_lazy;
-
-+ /* Do we do direct relocations? */
-+ EXTERN int _dl_direct;
-+
- /* Should we advise kernel about memory usage? */
- EXTERN int _dl_madvise;
-
diff --git a/patches/test/glibc-suse-hashvals.diff b/patches/test/glibc-suse-hashvals.diff
deleted file mode 100644
index a975b2621..000000000
--- a/patches/test/glibc-suse-hashvals.diff
+++ /dev/null
@@ -1,163 +0,0 @@
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dl-lookup.c glibc-2.3/elf/dl-lookup.c
---- glibc-pristine/elf/dl-lookup.c 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dl-lookup.c 2006-01-23 14:45:22.000000000 +0000
-@@ -206,10 +206,38 @@
- const struct r_found_version *version,
- int type_class, int flags, struct link_map *skip_map)
- {
-- const unsigned long int hash = _dl_elf_hash (undef_name);
-+ unsigned long int hash;
- struct sym_val current_value = { NULL, NULL };
- struct r_scope_elem **scope = symbol_scope;
-
-+ /* This sucks mostly - but people sadly don't pass a symtab index, or hashvals ptr in. */
-+ const Elf_Symndx *hashvals;
-+
-+ if (__builtin_expect (undef_map != NULL, 1) &&
-+ __builtin_expect (undef_map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1) &&
-+ __builtin_expect ((hashvals = (const void *)D_PTR (undef_map, l_info[SUSEIDX(DT_SUSE_HASHVALS)])) != NULL, 1) &&
-+ __builtin_expect (*ref != NULL, 1))
-+ {
-+ const ElfW(Sym) *symtab = (const void *) D_PTR (undef_map, l_info[DT_SYMTAB]);
-+ hashvals += *ref - symtab;
-+
-+ if (__builtin_expect ((ElfW(Addr))hashvals >= undef_map->l_map_end, 0) ||
-+ __builtin_expect ((ElfW(Addr))hashvals <= undef_map->l_map_start, 0))
-+ _dl_debug_printf ("out of bounds madness ... 0x%x\n", (int) hashvals);
-+ else
-+ {
-+ hash = *hashvals;
-+#if 0
-+ if (hash != _dl_elf_hash (undef_name))
-+ _dl_debug_printf ("Hash difference ! 0x%x 0x%x [offset 0x%x]\n",
-+ (int) _dl_elf_hash (undef_name),
-+ (int) hash, (int) (*ref - symtab));
-+#endif
-+ }
-+ }
-+ else
-+ hash = _dl_elf_hash (undef_name);
-+
- bump_num_relocations ();
-
- /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/do-lookup.h glibc-2.3/elf/do-lookup.h
---- glibc-pristine/elf/do-lookup.h 2005-04-06 07:57:05.000000000 +0100
-+++ glibc-2.3/elf/do-lookup.h 2006-01-23 14:17:32.000000000 +0000
-@@ -17,6 +17,9 @@
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+
- /* Inner part of the lookup functions. We return a value > 0 if we
- found the symbol, the value 0 if nothing is found and < 0 if
- something bad happened. */
-@@ -35,6 +38,7 @@
- do
- {
- const ElfW(Sym) *symtab;
-+ const Elf_Symndx *hashvals;
- const char *strtab;
- const ElfW(Half) *verstab;
- Elf_Symndx symidx;
-@@ -62,10 +66,11 @@
- undef_name,
- map->l_name[0] ? map->l_name : rtld_progname,
- map->l_ns);
-
-- symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
-- strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-- verstab = map->l_versyms;
-+ if (__builtin_expect (map->l_info[SUSEIDX(DT_SUSE_HASHVALS)] != NULL, 1))
-+ hashvals = (const void *) D_PTR (map, l_info[SUSEIDX(DT_SUSE_HASHVALS)]);
-+ else
-+ hashvals = NULL;
-
- /* Search the appropriate hash bucket in this object's symbol table
- for a definition for the same symbol name. */
-@@ -72,6 +77,20 @@
- symidx != STN_UNDEF;
- symidx = map->l_chain[symidx])
- {
-+ if (__builtin_expect (hashvals != NULL, 1) &&
-+ __builtin_expect ((ElfW(Addr))hashvals < map->l_map_end, 1) &&
-+ __builtin_expect ((ElfW(Addr))hashvals > map->l_map_start, 1))
-+ {
-+ if (__builtin_expect (hashvals[symidx] != hash, 1))
-+ continue;
-+ }
-+ /* If hashvals is present 99.9% of the loop is done: what follows
-+ is the very un-common / direct-hit case. */
-+
-+ symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
-+ strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-+ verstab = map->l_versyms;
-+
- sym = &symtab[symidx];
-
- assert (ELF_RTYPE_CLASS_PLT == 1);
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/dynamic-link.h glibc-2.3/elf/dynamic-link.h
---- glibc-pristine/elf/dynamic-link.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/dynamic-link.h 2006-01-20 16:54:28.000000000 +0000
-@@ -24,6 +24,10 @@
- #ifndef VERSYMIDX
- # define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
- #endif
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-
-
- /* Read the dynamic section at DYN and fill in INFO with indices DT_*. */
-@@ -52,6 +56,9 @@
- else if (dyn->d_tag >= DT_LOPROC &&
- dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
- info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
-+ else if (dyn->d_tag >= DT_SUSE_LO &&
-+ dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
-+ info[SUSEIDX(dyn->d_tag)] = dyn;
- else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
- info[VERSYMIDX (dyn->d_tag)] = dyn;
- else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
-@@ -102,6 +109,8 @@
- # endif
- ADJUST_DYN_INFO (DT_JMPREL);
- ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
-+ ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_HASHVALS));
-+ ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_DIRECT));
- # undef ADJUST_DYN_INFO
- assert (cnt <= DL_RO_DYN_TEMP_CNT);
- }
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/elf/elf.h glibc-2.3/elf/elf.h
---- glibc-pristine/elf/elf.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/elf/elf.h 2006-01-20 15:27:22.000000000 +0000
-@@ -729,6 +729,14 @@
- #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
- #define DT_VERSIONTAGNUM 16
-
-+/* SUSE specific pieces - at a random OS specific address. */
-+#define DT_SUSE_LO 0x6cbdd030
-+#define DT_SUSE_HASHVALS DT_SUSE_LO
-+#define DT_SUSE_DIRECT DT_SUSE_LO + 1
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 2
-+
- /* Sun added these machine-independent extensions in the "processor-specific"
- range. Be compatible. */
- #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
-diff -u -r -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-pristine/include/link.h glibc-2.3/include/link.h
---- glibc-pristine/include/link.h 2005-11-17 17:48:13.000000000 +0000
-+++ glibc-2.3/include/link.h 2006-01-20 15:27:17.000000000 +0000
-@@ -154,7 +154,7 @@
- are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
-
- ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
-- + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
-+ + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
- const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
- ElfW(Addr) l_entry; /* Entry point location. */
- ElfW(Half) l_phnum; /* Number of program header entries. */
diff --git a/patches/test/glibc-vt-reloc-3.diff b/patches/test/glibc-vt-reloc-3.diff
deleted file mode 100644
index f0e456fb9..000000000
--- a/patches/test/glibc-vt-reloc-3.diff
+++ /dev/null
@@ -1,239 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-init.c glibc-2.6.1/elf/dl-init.c
---- pristine-glibc-2.6.1/elf/dl-init.c 2005-01-06 22:40:26.000000000 +0000
-+++ glibc-2.6.1/elf/dl-init.c 2008-01-22 16:09:03.000000000 +0000
-@@ -30,6 +30,79 @@
- extern int _dl_starting_up_internal attribute_hidden;
- #endif
-
-+#define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+
-+/* process vtable / block copy relocations */
-+
-+static void
-+_dl_perform_vtrelocs (struct link_map *map)
-+{
-+ ElfW(VtReloc) *rel;
-+ int debug_output = GLRO(dl_debug_mask) & DL_DEBUG_RELOC;
-+ int i;
-+
-+ if (debug_output)
-+ _dl_debug_printf ("new vtcopy-reloc processing on '%s' offset 0x%x map 0x%x\n",
-+ map->l_name[0] ? map->l_name : rtld_progname,
-+ map->l_addr, map->l_map_start);
-+
-+ /* any vtrelocs ? */
-+ if (map->l_info[SUSEIDX(DT_SUSE_VTRELOC)] == NULL)
-+ {
-+ if (debug_output)
-+ _dl_debug_printf ("no vtreloc section in '%s'\n", map->l_name);
-+ return;
-+ }
-+ rel = (ElfW(VtReloc) *)(D_PTR (map, l_info[SUSEIDX(DT_SUSE_VTRELOC)]));
-+ if (debug_output)
-+ _dl_debug_printf ("vtreloc section found in '%s' at 0x%x (0x%x) mapped at 0x%x\n",
-+ map->l_name, rel, ((ElfW(Addr))rel - map->l_addr),
-+ map->l_addr);
-+ while (rel->r_src != 0)
-+ {
-+ ElfW(Addr) **src, **dest;
-+ ElfW(Word) mask;
-+
-+ src = (void *)rel->r_src;
-+ dest = (void *)rel->r_dest;
-+ if (debug_output)
-+ _dl_debug_printf ("copy from 0x%x to 0x%x mask 0x%x\n", src, dest, rel->r_mask);
-+#ifdef DONT_TOUCH_EXTERNAL
-+ if (dest < map->l_map_start || dest >= map->l_map_end)
-+ { /* weak symbol defined in another dso - thus already fixed up, and readonly */
-+ if (debug_output)
-+ _dl_debug_printf (" skip, defined elsewhere\n");
-+ }
-+ else
-+#endif
-+ {
-+ for (mask = rel->r_mask; mask; mask >>= 1)
-+ {
-+ /* _dl_debug_printf ("%s copy [&0x%x -> &0x%x]\n",
-+ mask & 1 ? "do" : "no", src, dest); */
-+ if (mask & 1)
-+ {
-+ if (debug_output || !(*src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef))
-+ {
-+ _dl_debug_printf ("do copy 0x%x to 0x%x %s [&0x%x -> &0x%x]\n",
-+ *src, *dest,
-+ *src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef ? "match" : "Bug",
-+ src, dest);
-+ }
-+ *dest = *src;
-+ }
-+ else if (debug_output)
-+ _dl_debug_printf ("no copy 0x%x to 0x%x %s\n",
-+ *src, *dest, *src == *dest && (int)*src > 0x100 ? "Bug" : "skip");
-+ dest++; src++;
-+ }
-+ }
-+ if (debug_output)
-+ _dl_debug_printf ("move to next vtrel entry\n");
-+ rel++;
-+ }
-+}
-
- static void
- call_init (struct link_map *l, int argc, char **argv, char **env)
-@@ -42,6 +115,8 @@
- dependency. */
- l->l_init_called = 1;
-
-+ _dl_perform_vtrelocs (l);
-+
- /* Check for object which constructors we do not run here. */
- if (__builtin_expect (l->l_name[0], 'a') == '\0'
- && l->l_type == lt_executable)
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-load.c glibc-2.6.1/elf/dl-load.c
---- pristine-glibc-2.6.1/elf/dl-load.c 2008-01-08 20:45:11.000000000 +0000
-+++ glibc-2.6.1/elf/dl-load.c 2008-01-11 15:23:16.000000000 +0000
-@@ -1200,9 +1200,13 @@
-
- /* Remember which part of the address space this object uses. */
- l->l_map_start = (ElfW(Addr)) __mmap ((void *) mappref, maplength,
-- c->prot,
-+ c->prot | PROT_WRITE,
- MAP_COPY|MAP_FILE,
- fd, c->mapoff);
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_RELOC)
-+ _dl_debug_printf ("map '%s' at 0x%x prot 0x%x\n", l->l_name,
-+ l->l_map_start, c->prot);
-+
- if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
- {
- map_error:
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-reloc.c glibc-2.6.1/elf/dl-reloc.c
---- pristine-glibc-2.6.1/elf/dl-reloc.c 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/dl-reloc.c 2008-01-22 15:54:46.000000000 +0000
-@@ -133,7 +133,6 @@
- '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
- }
-
--
- void
- _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
- int lazy, int consider_profiling)
-@@ -174,11 +173,15 @@
- /* DT_TEXTREL is now in level 2 and might phase out at some time.
- But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
- testing easier and therefore it will be available at all time. */
-- if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
-+ if (1) //__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
- {
- /* Bletch. We must make read-only segments writable
- long enough to relocate them. */
- const ElfW(Phdr) *ph;
-+
-+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
-+ _dl_debug_printf ("un-protecting foo\n");
-+
- for (ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
- if (ph->p_type == PT_LOAD && (ph->p_flags & PF_W) == 0)
- {
-@@ -296,6 +299,7 @@
- /* Mark the object so we know this work has been done. */
- l->l_relocated = 1;
-
-+#if 0
- /* Undo the segment protection changes. */
- while (__builtin_expect (textrels != NULL, 0))
- {
-@@ -312,6 +316,7 @@
- done, do it. */
- if (l->l_relro_size != 0)
- _dl_protect_relro (l);
-+#endif
- }
-
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dynamic-link.h glibc-2.6.1/elf/dynamic-link.h
---- pristine-glibc-2.6.1/elf/dynamic-link.h 2006-07-10 22:52:18.000000000 +0100
-+++ glibc-2.6.1/elf/dynamic-link.h 2008-01-10 18:08:21.000000000 +0000
-@@ -65,6 +65,10 @@
- #ifndef VERSYMIDX
- # define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
- #endif
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-
-
- /* Read the dynamic section at DYN and fill in INFO with indices DT_*. */
-@@ -88,6 +92,9 @@
-
- while (dyn->d_tag != DT_NULL)
- {
-+ if (dyn->d_tag >= DT_SUSE_LO &&
-+ dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
-+ info[SUSEIDX(dyn->d_tag)] = dyn;
- if (dyn->d_tag < DT_NUM)
- info[dyn->d_tag] = dyn;
- else if (dyn->d_tag >= DT_LOPROC &&
-@@ -143,6 +150,7 @@
- # endif
- ADJUST_DYN_INFO (DT_JMPREL);
- ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
-+ ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_VTRELOC));
- ADJUST_DYN_INFO (DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM);
- # undef ADJUST_DYN_INFO
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/elf.h glibc-2.6.1/elf/elf.h
---- pristine-glibc-2.6.1/elf/elf.h 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/elf.h 2008-01-09 16:43:02.000000000 +0000
-@@ -518,6 +518,22 @@
- Elf64_Sxword r_addend; /* Addend */
- } Elf64_Rela;
-
-+/* VTable relocation entry */
-+
-+typedef struct
-+{
-+ Elf32_Addr r_src; /* source address */
-+ Elf32_Addr r_dest; /* destination address */
-+ Elf32_Word r_mask; /* copy bit-mask */
-+} Elf32_VtReloc;
-+
-+typedef struct
-+{
-+ Elf64_Addr r_src; /* source address */
-+ Elf64_Addr r_dest; /* destination address */
-+ Elf64_Word r_mask; /* copy bit-mask */
-+} Elf64_VtReloc;
-+
- /* How to extract and insert information held in the r_info field. */
-
- #define ELF32_R_SYM(val) ((val) >> 8)
-@@ -734,6 +750,14 @@
- #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
- #define DT_VERSIONTAGNUM 16
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-+
- /* Sun added these machine-independent extensions in the "processor-specific"
- range. Be compatible. */
- #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/include/link.h glibc-2.6.1/include/link.h
---- pristine-glibc-2.6.1/include/link.h 2007-08-03 14:57:06.000000000 +0100
-+++ glibc-2.6.1/include/link.h 2008-01-09 16:43:02.000000000 +0000
-@@ -121,7 +121,7 @@
- are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
-
- ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
-- + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
-+ + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
- const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
- ElfW(Addr) l_entry; /* Entry point location. */
- ElfW(Half) l_phnum; /* Number of program header entries. */
diff --git a/patches/test/glibc-vt-reloc.diff b/patches/test/glibc-vt-reloc.diff
deleted file mode 100644
index 0af11ba08..000000000
--- a/patches/test/glibc-vt-reloc.diff
+++ /dev/null
@@ -1,223 +0,0 @@
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' /usr/src/packages/BUILD/glibc-2.6.1/elf/dl-load.c glibc-2.6.1/elf/dl-load.c
---- glibc-2.6.1/elf/dl-load.c 2008-01-08 20:45:11.000000000 +0000el
-+++ glibc-2.6.1/elf/dl-load.c 2008-01-11 15:23:16.000000000 +0000
-@@ -1200,9 +1200,13 @@
-
- /* Remember which part of the address space this object uses. */
- l->l_map_start = (ElfW(Addr)) __mmap ((void *) mappref, maplength,
-- c->prot,
-+ c->prot | PROT_WRITE,
- MAP_COPY|MAP_FILE,
- fd, c->mapoff);
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_RELOC)
-+ _dl_debug_printf ("map '%s' at 0x%x prot 0x%x\n", l->l_name,
-+ l->l_map_start, c->prot);
-+
- if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
- {
- map_error:
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-2.6.1/elf/dl-reloc.c glibc-2.6.1/elf/dl-reloc.c
---- glibc-2.6.1/elf/dl-reloc.c 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/dl-reloc.c 2008-01-14 10:33:11.000000000 +0000
-@@ -27,6 +27,9 @@
- #include <sys/types.h>
- #include "dynamic-link.h"
-
-+#define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+
- /* Statistics function. */
- #ifdef SHARED
- # define bump_num_cache_relocations() ++GL(dl_num_cache_relocations)
-@@ -133,6 +136,68 @@
- '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
- }
-
-+/* process vtable / block copy relocations */
-+static void
-+_dl_perform_vtrelocs (struct link_map *map, struct r_scope_elem *scope[])
-+{
-+ ElfW(VtReloc) *rel;
-+ int debug_output = GLRO(dl_debug_mask) & DL_DEBUG_RELOC;
-+ int i;
-+
-+ if (debug_output)
-+ _dl_debug_printf ("new vtcopy-reloc processing on '%s' offset 0x%x map 0x%x\n",
-+ map->l_name[0] ? map->l_name : rtld_progname,
-+ map->l_addr, map->l_map_start);
-+
-+ /* any vtrelocs ? */
-+ if (map->l_info[SUSEIDX(DT_SUSE_VTRELOC)] == NULL)
-+ {
-+ if (debug_output)
-+ _dl_debug_printf ("no vtreloc section in '%s'\n", map->l_name);
-+ return;
-+ }
-+ rel = (ElfW(VtReloc) *)(D_PTR (map, l_info[SUSEIDX(DT_SUSE_VTRELOC)]));
-+ if (debug_output)
-+ _dl_debug_printf ("vtreloc section found in '%s' at 0x%x (0x%x) mapped at 0x%x\n",
-+ map->l_name, rel, ((ElfW(Addr))rel - map->l_addr),
-+ map->l_addr);
-+ while (rel->r_src != 0)
-+ {
-+ ElfW(Addr) **src, **dest;
-+ ElfW(Word) mask;
-+
-+ src = (void *)rel->r_src;
-+ dest = (void *)rel->r_dest;
-+ if (debug_output)
-+ _dl_debug_printf ("copy from 0x%x to 0x%x mask 0x%x\n", src, dest, rel->r_mask);
-+
-+ for (mask = rel->r_mask; mask; mask >>= 1)
-+ {
-+/* _dl_debug_printf ("%s copy [&0x%x -> &0x%x]\n",
-+ mask & 1 ? "do" : "no", src, dest); */
-+ if (mask & 1)
-+ {
-+ if (debug_output || !(*src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef))
-+ {
-+ _dl_debug_printf ("do copy 0x%x to 0x%x %s [&0x%x -> &0x%x]\n",
-+ *src, *dest,
-+ *src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef ? "match" : "Bug",
-+ src, dest);
-+ }
-+ *dest = *src;
-+
-+ }
-+ else if (debug_output)
-+ _dl_debug_printf ("no copy 0x%x to 0x%x %s\n",
-+ *src, *dest, *src == *dest && (int)*src > 0x100 ? "Bug" : "skip");
-+ dest++; src++;
-+ }
-+
-+ if (debug_output)
-+ _dl_debug_printf ("move to next vtrel entry\n");
-+ rel++;
-+ }
-+}
-
- void
- _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
-@@ -174,11 +239,15 @@
- /* DT_TEXTREL is now in level 2 and might phase out at some time.
- But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
- testing easier and therefore it will be available at all time. */
-- if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
-+ if (1) //__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
- {
- /* Bletch. We must make read-only segments writable
- long enough to relocate them. */
- const ElfW(Phdr) *ph;
-+
-+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
-+ _dl_debug_printf ("un-protecting foo\n");
-+
- for (ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
- if (ph->p_type == PT_LOAD && (ph->p_flags & PF_W) == 0)
- {
-@@ -293,9 +362,12 @@
- #endif
- }
-
-+ _dl_perform_vtrelocs (l, scope);
-+
- /* Mark the object so we know this work has been done. */
- l->l_relocated = 1;
-
-+#if 0
- /* Undo the segment protection changes. */
- while (__builtin_expect (textrels != NULL, 0))
- {
-@@ -307,6 +379,7 @@
-
- textrels = textrels->next;
- }
-+#endif
-
- /* In case we can protect the data now that the relocations are
- done, do it. */
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-2.6.1/elf/dynamic-link.h glibc-2.6.1/elf/dynamic-link.h
---- glibc-2.6.1/elf/dynamic-link.h 2006-07-10 22:52:18.000000000 +0100
-+++ glibc-2.6.1/elf/dynamic-link.h 2008-01-10 18:08:21.000000000 +0000
-@@ -65,6 +65,10 @@
- #ifndef VERSYMIDX
- # define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
- #endif
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-
-
- /* Read the dynamic section at DYN and fill in INFO with indices DT_*. */
-@@ -88,6 +92,9 @@
-
- while (dyn->d_tag != DT_NULL)
- {
-+ if (dyn->d_tag >= DT_SUSE_LO &&
-+ dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
-+ info[SUSEIDX(dyn->d_tag)] = dyn;
- if (dyn->d_tag < DT_NUM)
- info[dyn->d_tag] = dyn;
- else if (dyn->d_tag >= DT_LOPROC &&
-@@ -143,6 +150,7 @@
- # endif
- ADJUST_DYN_INFO (DT_JMPREL);
- ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
-+ ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_VTRELOC));
- ADJUST_DYN_INFO (DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM);
- # undef ADJUST_DYN_INFO
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-2.6.1/elf/elf.h glibc-2.6.1/elf/elf.h
---- glibc-2.6.1/elf/elf.h 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/elf.h 2008-01-09 16:43:02.000000000 +0000
-@@ -518,6 +518,22 @@
- Elf64_Sxword r_addend; /* Addend */
- } Elf64_Rela;
-
-+/* VTable relocation entry */
-+
-+typedef struct
-+{
-+ Elf32_Addr r_src; /* source address */
-+ Elf32_Addr r_dest; /* destination address */
-+ Elf32_Word r_mask; /* copy bit-mask */
-+} Elf32_VtReloc;
-+
-+typedef struct
-+{
-+ Elf64_Addr r_src; /* source address */
-+ Elf64_Addr r_dest; /* destination address */
-+ Elf64_Word r_mask; /* copy bit-mask */
-+} Elf64_VtReloc;
-+
- /* How to extract and insert information held in the r_info field. */
-
- #define ELF32_R_SYM(val) ((val) >> 8)
-@@ -734,6 +750,14 @@
- #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
- #define DT_VERSIONTAGNUM 16
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-+
- /* Sun added these machine-independent extensions in the "processor-specific"
- range. Be compatible. */
- #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
-diff -u -r -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' glibc-2.6.1/include/link.h glibc-2.6.1/include/link.h
---- glibc-2.6.1/include/link.h 2007-08-03 14:57:06.000000000 +0100
-+++ glibc-2.6.1/include/link.h 2008-01-09 16:43:02.000000000 +0000
-@@ -121,7 +121,7 @@
- are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
-
- ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
-- + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
-+ + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
- const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
- ElfW(Addr) l_entry; /* Entry point location. */
- ElfW(Half) l_phnum; /* Number of program header entries. */
diff --git a/patches/test/gui-control-layout.diff b/patches/test/gui-control-layout.diff
deleted file mode 100644
index 221d7fdf8..000000000
--- a/patches/test/gui-control-layout.diff
+++ /dev/null
@@ -1,177 +0,0 @@
-Index: vcl/inc/button.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/button.hxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 button.hxx
---- vcl/inc/button.hxx 17 Apr 2003 17:55:12 -0000 1.8
-+++ vcl/inc/button.hxx 18 Jul 2003 16:25:05 -0000
-@@ -183,6 +183,7 @@ public:
- virtual void UserDraw( const UserDrawEvent& rUDEvt );
-
- virtual void Toggle();
-+ virtual void VtkRequestSize( Size &rSize );
-
- void SetImage( const Image& rImage );
- const Image& GetImage() const { return maImage; }
-@@ -378,6 +379,7 @@ public:
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
-
- virtual void Toggle();
-+ virtual void VtkRequestSize( Size &rSize );
-
- BOOL IsStateChanged() const { return mbStateChanged; }
-
-@@ -467,6 +469,7 @@ public:
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
-
- virtual void Toggle();
-+ virtual void VtkRequestSize( Size &rSize );
-
- void SetState( TriState eState );
- TriState GetState() const { return meState; }
-Index: vcl/inc/combobox.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/combobox.hxx,v
-retrieving revision 1.12
-diff -u -p -u -r1.12 combobox.hxx
---- vcl/inc/combobox.hxx 11 Apr 2003 17:24:42 -0000 1.12
-+++ vcl/inc/combobox.hxx 18 Jul 2003 16:25:05 -0000
-@@ -140,6 +140,7 @@ public:
- virtual void DoubleClick();
-
- virtual void Modify();
-+ virtual void VtkRequestSize( Size &rSize );
-
- virtual const Wallpaper& GetDisplayBackground() const;
-
-Index: vcl/inc/edit.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/edit.hxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 edit.hxx
---- vcl/inc/edit.hxx 27 Mar 2003 17:57:20 -0000 1.11
-+++ vcl/inc/edit.hxx 18 Jul 2003 16:25:05 -0000
-@@ -211,6 +211,7 @@ public:
-
- virtual void Modify();
- virtual void UpdateData();
-+ virtual void VtkRequestSize( Size &rSize );
-
- static BOOL IsCharInput( const KeyEvent& rKEvt );
-
-Index: vcl/inc/fixed.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/fixed.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 fixed.hxx
---- vcl/inc/fixed.hxx 29 Apr 2002 17:46:17 -0000 1.5
-+++ vcl/inc/fixed.hxx 18 Jul 2003 16:25:05 -0000
-@@ -106,6 +106,7 @@ public:
- virtual void Resize();
- virtual void StateChanged( StateChangedType nType );
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
-+ virtual void VtkRequestSize( Size &rSize );
-
- Size CalcMinimumSize( long nMaxWidth = 0 ) const;
- };
-Index: vcl/source/control/button.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/control/button.cxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 button.cxx
---- vcl/source/control/button.cxx 17 Apr 2003 17:55:28 -0000 1.21
-+++ vcl/source/control/button.cxx 18 Jul 2003 16:25:06 -0000
-@@ -1370,6 +1375,11 @@ void PushButton::EndSelection()
-
- // -----------------------------------------------------------------------
-
-+void PushButton::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize( 0 );
-+}
-+
- Size PushButton::CalcMinimumSize( long nMaxWidth ) const
- {
- Size aSize;
-@@ -2514,6 +2524,11 @@ Image RadioButton::GetRadioImage( const
-
- // -----------------------------------------------------------------------
-
-+void RadioButton::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize( 0 );
-+}
-+
- Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
- {
- Size aSize;
-@@ -3241,6 +3256,11 @@ Image CheckBox::GetCheckImage( const All
- }
-
- // -----------------------------------------------------------------------
-+
-+void CheckBox::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize( 0 );
-+}
-
- Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
- {
-Index: vcl/source/control/combobox.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/control/combobox.cxx,v
-retrieving revision 1.25
-diff -u -p -u -r1.25 combobox.cxx
---- vcl/source/control/combobox.cxx 12 Jun 2003 08:18:32 -0000 1.25
-+++ vcl/source/control/combobox.cxx 18 Jul 2003 16:25:07 -0000
-@@ -1048,6 +1048,11 @@ long ComboBox::CalcWindowSizePixel( USHO
-
- // -----------------------------------------------------------------------
-
-+void ComboBox::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize();
-+}
-+
- Size ComboBox::CalcMinimumSize() const
- {
- Size aSz;
-Index: vcl/source/control/edit.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/control/edit.cxx,v
-retrieving revision 1.59
-diff -u -p -u -r1.59 edit.cxx
---- vcl/source/control/edit.cxx 12 Jun 2003 08:18:42 -0000 1.59
-+++ vcl/source/control/edit.cxx 18 Jul 2003 16:25:08 -0000
-@@ -2379,6 +2379,11 @@ void Edit::SetSubEdit( Edit* pEdit )
-
- // -----------------------------------------------------------------------
-
-+void Edit::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize();
-+}
-+
- Size Edit::CalcMinimumSize() const
- {
- Size aSz( GetTextWidth( GetText() ), GetTextHeight() );
-Index: vcl/source/control/fixed.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/control/fixed.cxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 fixed.cxx
---- vcl/source/control/fixed.cxx 17 Oct 2002 14:47:00 -0000 1.10
-+++ vcl/source/control/fixed.cxx 18 Jul 2003 16:25:08 -0000
-@@ -412,6 +414,12 @@ void FixedText::DataChanged( const DataC
- }
-
- // -----------------------------------------------------------------------
-+
-+
-+void FixedText::VtkRequestSize( Size &rSize )
-+{
-+ rSize = CalcMinimumSize( 0 );
-+}
-
- Size FixedText::CalcMinimumSize( long nMaxWidth ) const
- {
diff --git a/patches/test/gui-disable-spellcheck-all-langs.diff b/patches/test/gui-disable-spellcheck-all-langs.diff
deleted file mode 100644
index a38caad7c..000000000
--- a/patches/test/gui-disable-spellcheck-all-langs.diff
+++ /dev/null
@@ -1,103 +0,0 @@
---- svx/source/options/optlingu.orig 2004-04-16 10:59:10.183356464 -0400
-+++ svx/source/options/optlingu.cxx 2004-04-16 11:03:21.387511428 -0400
-@@ -1611,12 +1611,19 @@
- pModel->Insert( pEntry );
- lcl_SetCheckButton( pEntry, bVal );
-
-+// Users often check this item, which makes lingucomponent use
-+// horrendous amounts of memory because all dictionaries are loaded.
-+// To make people not quite so lazy, force them to check _only_ the
-+// languages they really use by not providing this option. This may
-+// not work if users already checked this button in previous versions.
-+#if 0
- pEntry = CreateEntry( sAllLanguages, CBCOL_FIRST );
- aLngCfg.GetProperty( C2U(UPN_IS_SPELL_IN_ALL_LANGUAGES) ) >>= bVal;
- nUserData = OptionsUserData( EID_ALL_LANGUAGES, FALSE, 0, TRUE, bVal).GetUserData();
- pEntry->SetUserData( (void *)nUserData );
- pModel->Insert( pEntry );
- lcl_SetCheckButton( pEntry, bVal );
-+#endif
-
- pEntry = CreateEntry( sSpellAuto, CBCOL_FIRST );
- aLngCfg.GetProperty( C2U(UPN_IS_SPELL_AUTO) ) >>= bVal;
---- svtools/source/misc/lingucfg.cxx.orig 2003-03-27 09:39:15.000000000 -0500
-+++ svtools/source/misc/lingucfg.cxx 2004-04-18 20:19:24.423383758 -0400
-@@ -323,7 +323,7 @@
- const INT16 *pnVal = 0;
- const BOOL *pbVal = 0;
-
-- const SvtLinguOptions &rOpt = ((const SvtLinguConfig *) this)->aOpt;
-+ SvtLinguOptions &rOpt = ((SvtLinguConfig *) this)->aOpt;
- switch (nPropertyHandle)
- {
- case UPH_IS_GERMAN_PRE_REFORM : pbVal = &rOpt.bIsGermanPreReform; break;
-@@ -333,7 +333,15 @@
- case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break;
- case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break;
- case UPH_IS_SPELL_HIDE : pbVal = &rOpt.bIsSpellHideMarkings; break;
-- case UPH_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &rOpt.bIsSpellInAllLanguages; break;
-+ case UPH_IS_SPELL_IN_ALL_LANGUAGES :
-+ {
-+ // Disable spell checking in all languages
-+ // since enabling too many dictionaries takes
-+ // up huge amounts of memory
-+ rOpt.bIsSpellInAllLanguages = FALSE;
-+ pbVal = &rOpt.bIsSpellInAllLanguages;
-+ break;
-+ }
- case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break;
- case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break;
- case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break;
-@@ -409,7 +417,15 @@
- case UPH_IS_HYPH_SPECIAL : pbVal = &aOpt.bIsHyphSpecial; break;
- case UPH_IS_SPELL_AUTO : pbVal = &aOpt.bIsSpellAuto; break;
- case UPH_IS_SPELL_HIDE : pbVal = &aOpt.bIsSpellHideMarkings; break;
-- case UPH_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &aOpt.bIsSpellInAllLanguages; break;
-+ case UPH_IS_SPELL_IN_ALL_LANGUAGES :
-+ {
-+ // Disable spell checking in all languages
-+ // since enabling too man dictionaries uses
-+ // huge amounts of memory
-+ aOpt.bIsSpellInAllLanguages = FALSE;
-+ pbVal = NULL;
-+ break;
-+ }
- case UPH_IS_SPELL_SPECIAL : pbVal = &aOpt.bIsSpellSpecial; break;
- case UPH_IS_WRAP_REVERSE : pbVal = &aOpt.bIsSpellReverse; break;
- case UPH_DEFAULT_LANGUAGE : pnVal = &aOpt.nDefaultLanguage; break;
---- linguistic/source/lngopt.cxx.orig 2004-04-18 21:17:31.041707927 -0400
-+++ linguistic/source/lngopt.cxx 2004-04-18 18:49:16.000000000 -0400
-@@ -187,7 +193,15 @@
- case WID_IS_HYPH_SPECIAL : pbVal = &pData->bIsHyphSpecial; break;
- case WID_IS_SPELL_AUTO : pbVal = &pData->bIsSpellAuto; break;
- case WID_IS_SPELL_HIDE : pbVal = &pData->bIsSpellHideMarkings; break;
-- case WID_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &pData->bIsSpellInAllLanguages; break;
-+ case WID_IS_SPELL_IN_ALL_LANGUAGES :
-+ {
-+ // Disable spell checking in all languages
-+ // since enabling too many dictionaries takes
-+ // up huge amounts of memory.
-+ pData->bIsSpellInAllLanguages = FALSE;
-+ pbVal = NULL;
-+ break;
-+ }
- case WID_IS_SPELL_SPECIAL : pbVal = &pData->bIsSpellSpecial; break;
- case WID_IS_WRAP_REVERSE : pbVal = &pData->bIsSpellReverse; break;
- case WID_DEFAULT_LANGUAGE : pnVal = &pData->nDefaultLanguage; break;
-@@ -264,7 +284,15 @@
- case WID_IS_HYPH_SPECIAL : pbVal = &pData->bIsHyphSpecial; break;
- case WID_IS_SPELL_AUTO : pbVal = &pData->bIsSpellAuto; break;
- case WID_IS_SPELL_HIDE : pbVal = &pData->bIsSpellHideMarkings; break;
-- case WID_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &pData->bIsSpellInAllLanguages; break;
-+ case WID_IS_SPELL_IN_ALL_LANGUAGES :
-+ {
-+ // Disable spell checking in all languages
-+ // since enabling too many dictionaries
-+ // uses too much memory
-+ pData->bIsSpellInAllLanguages = FALSE;
-+ pbVal = &pData->bIsSpellInAllLanguages;
-+ break;
-+ }
- case WID_IS_SPELL_SPECIAL : pbVal = &pData->bIsSpellSpecial; break;
- case WID_IS_WRAP_REVERSE : pbVal = &pData->bIsSpellReverse; break;
- case WID_DEFAULT_LANGUAGE : pnVal = &pData->nDefaultLanguage; break;
diff --git a/patches/test/gui-window-layout.diff b/patches/test/gui-window-layout.diff
deleted file mode 100644
index fd0bafc23..000000000
--- a/patches/test/gui-window-layout.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-Index: vcl/inc/window.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/window.hxx,v
-retrieving revision 1.47
-diff -u -p -u -r1.47 window.hxx
---- vcl/inc/window.hxx 24 Apr 2003 16:30:42 -0000 1.47
-+++ vcl/inc/window.hxx 27 Jun 2003 08:11:20 -0000
-@@ -530,6 +530,8 @@ public:
- virtual long PreNotify( NotifyEvent& rNEvt );
- virtual long Notify( NotifyEvent& rNEvt );
- virtual Window* GetPreferredKeyInputWindow();
-+ virtual void VtkAllocateSize( const Size &aSize );
-+ virtual void VtkRequestSize( Size &rSize );
-
- /*virtual*/ void AddEventListener( const Link& rEventListener );
- /*virtual*/ void RemoveEventListener( const Link& rEventListener );
-Index: vcl/source/window/window.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/window.cxx,v
-retrieving revision 1.174
-diff -u -p -u -r1.174 window.cxx
---- vcl/source/window/window.cxx 12 Jun 2003 07:51:56 -0000 1.174
-+++ vcl/source/window/window.cxx 27 Jun 2003 08:11:23 -0000
-@@ -8776,3 +8781,11 @@ LanguageType Window::GetInputLanguage()
- return mpFrame->GetInputLanguage();
- }
-
-+
-+void Window::VtkAllocateSize( const Size &aSize )
-+{
-+}
-+
-+void Window::VtkRequestSize( Size &rSize )
-+{
-+}
diff --git a/patches/test/layout-ids.diff b/patches/test/layout-ids.diff
deleted file mode 100644
index b62bef615..000000000
--- a/patches/test/layout-ids.diff
+++ /dev/null
@@ -1,67 +0,0 @@
-Index: tools/inc/rcid.h
-===================================================================
-RCS file: /cvs/util/tools/inc/rcid.h,v
-retrieving revision 1.1.1.1
-diff -u -p -u -r1.1.1.1 rcid.h
---- tools/inc/rcid.h 18 Sep 2000 17:03:02 -0000 1.1.1.1
-+++ tools/inc/rcid.h 26 Aug 2003 14:00:27 -0000
-@@ -159,6 +159,18 @@
- #define RSC_TREELISTBOX (RSC_NOTYPE + 0x78)
- #define RSC_STRINGARRAY (RSC_NOTYPE + 0x79)
-
-+#define RSC_LAYOUT (RSC_NOTYPE + 0x80)
-+# define RSC_LAYOUT_CONTAINER (RSC_NOTYPE + 0x81)
-+# define RSC_LAYOUT_BIN (RSC_NOTYPE + 0x82)
-+# define RSC_LAYOUT_WINDOW (RSC_NOTYPE + 0x83)
-+# define RSC_LAYOUT_ALIGNMENT (RSC_NOTYPE + 0x84)
-+# define RSC_LAYOUT_BOX (RSC_NOTYPE + 0x85)
-+# define RSC_LAYOUT_HBOX (RSC_NOTYPE + 0x86)
-+# define RSC_LAYOUT_VBOX (RSC_NOTYPE + 0x87)
-+# define RSC_LAYOUT_TABLE (RSC_NOTYPE + 0x88)
-+// ...
-+#define RSC_LAYOUT_LAST (RSC_NOTYPE + 0x90)
-+
- // (RSC_NOTYPE + 0x200) - (RSC_NOTYPE + 0x300) fuer Sfx reserviert
-
- #define RT_SYS_BITMAP (RSC_NOTYPE + 0xf2)
-Index: tools/inc/rc.h
-===================================================================
-RCS file: /cvs/util/tools/inc/rc.h,v
-retrieving revision 1.1.1.1
-diff -u -p -u -r1.1.1.1 rc.h
---- tools/inc/rc.h 18 Sep 2000 17:03:02 -0000 1.1.1.1
-+++ tools/inc/rc.h 26 Aug 2003 14:18:07 -0000
-@@ -85,6 +85,7 @@ typedef short RSWND_STYLE;
- #define WINDOW_QUICKTEXT 0x0200
- #define WINDOW_EXTRALONG 0x0800
- #define WINDOW_UNIQUEID 0x1000
-+#define WINDOW_LAYOUT 0x2000
-
- // Definition der Struktur die alle "WorkWindow"-Resourcen haben
- #define WORKWIN_SHOWNORMAL 0
-@@ -241,6 +242,25 @@ typedef short RSWND_STYLE;
- #define RSC_IMAGELIST_IDLIST 0x08
- #define RSC_IMAGELIST_IDCOUNT 0x10
-
-+// Definitions for layout widgets
-+#define RSC_LAYOUT_PEER 0x01
-+#define RSC_LAYOUT_BORDER 0x02
-+#define RSC_LAYOUT_HOMOGENEOUS 0x04
-+// Child properties - no good soln' here so far
-+// box:
-+#define RSC_LAYOUT_CHILD_EXPAND 0x10
-+#define RSC_LAYOUT_CHILD_FILL 0x20
-+#define RSC_LAYOUT_CHILD_PADDING 0x40
-+#define RSC_LAYOUT_CHILD_PACK_END 0x80
-+// table:
-+#define RSC_LAYOUT_CHILD_OPTIONS 0x100
-+
-+// Alignment
-+#define RSC_LAYOUT_ALIGNMENT_ALIGN 0x01
-+#define RSC_LAYOUT_ALIGNMENT_SCALE 0x02
-+// Table
-+#define RSC_LAYOUT_TABLE_ROW_SPACE 0x01
-+#define RSC_LAYOUT_TABLE_COL_SPACE 0x02
-
- // obsolete, should be removed by MM
- #define RSC_COLOR (RSC_NOTYPE + 0x16)
diff --git a/patches/test/layout-rsc.diff b/patches/test/layout-rsc.diff
deleted file mode 100644
index 97709edd0..000000000
--- a/patches/test/layout-rsc.diff
+++ /dev/null
@@ -1,221 +0,0 @@
-? rsc/.2.html
-? rsc/doc++
-? rsc/rsc-list
-? rsc/rscJbgiwe
-? rsc/test.cxx
-? rsc/test.hxx
-? rsc/test.rc
-? rsc/test.src
-? rsc/test2.rc
-? rsc/test2.src
-? rsc/inc/rsclayout.hxx
-? rsc/source/res/rsclayout.cxx
-Index: rsc/inc/rscdb.hxx
-===================================================================
-RCS file: /cvs/gsl/rsc/inc/rscdb.hxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 rscdb.hxx
---- rsc/inc/rscdb.hxx 2 Jul 2002 14:25:56 -0000 1.8
-+++ rsc/inc/rscdb.hxx 26 Aug 2003 14:48:26 -0000
-@@ -226,6 +226,8 @@ class RscTypCont
- RscTop * pClassColor );
- RscTop * InitClassImageList( RscTop * pSuper, RscTop *pClassBitmap,
- RscTop * pClassColor );
-+
-+ RscTop * InitClassLayout( RscTop * pSuper );
- RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
- RscArray * pLangGeo );
- RscTop * InitClassSystemWindow( RscTop * pSuper );
-Index: rsc/inc/rsctop.hxx
-===================================================================
-RCS file: /cvs/gsl/rsc/inc/rsctop.hxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 rsctop.hxx
---- rsc/inc/rsctop.hxx 10 Oct 2001 11:51:13 -0000 1.2
-+++ rsc/inc/rsctop.hxx 26 Aug 2003 14:48:26 -0000
-@@ -73,6 +73,9 @@
- #ifndef _RSCCLOBJ_HXX
- #include <rscclobj.hxx>
- #endif
-+#ifndef _TOOLS_RCID_H
-+#include <tools/rcid.h>
-+#endif
-
- /****************** T Y P E S ********************************************/
- typedef short RSCVAR;
-@@ -112,6 +115,9 @@ public:
- USHORT GetTypId() const
- { return nTypId; };
- // Gibt die Oberklasse zurueck
-+ BOOL IsLayout() { return ( GetTypId() >= RSC_LAYOUT &&
-+ GetTypId() <= RSC_LAYOUT_LAST ); }
-+
- BOOL InHierarchy( RscTop * pClass );
- BOOL IsCodeWriteable() const
- {
-Index: rsc/source/parser/erscerr.cxx
-===================================================================
-RCS file: /cvs/gsl/rsc/source/parser/erscerr.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 erscerr.cxx
---- rsc/source/parser/erscerr.cxx 7 Nov 2001 16:51:18 -0000 1.6
-+++ rsc/source/parser/erscerr.cxx 26 Aug 2003 14:48:26 -0000
-@@ -464,7 +464,7 @@ void RscError::ErrorFormat( const ERRTYP
- StdLstErr( "\n" );
- }
- StdLstErr( "f" );
-- sprintf( buf, "%u", (USHORT)rError );
-+ sprintf( buf, "0x%x", (USHORT)rError );
- StdLstErr( buf );
-
- if( pFI && pTC ){
-Index: rsc/source/parser/rscicpx.cxx
-===================================================================
-RCS file: /cvs/gsl/rsc/source/parser/rscicpx.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 rscicpx.cxx
---- rsc/source/parser/rscicpx.cxx 26 Mar 2003 15:50:46 -0000 1.6
-+++ rsc/source/parser/rscicpx.cxx 26 Aug 2003 14:48:28 -0000
-@@ -281,6 +281,71 @@ RscTop * RscTypCont::InitClassImageList(
- return( pClassImageList );
- }
-
-+RscTop * RscTypCont::InitClassLayout( RscTop * pSuper )
-+{
-+ HASHID nId;
-+ RscTop *pClassLayout;
-+
-+ // Layout
-+ nId = pHS->Insert( "Layout" );
-+ pClassLayout = new RscClass( nId, RSC_LAYOUT, pSuper );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayout );
-+
-+ nId = aNmTb.Put( "PeerId", VARNAME );
-+ pClassLayout->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, RSC_LAYOUT_PEER );
-+ nId = aNmTb.Put( "Border", VARNAME );
-+ pClassLayout->SetVariable( nId, &aShort, NULL, 0, RSC_LAYOUT_BORDER );
-+ nId = aNmTb.Put( "Homogeneous", VARNAME );
-+ pClassLayout->SetVariable( nId, &aBool, NULL, 0, RSC_LAYOUT_HOMOGENEOUS );
-+
-+ // Not a very satisfactory way to do child properties:
-+ nId = aNmTb.Put( "Expand", VARNAME );
-+ pClassLayout->SetVariable( nId, &aBool, NULL, 0, RSC_LAYOUT_CHILD_EXPAND );
-+ nId = aNmTb.Put( "Fill", VARNAME );
-+ pClassLayout->SetVariable( nId, &aBool, NULL, 0, RSC_LAYOUT_CHILD_FILL );
-+ nId = aNmTb.Put( "Padding", VARNAME );
-+ pClassLayout->SetVariable( nId, &aShort, NULL, 0, RSC_LAYOUT_CHILD_PADDING );
-+ nId = aNmTb.Put( "PackEnd", VARNAME );
-+ pClassLayout->SetVariable( nId, &aBool, NULL, 0, RSC_LAYOUT_CHILD_PACK_END );
-+
-+ // FIXME: table options - need a flag per option... - or more complexity.
-+ pRoot->Insert( pClassLayout );
-+
-+ // LayoutBin
-+ RscTop *pClassLayoutBin;
-+ nId = pHS->Insert( "LayoutBin" );
-+ pClassLayoutBin = new RscClass( nId, RSC_LAYOUT_BIN, pClassLayout );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayoutBin );
-+
-+ // LayoutAlignment
-+ RscTop *pClassLayoutAlign;
-+ nId = pHS->Insert( "LayoutAlignment" );
-+ pClassLayoutAlign = new RscClass( nId, RSC_LAYOUT_ALIGNMENT, pClassLayoutBin );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayoutAlign );
-+
-+ // FIXME: need a flag per option, and a floating point type [!]
-+
-+ // LayoutBox
-+ RscTop *pClassLayoutBox;
-+ nId = pHS->Insert( "LayoutBox" );
-+ pClassLayoutBox = new RscClass( nId, RSC_LAYOUT_BOX, pClassLayout );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayoutBox );
-+
-+ // LayoutHBox
-+ RscTop *pClassLayoutHBox;
-+ nId = pHS->Insert( "LayoutHBox" );
-+ pClassLayoutHBox = new RscClass( nId, RSC_LAYOUT_HBOX, pClassLayoutBox );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayoutHBox );
-+
-+ // LayoutVBox
-+ RscTop *pClassLayoutVBox;
-+ nId = pHS->Insert( "LayoutVBox" );
-+ pClassLayoutVBox = new RscClass( nId, RSC_LAYOUT_VBOX, pClassLayoutBox );
-+ aNmTb.Put( nId, CLASSNAME, pClassLayoutVBox );
-+
-+ return pClassLayout;
-+}
-+
- /*************************************************************************
- |* RscTypCont::InitClassWindow()
- *************************************************************************/
-@@ -315,7 +380,7 @@ RscTop * RscTypCont::InitClassWindow( Rs
- // Variable einfuegen
- nVarId = aNmTb.Put( "_RscExtraFlags", VARNAME );
- pClassWindow->SetVariable( nVarId, pFlag, NULL,
-- VAR_HIDDEN | VAR_NOENUM );
-+ VAR_HIDDEN | VAR_NOENUM );
-
- aBaseLst.Insert(
- pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
-@@ -373,6 +438,8 @@ RscTop * RscTypCont::InitClassWindow( Rs
- pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_EXTRALONG );
- nId = aNmTb.Put( "UniqueId", VARNAME );
- pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_UNIQUEID );
-+ nId = aNmTb.Put( "LayoutId", VARNAME );
-+ pClassWindow->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, WINDOW_LAYOUT );
-
- return( pClassWindow );
- }
-Index: rsc/source/parser/rscinit.cxx
-===================================================================
-RCS file: /cvs/gsl/rsc/source/parser/rscinit.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 rscinit.cxx
---- rsc/source/parser/rscinit.cxx 2 Jul 2002 14:44:00 -0000 1.7
-+++ rsc/source/parser/rscinit.cxx 26 Aug 2003 14:48:28 -0000
-@@ -517,6 +517,8 @@ void RscTypCont::Init()
- pClassWindow = InitClassWindow( pClassMgr, pMapUnit,
- pLangGeometry );
- pRoot->Insert( pClassWindow );
-+
-+ InitClassLayout( pClassMgr );
- }
- {
-
-Index: rsc/source/res/rsccont.cxx
-===================================================================
-RCS file: /cvs/gsl/rsc/source/res/rsccont.cxx,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 rsccont.cxx
---- rsc/source/res/rsccont.cxx 10 Oct 2001 11:51:25 -0000 1.2
-+++ rsc/source/res/rsccont.cxx 26 Aug 2003 14:48:32 -0000
-@@ -292,14 +292,14 @@ RSCINST RscBaseCont::SearchEle( const RS
- |*
- *************************************************************************/
- ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName,
-- RscTop * pCreateClass,
-- const RSCINST & rCreateInst, RSCINST * pGetInst )
-+ RscTop * pCreateClass,
-+ const RSCINST & rCreateInst, RSCINST * pGetInst )
- {
- RscBaseContInst * pClassData;
- RSCINST aTmpI;
- ERRTYPE aError;
-
-- if( !bNoId && !rEleName.IsId() )
-+ if( !bNoId && !rEleName.IsId() && !pCreateClass->IsLayout() )
- aError = WRN_CONT_NOID;
- pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
-
-@@ -924,6 +924,11 @@ ERRTYPE RscBaseCont::ContWriteRc( const
- if( bExtra || bNoId )
- { // Nur Subresourcen schreiben, wenn bExtra == TRUE
- pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
-+
-+ if( rInst.pClass->IsLayout() ) {
-+ rMem.Put( (USHORT) 0x3c3e ); // helpful visible marker.
-+ rMem.Put( (USHORT) pClassData->nEntries );
-+ }
-
- for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ){
- aError = pClassData->pEntries[ i ].aInst.pClass->
diff --git a/patches/test/layout-test.diff b/patches/test/layout-test.diff
deleted file mode 100644
index 07be15fc8..000000000
--- a/patches/test/layout-test.diff
+++ /dev/null
@@ -1,143 +0,0 @@
-? svtools/workben/test.src.good
-? svtools/workben/workben..dpr
-Index: svtools/workben/makefile.mk
-===================================================================
-RCS file: /cvs/util/svtools/workben/makefile.mk,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 makefile.mk
---- svtools/workben/makefile.mk 1 Oct 2002 12:28:04 -0000 1.4
-+++ svtools/workben/makefile.mk 27 Aug 2003 12:16:28 -0000
-@@ -91,6 +91,11 @@ APP1STDLIBS= $(SVTOOLLIB) \
- APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND)
- APP1OBJS= $(OBJ)$/svdem.obj
-
-+SRC1FILES=test.src
-+SRS1NAME=test
-+RES1TARGET=test
-+SRS1FILES=$(SRS)$/test.srs
-+
-
- # --- Targets -------------------------------------------------------
-
-Index: svtools/workben/svdem.cxx
-===================================================================
-RCS file: /cvs/util/svtools/workben/svdem.cxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 svdem.cxx
---- svtools/workben/svdem.cxx 15 Jan 2002 17:25:59 -0000 1.3
-+++ svtools/workben/svdem.cxx 27 Aug 2003 12:16:28 -0000
-@@ -257,6 +257,22 @@ public:
-
- // -----------------------------------------------------------------------
-
-+class LayoutDlg : public ModalDialog
-+{
-+ PushButton aOk;
-+ PushButton aCancel;
-+ PushButton aSomething;
-+ public:
-+ LayoutDlg( Window *pParent) :
-+ ModalDialog( pParent, ResId( 1001 ) ),
-+ aOk ( this, ResId( 1002 ) ),
-+ aCancel ( this, ResId( 1003 ) ),
-+ aSomething ( this, ResId( 1004 ) )
-+ {
-+ FreeResource();
-+ }
-+};
-+
- void MyApp::Main()
- {
- try
-@@ -273,7 +289,13 @@ void MyApp::Main()
- Help::EnableExtHelp();
- Help::EnableBalloonHelp();
- Help::EnableQuickHelp();
--
-+
-+ ResMgr *pAppResMgr = new ResMgr( String( RTL_CONSTASCII_USTRINGPARAM( "test.res" ) ), NULL, NULL );
-+ Resource::SetResManager( pAppResMgr );
-+
-+ LayoutDlg aResWin( NULL );
-+ aResWin.Execute();
-+
- MyWin aMainWin( NULL, WinBits( WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) );
- aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "SVTOOLS - Workbench" ) ) );
- aMainWin.GrabFocus();
-Index: svtools/workben/test.src
-===================================================================
-RCS file: svtools/workben/test.src
-diff -N svtools/workben/test.src
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ svtools/workben/test.src 27 Aug 2003 12:16:28 -0000
-@@ -0,0 +1,55 @@
-+#define DLG_TEST 1001
-+#define BTN_OK 1002
-+#define BTN_CANCEL 1003
-+#define BTN_SOMETHING 1004
-+#define DLG_TEST_LAYOUT 1100
-+
-+ModalDialog DLG_TEST
-+{
-+ OutputSize = TRUE ;
-+ SVLook = TRUE;
-+ Moveable = TRUE ;
-+ Closeable = TRUE;
-+ Text = "Layout test dialog";
-+ Sizeable = TRUE;
-+ LayoutId = DLG_TEST_LAYOUT;
-+ Size = MAP_APPFONT(320, 50);
-+
-+ PushButton BTN_OK
-+ {
-+ Text = "Expand/Fill";
-+ };
-+ PushButton BTN_CANCEL
-+ {
-+ Text = "NoExpand";
-+ };
-+ PushButton BTN_SOMETHING
-+ {
-+ Text = "Expand/NoFill";
-+ Size = MAP_APPFONT(50, 50);
-+ Pos = MAP_APPFONT(100, 100);
-+ };
-+
-+ LayoutHBox DLG_TEST_LAYOUT {
-+ Homogeneous = False;
-+ Border = 4;
-+ Layout {
-+ PeerId = BTN_OK;
-+ Expand = True;
-+ Fill = True;
-+ Padding = 3;
-+ };
-+ Layout {
-+ PeerId = BTN_CANCEL;
-+ Expand = False;
-+ Fill = False;
-+ Padding = 1;
-+ };
-+ Layout {
-+ PeerId = BTN_SOMETHING;
-+ Expand = True;
-+ Fill = False;
-+ Padding = 0;
-+ };
-+ };
-+};
-Index: svtools/prj/d.lst
-===================================================================
-RCS file: /cvs/util/svtools/prj/d.lst,v
-retrieving revision 1.104
-diff -u -p -u -r1.104 d.lst
---- svtools/prj/d.lst 16 Jul 2003 18:11:00 -0000 1.104
-+++ svtools/prj/d.lst 27 Aug 2003 12:16:28 -0000
-@@ -27,6 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
- ..\%__SRC%\bin\svt?????.sym %_DEST%\bin%_EXT%\svt?????.sym
- ..\%__SRC%\bin\svl?????.dll %_DEST%\bin%_EXT%\svl?????.dll
- ..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.*
-+..\%__SRC%\bin\test.* %_DEST%\bin%_EXT%\test.*
- ..\%__SRC%\bin\bmpsum.* %_DEST%\bin%_EXT%\bmpsum.*
- ..\%__SRC%\bin\bmpgui.* %_DEST%\bin%_EXT%\bmpgui.*
- ..\%__SRC%\bin\g2g.* %_DEST%\bin%_EXT%\g2g.*
diff --git a/patches/test/layout-vcl-layout.diff b/patches/test/layout-vcl-layout.diff
deleted file mode 100644
index 44a4d3d08..000000000
--- a/patches/test/layout-vcl-layout.diff
+++ /dev/null
@@ -1,521 +0,0 @@
-Index: vcl/source/window/makefile.mk
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/makefile.mk,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 makefile.mk
---- vcl/source/window/makefile.mk 27 Mar 2003 17:58:22 -0000 1.10
-+++ vcl/source/window/makefile.mk 27 Aug 2003 12:18:43 -0000
-@@ -76,6 +76,7 @@ TARGET=win
- # --- Files --------------------------------------------------------
-
- SLOFILES= $(SLO)$/accel.obj \
-+ $(SLO)$/layout.obj \
- $(SLO)$/accmgr.obj \
- $(SLO)$/brdwin.obj \
- $(SLO)$/btndlg.obj \
-Index: vcl/source/window/layout.cxx
-===================================================================
-RCS file: vcl/source/window/layout.cxx
-diff -N vcl/source/window/layout.cxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ vcl/source/window/layout.cxx 27 Aug 2003 12:18:43 -0000
-@@ -0,0 +1,390 @@
-+#include <sal/macros.h>
-+#include <tools/rcid.h>
-+#include <tools/rc.h>
-+#include "layout.hxx"
-+
-+// --- LayoutConnector ---
-+
-+Layout *LayoutConnector::loadLayout()
-+{
-+ RSHEADER_TYPE *pHdr = (RSHEADER_TYPE *)m_pResMgr->GetClass();
-+ m_pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
-+
-+ fprintf( stderr, "Header: Id 0x%x type: %d, Glob: 0x%x, Local: 0x%x\n",
-+ pHdr->GetId(), pHdr->GetRT(), pHdr->GetGlobOff(), pHdr->GetLocalOff() );
-+
-+ Layout *pLayout = NULL;
-+
-+ switch( pHdr->GetRT() ) {
-+ case RSC_LAYOUT_BIN:
-+ case RSC_LAYOUT_BOX:
-+ fprintf( stderr, "Layout 0x%x is not instantiable\n", pHdr->GetRT() );
-+ break;
-+ case RSC_LAYOUT_HBOX:
-+ fprintf( stderr, "HBox Layout\n", pHdr->GetRT() );
-+ pLayout = new LayoutHBox();
-+ break;
-+ case RSC_LAYOUT_WINDOW:
-+ case RSC_LAYOUT_ALIGNMENT:
-+ case RSC_LAYOUT_VBOX:
-+ case RSC_LAYOUT_TABLE:
-+ fprintf( stderr, "Layout 0x%x not yet implemented\n", pHdr->GetRT() );
-+ break;
-+ case RSC_LAYOUT:
-+ fprintf( stderr, "Base Layout\n", pHdr->GetRT() );
-+ pLayout = new Layout();
-+ break;
-+ default:
-+ fprintf( stderr, "Layout 0x%x is unknown\n", pHdr->GetRT() );
-+ break;
-+ }
-+
-+ if( pLayout )
-+ pLayout->readRes( *this, m_pResMgr );
-+
-+ return pLayout;
-+}
-+LayoutConnector::LayoutConnector( Window *pWindow, ResMgr *pMgr,
-+ USHORT nId) :
-+ m_pTopWindow( pWindow )
-+{
-+ fprintf( stderr, "Window with a layout ! (0x%x)\n", nId );
-+
-+ ResId aLayout( nId, pMgr );
-+ aLayout.SetRT( RSC_LAYOUT_HBOX );
-+
-+ m_pResMgr = pMgr;
-+
-+ // Do the setup ...
-+ if( pMgr->GetResource( aLayout ) ) {
-+ m_pTopLayout = loadLayout();
-+ pMgr->PopContext();
-+ } else
-+ fprintf( stderr, "No such resource 0x%x\n", nId );
-+
-+ m_pResMgr = NULL;
-+}
-+void LayoutConnector::reconcile( Connection &pCnx)
-+{
-+ fprintf( stderr, "Reconcile mapping 0x%x\n", pCnx );
-+ pCnx.pLayout->setPeer( pCnx.pWindow );
-+ if( pCnx.pWindow->IsVisible() )
-+ fprintf( stderr, "FIXME: trigger re-layout\n" );
-+}
-+void LayoutConnector::addMap( USHORT nId, Layout *pLayout )
-+{
-+ std::list<Connection>::iterator aIter;
-+ for (aIter = m_aMap.begin(); aIter != m_aMap.end(); aIter++) {
-+ if( aIter->nId == nId ) {
-+ aIter->pLayout = pLayout;
-+ reconcile( *aIter );
-+ return;
-+ }
-+ }
-+ Connection aCnx = { nId, pLayout, NULL };
-+ m_aMap.push_back( aCnx );
-+}
-+void LayoutConnector::reconcileMap( USHORT nId, Window *pWindow )
-+{
-+ std::list<Connection>::iterator aIter;
-+ for (aIter = m_aMap.begin(); aIter != m_aMap.end(); aIter++) {
-+ if( aIter->nId == nId ) {
-+ aIter->pWindow = pWindow;
-+ reconcile( *aIter );
-+ return;
-+ }
-+ }
-+}
-+bool LayoutConnector::checkReconciled()
-+{
-+ bool bResult = true;
-+
-+ std::list<Connection>::iterator aIter;
-+ for (aIter = m_aMap.begin(); aIter != m_aMap.end(); aIter++) {
-+ if( !aIter->pWindow ) {
-+ fprintf( stderr, "Unreconciled id 0x%x -> %p\n",
-+ aIter->nId, aIter->pLayout );
-+ bResult = false;
-+ }
-+ }
-+
-+ return bResult;
-+}
-+
-+// --- Layout ---
-+
-+Layout::Layout() :
-+ m_pPeer( NULL ),
-+ m_aRequisition( 0, 0),
-+ m_nBorderWidth( 0 ),
-+ m_bHomogeneous( FALSE ),
-+ m_nPadding( 0 ),
-+ m_bExpand( 0 ),
-+ m_bFill( 0 ),
-+ m_bPackStart( TRUE )
-+{
-+}
-+Layout::~Layout()
-+{
-+}
-+void Layout::addChild( Layout *pLayout )
-+{
-+ fprintf( stderr, "Meaningless to add a child to base Layout\n");
-+}
-+void Layout::readRes( LayoutConnector &rCnx, ResMgr *pResMgr )
-+{
-+ USHORT nFlags;
-+ nFlags = pResMgr->ReadShort();
-+
-+ fprintf( stderr, "Flags: 0x%x\n", nFlags );
-+
-+ if( nFlags & RSC_LAYOUT_PEER ) {
-+ USHORT nPeer = pResMgr->ReadShort();
-+ fprintf( stderr, "Peer: 0x%x\n", nPeer );
-+ rCnx.addMap( nPeer, this );
-+ }
-+ if( nFlags & RSC_LAYOUT_BORDER)
-+ m_nBorderWidth = pResMgr->ReadShort();
-+ if( nFlags & RSC_LAYOUT_HOMOGENEOUS )
-+ m_bHomogeneous = TRUE;
-+ else
-+ m_bHomogeneous = FALSE;
-+
-+ if( nFlags & RSC_LAYOUT_CHILD_EXPAND )
-+ m_bExpand = TRUE;
-+ if( nFlags & RSC_LAYOUT_CHILD_FILL )
-+ m_bFill = TRUE;
-+ if( nFlags & RSC_LAYOUT_CHILD_PADDING )
-+ m_nPadding = pResMgr->ReadShort();
-+ if( nFlags & RSC_LAYOUT_CHILD_PACK_END )
-+ m_bPackStart = FALSE;
-+
-+ USHORT nMarker;
-+ while (( nMarker = pResMgr->ReadShort() ) != 0x3c3e )
-+ fprintf( stderr, " Skip strangeness 0x%x\n", nMarker); // FIXME: strange.
-+
-+ int nChildren = pResMgr->ReadShort();
-+ fprintf( stderr, "Layout has %d children\n", nChildren );
-+
-+ for( int i = 0; i < nChildren; i++ ){
-+ fprintf( stderr, "Load child %d\n", i);
-+ Layout *pChild;
-+
-+ if( ( pChild = rCnx.loadLayout() ) )
-+ addChild( pChild );
-+ }
-+}
-+void Layout::requestSize( Size &rSize )
-+{
-+ if( m_pPeer ) {
-+ m_pPeer->VtkRequestSize( rSize );
-+ // Size requesting doesn't seem too accurate
-+ rSize.Width() += 8;
-+ } else
-+ rSize = Size();
-+ fprintf( stderr, "Layout::RequestSize -> %d, %d [%p]\n",
-+ rSize.Width(), rSize.Height(), m_pPeer );
-+ m_aRequisition = rSize;
-+}
-+void Layout::allocateSize( const Point &rPoint,
-+ const Size &rSize )
-+{
-+ if( m_pPeer )
-+ m_pPeer->SetPosSizePixel( rPoint, rSize );
-+ fprintf( stderr, "Layout::allocateSize -> %d,%d (%d, %d) [%p]\n",
-+ rPoint.X(), rPoint.Y(), rSize.Width(), rSize.Height(),
-+ m_pPeer );
-+}
-+
-+// --- LayoutBin ---
-+
-+LayoutBin::LayoutBin() : Layout()
-+{
-+}
-+LayoutBin::~LayoutBin()
-+{
-+ if (m_pChild)
-+ delete m_pChild;
-+}
-+void LayoutBin::requestSize( Size &rSize )
-+{
-+ if( m_pChild )
-+ m_pChild->requestSize( rSize );
-+ else
-+ rSize = Size();
-+}
-+void LayoutBin::allocateSize( const Point &rPoint, const Size &rSize )
-+{
-+ if( m_pChild )
-+ m_pChild->allocateSize( rPoint, rSize );
-+}
-+
-+// --- LayoutBox ---
-+
-+LayoutBox::LayoutBox() :
-+ Layout(), m_nSpacing(0)
-+{
-+}
-+LayoutBox::~LayoutBox()
-+{
-+ std::list<BoxChild>::const_iterator aIter;
-+ for (aIter = m_aChildren.begin(); aIter != m_aChildren.end(); aIter++)
-+ delete aIter->pLayout;
-+}
-+void LayoutBox::addChild( Layout *pLayout )
-+{
-+ BoxChild aChild;
-+
-+ // this sucks ...
-+ aChild.pLayout = pLayout;
-+ aChild.nPadding = aChild.pLayout->m_nPadding;
-+ aChild.bExpand = aChild.pLayout->m_bExpand;
-+ aChild.bFill = aChild.pLayout->m_bFill;
-+ aChild.bPackStart = aChild.pLayout->m_bPackStart;
-+
-+ m_aChildren.push_back( aChild );
-+}
-+
-+// --- LayoutHBox ---
-+
-+LayoutHBox::LayoutHBox() : LayoutBox( )
-+{
-+}
-+void LayoutHBox::requestSize( Size &rSize )
-+{
-+ int nVisibleChildren = 0;
-+
-+ rSize.Width() = 0;
-+ rSize.Height() = 0;
-+
-+ std::list<BoxChild>::const_iterator aIter;
-+ for (aIter = m_aChildren.begin(); aIter != m_aChildren.end(); aIter++) {
-+ if( !aIter->pLayout->visible() )
-+ continue;
-+
-+ Size aChildSize;
-+
-+ aIter->pLayout->requestSize( aChildSize );
-+
-+ int nThisWidth = aChildSize.Width() + aIter->nPadding * 2;
-+
-+ if( m_bHomogeneous )
-+ rSize.Width() = SAL_MAX( rSize.Width(), nThisWidth );
-+ else
-+ rSize.Width() += nThisWidth;
-+
-+ rSize.Height() = SAL_MAX( rSize.Height(), aChildSize.Height() );
-+
-+ nVisibleChildren++;
-+ }
-+
-+ if (nVisibleChildren) {
-+ if( m_bHomogeneous )
-+ rSize.Width() *= nVisibleChildren;
-+ rSize.Width() += (nVisibleChildren - 1) * m_nSpacing;
-+ }
-+
-+ rSize.Width() += m_nBorderWidth * 2;
-+ rSize.Height() += m_nBorderWidth * 2;
-+
-+ fprintf( stderr, "LayoutHBox::RequestSize -> %d, %d [%p]\n",
-+ rSize.Width(), rSize.Height(), this );
-+
-+ m_aRequisition = rSize;
-+}
-+#define FIXED_PT 16
-+void LayoutHBox::allocateSize( const Point &rPoint, const Size &rSize )
-+{
-+ int nVisibleChildren = 0;
-+ int nExpandChildren = 0;
-+ int fExtraSpace;
-+ Point fEndPos;
-+ Point fStartPos;
-+ Size aChildSize;
-+
-+ LayoutBox::allocateSize( rPoint, rSize );
-+
-+ std::list<BoxChild>::const_iterator aIter;
-+ for (aIter = m_aChildren.begin(); aIter != m_aChildren.end(); aIter++) {
-+ if( aIter->pLayout->visible() )
-+ nVisibleChildren++;
-+ if( aIter->bExpand )
-+ nExpandChildren++;
-+ }
-+
-+ if( !nVisibleChildren )
-+ return;
-+
-+ if( m_bHomogeneous )
-+ fExtraSpace = ( ( rSize.Width() - m_nBorderWidth * 2 -
-+ ( nVisibleChildren - 1 ) * m_nSpacing ) * FIXED_PT ) / nVisibleChildren;
-+
-+ else if( nExpandChildren )
-+ fExtraSpace = ( ( rSize.Width() - m_aRequisition.Width() ) * FIXED_PT ) / nExpandChildren;
-+
-+ else
-+ fExtraSpace = 0;
-+
-+
-+ fprintf( stderr, "Layout::allocateSize extra space %g [%p]\n",
-+ (double)fExtraSpace/FIXED_PT, this );
-+
-+ fStartPos = rPoint;
-+ fStartPos.Move( m_nBorderWidth, m_nBorderWidth );
-+ fStartPos.X() *= FIXED_PT;
-+ fEndPos = rPoint;
-+ fEndPos.Move(rSize.Width(), 0);
-+ fEndPos.Move( -m_nBorderWidth, m_nBorderWidth );
-+ fEndPos.X() *= FIXED_PT;
-+ aChildSize.Height() = SAL_MAX( 1, rSize.Height() - m_nBorderWidth * 2 );
-+
-+ for (aIter = m_aChildren.begin(); aIter != m_aChildren.end(); aIter++) {
-+ if( !aIter->pLayout->visible() )
-+ continue;
-+
-+ Point aChildPos;
-+ int fBoxWidth; // of the available box space
-+
-+ if( m_bHomogeneous )
-+ fBoxWidth = fExtraSpace;
-+ else {
-+ fBoxWidth = ( aIter->pLayout->getRequisition().Width() + aIter->nPadding * 2 ) * FIXED_PT;
-+
-+ if( aIter->bExpand )
-+ fBoxWidth += fExtraSpace;
-+ }
-+
-+ int nSlackSpace;
-+ if( aIter->bFill ) {
-+ aChildSize.Width() = SAL_MAX( 1, fBoxWidth / FIXED_PT - aIter->nPadding * 2 );
-+ nSlackSpace = aIter->nPadding;
-+ } else {
-+ aChildSize.Width() = aIter->pLayout->getRequisition().Width();
-+ nSlackSpace = (fBoxWidth / FIXED_PT - aChildSize.Width()) / 2;
-+ }
-+
-+ fprintf( stderr, "LayoutHBox::alloc_child [%p] slack %d, childSize: %d,%d\n",
-+ aIter->pLayout, nSlackSpace, aChildSize.Width(), aChildSize.Height() );
-+
-+ Point aPlace;
-+ if( aIter->bPackStart ) {
-+
-+ aPlace = fStartPos;
-+ aPlace.X() /= FIXED_PT;
-+ aPlace.Move( nSlackSpace, 0 );
-+
-+ fStartPos.Move( fBoxWidth + m_nSpacing * FIXED_PT, 0 );
-+ } else {
-+
-+ fEndPos.Move( -fBoxWidth - m_nSpacing * FIXED_PT, 0 );
-+
-+ aPlace = fEndPos;
-+ aPlace.X() /= FIXED_PT;
-+ aPlace.Move( nSlackSpace, 0 );
-+ }
-+
-+ aIter->pLayout->allocateSize( aPlace, aChildSize );
-+ }
-+}
-+
-+
-Index: vcl/inc/layout.hxx
-===================================================================
-RCS file: vcl/inc/layout.hxx
-diff -N vcl/inc/layout.hxx
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ vcl/inc/layout.hxx 27 Aug 2003 12:18:43 -0000
-@@ -0,0 +1,102 @@
-+#ifndef _SV_LAYOUT_HXX
-+#define _SV_LAYOUT_HXX
-+
-+#include <list>
-+
-+#include <gen.hxx>
-+#include <resmgr.hxx>
-+#include <window.hxx>
-+
-+class Layout;
-+//
-+// The connector exists to connect widgets as they are
-+// instantiated later, to the pre-existing layout peers.
-+//
-+class LayoutConnector {
-+ struct Connection {
-+ USHORT nId;
-+ Layout *pLayout;
-+ Window *pWindow;
-+ };
-+ std::list<Connection> m_aMap;
-+ ResMgr *m_pResMgr;
-+ Window *m_pTopWindow;
-+ Layout *m_pTopLayout;
-+ private:
-+ void reconcile( Connection &pCnx );
-+ public:
-+ LayoutConnector( Window *pWindow, ResMgr *pMgr, USHORT nId );
-+
-+ // Construction time bits
-+ ResMgr *getSetupMgr();
-+ void addMap( USHORT nId, Layout *pLayout );
-+ Layout *loadLayout();
-+
-+ // later association bits
-+ void reconcileMap( USHORT nId, Window *pWindow );
-+ bool checkReconciled();
-+ Layout *getLayout() { return m_pTopLayout; }
-+};
-+
-+class Layout {
-+public: // sucking child properties ...
-+ Window *m_pPeer;
-+ Size m_aRequisition;
-+ int m_nBorderWidth;
-+ bool m_bHomogeneous;
-+// Unsatisfactory child properties ...
-+ int m_nPadding;
-+ bool m_bExpand;
-+ bool m_bFill;
-+ bool m_bPackStart;
-+ public:
-+ Layout();
-+ ~Layout();
-+ virtual void readRes( LayoutConnector &rCnx, ResMgr *pResMgr );
-+ virtual void requestSize( Size &rSize );
-+ virtual void allocateSize( const Point &rPoint,
-+ const Size &rSize );
-+ virtual void addChild( Layout *pLayout );
-+ const Size &getRequisition() { return m_aRequisition; }
-+ void setPeer( Window *pPeer) { m_pPeer = pPeer; }
-+ Window *getPeer() { return m_pPeer; }
-+ bool visible() { return m_pPeer ? m_pPeer->IsVisible() : TRUE; }
-+};
-+
-+class LayoutBin : public Layout {
-+ protected:
-+ Layout *m_pChild;
-+ public:
-+ LayoutBin();
-+ ~LayoutBin();
-+ virtual void requestSize( Size &rSize );
-+ virtual void allocateSize( const Point &rPoint, const Size &rSize );
-+};
-+
-+class LayoutBox : public Layout {
-+ protected:
-+// bool m_bHomogeneous;
-+ struct BoxChild {
-+ Layout *pLayout;
-+ int nPadding;
-+ bool bExpand;
-+ bool bFill;
-+ bool bPackStart;
-+ };
-+ int m_nSpacing;
-+ std::list<BoxChild> m_aChildren;
-+ public:
-+ LayoutBox();
-+ ~LayoutBox();
-+ virtual void addChild( Layout *pLayout );
-+};
-+
-+class LayoutHBox : public LayoutBox {
-+ public:
-+ LayoutHBox();
-+ virtual void requestSize( Size &rSize );
-+ virtual void allocateSize( const Point &rPoint,
-+ const Size &rSize );
-+};
-+
-+#endif // _SV_LAYOUT_HXX
diff --git a/patches/test/layout-vcl-window.diff b/patches/test/layout-vcl-window.diff
deleted file mode 100644
index de775513c..000000000
--- a/patches/test/layout-vcl-window.diff
+++ /dev/null
@@ -1,219 +0,0 @@
-Index: vcl/inc/window.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/window.hxx,v
-retrieving revision 1.47
-diff -u -p -u -r1.47 window.hxx
---- vcl/inc/window.hxx 24 Apr 2003 16:30:42 -0000 1.47
-+++ vcl/inc/window.hxx 27 Aug 2003 12:17:47 -0000
-@@ -131,6 +131,7 @@ class AccessObjectRef;
- class RmFrameWindow;
- class VCLXWindow;
- struct ImplAccessibleInfos;
-+class LayoutConnector;
-
- namespace com {
- namespace sun {
-@@ -530,6 +531,8 @@ public:
- virtual long PreNotify( NotifyEvent& rNEvt );
- virtual long Notify( NotifyEvent& rNEvt );
- virtual Window* GetPreferredKeyInputWindow();
-+ virtual void VtkAllocateSize( const Size &aSize );
-+ virtual void VtkRequestSize( Size &rSize );
-
- /*virtual*/ void AddEventListener( const Link& rEventListener );
- /*virtual*/ void RemoveEventListener( const Link& rEventListener );
-@@ -677,6 +680,7 @@ public:
- virtual void SetPosSizePixel( long nX, long nY,
- long nWidth, long nHeight,
- USHORT nFlags = WINDOW_POSSIZE_ALL );
-+ void DoLayout();
- void SetPosPixel( const Point& rNewPos );
- Point GetPosPixel() const;
- void SetSizePixel( const Size& rNewSize );
-Index: vcl/inc/window.h
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/window.h,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 window.h
---- vcl/inc/window.h 27 Mar 2003 17:57:36 -0000 1.11
-+++ vcl/inc/window.h 27 Aug 2003 12:17:47 -0000
-@@ -103,7 +103,7 @@ namespace dnd {
- // ---------------
- // - ImplWinData -
- // ---------------
--
-+class LayoutConnector;
- struct ImplWinData
- {
- UniString* mpExtOldText;
-@@ -113,6 +113,7 @@ struct ImplWinData
- Rectangle* mpFocusRect;
- Rectangle* mpTrackRect;
- USHORT mnTrackFlags;
-+ LayoutConnector* mpLayoutCnx;
- };
-
- // -------------------
-Index: vcl/source/window/window.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/window.cxx,v
-retrieving revision 1.176
-diff -u -p -u -r1.176 window.cxx
---- vcl/source/window/window.cxx 1 Jul 2003 14:48:37 -0000 1.176
-+++ vcl/source/window/window.cxx 27 Aug 2003 12:17:51 -0000
-@@ -206,6 +206,7 @@
- #include <dndlcon.hxx>
- #include <dndevdis.hxx>
- #include <impbmpconv.hxx>
-+#include <layout.hxx>
-
- #ifndef _UNOTOOLS_CONFIGNODE_HXX_
- #include <unotools/confignode.hxx>
-@@ -392,7 +393,7 @@ void Window::ImplUpdateGlobalSettings( A
- rSettings.SetStyleSettings( aStyleSettings );
- }
-
-- if( 1 )
-+ if( 0 ) // This is/was an incredibly broken thing to do
- {
- // #97047: Force all fonts except Mneu and Help to a fixed height
- // to avoid UI scaling due to large fonts
-@@ -1097,6 +1098,7 @@ void Window::ImplCallResize()
- {
- mbCallResize = FALSE;
- Resize();
-+ DoLayout();
-
- // #88419# Most classes don't call the base class in Resize() and Move(),
- // => Call ImpleResize/Move instead of Resize/Move directly...
-@@ -1209,6 +1211,7 @@ WinBits Window::ImplInitRes( const ResId
- pRes += 4;
- ULONG nStyle = GetLongRes( (void*)pRes );
- ((ResId&)rResId).aWinBits = nStyle;
-+
- return nStyle;
- }
-
-@@ -1296,6 +1299,24 @@ void Window::ImplLoadRes( const ResId& r
- SetData( (void*)ReadLongRes() );
- if ( nObjMask & WINDOW_UNIQUEID )
- SetUniqueId( (ULONG)ReadLongRes() );
-+ if ( nObjMask & WINDOW_LAYOUT )
-+ {
-+ ImplWinData* pWinData = ImplGetWinData();
-+ pWinData->mpLayoutCnx = new LayoutConnector
-+ ( this, GetResManager(), (USHORT)ReadShortRes() );
-+ }
-+
-+ Window *pWindow = this;
-+ LayoutConnector* pCnx = NULL;
-+
-+ while( pWindow &&
-+ !( pCnx = pWindow->ImplGetWinData()->mpLayoutCnx ) )
-+ pWindow = pWindow->mpRealParent;
-+
-+ if( pCnx )
-+ pCnx->reconcileMap( rResId.GetId(), this );
-+ else
-+ fprintf( stderr, "No LayoutConnector for %p\n", this );
- }
-
- // -----------------------------------------------------------------------
-@@ -1312,6 +1333,7 @@ ImplWinData* Window::ImplGetWinData() co
- mpWinData->mpFocusRect = NULL;
- mpWinData->mpTrackRect = NULL;
- mpWinData->mnTrackFlags = 0;
-+ mpWinData->mpLayoutCnx = NULL;
- }
-
- return mpWinData;
-@@ -1659,6 +1681,7 @@ void Window::ImplInitResolutionSettings(
- }
-
- // -----------------------------------------------------------------------
-+#include <stdio.h>
-
- void Window::ImplPointToLogic( Font& rFont ) const
- {
-@@ -1667,17 +1690,21 @@ void Window::ImplPointToLogic( Font& rFo
-
- if ( aSize.Width() )
- {
-- aSize.Width() *= mpFrameData->mnFontDPIX;
-- aSize.Width() += 72/2;
-- aSize.Width() /= 72;
-- aSize.Width() *= nScreenFontZoom;
-- aSize.Width() /= 100;
-- }
-- aSize.Height() *= mpFrameData->mnFontDPIY;
-- aSize.Height() += 72/2;
-- aSize.Height() /= 72;
-- aSize.Height() *= nScreenFontZoom;
-- aSize.Height() /= 100;
-+ double t = aSize.Width();
-+ t *= nScreenFontZoom;
-+ t /= 100.0;
-+ t *= mpFrameData->mnFontDPIX;
-+ t /= 72.0;
-+ t += 0.5;
-+ aSize.Width() = t;
-+ }
-+ double t = aSize.Height();
-+ t *= nScreenFontZoom;
-+ t /= 100.0;
-+ t *= mpFrameData->mnFontDPIY;
-+ t /= 72.0;
-+ t += 0.5;
-+ aSize.Height() = t;
-
- if ( IsMapModeEnabled() )
- aSize = PixelToLogic( aSize );
-@@ -5985,6 +6012,27 @@ void Window::SetParent( Window* pNewPare
-
- // -----------------------------------------------------------------------
-
-+void Window::DoLayout()
-+{
-+ Layout *pLayout;
-+ LayoutConnector *pCnx;
-+ if( ( pCnx = ImplGetWinData()->mpLayoutCnx ) &&
-+ ( pLayout = pCnx->getLayout() ) )
-+ {
-+ Size aSize;
-+
-+ if( !pCnx->checkReconciled() )
-+ fprintf( stderr, "Some windows will not show up\n" );
-+
-+ pLayout->requestSize( aSize );
-+ fprintf( stderr, "Window requested size %d, %d\n",
-+ aSize.Width(), aSize.Height() );
-+
-+ aSize = GetSizePixel();
-+ pLayout->allocateSize( Point(), aSize );
-+ }
-+}
-+
- void Window::Show( BOOL bVisible, USHORT nFlags )
- {
- DBG_CHKTHIS( Window, ImplDbgCheckWindow );
-@@ -5995,6 +6043,8 @@ void Window::Show( BOOL bVisible, USHORT
-
- mbVisible = bVisible != 0;
-
-+ DoLayout();
-+
- if ( !bVisible )
- {
- ImplHideAllOverlaps();
-@@ -8787,3 +8837,11 @@ LanguageType Window::GetInputLanguage()
- return mpFrame->GetInputLanguage();
- }
-
-+
-+void Window::VtkAllocateSize( const Size &aSize )
-+{
-+}
-+
-+void Window::VtkRequestSize( Size &rSize )
-+{
-+}
diff --git a/patches/test/link-vt-reloc.diff b/patches/test/link-vt-reloc.diff
deleted file mode 100644
index 6b78ce874..000000000
--- a/patches/test/link-vt-reloc.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-Index: cppuhelper/source/gcc3.map
-===================================================================
-RCS file: /cvs/udk/cppuhelper/source/gcc3.map,v
-retrieving revision 1.3
-diff -u -p -r1.3 gcc3.map
---- cppuhelper/source/gcc3.map 15 Oct 2007 11:52:54 -0000 1.3
-+++ cppuhelper/source/gcc3.map 23 Jan 2008 14:19:08 -0000
-@@ -218,6 +218,7 @@ _ZTVN4cppu20IPropertyArrayHelperE;
- _ZTVN4cppu20OPropertyArrayHelperE;
- _ZTVN4cppu27WeakComponentImplHelperBaseE;
- _ZTVN4cppu30WeakAggComponentImplHelperBaseE;
-+_ZTVN4cppu20PropertySetMixinImplE;
- _ZN4cppu20OPropertyArrayHelperD0Ev;
- _ZN4cppu20OPropertyArrayHelperD1Ev;
- _ZThn*_N4cppu14OWeakAggObject12setDelegatorERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
diff --git a/patches/test/lwp-filter-component.diff b/patches/test/lwp-filter-component.diff
deleted file mode 100644
index 6bdeeb4d5..000000000
--- a/patches/test/lwp-filter-component.diff
+++ /dev/null
@@ -1,804 +0,0 @@
---- /dev/null 2006-03-20 09:28:16.436453250 +0000
-+++ lotuswordpro/source/filter/LotusWordProImportFilter.cxx 2006-03-20 12:31:24.000000000 +0000
-@@ -0,0 +1,420 @@
-+#ifndef _OSL_DIAGNOSE_H_
-+#include <osl/diagnose.h>
-+#endif
-+#ifndef _RTL_TENCINFO_H_
-+#include <rtl/tencinfo.h>
-+#endif
-+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
-+#include <com/sun/star/io/XInputStream.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
-+#include <com/sun/star/xml/sax/XAttributeList.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_
-+#include <com/sun/star/xml/sax/XParser.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP
-+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
-+#include <com/sun/star/io/XInputStream.hpp>
-+#endif
-+#ifndef _ATTRLIST_HPP_
-+#include <xmloff/attrlist.hxx>
-+#endif
-+#ifndef _XMLKYWD_HPP
-+#include <xmloff/xmlkywd.hxx>
-+#endif
-+
-+#ifndef _UCBHELPER_CONTENT_HXX
-+#include <ucbhelper/content.hxx>
-+#endif
-+
-+#include <tools/stream.hxx>
-+
-+#include "LotusWordProImportFilter.hxx"
-+
-+#include <vector>
-+
-+using namespace ::rtl;
-+using rtl::OString;
-+using rtl::OUStringBuffer;
-+using rtl::OUString;
-+using com::sun::star::uno::Sequence;
-+using com::sun::star::uno::Reference;
-+using com::sun::star::lang::XComponent;
-+using com::sun::star::uno::Any;
-+using com::sun::star::uno::UNO_QUERY;
-+using com::sun::star::uno::XInterface;
-+using com::sun::star::uno::Exception;
-+using com::sun::star::uno::RuntimeException;
-+using com::sun::star::io::XInputStream;
-+using com::sun::star::lang::XMultiServiceFactory;
-+using com::sun::star::beans::PropertyValue;
-+using com::sun::star::document::XFilter;
-+using com::sun::star::document::XExtendedFilterDetection;
-+using com::sun::star::ucb::XCommandEnvironment;
-+
-+using com::sun::star::document::XImporter;
-+using com::sun::star::xml::sax::XAttributeList;
-+using com::sun::star::xml::sax::XDocumentHandler;
-+using com::sun::star::xml::sax::XParser;
-+
-+// W o r d P r o
-+static const sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f };
-+
-+const sal_Int32 MAXCHARS = 65534;
-+
-+ // Simple xml importer, currently the importer is very very simple
-+ // it only extracts pure text from the wordpro file. Absolutely no formating
-+ // information is currently imported.
-+ // To reflect the current state of this importer the sax events sent
-+ // to the document handler are also the simplest possible. In addition to
-+ // the the basic attributes set up for the 'office:document' element
-+ // all the imported text is inserted into 'text:p' elements.
-+ // The parser extracts the pure text and creates simple a simple 'text:p'
-+ // element to contain that text. In the event of the text exceeding
-+ // MAXCHARS new 'text:p' elements are created as needed
-+class SimpleXMLImporter
-+{
-+private:
-+
-+ Reference< XDocumentHandler > m_xDocHandler;
-+ std::vector< OUString > m_vStringChunks;
-+ SvStream& m_InputStream;
-+
-+ bool CheckValidData( sal_Int8 nChar )
-+ {
-+ if( ( nChar >= 0x20 && nChar <= 0x7E ) && ( nChar != 0X40 ) )
-+ return true;
-+ return false;
-+ }
-+
-+ void addAttribute( SvXMLAttributeList* pAttrList, const char* key, const char* val )
-+ {
-+ pAttrList->AddAttribute( OUString::createFromAscii( key ), OUString::createFromAscii( val ) );
-+ }
-+
-+ void writeTextChunk( const OUString& sChunk )
-+ {
-+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
-+ Reference < XAttributeList > xAttrList(pAttrList);
-+
-+ pAttrList->AddAttribute( OUString(RTL_CONSTASCII_USTRINGPARAM("text:style-name")), OUString(RTL_CONSTASCII_USTRINGPARAM("Standard")));
-+
-+ m_xDocHandler->startElement( OUString(RTL_CONSTASCII_USTRINGPARAM("text:p")), xAttrList );
-+ m_xDocHandler->characters( sChunk );
-+ m_xDocHandler->endElement( OUString(RTL_CONSTASCII_USTRINGPARAM("text:p") ) );
-+ }
-+
-+ void writeDocContentPreamble()
-+ {
-+ SvXMLAttributeList *pDocContentPropList = new SvXMLAttributeList();
-+ Reference < XAttributeList > xDocContentList(pDocContentPropList);
-+ addAttribute( pDocContentPropList, "xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
-+ addAttribute( pDocContentPropList, "xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:xlink", "http://www.w3.org/1999/xlink" );
-+ addAttribute( pDocContentPropList, "xmlns:dc", "http://purl.org/dc/elements/1.1/" );
-+ addAttribute( pDocContentPropList, "xmlns:meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:dr3d", "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:math", "http://www.w3.org/1998/Math/MathML" );
-+ addAttribute( pDocContentPropList, "xmlns:form", "urn:oasis:names:tc:opendocument:xmlns:form:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:script", "urn:oasis:names:tc:opendocument:xmlns:script:1.0" );
-+ addAttribute( pDocContentPropList, "xmlns:ooo", "http://openoffice.org/2004/office" );
-+ addAttribute( pDocContentPropList, "xmlns:ooow", "http://openoffice.org/2004/writer" );
-+ addAttribute( pDocContentPropList, "xmlns:oooc", "http://openoffice.org/2004/calc" );
-+ addAttribute( pDocContentPropList, "xmlns:dom", "http://www.w3.org/2001/xml-events" );
-+ addAttribute( pDocContentPropList, "xmlns:xforms", "http://www.w3.org/2002/xforms" );
-+ addAttribute( pDocContentPropList, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
-+ addAttribute( pDocContentPropList, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-+ addAttribute( pDocContentPropList, "office:version", "1.0");
-+ m_xDocHandler->startElement(OUString(RTL_CONSTASCII_USTRINGPARAM("office:document-content" ) ), xDocContentList );
-+ }
-+
-+ void parseDoc()
-+ {
-+ UINT8 nDelim, nDummy, nLen, nData;
-+ UINT16 nOpcode;
-+ int nCount = 0;
-+ OUStringBuffer sBuf( MAXCHARS );
-+ sal_Int32 nChars = 0;
-+
-+ while( !m_InputStream.IsEof())
-+ {
-+ m_InputStream >> nDelim;
-+ if( nDelim == 0x40 )
-+ {
-+ m_InputStream >> nDummy >> nOpcode;
-+ switch( nOpcode )
-+ {
-+ case 0xC00B: // Dictionary Word
-+ m_InputStream >> nLen >> nDummy;
-+ while( nLen > 0 && !m_InputStream.IsEof() )
-+ {
-+ UINT8 nChar;
-+ m_InputStream >> nChar;
-+ if( CheckValidData( nChar ) )
-+ {
-+ sBuf.appendAscii( (sal_Char*)(&nChar),1 );
-+ if ( ++nChars >= MAXCHARS )
-+ {
-+ m_vStringChunks.push_back( sBuf.makeStringAndClear() );
-+ nChars = 0;
-+ }
-+ }
-+ nLen--;
-+ }
-+ break;
-+
-+ case 0x0242: // Non Dictionary word
-+ m_InputStream >> nData;
-+ if( nData == 0x02 )
-+ {
-+ m_InputStream >> nLen >> nDummy;
-+ while( nLen > 0 && !m_InputStream.IsEof() )
-+ {
-+ m_InputStream >> nData;
-+ if( CheckValidData( nData ) )
-+ {
-+ sBuf.appendAscii( (sal_Char*)(&nData),1 );
-+ if ( ++nChars >= MAXCHARS )
-+ {
-+ m_vStringChunks.push_back( sBuf.makeStringAndClear() );
-+ nChars = 0;
-+ }
-+ }
-+ nLen--;
-+ }
-+ }
-+ break;
-+ }
-+ }
-+ }
-+ if ( nChars )
-+ m_vStringChunks.push_back( sBuf.makeStringAndClear() );
-+ }
-+
-+ void writeXML()
-+ {
-+ if ( m_vStringChunks.size() )
-+ {
-+ m_xDocHandler->startDocument();
-+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
-+ writeDocContentPreamble(); // writes "office:document-content" elem
-+ Reference < XAttributeList > xAttrList(pAttrList);
-+
-+ m_xDocHandler->startElement( OUString(RTL_CONSTASCII_USTRINGPARAM("office:body")), xAttrList );
-+
-+ // process strings imported
-+ std::vector< OUString >::const_iterator it = m_vStringChunks.begin();
-+ std::vector< OUString >::const_iterator it_end = m_vStringChunks.end();
-+ for ( ; it!=it_end; ++it )
-+ writeTextChunk( *it );
-+
-+ m_xDocHandler->endElement( OUString(RTL_CONSTASCII_USTRINGPARAM("office:body") ) );
-+ m_xDocHandler->endElement( OUString(RTL_CONSTASCII_USTRINGPARAM("office:document-content")));
-+ m_xDocHandler->endDocument();
-+ }
-+ }
-+public:
-+
-+ SimpleXMLImporter( const Reference< XDocumentHandler >& xDocHandler, SvStream& rStream ) : m_xDocHandler( xDocHandler ), m_InputStream( rStream ) {}
-+
-+ void import()
-+ {
-+ parseDoc();
-+ writeXML();
-+ }
-+};
-+
-+sal_Bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-+ throw (RuntimeException)
-+{
-+
-+ sal_Int32 nLength = aDescriptor.getLength();
-+ const PropertyValue * pValue = aDescriptor.getConstArray();
-+ OUString sURL;
-+ Reference < XInputStream > xInputStream;
-+ for ( sal_Int32 i = 0 ; i < nLength; i++)
-+ {
-+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
-+ pValue[i].Value >>= xInputStream;
-+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
-+ pValue[i].Value >>= sURL;
-+ rtl_TextEncoding encoding = RTL_TEXTENCODING_INFO_ASCII;
-+ }
-+ if ( !xInputStream.is() )
-+ {
-+ OSL_ASSERT( 0 );
-+ return sal_False;
-+ }
-+
-+ OString sFileName;
-+ sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
-+
-+ SvFileStream inputStream( sURL, STREAM_READ );
-+ if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) )
-+ return sal_False;
-+
-+ // An XML import service: what we push sax messages to..
-+ OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XMLImporter" ) );
-+
-+ Reference< XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
-+ Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
-+ xImporter->setTargetDocument(mxDoc);
-+
-+ SimpleXMLImporter xmlImporter( xInternalHandler, inputStream );
-+ xmlImporter.import();
-+
-+ return sal_True;
-+}
-+
-+sal_Bool SAL_CALL LotusWordProImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-+ throw (RuntimeException)
-+{
-+ return importImpl ( aDescriptor );
-+}
-+void SAL_CALL LotusWordProImportFilter::cancel( )
-+ throw (RuntimeException)
-+{
-+}
-+
-+// XImporter
-+void SAL_CALL LotusWordProImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
-+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
-+{
-+ meType = FILTER_IMPORT;
-+ mxDoc = xDoc;
-+}
-+
-+// XExtendedFilterDetection
-+OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
-+ throw( com::sun::star::uno::RuntimeException )
-+{
-+
-+ OUString sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "" ) );
-+ sal_Int32 nLength = Descriptor.getLength();
-+ sal_Int32 location = nLength;
-+ OUString sURL;
-+ const PropertyValue * pValue = Descriptor.getConstArray();
-+ Reference < XInputStream > xInputStream;
-+ for ( sal_Int32 i = 0 ; i < nLength; i++)
-+ {
-+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
-+ location=i;
-+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
-+ pValue[i].Value >>= xInputStream;
-+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
-+ pValue[i].Value >>= sURL;
-+
-+ rtl_TextEncoding encoding = RTL_TEXTENCODING_INFO_ASCII;
-+ }
-+
-+ Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
-+ if (!xInputStream.is())
-+ {
-+ try
-+ {
-+ ::ucb::Content aContent(sURL, xEnv);
-+ xInputStream = aContent.openStream();
-+ }
-+ catch ( Exception& )
-+ {
-+ return ::rtl::OUString();
-+ }
-+
-+ if (!xInputStream.is())
-+ return ::rtl::OUString();
-+ }
-+
-+ Sequence< ::sal_Int8 > aData;
-+ sal_Int32 nLen = sizeof( header ) / sizeof( header[0] );
-+ if ( ( nLen == xInputStream->readBytes( aData, nLen ) ) )
-+ if ( memcmp( ( void* )header, (void*) aData.getConstArray(), nLen ) == 0 )
-+ sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_LotusWordPro_Document" ) );
-+ return sTypeName;
-+}
-+
-+
-+// XInitialization
-+void SAL_CALL LotusWordProImportFilter::initialize( const Sequence< Any >& aArguments )
-+ throw (Exception, RuntimeException)
-+{
-+ Sequence < PropertyValue > aAnySeq;
-+ sal_Int32 nLength = aArguments.getLength();
-+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
-+ {
-+ const PropertyValue * pValue = aAnySeq.getConstArray();
-+ nLength = aAnySeq.getLength();
-+ for ( sal_Int32 i = 0 ; i < nLength; i++)
-+ {
-+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
-+ {
-+ pValue[i].Value >>= msFilterName;
-+ break;
-+ }
-+ }
-+ }
-+}
-+OUString LotusWordProImportFilter_getImplementationName ()
-+ throw (RuntimeException)
-+{
-+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.LotusWordProImportFilter" ) );
-+}
-+
-+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
-+sal_Bool SAL_CALL LotusWordProImportFilter_supportsService( const OUString& ServiceName )
-+ throw (RuntimeException)
-+{
-+ return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
-+ ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
-+}
-+Sequence< OUString > SAL_CALL LotusWordProImportFilter_getSupportedServiceNames( )
-+ throw (RuntimeException)
-+{
-+ Sequence < OUString > aRet(2);
-+// Sequence < OUString > aRet(1);
-+ OUString* pArray = aRet.getArray();
-+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
-+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
-+ return aRet;
-+}
-+#undef SERVICE_NAME2
-+#undef SERVICE_NAME1
-+
-+Reference< XInterface > SAL_CALL LotusWordProImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
-+ throw( Exception )
-+{
-+ return (cppu::OWeakObject*) new LotusWordProImportFilter( rSMgr );
-+}
-+
-+// XServiceInfo
-+OUString SAL_CALL LotusWordProImportFilter::getImplementationName( )
-+ throw (RuntimeException)
-+{
-+ return LotusWordProImportFilter_getImplementationName();
-+}
-+sal_Bool SAL_CALL LotusWordProImportFilter::supportsService( const OUString& rServiceName )
-+ throw (RuntimeException)
-+{
-+ return LotusWordProImportFilter_supportsService( rServiceName );
-+}
-+Sequence< OUString > SAL_CALL LotusWordProImportFilter::getSupportedServiceNames( )
-+ throw (RuntimeException)
-+{
-+ return LotusWordProImportFilter_getSupportedServiceNames();
-+}
---- /dev/null 2006-03-20 09:28:16.436453250 +0000
-+++ lotuswordpro/source/filter/LotusWordProImportFilter.hxx 2006-03-20 10:10:03.000000000 +0000
-@@ -0,0 +1,104 @@
-+#ifndef _WORDPERFECTIMPORTFILTER_HXX
-+#define _WORDPERFECTIMPORTFILTER_HXX
-+
-+#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_
-+#include <com/sun/star/document/XFilter.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_
-+#include <com/sun/star/document/XImporter.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_
-+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
-+#include <com/sun/star/lang/XInitialization.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#endif
-+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
-+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-+#endif
-+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
-+#include <cppuhelper/implbase5.hxx>
-+#endif
-+#include <rtl/ustrbuf.hxx>
-+
-+enum FilterType
-+{
-+ FILTER_IMPORT,
-+ FILTER_EXPORT
-+};
-+/* This component will be instantiated for both import or export. Whether it calls
-+ * setSourceDocument or setTargetDocument determines which Impl function the filter
-+ * member calls */
-+class LotusWordProImportFilter : public cppu::WeakImplHelper5
-+<
-+ com::sun::star::document::XFilter,
-+ com::sun::star::document::XImporter,
-+ com::sun::star::document::XExtendedFilterDetection,
-+ com::sun::star::lang::XInitialization,
-+ com::sun::star::lang::XServiceInfo
-+>
-+{
-+private:
-+
-+protected:
-+ // oo.org declares
-+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
-+ ::rtl::OUString msFilterName;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
-+
-+ FilterType meType;
-+
-+ sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+public:
-+ LotusWordProImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-+ : mxMSF( rxMSF ) {}
-+ virtual ~LotusWordProImportFilter() {}
-+
-+ // XFilter
-+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-+ throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL cancel( )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+ // XImporter
-+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
-+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+
-+ //XExtendedFilterDetection
-+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
-+ throw( com::sun::star::uno::RuntimeException );
-+
-+ // XInitialization
-+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
-+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-+
-+ // XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
-+ throw (::com::sun::star::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
-+ throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+};
-+
-+::rtl::OUString LotusWordProImportFilter_getImplementationName()
-+ throw ( ::com::sun::star::uno::RuntimeException );
-+
-+sal_Bool SAL_CALL LotusWordProImportFilter_supportsService( const ::rtl::OUString& ServiceName )
-+ throw ( ::com::sun::star::uno::RuntimeException );
-+
-+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL LotusWordProImportFilter_getSupportedServiceNames( )
-+ throw ( ::com::sun::star::uno::RuntimeException );
-+
-+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-+SAL_CALL LotusWordProImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
-+ throw ( ::com::sun::star::uno::Exception );
-+
-+#endif
-diff -rNup lotusworkpro/prj/build.lst lotuswordpro/prj/build.lst
---- lotuswordpro/prj/build.lst 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/prj/build.lst 2006-03-13 17:14:50.000000000 +0000
-@@ -0,0 +1,4 @@
-+wp lotuswordpro : sfx2 sot svx comphelper NULL
-+wp lotuswordpro usr1 - all lwp_mkout NULL
-+wp lotuswordpro\source\filter nmake - all lwp_filter NULL
-+wp lotuswordpro\util nmake - all lwp_util lwp_filter NULL
-diff -rNup lotuswordpro/prj/d.lst lotuswordpro/prj/d.lst
---- lotuswordpro/prj/d.lst 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/prj/d.lst 2004-10-08 09:48:28.000000000 +0100
-@@ -0,0 +1,3 @@
-+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
-+..\%__SRC%\bin\*.dll %_DEST%\lib%_EXT%\*.dll
-+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
-diff -rNup lotuswordpro/source/filter/genericfilter.cxx lotuswordpro/source/filter/genericfilter.cxx
---- lotuswordpro/source/filter/genericfilter.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/source/filter/genericfilter.cxx 2006-03-14 11:06:00.000000000 +0000
-@@ -0,0 +1,77 @@
-+#include <stdio.h>
-+
-+#include <osl/mutex.hxx>
-+#include <osl/thread.h>
-+#include <cppuhelper/factory.hxx>
-+
-+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-+#endif
-+
-+#include "LotusWordProImportFilter.hxx"
-+
-+using namespace ::rtl;
-+using namespace ::cppu;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::lang;
-+using namespace ::com::sun::star::registry;
-+
-+extern "C"
-+{
-+//==================================================================================================
-+void SAL_CALL component_getImplementationEnvironment(
-+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
-+{
-+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+}
-+//==================================================================================================
-+sal_Bool SAL_CALL component_writeInfo(
-+ void * pServiceManager, void * pRegistryKey )
-+{
-+ if (pRegistryKey)
-+ {
-+ try
-+ {
-+ sal_Int32 nPos = 0;
-+ Reference< XRegistryKey > xNewKey(
-+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( LotusWordProImportFilter_getImplementationName() ) );
-+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
-+
-+ const Sequence< OUString > & rSNL = LotusWordProImportFilter_getSupportedServiceNames();
-+ const OUString * pArray = rSNL.getConstArray();
-+ for ( nPos = rSNL.getLength(); nPos--; )
-+ xNewKey->createKey( pArray[nPos] );
-+
-+ return sal_True;
-+ }
-+ catch (InvalidRegistryException &)
-+ {
-+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
-+ }
-+ }
-+ return sal_False;
-+}
-+//==================================================================================================
-+void * SAL_CALL component_getFactory(
-+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
-+{
-+ void * pRet = 0;
-+
-+ OUString implName = OUString::createFromAscii( pImplName );
-+ if ( pServiceManager && implName.equals(LotusWordProImportFilter_getImplementationName()) )
-+ {
-+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
-+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
-+ OUString::createFromAscii( pImplName ),
-+ LotusWordProImportFilter_createInstance, LotusWordProImportFilter_getSupportedServiceNames() ) );
-+
-+ if (xFactory.is())
-+ {
-+ xFactory->acquire();
-+ pRet = xFactory.get();
-+ }
-+ }
-+
-+ return pRet;
-+}
-+}
-diff -rNup lotuswordpro/source/filter/makefile.mk lotuswordpro/source/filter/makefile.mk
---- lotuswordpro/source/filter/makefile.mk 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/source/filter/makefile.mk 2006-03-14 11:07:05.000000000 +0000
-@@ -0,0 +1,20 @@
-+PRJ=..$/..
-+
-+PRJNAME=filter
-+TARGET=filter
-+ENABLE_EXCEPTIONS=true
-+
-+.INCLUDE : settings.mk
-+
-+.IF "$(SYSTEM_LIBWPD)" == "YES"
-+INCPRE+=$(LIBWPD_CFLAGS) -I..
-+.ELSE
-+# broken but ... necessary, internal include shafted ...
-+INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd -I..
-+.ENDIF
-+
-+SLOFILES= \
-+ $(SLO)$/LotusWordProImportFilter.obj \
-+ $(SLO)$/genericfilter.obj
-+
-+.INCLUDE : target.mk
-diff -rNup lotuswordpro/util/lwpft.map lotuswordpro/util/lwpft.map
---- lotuswordpro/util/lwpft.map 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/util/lwpft.map 2004-08-05 18:44:50.000000000 +0100
-@@ -0,0 +1,8 @@
-+WPFT_1_0 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_writeInfo;
-+ component_getFactory;
-+ local:
-+ *;
-+};
-diff -rNup lotuswordpro/util/makefile.mk lotuswordpro/util/makefile.mk
---- lotuswordpro/util/makefile.mk 1970-01-01 01:00:00.000000000 +0100
-+++ lotuswordpro/util/makefile.mk 2006-03-13 17:13:49.000000000 +0000
-@@ -0,0 +1,27 @@
-+PRJ=..
-+PRJNAME=lwpft
-+TARGET=lwpft
-+VERSION=$(UPD)
-+
-+.INCLUDE : settings.mk
-+
-+LIB1TARGET= $(SLB)$/$(TARGET).lib
-+LIB1FILES= \
-+ $(SLB)$/filter.lib
-+SHL1LIBS=$(LIB1TARGET)
-+SHL1STDLIBS+= \
-+ $(TOOLSLIB) \
-+ $(COMPHELPERLIB) \
-+ $(UCBHELPERLIB) \
-+ $(CPPUHELPERLIB) \
-+ $(CPPULIB) \
-+ $(SALLIB) \
-+ $(XMLOFFLIB)
-+
-+SHL1TARGET = $(TARGET)$(UPD)$(DLLPOSTFIX)
-+SHL1IMPLIB = i$(SHL1TARGET)
-+SHL1LIBS = $(LIB1TARGET)
-+SHL1VERSIONMAP=$(TARGET).map
-+DEF1NAME=$(SHL1TARGET)
-+
-+.INCLUDE : target.mk
-diff -urpN filter.orig/source/config/fragments/fcfg_writer.mk filter/source/config/fragments/fcfg_writer.mk
---- filter.orig/source/config/fragments/fcfg_writer.mk 2006-03-13 16:35:22.000000000 +0000
-+++ filter/source/config/fragments/fcfg_writer.mk 2006-03-15 10:03:24.000000000 +0000
-@@ -46,6 +46,7 @@ T4_WRITER = \
- writer_StarOffice_XML_Writer \
- $(T4_WRITER_BINFILTER) \
- writer_WordPerfect_Document \
-+ writer_LotusWordPro_Document \
- writer_Text \
- writer_Text_encoded \
- writer_JustSystem_Ichitaro_10 \
-@@ -77,6 +78,7 @@ F4_WRITER = \
- StarOffice_XML__Writer_ \
- $(F4_WRITER_BINFILTER) \
- WordPerfect \
-+ LotusWordPro \
- Text \
- Text__encoded_ \
- writer_JustSystem_Ichitaro_10 \
-diff -urpN filter.orig/source/config/fragments/filters/LotusWordPro.xcu filter/source/config/fragments/filters/LotusWordPro.xcu
---- filter.orig/source/config/fragments/filters/LotusWordPro.xcu 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/config/fragments/filters/LotusWordPro.xcu 2006-03-15 10:14:03.000000000 +0000
-@@ -0,0 +1,13 @@
-+ <node oor:name="LotusWordPro" oor:op="replace">
-+ <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
-+ <prop oor:name="UIComponent"/>
-+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.LotusWordProImportFilter</value></prop>
-+ <prop oor:name="UserData"><value>WPD</value></prop>
-+ <prop oor:name="UIName">
-+ <value xml:lang="x-default">Lotus WordPro Document</value>
-+ </prop>
-+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
-+ <prop oor:name="Type"><value>writer_LotusWordPro_Document</value></prop>
-+ <prop oor:name="TemplateName"/>
-+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
-+ </node>
-diff -urpN filter.orig/source/config/fragments/types/writer_LotusWordPro_Document.xcu filter/source/config/fragments/types/writer_LotusWordPro_Document.xcu
---- filter.orig/source/config/fragments/types/writer_LotusWordPro_Document.xcu 1970-01-01 01:00:00.000000000 +0100
-+++ filter/source/config/fragments/types/writer_LotusWordPro_Document.xcu 2006-03-15 10:14:32.000000000 +0000
-@@ -0,0 +1,12 @@
-+ <node oor:name="writer_LotusWordPro_Document" oor:op="replace" >
-+ <prop oor:name="DetectService"><value>com.sun.star.comp.Writer.LotusWordProImportFilter</value></prop>
-+ <prop oor:name="URLPattern"/>
-+ <prop oor:name="Extensions"><value>lwp</value></prop>
-+ <prop oor:name="MediaType"/>
-+ <prop oor:name="Preferred"><value>false</value></prop>
-+ <prop oor:name="PreferredFilter"><value>LotusWordPro</value></prop>
-+ <prop oor:name="UIName">
-+ <value>LotusWordPro Document</value>
-+ </prop>
-+ <prop oor:name="ClipboardFormat"/>
-+ </node>
-Index: officecfg/registry/data/org/openoffice/Office/UI.xcu
-===================================================================
-RCS file: /cvs/util/officecfg/registry/data/org/openoffice/Office/UI.xcu,v
-retrieving revision 1.33
-diff -u -p -r1.33 UI.xcu
---- officecfg/registry/data/org/openoffice/Office/UI.xcu 8 Sep 2005 14:52:04 -0000 1.33
-+++ officecfg/registry/data/org/openoffice/Office/UI.xcu 15 Mar 2006 11:29:44 -0000
-@@ -44,7 +44,7 @@
- <value xml:lang="en-US">Text documents</value>
- </prop>
- <prop oor:name="Filters">
-- <value oor:separator=";">HTML (StarWriter);MS WinWord 2.x (W4W);MS WinWord 6.0;MS Word 95;MS Word 95 Vorlage;MS Word 97;MS Word 97 Vorlage;StarOffice XML (Writer);StarWriter 3.0;StarWriter 3.0 Vorlage/Template;StarWriter 4.0;StarWriter 4.0 Vorlage/Template;StarWriter 5.0;StarWriter 5.0 Vorlage/Template;writer_StarOffice_XML_Writer_Template;Text;WordPerfect;writer8;writer8_template</value>
-+ <value oor:separator=";">HTML (StarWriter);MS WinWord 2.x (W4W);MS WinWord 6.0;MS Word 95;MS Word 95 Vorlage;MS Word 97;MS Word 97 Vorlage;StarOffice XML (Writer);StarWriter 3.0;StarWriter 3.0 Vorlage/Template;StarWriter 4.0;StarWriter 4.0 Vorlage/Template;StarWriter 5.0;StarWriter 5.0 Vorlage/Template;writer_StarOffice_XML_Writer_Template;Text;WordPerfect;writer8;writer8_template;LotusWordPro</value>
- </prop>
- </node>
- <node oor:name="com.sun.star.sheet.SpreadsheetDocument" oor:op="replace">
-Index: scp2/source/ooo/file_library_ooo.scp
-===================================================================
-RCS file: /cvs/installation/scp2/source/ooo/file_library_ooo.scp,v
-retrieving revision 1.184.2.2
-diff -u -p -r1.184.2.2 file_library_ooo.scp
---- scp2/source/ooo/file_library_ooo.scp 17 Feb 2006 16:52:02 -0000 1.184.2.2
-+++ scp2/source/ooo/file_library_ooo.scp 15 Mar 2006 11:48:56 -0000
-@@ -1276,6 +1366,7 @@ End
- #endif
-
- STD_UNO_LIB_FILE_PATCH(gid_File_Lib_Wpft,wpft)
-+STD_UNO_LIB_FILE_PATCH(gid_File_Lib_Wlwp,lwpft)
-
- #if !defined(MACOSX) && ( !defined(SYSTEM_MOZILLA) && !defined(WITHOUT_MOZILLA) )
-
-Index: scp2/source/writer/module_writer.scp
-===================================================================
-RCS file: /cvs/installation/scp2/source/writer/module_writer.scp,v
-retrieving revision 1.14
-diff -u -p -r1.14 module_writer.scp
---- scp2/source/writer/module_writer.scp 9 Sep 2005 01:50:00 -0000 1.14
-+++ scp2/source/writer/module_writer.scp 15 Mar 2006 11:50:35 -0000
-@@ -52,6 +52,7 @@ Module gid_Module_Prg_Wrt_Bin
- gid_File_Lib_Swd,
- gid_File_Lib_Swui,
- gid_File_Lib_Wpft,
-+ gid_File_Lib_Wlwp,
- gid_File_Share_Config_Sofficecfg_Writer_Menubar_Xml,
- gid_File_Share_Config_Sofficecfg_Writerweb_Menubar_Xml,
- gid_File_Share_Config_Sofficecfg_Writerglobal_Menubar_Xml,
-Index: sw/prj/build.lst
-===================================================================
-RCS file: /cvs/sw/sw/prj/build.lst,v
-retrieving revision 1.16
-diff -u -p -r1.16 build.lst
---- sw/prj/build.lst 8 Nov 2005 17:14:00 -0000 1.16
-+++ sw/prj/build.lst 15 Mar 2006 12:09:49 -0000
-@@ -1,4 +1,4 @@
--sw sw : connectivity OOo:writerperfect svx stoc uui sch NULL
-+sw sw : connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui sch NULL
- sw sw usr1 - all sw_mkout NULL
- sw sw\inc get - all sw_inc NULL
- sw sw\prj get - all sw_prj NULL
diff --git a/patches/test/macbuild.diff b/patches/test/macbuild.diff
deleted file mode 100644
index 86e65b870..000000000
--- a/patches/test/macbuild.diff
+++ /dev/null
@@ -1,116 +0,0 @@
-Index: bin/build-ooo
-===================================================================
---- bin/build-ooo (revision 13863)
-+++ bin/build-ooo (working copy)
-@@ -5,7 +5,7 @@
- #
- . ./setup
-
--if test "z$BUILD_WIN32" = "z" -a "z`uname -s`" != "zSunOS"; then
-+if test "z$BUILD_WIN32" = "z" -a "z`uname -s`" != "zSunOS" -a "z`uname -s`" != "zDarwin"; then
- if ! test -f /proc/cpuinfo; then
- echo "Looks like proc isn't mounted - this means almost certain"
- echo "Java related weird build failure: please check /proc"
-Index: bin/ooinstall
-===================================================================
---- bin/ooinstall (revision 13863)
-+++ bin/ooinstall (working copy)
-@@ -32,13 +32,18 @@
- }
-
- sub wanted {
-+ my $path_to_unopkg="$path/program";
-+ if ( $^O =~ /darwin/i )
-+ {
-+ $path_to_unopkg="$path/OpenOffice.org.app/Contents/MacOS";
-+ }
- -f $_
- && /.*\.oxt$/
-- && system ( "LD_LIBRARY_PATH='' $path/program/unopkg add -v --shared $File::Find::name" )
-+ && system ( "LD_LIBRARY_PATH='' $path_to_unopkg/unopkg add -v --shared $File::Find::name" )
- && die "Cannot install $_ extension!";
- }
-
--( -f "/proc/meminfo" ) || die "The installer cannot work without javaldx running, which requires /proc to be mounted";
-+( $^O =~ /darwin/i ) || ( -f "/proc/meminfo" ) || die "The installer cannot work without javaldx running, which requires /proc to be mounted";
-
- suck_setup ("./setup") || suck_setup ("bin/setup") || die "can't find bin/setup";
-
-Index: configure.in
-===================================================================
---- configure.in (revision 13863)
-+++ configure.in (working copy)
-@@ -589,7 +589,7 @@
- AC_CHECK_HEADER(png.h, have_png=true, have_png=false)
- AC_CHECK_HEADER(zlib.h, have_zlib=true, have_zlib=false)
-
--if test "z$with_win32" = "z"; then
-+if test "z$with_win32" = "z" -a "z`uname -s`" != "zDarwin"; then
- if test "z$enable_pam" != "zno" && ! $have_pam; then
- AC_MSG_ERROR(install pam-devel)
- fi
-@@ -716,7 +716,7 @@
- fi
- fi
- if test "$enable_gtk" != "no"; then
-- if test "z$with_win32" = "z"; then
-+ if test "z$with_win32" = "z" -a "z`uname -s`" != "zDarwin"; then
- OOO_WIDGET_FLAGS="--enable-gtk $OOO_WIDGET_FLAGS"
- widget_sets="gtk $widget_sets"
-
-@@ -896,7 +896,11 @@
-
-
- AC_MSG_CHECKING([for GNU cp])
--GNUCP=cp
-+if test "z`uname -s`" = "zDarwin"; then
-+ GNUCP=gcp
-+else
-+ GNUCP=cp
-+fi
- if test "z$with_gnu_cp" != "z"; then
- if test "z${with_gnu_cp%%/*}" = "z" ; then
- # it's an absolute path
-diff --git a/sfx2/source/layout/makefile.mk b/sfx2/source/layout/makefile.mk
-index 2ef1231..eedce24 100644
---- sfx2/source/layout/makefile.mk
-+++ sfx2/source/layout/makefile.mk
-@@ -44,11 +44,15 @@ CFLAGS += -I../$(PRJ)/toolkit/source/vclcompat
-
- # --- Files --------------------------------------------------------
-
-+.IF "$(ENABLE_LAYOUT)" == "TRUE"
-+
- SLOFILES = \
- $(SLO)$/sfxtabpage.obj \
- $(SLO)$/sfxtabdialog.obj \
- #
-
-+.ENDIF # ENABLE_LAYOUT == TRUE
-+
- # --- Tagets -------------------------------------------------------
-
- .INCLUDE : target.mk
-diff --git a/sfx2/util/makefile.mk b/sfx2/util/makefile.mk
-index ec85e9e..b987fae 100644
---- sfx2/util/makefile.mk
-+++ sfx2/util/makefile.mk
-@@ -53,7 +53,6 @@ LIB1FILES= $(SLB)$/appl.lib \
- $(SLB)$/view.lib \
- $(SLB)$/control.lib \
- $(SLB)$/notify.lib \
-- $(SLB)$/layout.lib \
- $(SLB)$/menu.lib \
- $(SLB)$/inet.lib \
- $(SLB)$/toolbox.lib \
-@@ -62,6 +61,10 @@ LIB1FILES= $(SLB)$/appl.lib \
- $(SLB)$/bastyp.lib \
- $(SLB)$/config.lib
-
-+.IF "$(ENABLE_LAYOUT)" == "TRUE"
-+LIB1FILES += $(SLB)$/layout.lib
-+.ENDIF # ENABLE_LAYOUT == TRUE
-+
- HELPIDFILES=\
- ..\inc\sfx2\sfxsids.hrc \
- ..\source\inc\helpid.hrc
diff --git a/patches/test/mono-testtools.diff b/patches/test/mono-testtools.diff
deleted file mode 100644
index 15959856a..000000000
--- a/patches/test/mono-testtools.diff
+++ /dev/null
@@ -1,163 +0,0 @@
-? testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs.origish
-? testtools/source/bridgetest/cli/mcs-failure
-? testtools/source/bridgetest/cli/mcs-failure.tar.gz
-Index: testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs
-===================================================================
-RCS file: /cvs/udk/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs,v
-retrieving revision 1.5
-diff -u -r1.5 cli_bridgetest_inprocess.cs
---- testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs 20 Sep 2004 14:27:51 -0000 1.5
-+++ testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs 11 May 2005 14:19:54 -0000
-@@ -139,26 +139,8 @@
- new uno.Any(
- typeof (XSingleComponentFactory),
- new Factory(
-- typeof (vb_testobj.VBBridgeTestObject),
-- "com.sun.star.test.bridge.cli_uno.VbTestObject" ) ) );
-- xSet.insert(
-- new uno.Any(
-- typeof (XSingleComponentFactory),
-- new Factory(
-- typeof (cpp_bridgetest.BridgeTest),
-- "com.sun.star.test.bridge.cli_uno.CppBridgeTest" ) ) );
-- xSet.insert(
-- new uno.Any(
-- typeof (XSingleComponentFactory),
-- new Factory(
- typeof (cs_testobj.BridgeTest),
- "com.sun.star.test.bridge.cli_uno.CsBridgeTest" ) ) );
-- xSet.insert(
-- new uno.Any(
-- typeof (XSingleComponentFactory),
-- new Factory(
-- typeof (vb_bridetest.BridgeTest),
-- "com.sun.star.test.bridge.cli_uno.VbBridgeTest" ) ) );
-
- // I.
- // direct unbridged test
-Index: testtools/source/bridgetest/cli/makefile.mk
-===================================================================
-RCS file: /cvs/udk/testtools/source/bridgetest/cli/makefile.mk,v
-retrieving revision 1.11
-diff -u -r1.11 makefile.mk
---- testtools/source/bridgetest/cli/makefile.mk 16 Dec 2004 12:49:01 -0000 1.11
-+++ testtools/source/bridgetest/cli/makefile.mk 11 May 2005 14:19:54 -0000
-@@ -74,10 +74,9 @@
- .INCLUDE : settings.mk
- DLLPRE =
-
--.IF "$(COM)$(COMEX)" == "MSC8" || "$(COM)$(COMEX)"=="MSC10"
-
- # ------------------------------------------------------------------
--.IF "$(GUI)"=="WNT"
-+.IF "$(GUI)"=="WINNT"
- MY_DLLPOSTFIX=.dll
- DESTDIR=$(BIN)
- BATCH_SUFFIX=.bat
-@@ -106,20 +105,20 @@
-
- #-----------------------
-
--CFLAGS += -clr -AI $(OUT)$/bin -AI $(SOLARBINDIR)
-+# CFLAGS += -clr -AI $(OUT)$/bin -AI $(SOLARBINDIR)
-
--SLOFILES= \
-- $(SLO)$/cli_cpp_bridgetest.obj
-+#SLOFILES= \
-+# $(SLO)$/cli_cpp_bridgetest.obj
-
--SHL1OBJS = $(SLOFILES)
-+#SHL1OBJS = $(SLOFILES)
-
--SHL1TARGET = $(TARGET)
-+#SHL1TARGET = $(TARGET)
-
--SHL1STDLIBS = \
-- mscoree.lib
-+#SHL1STDLIBS = \
-+# mscoree.lib
-
--SHL1DEF = $(MISC)$/$(SHL1TARGET).def
--DEF1NAME = $(SHL1TARGET)
-+#SHL1DEF = $(MISC)$/$(SHL1TARGET).def
-+#DEF1NAME = $(SHL1TARGET)
-
-
- # --- Targets ------------------------------------------------------
-@@ -136,7 +135,7 @@
- CLI_CPPUHELPER = $(SOLARBINDIR)$/cli_cppuhelper.dll
- CLI_TYPES_BRIDGETEST = $(BIN)$/cli_types_bridgetest.dll
-
--CSCFLAGS = -warnaserror+ -incremental-
-+CSCFLAGS = -incremental-
- VBC_FLAGS = -warnaserror+
- .IF "$(debug)" != ""
- CSCFLAGS += -debug+ -checked+ -define:DEBUG -define:TRACE
-@@ -158,7 +157,7 @@
- -reference:$(CLI_TYPES_BRIDGETEST) \
- -reference:$(CLI_URE) \
- -reference:$(CLI_BASETYPES) \
-- -reference:$(CLI_TYPES) \
-+ -reference:$(CLI_TYPES) \
- cli_cs_testobj.cs cli_cs_multi.cs
-
- $(DESTDIR)$/cli_cs_bridgetest.uno.dll : \
-@@ -214,9 +213,6 @@
- cli_bridgetest_inprocess.cs \
- $(DESTDIR)$/cli_cs_bridgetest.uno.dll \
- $(DESTDIR)$/cli_cs_testobj.uno.dll \
-- $(DESTDIR)$/cli_vb_bridgetest.uno.dll \
-- $(DESTDIR)$/cli_vb_testobj.uno.dll \
-- $(DESTDIR)$/cli_cpp_bridgetest.uno.dll \
- $(CLI_BASETYPES) \
- $(CLI_TYPES) \
- $(CLI_URE) \
-@@ -229,9 +225,6 @@
- -reference:$(CLI_CPPUHELPER) \
- -reference:$(DESTDIR)$/cli_cs_bridgetest.uno.dll \
- -reference:$(DESTDIR)$/cli_cs_testobj.uno.dll \
-- -reference:$(DESTDIR)$/cli_vb_bridgetest.uno.dll \
-- -reference:$(DESTDIR)$/cli_vb_testobj.uno.dll \
-- -reference:$(DESTDIR)$/cli_cpp_bridgetest.uno.dll \
- cli_bridgetest_inprocess.cs
- $(GNUCOPY) -p cli_bridgetest_inprocess.ini $(DESTDIR)
- $(GNUCOPY) -p $(CLI_CPPUHELPER) $(DESTDIR)$/$(CLI_CPPUHELPER:f)
-@@ -239,5 +232,4 @@
- $(GNUCOPY) -p $(CLI_TYPES) $(DESTDIR)$/$(CLI_TYPES:f)
- $(GNUCOPY) -p $(CLI_URE) $(DESTDIR)$/$(CLI_URE:f)
-
--.ENDIF
-
-Index: testtools/source/bridgetest/idl/makefile.mk
-===================================================================
-RCS file: /cvs/udk/testtools/source/bridgetest/idl/makefile.mk,v
-retrieving revision 1.4
-diff -u -r1.4 makefile.mk
---- testtools/source/bridgetest/idl/makefile.mk 20 Aug 2004 09:16:39 -0000 1.4
-+++ testtools/source/bridgetest/idl/makefile.mk 11 May 2005 14:19:54 -0000
-@@ -81,7 +81,6 @@
- + $(RM) $@
- $(REGMERGE) $@ /UCR $(MISC)$/$(TARGET)$/bridgetest.urd
-
--.IF "$(GUI)" == "WNT"
-
- CLIMAKERFLAGS =
- .IF "$(debug)" != ""
-@@ -97,4 +96,3 @@
- -X $(SOLARBINDIR)$/types.rdb $<
- $(TOUCH) $@
-
--.ENDIF # GUI, WNT
-Index: testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini
-===================================================================
-RCS file: /cvs/udk/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini,v
-retrieving revision 1.2
-diff -u -r1.2 cli_bridgetest_inprocess.ini
---- testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini 4 Sep 2003 09:16:51 -0000 1.2
-+++ testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini 11 May 2005 17:00:06 -0000
-@@ -1,3 +1,3 @@
- [Bootstrap]
--UNO_TYPES=$SYSBINDIR/uno_types.rdb
--UNO_SERVICES=$SYSBINDIR/uno_services.rdb
-+UNO_TYPES=uno_types.rdb
-+UNO_SERVICES=uno_services.rdb
diff --git a/patches/test/ms-interoperability-email-attachment-as-doc-xls-ppt-m99-v2.diff b/patches/test/ms-interoperability-email-attachment-as-doc-xls-ppt-m99-v2.diff
deleted file mode 100644
index c00d19a05..000000000
--- a/patches/test/ms-interoperability-email-attachment-as-doc-xls-ppt-m99-v2.diff
+++ /dev/null
@@ -1,602 +0,0 @@
-Index: sfx2/source/inc/mailmodel.hxx
-===================================================================
-RCS file: /cvs/framework/sfx2/source/inc/mailmodel.hxx,v
-retrieving revision 1.4
-diff -u -p -r1.4 mailmodel.hxx
---- sfx2/source/inc/mailmodel.hxx 7 Sep 2005 19:06:14 -0000 1.4
-+++ sfx2/source/inc/mailmodel.hxx 21 Feb 2006 12:29:11 -0000
-@@ -87,8 +87,7 @@ private:
-
- void ClearList( AddressList_Impl* pList );
- void MakeValueList( AddressList_Impl* pList, String& rValueList );
-- SaveResult SaveDocument( String& rFileName, String& rType );
-- SaveResult SaveDocAsPDF( String& rFileName, String& rType );
-+ SaveResult SaveDocumentAsFormat( String& rFileName, String& rType, const String& rFilter );
-
- DECL_LINK( DoneHdl, void* );
-
-@@ -108,7 +107,7 @@ public:
- void SetSubject( const String& rSubject ) { maSubject = rSubject; }
- void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
-
-- SendMailResult Send( MailDocType );
-+ SendMailResult Send( const String& rFilter );
- };
-
- BOOL CreateFromAddress_Impl( String& rFrom );
-Index: sfx2/source/dialog/mailmodel.cxx
-===================================================================
-RCS file: /cvs/framework/sfx2/source/dialog/mailmodel.cxx,v
-retrieving revision 1.37
-diff -u -p -r1.37 mailmodel.cxx
---- sfx2/source/dialog/mailmodel.cxx 7 Sep 2005 18:23:34 -0000 1.37
-+++ sfx2/source/dialog/mailmodel.cxx 21 Feb 2006 12:29:26 -0000
-@@ -243,9 +243,11 @@ void SfxMailModel_Impl::MakeValueList( A
- }
- }
-
--SfxMailModel_Impl::SaveResult SfxMailModel_Impl::SaveDocument( String& rFileName, String& rType )
-+SfxMailModel_Impl::SaveResult SfxMailModel_Impl::SaveDocumentAsFormat( String& rFileName, String& rType, const String& rFilter )
- {
- SaveResult eRet = SAVE_CANCELLED;
-+ bool bSaveAs = ( rFilter.Len() > 0 );
-+
- SfxViewFrame* pTopViewFrm = mpBindings->GetDispatcher_Impl()->GetFrame()->GetTopViewFrame();
- SfxObjectShellRef xDocShell = pTopViewFrm->GetObjectShell();
-
-@@ -256,7 +258,15 @@ SfxMailModel_Impl::SaveResult SfxMailMod
- BOOL bModified = xDocShell->IsModified();
-
- // detect filter
-- const SfxFilter* pFilter = xDocShell->GetMedium()->GetFilter();
-+ String sFactoryShortName = String::CreateFromAscii(xDocShell->GetFactory().GetShortName());
-+ String sFactoryLongName = SfxObjectShell::GetServiceNameFromFactory(sFactoryShortName);
-+ SfxFilterMatcher aMatcher( sFactoryShortName );
-+
-+ const SfxFilter* pFilter = NULL;
-+ if ( bSaveAs )
-+ pFilter = aMatcher.GetFilter4FilterName( rFilter );
-+ else
-+ pFilter = xDocShell->GetMedium()->GetFilter();
- sal_Bool bHasFilter = pFilter ? sal_True : sal_False;
- if ( !pFilter )
- {
-@@ -280,6 +290,8 @@ SfxMailModel_Impl::SaveResult SfxMailMod
- String aName;
- if ( aFileObj.hasExtension() )
- {
-- pExt = new String( String::CreateFromAscii( "." ) + (OUString) aFileObj.getExtension() );
-+ if ( !bSaveAs ) // Only use extension in NOT save in another
-+ // Format
-+ pExt = new String( String::CreateFromAscii( "." ) + (OUString) aFileObj.getExtension() );
- aFileObj.removeExtension();
- aLeadingStr = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
-@@ -305,7 +313,7 @@ SfxMailModel_Impl::SaveResult SfxMailMod
-
- rFileName = aTempFile.GetURL();
-
-- if ( bModified || !xDocShell->HasName() )
-+ if ( bModified || !xDocShell->HasName() || bSaveAs )
- {
- // prepare for mail export
- SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher();
-@@ -488,92 +496,6 @@ const SfxFilter* impl_getPDFFilterForDoc
- return 0;
- }
-
--SfxMailModel_Impl::SaveResult SfxMailModel_Impl::SaveDocAsPDF( String& rFileName, String& rType )
--{
-- SaveResult eRet = SAVE_CANCELLED;
-- SfxViewFrame* pTopViewFrm = mpBindings->GetDispatcher_Impl()->GetFrame()->GetTopViewFrame();
-- SfxObjectShellRef xDocShell = pTopViewFrm->GetObjectShell();
--
-- // save the document
-- if ( xDocShell.Is() && xDocShell->GetMedium() )
-- {
-- // save old settings
-- BOOL bModified = xDocShell->IsModified();
-- // prepare for mail export
-- SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher();
-- pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON );
--
-- // Get PDF Filter from document
-- String sFactoryShortName = String::CreateFromAscii(xDocShell->GetFactory().GetShortName());
-- String sFactoryLongName = SfxObjectShell::GetServiceNameFromFactory(sFactoryShortName);
-- SfxFilterMatcher aMatcher( sFactoryShortName );
-- String aPDFExtension = String::CreateFromAscii( "pdf" ); // Extension without dot!
--
-- const SfxFilter* pFilter = impl_getPDFFilterForDoc( sFactoryLongName, aMatcher);
-- sal_Bool bHasFilter = pFilter ? sal_True : sal_False;
--
-- // create temp file name with leading chars and extension
-- sal_Bool bHasName = xDocShell->HasName();
-- String aLeadingStr;
-- String* pExt = NULL;
--
-- if ( !bHasName )
-- aLeadingStr = String( DEFINE_CONST_UNICODE("noname") );
-- else
-- {
-- INetURLObject aFileObj = xDocShell->GetMedium()->GetURLObject();
-- String aName;
-- if ( aFileObj.hasExtension() )
-- {
-- pExt = new String( String::CreateFromAscii( "." ) + (OUString)aPDFExtension );
-- aFileObj.removeExtension();
-- aLeadingStr = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
-- aLeadingStr += String::CreateFromAscii( "_" );
-- }
-- else
-- {
-- aLeadingStr = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
-- aLeadingStr += String::CreateFromAscii( "_" );
-- }
-- }
--
-- if ( pFilter && !pExt )
-- {
-- pExt = new String( pFilter->GetWildcard()().GetToken(0) );
-- // erase the '*' from the extension (e.g. "*.sdw")
-- pExt->Erase( 0, 1 );
-- }
--
-- ::utl::TempFile aTempFile( aLeadingStr, pExt );
-- delete pExt;
--
-- rFileName = aTempFile.GetURL();
--
-- // save document to temp file
-- SfxStringItem aFileName( SID_FILE_NAME, rFileName );
-- const SfxBoolItem *pRet = (const SfxBoolItem*)pDisp->Execute( SID_EXPORTDOCASPDF, SFX_CALLMODE_SYNCHRON, &aFileName, 0L );
-- BOOL bRet = pRet ? pRet->GetValue() : FALSE;
-- eRet = bRet ? SAVE_SUCCESSFULL : SAVE_CANCELLED;
--
-- if ( pFilter )
-- {
-- // detect content type and expand with the file name
-- rType = pFilter->GetMimeType();
-- rType += DEFINE_CONST_UNICODE("; name =\"");
-- INetURLObject aFileObj = xDocShell->GetMedium()->GetURLObject();
-- rType += String(aFileObj.getName( INetURLObject::LAST_SEGMENT,
-- true, INetURLObject::DECODE_WITH_CHARSET ));
-- rType += '\"';
-- }
--
-- // restore old settings
-- if ( !bModified && xDocShell->IsEnableSetModified() )
-- xDocShell->SetModified( FALSE );
-- }
--
-- return eRet;
--}
--
- IMPL_LINK_INLINE_START( SfxMailModel_Impl, DoneHdl, void*, EMPTYARG )
- {
- mbLoadDone = sal_True;
-@@ -644,17 +566,14 @@ void SfxMailModel_Impl::AddAddress( cons
- }
- }
-
--SfxMailModel_Impl::SendMailResult SfxMailModel_Impl::Send( MailDocType eMailDocType )
-+SfxMailModel_Impl::SendMailResult SfxMailModel_Impl::Send( const String& rFilterName )
- {
- SaveResult eSaveResult;
- SendMailResult eResult = SEND_MAIL_ERROR;
- String aFileName, aContentType;
-
- sal_Bool bSuccessfull = sal_False;
-- if ( eMailDocType == TYPE_SELF )
-- eSaveResult = SaveDocument( aFileName, aContentType );
-- else
-- eSaveResult = SaveDocAsPDF( aFileName, aContentType );
-+ eSaveResult = SaveDocumentAsFormat( aFileName, aContentType, rFilterName );
-
- if ( eSaveResult == SAVE_SUCCESSFULL )
- {
-Index: sfx2/source/view/viewsh.cxx
-===================================================================
-RCS file: /cvs/framework/sfx2/source/view/viewsh.cxx,v
-retrieving revision 1.58
-diff -u -p -r1.58 viewsh.cxx
---- sfx2/source/view/viewsh.cxx 7 Feb 2006 10:29:45 -0000 1.58
-+++ sfx2/source/view/viewsh.cxx 21 Feb 2006 12:31:04 -0000
-@@ -160,7 +160,6 @@ void SfxViewShell::ExecMisc_Impl( SfxReq
-
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-- case SID_MAIL_SENDDOCASPDF:
- case SID_MAIL_SENDDOC:
- {
- SfxObjectShell* pDoc = GetObjectShell();
-@@ -192,10 +191,12 @@ void SfxViewShell::ExecMisc_Impl( SfxReq
- }
-
- SfxMailModel_Impl::SendMailResult eResult = SfxMailModel_Impl::SEND_MAIL_ERROR;
-- if ( nId == SID_MAIL_SENDDOCASPDF )
-- eResult = aModel.Send( SfxMailModel_Impl::TYPE_ASPDF );
-- else
-- eResult = aModel.Send( SfxMailModel_Impl::TYPE_SELF );
-+ String sFilterName;
-+ SFX_REQUEST_ARG(rReq, pFilterName, SfxStringItem, SID_FILTER_NAME, FALSE );
-+ if ( pFilterName )
-+ sFilterName = pFilterName->GetValue();
-+
-+ eResult = aModel.Send( sFilterName );
-
- if ( eResult == SfxMailModel_Impl::SEND_MAIL_ERROR )
- {
-@@ -314,7 +316,6 @@ void SfxViewShell::GetState_Impl( SfxIte
- }
-
- // Mail-Funktionen
-- case SID_MAIL_SENDDOCASPDF:
- case SID_MAIL_SENDDOC:
- {
- BOOL bEnable = !GetViewFrame()->HasChildWindow( SID_MAIL_CHILDWIN );
-Index: sc/uiconfig/scalc/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/sc/sc/uiconfig/scalc/menubar/menubar.xml,v
-retrieving revision 1.21
-diff -u -p -r1.21 menubar.xml
---- sc/uiconfig/scalc/menubar/menubar.xml 16 Nov 2005 10:15:26 -0000 1.21
-+++ sc/uiconfig/scalc/menubar/menubar.xml 21 Feb 2006 12:34:02 -0000
-@@ -21,7 +21,8 @@
- <menu:menu menu:id=".uno:SendTo" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=calc_pdf_Export" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=MS Excel 95" menu:helpid="6707" menu:label="" />
- </menu:menupopup>
- </menu:menu>
- <menu:menuseparator/>
-Index: sw/uiconfig/sglobal/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/sw/sw/uiconfig/sglobal/menubar/menubar.xml,v
-retrieving revision 1.19
-diff -u -p -r1.19 menubar.xml
---- sw/uiconfig/sglobal/menubar/menubar.xml 16 Nov 2005 09:54:22 -0000 1.19
-+++ sw/uiconfig/sglobal/menubar/menubar.xml 21 Feb 2006 12:34:24 -0000
-@@ -21,7 +21,7 @@
- <menu:menu menu:id=".uno:SendToMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=writer_globaldocument_pdf_Export" menu:helpid="6672" menu:label="" />
- <menu:menuseparator/>
- <menu:menuitem menu:id=".uno:NewGlobalDoc" menu:helpid="20004" menu:label="" />
- <menu:menuitem menu:id=".uno:NewHtmlDoc" menu:helpid="20040" menu:label="" />
-Index: sw/uiconfig/sweb/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/sw/sw/uiconfig/sweb/menubar/menubar.xml,v
-retrieving revision 1.18
-diff -u -p -r1.18 menubar.xml
---- sw/uiconfig/sweb/menubar/menubar.xml 16 Nov 2005 09:55:48 -0000 1.18
-+++ sw/uiconfig/sweb/menubar/menubar.xml 21 Feb 2006 12:34:39 -0000
-@@ -18,7 +18,7 @@
- <menu:menu menu:id=".uno:SendToMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=writer_web_pdf_Export" menu:helpid="6672" menu:label="" />
- </menu:menupopup>
- </menu:menu>
- <menu:menuseparator/>
-Index: sw/uiconfig/swriter/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/sw/sw/uiconfig/swriter/menubar/menubar.xml,v
-retrieving revision 1.20
-diff -u -p -r1.20 menubar.xml
---- sw/uiconfig/swriter/menubar/menubar.xml 16 Nov 2005 09:57:09 -0000 1.20
-+++ sw/uiconfig/swriter/menubar/menubar.xml 21 Feb 2006 12:34:45 -0000
-@@ -21,7 +21,9 @@
- <menu:menu menu:id=".uno:SendToMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=writer_pdf_Export" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=MS WinWord 6.0" menu:helpid="6707" menu:label="" />
-+
- <menu:menuseparator/>
- <menu:menuitem menu:id=".uno:NewGlobalDoc" menu:helpid="20004" menu:label="" />
- <menu:menuitem menu:id=".uno:NewHtmlDoc" menu:helpid="20040" menu:label="" />
-Index: sd/uiconfig/sdraw/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/graphics/sd/uiconfig/sdraw/menubar/menubar.xml,v
-retrieving revision 1.22
-diff -u -p -r1.22 menubar.xml
---- sd/uiconfig/sdraw/menubar/menubar.xml 16 Nov 2005 09:23:48 -0000 1.22
-+++ sd/uiconfig/sdraw/menubar/menubar.xml 21 Feb 2006 12:35:10 -0000
-@@ -21,7 +21,7 @@
- <menu:menu menu:id=".uno:SendMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?Filtername:string=draw_pdf_Export" menu:helpid="6672" menu:label="" />
- </menu:menupopup>
- </menu:menu>
- <menu:menuseparator/>
-Index: sd/uiconfig/simpress/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/graphics/sd/uiconfig/simpress/menubar/menubar.xml,v
-retrieving revision 1.24
-diff -u -p -r1.24 menubar.xml
---- sd/uiconfig/simpress/menubar/menubar.xml 16 Nov 2005 09:25:04 -0000 1.24
-+++ sd/uiconfig/simpress/menubar/menubar.xml 21 Feb 2006 12:35:18 -0000
-@@ -21,7 +21,8 @@
- <menu:menu menu:id=".uno:SendMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=impress_pdf_Export" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=MS PowerPoint 97" menu:helpid="6706" menu:label="" />
- </menu:menupopup>
- </menu:menu>
- <menu:menuseparator/>
-Index: starmath/uiconfig/smath/menubar/menubar.xml
-===================================================================
-RCS file: /cvs/sw/starmath/uiconfig/smath/menubar/menubar.xml,v
-retrieving revision 1.11
-diff -u -p -r1.11 menubar.xml
---- starmath/uiconfig/smath/menubar/menubar.xml 9 Sep 2004 16:32:46 -0000 1.11
-+++ starmath/uiconfig/smath/menubar/menubar.xml 21 Feb 2006 12:35:47 -0000
-@@ -20,7 +20,7 @@
- <menu:menu menu:id=".uno:SendToMenu" menu:label="" >
- <menu:menupopup>
- <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
-- <menu:menuitem menu:id=".uno:SendMailDocAsPDF" menu:helpid="6672" menu:label="" />
-+ <menu:menuitem menu:id=".uno:SendMail?FilterName:string=math_pdf_Export" menu:helpid="6672" menu:label="" />
- </menu:menupopup>
- </menu:menu>
- <menu:menuseparator/>
-Index: officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-===================================================================
-RCS file: /cvs/util/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu,v
-retrieving revision 1.14
-diff -u -p -r1.14 CalcCommands.xcu
---- officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 15 Mar 2005 12:42:05 -0000 1.14
-+++ officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 21 Feb 2006 12:37:57 -0000
-@@ -1498,6 +1503,11 @@
- <value xml:lang="en-US">Sen~d</value>
- </prop>
- </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=MS Excel 95" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="en-US">Document as MS-E~xcel Attachment...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:ProtectMenu" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="de">Dokument sch~ützen</value>
-Index: officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
-===================================================================
-RCS file: /cvs/util/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu,v
-retrieving revision 1.16
-diff -u -p -r1.16 DrawImpressCommands.xcu
---- officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu 21 Feb 2005 12:09:26 -0000 1.16
-+++ officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu 21 Feb 2006 12:37:57 -0000
-@@ -1737,6 +1737,11 @@
- <value xml:lang="en-US">Styl~es</value>
- </prop>
- </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=MS PowerPoint 97" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="en-US">Document as MS-~PPT Attachment...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:SnapLinesMenu" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="de">Führungslinien</value>
-Index: officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
-===================================================================
-RCS file: /cvs/util/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu,v
-retrieving revision 1.46
-diff -u -p -r1.46 GenericCommands.xcu
---- officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 21 Dec 2005 16:12:15 -0000 1.46
-+++ officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 21 Feb 2006 12:37:58 -0000
-@@ -4516,12 +4516,6 @@
- <value xml:lang="en-US">Stop Recording</value>
- </prop>
- </node>
-- <node oor:name=".uno:SendMailDocAsPDF" oor:op="replace">
-- <prop oor:name="Label" oor:type="xs:string">
-- <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-- <value xml:lang="en-US">Document as P~DF Attachment...</value>
-- </prop>
-- </node>
- <node oor:name=".uno:ExportToPDF" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="de">Exportieren als ~PDF...</value>
-@@ -5241,6 +5235,42 @@
- <value>1</value>
- </prop>
- </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=writer_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=calc_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=impress_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=writer_web_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=math_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=writer_globaldocument_pdf_Export" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">Dokument als PD~F-Anhang...</value>
-+ <value xml:lang="en-US">Document as P~DF Attachment...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:SendMail" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="de">Dokument als ~E-Mail...</value>
-Index: officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
-===================================================================
-RCS file: /cvs/util/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu,v
-retrieving revision 1.22
-diff -u -p -r1.22 WriterCommands.xcu
---- officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 16 Nov 2005 09:16:29 -0000 1.22
-+++ officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 21 Feb 2006 12:37:59 -0000
-@@ -791,6 +791,11 @@
- <value>1</value>
- </prop>
- </node>
-+ <node oor:name=".uno:SendMail?FilterName:string=MS WinWord 6.0" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="en-US">Document as MS-~Doc Attachment...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:SendOutlineToClipboard" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="de">Gliederung zur Zwis~chenablage</value>
-Index: sfx2/sdi/sfx.sdi
-===================================================================
-RCS file: /cvs/framework/sfx2/sdi/sfx.sdi,v
-retrieving revision 1.69
-diff -u -p -r1.69 sfx.sdi
---- sfx2/sdi/sfx.sdi 3 Nov 2005 12:05:03 -0000 1.69
-+++ sfx2/sdi/sfx.sdi 21 Feb 2006 12:53:09 -0000
-@@ -6369,34 +6369,7 @@ SfxVoidItem SendFax FN_FAX
-
- //--------------------------------------------------------------------------
- SfxBoolItem SendMail SID_MAIL_SENDDOC
--(SfxStringItem Recipient SID_MAIL_RECIPIENT,SfxStringItem Subject SID_MAIL_SUBJECT,SfxStringItem MailText SID_MAIL_TEXT,SfxUInt16Item Priority SID_MAIL_PRIORITY,SfxBoolItem AttachedDoc SID_MAIL_ATTACH,SfxStringItem AttachFiles SID_MAIL_ATTACH_FILE)
--[
-- /* flags: */
-- AutoUpdate = FALSE,
-- Cachable = Cachable,
-- FastCall = FALSE,
-- HasCoreId = FALSE,
-- HasDialog = TRUE,
-- ReadOnlyDoc = TRUE,
-- Toggle = FALSE,
-- Container = TRUE,
-- RecordAbsolute = FALSE,
-- RecordPerSet;
-- Asynchron;
--
-- /* status: */
-- SlotType = SfxStringItem
--
-- /* config: */
-- AccelConfig = TRUE,
-- MenuConfig = TRUE,
-- StatusBarConfig = FALSE,
-- ToolBoxConfig = TRUE,
-- GroupId = GID_DOCUMENT;
--]
--
--SfxBoolItem SendMailDocAsPDF SID_MAIL_SENDDOCASPDF
--(SfxStringItem Recipient SID_MAIL_RECIPIENT,SfxStringItem Subject SID_MAIL_SUBJECT,SfxStringItem MailText SID_MAIL_TEXT,SfxUInt16Item Priority SID_MAIL_PRIORITY,SfxBoolItem AttachedDoc SID_MAIL_ATTACH,SfxStringItem AttachFiles SID_MAIL_ATTACH_FILE)
-+(SfxStringItem Recipient SID_MAIL_RECIPIENT,SfxStringItem Subject SID_MAIL_SUBJECT,SfxStringItem MailText SID_MAIL_TEXT,SfxUInt16Item Priority SID_MAIL_PRIORITY,SfxBoolItem AttachedDoc SID_MAIL_ATTACH,SfxStringItem AttachFiles SID_MAIL_ATTACH_FILE, SfxStringItem FilterName SID_FILTER_NAME)
- [
- /* flags: */
- AutoUpdate = FALSE,
-Index: sfx2/sdi/viwslots.sdi
-===================================================================
-RCS file: /cvs/framework/sfx2/sdi/viwslots.sdi,v
-retrieving revision 1.4
-diff -u -p -r1.4 viwslots.sdi
---- sfx2/sdi/viwslots.sdi 26 Aug 2002 07:32:06 -0000 1.4
-+++ sfx2/sdi/viwslots.sdi 21 Feb 2006 12:53:09 -0000
-@@ -17,11 +17,6 @@ interface View : Object
- ExecMethod = ExecMisc_Impl ;
- StateMethod = GetState_Impl ;
- ]
-- SID_MAIL_SENDDOCASPDF // ole(no) api(todo)
-- [
-- ExecMethod = ExecMisc_Impl ;
-- StateMethod = GetState_Impl ;
-- ]
- //---------------------------------------------------------------------
- SID_PRINTDOC // ole(no) api(play/rec)
- [
-Index: sfx2/inc/sfxsids.hrc
-===================================================================
-RCS file: /cvs/framework/sfx2/inc/sfxsids.hrc,v
-retrieving revision 1.83
-diff -u -p -r1.83 sfxsids.hrc
---- sfx2/inc/sfxsids.hrc 23 Sep 2005 15:13:44 -0000 1.83
-+++ sfx2/inc/sfxsids.hrc 21 Feb 2006 12:57:21 -0000
-@@ -122,7 +122,6 @@
- #define SID_MAIL_OPEN (SID_SFX_START + 329)
- #define SID_MAIL_NOTIFY (SID_SFX_START + 330)
- #define SID_MAIL_SENDDOC (SID_SFX_START + 331)
--#define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672)
-
-
- #define SID_MAIL_RECIPIENT (SID_SFX_START + 334)
---- svx/inc/globlmn_tmpl.hrc 2006-02-21 14:32:33.000000000 +0000
-+++ svx.patch/inc/globlmn_tmpl.hrc 2006-02-21 21:06:12.000000000 +0000
-@@ -555,14 +555,6 @@
- Text [ en-US ] = "Document as ~E-mail..." ; \
- Text [ x-comment ] = " "; \
-
--#define ITEM_FILE_MAIL_SENDDOCASPDF \
-- Identifier = SID_MAIL_SENDDOCASPDF ; \
-- Command = ".uno:SendMailDocAsPDF" ; \
-- HelpID = SID_MAIL_SENDDOCASPDF ; \
-- Text [ de ] = "Dokument als PD~F-Anhang..." ; \
-- Text [ en-US ] = "Document as P~DF Attachment..." ; \
--
--
- #define ITEM_FILE_QUITAPP \
- Identifier = SID_QUITAPP ; \
- Command = ".uno:Quit" ; \
---- sd/source/ui/app/menuids2_tmpl.src 2006-02-21 21:38:21.000000000 +0000
-+++ sd.patch/source/ui/app/menuids2_tmpl.src 2006-02-21 21:39:30.000000000 +0000
-@@ -102,11 +102,6 @@
- Text [ en-US ] = "Sen~d" ; \
- SubMenu = Menu\
- {\
-- ItemList = \
-- {\
-- MI ( ITEM_FILE_MAIL_SENDDOC ) \
-- MI ( ITEM_FILE_MAIL_SENDDOCASPDF ) \
-- };\
- };\
- };
-
---- sw/sdi/wviewsh.sdi 2005-09-09 03:44:55.000000000 +0100
-+++ sw.patched/sdi/wviewsh.sdi 2006-02-22 09:34:32.000000000 +0000
-@@ -176,10 +176,6 @@ interface WebSourceView : View
- [
- StateMethod = GetState ;
- ]
-- SID_MAIL_SENDDOCASPDF
-- [
-- StateMethod = GetState ;
-- ]
- SID_EXPORTDOC
- [
- StateMethod = GetState ;
---- sw/source/ui/uiview/srcview.cxx 2006-02-10 14:53:13.000000000 +0000
-+++ sw.patched/source/ui/uiview/srcview.cxx 2006-02-22 09:39:58.000000000 +0000
-@@ -710,7 +710,6 @@ void SwSrcView::GetState(SfxItemSet& rSe
- }
- }
- break;
-- case SID_MAIL_SENDDOCASPDF:
- case SID_MAIL_SENDDOC :
- case SID_EXPORTDOCASPDF:
- case SID_DIRECTEXPORTDOCASPDF:
diff --git a/patches/test/myspell-shrink.diff b/patches/test/myspell-shrink.diff
deleted file mode 100644
index ecf0324b6..000000000
--- a/patches/test/myspell-shrink.diff
+++ /dev/null
@@ -1,406 +0,0 @@
-Index: lingucomponent/source/spellcheck/myspell/hashmgr.cxx
-===================================================================
-RCS file: /cvs/whiteboard/lingucomponent/source/spellcheck/myspell/hashmgr.cxx,v
-retrieving revision 1.9
-diff -u -r1.9 hashmgr.cxx
---- lingucomponent/source/spellcheck/myspell/hashmgr.cxx 25 Feb 2004 14:07:47 -0000 1.9
-+++ lingucomponent/source/spellcheck/myspell/hashmgr.cxx 17 Jun 2005 10:43:17 -0000
-@@ -6,11 +6,26 @@
-
- #include "hashmgr.hxx"
-
-+#ifdef SMALL
-+# include <sys/mman.h>
-+# include <sys/types.h>
-+# include <sys/stat.h>
-+# include <unistd.h>
-+# include <errno.h>
-+# include <fcntl.h>
-+# define IS_END(c) ((c) == '\r' || (c) == '\n')
-+#endif
-+
- extern void mychomp(char * s);
- extern char * mystrdup(const char *);
-
- using namespace std;
-
-+#ifdef SMALL
-+# define WORD_END_CONDITN(c) ((c) == 0 || (c) == '/')
-+#else
-+# define WORD_END_CONDITN(c) ((c) == 0)
-+#endif
-
- // build a hash table from a munched word list
-
-@@ -28,11 +43,22 @@
- }
- tablesize = 0;
- }
-+#ifdef SMALL
-+ compat.wlen = 0;
-+ compat.alen = 0;
-+ compat.word = NULL;
-+ compat.astr = NULL;
-+ compat.next = NULL;
-+ fd = -1;
-+ length = 0;
-+ buffer = NULL;
-+#endif
- }
-
-
- HashMgr::~HashMgr()
- {
-+#ifndef SMALL
- if (tableptr) {
- // now pass through hash table freeing up everything
- // go through column by column of the table
-@@ -54,6 +80,25 @@
- }
- free(tableptr);
- }
-+#else // SMALL
-+#ifdef UNX
-+ if (fd != -1)
-+ {
-+ if (buffer)
-+ munmap (buffer, length);
-+ close (fd);
-+ }
-+ else
-+#endif
-+ {
-+ if (buffer)
-+ free (buffer);
-+ }
-+ delete[] compat.word;
-+
-+ buffer = NULL;
-+ fd = -1;
-+#endif
- tablesize = 0;
- }
-
-@@ -63,6 +108,7 @@
-
- struct hentry * HashMgr::lookup(const char *word) const
- {
-+#ifndef SMALL
- struct hentry * dp;
- if (tableptr) {
- dp = &tableptr[hash(word)];
-@@ -72,12 +118,30 @@
- }
- }
- return NULL;
-+#else
-+ const char *hash_str;
-+ int hash_id = hash(word);
-+ while ((hash_str = tableptr[hash_id%tablesize]) != NULL)
-+ {
-+ int i;
-+ for (i = 0; (word[i] != '\0' && !IS_END(hash_str[i]) &&
-+ hash_str[i] != '/' && word[i] == hash_str[i]); i++)
-+ ;
-+ if (word[i] == '\0' && (IS_END(hash_str[i]) || hash_str[i] == '/'))
-+ return ((HashMgr*)this)->setup_hentry (hash_str);
-+ hash_id++;
-+ }
-+ fprintf( stderr, "No instance of '%s' hashid 0x%x\n", word, hash(word) );
-+ return NULL;
-+#endif
- }
-
-
-
- // add a word to the hash table (private)
-
-+#ifndef SMALL
-+
- int HashMgr::add_word(const char * word, int wl, const char * aff, int al)
- {
- int i = hash(word);
-@@ -107,11 +171,48 @@
- return 0;
- }
-
-+#else
-
-+struct hentry *HashMgr::setup_hentry(const char *ptr)
-+{
-+ int i;
-+ const char *end;
-+ for ( i = 0; !IS_END(ptr[i]); i++);
-+// FIXME: could/should have a member/buffer to save this for
-+// the common/short-string case
-+ delete[] compat.word;
-+ compat.word = new char[ i + 1 ];
-+ compat.wlen = i;
-+ compat.astr = NULL;
-+ compat.alen = 0;
-+ for (i = 0; !IS_END(ptr[i]) != '/'; i++) {
-+ compat.word[i] = ptr[i];
-+ if (ptr[i] == '/') {
-+ compat.word[i] = '\0';
-+ compat.wlen = i;
-+ compat.astr = compat.word + i + 1;
-+ }
-+ }
-+ compat.word[i] = '\0';
-+ if (compat.astr)
-+ compat.alen = i - compat.wlen - 1;
-+ fprintf( stderr, "Hit '%s' ('%s')\n", compat.word, compat.astr );
-+
-+ return &compat;
-+}
-+#endif
-
- // walk the hash table entry by entry - null at end
- struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const
- {
-+#ifdef SMALL
-+ if (col < 0)
-+ col = -1;
-+ while (col < tablesize && !tableptr[++col]);
-+ if (col < tablesize)
-+ return ((HashMgr *)this)->setup_hentry(tableptr[col]);
-+ return NULL;
-+#else
- //reset to start
- if ((col < 0) || (hp == NULL)) {
- col = -1;
-@@ -133,14 +234,129 @@
- col = -1;
- }
- return hp;
-+#endif
- }
-
-
-
- // load a munched word list and build a hash table on the fly
-+#ifdef SMALL
-+int
-+HashMgr::slurp( int fd, size_t bytes )
-+{
-+ size_t offset = 0;
-+ ssize_t count;
-+ do
-+ {
-+ count = read (fd, buffer + offset, bytes);
-+ if (count < 0)
-+ {
-+ if (errno == EINTR)
-+ continue;
-+ else
-+ return 1;
-+ }
-+ bytes -= count;
-+ offset += count;
-+ }
-+ while (bytes > 0);
-+}
-
-+size_t
-+HashMgr::seek_newline( size_t i )
-+{
-+ while (i < length && !IS_END(buffer[i])) i++;
-+ while (i < length && IS_END(buffer[i])) i++;
-+ return i;
-+}
-+
-+#endif
- int HashMgr::load_tables(const char * tpath)
- {
-+#ifdef SMALL
-+#define HASH_DEBUG
-+
-+#ifdef HASH_DEBUG
-+ fprintf( stderr, "Load tables from '%s'\n", tpath );
-+#endif
-+ fd = open (tpath, O_RDONLY);
-+ if (fd < 0)
-+ return 1;
-+ struct stat info;
-+ if (fstat(fd, &info) < 0)
-+ return 1;
-+#ifdef UNX
-+ length = info.st_size;
-+ if (buffer = (char *)mmap (NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0))
-+ ;
-+ else
-+#endif
-+ {
-+ buffer = new char[ length ];
-+ int failed = slurp (fd, length);
-+ close (fd);
-+ fd = -1;
-+ if (failed)
-+ {
-+ delete buffer;
-+ return 1;
-+ }
-+ }
-+ if (!buffer)
-+ return 1;
-+ size_t second_line = seek_newline (0);
-+ char *str = new char [ second_line + 1 ];
-+ memcpy (str, buffer, second_line);
-+ str[second_line] = '\0';
-+ tablesize = strtol(str, NULL, 0);
-+ delete[] str;
-+ if (tablesize <= 0)
-+ return 4;
-+ long sparse = tablesize * 2;
-+
-+ // Bin any small prime factors
-+ while (!(sparse % 2) || !(sparse % 3) || !(sparse % 5 ) ||
-+ !(sparse % 7) || !(sparse % 11) || !(sparse % 13 ))
-+ sparse++;
-+
-+ fprintf( stderr, "Switch table size to %d from %d\n",
-+ tablesize, sparse);
-+ tablesize = sparse;
-+
-+ // Hash - normal fixed size sparse hash, compare until we hit a NULL
-+ tableptr = (char **)calloc (sizeof(char *), tablesize );
-+
-+#ifdef HASH_DEBUG
-+ static int total_cols = 0;
-+ static int total_lookups = 0;
-+#endif
-+ size_t i = 0;
-+ // CHECKME: '\n' on Win32 ? - cf. Win32 binary downloads I guess.
-+ for (i = second_line; i < length;)
-+ {
-+ int hash_id;
-+ size_t next_line = seek_newline (i);
-+ if (next_line >= length)
-+ break;
-+
-+ hash_id = hash(buffer + i);
-+ int collisions = 0;
-+ while (tableptr[hash_id%tablesize]) {
-+ collisions++;
-+ hash_id++;
-+ }
-+#ifdef HASH_DEBUG
-+ total_lookups++;
-+ total_cols += collisions;
-+#endif
-+ tableptr[hash_id] = buffer + i;
-+ i = next_line;
-+ }
-+#ifdef HASH_DEBUG
-+ fprintf (stderr, "%d collisions on %d lookups\n", total_cols, total_lookups);
-+#endif
-+
-+#else // ! SMALL
- int wl, al;
- char * ap;
-
-@@ -186,22 +402,33 @@
- }
-
- fclose(rawdict);
-+#endif
- return 0;
- }
-
-+int HashMgr::hash(const char * word) const
-+{
-+#ifdef SMALL
-+ unsigned long hv = word[0];
-+ for (int i = 1; !WORD_END_CONDITN(word[i]) && !IS_END(word[i]); i++)
-+ hv = (hv << 5) - hv + word[i];
-+/* fprintf(stderr, "string '");
-+ for (int i = 0; !WORD_END_CONDITN(word[ i ] && !IS_END(word[i])); i++)
-+ fprintf( stderr, "%c", word[i] );
-+ fprintf(stderr, "' 0x%x \n", (int)hv % tablesize); */
-
-+ return hv % tablesize;
-+#else
- // the hash function is a simple load and rotate
- // algorithm borrowed
--
--int HashMgr::hash(const char * word) const
--{
- long hv = 0;
-- for (int i=0; i < 4 && *word != 0; i++)
-+ for (int i=0; i < 4 && !WORD_END_CONDITN (*word); i++)
- hv = (hv << 8) | (*word++);
-- while (*word != 0) {
-+ while (WORD_END_CONDITN (*word)) {
- ROTATE(hv,ROTATE_LEN);
- hv ^= (*word++);
- }
- return (unsigned long) hv % tablesize;
-+#endif
- }
-
-Index: lingucomponent/source/spellcheck/myspell/hashmgr.hxx
-===================================================================
-RCS file: /cvs/whiteboard/lingucomponent/source/spellcheck/myspell/hashmgr.hxx,v
-retrieving revision 1.6
-diff -u -r1.6 hashmgr.hxx
---- lingucomponent/source/spellcheck/myspell/hashmgr.hxx 24 Jun 2003 19:48:03 -0000 1.6
-+++ lingucomponent/source/spellcheck/myspell/hashmgr.hxx 17 Jun 2005 10:43:17 -0000
-@@ -3,20 +3,36 @@
-
- #include "htypes.hxx"
-
-+#define SMALL
-+
- class HashMgr
- {
-- int tablesize;
-- struct hentry * tableptr;
-+ int tablesize;
-+#ifndef SMALL
-+ struct hentry * tableptr;
-+#else
-+ char ** tableptr;
-+ mutable struct hentry compat;
-+ int fd;
-+ char *buffer;
-+ size_t length;
-+ // FIXME: this API sucks - ideally need to re-work all
-+ // struct hentry use - and encapsulate those operations
-+ // in a more abstract class.
-+ struct hentry *setup_hentry(const char *ptr);
-+ size_t seek_newline(size_t from_offset);
-+ int slurp( int fd, size_t bytes );
-+#endif
-
- public:
- HashMgr(const char * tpath);
- ~HashMgr();
-
- struct hentry * lookup(const char *) const;
-- int hash(const char *) const;
- struct hentry * walk_hashtable(int & col, struct hentry * hp) const;
-
- private:
-+ int hash(const char *) const;
- HashMgr( const HashMgr & ); // not implemented
- HashMgr &operator=( const HashMgr & ); // not implemented
- int load_tables(const char * tpath);
-Index: lingucomponent/source/spellcheck/myspell/makefile.mk
-===================================================================
-RCS file: /cvs/whiteboard/lingucomponent/source/spellcheck/myspell/makefile.mk,v
-retrieving revision 1.8
-diff -u -r1.8 makefile.mk
---- lingucomponent/source/spellcheck/myspell/makefile.mk 9 Mar 2004 12:42:12 -0000 1.8
-+++ lingucomponent/source/spellcheck/myspell/makefile.mk 17 Jun 2005 10:43:17 -0000
-@@ -72,6 +72,11 @@
-
- # --- Files --------------------------------------------------------
-
-+.IF "$(SYSTEM_MYSPELL)" == "YES"
-+@all:
-+ @echo "Using system myspell..."
-+.ENDIF
-+
- # all_target: ALLTAR DICTIONARY
- all_target: ALLTAR
-
diff --git a/patches/test/odf-filter-hash-token-map-xmloff.diff b/patches/test/odf-filter-hash-token-map-xmloff.diff
deleted file mode 100644
index c915814a7..000000000
--- a/patches/test/odf-filter-hash-token-map-xmloff.diff
+++ /dev/null
@@ -1,120 +0,0 @@
-diff --git xmloff/inc/xmloff/xmltoken.hxx xmloff/inc/xmloff/xmltoken.hxx
-index f03fba5..923cde1 100644
---- xmloff/inc/xmloff/xmltoken.hxx
-+++ xmloff/inc/xmloff/xmltoken.hxx
-@@ -3045,11 +3045,16 @@ namespace xmloff { namespace token {
- XMLOFF_DLLPUBLIC const ::rtl::OUString& GetXMLToken(
- enum XMLTokenEnum eToken );
-
-+ XMLOFF_DLLPUBLIC XMLTokenEnum GetXMLTokenID(
-+ const ::rtl::OUString& rName );
-+
- /// compare eToken to the string
- XMLOFF_DLLPUBLIC sal_Bool IsXMLToken(
- const ::rtl::OUString& rString,
- enum XMLTokenEnum eToken );
-
-+ XMLOFF_DLLPUBLIC void InitTokens();
-+
- // gives all allocated memory for OUString* back
- XMLOFF_DLLPUBLIC void ResetTokens();
-
-diff --git xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
-index d164a7c..7e21c1b 100644
---- xmloff/source/core/xmlexp.cxx
-+++ xmloff/source/core/xmlexp.cxx
-@@ -346,6 +346,8 @@ void SvXMLExport::_InitCtor()
- }
- }
- // <--
-+
-+ xmloff::token::InitTokens();
- }
-
- // --> OD 2006-03-14 #i51726#
-diff --git xmloff/source/core/xmlimp.cxx xmloff/source/core/xmlimp.cxx
-index 3d25e07..987d496 100644
---- xmloff/source/core/xmlimp.cxx
-+++ xmloff/source/core/xmlimp.cxx
-@@ -309,6 +309,8 @@ void SvXMLImport::_InitCtor()
- mxModel->addEventListener(mxEventListener);
- }
-
-+ ::xmloff::token::InitTokens();
-+
- ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
-
- }
-diff --git xmloff/source/core/xmltoken.cxx xmloff/source/core/xmltoken.cxx
-index 323d59b..fd5d013 100644
---- xmloff/source/core/xmltoken.cxx
-+++ xmloff/source/core/xmltoken.cxx
-@@ -34,7 +34,10 @@
- #include <tools/debug.hxx>
- #include <rtl/ustring.hxx>
-
-+#include <hash_map>
-+
- using ::rtl::OUString;
-+using ::rtl::OUStringHash;
-
- namespace xmloff { namespace token {
-
-@@ -3047,6 +3050,9 @@ namespace xmloff { namespace token {
- #endif
- };
-
-+ typedef ::std::hash_map<OUString, XMLTokenEnum, OUStringHash> TokenNameMapType;
-+ TokenNameMapType aTokenNameMap;
-+
- sal_Int32 nRescheduleCount = 0;
-
- // get OUString representation of token
-@@ -3077,6 +3083,15 @@ namespace xmloff { namespace token {
- return *pToken->pOUString;
- }
-
-+ XMLTokenEnum GetXMLTokenID( const OUString& rName )
-+ {
-+ TokenNameMapType::const_iterator itr = aTokenNameMap.find(rName);
-+ if (itr != aTokenNameMap.end())
-+ return itr->second;
-+
-+ return XML_TOKEN_INVALID;
-+ }
-+
- // does rString represent eToken?
- sal_Bool IsXMLToken(
- const OUString& rString,
-@@ -3089,6 +3104,23 @@ namespace xmloff { namespace token {
- return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
- }
-
-+ void InitTokens()
-+ {
-+ if (!aTokenNameMap.empty())
-+ return;
-+
-+ size_t n = sizeof(aTokenList)/sizeof(XMLTokenEntry);
-+ for (size_t i = 0; i < n; ++i)
-+ {
-+ if (!aTokenList[i].pOUString)
-+ aTokenList[i].pOUString = new OUString(
-+ aTokenList[i].pChar, aTokenList[i].nLength, RTL_TEXTENCODING_ASCII_US );
-+
-+ aTokenNameMap.insert(
-+ TokenNameMapType::value_type(*aTokenList[i].pOUString, static_cast<XMLTokenEnum>(i)));
-+ }
-+ }
-+
- // gives all allocated memory for OUString* back
- void ResetTokens()
- {
-@@ -3101,6 +3133,7 @@ namespace xmloff { namespace token {
- delete aTokenList[i].pOUString;
- aTokenList[i].pOUString = NULL;
- }
-+ aTokenNameMap.clear();
- }
- }
-
diff --git a/patches/test/ooo-build-qatesttool.diff b/patches/test/ooo-build-qatesttool.diff
deleted file mode 100644
index e458898cb..000000000
--- a/patches/test/ooo-build-qatesttool.diff
+++ /dev/null
@@ -1,116 +0,0 @@
-Index: qatesttool/global/win/dial_a_c.win
-===================================================================
-RCS file: /cvs/qa/qatesttool/global/win/dial_a_c.win,v
-retrieving revision 1.12
-diff -u -p -r1.12 dial_a_c.win
---- qatesttool/global/win/dial_a_c.win 13 Jan 2005 09:23:06 -0000 1.12
-+++ qatesttool/global/win/dial_a_c.win 6 Feb 2006 10:33:03 -0000
-@@ -79,7 +79,7 @@ CrLf sw:RadioButton:DLG_ASCII_FILTER:RB_
- Cr sw:RadioButton:DLG_ASCII_FILTER:RB_CR
- Lf sw:RadioButton:DLG_ASCII_FILTER:RB_LF
-
--*Attribute HID_SEARCHATTR
-+*SearchAttribute HID_SEARCHATTR
- Auswahl HID_SEARCHATTR_CTL_ATTR
-
- ' *Aufzaehlungszeichen SID_OUTLINE_BULLET
-Index: qatesttool/writer/level1/inc/regexp/search.inc
-===================================================================
-RCS file: /cvs/qa/qatesttool/writer/level1/inc/regexp/search.inc,v
-retrieving revision 1.12
-diff -u -p -r1.12 search.inc
---- qatesttool/writer/level1/inc/regexp/search.inc 7 Dec 2005 14:35:48 -0000 1.12
-+++ qatesttool/writer/level1/inc/regexp/search.inc 6 Feb 2006 10:33:29 -0000
-@@ -992,8 +992,8 @@ endcase
-
- function wCountNumberOfAttributes() as Integer
- Dim i as integer, AttributeCount as integer
-- Attribute.Click
-- Kontext "Attribute"
-+ SearchAttribute.Click
-+ Kontext "SearchAttribute"
- wait 500
- ' Count how much Attributes are in the list
- For i = 1 to 200
-@@ -1006,7 +1006,7 @@ function wCountNumberOfAttributes() as I
- i = 202
- endcatch
- next i
-- Attribute.Close
-+ SearchAttribute.Close
- end function
-
- ' ----------------------------------------------------------------------------------
-@@ -1019,7 +1019,7 @@ function wSelectAttributeName(aNumber as
- Dim i as integer, aSelectIt as String
- Kontext "FindAndReplace"
- Attributes.Click
-- Kontext "Attribute"
-+ Kontext "SearchAttribute"
-
- Select Case aNumber
- Case 1
-@@ -1341,7 +1341,7 @@ function wSelectAttributeName(aNumber as
- if AsianSupport = True then Warnlog "Unable to locate Attribute in list!"
- wSelectAttributeName = ""
- endif
-- Attribute.Ok
-+ SearchAttribute.Ok
- end function
-
-
-@@ -1596,13 +1596,13 @@ sub wSetFindAndReplaceToDefault(WhichDoc
- if CurrentSelectionOnly.IsEnabled then CurrentSelectionOnly.Uncheck
- 'Column 3
- Attributes.Click
-- Kontext "Attribute"
-+ Kontext "SearchAttribute"
- ' List has 32 Attributes
- For i = 1 to 32
- Auswahl.Select i
- Auswahl.Uncheck
- Next i
-- Attribute.OK
-+ SearchAttribute.OK
- kontext "FindAndReplace"
- if NoFormat.IsEnabled then NoFormat.Click
- Kontext "FindAndReplace"
-@@ -1689,7 +1689,7 @@ end sub
- function ToggleAttribute(sNumber as integer, sCheck as boolean)
- Kontext "FindAndReplace"
- Attributes.Click
-- Kontext "Attribute"
-+ Kontext "SearchAttribute"
- Auswahl.Select sNumber 'Check Attributes underlined
- wait 500
- if sCheck = "True" then
-@@ -1698,7 +1698,7 @@ function ToggleAttribute(sNumber as inte
- Auswahl.Uncheck
- endif
- wait 500
-- Attribute.OK
-+ SearchAttribute.OK
- Kontext "FindAndReplace"
- end function
-
-Index: qatesttool/writer/update/inc/w_002_.inc
-===================================================================
-RCS file: /cvs/qa/qatesttool/writer/update/inc/w_002_.inc,v
-retrieving revision 1.35
-diff -u -p -r1.35 w_002_.inc
---- qatesttool/writer/update/inc/w_002_.inc 30 Jan 2006 09:23:33 -0000 1.35
-+++ qatesttool/writer/update/inc/w_002_.inc 6 Feb 2006 10:33:56 -0000
-@@ -404,10 +404,10 @@ testcase tEditFindAndReplace
-
- Attributes.Click
- '/// in 'Find&Replace' dialog click 'Attributess' ///
-- Kontext "Attribute"
-- Call DialogTest ( Attribute )
-+ Kontext "SearchAttribute"
-+ Call DialogTest ( SearchAttribute )
- '/// Cancel dialog 'Attributess' ///
-- Attribute.Cancel
-+ SearchAttribute.Cancel
-
- Kontext "FindAndReplace"
- Call DialogTest ( FindAndReplace )
diff --git a/patches/test/opengl-canvas.diff b/patches/test/opengl-canvas.diff
deleted file mode 100644
index 1f6371074..000000000
--- a/patches/test/opengl-canvas.diff
+++ /dev/null
@@ -1,5650 +0,0 @@
-Opengl canvas implementation
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-diff -r 6ae934bd30f5 basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
---- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -257,6 +257,26 @@
- */
- B2DPolyPolygon reSegmentPolyPolygonEdges(const B2DPolyPolygon& rCandidate, sal_uInt32 nSubEdges, bool bHandleCurvedEdges, bool bHandleStraightEdges);
-
-+ /** Creates polypolygon for seven-segment display number
-+
-+ This function takes an integer number between 0 and 9 and
-+ convert it into the well-known seven-segment display
-+ number (like most digital clocks show their numbers). The
-+ digit will exactly fit the unit rectangle. The polypolygon
-+ will be a line polygon, i.e. if you need the segment parts
-+ to have width, use createAreaGeometry() on the result.
-+
-+ @param cNumber
-+ Number from '0' to '9' as ASCII char, or '-', 'E' and '.'
-+ to convert to 7 segment code
-+
-+ @param bLitSegments
-+ When true, return a polygon containing the segments that
-+ are 'lit' for the given number. Return un-lit segments
-+ otherwise.
-+ */
-+ B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char cNumber, bool bLitSegments=true);
-+
- //////////////////////////////////////////////////////////////////////
- // comparators with tolerance for 2D PolyPolygons
- bool equal(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB, const double& rfSmallValue);
-diff -r 6ae934bd30f5 basegfx/inc/basegfx/tools/tools.hxx
---- a/basegfx/inc/basegfx/tools/tools.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/basegfx/inc/basegfx/tools/tools.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -37,6 +37,7 @@
- {
- class B2DPoint;
- class B2DRange;
-+ class B2DPolyPolygon;
-
- namespace tools
- {
-@@ -128,6 +129,30 @@
- ::basegfx::B2DPoint& io_rRightBottom,
- const ::basegfx::B2DRange& rFitTarget );
-
-+ /** Creates polypolygon with the given number as seven-segment
-+ digits
-+
-+ @param fVal
-+ Value to convert
-+
-+ @param nTotalDigits
-+ Total number of digits to display. If less is needed for
-+ given number, fill space with blanks.
-+
-+ @param nDecPlaces
-+ Decimal places to show. When 0, display as integer. When
-+ negative, fill given number of before-the-decimal point
-+ with zero.
-+
-+ @param bLitSegments
-+ When true, return a polygon containing the segments that
-+ are 'lit' for the given number. Return un-lit segments
-+ otherwise.
-+ */
-+ B2DPolyPolygon number2PolyPolygon(double fVal,
-+ sal_Int32 nTotalDigits,
-+ sal_Int32 nDecPlaces,
-+ bool bLitSegments=true);
- }
- }
-
-diff -r 6ae934bd30f5 basegfx/source/polygon/b2dpolypolygontools.cxx
---- a/basegfx/source/polygon/b2dpolypolygontools.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -581,6 +581,138 @@
- return aRetval;
- }
-
-+ B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments)
-+ {
-+ // config here
-+ // {
-+ const double fTotalSize=1.0;
-+ const double fPosMiddleSegment=0.6;
-+ const double fSegmentEndChopHoriz=0.08;
-+ const double fSegmentEndChopVert =0.04;
-+ // }
-+ // config here
-+
-+ const double fLeft=0.0;
-+ const double fRight=fTotalSize;
-+ const double fTop=0.0;
-+ const double fMiddle=fPosMiddleSegment;
-+ const double fBottom=fTotalSize;
-+
-+ // from 0 to 5: pair of segment corner coordinates
-+ //
-+ // segment corner indices are these:
-+ //
-+ // 0 - 1
-+ // | |
-+ // 2 - 3
-+ // | |
-+ // 4 - 5
-+ //
-+ static const double corners[] =
-+ {
-+ fLeft, fTop,
-+ fRight, fTop,
-+ fLeft, fMiddle,
-+ fRight, fMiddle,
-+ fLeft, fBottom,
-+ fRight, fBottom
-+ };
-+
-+ // from 0 to 9: which segments are 'lit' for this number?
-+ //
-+ // array denotes graph edges to traverse, with -1 means
-+ // stop (the vertices are the corner indices from above):
-+ // 0
-+ // -
-+ // 1 | | 2
-+ // - 3
-+ // 4 | | 5
-+ // -
-+ // 6
-+ //
-+ static const int numbers[] =
-+ {
-+ 1, 1, 1, 0, 1, 1, 1, // 0
-+ 0, 0, 1, 0, 0, 1, 0, // 1
-+ 1, 0, 1, 1, 1, 0, 1, // 2
-+ 1, 0, 1, 1, 0, 1, 1, // 3
-+ 0, 1, 1, 1, 0, 1, 0, // 4
-+ 1, 1, 0, 1, 0, 1, 1, // 5
-+ 1, 1, 0, 1, 1, 1, 1, // 6
-+ 1, 0, 1, 0, 0, 1, 0, // 1
-+ 1, 1, 1, 1, 1, 1, 1, // 8
-+ 1, 1, 1, 1, 0, 1, 1, // 9
-+ 0, 0, 0, 1, 0, 0, 0, // '-'
-+ 1, 1, 0, 1, 1, 0, 1, // 'E'
-+ };
-+
-+ // maps segment index to two corner ids:
-+ static const int index2corner[] =
-+ {
-+ 0, 2, // 0
-+ 0, 4, // 1
-+ 2, 6, // 2
-+ 4, 6, // 3
-+ 4, 8, // 4
-+ 6, 10, // 5
-+ 8, 10, // 6
-+ };
-+
-+ B2DPolyPolygon aRes;
-+ if( nNumber == '-' )
-+ {
-+ nNumber = 10;
-+ }
-+ else if( nNumber == 'E' )
-+ {
-+ nNumber = 11;
-+ }
-+ else if( nNumber == '.' )
-+ {
-+ if( bLitSegments )
-+ aRes.append(createPolygonFromCircle(B2DPoint(fTotalSize/2, fTotalSize),
-+ fSegmentEndChopHoriz));
-+ return aRes;
-+ }
-+ else
-+ {
-+ nNumber=clamp<sal_uInt32>(nNumber,'0','9') - '0';
-+ }
-+
-+ B2DPolygon aCurrSegment;
-+ const size_t sliceSize=sizeof(numbers)/sizeof(*numbers)/12;
-+ const int* pCurrSegment=numbers + nNumber*sliceSize;
-+ for( size_t i=0; i<sliceSize; i++, pCurrSegment++)
-+ {
-+ if( !(*pCurrSegment ^ bLitSegments) )
-+ {
-+ const size_t j=2*i;
-+ aCurrSegment.clear();
-+ B2DPoint start(corners[index2corner[j]],
-+ corners[index2corner[j]+1] );
-+ B2DPoint end (corners[index2corner[j+1]],
-+ corners[index2corner[j+1]+1]);
-+
-+ if( start.getX() == end.getX() )
-+ {
-+ start.setY(start.getY()+fSegmentEndChopVert);
-+ end.setY(end.getY()-fSegmentEndChopVert);
-+ }
-+ else
-+ {
-+ start.setX(start.getX()+fSegmentEndChopHoriz);
-+ end.setX(end.getX()-fSegmentEndChopHoriz);
-+ }
-+
-+ aCurrSegment.append(start);
-+ aCurrSegment.append(end);
-+ }
-+ aRes.append(aCurrSegment);
-+ }
-+
-+ return aRes;
-+ }
-+
- } // end of namespace tools
- } // end of namespace basegfx
-
-diff -r 6ae934bd30f5 basegfx/source/tools/makefile.mk
---- a/basegfx/source/tools/makefile.mk Mon Jan 18 21:14:50 2010 +0100
-+++ b/basegfx/source/tools/makefile.mk Tue Jan 19 22:12:52 2010 +0100
-@@ -47,6 +47,7 @@
- $(SLO)$/debugplotter.obj \
- $(SLO)$/keystoplerp.obj \
- $(SLO)$/liangbarsky.obj \
-+ $(SLO)$/numbertools.obj \
- $(SLO)$/tools.obj \
- $(SLO)$/unopolypolygon.obj
-
-diff -r 6ae934bd30f5 basegfx/source/tools/numbertools.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/basegfx/source/tools/numbertools.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: b2dpolypolygontools.hxx,v $
-+ * $Revision: 1.20 $
-+ *
-+ * 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 <basegfx/tools/tools.hxx>
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+
-+#include <rtl/ustrbuf.hxx>
-+#include <rtl/math.hxx>
-+
-+#include <utility>
-+
-+namespace basegfx { namespace tools
-+{
-+ B2DPolyPolygon number2PolyPolygon(double fValue, sal_Int32 nTotalDigits, sal_Int32 nDecPlaces, bool bLitSegments)
-+ {
-+ // config here
-+ // {
-+ const double fSpace=0.2;
-+ // }
-+ // config here
-+
-+ rtl::OUStringBuffer aNum;
-+ rtl::math::doubleToUStringBuffer(aNum,
-+ fValue,
-+ rtl_math_StringFormat_F,
-+ nDecPlaces, '.',
-+ 0, ',');
-+
-+ B2DPolyPolygon aRes;
-+ B2DHomMatrix aMat;
-+ double fCurrX=std::max(nTotalDigits-aNum.getLength(), 0) * (1.0+fSpace);
-+ for( sal_Int32 i=0; i<aNum.getLength(); ++i )
-+ {
-+ B2DPolyPolygon aCurr;
-+ aCurr=createSevenSegmentPolyPolygon(aNum.charAt(i),
-+ bLitSegments);
-+
-+ aMat.identity();
-+ aMat.translate(fCurrX,0.0);
-+ aCurr.transform(aMat);
-+
-+ fCurrX += 1.0+fSpace;
-+
-+ aRes.append(aCurr);
-+ }
-+
-+ return aRes;
-+ }
-+
-+} }
-diff -r 6ae934bd30f5 canvas/prj/build.lst
---- a/canvas/prj/build.lst Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/prj/build.lst Tue Jan 19 22:12:52 2010 +0100
-@@ -6,5 +6,6 @@
- cv canvas\source\simplecanvas nmake - all cv_simplecanvas cv_tools cv_inc NULL
- cv canvas\source\cairo nmake - all cv_cairo cv_tools cv_inc NULL
- cv canvas\source\directx nmake - w cv_directx cv_tools cv_inc NULL
-+cv canvas\source\opengl nmake - all cv_opengl cv_tools cv_inc NULL
- cv canvas\source\null nmake - all cv_null cv_tools cv_inc NULL
- cv canvas\source\factory nmake - all cv_factory cv_inc NULL
-diff -r 6ae934bd30f5 canvas/prj/d.lst
---- a/canvas/prj/d.lst Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/prj/d.lst Tue Jan 19 22:12:52 2010 +0100
-@@ -1,5 +1,6 @@
- ..\%__SRC%\bin\canvasto*.dll %_DEST%\bin%_EXT%\canvasto*.dll
- ..\%__SRC%\bin\cairocan*.dll %_DEST%\bin%_EXT%\cairocan*.dll
-+..\%__SRC%\bin\oglcanvas*.dll %_DEST%\bin%_EXT%\oglcanvas*.dll
- ..\%__SRC%\bin\directx*.dll %_DEST%\bin%_EXT%\directx*.dll
- ..\%__SRC%\bin\gdiplus*.dll %_DEST%\bin%_EXT%\gdiplus*.dll
- ..\%__SRC%\bin\vclcanva*.dll %_DEST%\bin%_EXT%\vclcanva*.dll
-@@ -9,6 +10,7 @@
- ..\%__SRC%\lib\icanvastools.lib %_DEST%\lib%_EXT%\icanvastools.lib
- ..\%__SRC%\lib\libcanvastools*.so %_DEST%\lib%_EXT%\
- ..\%__SRC%\lib\cairocanvas.uno.so %_DEST%\lib%_EXT%\cairocanvas.uno.so
-+..\%__SRC%\lib\oglcanvas.uno.so %_DEST%\lib%_EXT%\oglcanvas.uno.so
- ..\%__SRC%\lib\vclcanvas.uno.so %_DEST%\lib%_EXT%\vclcanvas.uno.so
- ..\%__SRC%\lib\nullcanvas.uno.so %_DEST%\lib%_EXT%\nullcanvas.uno.so
- ..\%__SRC%\lib\simplecanvas.uno.so %_DEST%\lib%_EXT%\simplecanvas.uno.so
-diff -r 6ae934bd30f5 canvas/source/cairo/cairo_canvashelper.hxx
---- a/canvas/source/cairo/cairo_canvashelper.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/source/cairo/cairo_canvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -32,6 +32,7 @@
- #define _CAIROCANVAS_CANVASHELPER_HXX_
-
- #include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
-
- #include <basegfx/vector/b2isize.hxx>
-diff -r 6ae934bd30f5 canvas/source/directx/dx_bitmapcanvashelper.hxx
---- a/canvas/source/directx/dx_bitmapcanvashelper.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/source/directx/dx_bitmapcanvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -32,6 +32,7 @@
- #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
-
- #include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
-
- #include <basegfx/vector/b2isize.hxx>
- #include <basegfx/vector/b2dsize.hxx>
-diff -r 6ae934bd30f5 canvas/source/null/null_canvashelper.hxx
---- a/canvas/source/null/null_canvashelper.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/source/null/null_canvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -32,6 +32,7 @@
- #define _NULLCANVAS_CANVASHELPER_HXX_
-
- #include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
-
- #include <basegfx/vector/b2isize.hxx>
-diff -r 6ae934bd30f5 canvas/source/opengl/exports.dxp
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/exports.dxp Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,3 @@
-+component_getImplementationEnvironment
-+component_writeInfo
-+component_getFactory
-diff -r 6ae934bd30f5 canvas/source/opengl/exports.map
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/exports.map Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,8 @@
-+CAN_1_0 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_writeInfo;
-+ component_getFactory;
-+ local:
-+ *;
-+};
-diff -r 6ae934bd30f5 canvas/source/opengl/makefile.mk
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/makefile.mk Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,67 @@
-+#*************************************************************************
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# Author:
-+# Thorsten Behrens <tbehrens@novell.com>
-+#
-+# Copyright (C) 2008, Novell Inc.
-+# Parts copyright 2005 by Sun Microsystems, Inc.
-+#
-+# The Contents of this file are made available subject to
-+# the terms of GNU Lesser General Public License Version 2.1.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..
-+
-+PRJNAME=canvas
-+TARGET=oglcanvas
-+ENABLE_EXCEPTIONS=TRUE
-+
-+# --- Settings -----------------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+DLLPRE =
-+
-+# --- Common ----------------------------------------------------------
-+
-+.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
-+CDEFS+= -DVERBOSE
-+.ENDIF
-+
-+SLOFILES = $(SLO)$/ogl_bitmapcanvashelper.obj \
-+ $(SLO)$/ogl_canvasbitmap.obj \
-+ $(SLO)$/ogl_canvascustomsprite.obj \
-+ $(SLO)$/ogl_canvasfont.obj \
-+ $(SLO)$/ogl_canvashelper.obj \
-+ $(SLO)$/ogl_canvastools.obj \
-+ $(SLO)$/ogl_spritecanvas.obj \
-+ $(SLO)$/ogl_spritedevicehelper.obj \
-+ $(SLO)$/ogl_textlayout.obj \
-+ $(SLO)$/ogl_texturecache.obj
-+
-+
-+SHL1TARGET=$(TARGET).uno
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB)
-+
-+.IF "$(GUI)"=="UNX"
-+ SHL1STDLIBS += -lGL -lGLU -lX11
-+.ELIF "$(GUI)"=="WNT"
-+ SHL1STDLIBS += opengl32.lib glu32.lib gdi32.lib
-+.ELSE
-+ .ERROR "Add your system OpenGL libs here"
-+.ENDIF
-+
-+SHL1IMPLIB=i$(TARGET)
-+SHL1LIBS=$(SLB)$/$(TARGET).lib
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+
-+SHL1VERSIONMAP=exports.map
-+
-+DEF1NAME=$(SHL1TARGET)
-+DEF1EXPORTFILE=exports.dxp
-+
-+# ==========================================================================
-+
-+.INCLUDE : target.mk
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_bitmapcanvashelper.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_bitmapcanvashelper.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_bitmapcanvashelper.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <canvas/canvastools.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ BitmapCanvasHelper::BitmapCanvasHelper()
-+ {}
-+
-+ void BitmapCanvasHelper::disposing()
-+ {
-+ CanvasHelper::disposing();
-+ }
-+
-+ void BitmapCanvasHelper::init( rendering::XGraphicDevice& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper,
-+ const geometry::IntegerSize2D& rSize )
-+ {
-+ maSize = rSize;
-+ CanvasHelper::init(rDevice,rDeviceHelper);
-+ }
-+
-+ void BitmapCanvasHelper::copyRect( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XBitmapCanvas >& /*sourceCanvas*/,
-+ const geometry::RealRectangle2D& /*sourceRect*/,
-+ const rendering::ViewState& /*sourceViewState*/,
-+ const rendering::RenderState& /*sourceRenderState*/,
-+ const geometry::RealRectangle2D& /*destRect*/,
-+ const rendering::ViewState& /*destViewState*/,
-+ const rendering::RenderState& /*destRenderState*/ )
-+ {
-+ // TODO(F2): copyRect NYI
-+ }
-+
-+ geometry::IntegerSize2D BitmapCanvasHelper::getSize()
-+ {
-+ return maSize;
-+ }
-+
-+ uno::Reference< rendering::XBitmap > BitmapCanvasHelper::getScaledBitmap( const geometry::RealSize2D& /*newSize*/,
-+ sal_Bool /*beFast*/ )
-+ {
-+ // TODO(F1):
-+ return uno::Reference< rendering::XBitmap >();
-+ }
-+
-+ uno::Sequence< sal_Int8 > BitmapCanvasHelper::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/,
-+ const geometry::IntegerRectangle2D& /*rect*/ )
-+ {
-+ // TODO(F2): NYI - and improbable to ever be
-+ return uno::Sequence< sal_Int8 >();
-+ }
-+
-+ void BitmapCanvasHelper::setData( const uno::Sequence< sal_Int8 >& /*data*/,
-+ const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
-+ const geometry::IntegerRectangle2D& /*rect*/ )
-+ {
-+ // TODO(F2): NYI - and improbable to ever be
-+ }
-+
-+ void BitmapCanvasHelper::setPixel( const uno::Sequence< sal_Int8 >& /*color*/,
-+ const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
-+ const geometry::IntegerPoint2D& /*pos*/ )
-+ {
-+ // TODO(F2): NYI - and improbable to ever be
-+ }
-+
-+ uno::Sequence< sal_Int8 > BitmapCanvasHelper::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/,
-+ const geometry::IntegerPoint2D& /*pos*/ )
-+ {
-+ // TODO(F2): NYI - and improbable to ever be
-+ return uno::Sequence< sal_Int8 >();
-+ }
-+
-+ rendering::IntegerBitmapLayout BitmapCanvasHelper::getMemoryLayout()
-+ {
-+ return ::canvas::tools::getStdMemoryLayout(getSize());
-+ }
-+
-+ bool BitmapCanvasHelper::hasAlpha() const
-+ {
-+ return true;
-+ }
-+
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_bitmapcanvashelper.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_bitmapcanvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,107 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_BITMAPCANVASHELPER_HXX_
-+#define OGL_BITMAPCANVASHELPER_HXX_
-+
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
-+#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-+
-+#include <basegfx/vector/b2isize.hxx>
-+#include <basegfx/vector/b2dsize.hxx>
-+
-+#include <boost/utility.hpp>
-+#include <boost/shared_ptr.hpp>
-+#include <vector>
-+
-+#include "ogl_canvashelper.hxx"
-+
-+
-+namespace oglcanvas
-+{
-+ /** Helper class for basic canvas functionality. */
-+ class BitmapCanvasHelper : public CanvasHelper
-+ {
-+ public:
-+ BitmapCanvasHelper();
-+
-+ /// Release all references
-+ void disposing();
-+
-+ /** Initialize canvas helper
-+
-+ This method late-initializes the canvas helper, providing
-+ it with the necessary device and output objects. Note that
-+ the CanvasHelper does <em>not</em> take ownership of the
-+ passed rDevice reference, nor does it perform any
-+ reference counting. Thus, to prevent the reference counted
-+ SpriteCanvas object from deletion, the user of this class
-+ is responsible for holding ref-counted references itself!
-+
-+ @param rDevice
-+ Reference device this canvas is associated with
-+
-+ */
-+ void init( ::com::sun::star::rendering::XGraphicDevice& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper,
-+ const ::com::sun::star::geometry::IntegerSize2D& rSize );
-+
-+ // BitmapCanvasHelper functionality
-+ // ================================
-+
-+ void copyRect( const ::com::sun::star::rendering::XCanvas* rCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
-+ const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
-+ const ::com::sun::star::rendering::ViewState& sourceViewState,
-+ const ::com::sun::star::rendering::RenderState& sourceRenderState,
-+ const ::com::sun::star::geometry::RealRectangle2D& destRect,
-+ const ::com::sun::star::rendering::ViewState& destViewState,
-+ const ::com::sun::star::rendering::RenderState& destRenderState );
-+
-+ ::com::sun::star::geometry::IntegerSize2D getSize();
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > queryBitmapCanvas();
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
-+ getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
-+ sal_Bool beFast );
-+
-+ ::com::sun::star::uno::Sequence< sal_Int8 >
-+ getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
-+
-+ void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
-+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
-+
-+ void setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
-+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
-+
-+ ::com::sun::star::uno::Sequence< sal_Int8 >
-+ getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
-+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
-+
-+ ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
-+
-+ bool hasAlpha() const;
-+
-+ private:
-+ ::com::sun::star::geometry::IntegerSize2D maSize;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_buffercontext.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_buffercontext.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,38 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_BUFFERCONTEXT_HXX_
-+#define OGL_BUFFERCONTEXT_HXX_
-+
-+#include <sal/config.h>
-+#include <boost/shared_ptr.hpp>
-+
-+namespace oglcanvas
-+{
-+ struct IBufferContext
-+ {
-+ virtual ~IBufferContext() {}
-+
-+ /// start render to buffer. changes gl current context
-+ virtual bool startBufferRendering() = 0;
-+
-+ /// end render to buffer. switches to window context, and selects rendered texture
-+ virtual bool endBufferRendering() = 0;
-+ };
-+
-+ typedef ::boost::shared_ptr<IBufferContext> IBufferContextSharedPtr;
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvasbitmap.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvasbitmap.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ * Parts copyright 2004 David Reveman, Peter Nilsson
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_canvasbitmap.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <canvas/canvastools.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ CanvasBitmap::CanvasBitmap( const geometry::IntegerSize2D& rSize,
-+ const SpriteCanvasRef& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper,
-+ bool bHasAlpha ) :
-+ mpDevice( rDevice ),
-+ mbHasAlpha( bHasAlpha )
-+ {
-+ ENSURE_OR_THROW( mpDevice.is(),
-+ "CanvasBitmap::CanvasBitmap(): Invalid surface or device" );
-+
-+ maCanvasHelper.init( *mpDevice.get(), rDeviceHelper, rSize );
-+ }
-+
-+ CanvasBitmap::CanvasBitmap( const CanvasBitmap& rSrc ) :
-+ mpDevice( rSrc.mpDevice ),
-+ mbHasAlpha( rSrc.mbHasAlpha )
-+ {
-+ maCanvasHelper = rSrc.maCanvasHelper;
-+ }
-+
-+ void SAL_CALL CanvasBitmap::disposing()
-+ {
-+ mpDevice.clear();
-+
-+ // forward to parent
-+ CanvasBitmapBaseT::disposing();
-+ }
-+
-+ bool CanvasBitmap::renderRecordedActions() const
-+ {
-+ return maCanvasHelper.renderRecordedActions();
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvasbitmap.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvasbitmap.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ * Parts copyright 2004 David Reveman, Peter Nilsson
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVASBITMAP_HXX
-+#define OGL_CANVASBITMAP_HXX
-+
-+#include <cppuhelper/compbase2.hxx>
-+
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
-+#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-+
-+#include <canvas/base/integerbitmapbase.hxx>
-+#include <canvas/base/basemutexhelper.hxx>
-+#include <basegfx/vector/b2isize.hxx>
-+
-+#include <boost/shared_ptr.hpp>
-+
-+#include "ogl_bitmapcanvashelper.hxx"
-+#include "ogl_spritecanvas.hxx"
-+
-+
-+/* Definition of CanvasBitmap class */
-+
-+namespace oglcanvas
-+{
-+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XBitmapCanvas,
-+ ::com::sun::star::rendering::XIntegerBitmap > CanvasBitmapBase_Base;
-+ typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
-+ BitmapCanvasHelper,
-+ ::osl::MutexGuard,
-+ ::cppu::OWeakObject > CanvasBitmapBaseT;
-+
-+ class CanvasBitmap : public CanvasBitmapBaseT
-+ {
-+ public:
-+ /** Create a canvas bitmap for the given surface
-+
-+ @param rSize
-+ Size of the bitmap
-+
-+ @param rDevice
-+ Reference device, with which bitmap should be compatible
-+ */
-+ CanvasBitmap( const ::com::sun::star::geometry::IntegerSize2D& rSize,
-+ const SpriteCanvasRef& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper,
-+ bool bHasAlpha );
-+
-+ /** Create verbatim copy (including all recorded actions)
-+ */
-+ CanvasBitmap( const CanvasBitmap& rSrc );
-+
-+ /// Dispose all internal references
-+ virtual void SAL_CALL disposing();
-+
-+ /** Write out recorded actions
-+ */
-+ bool renderRecordedActions() const;
-+
-+ private:
-+ /** MUST hold here, too, since CanvasHelper only contains a
-+ raw pointer (without refcounting)
-+ */
-+ SpriteCanvasRef mpDevice;
-+ bool mbHasAlpha;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvascustomsprite.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,265 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_canvascustomsprite.hxx"
-+#include "ogl_canvastools.hxx"
-+#include "ogl_tools.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <canvas/verbosetrace.hxx>
-+#include <canvas/verifyinput.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+#include <canvas/canvastools.hxx>
-+
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/point/b2dpoint.hxx>
-+#include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/polygon/b2dpolygonclipper.hxx>
-+#include <basegfx/polygon/b2dpolygontriangulator.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+
-+#include <GL/gl.h>
-+#include <GL/glu.h>
-+#include <GL/glext.h>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
-+ const SpriteCanvasRef& rRefDevice,
-+ SpriteDeviceHelper& rDeviceHelper ) :
-+ mpSpriteCanvas( rRefDevice ),
-+ maSize(rSpriteSize),
-+ mxClip(),
-+ maTransformation(),
-+ maPosition(),
-+ mfAlpha(0.0),
-+ mfPriority(0.0)
-+ {
-+ ENSURE_OR_THROW( rRefDevice.get(),
-+ "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
-+
-+ ::canvas::tools::setIdentityAffineMatrix2D(maTransformation);
-+ maCanvasHelper.init( *rRefDevice.get(),
-+ rDeviceHelper );
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::disposing()
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ mpSpriteCanvas.clear();
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::setAlpha( double alpha ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ canvas::tools::verifyRange( alpha, 0.0, 1.0 );
-+
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ mfAlpha = alpha;
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::move( const geometry::RealPoint2D& aNewPos,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ canvas::tools::verifyArgs(aNewPos, viewState, renderState,
-+ BOOST_CURRENT_FUNCTION,
-+ static_cast< ::cppu::OWeakObject* >(this));
-+
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ ::basegfx::B2DHomMatrix aTransform;
-+ ::canvas::tools::mergeViewAndRenderTransform(aTransform,
-+ viewState,
-+ renderState);
-+
-+ // convert position to device pixel
-+ maPosition = ::basegfx::unotools::b2DPointFromRealPoint2D(aNewPos);
-+ maPosition *= aTransform;
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::transform( const geometry::AffineMatrix2D& aTransformation ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ maTransformation = aTransformation;
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::clip( const uno::Reference< rendering::XPolyPolygon2D >& xClip ) throw (uno::RuntimeException)
-+ {
-+ mxClip = xClip;
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::setPriority( double nPriority ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ mfPriority = nPriority;
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::show() throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if( mpSpriteCanvas.is() )
-+ mpSpriteCanvas->show(this);
-+ }
-+
-+ void SAL_CALL CanvasCustomSprite::hide() throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if( mpSpriteCanvas.is() )
-+ mpSpriteCanvas->hide(this);
-+ }
-+
-+ uno::Reference< rendering::XCanvas > SAL_CALL CanvasCustomSprite::getContentCanvas() throw (uno::RuntimeException)
-+ {
-+ return this;
-+ }
-+
-+ bool CanvasCustomSprite::renderSprite() const
-+ {
-+ if( ::basegfx::fTools::equalZero( mfAlpha ) )
-+ return true;
-+
-+ TransformationPreserver aPreserver1;
-+ const ::basegfx::B2IVector aSpriteSizePixel(
-+ ::canvas::tools::roundUp( maSize.Width ),
-+ ::canvas::tools::roundUp( maSize.Height ));
-+
-+ // translate sprite to output position
-+ glTranslated(maPosition.getX(), maPosition.getY(), 0);
-+
-+ {
-+ TransformationPreserver aPreserver2;
-+
-+ // apply sprite content transformation matrix
-+ double aGLTransform[] =
-+ {
-+ maTransformation.m00, maTransformation.m10, 0, 0,
-+ maTransformation.m01, maTransformation.m11, 0, 0,
-+ 0, 0, 1, 0,
-+ maTransformation.m02, maTransformation.m12, 0, 1
-+ };
-+ glMultMatrixd(aGLTransform);
-+
-+ IBufferContextSharedPtr pBufferContext;
-+ if( mfAlpha != 1.0 || mxClip.is() )
-+ {
-+ // drats. need to render to temp surface before, and then
-+ // composite that to screen
-+
-+ // TODO(P3): buffer pbuffer, maybe even keep content
-+ // (in a texture?)
-+ pBufferContext=maCanvasHelper.getDeviceHelper()->createBufferContext(aSpriteSizePixel);
-+ pBufferContext->startBufferRendering();
-+ }
-+
-+ // this ends up in pBufferContext, if that one's "current"
-+ if( !maCanvasHelper.renderRecordedActions() )
-+ return false;
-+
-+ if( pBufferContext )
-+ {
-+ // content ended up in background buffer - compose to
-+ // screen now. Calls below switches us back to window
-+ // context, and binds to generated, dynamic texture
-+ pBufferContext->endBufferRendering();
-+
-+ glEnable(GL_TEXTURE_2D);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MIN_FILTER,
-+ GL_NEAREST);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MAG_FILTER,
-+ GL_NEAREST);
-+ glEnable(GL_BLEND);
-+ glBlendFunc(GL_SRC_ALPHA,
-+ GL_ONE_MINUS_SRC_ALPHA);
-+
-+ // blend against fixed vertex color; texture alpha is multiplied in
-+ glColor4f(1,1,1,mfAlpha);
-+
-+ if( mxClip.is() )
-+ {
-+ const double fWidth=maSize.Width;
-+ const double fHeight=maSize.Height;
-+
-+ // TODO(P3): buffer triangulation
-+ const ::basegfx::B2DPolygon& rTriangulatedPolygon(
-+ ::basegfx::triangulator::triangulate(
-+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(mxClip)));
-+
-+ basegfx::B2DPolygon rTriangleList(
-+ basegfx::tools::clipTriangleListOnRange(
-+ rTriangulatedPolygon,
-+ basegfx::B2DRange(
-+ 0,0,
-+ aSpriteSizePixel.getX(),
-+ aSpriteSizePixel.getY())));
-+
-+ glBegin(GL_TRIANGLES);
-+ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
-+ {
-+ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
-+ const double s(rPt.getX()/fWidth);
-+ const double t(rPt.getY()/fHeight);
-+ glTexCoord2f(s,t); glVertex2d(rPt.getX(), rPt.getY());
-+ }
-+ glEnd();
-+ }
-+ else
-+ {
-+ const double fWidth=maSize.Width/aSpriteSizePixel.getX();
-+ const double fHeight=maSize.Height/aSpriteSizePixel.getY();
-+
-+ glBegin(GL_TRIANGLE_STRIP);
-+ glTexCoord2f(0,0); glVertex2d(0,0);
-+ glTexCoord2f(0,fHeight); glVertex2d(0, aSpriteSizePixel.getY());
-+ glTexCoord2f(fWidth,0); glVertex2d(aSpriteSizePixel.getX(),0);
-+ glTexCoord2f(fWidth,fHeight); glVertex2d(aSpriteSizePixel.getX(),aSpriteSizePixel.getY());
-+ glEnd();
-+ }
-+
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+ glDisable(GL_TEXTURE_2D);
-+ }
-+ }
-+
-+ glColor4f(1,0,0,1);
-+ glBegin(GL_LINE_STRIP);
-+ glVertex2d(-2,-2);
-+ glVertex2d(-2,maSize.Height+4);
-+ glVertex2d(maSize.Width+4,maSize.Height+4);
-+ glVertex2d(maSize.Width+4,-2);
-+ glVertex2d(-2,-2);
-+ glVertex2d(maSize.Width+4,maSize.Height+4);
-+ glEnd();
-+
-+ std::vector<double> aVec;
-+ aVec.push_back(mfAlpha);
-+ aVec.push_back(mfPriority);
-+ aVec.push_back(maCanvasHelper.getRecordedActionCount());
-+ renderOSD( aVec, 10 );
-+
-+ return true;
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvascustomsprite.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvascustomsprite.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,103 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVASCUSTOMSPRITE_HXX
-+#define OGL_CANVASCUSTOMSPRITE_HXX
-+
-+#include <cppuhelper/compbase2.hxx>
-+#include <comphelper/uno3.hxx>
-+
-+#include <com/sun/star/lang/XComponent.hpp>
-+#include <com/sun/star/rendering/XCustomSprite.hpp>
-+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
-+
-+#include <basegfx/point/b2dpoint.hxx>
-+#include <basegfx/vector/b2isize.hxx>
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+
-+#include <canvas/base/basemutexhelper.hxx>
-+
-+#include "ogl_spritecanvas.hxx"
-+#include "ogl_canvashelper.hxx"
-+
-+
-+namespace oglcanvas
-+{
-+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCustomSprite,
-+ ::com::sun::star::rendering::XCanvas > CanvasCustomSpriteBase_Base;
-+ typedef ::canvas::CanvasBase< ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
-+ CanvasHelper,
-+ ::osl::MutexGuard,
-+ ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
-+
-+ /* Definition of CanvasCustomSprite class */
-+
-+ class CanvasCustomSprite : public CanvasCustomSpriteBaseT
-+ {
-+ public:
-+ /** Create a custom sprite
-+
-+ @param rSpriteSize
-+ Size of the sprite in pixel
-+
-+ @param rRefDevice
-+ Associated output device
-+
-+ @param rSpriteCanvas
-+ Target canvas
-+
-+ @param rDevice
-+ Target DX device
-+ */
-+ CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
-+ const SpriteCanvasRef& rRefDevice,
-+ SpriteDeviceHelper& rDeviceHelper );
-+
-+ virtual void SAL_CALL disposing();
-+
-+ // XSprite
-+ virtual void SAL_CALL setAlpha( double alpha ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL move( const ::com::sun::star::geometry::RealPoint2D& aNewPos, const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL transform( const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL clip( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setPriority( double nPriority ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL show() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL hide() throw (::com::sun::star::uno::RuntimeException);
-+
-+ // XCustomSprite
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getContentCanvas() throw (::com::sun::star::uno::RuntimeException);
-+
-+ double getPriority() const { return mfPriority; }
-+
-+ /// Render sprite content at sprite position
-+ bool renderSprite() const;
-+
-+ private:
-+ /** MUST hold here, too, since CanvasHelper only contains a
-+ raw pointer (without refcounting)
-+ */
-+ SpriteCanvasRef mpSpriteCanvas;
-+ const ::com::sun::star::geometry::RealSize2D maSize;
-+
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D > mxClip;
-+ ::com::sun::star::geometry::AffineMatrix2D maTransformation;
-+ ::basegfx::B2DPoint maPosition;
-+ double mfAlpha;
-+ double mfPriority;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvasfont.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvasfont.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_canvasfont.hxx"
-+#include "ogl_textlayout.hxx"
-+
-+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
-+#include <com/sun/star/rendering/PanoseWeight.hpp>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest,
-+ const uno::Sequence< beans::PropertyValue >& /*extraFontProperties*/,
-+ const geometry::Matrix2D& fontMatrix ) :
-+ CanvasFontBaseT( m_aMutex ),
-+ maFontRequest( rFontRequest ),
-+ maFontMatrix( fontMatrix )
-+ {
-+ }
-+
-+ void SAL_CALL CanvasFont::disposing()
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ }
-+
-+ uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout( const rendering::StringContext& aText,
-+ sal_Int8 nDirection,
-+ sal_Int64 nRandomSeed ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return new TextLayout( aText, nDirection, nRandomSeed, ImplRef( this ) );
-+ }
-+
-+ uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Sequence< double >();
-+ }
-+
-+ uno::Sequence< beans::PropertyValue > SAL_CALL CanvasFont::getExtraFontProperties( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Sequence< beans::PropertyValue >();
-+ }
-+
-+ rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return maFontRequest;
-+ }
-+
-+ rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return rendering::FontMetrics();
-+ }
-+
-+ const ::com::sun::star::geometry::Matrix2D& CanvasFont::getFontMatrix() const
-+ {
-+ return maFontMatrix;
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvasfont.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvasfont.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,72 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVASFONT_HXX
-+#define OGL_CANVASFONT_HXX
-+
-+#include <comphelper/implementationreference.hxx>
-+
-+#include <cppuhelper/compbase1.hxx>
-+#include <comphelper/broadcasthelper.hxx>
-+
-+#include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/rendering/XCanvasFont.hpp>
-+
-+#include <rtl/ref.hxx>
-+
-+#include <boost/shared_ptr.hpp>
-+#include <boost/utility.hpp>
-+
-+
-+/* Definition of CanvasFont class */
-+
-+namespace oglcanvas
-+{
-+ class SpriteCanvas;
-+
-+ typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::rendering::XCanvasFont > CanvasFontBaseT;
-+
-+ class CanvasFont : public ::comphelper::OBaseMutex,
-+ public CanvasFontBaseT,
-+ private ::boost::noncopyable
-+ {
-+ public:
-+ typedef ::comphelper::ImplementationReference<
-+ CanvasFont,
-+ ::com::sun::star::rendering::XCanvasFont > ImplRef;
-+
-+ CanvasFont( const ::com::sun::star::rendering::FontRequest& fontRequest,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties,
-+ const ::com::sun::star::geometry::Matrix2D& fontMatrix );
-+
-+ /// Dispose all internal references
-+ virtual void SAL_CALL disposing();
-+
-+ // XCanvasFont
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > SAL_CALL createTextLayout( const ::com::sun::star::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::rendering::FontRequest SAL_CALL getFontRequest( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ const ::com::sun::star::geometry::Matrix2D& getFontMatrix() const;
-+
-+ private:
-+ ::com::sun::star::rendering::FontRequest maFontRequest;
-+ ::com::sun::star::geometry::Matrix2D maFontMatrix;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvashelper.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvashelper.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,1022 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ * Parts copyright 2004 David Reveman, Peter Nilsson
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#define GL_GLEXT_PROTOTYPES
-+
-+#include "ogl_canvashelper.hxx"
-+
-+#include <rtl/crc.h>
-+#include <canvas/debug.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontriangulator.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+
-+#include <com/sun/star/rendering/TexturingMode.hpp>
-+#include <com/sun/star/rendering/CompositeOperation.hpp>
-+#include <com/sun/star/rendering/RepaintResult.hpp>
-+#include <com/sun/star/rendering/PathCapType.hpp>
-+#include <com/sun/star/rendering/PathJoinType.hpp>
-+
-+#include <vcl/virdev.hxx>
-+#include <vcl/metric.hxx>
-+#include <vcl/font.hxx>
-+
-+#include "ogl_canvasfont.hxx"
-+#include "ogl_canvastools.hxx"
-+#include "ogl_canvasbitmap.hxx"
-+#include "ogl_spritecanvas.hxx"
-+#include "ogl_texturecache.hxx"
-+#include "ogl_tools.hxx"
-+
-+#include <GL/gl.h>
-+#include <GL/glu.h>
-+#include <GL/glext.h>
-+
-+#include <boost/scoped_array.hpp>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ /* Concepts:
-+ =========
-+
-+ This OpenGL canvas implementation tries to keep all render
-+ output as high-level as possible, i.e. geometry data and
-+ externally-provided bitmaps. Therefore, calls at the
-+ XCanvas-interfaces are not immediately transformed into colored
-+ pixel inside some GL buffer, but are retained simply with their
-+ call parameters. Only after XSpriteCanvas::updateScreen() has
-+ been called, this all gets transferred to the OpenGL subsystem
-+ and converted to a visible scene. The big advantage is, this
-+ makes sprite modifications practically zero-overhead, and saves
-+ a lot on texture memory (compared to the directx canvas, which
-+ immediately dumps every render call into a texture).
-+
-+ The drawback, of course, is that complex images churn a lot of
-+ GPU cycles on every re-rendering.
-+
-+ For the while, I'll be using immediate mode, i.e. transfer data
-+ over and over again to the OpenGL subsystem. Alternatively,
-+ there are display lists, which at least keep the data on the
-+ server, or even better, vertex buffers, which copy geometry
-+ data over en bloc.
-+
-+ Next todo: put polygon geometry into vertex buffer (LRU cache
-+ necessary?) - or, rather, buffer objects! prune entries older
-+ than one updateScreen() call)
-+
-+ Text: http://www.opengl.org/resources/features/fontsurvey/
-+ */
-+
-+ struct CanvasHelper::Action
-+ {
-+ ::basegfx::B2DHomMatrix maTransform;
-+ GLenum meSrcBlendMode;
-+ GLenum meDstBlendMode;
-+ rendering::ARGBColor maARGBColor;
-+ ::basegfx::B2DPolyPolygonVector maPolyPolys;
-+
-+ ::boost::function6< bool,
-+ const CanvasHelper&,
-+ const ::basegfx::B2DHomMatrix&,
-+ GLenum,
-+ GLenum,
-+ const rendering::ARGBColor&,
-+ const ::basegfx::B2DPolyPolygonVector& > maFunction;
-+ };
-+
-+ namespace
-+ {
-+ bool lcl_drawPoint( const CanvasHelper& /*rHelper*/,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const geometry::RealPoint2D& rPoint )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ glBegin(GL_POINTS);
-+ glVertex2d(rPoint.X, rPoint.Y);
-+ glEnd();
-+
-+ return true;
-+ }
-+
-+ bool lcl_drawLine( const CanvasHelper& /*rHelper*/,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const geometry::RealPoint2D& rStartPoint,
-+ const geometry::RealPoint2D& rEndPoint )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ glBegin(GL_LINES);
-+ glVertex2d(rStartPoint.X, rStartPoint.Y);
-+ glVertex2d(rEndPoint.X, rEndPoint.Y);
-+ glEnd();
-+
-+ return true;
-+ }
-+
-+ bool lcl_drawPolyPolygon( const CanvasHelper& /*rHelper*/,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
-+ const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
-+ while( aCurr != aEnd )
-+ renderPolyPolygon(*aCurr++);
-+
-+ return true;
-+ }
-+
-+ bool lcl_fillPolyPolygon( const CanvasHelper& /*rHelper*/,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
-+ const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
-+ while( aCurr != aEnd )
-+ {
-+ glBegin(GL_TRIANGLES);
-+ renderComplexPolyPolygon(*aCurr++);
-+ glEnd();
-+ }
-+
-+ return true;
-+ }
-+
-+ bool lcl_fillGradientPolyPolygon( const CanvasHelper& rHelper,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const ::canvas::ParametricPolyPolygon::Values& rValues,
-+ const rendering::Texture& rTexture,
-+ const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rendering::ARGBColor());
-+
-+ // convert to weird canvas textur coordinate system (not
-+ // [0,1]^2, but path coordinate system)
-+ ::basegfx::B2DHomMatrix aTextureTransform;
-+ ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform,
-+ rTexture.AffineTransform );
-+ ::basegfx::B2DRange aBounds;
-+ ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
-+ const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
-+ while( aCurr != aEnd )
-+ aBounds.expand(::basegfx::tools::getRange(*aCurr++));
-+ aTextureTransform.translate(-aBounds.getMinX(), -aBounds.getMinY());
-+ aTextureTransform.scale(1/aBounds.getWidth(), 1/aBounds.getHeight());
-+
-+ const sal_Int32 nNumCols=rValues.maColors.getLength();
-+ uno::Sequence< rendering::ARGBColor > aColors(nNumCols);
-+ rendering::ARGBColor* const pColors=aColors.getArray();
-+ rendering::ARGBColor* pCurrCol=pColors;
-+ for( sal_Int32 i=0; i<nNumCols; ++i )
-+ *pCurrCol++ = rHelper.getDevice()->getDeviceColorSpace()->convertToARGB(rValues.maColors[i])[0];
-+
-+ OSL_ASSERT(nNumCols == rValues.maStops.getLength());
-+
-+ switch( rValues.meType )
-+ {
-+ case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
-+ rHelper.getDeviceHelper()->useLinearGradientShader(pColors,
-+ rValues.maStops,
-+ aTextureTransform);
-+ break;
-+
-+ case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
-+ rHelper.getDeviceHelper()->useRadialGradientShader(pColors,
-+ rValues.maStops,
-+ aTextureTransform);
-+ break;
-+
-+ case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
-+ rHelper.getDeviceHelper()->useRectangularGradientShader(pColors,
-+ rValues.maStops,
-+ aTextureTransform);
-+ break;
-+
-+ default:
-+ ENSURE_OR_THROW( false,
-+ "CanvasHelper lcl_fillGradientPolyPolygon(): Unexpected case" );
-+ }
-+
-+
-+ aCurr=rPolyPolygons.begin();
-+ while( aCurr != aEnd )
-+ {
-+ glBegin(GL_TRIANGLES);
-+ renderComplexPolyPolygon(*aCurr++);
-+ glEnd();
-+ }
-+
-+ glUseProgram(0);
-+ glLoadIdentity();
-+ glMatrixMode(GL_MODELVIEW);
-+
-+ return true;
-+ }
-+
-+ bool lcl_drawOwnBitmap( const CanvasHelper& /*rHelper*/,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const CanvasBitmap& rBitmap )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ return rBitmap.renderRecordedActions();
-+ }
-+
-+ bool lcl_drawGenericBitmap( const CanvasHelper& rHelper,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor,
-+ const geometry::IntegerSize2D& rPixelSize,
-+ const uno::Sequence<sal_Int8>& rPixelData,
-+ sal_uInt32 nPixelCrc32 )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rColor);
-+
-+ const unsigned int nTexId=rHelper.getDeviceHelper()->getTextureCache().getTexture(
-+ rPixelSize, rPixelData.getConstArray(), nPixelCrc32);
-+
-+ glBindTexture(GL_TEXTURE_2D, nTexId);
-+ glEnable(GL_TEXTURE_2D);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MIN_FILTER,
-+ GL_NEAREST);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MAG_FILTER,
-+ GL_NEAREST);
-+ glEnable(GL_BLEND);
-+ glBlendFunc(GL_SRC_ALPHA,
-+ GL_ONE_MINUS_SRC_ALPHA);
-+
-+ // blend against fixed vertex color; texture alpha is multiplied in
-+ glColor4f(1,1,1,1);
-+
-+ glBegin(GL_TRIANGLE_STRIP);
-+ glTexCoord2f(0,0); glVertex2d(0,0);
-+ glTexCoord2f(0,1); glVertex2d(0, rPixelSize.Height);
-+ glTexCoord2f(1,0); glVertex2d(rPixelSize.Width,0);
-+ glTexCoord2f(1,1); glVertex2d(rPixelSize.Width,rPixelSize.Height);
-+ glEnd();
-+
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+ glDisable(GL_TEXTURE_2D);
-+
-+ return true;
-+ }
-+
-+ bool lcl_fillTexturedPolyPolygon( const CanvasHelper& rHelper,
-+ const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::Texture& rTexture,
-+ const geometry::IntegerSize2D& rPixelSize,
-+ const uno::Sequence<sal_Int8>& rPixelData,
-+ sal_uInt32 nPixelCrc32,
-+ const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
-+ {
-+ TransformationPreserver aPreserver;
-+ setupState(rTransform, eSrcBlend, eDstBlend, rendering::ARGBColor());
-+
-+ const unsigned int nTexId=rHelper.getDeviceHelper()->getTextureCache().getTexture(
-+ rPixelSize, rPixelData.getConstArray(), nPixelCrc32);
-+
-+ glBindTexture(GL_TEXTURE_2D, nTexId);
-+ glEnable(GL_TEXTURE_2D);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MIN_FILTER,
-+ GL_NEAREST);
-+ glTexParameteri(GL_TEXTURE_2D,
-+ GL_TEXTURE_MAG_FILTER,
-+ GL_NEAREST);
-+ glEnable(GL_BLEND);
-+ glBlendFunc(GL_SRC_ALPHA,
-+ GL_ONE_MINUS_SRC_ALPHA);
-+
-+ // convert to weird canvas textur coordinate system (not
-+ // [0,1]^2, but path coordinate system)
-+ ::basegfx::B2DHomMatrix aTextureTransform;
-+ ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform,
-+ rTexture.AffineTransform );
-+ ::basegfx::B2DRange aBounds;
-+ ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
-+ const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
-+ while( aCurr != aEnd )
-+ aBounds.expand(::basegfx::tools::getRange(*aCurr++));
-+ aTextureTransform.translate(-aBounds.getMinX(), -aBounds.getMinY());
-+ aTextureTransform.scale(1/aBounds.getWidth(), 1/aBounds.getHeight());
-+ aTextureTransform.invert();
-+
-+ glMatrixMode(GL_TEXTURE);
-+ double aTexTransform[] =
-+ {
-+ aTextureTransform.get(0,0), aTextureTransform.get(1,0), 0, 0,
-+ aTextureTransform.get(0,1), aTextureTransform.get(1,1), 0, 0,
-+ 0, 0, 1, 0,
-+ aTextureTransform.get(0,2), aTextureTransform.get(1,2), 0, 1
-+ };
-+ glLoadMatrixd(aTexTransform);
-+
-+ // blend against fixed vertex color; texture alpha is multiplied in
-+ glColor4f(1,1,1,rTexture.Alpha);
-+
-+ aCurr=rPolyPolygons.begin();
-+ while( aCurr != aEnd )
-+ {
-+ glBegin(GL_TRIANGLES);
-+ renderComplexPolyPolygon(*aCurr++);
-+ glEnd();
-+ }
-+
-+ glLoadIdentity();
-+ glMatrixMode(GL_MODELVIEW);
-+
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+ glDisable(GL_TEXTURE_2D);
-+
-+ return true;
-+ }
-+ }
-+
-+ CanvasHelper::CanvasHelper() :
-+ mpDevice( NULL ),
-+ mpRecordedActions()
-+ {}
-+
-+ CanvasHelper::~CanvasHelper()
-+ {}
-+
-+ CanvasHelper& CanvasHelper::operator=( const CanvasHelper& rSrc )
-+ {
-+ mpDevice = rSrc.mpDevice;
-+ mpDeviceHelper = rSrc.mpDeviceHelper;
-+ mpRecordedActions = rSrc.mpRecordedActions;
-+ return *this;
-+ }
-+
-+ void CanvasHelper::disposing()
-+ {
-+ RecordVectorT aThrowaway;
-+ mpRecordedActions.swap( aThrowaway );
-+ mpDevice = NULL;
-+ mpDeviceHelper = NULL;
-+ }
-+
-+ void CanvasHelper::init( rendering::XGraphicDevice& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper )
-+ {
-+ mpDevice = &rDevice;
-+ mpDeviceHelper = &rDeviceHelper;
-+ }
-+
-+ void CanvasHelper::clear()
-+ {
-+ mpRecordedActions->clear();
-+ }
-+
-+ void CanvasHelper::drawPoint( const rendering::XCanvas* /*pCanvas*/,
-+ const geometry::RealPoint2D& aPoint,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maFunction = ::boost::bind(&lcl_drawPoint,
-+ _1,_2,_3,_4,_5,
-+ aPoint);
-+ }
-+ }
-+
-+ void CanvasHelper::drawLine( const rendering::XCanvas* /*pCanvas*/,
-+ const geometry::RealPoint2D& aStartPoint,
-+ const geometry::RealPoint2D& aEndPoint,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maFunction = ::boost::bind(&lcl_drawLine,
-+ _1,_2,_3,_4,_5,
-+ aStartPoint,aEndPoint);
-+ }
-+ }
-+
-+ void CanvasHelper::drawBezier( const rendering::XCanvas* /*pCanvas*/,
-+ const geometry::RealBezierSegment2D& aBezierSegment,
-+ const geometry::RealPoint2D& aEndPoint,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+
-+ // TODO(F2): subdivide&render whole curve
-+ rAct.maFunction = ::boost::bind(&lcl_drawLine,
-+ _1,_2,_3,_4,_5,
-+ geometry::RealPoint2D(
-+ aBezierSegment.Px,
-+ aBezierSegment.Py),
-+ aEndPoint);
-+ }
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ ENSURE_OR_THROW( xPolyPolygon.is(),
-+ "CanvasHelper::drawPolyPolygon: polygon is NULL");
-+
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maPolyPolys.push_back(
-+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
-+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
-+
-+ rAct.maFunction = &lcl_drawPolyPolygon;
-+ }
-+
-+ // TODO(P1): Provide caching here.
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState,
-+ const rendering::StrokeAttributes& /*strokeAttributes*/ )
-+ {
-+ ENSURE_OR_THROW( xPolyPolygon.is(),
-+ "CanvasHelper::strokePolyPolygon: polygon is NULL");
-+
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maPolyPolys.push_back(
-+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
-+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
-+
-+ // TODO(F3): fallback to drawPolyPolygon currently
-+ rAct.maFunction = &lcl_drawPolyPolygon;
-+ }
-+
-+ // TODO(P1): Provide caching here.
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
-+ const rendering::ViewState& /*viewState*/,
-+ const rendering::RenderState& /*renderState*/,
-+ const uno::Sequence< rendering::Texture >& /*textures*/,
-+ const rendering::StrokeAttributes& /*strokeAttributes*/ )
-+ {
-+ // TODO
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
-+ const rendering::ViewState& /*viewState*/,
-+ const rendering::RenderState& /*renderState*/,
-+ const uno::Sequence< rendering::Texture >& /*textures*/,
-+ const uno::Reference< geometry::XMapping2D >& /*xMapping*/,
-+ const rendering::StrokeAttributes& /*strokeAttributes*/ )
-+ {
-+ // TODO
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XPolyPolygon2D > CanvasHelper::queryStrokeShapes( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
-+ const rendering::ViewState& /*viewState*/,
-+ const rendering::RenderState& /*renderState*/,
-+ const rendering::StrokeAttributes& /*strokeAttributes*/ )
-+ {
-+ // TODO
-+ return uno::Reference< rendering::XPolyPolygon2D >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ ENSURE_OR_THROW( xPolyPolygon.is(),
-+ "CanvasHelper::fillPolyPolygon: polygon is NULL");
-+
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maPolyPolys.push_back(
-+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
-+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
-+
-+ rAct.maFunction = &lcl_fillPolyPolygon;
-+ }
-+
-+ // TODO(P1): Provide caching here.
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState,
-+ const uno::Sequence< rendering::Texture >& textures )
-+ {
-+ ENSURE_OR_THROW( xPolyPolygon.is(),
-+ "CanvasHelper::fillPolyPolygon: polygon is NULL");
-+
-+ if( mpDevice )
-+ {
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maPolyPolys.push_back(
-+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
-+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
-+
-+ // TODO(F1): Multi-texturing
-+ if( textures[0].Gradient.is() )
-+ {
-+ // try to cast XParametricPolyPolygon2D reference to
-+ // our implementation class.
-+ ::canvas::ParametricPolyPolygon* pGradient =
-+ dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() );
-+
-+ if( pGradient )
-+ {
-+ // copy state from Gradient polypoly locally
-+ // (given object might change!)
-+ const ::canvas::ParametricPolyPolygon::Values& rValues(
-+ pGradient->getValues() );
-+
-+ rAct.maFunction = ::boost::bind(&lcl_fillGradientPolyPolygon,
-+ _1,_2,_3,_4,
-+ rValues,
-+ textures[0],
-+ _6);
-+ }
-+ else
-+ {
-+ // TODO(F1): The generic case is missing here
-+ ENSURE_OR_THROW( false,
-+ "CanvasHelper::fillTexturedPolyPolygon(): unknown parametric polygon encountered" );
-+ }
-+ }
-+ else if( textures[0].Bitmap.is() )
-+ {
-+ // own bitmap?
-+ CanvasBitmap* pOwnBitmap=dynamic_cast<CanvasBitmap*>(textures[0].Bitmap.get());
-+ if( pOwnBitmap )
-+ {
-+ // TODO(F2): own texture bitmap
-+ }
-+ else
-+ {
-+ // TODO(P3): Highly inefficient - simply copies pixel data
-+
-+ uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntegerBitmap(
-+ textures[0].Bitmap,
-+ uno::UNO_QUERY);
-+ if( xIntegerBitmap.is() )
-+ {
-+ const geometry::IntegerSize2D aSize=xIntegerBitmap->getSize();
-+ rendering::IntegerBitmapLayout aLayout;
-+ uno::Sequence<sal_Int8> aPixelData=
-+ xIntegerBitmap->getData(
-+ aLayout,
-+ geometry::IntegerRectangle2D(0,0,aSize.Width,aSize.Height));
-+
-+ // force-convert color to ARGB8888 int color space
-+ uno::Sequence<sal_Int8> aARGBBytes(
-+ aLayout.ColorSpace->convertToIntegerColorSpace(
-+ aPixelData,
-+ canvas::tools::getStdColorSpace()));
-+
-+ rAct.maFunction = ::boost::bind(&lcl_fillTexturedPolyPolygon,
-+ _1,_2,_3,_4,
-+ textures[0],
-+ aSize,
-+ aARGBBytes,
-+ rtl_crc32(0,
-+ aARGBBytes.getConstArray(),
-+ aARGBBytes.getLength()),
-+ _6);
-+ }
-+ // TODO(F1): handle non-integer case
-+ }
-+ }
-+ }
-+
-+ // TODO(P1): Provide caching here.
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
-+ const rendering::ViewState& /*viewState*/,
-+ const rendering::RenderState& /*renderState*/,
-+ const uno::Sequence< rendering::Texture >& /*textures*/,
-+ const uno::Reference< geometry::XMapping2D >& /*xMapping*/ )
-+ {
-+ // TODO
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* /*pCanvas*/,
-+ const rendering::FontRequest& fontRequest,
-+ const uno::Sequence< beans::PropertyValue >& extraFontProperties,
-+ const geometry::Matrix2D& fontMatrix )
-+ {
-+ if( mpDevice )
-+ return uno::Reference< rendering::XCanvasFont >(
-+ new CanvasFont(fontRequest, extraFontProperties, fontMatrix ) );
-+
-+ return uno::Reference< rendering::XCanvasFont >();
-+ }
-+
-+ uno::Sequence< rendering::FontInfo > CanvasHelper::queryAvailableFonts( const rendering::XCanvas* /*pCanvas*/,
-+ const rendering::FontInfo& /*aFilter*/,
-+ const uno::Sequence< beans::PropertyValue >& /*aFontProperties*/ )
-+ {
-+ // TODO
-+ return uno::Sequence< rendering::FontInfo >();
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawText( const rendering::XCanvas* /*pCanvas*/,
-+ const rendering::StringContext& /*text*/,
-+ const uno::Reference< rendering::XCanvasFont >& /*xFont*/,
-+ const rendering::ViewState& /*viewState*/,
-+ const rendering::RenderState& /*renderState*/,
-+ sal_Int8 /*textDirection*/ )
-+ {
-+ // TODO - but not used from slideshow
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XTextLayout >& xLayoutetText,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ ENSURE_OR_THROW( xLayoutetText.is(),
-+ "CanvasHelper::drawTextLayout: text is NULL");
-+
-+ if( mpDevice )
-+ {
-+ VirtualDevice aVDev;
-+ aVDev.EnableOutput(FALSE);
-+
-+ CanvasFont* pFont=dynamic_cast<CanvasFont*>(xLayoutetText->getFont().get());
-+ const rendering::StringContext& rTxt=xLayoutetText->getText();
-+ if( pFont && rTxt.Length )
-+ {
-+ // create the font
-+ const rendering::FontRequest& rFontRequest = pFont->getFontRequest();
-+ const geometry::Matrix2D& rFontMatrix = pFont->getFontMatrix();
-+ ::Font aFont(
-+ rFontRequest.FontDescription.FamilyName,
-+ rFontRequest.FontDescription.StyleName,
-+ Size( 0, ::basegfx::fround(rFontRequest.CellSize)));
-+
-+ aFont.SetAlign( ALIGN_BASELINE );
-+ aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
-+ aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==util::TriState_YES) ? TRUE : FALSE );
-+ aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
-+ aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
-+
-+ // adjust to stretched font
-+ if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
-+ {
-+ const Size aSize = aVDev.GetFontMetric( aFont ).GetSize();
-+ const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
-+ double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
-+
-+ if( !::basegfx::fTools::equalZero( fDividend) )
-+ fStretch /= fDividend;
-+
-+ const sal_Int32 nNewWidth = ::basegfx::fround( aSize.Width() * fStretch );
-+
-+ aFont.SetWidth( nNewWidth );
-+ }
-+
-+ // set font
-+ aVDev.SetFont(aFont);
-+
-+ const Point aEmptyPoint(0, 0);
-+ const String aText(rTxt.Text.getStr());
-+
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+
-+ // handle custom spacing, if there
-+ uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements();
-+ if( aLogicalAdvancements.getLength() )
-+ {
-+ // create the DXArray
-+ const sal_Int32 nLen( aLogicalAdvancements.getLength() );
-+ ::boost::scoped_array<sal_Int32> pDXArray( new sal_Int32[nLen] );
-+ for( sal_Int32 i=0; i<nLen; ++i )
-+ pDXArray[i] = basegfx::fround( aLogicalAdvancements[i] );
-+
-+ // get the glyphs
-+ aVDev.GetTextOutlines(rAct.maPolyPolys,
-+ rTxt.Text,
-+ 0,
-+ (xub_StrLen)rTxt.StartPosition,
-+ (xub_StrLen)rTxt.Length,
-+ TRUE,
-+ 0,
-+ pDXArray.get() );
-+ }
-+ else
-+ {
-+ // get the glyphs
-+ aVDev.GetTextOutlines(rAct.maPolyPolys,
-+ rTxt.Text,
-+ 0,
-+ (xub_StrLen)rTxt.StartPosition,
-+ (xub_StrLen)rTxt.Length );
-+ }
-+
-+ // own copy, for thread safety
-+ std::for_each(rAct.maPolyPolys.begin(),
-+ rAct.maPolyPolys.end(),
-+ ::boost::mem_fn(&::basegfx::B2DPolyPolygon::makeUnique));
-+
-+ rAct.maFunction = &lcl_fillPolyPolygon;
-+ }
-+ }
-+
-+ // TODO
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas* /*pCanvas*/,
-+ const uno::Reference< rendering::XBitmap >& xBitmap,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ ENSURE_OR_THROW( xBitmap.is(),
-+ "CanvasHelper::drawBitmap: bitmap is NULL");
-+
-+ if( mpDevice )
-+ {
-+ // own bitmap?
-+ CanvasBitmap* pOwnBitmap=dynamic_cast<CanvasBitmap*>(xBitmap.get());
-+ if( pOwnBitmap )
-+ {
-+ // insert as transformed copy of bitmap action vector -
-+ // during rendering, this gets rendered into a temporary
-+ // buffer, and then composited to the front
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maFunction = ::boost::bind(&lcl_drawOwnBitmap,
-+ _1,_2,_3,_4,_5,
-+ *pOwnBitmap);
-+ }
-+ else
-+ {
-+ // TODO(P3): Highly inefficient - simply copies pixel data
-+
-+ uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntegerBitmap(
-+ xBitmap, uno::UNO_QUERY);
-+ if( xIntegerBitmap.is() )
-+ {
-+ const geometry::IntegerSize2D aSize=xBitmap->getSize();
-+ rendering::IntegerBitmapLayout aLayout;
-+ uno::Sequence<sal_Int8> aPixelData=
-+ xIntegerBitmap->getData(
-+ aLayout,
-+ geometry::IntegerRectangle2D(0,0,aSize.Width,aSize.Height));
-+
-+ // force-convert color to ARGB8888 int color space
-+ uno::Sequence<sal_Int8> aARGBBytes(
-+ aLayout.ColorSpace->convertToIntegerColorSpace(
-+ aPixelData,
-+ canvas::tools::getStdColorSpace()));
-+
-+ mpRecordedActions->push_back( Action() );
-+ Action& rAct=mpRecordedActions->back();
-+
-+ setupGraphicsState( rAct, viewState, renderState );
-+ rAct.maFunction = ::boost::bind(&lcl_drawGenericBitmap,
-+ _1,_2,_3,_4,_5,
-+ aSize, aARGBBytes,
-+ rtl_crc32(0,
-+ aARGBBytes.getConstArray(),
-+ aARGBBytes.getLength()));
-+ }
-+ // TODO(F1): handle non-integer case
-+ }
-+ }
-+
-+ // TODO(P1): Provide caching here.
-+ return uno::Reference< rendering::XCachedPrimitive >(NULL);
-+ }
-+
-+ uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas,
-+ const uno::Reference< rendering::XBitmap >& xBitmap,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ // TODO(F3): remove this wart altogether
-+ return drawBitmap(pCanvas, xBitmap, viewState, renderState);
-+ }
-+
-+ uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice()
-+ {
-+ return uno::Reference< rendering::XGraphicDevice >(mpDevice);
-+ }
-+
-+ void CanvasHelper::setupGraphicsState( Action& o_action,
-+ const rendering::ViewState& viewState,
-+ const rendering::RenderState& renderState )
-+ {
-+ ENSURE_OR_THROW( mpDevice,
-+ "CanvasHelper::setupGraphicsState: reference device invalid" );
-+
-+ // TODO(F3): clipping
-+ // TODO(P2): think about caching transformations between canvas calls
-+
-+ // setup overall transform only now. View clip above was
-+ // relative to view transform
-+ ::basegfx::B2DHomMatrix aTransform;
-+ ::canvas::tools::mergeViewAndRenderTransform(o_action.maTransform,
-+ viewState,
-+ renderState);
-+ // setup compositing - mapping courtesy David Reveman
-+ // (glitz_operator.c)
-+ switch( renderState.CompositeOperation )
-+ {
-+ case rendering::CompositeOperation::OVER:
-+ o_action.meSrcBlendMode=GL_ONE;
-+ o_action.meDstBlendMode=GL_ONE_MINUS_SRC_ALPHA;
-+ break;
-+ case rendering::CompositeOperation::CLEAR:
-+ o_action.meSrcBlendMode=GL_ZERO;
-+ o_action.meDstBlendMode=GL_ZERO;
-+ break;
-+ case rendering::CompositeOperation::SOURCE:
-+ o_action.meSrcBlendMode=GL_ONE;
-+ o_action.meDstBlendMode=GL_ZERO;
-+ break;
-+ case rendering::CompositeOperation::UNDER:
-+ // FALLTHROUGH intended - but correct?!
-+ case rendering::CompositeOperation::DESTINATION:
-+ o_action.meSrcBlendMode=GL_ZERO;
-+ o_action.meDstBlendMode=GL_ONE;
-+ break;
-+ case rendering::CompositeOperation::INSIDE:
-+ o_action.meSrcBlendMode=GL_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_ZERO;
-+ break;
-+ case rendering::CompositeOperation::INSIDE_REVERSE:
-+ o_action.meSrcBlendMode=GL_ONE_MINUS_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_ZERO;
-+ break;
-+ case rendering::CompositeOperation::OUTSIDE:
-+ o_action.meSrcBlendMode=GL_ONE_MINUS_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_ONE;
-+ break;
-+ case rendering::CompositeOperation::OUTSIDE_REVERSE:
-+ o_action.meSrcBlendMode=GL_ZERO;
-+ o_action.meDstBlendMode=GL_ONE_MINUS_SRC_ALPHA;
-+ break;
-+ case rendering::CompositeOperation::ATOP:
-+ o_action.meSrcBlendMode=GL_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_ONE_MINUS_SRC_ALPHA;
-+ break;
-+ case rendering::CompositeOperation::ATOP_REVERSE:
-+ o_action.meSrcBlendMode=GL_ONE_MINUS_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_SRC_ALPHA;
-+ break;
-+ case rendering::CompositeOperation::XOR:
-+ o_action.meSrcBlendMode=GL_ONE_MINUS_DST_ALPHA;
-+ o_action.meDstBlendMode=GL_ONE_MINUS_SRC_ALPHA;
-+ break;
-+ case rendering::CompositeOperation::ADD:
-+ o_action.meSrcBlendMode=GL_ONE;
-+ o_action.meDstBlendMode=GL_ONE;
-+ break;
-+ case rendering::CompositeOperation::SATURATE:
-+ o_action.meSrcBlendMode=GL_SRC_ALPHA_SATURATE;
-+ o_action.meDstBlendMode=GL_SRC_ALPHA_SATURATE;
-+ break;
-+
-+ default:
-+ ENSURE_OR_THROW( false, "CanvasHelper::setupGraphicsState: unexpected mode" );
-+ break;
-+ }
-+
-+ o_action.maARGBColor =
-+ mpDevice->getDeviceColorSpace()->convertToARGB(renderState.DeviceColor)[0];
-+ }
-+
-+ void CanvasHelper::flush() const
-+ {
-+ }
-+
-+ bool CanvasHelper::renderRecordedActions() const
-+ {
-+ std::vector<Action>::const_iterator aCurr(mpRecordedActions->begin());
-+ const std::vector<Action>::const_iterator aEnd(mpRecordedActions->end());
-+ while( aCurr != aEnd )
-+ {
-+ if( !aCurr->maFunction( *this,
-+ aCurr->maTransform,
-+ aCurr->meSrcBlendMode,
-+ aCurr->meDstBlendMode,
-+ aCurr->maARGBColor,
-+ aCurr->maPolyPolys ) )
-+ return false;
-+
-+ ++aCurr;
-+ }
-+
-+ return true;
-+ }
-+
-+ size_t CanvasHelper::getRecordedActionCount() const
-+ {
-+ return mpRecordedActions->size();
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvashelper.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,242 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVASHELPER_HXX_
-+#define OGL_CANVASHELPER_HXX_
-+
-+#include <com/sun/star/rendering/XCanvas.hpp>
-+
-+#include <basegfx/vector/b2isize.hxx>
-+#include <basegfx/vector/b2dsize.hxx>
-+
-+#include <o3tl/cow_wrapper.hxx>
-+#include <vector>
-+
-+namespace oglcanvas
-+{
-+ class SpriteDeviceHelper;
-+
-+ /** Helper class for basic canvas functionality. */
-+ class CanvasHelper
-+ {
-+ public:
-+ CanvasHelper();
-+
-+ // outline because of incomplete type Action
-+ ~CanvasHelper();
-+ CanvasHelper& operator=( const CanvasHelper& );
-+
-+ /// Release all references
-+ void disposing();
-+
-+ /** Initialize canvas helper
-+
-+ This method late-initializes the canvas helper, providing
-+ it with the necessary device and output objects. Note that
-+ the CanvasHelper does <em>not</em> take ownership of the
-+ passed rDevice reference, nor does it perform any
-+ reference counting. Thus, to prevent the reference counted
-+ SpriteCanvas object from deletion, the user of this class
-+ is responsible for holding ref-counted references itself!
-+
-+ @param rDevice
-+ Reference device this canvas is associated with
-+
-+ */
-+ void init( ::com::sun::star::rendering::XGraphicDevice& rDevice,
-+ SpriteDeviceHelper& rDeviceHelper );
-+
-+ // CanvasHelper functionality
-+ // ==========================
-+
-+ // XCanvas (only providing, not implementing the
-+ // interface. Also note subtle method parameter differences)
-+ void clear();
-+ void drawPoint( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::geometry::RealPoint2D& aPoint,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ void drawLine( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
-+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ void drawBezier( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
-+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::rendering::Texture >& textures,
-+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::rendering::Texture >& textures,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::geometry::XMapping2D >& xMapping,
-+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
-+ queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::rendering::Texture >& textures );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::rendering::Texture >& textures,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::geometry::XMapping2D >& xMapping );
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
-+ createFont( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::rendering::FontRequest& fontRequest,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::beans::PropertyValue >& extraFontProperties,
-+ const ::com::sun::star::geometry::Matrix2D& fontMatrix );
-+
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo >
-+ queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::rendering::FontInfo& aFilter,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::beans::PropertyValue >& aFontProperties );
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ drawText( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::rendering::StringContext& text,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XCanvasFont >& xFont,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState,
-+ sal_Int8 textDirection );
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XTextLayout >& layoutetText,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ drawBitmap( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XBitmap >& xBitmap,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
-+ drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* pCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XBitmap >& xBitmap,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >
-+ getDevice();
-+
-+ // Flush drawing queue to screen
-+ void flush() const;
-+
-+ /** Called from XCanvas base classes, to notify that content
-+ is _about_ to change
-+ */
-+ void modifying() {}
-+
-+ /** Write out recorded actions
-+ */
-+ bool renderRecordedActions() const;
-+
-+ /** Retrieve number of recorded actions
-+ */
-+ size_t getRecordedActionCount() const;
-+
-+ SpriteDeviceHelper* getDeviceHelper() const { return mpDeviceHelper; }
-+ ::com::sun::star::rendering::XGraphicDevice* getDevice() const { return mpDevice; }
-+
-+ struct Action;
-+ typedef o3tl::cow_wrapper< std::vector<Action>,
-+ o3tl::ThreadSafeRefCountingPolicy > RecordVectorT;
-+
-+ private:
-+ // declared, but not defined
-+ CanvasHelper( const CanvasHelper& );
-+
-+ void setupGraphicsState( Action& o_action,
-+ const ::com::sun::star::rendering::ViewState& viewState,
-+ const ::com::sun::star::rendering::RenderState& renderState );
-+
-+ /** Phyical output device
-+
-+ Deliberately not a refcounted reference, because of
-+ potential circular references for spritecanvas.
-+ */
-+ ::com::sun::star::rendering::XGraphicDevice* mpDevice;
-+
-+ /** Internal helper - used for a few global GL objects,
-+ e.g. shader programs; and caches
-+ */
-+ SpriteDeviceHelper* mpDeviceHelper;
-+
-+ /** Ptr to array of recorded render calls
-+
-+ Gets shared copy-on-write, when this CanvasHelper is
-+ copied (used e.g. for CanvasBitmap)
-+ */
-+ RecordVectorT mpRecordedActions;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvastools.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvastools.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,147 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ * Parts copyright 2004 David Reveman, Peter Nilsson
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#define GL_GLEXT_PROTOTYPES
-+
-+#include "ogl_canvastools.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/tools/tools.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolygontriangulator.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+
-+#include <com/sun/star/rendering/ARGBColor.hpp>
-+
-+#include <GL/gl.h>
-+#include <GL/glu.h>
-+#include <GL/glext.h>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ /// triangulates polygon before
-+ void renderComplexPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
-+ {
-+ ::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
-+ if( aPolyPoly.areControlPointsUsed() )
-+ aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
-+ const ::basegfx::B2DRange& rBounds(aPolyPoly.getB2DRange());
-+ const double nWidth=rBounds.getWidth();
-+ const double nHeight=rBounds.getHeight();
-+ const ::basegfx::B2DPolygon& rTriangulatedPolygon(
-+ ::basegfx::triangulator::triangulate(aPolyPoly));
-+
-+ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
-+ {
-+ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
-+ const double s(rPt.getX()/nWidth);
-+ const double t(rPt.getY()/nHeight);
-+ glTexCoord2f(s,t); glVertex2d(rPt.getX(), rPt.getY());
-+ }
-+ }
-+
-+ /** only use this for line polygons.
-+
-+ better not leave triangulation to OpenGL. also, ignores texturing
-+ */
-+ void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
-+ {
-+ ::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
-+ if( aPolyPoly.areControlPointsUsed() )
-+ aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
-+
-+ for( sal_uInt32 i=0; i<aPolyPoly.count(); i++ )
-+ {
-+ glBegin(GL_LINE_STRIP);
-+
-+ const ::basegfx::B2DPolygon& rPolygon( aPolyPoly.getB2DPolygon(i) );
-+
-+ const sal_uInt32 nPts=rPolygon.count();
-+ const sal_uInt32 nExtPts=nPts + rPolygon.isClosed();
-+ for( sal_uInt32 j=0; j<nExtPts; j++ )
-+ {
-+ const ::basegfx::B2DPoint& rPt( rPolygon.getB2DPoint( j % nPts ) );
-+ glVertex2d(rPt.getX(), rPt.getY());
-+ }
-+
-+ glEnd();
-+ }
-+ }
-+
-+ void setupState( const ::basegfx::B2DHomMatrix& rTransform,
-+ GLenum eSrcBlend,
-+ GLenum eDstBlend,
-+ const rendering::ARGBColor& rColor )
-+ {
-+ double aGLTransform[] =
-+ {
-+ rTransform.get(0,0), rTransform.get(1,0), 0, 0,
-+ rTransform.get(0,1), rTransform.get(1,1), 0, 0,
-+ 0, 0, 1, 0,
-+ rTransform.get(0,2), rTransform.get(1,2), 0, 1
-+ };
-+ glMultMatrixd(aGLTransform);
-+
-+ glEnable(GL_BLEND);
-+ glBlendFunc(eSrcBlend, eDstBlend);
-+
-+ glColor4d(rColor.Red,
-+ rColor.Green,
-+ rColor.Blue,
-+ rColor.Alpha);
-+
-+ // GL 1.2:
-+ // glBlendEquation( GLenum mode );
-+ // glBlendColor( GLclampf red, GLclampf green,GLclampf blue, GLclampf alpha );
-+ // glConvolutionFilter1D
-+ // glConvolutionFilter2D
-+ // glSeparableFilter2D
-+ }
-+
-+ void renderOSD( const std::vector<double>& rNumbers, double scale )
-+ {
-+ double y=4.0;
-+ basegfx::B2DHomMatrix aTmp;
-+ basegfx::B2DHomMatrix aScaleShear;
-+ aScaleShear.shearX(-0.1);
-+ aScaleShear.scale(scale,scale);
-+
-+ for( size_t i=0; i<rNumbers.size(); ++i )
-+ {
-+ aTmp.identity();
-+ aTmp.translate(0,y);
-+ y += 1.2*scale;
-+
-+ basegfx::B2DPolyPolygon aPoly=
-+ basegfx::tools::number2PolyPolygon(rNumbers[i],10,3);
-+
-+ aTmp=aTmp*aScaleShear;
-+ aPoly.transform(aTmp);
-+
-+ glColor4f(0,1,0,1);
-+ renderPolyPolygon(aPoly);
-+ }
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_canvastools.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_canvastools.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,41 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVASTOOLS_HXX
-+#define OGL_CANVASTOOLS_HXX
-+
-+#include <sal/config.h>
-+#include <vector>
-+
-+namespace com { namespace sun { namespace star { namespace rendering {
-+ struct ARGBColor;
-+}}}}
-+namespace basegfx {
-+ class B2DPolyPolygon;
-+ class B2DHomMatrix;
-+}
-+
-+namespace oglcanvas
-+{
-+ void renderComplexPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
-+ void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
-+ void setupState( const ::basegfx::B2DHomMatrix& rTransform,
-+ unsigned int eSrcBlend,
-+ unsigned int eDstBlend,
-+ const ::com::sun::star::rendering::ARGBColor& rColor );
-+
-+ void renderOSD( const std::vector<double>& rNumbers, double scale );
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_spritecanvas.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_spritecanvas.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,202 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_spritecanvas.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <canvas/verbosetrace.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+#include <osl/mutex.hxx>
-+
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/registry/XRegistryKey.hpp>
-+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-+#include <com/sun/star/lang/NoSupportException.hpp>
-+
-+#include <toolkit/helper/vclunohelper.hxx>
-+#include <cppuhelper/factory.hxx>
-+#include <cppuhelper/implementationentry.hxx>
-+#include <comphelper/servicedecl.hxx>
-+
-+#include "ogl_canvascustomsprite.hxx"
-+
-+#include <GL/gl.h>
-+#include <GL/glext.h>
-+
-+#define SPRITECANVAS_SERVICE_NAME "com.sun.star.rendering.SpriteCanvas.OGL"
-+#define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.OGL"
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
-+ const uno::Reference< uno::XComponentContext >& rxContext ) :
-+ maArguments(aArguments),
-+ mxComponentContext( rxContext )
-+ {
-+ }
-+
-+ void SpriteCanvas::initialize()
-+ {
-+ // Only call initialize when not in probe mode
-+ if( maArguments.getLength() == 0 )
-+ return;
-+
-+ VERBOSE_TRACE( "SpriteCanvas::initialize called" );
-+
-+ /* aArguments:
-+ 0: ptr to creating instance (Window or VirtualDevice)
-+ 1: SystemEnvData as a streamed Any (or empty for VirtualDevice)
-+ 2: current bounds of creating instance
-+ 3: bool, denoting always on top state for Window (always false for VirtualDevice)
-+ 4: XWindow for creating Window (or empty for VirtualDevice)
-+ 5: SystemGraphicsData as a streamed Any
-+ */
-+ ENSURE_ARG_OR_THROW( maArguments.getLength() >= 5 &&
-+ maArguments[4].getValueTypeClass() == uno::TypeClass_INTERFACE,
-+ "OpenGL SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
-+
-+ uno::Reference< awt::XWindow > xParentWindow;
-+ maArguments[4] >>= xParentWindow;
-+ Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
-+ if( !pParentWindow )
-+ throw lang::NoSupportException(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "Parent window not VCL window, or canvas out-of-process!")),
-+ NULL);
-+
-+ awt::Rectangle aRect;
-+ maArguments[2] >>= aRect;
-+
-+ // setup helper
-+ maDeviceHelper.init( *pParentWindow,
-+ *this,
-+ aRect );
-+ maCanvasHelper.init( *this, maDeviceHelper );
-+ maArguments.realloc(0);
-+ }
-+
-+ void SAL_CALL SpriteCanvas::disposing()
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ mxComponentContext.clear();
-+
-+ // forward to parent
-+ SpriteCanvasBaseT::disposing();
-+ }
-+
-+ ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // avoid repaints on hidden window (hidden: not mapped to
-+ // screen). Return failure, since the screen really has _not_
-+ // been updated (caller should try again later)
-+ return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll );
-+ }
-+
-+ ::sal_Bool SAL_CALL SpriteCanvas::switchBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // avoid repaints on hidden window (hidden: not mapped to
-+ // screen). Return failure, since the screen really has _not_
-+ // been updated (caller should try again later)
-+ return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll );
-+ }
-+
-+ uno::Reference< rendering::XAnimatedSprite > SAL_CALL SpriteCanvas::createSpriteFromAnimation(
-+ const uno::Reference< rendering::XAnimation >& /*animation*/ ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ return uno::Reference< rendering::XAnimatedSprite >();
-+ }
-+
-+ uno::Reference< rendering::XAnimatedSprite > SAL_CALL SpriteCanvas::createSpriteFromBitmaps(
-+ const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/,
-+ ::sal_Int8 /*interpolationMode*/ ) throw (lang::IllegalArgumentException,
-+ rendering::VolatileContentDestroyedException,
-+ uno::RuntimeException)
-+ {
-+ return uno::Reference< rendering::XAnimatedSprite >();
-+ }
-+
-+ uno::Reference< rendering::XCustomSprite > SAL_CALL SpriteCanvas::createCustomSprite(
-+ const geometry::RealSize2D& spriteSize ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ return uno::Reference< rendering::XCustomSprite >(
-+ new CanvasCustomSprite(spriteSize, this, maDeviceHelper) );
-+ }
-+
-+ uno::Reference< rendering::XSprite > SAL_CALL SpriteCanvas::createClonedSprite(
-+ const uno::Reference< rendering::XSprite >& /*original*/ ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ return uno::Reference< rendering::XSprite >();
-+ }
-+
-+ sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return maDeviceHelper.showBuffer(mbIsVisible, bUpdateAll);
-+ }
-+
-+ ::rtl::OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (uno::RuntimeException)
-+ {
-+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SPRITECANVAS_SERVICE_NAME ) );
-+ }
-+
-+ void SpriteCanvas::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ maDeviceHelper.show(xSprite);
-+ }
-+
-+ void SpriteCanvas::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ maDeviceHelper.hide(xSprite);
-+ }
-+
-+ bool SpriteCanvas::renderRecordedActions() const
-+ {
-+ return maCanvasHelper.renderRecordedActions();
-+ }
-+
-+ static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas )
-+ {
-+ uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
-+ pCanvas->initialize();
-+ return xRet;
-+ }
-+
-+ namespace sdecl = comphelper::service_decl;
-+ sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl(&initCanvas);
-+ const sdecl::ServiceDecl oglSpriteCanvasDecl(
-+ serviceImpl,
-+ SPRITECANVAS_IMPLEMENTATION_NAME,
-+ SPRITECANVAS_SERVICE_NAME );
-+}
-+
-+// The C shared lib entry points
-+COMPHELPER_SERVICEDECL_EXPORTS1(oglcanvas::oglSpriteCanvasDecl);
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_spritecanvas.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_spritecanvas.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,125 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_SPRITECANVAS_HXX_
-+#define OGL_SPRITECANVAS_HXX_
-+
-+#include <rtl/ref.hxx>
-+
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/lang/XServiceName.hpp>
-+#include <com/sun/star/awt/XWindowListener.hpp>
-+#include <com/sun/star/util/XUpdatable.hpp>
-+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
-+#include <com/sun/star/rendering/XGraphicDevice.hpp>
-+#include <com/sun/star/rendering/XBufferController.hpp>
-+
-+#include <cppuhelper/compbase8.hxx>
-+#include <comphelper/uno3.hxx>
-+
-+#include <canvas/base/spritecanvasbase.hxx>
-+#include <canvas/base/basemutexhelper.hxx>
-+#include <canvas/base/bufferedgraphicdevicebase.hxx>
-+
-+#include "ogl_spritedevicehelper.hxx"
-+#include "ogl_canvashelper.hxx"
-+
-+
-+namespace oglcanvas
-+{
-+ class CanvasCustomSprite;
-+
-+ typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
-+ ::com::sun::star::rendering::XGraphicDevice,
-+ ::com::sun::star::lang::XMultiServiceFactory,
-+ ::com::sun::star::rendering::XBufferController,
-+ ::com::sun::star::awt::XWindowListener,
-+ ::com::sun::star::util::XUpdatable,
-+ ::com::sun::star::beans::XPropertySet,
-+ ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
-+ typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >,
-+ SpriteDeviceHelper,
-+ ::osl::MutexGuard,
-+ ::cppu::OWeakObject > SpriteCanvasDeviceBaseT;
-+
-+ typedef ::canvas::CanvasBase< SpriteCanvasDeviceBaseT,
-+ CanvasHelper,
-+ ::osl::MutexGuard,
-+ ::cppu::OWeakObject > SpriteCanvasBaseT;
-+
-+ /** Product of this component's factory.
-+
-+ The SpriteCanvas object combines the actual Window canvas with
-+ the XGraphicDevice interface. This is because there's a
-+ one-to-one relation between them, anyway, since each window
-+ can have exactly one canvas and one associated
-+ XGraphicDevice. And to avoid messing around with circular
-+ references, this is implemented as one single object.
-+ */
-+ class SpriteCanvas : public SpriteCanvasBaseT
-+ {
-+ public:
-+ SpriteCanvas( const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Any >& aArguments,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::uno::XComponentContext >& rxContext );
-+
-+ void initialize();
-+
-+#if defined __SUNPRO_CC
-+ using SpriteCanvasBaseT::disposing;
-+#endif
-+
-+ /// Dispose all internal references
-+ virtual void SAL_CALL disposing();
-+
-+ // Forwarding the XComponent implementation to the
-+ // cppu::ImplHelper templated base
-+ // Classname Base doing refcounting Base implementing the XComponent interface
-+ // | | |
-+ // V V V
-+ DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
-+
-+ // XBufferController (partial)
-+ virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ // XSpriteCanvas
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps, ::sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL updateScreen( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ // XServiceName
-+ virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ void show( const ::rtl::Reference< CanvasCustomSprite >& );
-+ void hide( const ::rtl::Reference< CanvasCustomSprite >& );
-+
-+ /** Write out recorded actions
-+ */
-+ bool renderRecordedActions() const;
-+
-+ private:
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
-+ };
-+
-+ typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_spritedevicehelper.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,1258 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ * Radek Doulik <rodo@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_spritedevicehelper.hxx"
-+#include "ogl_spritecanvas.hxx"
-+#include "ogl_canvasbitmap.hxx"
-+#include "ogl_canvastools.hxx"
-+#include "ogl_canvascustomsprite.hxx"
-+#include "ogl_texturecache.hxx"
-+
-+#include <canvas/verbosetrace.hxx>
-+#include <basegfx/tools/canvastools.hxx>
-+#include <basegfx/tools/unopolypolygon.hxx>
-+
-+#include <osl/mutex.hxx>
-+#include <rtl/instance.hxx>
-+#include <com/sun/star/uno/Reference.hxx>
-+#include <com/sun/star/lang/NoSupportException.hpp>
-+#include <com/sun/star/rendering/XColorSpace.hpp>
-+#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
-+
-+#include <vcl/sysdata.hxx>
-+#include <vcl/syschild.hxx>
-+#include <vcl/canvastools.hxx>
-+#include <toolkit/helper/vclunohelper.hxx>
-+
-+#define GL_GLEXT_PROTOTYPES
-+#include <GL/gl.h>
-+#include <GL/glu.h>
-+#include <GL/glext.h>
-+
-+namespace unx
-+{
-+ #include <X11/keysym.h>
-+ #include <X11/X.h>
-+ #include <GL/glx.h>
-+ #include <GL/glxext.h>
-+}
-+
-+
-+using namespace ::com::sun::star;
-+
-+static bool lcl_bErrorTriggered=false;
-+static int lcl_XErrorHandler( unx::Display*, unx::XErrorEvent* )
-+{
-+ lcl_bErrorTriggered = true;
-+ return 0;
-+}
-+
-+/** Dummy vertex processing. Simply uses default pipeline for vertex
-+ transformation, and forwards texture coodinates to fragment shader
-+ */
-+static const char dummyVertexShader[] =
-+{
-+ "varying vec2 v_textureCoords2d; "
-+ "void main(void) "
-+ "{ "
-+ " gl_Position = ftransform(); "
-+ " v_textureCoords2d = gl_MultiTexCoord0.st; "
-+ "} "
-+};
-+
-+/** Two-color linear gradient
-+ */
-+static const char linearTwoColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform vec4 v_startColor4d; "
-+ "uniform vec4 v_endColor4d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ "void main(void) "
-+ "{ "
-+ " gl_FragColor = mix(v_startColor4d, "
-+ " v_endColor4d, "
-+ " clamp( "
-+ " (m_transform * vec3(v_textureCoords2d,1)).s, "
-+ " 0.0, 1.0)); "
-+ "} "
-+};
-+
-+/** N-color linear gradient
-+ */
-+static const char linearMultiColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform int i_nColors; "
-+ "uniform sampler1D t_colorArray4d; "
-+ "uniform sampler1D t_stopArray1d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ " "
-+ "int findBucket(float t) "
-+ "{ "
-+ " int nMinBucket=0; "
-+ " while( nMinBucket < i_nColors && "
-+ " texture1D(t_stopArray1d, nMinBucket).s < t ) "
-+ " ++nMinBucket; "
-+ " return max(nMinBucket-1,0); "
-+ "} "
-+ " "
-+ "void main(void) "
-+ "{ "
-+ " const float fAlpha = "
-+ " clamp( (m_transform * vec3(v_textureCoords2d,1)).s, "
-+ " 0.0, 1.0 ); "
-+ " "
-+ " const int nMinBucket=findBucket( fAlpha ); "
-+ " "
-+ " const float fLerp = "
-+ " (fAlpha-texture1D(t_stopArray1d, nMinBucket).s) / "
-+ " (texture1D(t_stopArray1d, nMinBucket+1).s - "
-+ " texture1D(t_stopArray1d, nMinBucket).s); "
-+ " "
-+ " gl_FragColor = mix(texture1D(t_colorArray4d, nMinBucket), "
-+ " texture1D(t_colorArray4d, nMinBucket+1), "
-+ " fLerp); "
-+ "} "
-+};
-+
-+/** Two-color radial gradient
-+ */
-+static const char radialTwoColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform vec4 v_startColor4d; "
-+ "uniform vec4 v_endColor4d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ "const vec2 v_center2d = vec2(0,0); "
-+ "void main(void) "
-+ "{ "
-+ " gl_FragColor = mix(v_startColor4d, "
-+ " v_endColor4d, "
-+ " 1.0 - distance( "
-+ " vec2( "
-+ " m_transform * vec3(v_textureCoords2d,1)), "
-+ " v_center2d)); "
-+ "} "
-+};
-+
-+/** Multi-color radial gradient
-+ */
-+static const char radialMultiColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform int i_nColors; "
-+ "uniform sampler1D t_colorArray4d; "
-+ "uniform sampler1D t_stopArray1d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ "const vec2 v_center2d = vec2(0,0); "
-+ " "
-+ "int findBucket(float t) "
-+ "{ "
-+ " int nMinBucket=0; "
-+ " while( nMinBucket < i_nColors && "
-+ " texture1D(t_stopArray1d, nMinBucket).s < t ) "
-+ " ++nMinBucket; "
-+ " return max(nMinBucket-1,0); "
-+ "} "
-+ " "
-+ "void main(void) "
-+ "{ "
-+ " const float fAlpha = "
-+ " clamp( 1.0 - distance( "
-+ " vec2( m_transform * vec3(v_textureCoords2d,1)), "
-+ " v_center2d), "
-+ " 0.0, 1.0 ); "
-+ " "
-+ " const int nMinBucket=findBucket( fAlpha ); "
-+ " "
-+ " const float fLerp = "
-+ " (fAlpha-texture1D(t_stopArray1d, nMinBucket).s) / "
-+ " (texture1D(t_stopArray1d, nMinBucket+1).s - "
-+ " texture1D(t_stopArray1d, nMinBucket).s); "
-+ " "
-+ " gl_FragColor = mix(texture1D(t_colorArray4d, nMinBucket), "
-+ " texture1D(t_colorArray4d, nMinBucket+1), "
-+ " fLerp); "
-+ "} "
-+};
-+
-+/** Two-color rectangular gradient
-+ */
-+static const char rectangularTwoColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform vec4 v_startColor4d; "
-+ "uniform vec4 v_endColor4d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ "void main(void) "
-+ "{ "
-+ " const vec2 v = abs( vec2(m_transform * vec3(v_textureCoords2d,1)) ); "
-+ " const float t = max(v.x, v.y); "
-+ " gl_FragColor = mix(v_startColor4d, "
-+ " v_endColor4d, "
-+ " 1.0-t); "
-+ "} "
-+};
-+
-+/** Multi-color rectangular gradient
-+ */
-+static const char rectangularMultiColorGradientFragmentShader[] =
-+{
-+ "#version 120 \n"
-+ "uniform int i_nColors; "
-+ "uniform sampler1D t_colorArray4d; "
-+ "uniform sampler1D t_stopArray1d; "
-+ "uniform mat3x2 m_transform; "
-+ "varying vec2 v_textureCoords2d; "
-+ " "
-+ "int findBucket(float t) "
-+ "{ "
-+ " int nMinBucket=0; "
-+ " while( nMinBucket < i_nColors && "
-+ " texture1D(t_stopArray1d, nMinBucket).s < t ) "
-+ " ++nMinBucket; "
-+ " return max(nMinBucket-1,0); "
-+ "} "
-+ " "
-+ "void main(void) "
-+ "{ "
-+ " const vec2 v = abs( vec2(m_transform * vec3(v_textureCoords2d,1)) ); "
-+ " const float fAlpha = 1 - max(v.x, v.y); "
-+ " "
-+ " const int nMinBucket=findBucket( fAlpha ); "
-+ " "
-+ " const float fLerp = "
-+ " (fAlpha-texture1D(t_stopArray1d, nMinBucket).s) / "
-+ " (texture1D(t_stopArray1d, nMinBucket+1).s - "
-+ " texture1D(t_stopArray1d, nMinBucket).s); "
-+ " "
-+ " gl_FragColor = mix(texture1D(t_colorArray4d, nMinBucket), "
-+ " texture1D(t_colorArray4d, nMinBucket+1), "
-+ " fLerp); "
-+ "} "
-+};
-+
-+static void initContext()
-+{
-+ // need the backside for mirror effects
-+ glDisable(GL_CULL_FACE);
-+
-+ // no perspective, we're 2D
-+ glMatrixMode(GL_PROJECTION);
-+ glLoadIdentity();
-+
-+ // misc preferences
-+ glEnable(GL_POINT_SMOOTH);
-+ glEnable(GL_LINE_SMOOTH);
-+ glEnable(GL_POLYGON_SMOOTH);
-+ glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
-+ glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
-+ glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
-+ glShadeModel(GL_FLAT);
-+}
-+
-+static void initTransformation(const ::Size& rSize, bool bMirror=false)
-+{
-+ // use whole window
-+ glViewport( 0,0,
-+ (GLsizei)rSize.Width(),
-+ (GLsizei)rSize.Height() );
-+
-+ // model coordinate system is already in device pixel
-+ glMatrixMode(GL_MODELVIEW);
-+ glLoadIdentity();
-+ glTranslated(-1.0, (bMirror ? -1.0 : 1.0), 0.0);
-+ glScaled( 2.0 / rSize.Width(),
-+ (bMirror ? 2.0 : -2.0) / rSize.Height(),
-+ 1.0 );
-+
-+ // clear to black
-+ glClearColor(0,0,0,0);
-+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-+}
-+
-+static boost::shared_ptr<SystemChildWindow> createChildWindow( unx::XVisualInfo*& viWin,
-+ unx::XVisualInfo*& viPB,
-+ void*& fbConfig,
-+ Window& rWindow,
-+ unx::Display* pDisplay,
-+ int nScreen )
-+{
-+ // select appropriate visual
-+ static int winAttrList3[] =
-+ {
-+ GLX_RGBA,//only TrueColor or DirectColor
-+ //single buffered
-+ GLX_RED_SIZE,4,//use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,//use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,//use the maximum blue bits, with a minimum of 4 bits
-+ GLX_DEPTH_SIZE,0,//no depth buffer
-+ None
-+ };
-+ static int pBufAttrList3[] =
-+ {
-+ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
-+ GLX_RED_SIZE,4,//use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,//use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,//use the maximum blue bits, with a minimum of 4 bits
-+ GLX_ALPHA_SIZE,4,
-+ GLX_DEPTH_SIZE,0,//no depth buffer
-+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
-+ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
-+ None
-+ };
-+ static int winAttrList2[] =
-+ {
-+ GLX_RGBA,//only TrueColor or DirectColor
-+ /// single buffered
-+ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
-+ None
-+ };
-+ static int pBufAttrList2[] =
-+ {
-+ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
-+ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_ALPHA_SIZE,4,
-+ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
-+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
-+ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
-+ None
-+ };
-+ static int winAttrList1[] =
-+ {
-+ GLX_RGBA,//only TrueColor or DirectColor
-+ GLX_DOUBLEBUFFER,/// only double buffer
-+ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_DEPTH_SIZE,0,/// no depth buffer
-+ None
-+ };
-+ static int pBufAttrList1[] =
-+ {
-+ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
-+ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_ALPHA_SIZE,4,
-+ GLX_DEPTH_SIZE,0,/// no depth buffer
-+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
-+ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
-+ None
-+ };
-+ static int winAttrList0[] =
-+ {
-+ GLX_RGBA,//only TrueColor or DirectColor
-+ GLX_DOUBLEBUFFER,// only double buffer
-+ GLX_RED_SIZE,4,// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_DEPTH_SIZE,1,// use the maximum depth bits, making sure there is a depth buffer
-+ None
-+ };
-+ static int pBufAttrList0[] =
-+ {
-+ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
-+ GLX_RED_SIZE,4,// use the maximum red bits, with a minimum of 4 bits
-+ GLX_GREEN_SIZE,4,// use the maximum green bits, with a minimum of 4 bits
-+ GLX_BLUE_SIZE,4,// use the maximum blue bits, with a minimum of 4 bits
-+ GLX_ALPHA_SIZE,4,
-+ GLX_DEPTH_SIZE,1,// use the maximum depth bits, making sure there is a depth buffer
-+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
-+ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
-+ None
-+ };
-+ static int* winAttrTable[] =
-+ {
-+ winAttrList0,
-+ winAttrList1,
-+ winAttrList2,
-+ winAttrList3,
-+ NULL
-+ };
-+ static int* pBufAttrTable[] =
-+ {
-+ pBufAttrList0,
-+ pBufAttrList1,
-+ pBufAttrList2,
-+ pBufAttrList3,
-+ NULL
-+ };
-+ int** pWinAttributeTable = winAttrTable;
-+ int** pBufAttributeTable = pBufAttrTable;
-+
-+ boost::shared_ptr<SystemChildWindow> pResult;
-+ unx::GLXFBConfig* fbConfigs=NULL;
-+ int nConfigs, nVal;
-+ while( *pWinAttributeTable && *pBufAttributeTable )
-+ {
-+ // try to find a window visual for the current set of
-+ // attributes
-+ viWin = unx::glXChooseVisual( pDisplay,
-+ nScreen,
-+ *pWinAttributeTable );
-+ if( viWin )
-+ {
-+ // try to find a framebuffer config for the current set of
-+ // attributes
-+ fbConfigs = glXChooseFBConfig( pDisplay,
-+ nScreen,
-+ *pBufAttributeTable,
-+ &nConfigs );
-+ // don't use glXGetFBConfigs, that does not list alpha-configs
-+ // fbConfigs = unx::glXGetFBConfigs(pDisplay, nScreen, &nConfigs);
-+ for(int i=0; i<nConfigs; i++)
-+ {
-+ viPB = glXGetVisualFromFBConfig(pDisplay, fbConfigs[i]);
-+ if( viPB && viPB->visualid != viWin->visualid )
-+ {
-+ glXGetFBConfigAttrib(pDisplay,
-+ fbConfigs[i],
-+ GLX_DRAWABLE_TYPE,
-+ &nVal);
-+
-+ if( (GLX_PBUFFER_BIT|GLX_WINDOW_BIT|GLX_PIXMAP_BIT)
-+ == (nVal & (GLX_PBUFFER_BIT|GLX_WINDOW_BIT|GLX_PIXMAP_BIT)) )
-+ {
-+ SystemWindowData winData;
-+ winData.nSize = sizeof(winData);
-+ OSL_TRACE("using VisualID %08X for OpenGL canvas", viWin->visualid);
-+ winData.pVisual = (void*)(viWin->visual);
-+ pResult.reset( new SystemChildWindow(&rWindow, 0, &winData, FALSE) );
-+
-+ if( pResult->GetSystemData() )
-+ {
-+ fbConfig = &fbConfigs[i];
-+ return pResult;
-+ }
-+
-+ pResult.reset();
-+ }
-+
-+ XFree(viPB);
-+ }
-+ }
-+
-+ XFree(viWin);
-+ }
-+
-+ ++pWinAttributeTable;
-+ ++pBufAttributeTable;
-+ }
-+
-+ return pResult;
-+}
-+
-+
-+namespace oglcanvas
-+{
-+ /** Compile shader program
-+
-+ Code courtesy rodo
-+ */
-+ void SpriteDeviceHelper::compileShader(unsigned int& o_rShaderHandle,
-+ unsigned int eShaderType,
-+ const char* pShaderSourceCode)
-+ {
-+ GLint nCompileStatus;
-+ char log[1024];
-+
-+ o_rShaderHandle = glCreateShader( eShaderType );
-+ glShaderSource( o_rShaderHandle, 1, &pShaderSourceCode, NULL );
-+ glCompileShader( o_rShaderHandle );
-+ glGetShaderInfoLog( o_rShaderHandle, sizeof(log), NULL, log );
-+ OSL_TRACE("shader compile log: %s", log);
-+
-+ glGetShaderiv( o_rShaderHandle, GL_COMPILE_STATUS, &nCompileStatus );
-+ if( !nCompileStatus )
-+ {
-+ glDeleteShader(o_rShaderHandle);
-+ o_rShaderHandle=0;
-+ }
-+ }
-+
-+ /** Link vertex & fragment shaders
-+
-+ Code courtesy rodo
-+ */
-+ void SpriteDeviceHelper::linkShaders(unsigned int& o_rProgramHandle,
-+ unsigned int nVertexProgramId,
-+ unsigned int nFragmentProgramId)
-+ {
-+ if( !nVertexProgramId || !nFragmentProgramId )
-+ return;
-+
-+ o_rProgramHandle = glCreateProgram();
-+ glAttachShader( o_rProgramHandle, nVertexProgramId );
-+ glAttachShader( o_rProgramHandle, nFragmentProgramId );
-+
-+ char log[1024];
-+ GLint nProgramLinked;
-+
-+ glLinkProgram( o_rProgramHandle );
-+ glGetProgramInfoLog( o_rProgramHandle, sizeof(log), NULL, log );
-+ OSL_TRACE("shader program link log: %s", log);
-+ glGetProgramiv( o_rProgramHandle, GL_LINK_STATUS, &nProgramLinked );
-+
-+ if( !nProgramLinked )
-+ {
-+ glDeleteProgram(o_rProgramHandle);
-+ o_rProgramHandle=0;
-+ }
-+ }
-+
-+ SpriteDeviceHelper::SpriteDeviceHelper() :
-+ mpDevice(NULL),
-+ mpSpriteCanvas(NULL),
-+ maActiveSprites(),
-+ maLastUpdate(),
-+ mpChildWindow(),
-+ mpDisplay(NULL),
-+ mpGLContext(NULL),
-+ mpGLPBufContext(NULL),
-+ mpFBConfig(NULL),
-+ mpTextureCache(new TextureCache()),
-+ mnDummyVertexProgram(0),
-+ mnLinearTwoColorGradientFragmentProgram(0),
-+ mnLinearMultiColorGradientFragmentProgram(0),
-+ mnRadialTwoColorGradientFragmentProgram(0),
-+ mnRadialMultiColorGradientFragmentProgram(0),
-+ mnRectangularTwoColorGradientFragmentProgram(0),
-+ mnRectangularMultiColorGradientFragmentProgram(0),
-+ mnLinearTwoColorGradientProgram(0),
-+ mnLinearMultiColorGradientProgram(0),
-+ mnRadialTwoColorGradientProgram(0),
-+ mnRadialMultiColorGradientProgram(0),
-+ mnRectangularTwoColorGradientProgram(0),
-+ mnRectangularMultiColorGradientProgram(0)
-+ {}
-+
-+ void SpriteDeviceHelper::init( Window& rWindow,
-+ SpriteCanvas& rSpriteCanvas,
-+ const awt::Rectangle& rViewArea )
-+ {
-+ mpSpriteCanvas = &rSpriteCanvas;
-+
-+ rSpriteCanvas.setWindow(
-+ uno::Reference<awt::XWindow2>(
-+ VCLUnoHelper::GetInterface(&rWindow),
-+ uno::UNO_QUERY_THROW) );
-+
-+ // init OpenGL
-+ const SystemEnvData* sysData(rWindow.GetSystemData());
-+ unx::Display* pDisplay=reinterpret_cast<unx::Display*>(sysData->pDisplay);
-+ mpDisplay=pDisplay;
-+ if( !unx::glXQueryExtension(pDisplay, NULL, NULL) )
-+ return;
-+
-+ unx::Window xWindow = sysData->aWindow;
-+ unx::XWindowAttributes xAttr;
-+ unx::XGetWindowAttributes( pDisplay, xWindow, &xAttr );
-+ int nScreen = XScreenNumberOfScreen( xAttr.screen );
-+
-+ unx::Window childXWindow=0;
-+ unx::XVisualInfo* viWin=NULL;
-+ unx::XVisualInfo* viPB=NULL;
-+ mpChildWindow=createChildWindow(viWin,viPB,mpFBConfig,
-+ rWindow,pDisplay,nScreen);
-+
-+ // tweak SysChild window to act as an input-transparent
-+ // overlay
-+ if( mpChildWindow )
-+ {
-+ childXWindow=mpChildWindow->GetSystemData()->aWindow;
-+ mpChildWindow->SetMouseTransparent( TRUE );
-+ mpChildWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP );
-+ mpChildWindow->EnableEraseBackground( FALSE );
-+ mpChildWindow->SetControlForeground();
-+ mpChildWindow->SetControlBackground();
-+ mpChildWindow->EnablePaint(FALSE);
-+
-+ unx::GLXContext pContext1 =
-+ glXCreateContext(pDisplay,
-+ viWin,
-+ 0,
-+ GL_TRUE);
-+ mpGLContext = pContext1;
-+
-+ unx::GLXContext pContext2 =
-+ glXCreateContext( pDisplay,
-+ viPB,
-+ pContext1,
-+ GL_TRUE );
-+ mpGLPBufContext = pContext2;
-+
-+ XFree(viWin);
-+ XFree(viPB);
-+
-+ if( !glXMakeCurrent( pDisplay,
-+ childXWindow,
-+ pContext1) )
-+ {
-+ glXDestroyContext(pDisplay, pContext1);
-+ glXDestroyContext(pDisplay, pContext2);
-+ throw lang::NoSupportException(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "Could not select OpenGL context!") ),NULL);
-+ }
-+
-+ const GLubyte* extensions=glGetString( GL_EXTENSIONS );
-+ if( gluCheckExtension((const GLubyte*)"GLX_SGI_swap_control", extensions) )
-+ {
-+ // try to enable vsync
-+ typedef GLint (*glXSwapIntervalProc)(GLint);
-+ glXSwapIntervalProc glXSwapInterval =
-+ (glXSwapIntervalProc) unx::glXGetProcAddress((const GLubyte*)"glXSwapIntervalSGI");
-+ if( glXSwapInterval )
-+ {
-+ int (*oldHandler)(unx::Display*, unx::XErrorEvent*);
-+
-+ // synchronize on global mutex - no other ogl
-+ // canvas instance permitted to enter here
-+ {
-+ ::osl::MutexGuard aGuard( *::osl::Mutex::getGlobalMutex() );
-+
-+ // replace error handler temporarily
-+ oldHandler = unx::XSetErrorHandler( lcl_XErrorHandler );
-+
-+ lcl_bErrorTriggered = false;
-+
-+ // Note: if this fails, so be it. Buggy
-+ // drivers will then not have vsync.
-+ glXSwapInterval(1);
-+
-+ // sync so that we possibly get an XError
-+ unx::glXWaitGL();
-+ XSync(pDisplay, false);
-+
-+ unx::XSetErrorHandler( oldHandler );
-+ }
-+ }
-+ }
-+
-+ // init window context
-+ initContext();
-+
-+ // compile & link shaders - code courtesy rodo
-+ compileShader(mnDummyVertexProgram,
-+ GL_VERTEX_SHADER,
-+ dummyVertexShader);
-+ compileShader(mnLinearTwoColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ linearTwoColorGradientFragmentShader);
-+ compileShader(mnLinearMultiColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ linearMultiColorGradientFragmentShader);
-+ compileShader(mnRadialTwoColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ radialTwoColorGradientFragmentShader);
-+ compileShader(mnRadialMultiColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ radialMultiColorGradientFragmentShader);
-+ compileShader(mnRectangularTwoColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ rectangularTwoColorGradientFragmentShader);
-+ compileShader(mnRectangularMultiColorGradientFragmentProgram,
-+ GL_FRAGMENT_SHADER,
-+ rectangularMultiColorGradientFragmentShader);
-+ linkShaders(mnLinearTwoColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnLinearTwoColorGradientFragmentProgram);
-+ linkShaders(mnLinearMultiColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnLinearMultiColorGradientFragmentProgram);
-+ linkShaders(mnRadialTwoColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnRadialTwoColorGradientFragmentProgram);
-+ linkShaders(mnRadialMultiColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnRadialMultiColorGradientFragmentProgram);
-+ linkShaders(mnRectangularTwoColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnRectangularTwoColorGradientFragmentProgram);
-+ linkShaders(mnRectangularMultiColorGradientProgram,
-+ mnDummyVertexProgram,
-+ mnRectangularMultiColorGradientFragmentProgram);
-+
-+ glXMakeCurrent(pDisplay, None, NULL);
-+ }
-+
-+ if( !mpGLContext || glGetError() != GL_NO_ERROR )
-+ throw lang::NoSupportException(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "Could not create OpenGL context, or an error occurred doing so!") ),NULL);
-+
-+ notifySizeUpdate(rViewArea);
-+ mpChildWindow->Show();
-+ // TODO(E3): check for GL_ARB_imaging extension
-+ }
-+
-+ void SpriteDeviceHelper::disposing()
-+ {
-+ // release all references
-+ mpSpriteCanvas = NULL;
-+ mpDevice = NULL;
-+ mpTextureCache.reset();
-+
-+ if( mpGLContext )
-+ {
-+ glDeleteProgram( mnRectangularTwoColorGradientProgram );
-+ glDeleteProgram( mnRectangularMultiColorGradientProgram );
-+ glDeleteProgram( mnRadialTwoColorGradientProgram );
-+ glDeleteProgram( mnRadialMultiColorGradientProgram );
-+ glDeleteProgram( mnLinearTwoColorGradientProgram );
-+ glDeleteProgram( mnLinearMultiColorGradientProgram );
-+ glDeleteShader( mnRectangularTwoColorGradientFragmentProgram );
-+ glDeleteShader( mnRectangularMultiColorGradientFragmentProgram );
-+ glDeleteShader( mnRadialTwoColorGradientFragmentProgram );
-+ glDeleteShader( mnRadialMultiColorGradientFragmentProgram );
-+ glDeleteShader( mnLinearTwoColorGradientFragmentProgram );
-+ glDeleteShader( mnLinearMultiColorGradientFragmentProgram );
-+ glDeleteShader( mnDummyVertexProgram );
-+
-+ glXDestroyContext(reinterpret_cast<unx::Display*>(mpDisplay),
-+ reinterpret_cast<unx::GLXContext>(mpGLContext));
-+ }
-+
-+ mpDisplay = NULL;
-+ mpGLContext = NULL;
-+ mpChildWindow.reset();
-+ }
-+
-+ geometry::RealSize2D SpriteDeviceHelper::getPhysicalResolution()
-+ {
-+ if( !mpChildWindow )
-+ return ::canvas::tools::createInfiniteSize2D(); // we're disposed
-+
-+ // Map a one-by-one millimeter box to pixel
-+ const MapMode aOldMapMode( mpChildWindow->GetMapMode() );
-+ mpChildWindow->SetMapMode( MapMode(MAP_MM) );
-+ const Size aPixelSize( mpChildWindow->LogicToPixel(Size(1,1)) );
-+ mpChildWindow->SetMapMode( aOldMapMode );
-+
-+ return ::vcl::unotools::size2DFromSize( aPixelSize );
-+ }
-+
-+ geometry::RealSize2D SpriteDeviceHelper::getPhysicalSize()
-+ {
-+ if( !mpChildWindow )
-+ return ::canvas::tools::createInfiniteSize2D(); // we're disposed
-+
-+ // Map the pixel dimensions of the output window to millimeter
-+ const MapMode aOldMapMode( mpChildWindow->GetMapMode() );
-+ mpChildWindow->SetMapMode( MapMode(MAP_MM) );
-+ const Size aLogSize( mpChildWindow->PixelToLogic(mpChildWindow->GetOutputSizePixel()) );
-+ mpChildWindow->SetMapMode( aOldMapMode );
-+
-+ return ::vcl::unotools::size2DFromSize( aLogSize );
-+ }
-+
-+ uno::Reference< rendering::XLinePolyPolygon2D > SpriteDeviceHelper::createCompatibleLinePolyPolygon(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
-+ {
-+ // disposed?
-+ if( !mpSpriteCanvas )
-+ return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed
-+
-+ return uno::Reference< rendering::XLinePolyPolygon2D >(
-+ new ::basegfx::unotools::UnoPolyPolygon(
-+ ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence( points )));
-+ }
-+
-+ uno::Reference< rendering::XBezierPolyPolygon2D > SpriteDeviceHelper::createCompatibleBezierPolyPolygon(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points )
-+ {
-+ // disposed?
-+ if( !mpSpriteCanvas )
-+ return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed
-+
-+ return uno::Reference< rendering::XBezierPolyPolygon2D >(
-+ new ::basegfx::unotools::UnoPolyPolygon(
-+ ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence( points ) ) );
-+ }
-+
-+ uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleBitmap(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& size )
-+ {
-+ // disposed?
-+ if( !mpSpriteCanvas )
-+ return uno::Reference< rendering::XBitmap >(); // we're disposed
-+
-+ return uno::Reference< rendering::XBitmap >(
-+ new CanvasBitmap( size,
-+ mpSpriteCanvas,
-+ *this,
-+ false ) );
-+ }
-+
-+ uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileBitmap(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& /*size*/ )
-+ {
-+ return uno::Reference< rendering::XVolatileBitmap >();
-+ }
-+
-+ uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleAlphaBitmap(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& size )
-+ {
-+ // disposed?
-+ if( !mpSpriteCanvas )
-+ return uno::Reference< rendering::XBitmap >(); // we're disposed
-+
-+ return uno::Reference< rendering::XBitmap >(
-+ new CanvasBitmap( size,
-+ mpSpriteCanvas,
-+ *this,
-+ true ) );
-+ }
-+
-+ uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileAlphaBitmap(
-+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& /*size*/ )
-+ {
-+ return uno::Reference< rendering::XVolatileBitmap >();
-+ }
-+
-+ sal_Bool SpriteDeviceHelper::hasFullScreenMode()
-+ {
-+ // TODO(F3): offer fullscreen mode the XCanvas way
-+ return false;
-+ }
-+
-+ sal_Bool SpriteDeviceHelper::enterFullScreenMode( sal_Bool /*bEnter*/ )
-+ {
-+ // TODO(F3): offer fullscreen mode the XCanvas way
-+ return false;
-+ }
-+
-+ ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 /*nBuffers*/ )
-+ {
-+ // TODO(F3): implement XBufferStrategy interface. For now, we
-+ // _always_ will have exactly one backbuffer
-+ return 1;
-+ }
-+
-+ void SpriteDeviceHelper::destroyBuffers()
-+ {
-+ // TODO(F3): implement XBufferStrategy interface. For now, we
-+ // _always_ will have exactly one backbuffer
-+ }
-+
-+ namespace
-+ {
-+ /** Functor providing a StrictWeakOrdering for XSprites (over
-+ priority)
-+ */
-+ struct SpriteComparator
-+ {
-+ bool operator()( const ::rtl::Reference<CanvasCustomSprite>& rLHS,
-+ const ::rtl::Reference<CanvasCustomSprite>& rRHS ) const
-+ {
-+ const double nPrioL( rLHS->getPriority() );
-+ const double nPrioR( rRHS->getPriority() );
-+
-+ // if prios are equal, tie-break on ptr value
-+ return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
-+ }
-+ };
-+ }
-+
-+ ::sal_Bool SpriteDeviceHelper::showBuffer( bool bIsVisible, ::sal_Bool /*bUpdateAll*/ )
-+ {
-+ // hidden or disposed?
-+ if( !bIsVisible || !mpChildWindow || !mpSpriteCanvas )
-+ return false;
-+
-+ if( !activateWindowContext() )
-+ return false;
-+
-+ const ::Size& rOutputSize=mpChildWindow->GetSizePixel();
-+ initTransformation(rOutputSize);
-+
-+ // render the actual spritecanvas content
-+ mpSpriteCanvas->renderRecordedActions();
-+
-+ // render all sprites (in order of priority) on top of that
-+ std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites;
-+ std::copy(maActiveSprites.begin(),
-+ maActiveSprites.end(),
-+ std::back_insert_iterator<
-+ std::vector< ::rtl::Reference< CanvasCustomSprite > > >(aSprites));
-+ std::sort(aSprites.begin(),
-+ aSprites.end(),
-+ SpriteComparator());
-+ std::for_each(aSprites.begin(),
-+ aSprites.end(),
-+ boost::mem_fn(&CanvasCustomSprite::renderSprite));
-+
-+
-+ // frame counter, other info
-+ glMatrixMode(GL_MODELVIEW);
-+ glLoadIdentity();
-+ glTranslated(-1.0, 1.0, 0.0);
-+ glScaled( 2.0 / rOutputSize.Width(),
-+ -2.0 / rOutputSize.Height(),
-+ 1.0 );
-+
-+ const double denominator( maLastUpdate.getElapsedTime() );
-+ maLastUpdate.reset();
-+
-+ const double fps(denominator == 0.0 ? 100.0 : 1.0/denominator);
-+ std::vector<double> aVec; aVec.push_back(fps);
-+ aVec.push_back(maActiveSprites.size());
-+ aVec.push_back(mpTextureCache->getCacheSize());
-+ aVec.push_back(mpTextureCache->getCacheMissCount());
-+ aVec.push_back(mpTextureCache->getCacheHitCount());
-+ renderOSD( aVec, 20 );
-+
-+ // switch buffer, sync etc.
-+ const unx::Window aXWindow=mpChildWindow->GetSystemData()->aWindow;
-+ unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
-+ aXWindow);
-+ mpChildWindow->Show();
-+ unx::glXWaitGL();
-+ XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
-+
-+ // flush texture cache, such that it does not build up
-+ // indefinitely.
-+ // TODO: have max cache size/LRU time in config, prune only on
-+ // demand
-+ mpTextureCache->prune();
-+
-+ return true;
-+ }
-+
-+ ::sal_Bool SpriteDeviceHelper::switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll )
-+ {
-+ // no difference for VCL canvas
-+ return showBuffer( bIsVisible, bUpdateAll );
-+ }
-+
-+ uno::Any SpriteDeviceHelper::isAccelerated() const
-+ {
-+ return ::com::sun::star::uno::makeAny(false);
-+ }
-+
-+ uno::Any SpriteDeviceHelper::getDeviceHandle() const
-+ {
-+ return uno::Any();
-+ }
-+
-+ uno::Any SpriteDeviceHelper::getSurfaceHandle() const
-+ {
-+ return uno::Any();
-+ }
-+
-+ uno::Reference<rendering::XColorSpace> SpriteDeviceHelper::getColorSpace() const
-+ {
-+ // always the same
-+ return uno::Reference<rendering::XColorSpace>(
-+ ::canvas::tools::getStdColorSpace(),
-+ uno::UNO_QUERY);
-+ }
-+
-+ void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
-+ {
-+ if( mpChildWindow )
-+ mpChildWindow->SetPosSizePixel(
-+ 0,0,rBounds.Width,rBounds.Height);
-+ }
-+
-+ void SpriteDeviceHelper::dumpScreenContent() const
-+ {
-+ OSL_TRACE( "%s\n",
-+ BOOST_CURRENT_FUNCTION );
-+ }
-+
-+ void SpriteDeviceHelper::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
-+ {
-+ maActiveSprites.insert(xSprite);
-+ }
-+
-+ void SpriteDeviceHelper::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
-+ {
-+ maActiveSprites.erase(xSprite);
-+ }
-+
-+ static void setupUniforms( unsigned int nProgramId,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ const GLint nTransformLocation = glGetUniformLocation(nProgramId,
-+ "m_transform" );
-+ // OGL is column-major
-+ float aTexTransform[] =
-+ {
-+ rTexTransform.get(0,0), rTexTransform.get(1,0),
-+ rTexTransform.get(0,1), rTexTransform.get(1,1),
-+ rTexTransform.get(0,2), rTexTransform.get(1,2)
-+ };
-+ glUniformMatrix3x2fv(nTransformLocation,1,false,aTexTransform);
-+ }
-+
-+ static void setupUniforms( unsigned int nProgramId,
-+ const rendering::ARGBColor* pColors,
-+ const uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ glUseProgram(nProgramId);
-+
-+ GLuint nColorsTexture;
-+ glActiveTexture(GL_TEXTURE0);
-+ glGenTextures(1, &nColorsTexture);
-+ glBindTexture(GL_TEXTURE_1D, nColorsTexture);
-+
-+ const sal_Int32 nColors=rStops.getLength();
-+ glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA, nColors, 0, GL_RGBA, GL_DOUBLE, pColors );
-+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
-+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-+
-+ GLuint nStopsTexture;
-+ glActiveTexture(GL_TEXTURE1);
-+ glGenTextures(1, &nStopsTexture);
-+ glBindTexture(GL_TEXTURE_1D, nStopsTexture);
-+
-+ glTexImage1D( GL_TEXTURE_1D, 0, GL_ALPHA, nColors, 0, GL_ALPHA, GL_DOUBLE, rStops.getConstArray() );
-+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
-+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-+
-+ const GLint nColorArrayLocation = glGetUniformLocation(nProgramId,
-+ "t_colorArray4d" );
-+ glUniform1i( nColorArrayLocation, 0 ); // unit 0
-+
-+ const GLint nStopArrayLocation = glGetUniformLocation(nProgramId,
-+ "t_stopArray1d" );
-+ glUniform1i( nStopArrayLocation, 1 ); // unit 1
-+
-+ const GLint nNumColorLocation = glGetUniformLocation(nProgramId,
-+ "i_nColors" );
-+ glUniform1i( nNumColorLocation, nColors-1 );
-+
-+ setupUniforms(nProgramId,rTexTransform);
-+ }
-+
-+ static void setupUniforms( unsigned int nProgramId,
-+ const rendering::ARGBColor& rStartColor,
-+ const rendering::ARGBColor& rEndColor,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ glUseProgram(nProgramId);
-+
-+ const GLint nStartColorLocation = glGetUniformLocation(nProgramId,
-+ "v_startColor4d" );
-+ glUniform4f(nStartColorLocation,
-+ rStartColor.Red,
-+ rStartColor.Green,
-+ rStartColor.Blue,
-+ rStartColor.Alpha);
-+
-+ const GLint nEndColorLocation = glGetUniformLocation(nProgramId,
-+ "v_endColor4d" );
-+ glUniform4f(nEndColorLocation,
-+ rEndColor.Red,
-+ rEndColor.Green,
-+ rEndColor.Blue,
-+ rEndColor.Alpha);
-+
-+ setupUniforms(nProgramId,rTexTransform);
-+ }
-+
-+ void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor* pColors,
-+ const uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ if( rStops.getLength() > 2 )
-+ setupUniforms(mnLinearMultiColorGradientProgram, pColors, rStops, rTexTransform);
-+ else
-+ setupUniforms(mnLinearTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
-+ }
-+
-+ void SpriteDeviceHelper::useRadialGradientShader( const rendering::ARGBColor* pColors,
-+ const uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ if( rStops.getLength() > 2 )
-+ setupUniforms(mnRadialMultiColorGradientProgram, pColors, rStops, rTexTransform);
-+ else
-+ setupUniforms(mnRadialTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
-+ }
-+
-+ void SpriteDeviceHelper::useRectangularGradientShader( const rendering::ARGBColor* pColors,
-+ const uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform )
-+ {
-+ if( rStops.getLength() > 2 )
-+ setupUniforms(mnRectangularMultiColorGradientProgram, pColors, rStops, rTexTransform);
-+ else
-+ setupUniforms(mnRectangularTwoColorGradientProgram, pColors[0], pColors[1], rTexTransform);
-+ }
-+
-+ bool SpriteDeviceHelper::activatePBufferContext(const ::basegfx::B2IVector& rSize,
-+ unsigned int PBuffer) const
-+ {
-+ if( !glXMakeCurrent( reinterpret_cast<unx::Display*>(mpDisplay),
-+ PBuffer,
-+ reinterpret_cast<unx::GLXContext>(mpGLPBufContext)) )
-+ {
-+ OSL_TRACE("SpriteDeviceHelper::activatePBufferContext(): cannot activate GL context");
-+ return false;
-+ }
-+
-+ initContext();
-+ initTransformation(
-+ ::Size(
-+ rSize.getX(),
-+ rSize.getY()),
-+ true);
-+
-+ return true;
-+ }
-+
-+ bool SpriteDeviceHelper::activateWindowContext() const
-+ {
-+ const unx::Window aXWindow=mpChildWindow->GetSystemData()->aWindow;
-+ if( !glXMakeCurrent( reinterpret_cast<unx::Display*>(mpDisplay),
-+ aXWindow,
-+ reinterpret_cast<unx::GLXContext>(mpGLContext)) )
-+ {
-+ OSL_TRACE("SpriteDeviceHelper::activateWindowContext(): cannot activate GL context");
-+ return false;
-+ }
-+
-+ return true;
-+ }
-+
-+ bool SpriteDeviceHelper::updatePBufferTexture( const ::basegfx::B2IVector& rSize,
-+ unsigned int nTextId ) const
-+ {
-+ glBindTexture( GL_TEXTURE_2D, nTextId );
-+ glEnable(GL_TEXTURE_2D);
-+ glCopyTexSubImage2D( GL_TEXTURE_2D,
-+ 0, 0, 0, 0, 0,
-+ rSize.getX(),
-+ rSize.getY() );
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+
-+ return true;
-+ }
-+
-+ namespace
-+ {
-+ class BufferContextImpl : public IBufferContext
-+ {
-+ ::basegfx::B2IVector maSize;
-+ const SpriteDeviceHelper& mrDeviceHelper;
-+ unx::GLXPbuffer mpPBuffer;
-+ unx::Display* mpDisplay;
-+ unsigned int mnTexture;
-+
-+ virtual bool startBufferRendering()
-+ {
-+ return mrDeviceHelper.activatePBufferContext(maSize,mpPBuffer);
-+ }
-+
-+ virtual bool endBufferRendering()
-+ {
-+ mrDeviceHelper.updatePBufferTexture(maSize,mnTexture);
-+ if( !mrDeviceHelper.activateWindowContext() )
-+ return false;
-+
-+ glBindTexture( GL_TEXTURE_2D, mnTexture );
-+
-+ return true;
-+ }
-+
-+ public:
-+ BufferContextImpl(const SpriteDeviceHelper& rDeviceHelper,
-+ unx::GLXPbuffer pBuffer,
-+ unx::Display* pDisplay,
-+ const ::basegfx::B2IVector& rSize) :
-+ maSize(rSize),
-+ mrDeviceHelper(rDeviceHelper),
-+ mpPBuffer(pBuffer),
-+ mpDisplay(pDisplay),
-+ mnTexture(0)
-+ {
-+ glGenTextures( 1, &mnTexture );
-+#if 1
-+ glBindTexture( GL_TEXTURE_2D, mnTexture );
-+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
-+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA,
-+ maSize.getX(), maSize.getY(),
-+ 0, GL_RGBA, GL_UNSIGNED_BYTE, new int[maSize.getX()*maSize.getY()] );
-+#endif
-+ }
-+
-+ ~BufferContextImpl()
-+ {
-+#if 0
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+ glDeleteTextures( 1, &mnTexture );
-+ glXDestroyPbuffer( mpDisplay, mpPBuffer );
-+#endif
-+ }
-+ };
-+ }
-+
-+ IBufferContextSharedPtr SpriteDeviceHelper::createBufferContext(const ::basegfx::B2IVector& rSize) const
-+ {
-+ int pBufAttribs[] =
-+ {
-+ GLX_PBUFFER_WIDTH, rSize.getX(),
-+ GLX_PBUFFER_HEIGHT, rSize.getY(),
-+ GLX_LARGEST_PBUFFER, False,
-+ None
-+ };
-+
-+ unx::GLXPbuffer pBuffer;
-+ pBuffer = unx::glXCreatePbuffer( reinterpret_cast<unx::Display*>(mpDisplay),
-+ *reinterpret_cast<unx::GLXFBConfig*>(mpFBConfig),
-+ pBufAttribs );
-+
-+ IBufferContextSharedPtr pRet;
-+ if( pBuffer )
-+ pRet.reset(new BufferContextImpl(
-+ *this,
-+ pBuffer,
-+ reinterpret_cast<unx::Display*>(mpDisplay),
-+ rSize));
-+
-+ return pRet;
-+ }
-+
-+ TextureCache& SpriteDeviceHelper::getTextureCache() const
-+ {
-+ return *mpTextureCache;
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_spritedevicehelper.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_spritedevicehelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,183 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_SPRITEDEVICEHELPER_HXX
-+#define OGL_SPRITEDEVICEHELPER_HXX
-+
-+#include <rtl/ref.hxx>
-+#include <canvas/elapsedtime.hxx>
-+#include <com/sun/star/rendering/XGraphicDevice.hpp>
-+#include <boost/utility.hpp>
-+#include <boost/shared_ptr.hpp>
-+
-+#include "ogl_buffercontext.hxx"
-+
-+#include <set>
-+
-+
-+class Window;
-+class SystemChildWindow;
-+namespace basegfx{ class B2IVector; class B2DHomMatrix; }
-+namespace com { namespace sun { namespace star {
-+ namespace awt { struct Rectangle; }
-+ namespace geometry { struct AffineMatrix2D; }
-+}}}
-+
-+namespace oglcanvas
-+{
-+ class TextureCache;
-+ class SpriteCanvas;
-+ class CanvasCustomSprite;
-+ class CanvasHelper;
-+
-+ class SpriteDeviceHelper : private ::boost::noncopyable
-+ {
-+ public:
-+ SpriteDeviceHelper();
-+
-+ void init( Window& rWindow,
-+ SpriteCanvas& rSpriteCanvas,
-+ const ::com::sun::star::awt::Rectangle& rViewArea );
-+
-+ /// Dispose all internal references
-+ void disposing();
-+
-+ // XWindowGraphicDevice
-+ ::com::sun::star::geometry::RealSize2D getPhysicalResolution();
-+ ::com::sun::star::geometry::RealSize2D getPhysicalSize();
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::geometry::IntegerSize2D& size );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::geometry::IntegerSize2D& size );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::geometry::IntegerSize2D& size );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
-+ const ::com::sun::star::geometry::IntegerSize2D& size );
-+
-+ sal_Bool hasFullScreenMode( );
-+ sal_Bool enterFullScreenMode( sal_Bool bEnter );
-+
-+ ::sal_Int32 createBuffers( ::sal_Int32 nBuffers );
-+ void destroyBuffers( );
-+ ::sal_Bool showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
-+ ::sal_Bool switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
-+
-+ ::com::sun::star::uno::Any isAccelerated() const;
-+ ::com::sun::star::uno::Any getDeviceHandle() const;
-+ ::com::sun::star::uno::Any getSurfaceHandle() const;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XColorSpace > getColorSpace() const;
-+
-+ void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
-+
-+ /** called when DumpScreenContent property is enabled on
-+ XGraphicDevice, and writes out bitmaps of current screen.
-+ */
-+ void dumpScreenContent() const;
-+
-+ void show( const ::rtl::Reference< CanvasCustomSprite >& );
-+ void hide( const ::rtl::Reference< CanvasCustomSprite >& );
-+
-+ /// enable linear gradient shader "texture" with given parameters
-+ void useLinearGradientShader( const ::com::sun::star::rendering::ARGBColor* pColors,
-+ const ::com::sun::star::uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform );
-+ /// enable radial gradient shader "texture" with given parameters
-+ void useRadialGradientShader( const ::com::sun::star::rendering::ARGBColor* pColors,
-+ const ::com::sun::star::uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform );
-+ /// enable rectangular gradient shader "texture" with given parameters
-+ void useRectangularGradientShader( const ::com::sun::star::rendering::ARGBColor* pColors,
-+ const ::com::sun::star::uno::Sequence< double >& rStops,
-+ const ::basegfx::B2DHomMatrix& rTexTransform );
-+
-+ /// create a pbuffer context (for rendering into background surface)
-+ IBufferContextSharedPtr createBufferContext(const ::basegfx::B2IVector& rSize) const;
-+
-+ /// Get instance of internal texture cache
-+ TextureCache& getTextureCache() const;
-+
-+ ////////////////////////////////////////////////////////
-+
-+ // nobody except IBufferContext implementations are supposed
-+ // to use this
-+ bool activatePBufferContext(const ::basegfx::B2IVector& rSize,
-+ unsigned int PBuffer) const;
-+ bool activateWindowContext() const;
-+ bool updatePBufferTexture( const ::basegfx::B2IVector&,
-+ unsigned int ) const;
-+
-+ private:
-+ void resize( const ::basegfx::B2IVector& rNewSize );
-+
-+ void compileShader(unsigned int& o_rShaderHandle,
-+ unsigned int eShaderType,
-+ const char* pShaderSourceCode);
-+ void linkShaders(unsigned int& o_rProgramHandle,
-+ unsigned int nVertexProgramId,
-+ unsigned int nFragmentProgramId);
-+
-+ /** Phyical output device
-+
-+ Deliberately not a refcounted reference, because of
-+ potential circular references for canvas. Needed to
-+ create bitmaps
-+ */
-+ com::sun::star::rendering::XGraphicDevice* mpDevice;
-+
-+ /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
-+ SpriteCanvas* mpSpriteCanvas;
-+
-+ std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites;
-+
-+ /// For the frame counter timings
-+ ::canvas::tools::ElapsedTime maLastUpdate;
-+
-+ boost::shared_ptr<SystemChildWindow> mpChildWindow;
-+ void* mpDisplay;
-+ void* mpGLContext;
-+ void* mpGLPBufContext;
-+ void* mpFBConfig;
-+
-+ boost::shared_ptr<TextureCache> mpTextureCache;
-+
-+ unsigned int mnDummyVertexProgram;
-+
-+ unsigned int mnLinearTwoColorGradientFragmentProgram;
-+ unsigned int mnLinearMultiColorGradientFragmentProgram;
-+ unsigned int mnRadialTwoColorGradientFragmentProgram;
-+ unsigned int mnRadialMultiColorGradientFragmentProgram;
-+ unsigned int mnRectangularTwoColorGradientFragmentProgram;
-+ unsigned int mnRectangularMultiColorGradientFragmentProgram;
-+ unsigned int mnLinearTwoColorGradientProgram;
-+ unsigned int mnLinearMultiColorGradientProgram;
-+ unsigned int mnRadialTwoColorGradientProgram;
-+ unsigned int mnRadialMultiColorGradientProgram;
-+ unsigned int mnRectangularTwoColorGradientProgram;
-+ unsigned int mnRectangularMultiColorGradientProgram;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_textlayout.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_textlayout.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,222 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#include "ogl_textlayout.hxx"
-+
-+#include <canvas/debug.hxx>
-+#include <canvas/verbosetrace.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/numeric/ftools.hxx>
-+
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ TextLayout::TextLayout( const rendering::StringContext& aText,
-+ sal_Int8 nDirection,
-+ sal_Int64 /*nRandomSeed*/,
-+ const CanvasFont::ImplRef& rFont ) :
-+ TextLayoutBaseT( m_aMutex ),
-+ maText( aText ),
-+ maLogicalAdvancements(),
-+ mpFont( rFont ),
-+ mnTextDirection( nDirection )
-+ {
-+ }
-+
-+ void SAL_CALL TextLayout::disposing()
-+ {
-+ mpFont.reset();
-+ }
-+
-+ // XTextLayout
-+ uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > > SAL_CALL TextLayout::queryTextShapes( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >();
-+ }
-+
-+ uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Sequence< geometry::RealRectangle2D >();
-+ }
-+
-+ uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Sequence< geometry::RealRectangle2D >();
-+ }
-+
-+ uno::Sequence< double > SAL_CALL TextLayout::queryLogicalAdvancements( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return maLogicalAdvancements;
-+ }
-+
-+ void SAL_CALL TextLayout::applyLogicalAdvancements( const uno::Sequence< double >& aAdvancements ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ if( aAdvancements.getLength() != maText.Length )
-+ {
-+ OSL_TRACE( "TextLayout::applyLogicalAdvancements(): mismatching number of advancements" );
-+ throw lang::IllegalArgumentException();
-+ }
-+
-+ maLogicalAdvancements = aAdvancements;
-+ }
-+
-+ geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ ENSURE_OR_THROW( mpFont.get(),
-+ "TextLayout::queryTextBounds(): invalid font" );
-+
-+ // fake text bounds by either taking the advancement values,
-+ // or assuming square glyph boxes (width similar to height)
-+ const rendering::FontRequest& rFontRequest( mpFont->getFontRequest() );
-+ const double nFontSize( ::std::max( rFontRequest.CellSize,
-+ rFontRequest.ReferenceAdvancement ) );
-+ if( maLogicalAdvancements.getLength() )
-+ {
-+ return geometry::RealRectangle2D( 0, -nFontSize/2,
-+ maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ],
-+ nFontSize/2 );
-+ }
-+ else
-+ {
-+ return geometry::RealRectangle2D( 0, -nFontSize/2,
-+ nFontSize * maText.Length,
-+ nFontSize/2 );
-+ }
-+ }
-+
-+ double SAL_CALL TextLayout::justify( double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return 0.0;
-+ }
-+
-+ double SAL_CALL TextLayout::combinedJustify( const uno::Sequence< uno::Reference< rendering::XTextLayout > >& /*aNextLayouts*/,
-+ double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return 0.0;
-+ }
-+
-+ rendering::TextHit SAL_CALL TextLayout::getTextHit( const geometry::RealPoint2D& /*aHitPoint*/ ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return rendering::TextHit();
-+ }
-+
-+ rendering::Caret SAL_CALL TextLayout::getCaret( sal_Int32 /*nInsertionIndex*/,
-+ sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return rendering::Caret();
-+ }
-+
-+ sal_Int32 SAL_CALL TextLayout::getNextInsertionIndex( sal_Int32 /*nStartIndex*/,
-+ sal_Int32 /*nCaretAdvancement*/,
-+ sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return 0;
-+ }
-+
-+ uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryVisualHighlighting( sal_Int32 /*nStartIndex*/,
-+ sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Reference< rendering::XPolyPolygon2D >();
-+ }
-+
-+ uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryLogicalHighlighting( sal_Int32 /*nStartIndex*/,
-+ sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return uno::Reference< rendering::XPolyPolygon2D >();
-+ }
-+
-+ double SAL_CALL TextLayout::getBaselineOffset( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+ return 0.0;
-+ }
-+
-+ sal_Int8 SAL_CALL TextLayout::getMainTextDirection( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return mnTextDirection;
-+ }
-+
-+ uno::Reference< rendering::XCanvasFont > SAL_CALL TextLayout::getFont( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return mpFont.getRef();
-+ }
-+
-+ rendering::StringContext SAL_CALL TextLayout::getText( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ return maText;
-+ }
-+
-+ bool TextLayout::draw( const rendering::ViewState& /*rViewState*/,
-+ const rendering::RenderState& /*rRenderState*/,
-+ const uno::Reference< rendering::XGraphicDevice >& /*xGraphicDevice*/ ) const
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // TODO
-+
-+ return true;
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_textlayout.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_textlayout.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_TEXTLAYOUT_HXX
-+#define OGL_TEXTLAYOUT_HXX
-+
-+#include <cppuhelper/compbase1.hxx>
-+#include <comphelper/broadcasthelper.hxx>
-+
-+#include <com/sun/star/rendering/XTextLayout.hpp>
-+
-+#include <basegfx/vector/b2isize.hxx>
-+
-+#include <boost/utility.hpp>
-+
-+#include "ogl_canvasfont.hxx"
-+
-+
-+/* Definition of TextLayout class */
-+
-+namespace oglcanvas
-+{
-+ typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::rendering::XTextLayout > TextLayoutBaseT;
-+
-+ class TextLayout : public ::comphelper::OBaseMutex,
-+ public TextLayoutBaseT,
-+ private ::boost::noncopyable
-+ {
-+ public:
-+ TextLayout( const ::com::sun::star::rendering::StringContext& aText,
-+ sal_Int8 nDirection,
-+ sal_Int64 nRandomSeed,
-+ const CanvasFont::ImplRef& rFont );
-+
-+ /// Dispose all internal references
-+ virtual void SAL_CALL disposing();
-+
-+ // XTextLayout
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL applyLogicalAdvancements( const ::com::sun::star::uno::Sequence< double >& aAdvancements ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual double SAL_CALL justify( double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual double SAL_CALL combinedJustify( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::rendering::TextHit SAL_CALL getTextHit( const ::com::sun::star::geometry::RealPoint2D& aHitPoint ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual double SAL_CALL getBaselineOffset( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual sal_Int8 SAL_CALL getMainTextDirection( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::rendering::StringContext SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ bool draw( const ::com::sun::star::rendering::ViewState& rViewState,
-+ const ::com::sun::star::rendering::RenderState& rRenderState,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice ) const;
-+
-+ private:
-+ ::com::sun::star::rendering::StringContext maText;
-+ ::com::sun::star::uno::Sequence< double > maLogicalAdvancements;
-+ CanvasFont::ImplRef mpFont;
-+ sal_Int8 mnTextDirection;
-+ };
-+
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_texturecache.cxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_texturecache.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,132 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ * Parts copyright 2004 David Reveman, Peter Nilsson
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_canvas.hxx"
-+
-+#define GL_GLEXT_PROTOTYPES
-+
-+#include "ogl_texturecache.hxx"
-+
-+#include <com/sun/star/geometry/IntegerSize2D.hpp>
-+
-+#include <GL/gl.h>
-+#include <GL/glu.h>
-+#include <GL/glext.h>
-+
-+using namespace ::com::sun::star;
-+
-+namespace oglcanvas
-+{
-+ TextureCache::TextureCache() :
-+ maCache(101),
-+ mnMissCount(0),
-+ mnHitCount(0)
-+ {}
-+
-+ TextureCache::~TextureCache()
-+ {
-+ flush();
-+ }
-+
-+ void TextureCache::flush()
-+ {
-+ // un-bind any texture
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+
-+ // delete all cached textures
-+ TextureCacheMapT::const_iterator aCurr=maCache.begin();
-+ const TextureCacheMapT::const_iterator aEnd=maCache.end();
-+ while( aCurr != aEnd )
-+ {
-+ glDeleteTextures(1, &aCurr->second.nTexture);
-+ ++aCurr;
-+ }
-+
-+ maCache.clear();
-+ mnMissCount = 0;
-+ mnHitCount = 0;
-+ }
-+
-+ void TextureCache::prune()
-+ {
-+ // un-bind any texture
-+ glBindTexture(GL_TEXTURE_2D, 0);
-+
-+ // delete already "old" textures, mark "new" entries "old"
-+ TextureCacheMapT::iterator aNext;
-+ TextureCacheMapT::iterator aCurr=maCache.begin();
-+ const TextureCacheMapT::iterator aEnd=maCache.end();
-+ while( aCurr != aEnd )
-+ {
-+ aNext=aCurr; ++aNext;
-+ if( aCurr->second.bOld )
-+ {
-+ glDeleteTextures(1, &aCurr->second.nTexture);
-+ maCache.erase(aCurr);
-+ }
-+ else
-+ {
-+ aCurr->second.bOld = true;
-+ }
-+ aCurr=aNext;
-+ }
-+
-+ mnMissCount = 0;
-+ mnHitCount = 0;
-+ }
-+
-+ unsigned int TextureCache::getTexture( const geometry::IntegerSize2D& rPixelSize,
-+ const sal_Int8* pPixel,
-+ sal_uInt32 nPixelCrc32) const
-+ {
-+ unsigned int nTexture(0);
-+
-+ // texture already cached?
-+ TextureCacheMapT::iterator aCacheEntry;
-+ if( (aCacheEntry=maCache.find(nPixelCrc32)) == maCache.end() )
-+ {
-+ // nope, insert new entry
-+ glGenTextures(1, &nTexture);
-+ glBindTexture(GL_TEXTURE_2D, nTexture);
-+
-+ // TODO(E3): handle limited texture sizes -
-+ // glGetIntegerv(GL_MAX_TEXTURE_SIZE)
-+ glTexImage2D(GL_TEXTURE_2D,
-+ 0,
-+ 4,
-+ rPixelSize.Width,
-+ rPixelSize.Height,
-+ 0,
-+ GL_RGBA,
-+ GL_UNSIGNED_INT_8_8_8_8_REV,
-+ pPixel);
-+
-+ maCache[nPixelCrc32].nTexture = nTexture;
-+ ++mnMissCount;
-+
-+ return nTexture;
-+ }
-+ else
-+ {
-+ nTexture = aCacheEntry->second.nTexture;
-+ aCacheEntry->second.bOld = false;
-+ ++mnHitCount;
-+ }
-+
-+ return nTexture;
-+ }
-+}
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_texturecache.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_texturecache.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_TEXTURECACHE_HXX
-+#define OGL_TEXTURECACHE_HXX
-+
-+#include <sal/types.h>
-+#include <hash_map>
-+
-+namespace com { namespace sun { namespace star {
-+ namespace geometry { struct IntegerSize2D; }
-+}}}
-+
-+namespace oglcanvas
-+{
-+ class TextureCache
-+ {
-+ public:
-+ TextureCache();
-+ ~TextureCache();
-+
-+ /// clear whole cache, reset statistic counters
-+ void flush();
-+
-+ /** prune old entries from cache
-+
-+ Everytime this method is called, all cache entries are set
-+ to "old". If subsequently not used by getTexture(),
-+ they'll be entitled for expunge on the next prune()
-+ call. Resets statistic counters.
-+ */
-+ void prune();
-+
-+ /// Statistics
-+ size_t getCacheSize() const { return maCache.size(); };
-+ sal_uInt32 getCacheMissCount() const { return mnMissCount; }
-+ sal_uInt32 getCacheHitCount() const { return mnHitCount; }
-+
-+ unsigned int getTexture( const ::com::sun::star::geometry::IntegerSize2D& rPixelSize,
-+ const sal_Int8* pPixel,
-+ sal_uInt32 nPixelCrc32) const;
-+ private:
-+ struct CacheEntry
-+ {
-+ CacheEntry() : nTexture(0), bOld(false) {}
-+ unsigned int nTexture;
-+ bool bOld;
-+ };
-+ typedef std::hash_map<sal_uInt32,CacheEntry> TextureCacheMapT;
-+ mutable TextureCacheMapT maCache;
-+ mutable sal_uInt32 mnMissCount;
-+ mutable sal_uInt32 mnHitCount;
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/opengl/ogl_tools.hxx
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/canvas/source/opengl/ogl_tools.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,35 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#ifndef OGL_CANVAS_TOOLS_HXX
-+#define OGL_CANVAS_TOOLS_HXX
-+
-+#include <sal/config.h>
-+#include <GL/gl.h>
-+
-+
-+namespace oglcanvas
-+{
-+ struct TransformationPreserver
-+ {
-+ TransformationPreserver()
-+ { glPushMatrix(); }
-+
-+ ~TransformationPreserver()
-+ { glPopMatrix(); }
-+ };
-+}
-+
-+#endif
-diff -r 6ae934bd30f5 canvas/source/tools/canvastools.cxx
---- a/canvas/source/tools/canvastools.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/source/tools/canvastools.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -435,7 +435,7 @@
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
-- *pOut++ = vcl::unotools::toDoubleColor(255-*pIn++);
-+ *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- }
- return aRes;
- }
-@@ -500,7 +500,7 @@
- for( sal_Size i=0; i<nLen; i+=4 )
- {
- *pOut++ = rendering::ARGBColor(
-- vcl::unotools::toDoubleColor(255-pIn[3]),
-+ vcl::unotools::toDoubleColor(pIn[3]),
- vcl::unotools::toDoubleColor(pIn[0]),
- vcl::unotools::toDoubleColor(pIn[1]),
- vcl::unotools::toDoubleColor(pIn[2]));
-@@ -521,7 +521,7 @@
- rendering::ARGBColor* pOut( aRes.getArray() );
- for( sal_Size i=0; i<nLen; i+=4 )
- {
-- const sal_Int8 nAlpha( 255-pIn[3] );
-+ const sal_Int8 nAlpha( pIn[3] );
- *pOut++ = rendering::ARGBColor(
- vcl::unotools::toDoubleColor(nAlpha),
- vcl::unotools::toDoubleColor(nAlpha*pIn[0]),
-@@ -562,7 +562,7 @@
- *pColors++ = vcl::unotools::toByteColor(pIn->Red);
- *pColors++ = vcl::unotools::toByteColor(pIn->Green);
- *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
-- *pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha);
-+ *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
- ++pIn;
- }
- return aRes;
-@@ -580,7 +580,7 @@
- *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
- *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
- *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
-- *pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha);
-+ *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
- ++pIn;
- }
- return aRes;
-diff -r 6ae934bd30f5 canvas/source/vcl/canvashelper.hxx
---- a/canvas/source/vcl/canvashelper.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/canvas/source/vcl/canvashelper.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -32,6 +32,7 @@
- #define _VCLCANVAS_CANVASHELPER_HXX_
-
- #include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <com/sun/star/rendering/XIntegerBitmap.hpp>
-
- #include <vcl/outdev.hxx>
-diff -r 6ae934bd30f5 cppcanvas/inc/cppcanvas/spritecanvas.hxx
---- a/cppcanvas/inc/cppcanvas/spritecanvas.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/cppcanvas/inc/cppcanvas/spritecanvas.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -38,7 +38,7 @@
- #include <boost/shared_ptr.hpp>
-
-
--#include <cppcanvas/bitmapcanvas.hxx>
-+#include <cppcanvas/canvas.hxx>
- #include <cppcanvas/sprite.hxx>
- #include <cppcanvas/customsprite.hxx>
-
-@@ -59,7 +59,7 @@
-
- /** SpriteCanvas interface
- */
-- class SpriteCanvas : public virtual BitmapCanvas
-+ class SpriteCanvas : public virtual Canvas
- {
- public:
- virtual bool updateScreen( bool bUpdateAll ) const = 0;
-diff -r 6ae934bd30f5 cppcanvas/source/wrapper/implspritecanvas.cxx
---- a/cppcanvas/source/wrapper/implspritecanvas.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/cppcanvas/source/wrapper/implspritecanvas.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -64,8 +64,6 @@
- ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
- ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
- uno::UNO_QUERY) ),
-- ImplBitmapCanvas( uno::Reference< rendering::XBitmapCanvas >(rCanvas,
-- uno::UNO_QUERY) ),
- mxSpriteCanvas( rCanvas ),
- mpTransformArbiter( new TransformationArbiter() )
- {
-@@ -74,10 +72,8 @@
-
- ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) :
- Canvas(),
-- BitmapCanvas(),
- SpriteCanvas(),
- ImplCanvas( rOrig ),
-- ImplBitmapCanvas( rOrig ),
- mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ),
- mpTransformArbiter( new TransformationArbiter() )
- {
-diff -r 6ae934bd30f5 cppcanvas/source/wrapper/implspritecanvas.hxx
---- a/cppcanvas/source/wrapper/implspritecanvas.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/cppcanvas/source/wrapper/implspritecanvas.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -44,14 +44,14 @@
-
- #include <cppcanvas/spritecanvas.hxx>
-
--#include <implbitmapcanvas.hxx>
-+#include <implcanvas.hxx>
-
-
- namespace cppcanvas
- {
- namespace internal
- {
-- class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas
-+ class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplCanvas
- {
- public:
- ImplSpriteCanvas( const ::com::sun::star::uno::Reference<
-diff -r 6ae934bd30f5 offapi/com/sun/star/rendering/XSpriteCanvas.idl
---- a/offapi/com/sun/star/rendering/XSpriteCanvas.idl Mon Jan 18 21:14:50 2010 +0100
-+++ b/offapi/com/sun/star/rendering/XSpriteCanvas.idl Tue Jan 19 22:12:52 2010 +0100
-@@ -33,7 +33,7 @@
- #ifndef __com_sun_star_lang_IllegalArgumentException_idl__
- #include <com/sun/star/lang/IllegalArgumentException.idl>
- #endif
--#ifndef __com_sun_star_rendering_XBitmapCanvas_idl__
-+#ifndef __com_sun_star_rendering_XCanvas_idl__
- #include <com/sun/star/rendering/XBitmapCanvas.idl>
- #endif
- #ifndef __com_sun_star_rendering_XAnimation_idl__
-@@ -49,7 +49,7 @@
- interface XAnimatedSprite;
- interface XCustomSprite;
-
--/** Specialization of a XBitmapCanvas, where moving, animated objects
-+/** Specialization of a XCanvas, where moving, animated objects
- (called sprites) are supported.<p>
-
- @attention The screen output of canvas drawing operations is
-@@ -63,9 +63,9 @@
- (because there's a defined moment in time where content display
- can happen, namely the XBufferController::showBuffer()) call. If
- you don't need sprite functionality, and don't want the
-- updateScreen hassle, simply use the XBitmapCanvas.
-+ updateScreen hassle, simply use the XCanvas.
- */
--interface XSpriteCanvas : XBitmapCanvas
-+interface XSpriteCanvas : XCanvas
- {
- /** Create a sprite object from the specified animation
- sequence. A sprite is a back-buffered object with its own,
-@@ -117,9 +117,8 @@
- object.
-
- The cloned sprite always shows the same content as its
-- original. Furthermore, cloned copies of a hidden original are
-- never visible, although cloned copies of a visible original
-- can of course be invisible.
-+ original, but of course the sprite position, visibility, alpha
-+ etc. can be modified independently.
-
- @param original
- The original sprite to copy the content from. This sprite must
-diff -r 6ae934bd30f5 officecfg/registry/data/org/openoffice/Office/Canvas.xcu
---- a/officecfg/registry/data/org/openoffice/Office/Canvas.xcu Mon Jan 18 21:14:50 2010 +0100
-+++ b/officecfg/registry/data/org/openoffice/Office/Canvas.xcu Tue Jan 19 22:12:52 2010 +0100
-@@ -52,6 +52,7 @@
- <prop oor:name="PreferredImplementations" oor:type="oor:string-list">
- <value oor:separator=",">com.sun.star.comp.rendering.SpriteCanvas.DX9,
- com.sun.star.comp.rendering.SpriteCanvas.DX5,
-+ com.sun.star.comp.rendering.SpriteCanvas.OGL,
- com.sun.star.comp.rendering.SpriteCanvas.Cairo,
- com.sun.star.comp.rendering.SpriteCanvas.GL,
- com.sun.star.comp.rendering.SpriteCanvas.Java,
-diff -r 6ae934bd30f5 scp2/source/canvas/makefile.mk
---- a/scp2/source/canvas/makefile.mk Mon Jan 18 21:14:50 2010 +0100
-+++ b/scp2/source/canvas/makefile.mk Tue Jan 19 22:12:52 2010 +0100
-@@ -51,6 +51,7 @@
- .ENDIF
-
- PARFILES= canvascommons.par \
-+ openglcanvas.par \
- vclcanvas.par
-
- .IF "$(ENABLE_CAIRO)" == "TRUE"
-diff -r 6ae934bd30f5 scp2/source/canvas/openglcanvas.scp
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/scp2/source/canvas/openglcanvas.scp Tue Jan 19 22:12:52 2010 +0100
-@@ -0,0 +1,28 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * Author:
-+ * Thorsten Behrens <tbehrens@novell.com>
-+ *
-+ * Copyright (C) 2008, Novell Inc.
-+ * Parts copyright 2005 by Sun Microsystems, Inc.
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ ************************************************************************/
-+
-+#include "macros.inc"
-+
-+File gid_File_Lib_OpenGLCanvas
-+ TXT_FILE_BODY;
-+ Styles = (PACKED,UNO_COMPONENT);
-+ RegistryID = gid_Starregistry_Services_Rdb;
-+ Dir = gid_Dir_Program;
-+ #ifdef UNX
-+ Name = STRING(CONCAT2(oglcanvas.uno,UNXSUFFIX));
-+ #else
-+ Name = "oglcanvas.uno.dll";
-+ #endif
-+End
-diff -r 6ae934bd30f5 scp2/util/makefile.mk
---- a/scp2/util/makefile.mk Mon Jan 18 21:14:50 2010 +0100
-+++ b/scp2/util/makefile.mk Tue Jan 19 22:12:52 2010 +0100
-@@ -179,8 +179,8 @@
- file_crashrep_dynamic.par
- .ENDIF
-
--SCP1FILES += \
-- vclcanvas.par
-+SCP1FILES += vclcanvas.par \
-+ openglcanvas.par
-
- .IF "$(ENABLE_CAIRO)" == "TRUE"
- SCP1FILES += cairocanvas.par
-diff -r 6ae934bd30f5 sd/source/ui/presenter/PresenterCanvas.cxx
---- a/sd/source/ui/presenter/PresenterCanvas.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/presenter/PresenterCanvas.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -809,17 +809,6 @@
-
-
-
--Reference<rendering::XBitmapCanvas> SAL_CALL PresenterCanvas::queryBitmapCanvas (void)
-- throw (RuntimeException)
--{
-- ThrowIfDisposed();
--
-- return this;
--}
--
--
--
--
- Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
- const css::geometry::RealSize2D& rNewSize,
- sal_Bool bFast)
-diff -r 6ae934bd30f5 sd/source/ui/presenter/PresenterCanvas.hxx
---- a/sd/source/ui/presenter/PresenterCanvas.hxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/presenter/PresenterCanvas.hxx Tue Jan 19 22:12:52 2010 +0100
-@@ -41,6 +41,7 @@
- #include <com/sun/star/lang/XInitialization.hpp>
- #include <com/sun/star/lang/IllegalArgumentException.hpp>
- #include <com/sun/star/rendering/XSpriteCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <com/sun/star/rendering/VolatileContentDestroyedException.hpp>
- #include <cppuhelper/basemutex.hxx>
- #include <cppuhelper/compbase4.hxx>
-@@ -387,9 +388,6 @@
- virtual sal_Bool SAL_CALL hasAlpha (void)
- throw (css::uno::RuntimeException);
-
-- virtual css::uno::Reference<css::rendering::XBitmapCanvas> SAL_CALL queryBitmapCanvas (void)
-- throw (css::uno::RuntimeException);
--
- virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL getScaledBitmap(
- const css::geometry::RealSize2D& rNewSize,
- sal_Bool bFast)
-diff -r 6ae934bd30f5 sd/source/ui/presenter/PresenterTextView.cxx
---- a/sd/source/ui/presenter/PresenterTextView.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/presenter/PresenterTextView.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -52,6 +52,7 @@
- #include <com/sun/star/awt/FontDescriptor.hpp>
- #include <com/sun/star/awt/Size.hpp>
- #include <com/sun/star/rendering/XSpriteCanvas.hpp>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <com/sun/star/util/Color.hpp>
- #include <com/sun/star/i18n/ScriptType.hpp>
-
-diff -r 6ae934bd30f5 sd/source/ui/presenter/SlideRenderer.cxx
---- a/sd/source/ui/presenter/SlideRenderer.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/presenter/SlideRenderer.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -34,6 +34,7 @@
- #include "SlideRenderer.hxx"
- #include "sdpage.hxx"
- #include <toolkit/helper/vclunohelper.hxx>
-+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
- #include <vos/mutex.hxx>
- #include <vcl/svapp.hxx>
- #include <cppcanvas/vclfactory.hxx>
-diff -r 6ae934bd30f5 sd/source/ui/slideshow/slideshowimpl.cxx
---- a/sd/source/ui/slideshow/slideshowimpl.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/slideshow/slideshowimpl.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -1915,9 +1915,9 @@
- // returns a small positive number but not 0 (which is
- // handled above). Also, make sure that calls to update()
- // have a minimum frequency.
-- // => Allow up to 60 frames per second. Call at least once
-+ // => Allow up to 100 frames per second. Call at least once
- // every 4 seconds.
-- const static sal_Int32 mnMaximumFrameCount (60);
-+ const static sal_Int32 mnMaximumFrameCount (100);
- const static double mnMinimumTimeout (1.0 / mnMaximumFrameCount);
- const static double mnMaximumTimeout (4.0);
- fUpdate = ::basegfx::clamp(fUpdate, mnMinimumTimeout, mnMaximumTimeout);
-diff -r 6ae934bd30f5 sd/source/ui/slideshow/slideshowviewimpl.cxx
---- a/sd/source/ui/slideshow/slideshowviewimpl.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -59,7 +59,6 @@
-
- using ::rtl::OUString;
- using namespace ::com::sun::star;
--using namespace ::com::sun::star;
-
- namespace sd
- {
-diff -r 6ae934bd30f5 slideshow/source/engine/slideview.cxx
---- a/slideshow/source/engine/slideview.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/slideshow/source/engine/slideview.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -898,6 +898,11 @@
- if( !mxView.is() || !mpCanvas )
- return;
-
-+ mpCanvas->clear(); // this is unnecessary, strictly speaking. but
-+ // it makes the SlideView behave exactly like a
-+ // sprite-based SlideViewLayer, because those
-+ // are created from scratch after a resize
-+
- // clear whole view
- mxView->clear();
- }
-@@ -1113,10 +1118,6 @@
- if( !mpCanvas || !mxView.is())
- return;
-
-- mpCanvas->clear(); // this is unnecessary, strictly speaking. but
-- // it makes the SlideView behave exactly like a
-- // sprite-based SlideViewLayer, because those
-- // are created from scratch after a resize
- clearAll();
- mpCanvas->setTransformation( getTransformation() );
- mpCanvas->setClip(
-diff -r 6ae934bd30f5 slideshow/source/engine/transitions/slidechangebase.cxx
---- a/slideshow/source/engine/transitions/slidechangebase.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/slideshow/source/engine/transitions/slidechangebase.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -247,6 +247,7 @@
-
- const SlideBitmapSharedPtr pSlideBitmap( getEnteringBitmap( *aCurr ));
- pSlideBitmap->clip( basegfx::B2DPolyPolygon() /* no clipping */ );
-+ aCurr->mpView->clearAll();
- renderBitmap( pSlideBitmap,
- aCurr->mpView->getCanvas() );
-
-diff -r 6ae934bd30f5 slideshow/source/engine/transitions/slidetransitionfactory.cxx
---- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -562,6 +562,7 @@
- if (mbFirstPerformCall && maLeavingDirection.equalZero())
- {
- mbFirstPerformCall = false;
-+ rViewEntry.mpView->clearAll();
- renderBitmap( getLeavingBitmap(rViewEntry), rDestinationCanvas );
- }
-
-@@ -600,6 +601,7 @@
- if (mbFirstPerformCall && maEnteringDirection.equalZero())
- {
- mbFirstPerformCall = false;
-+ rViewEntry.mpView->clearAll();
- renderBitmap( getEnteringBitmap(rViewEntry), rDestinationCanvas );
- }
-
-diff -r 6ae934bd30f5 slideshow/source/engine/waitsymbol.cxx
---- a/slideshow/source/engine/waitsymbol.cxx Mon Jan 18 21:14:50 2010 +0100
-+++ b/slideshow/source/engine/waitsymbol.cxx Tue Jan 19 22:12:52 2010 +0100
-@@ -41,6 +41,7 @@
- #include <basegfx/vector/b2dvector.hxx>
-
- #include <com/sun/star/rendering/XCanvas.hpp>
-+#include <com/sun/star/presentation/XSlideShowView.hpp>
-
- #include "waitsymbol.hxx"
- #include "eventmultiplexer.hxx"
-@@ -115,13 +116,13 @@
- basegfx::B2DPoint WaitSymbol::calcSpritePos(
- UnoViewSharedPtr const & rView ) const
- {
-- const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(),
-- uno::UNO_QUERY_THROW );
-- const geometry::IntegerSize2D realSize( xBitmap->getSize() );
-+ const awt::Rectangle aViewArea( rView->getUnoView()->getCanvasArea() );
- return basegfx::B2DPoint(
-- std::min<sal_Int32>( realSize.Width, LEFT_BORDER_SPACE ),
-- std::max<sal_Int32>( 0, realSize.Height - mxBitmap->getSize().Height
-- - LOWER_BORDER_SPACE ) );
-+ aViewArea.X + std::min<sal_Int32>( aViewArea.Width, LEFT_BORDER_SPACE ),
-+ aViewArea.X + std::max<sal_Int32>( 0,
-+ aViewArea.Height
-+ - mxBitmap->getSize().Height
-+ - LOWER_BORDER_SPACE ) );
- }
-
- void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView )
diff --git a/patches/test/pagein-idle b/patches/test/pagein-idle
deleted file mode 100644
index ff7e6bec5..000000000
--- a/patches/test/pagein-idle
+++ /dev/null
@@ -1,133 +0,0 @@
-sofficerc
-bootstraprc
-unorc
-types.rdb
-services.rdb
-configmgrrc
-../share/registry/schema
-../share/registry
-../share/registry/modules
-../share/registry/res
-%userinst%/user/registry
-%userinst%/user/registry/cache
-../share/registry/modules/org/openoffice/Setup
-%userinst%/user/registry/cache/org.openoffice.Setup.dat
-%userinst%/user/registry/data/org/openoffice/Setup.xcu
-%userinst%/user/registry/cache/org.openoffice.Office.Linguistic.dat
-%userinst%/user/registry/data/org/openoffice/Office/Linguistic.xcu
-%userinst%/user/registry/cache/org.openoffice.System.dat
-%userinst%/user/registry/cache/org.openoffice.VCL.dat
-resource
-resource/vcl%ver%%lang%.res
-../share/registry/modules/org/openoffice/Office/Common
-%userinst%/user/registry/cache/org.openoffice.Office.Common.dat
-%userinst%/user/registry/data/org/openoffice/Office/Common.xcu
-%userinst%/user/registry/cache/org.openoffice.Office.Substitution.dat
-intro.bmp
-%userinst%/user/registry/cache/org.openoffice.ucb.Configuration.dat
-resource/ooo%ver%%lang%.res
-resource/ofa%ver%%lang%.res
-%userinst%/user/registry/cache/org.openoffice.Office.Views.dat
-%userinst%/user/registry/data/org/openoffice/Office/Views.xcu
-%userinst%/user/registry/cache/org.openoffice.Office.Commands.dat
-%userinst%/user/registry/cache/org.openoffice.Office.ProtocolHandler.dat
-%userinst%/user/registry/cache/org.openoffice.ucb.Store.dat
-%userinst%/user/registry/data/org/openoffice/ucb/Store.xcu
-resource/sfx%ver%%lang%.res
-%userinst%/user/registry/cache/org.openoffice.Office.Events.dat
-%userinst%/user/registry/cache/org.openoffice.Office.Jobs.dat
-resource/dkt%ver%%lang%.res
-# ../share/config/images_industrial.zip
-%userinst%/user/config/imagecache
-%userinst%/user/psprint/pspfontcache
-jvmfwk3rc
-%userinst%/user/config/javasettings_Linux_x86.xml
-../share/config/javavendors.xml
-resource/svt%ver%%lang%.res
-%userinst%/user/registry/cache/org.openoffice.Office.Recovery.dat
-%userinst%/user/registry/data/org/openoffice/Office/Recovery.xcu
-%userinst%/user/registry/cache/org.openoffice.Office.TypeDetection.dat
-../share/registry/modules/org/openoffice/TypeDetection/Types
-%userinst%/user/registry/cache/org.openoffice.TypeDetection.Types.dat
-../share/registry/modules/org/openoffice/TypeDetection/Misc
-%userinst%/user/registry/cache/org.openoffice.TypeDetection.Misc.dat
-../share/registry/modules/org/openoffice/TypeDetection/Filter
-%userinst%/user/registry/cache/org.openoffice.TypeDetection.Filter.dat
-%userinst%/user/registry/cache/org.openoffice.Office.UI.dat
-resource/sw%ver%%lang%.res
-resource/svx%ver%%lang%.res
-%userinst%/user/registry/cache/org.openoffice.Office.Writer.dat
-%userinst%/user/registry/data/org/openoffice/Office/Writer.xcu
-%userinst%/user/registry/cache/org.openoffice.Office.WriterWeb.dat
-%userinst%/user/registry/cache/org.openoffice.Office.Compatibility.dat
-../share/config/soffice.cfg/modules/swriter/menubar
-%userinst%/user/config/soffice.cfg/modules/swriter/menubar
-../share/config/soffice.cfg/modules/swriter/toolbar
-%userinst%/user/config/soffice.cfg/modules/swriter/toolbar
-../share/config/soffice.cfg/modules/swriter/statusbar
-%userinst%/user/config/soffice.cfg/modules/swriter/statusbar
-../share/config/soffice.cfg/modules/swriter/toolbar/drawingobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/calloutshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/starshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/formtextobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/drawbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/drawtextobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/extrusionobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/alignmentbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/numobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/optimizetablebar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/tableobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/textobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/standardbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/symbolshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/formsfilterbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/fullscreenbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/graffilterbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/formdesign.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/toolbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/previewobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/moreformcontrols.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/insertbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/basicshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/mediaobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/graphicobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/fontworkshapetype.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/viewerbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/arrowshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/flowchartshapes.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/insertobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/frameobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/formcontrols.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/formsnavigationbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/colorbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/oleobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/fontworkobjectbar.xml
-../share/config/soffice.cfg/modules/swriter/toolbar/bezierobjectbar.xml
-%userinst%/user/registry/cache/org.openoffice.Office.Addons.dat
-%userinst%/user/registry/cache/org.openoffice.Office.UI.Factories.dat
-../share/config/soffice.cfg/modules/swriter/menubar/menubar.xml
-%userinst%/user/registry/cache/org.openoffice.Office.UI.WriterCommands.dat
-%userinst%/user/registry/cache/org.openoffice.Office.UI.GenericCommands.dat
-%userinst%/user/registry/cache/org.openoffice.Office.UI.Controller.dat
-%userinst%/user/registry/cache/org.openoffice.Office.UI.WriterWindowState.dat
-%userinst%/user/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
-../share/registry/schema/org/openoffice/Office/UI/WindowState.xcs
-# %userinst%/user/config/imagecache/res_commandimagelist_lc_enUS514industrial
-# %userinst%/user/config/imagecache/res_commandimagelist_lc_enUS116industrial
-# %userinst%/user/config/imagecache/svt%ver%%lang%1592167industrial
-../share/config/soffice.cfg/modules/swriter/statusbar/statusbar.xml
-# %userinst%/user/config/imagecache/sfx%ver%%lang%03industrial
-# %userinst%/user/config/imagecache/sw%ver%%lang%15industrial
-# %userinst%/user/registry/cache/org.openoffice.Office.SFX.dat
-# %userinst%/user/config/imagecache/sfx%ver%%lang%2683industrial
-../share/psprint/driver
-%userinst%/user/psprint/driver
-../share/psprint/driver/SGENPRT.PS
-../share/psprint/psprint.conf
-../share/psprint
-%userinst%/user/psprint
-%userinst%/user/registry/cache/org.openoffice.LDAP.dat
-%userinst%/user/registry/cache/org.openoffice.UserProfile.dat
-%userinst%/user/registry/data/org/openoffice/UserProfile.xcu
-# %userinst%/user/config/imagecache/svt%ver%%lang%1592267industrial
-# %userinst%/user/config/imagecache/ooo%ver%%lang%1592215industrial
diff --git a/patches/test/pagein-idle.diff b/patches/test/pagein-idle.diff
deleted file mode 100644
index 8d43cee5c..000000000
--- a/patches/test/pagein-idle.diff
+++ /dev/null
@@ -1,469 +0,0 @@
-? desktop/source/pagein/bootstraprc
-? desktop/source/pagein/doflush
-? desktop/source/pagein/fillmem
-? desktop/source/pagein/fillmem.c
-? desktop/source/pagein/flushdisk
-? desktop/source/pagein/flushdisk.c
-Index: desktop/source/pagein/file_image.h
-===================================================================
-RCS file: /cvs/framework/desktop/source/pagein/file_image.h,v
-retrieving revision 1.2
-diff -u -r1.2 file_image.h
---- desktop/source/pagein/file_image.h 4 Jun 2003 10:43:03 -0000 1.2
-+++ desktop/source/pagein/file_image.h 27 Jul 2005 15:41:01 -0000
-@@ -83,6 +83,7 @@
-
- #define FILE_IMAGE_INITIALIZER { 0, 0 }
-
-+int file_image_setup_idle_load (void);
-
- /** file_image_open.
- */
-Index: desktop/source/pagein/file_image_unx.c
-===================================================================
-RCS file: /cvs/framework/desktop/source/pagein/file_image_unx.c,v
-retrieving revision 1.4
-diff -u -r1.4 file_image_unx.c
---- desktop/source/pagein/file_image_unx.c 4 Feb 2004 12:52:24 -0000 1.4
-+++ desktop/source/pagein/file_image_unx.c 27 Jul 2005 15:41:01 -0000
-@@ -74,8 +74,266 @@
-
- #include <sys/mman.h>
- #include <sys/stat.h>
--
-+#include <sys/types.h>
-+#include <stdio.h>
-+#include <stdlib.h>
- #include <string.h>
-+#include <dirent.h>
-+
-+#ifdef DEBUG
-+# define dprintf(a) fprintf a
-+#else
-+# define dprintf(a)
-+#endif
-+
-+static char *
-+get_user_installation (void)
-+{
-+ static char *installation = NULL;
-+ FILE *bootstraprc;
-+ const char *home;
-+ char *user_installation = NULL;
-+
-+ if (installation)
-+ return installation;
-+
-+ home = getenv ("HOME");
-+
-+ bootstraprc = fopen ("bootstraprc", "r");
-+ if (bootstraprc)
-+ {
-+ char buf[80];
-+ static const char *key = "UserInstallation=$SYSUSERCONFIG/";
-+ while (fgets (buf, sizeof (buf), bootstraprc))
-+ {
-+ if (!strncmp (buf, key, strlen (key)))
-+ {
-+ char *p;
-+ user_installation = strdup (buf + strlen (key));
-+ /* chomp */
-+ for (p = user_installation; *p != '\0'; p++)
-+ if (*p == '\r' || *p == '\n')
-+ break;
-+ *p = '\0';
-+ break;
-+ }
-+ }
-+ }
-+ else
-+ dprintf ((stderr, "Failed to open bootstraprc\n"));
-+
-+ if (!user_installation)
-+ {
-+ dprintf ((stderr, "using default path\n"));
-+ user_installation = strdup (".ooo-2.0");
-+ }
-+
-+ installation = malloc (strlen (home) + 1 + strlen (user_installation) + 1);
-+ strcpy (installation, home);
-+ strcat (installation, "/");
-+ strcat (installation, user_installation);
-+ free (user_installation);
-+
-+ return installation;
-+}
-+
-+static char *
-+collate (char **split)
-+{
-+ int i;
-+ int offs;
-+ char *res;
-+ for (offs = i = 0; split[i]; i++)
-+ offs += strlen (split[i]);
-+ res = malloc (offs + 1);
-+ for (offs = i = 0; split[i]; i++)
-+ {
-+ int len = strlen (split[i]);
-+ memcpy (res + offs, split[i], len);
-+ offs += len;
-+ }
-+ res[offs] = '\0';
-+ return res;
-+}
-+
-+static char *
-+do_strndup (const char *str, int len)
-+{
-+ int i;
-+ char *res = malloc (len + 1);
-+ for (i = 0; str[i] && i < len; i++)
-+ res[i] = str[i];
-+ res[i] = '\0';
-+ return res;
-+}
-+
-+static char **
-+split_filename (const char *filename)
-+{
-+ int i, j, last_fragment;
-+ char **split;
-+
-+ split = malloc (sizeof (char *) * strlen (filename) + 1);
-+ for (last_fragment = j = i = 0; filename [i] != '\0'; i++)
-+ {
-+ if (filename[i] == '%')
-+ {
-+ split[j++] = do_strndup (filename + last_fragment, i - last_fragment);
-+ last_fragment = i + 1;
-+ }
-+ }
-+ split[j] = do_strndup (filename + last_fragment, i - last_fragment);
-+ split[j+1] = NULL;
-+ return split;
-+}
-+
-+static char *
-+try_lang (char **split, int idx, char *lang)
-+{
-+ char *path;
-+ struct stat st;
-+
-+ free (split[idx]);
-+ split[idx] = strdup (lang);
-+ path = collate (split);
-+ dprintf ((stderr, "Try '%s' - path ", path));
-+ if (access (path, R_OK))
-+ {
-+ free (path);
-+ path = NULL;
-+ }
-+ else
-+ free (lang); /* sucky but ... */
-+ dprintf ((stderr, "there: %d\n", path != NULL));
-+ return path;
-+}
-+
-+const char *en_fallbacks[] = { "US", NULL };
-+const char *es_fallbacks[] = { "ES", NULL };
-+
-+const struct {
-+ const char *base;
-+ const char **fallback_locales;
-+} fallbacks[] =
-+{
-+ { "en", en_fallbacks },
-+ { "es", es_fallbacks },
-+ { NULL, NULL }
-+};
-+
-+/*
-+ * This is really crude, to do this correctly is really
-+ * tough, a maintenance nightmare etc. Hopefully we can do
-+ * quite well without much effort though & just seek for
-+ * the rest.
-+ */
-+static char *
-+guess_lang (char **split, int idx)
-+{
-+ int i;
-+ char *lang = strdup (getenv ("LANG"));
-+ char *p, *ret;
-+ char *locale = NULL;
-+ char *scratch;
-+
-+ scratch = malloc (strlen(lang) + 2);
-+
-+ if ((p = strchr (lang, '.')))
-+ *p = '\0';
-+
-+ /* hopefully now of the form 'fr_FR' or 'fr' */
-+ if ((locale = strchr (lang, '_')) ||
-+ (locale = strchr (lang, '-')))
-+ *locale++ = '\0';
-+
-+ dprintf ((stderr, "i18n: '%s'-'%s'\n", lang, locale));
-+
-+ /* Try with fr-FR */
-+ if (locale)
-+ {
-+ strcpy (scratch, lang);
-+ strcat (scratch, "-");
-+ strcat (scratch, locale);
-+ if ((ret = try_lang (split, idx, scratch)))
-+ return ret;
-+ }
-+
-+ /* Try with fr */
-+ strcpy (scratch, lang);
-+ if ((ret = try_lang (split, idx, scratch)))
-+ return ret;
-+
-+ /* Try other prefixes */
-+ strcat (scratch, "-");
-+ locale = scratch + strlen(scratch);
-+ for (i = 0; fallbacks[i].base; i++)
-+ {
-+ if (!strcmp (lang, fallbacks[i].base))
-+ {
-+ int j;
-+ for (j = 0; fallbacks[i].fallback_locales[j]; j++)
-+ {
-+ strcpy (locale, fallbacks[i].fallback_locales[j]);
-+ if ((ret = try_lang (split, idx, scratch)))
-+ return ret;
-+ }
-+ }
-+ }
-+
-+ return NULL;
-+}
-+
-+static char *
-+expand_filename (const char *filename)
-+{
-+ char *tilde;
-+ char *ver;
-+ char *ret = NULL;
-+ int i;
-+ int lang_idx = -1;
-+
-+ char **split = split_filename (filename);
-+
-+ for (i = 1; split[i]; i += 2 )
-+ {
-+ if (!strcmp (split[i], "userinst"))
-+ {
-+ free (split[i]);
-+ split[i] = strdup (get_user_installation());
-+ }
-+ else if (!strcmp (split[i], "ver"))
-+ {
-+ free (split[i]);
-+ split[i] = strdup ("680"); /* hard-coded - sigh */
-+ }
-+ else if (!strcmp (split[i], "lang"))
-+ {
-+ free (split[i]); /* handle later */
-+ split[i] = NULL;
-+ lang_idx = i;
-+ }
-+ else
-+ dprintf ((stderr, "Warning: Unknown control name '%s'\n", split[i]));
-+ }
-+
-+ if (lang_idx >= 0)
-+ {
-+ if (!(ret = guess_lang (split, lang_idx)))
-+ {
-+ dprintf ((stderr, "Failed to find lang dicts\n"));
-+ goto cleanup;
-+ }
-+ }
-+
-+ if (!ret)
-+ ret = collate (split);
-+ cleanup:
-+ for (i = 0; split[i]; i++)
-+ free (split[i]);
-+ free (split);
-+
-+ return ret;
-+}
-
- /*
- * file_image_open
-@@ -86,14 +344,25 @@
- int fd;
- struct stat st;
- void * p;
-+ char *fname;
-
- if (image == 0)
- return (EINVAL);
-
-+ fname = expand_filename (filename);
-+ if (!fname)
-+ fprintf (stderr, "Failed to expand '%s'\n", filename);
-+ else
-+ dprintf ((stderr, "Expanded '%s' to '%s'\n", filename, fname));
-+
- image->m_base = MAP_FAILED, image->m_size = 0;
-
-- if ((fd = open (filename, O_RDONLY)) == -1)
-+ if ((fd = open (fname, O_RDONLY)) == -1)
-+ {
-+ free (fname);
- return (errno);
-+ }
-+ free (fname);
-
- if (fstat (fd, &st) == -1)
- {
-@@ -101,6 +370,14 @@
- goto cleanup_and_leave;
- }
-
-+ if (S_ISDIR (st.st_mode))
-+ {
-+ DIR *dirent = opendir (fname);
-+ dprintf ((stderr, "Read directory '%s'\n", fname));
-+ while (dirent && readdir (dirent));
-+ goto cleanup_and_leave;
-+ }
-+
- p = mmap (0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (p == MAP_FAILED)
- {
-@@ -143,7 +420,6 @@
- #endif
- }
-
--
- #ifndef MACOSX
- if ((s = sysconf (_SC_PAGESIZE)) == -1)
- s = 0x1000;
-@@ -182,3 +458,70 @@
- image->m_base = 0, image->m_size = 0;
- return (0);
- }
-+
-+/*
-+ * Highly Linux specific - and functions only with
-+ * recent CFQ & linux >= 2.6.12
-+ * http://www.ibiblio.org/peanut/Kernel-2.6.12/block/ioprio.txt
-+ */
-+#if defined(LINUX)
-+
-+#include <getopt.h>
-+#include <sys/ptrace.h>
-+#include <asm/unistd.h>
-+
-+/* Syscall-numbers - nice ... */
-+#if defined(__i386__)
-+#define __NR_ioprio_set 289
-+#elif defined(__ppc__)
-+#define __NR_ioprio_set 273
-+#elif defined(__x86_64__)
-+#define __NR_ioprio_set 251
-+#elif defined(__ia64__)
-+#define __NR_ioprio_set 1274
-+#else
-+#error "Unsupported arch"
-+#endif
-+
-+extern int sys_ioprio_set(int, int, int);
-+_syscall3(int, ioprio_set, int, which, int, who, int, ioprio);
-+
-+enum {
-+ IOPRIO_CLASS_NONE,
-+ IOPRIO_CLASS_RT,
-+ IOPRIO_CLASS_BE,
-+ IOPRIO_CLASS_IDLE,
-+};
-+
-+enum {
-+ IOPRIO_WHO_PROCESS = 1,
-+ IOPRIO_WHO_PGRP,
-+ IOPRIO_WHO_USER,
-+};
-+
-+#define IOPRIO_CLASS_SHIFT 13
-+
-+#endif
-+
-+/*
-+ * Ideally this idle loading would synchronise occasionally
-+ * with soffice.bin to ensure we don't:
-+ * read (pagein) / evict / re-read (soffice.bin)
-+ * giving worse performance than before. Most modern machines
-+ * have loads of RAM anyway, so should improve things. Ideally
-+ * soffice.bin will catch up with pagein's I/O.
-+ */
-+int file_image_setup_idle_load (void)
-+{
-+#if !defined(LINUX)
-+ return 1;
-+#else
-+ int ioprio = 7;
-+ int ioprio_class = IOPRIO_CLASS_IDLE;
-+
-+ if (ioprio_set (IOPRIO_WHO_PROCESS, 0,
-+ ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1)
-+ return 0; // testing ... 1;
-+ return 0;
-+#endif
-+}
-Index: desktop/source/pagein/pagein.c
-===================================================================
-RCS file: /cvs/framework/desktop/source/pagein/pagein.c,v
-retrieving revision 1.2
-diff -u -r1.2 pagein.c
---- desktop/source/pagein/pagein.c 4 Jun 2003 10:43:30 -0000 1.2
-+++ desktop/source/pagein/pagein.c 27 Jul 2005 15:41:01 -0000
-@@ -61,6 +61,7 @@
-
- #include "file_image.h"
-
-+#include <stdlib.h>
- #include <unistd.h>
- #include <errno.h>
- #include <stdio.h>
-@@ -88,6 +89,7 @@
-
- cleanup_and_leave:
- file_image_close (&image);
-+
- return (result);
- }
-
-@@ -101,7 +103,7 @@
- {
- fprintf (
- stderr,
-- "%s: Usage: pagein [-v[v]] [-L<path>] [@]<filename> ...\n",
-+ "%s: Usage: pagein [-i] [-v[v]] [-L<path>] [@]<filename> ...\n",
- argv[0]);
- return (1);
- }
-@@ -122,6 +124,10 @@
- for (v += 1, j += 1; argv[i][j]; j++)
- v += (argv[i][j] == 'v');
- break;
-+ case 'i':
-+ if (file_image_setup_idle_load())
-+ exit (0);
-+ break;
- case 'L':
- /* search path */
- if (chdir (&(argv[i][2])) == -1)
-@@ -147,6 +153,8 @@
- }
- while (fgets (path, sizeof(path), fp) != 0)
- {
-+ if (path[0] == '#')
-+ continue;
- path[strlen(path) - 1] = '\0', k = 0;
- if (do_pagein (path, &k) == 0)
- {
diff --git a/patches/test/psprint-enable-artificial-ItalicBold-printing.diff b/patches/test/psprint-enable-artificial-ItalicBold-printing.diff
deleted file mode 100644
index 0e3ea6308..000000000
--- a/patches/test/psprint-enable-artificial-ItalicBold-printing.diff
+++ /dev/null
@@ -1,62 +0,0 @@
---- psprintBoldItalicPatch/inc/psprint/fontmanager.hxx 2005-08-24 15:07:47.287701000 +0100
-+++ psprint/inc/psprint/fontmanager.hxx 2005-08-24 16:30:39.737278761 +0100
-@@ -395,6 +395,7 @@
- std::hash_map< fontID, PrintFont* > m_aFonts;
- std::hash_map< int, family::type > m_aFamilyTypes;
- std::hash_map< int, int > m_aFamilyStyles;
-+ std::list< fontID > m_aArtificialFonts;
- std::list< rtl::OUString > m_aPrinterDrivers;
- std::list< rtl::OString > m_aFontDirectories;
- std::list< int > m_aPrivateFontDirectories;
-@@ -497,6 +498,21 @@
- // get the font list and fast font info. see getFontList for pParser
- void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser = NULL ) const;
-
-+ // true if the font is an artificial one
-+ bool isArtificial( fontID nFontID )
-+ {
-+ bool result = false;
-+ ::std::list<int>::const_iterator it = m_aArtificialFonts.begin();
-+ for ( ; it != m_aArtificialFonts.end(); ++it )
-+ {
-+ if ( *it == nFontID )
-+ {
-+ result = true;;
-+ break;
-+ }
-+ }
-+ return result;
-+ }
- // get font info for a specific font
- bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
- // get fast font info for a specific font
---- psprintBoldItalicPatch/source/printergfx/text_gfx.cxx 2005-08-25 09:43:37.959840156 +0100
-+++ psprint/source/printergfx/text_gfx.cxx 2005-08-24 16:41:48.354072375 +0100
-@@ -193,6 +193,9 @@
- mnTextAngle = nAngle;
- mbTextVertical = bVertical;
-
-+ bool fontIsArtificial = mrFontMgr.isArtificial(mnFontID );
-+ maVirtualStatus.mbArtItalic = ( fontIsArtificial && ( mrFontMgr.getFontItalic(mnFontID) == italic::Italic ) );
-+ maVirtualStatus.mbArtBold = ( fontIsArtificial && ( mrFontMgr.getFontWeight(mnFontID) >= weight::Medium ) );
- return 0;
- }
-
---- psprintBoldItalicPatch/source/fontmanager/fontmanager.cxx 2005-08-24 15:38:14.320780000 +0100
-+++ psprint/source/fontmanager/fontmanager.cxx 2005-08-24 16:29:40.876864139 +0100
-@@ -246,6 +246,7 @@
- else if( (result)->m_eType == fonttype::Builtin )
- m_aFontFileToFontID[ static_cast<BuiltinFont*>(result)->m_aMetricFile ].insert( aFont );
- m_aFonts[ aFont ] = result;
-+ m_aArtificialFonts.push_back(aFont);
- // track what family's have what styles {italic, bold,
- // italic-bold }
- updateFamilyStyles( result);
-@@ -2222,6 +2223,7 @@
- m_aFontDirectories.clear();
- m_aPrivateFontDirectories.clear();
- m_aFamilyStyles.clear();
-+ m_aArtificialFonts.clear();
- }
-
- #if OSL_DEBUG_LEVEL > 1
diff --git a/patches/test/quick-diagramming.diff b/patches/test/quick-diagramming.diff
deleted file mode 100644
index d42f11ef0..000000000
--- a/patches/test/quick-diagramming.diff
+++ /dev/null
@@ -1,10445 +0,0 @@
-All the smartart work, including UI
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- oox/inc/oox/core/filterbase.hxx | 5
- oox/inc/oox/core/xmlfilterbase.hxx | 45 +
- oox/inc/oox/drawingml/chart/converterbase.hxx | 2
- oox/inc/oox/drawingml/customshapeproperties.hxx | 5
- oox/inc/oox/drawingml/diagram/datamodelcontext.hxx | 57 -
- oox/inc/oox/drawingml/diagram/diagram.hxx | 242 +-----
- .../drawingml/diagram/diagramfragmenthandler.hxx | 103 --
- .../oox/drawingml/diagram/diagramlayoutatoms.hxx | 212 -----
- oox/inc/oox/drawingml/drawingmltypes.hxx | 3
- oox/inc/oox/drawingml/graphicshapecontext.hxx | 5
- oox/inc/oox/drawingml/shape.hxx | 28 +
- oox/inc/oox/drawingml/theme.hxx | 8
- oox/inc/oox/ppt/dgmimport.hxx | 68 ++
- oox/inc/oox/ppt/dgmlayout.hxx | 69 ++
- oox/inc/oox/ppt/pptimport.hxx | 2
- oox/inc/oox/xls/excelfilter.hxx | 2
- oox/inc/oox/xls/workbookhelper.hxx | 2
- oox/source/core/facreg.cxx | 6
- oox/source/core/filterbase.cxx | 17
- oox/source/core/xmlfilterbase.cxx | 164 +++-
- oox/source/drawingml/chart/chartspaceconverter.cxx | 5
- oox/source/drawingml/chart/converterbase.cxx | 4
- oox/source/drawingml/chart/datasourceconverter.cxx | 12
- oox/source/drawingml/clrscheme.cxx | 2
- oox/source/drawingml/color.cxx | 4
- oox/source/drawingml/customshapegeometry.cxx | 6
- .../drawingml/diagram/constraintlistcontext.cxx | 102 ++
- .../drawingml/diagram/constraintlistcontext.hxx | 54 +
- oox/source/drawingml/diagram/datamodelcontext.cxx | 234 ++++--
- oox/source/drawingml/diagram/datamodelcontext.hxx | 57 +
- oox/source/drawingml/diagram/diagram.cxx | 503 ++++++++++--
- oox/source/drawingml/diagram/diagram.hxx | 320 ++++++++
- .../drawingml/diagram/diagramdefinitioncontext.cxx | 15
- .../drawingml/diagram/diagramdefinitioncontext.hxx | 2
- .../drawingml/diagram/diagramfragmenthandler.cxx | 188 +++--
- .../drawingml/diagram/diagramfragmenthandler.hxx | 117 +++
- .../drawingml/diagram/diagramlayoutatoms.cxx | 834 +++++++++++++++++++-
- .../drawingml/diagram/diagramlayoutatoms.hxx | 318 ++++++++
- oox/source/drawingml/diagram/layoutnodecontext.cxx | 146 ++--
- oox/source/drawingml/diagram/layoutnodecontext.hxx | 3
- oox/source/drawingml/diagram/makefile.mk | 1
- oox/source/drawingml/drawingmltypes.cxx | 4
- oox/source/drawingml/fillproperties.cxx | 3
- oox/source/drawingml/graphicshapecontext.cxx | 61 -
- oox/source/drawingml/lineproperties.cxx | 6
- oox/source/drawingml/shape.cxx | 73 ++
- oox/source/drawingml/shapepropertiescontext.cxx | 5
- oox/source/drawingml/textparagraph.cxx | 9
- oox/source/drawingml/textparagraphproperties.cxx | 1
- oox/source/helper/storagebase.cxx | 20
- oox/source/ppt/dgmimport.cxx | 124 +++
- oox/source/ppt/dgmlayout.cxx | 183 ++++
- oox/source/ppt/makefile.mk | 2
- oox/source/ppt/pptimport.cxx | 4
- oox/source/ppt/presentationfragmenthandler.cxx | 22 +
- oox/source/shape/ShapeFilterBase.cxx | 4
- oox/source/shape/ShapeFilterBase.hxx | 2
- oox/source/token/makefile.mk | 11
- oox/source/xls/excelfilter.cxx | 2
- oox/source/xls/workbookhelper.cxx | 4
- sc/source/filter/excel/xestream.cxx | 5
- sc/source/filter/inc/xestream.hxx | 2
- sd/inc/glob.hrc | 1
- sd/inc/helpids.h | 1
- sd/inc/sdpage.hxx | 14
- sd/prj/build.lst | 3
- sd/source/core/sdpage2.cxx | 10
- sd/source/filter/pptx/epptooxml.hxx | 2
- sd/source/filter/pptx/pptx-epptooxml.cxx | 4
- sd/source/filter/xml/sdxmlwrp.cxx | 31 +
- .../ui/animations/CustomAnimationCreateDialog.cxx | 6
- sd/source/ui/animations/motionpathtag.cxx | 5
- sd/source/ui/animations/motionpathtag.hxx | 4
- sd/source/ui/app/strings.src | 6
- sd/source/ui/diagram/DiagramDesignPane.cxx | 685 ++++++++++++++++
- sd/source/ui/diagram/DiagramDesignPane.hrc | 56 +
- sd/source/ui/diagram/DiagramDesignPane.hxx | 131 +++
- sd/source/ui/diagram/DiagramDesignPane.src | 173 ++++
- sd/source/ui/diagram/diagramtag.cxx | 671 ++++++++++++++++
- sd/source/ui/diagram/diagramtag.hxx | 94 ++
- sd/source/ui/diagram/makefile.mk | 59 +
- sd/source/ui/framework/tools/FrameworkHelper.cxx | 2
- sd/source/ui/func/smarttag.cxx | 39 +
- sd/source/ui/inc/TaskPaneViewShell.hxx | 1
- sd/source/ui/inc/framework/FrameworkHelper.hxx | 1
- sd/source/ui/inc/smarttag.hxx | 15
- sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 17
- .../ui/toolpanel/controls/DiagramDesignPanel.cxx | 104 ++
- .../ui/toolpanel/controls/DiagramDesignPanel.hxx | 78 ++
- sd/source/ui/toolpanel/controls/makefile.mk | 1
- sd/source/ui/unoidl/unopage.cxx | 18
- sd/source/ui/view/drviewse.cxx | 5
- sd/source/ui/view/viewshel.cxx | 14
- sd/util/makefile.mk | 2
- svx/inc/svdstr.hrc | 5
- .../overlay/overlayprimitive2dsequenceobject.hxx | 2
- svx/inc/svx/svdobj.hxx | 1
- svx/inc/svx/svdodiagram.hxx | 118 +++
- svx/inc/svx/unoprov.hxx | 3
- svx/inc/svx/unoshape.hxx | 24 +
- svx/inc/svx/unoshprp.hxx | 6
- svx/prj/d.lst | 2
- svx/source/svdraw/makefile.mk | 1
- svx/source/svdraw/svdobj.cxx | 2
- svx/source/svdraw/svdodiagram.cxx | 309 +++++++
- svx/source/svdraw/svdstr.src | 9
- svx/source/unodraw/unopage.cxx | 3
- svx/source/unodraw/unoprov.cxx | 26 +
- svx/source/unodraw/unoshap2.cxx | 7
- svx/source/unodraw/unoshape.cxx | 113 +++
- svx/source/unodraw/unoshtxt.cxx | 48 +
- xmloff/inc/xmlnmspe.hxx | 1
- xmloff/inc/xmloff/shapeexport.hxx | 2
- xmloff/inc/xmloff/xmlexp.hxx | 4
- xmloff/inc/xmloff/xmlimp.hxx | 9
- xmloff/inc/xmloff/xmltoken.hxx | 9
- xmloff/source/core/xmlexp.cxx | 79 ++
- xmloff/source/core/xmlimp.cxx | 51 +
- xmloff/source/core/xmltoken.cxx | 8
- xmloff/source/draw/sdxmlexp.cxx | 15
- xmloff/source/draw/sdxmlimp.cxx | 6
- xmloff/source/draw/sdxmlimp_impl.hxx | 3
- xmloff/source/draw/shapeexport.cxx | 10
- xmloff/source/draw/shapeexport2.cxx | 56 +
- xmloff/source/draw/shapeexport4.cxx | 25 -
- xmloff/source/draw/ximpgrp.cxx | 39 +
- xmloff/source/draw/ximpshap.cxx | 18
- xmloff/source/draw/ximpstyl.cxx | 7
- 128 files changed, 6691 insertions(+), 1102 deletions(-)
- delete mode 100644 oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
- delete mode 100644 oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
- delete mode 100644 oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
- create mode 100644 oox/inc/oox/ppt/dgmimport.hxx
- create mode 100644 oox/inc/oox/ppt/dgmlayout.hxx
- create mode 100644 oox/source/drawingml/diagram/constraintlistcontext.cxx
- create mode 100644 oox/source/drawingml/diagram/constraintlistcontext.hxx
- create mode 100644 oox/source/drawingml/diagram/datamodelcontext.hxx
- create mode 100644 oox/source/drawingml/diagram/diagram.hxx
- create mode 100644 oox/source/drawingml/diagram/diagramfragmenthandler.hxx
- create mode 100644 oox/source/drawingml/diagram/diagramlayoutatoms.hxx
- create mode 100644 oox/source/ppt/dgmimport.cxx
- create mode 100644 oox/source/ppt/dgmlayout.cxx
- create mode 100644 sd/source/ui/diagram/DiagramDesignPane.cxx
- create mode 100644 sd/source/ui/diagram/DiagramDesignPane.hrc
- create mode 100644 sd/source/ui/diagram/DiagramDesignPane.hxx
- create mode 100644 sd/source/ui/diagram/DiagramDesignPane.src
- create mode 100644 sd/source/ui/diagram/diagramtag.cxx
- create mode 100644 sd/source/ui/diagram/diagramtag.hxx
- create mode 100644 sd/source/ui/diagram/makefile.mk
- create mode 100644 sd/source/ui/toolpanel/controls/DiagramDesignPanel.cxx
- create mode 100644 sd/source/ui/toolpanel/controls/DiagramDesignPanel.hxx
- create mode 100644 svx/inc/svx/svdodiagram.hxx
- create mode 100644 svx/source/svdraw/svdodiagram.cxx
-
-
-diff --git oox/inc/oox/core/filterbase.hxx oox/inc/oox/core/filterbase.hxx
-index 445123f..d9ac5ed 100644
---- oox/inc/oox/core/filterbase.hxx
-+++ oox/inc/oox/core/filterbase.hxx
-@@ -50,6 +50,7 @@ namespace com { namespace sun { namespace star {
- namespace frame { class XModel; }
- namespace task { class XStatusIndicator; }
- namespace task { class XInteractionHandler; }
-+ namespace drawing { class XShape; }
- namespace io { class XInputStream; }
- namespace io { class XOutputStream; }
- namespace io { class XStream; }
-@@ -100,6 +101,10 @@ public:
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
- getModel() const;
-
-+ /// Returns the parent shape to load into (if any)
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
-+ getParentShape() const;
-+
- /** Returns the status indicator. */
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
- getStatusIndicator() const;
-diff --git oox/inc/oox/core/xmlfilterbase.hxx oox/inc/oox/core/xmlfilterbase.hxx
-index 1f4edc3..afb8723 100644
---- oox/inc/oox/core/xmlfilterbase.hxx
-+++ oox/inc/oox/core/xmlfilterbase.hxx
-@@ -45,6 +45,8 @@ namespace com { namespace sun { namespace star {
- namespace document { class XDocumentProperties; }
- namespace xml { namespace sax { class XLocator; } }
- namespace xml { namespace sax { class XFastDocumentHandler; } }
-+ namespace xml { namespace dom { class XDocument; } }
-+ namespace xml { namespace sax { class XFastSAXSerializable; } }
- } } }
-
- namespace oox { namespace drawingml { class Theme; } }
-@@ -81,17 +83,19 @@ public:
- /** Has to be implemented by each filter to resolve scheme colors. */
- virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const = 0;
-
-- /** Has to be implemented by each filter to return drawings collection. */
-+ /** Has to be implemented by each filter to return the table style list. */
-+ virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
-+
-+ // ------------------------------------------------------------------------
-+
-+ /** Override to return drawings collection. */
- virtual const ::oox::vml::DrawingPtr
-- getDrawings() = 0;
-+ getDrawings();
-
-- /** Has to be implemented by each filter, returns a filter-specific chart
-+ /** Override to return a filter-specific chart
- converter object, that should be global per imported document. */
-- virtual ::oox::drawingml::chart::ChartConverter&
-- getChartConverter() = 0;
--
-- /** Has to be implemented by each filter to return the table style list. */
-- virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
-+ virtual ::oox::drawingml::chart::ChartConverter*
-+ getChartConverter();
-
- // ------------------------------------------------------------------------
-
-@@ -106,6 +110,31 @@ public:
- */
- bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
-
-+ /** Imports a fragment into an xml::dom::XDocument.
-+
-+ @param rFragmentPath path to fragment
-+
-+ @return a non-empty reference to the XDocument, if the
-+ fragment could be imported.
-+ */
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> importFragment( const ::rtl::OUString& rFragmentPath );
-+
-+ /** Imports a fragment from an xml::dom::XDocument using the
-+ passed fragment handler
-+
-+ @param rxHandler fragment handler; path to fragment is
-+ ignored, input source is the rxSerializer
-+
-+ @param rxSerializer usually retrieved from a
-+ xml::dom::XDocument, will get serialized into rxHandler
-+
-+ @return true, if the fragment could be imported.
-+ */
-+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
-+
- /** Imports the relations fragment associated with the specified fragment.
-
- @return The relations collection of the specified fragment.
-diff --git oox/inc/oox/drawingml/chart/converterbase.hxx oox/inc/oox/drawingml/chart/converterbase.hxx
-index f456d95..35fa990 100644
---- oox/inc/oox/drawingml/chart/converterbase.hxx
-+++ oox/inc/oox/drawingml/chart/converterbase.hxx
-@@ -79,7 +79,7 @@ protected:
- /** Returns the filter object of the imported/exported document. */
- ::oox::core::XmlFilterBase& getFilter() const;
- /** Returns the chart converter. */
-- ChartConverter& getChartConverter() const;
-+ ChartConverter* getChartConverter() const;
- /** Returns the API chart document model. */
- ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
- getChartDocument() const;
-diff --git oox/inc/oox/drawingml/customshapeproperties.hxx oox/inc/oox/drawingml/customshapeproperties.hxx
-index 55faac8..cb7cca0 100644
---- oox/inc/oox/drawingml/customshapeproperties.hxx
-+++ oox/inc/oox/drawingml/customshapeproperties.hxx
-@@ -77,8 +77,9 @@ public:
- const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
- const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const;
-
-- void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; };
-- std::vector< CustomShapeGuide >& getAdjustmentValues(){ return maAdjustmentValues; };
-+ void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; }
-+ const rtl::OUString& getShapePresetType() const { return maShapePresetType; }
-+ std::vector< CustomShapeGuide >& getAdjustmentValues(){ return maAdjustmentValues; }
-
- double getValue( const std::vector< CustomShapeGuide >&, sal_uInt32 nIndex ) const;
- ::basegfx::B2DPolyPolygon& getPolygon() { return maPolygon; }
-diff --git oox/inc/oox/drawingml/diagram/datamodelcontext.hxx oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
-deleted file mode 100644
-index 9cbeb96..0000000
---- oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
-+++ /dev/null
-@@ -1,57 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: datamodelcontext.hxx,v $
-- * $Revision: 1.4 $
-- *
-- * 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 OOX_DRAWINGML_SHAPECONTEXT_HXX
--#define OOX_DRAWINGML_SHAPECONTEXT_HXX
--
--#include <com/sun/star/drawing/XShapes.hpp>
--
--#include "oox/core/contexthandler.hxx"
--#include "oox/drawingml/diagram/diagram.hxx"
--
--namespace oox { namespace drawingml {
--
--// CT_DataModel
--class DataModelContext : public ::oox::core::ContextHandler
--{
--public:
-- DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
-- virtual ~DataModelContext();
--
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
--
--protected:
-- DiagramDataPtr mpDataModel;
--};
--
--} }
--
--#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
-diff --git oox/inc/oox/drawingml/diagram/diagram.hxx oox/inc/oox/drawingml/diagram/diagram.hxx
-index b1c2ddd..732959b 100644
---- oox/inc/oox/drawingml/diagram/diagram.hxx
-+++ oox/inc/oox/drawingml/diagram/diagram.hxx
-@@ -28,232 +28,40 @@
- *
- ************************************************************************/
-
--
--
- #ifndef OOX_DRAWINGML_DIAGRAM_HXX
- #define OOX_DRAWINGML_DIAGRAM_HXX
-
--#include <vector>
--#include <boost/shared_ptr.hpp>
--#include <boost/enable_shared_from_this.hpp>
-+#include <rtl/ustring.hxx>
- #include "oox/drawingml/shape.hxx"
--#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
--
--namespace oox { namespace drawingml {
--
--namespace dgm {
-+#include "oox/core/xmlfilterbase.hxx"
-
--/** A Connection
-- */
--class Connection
--{
--public:
-- Connection()
-- : mnType( 0 )
-- , mnSourceOrder( 0 )
-- , mnDestOrder( 0 )
-- {
-- }
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-
-- void dump();
--
-- sal_Int32 mnType;
-- ::rtl::OUString msModelId;
-- ::rtl::OUString msSourceId;
-- ::rtl::OUString msDestId;
-- ::rtl::OUString msParTransId;
-- ::rtl::OUString msPresId;
-- ::rtl::OUString msSibTransId;
-- sal_Int32 mnSourceOrder;
-- sal_Int32 mnDestOrder;
--
--};
--
--typedef boost::shared_ptr< Connection > ConnectionPtr;
--typedef std::vector< ConnectionPtr > Connections;
-+namespace oox { namespace drawingml {
-
--class Point;
-+/** load diagram data, and put resulting graphic into shape
-
--typedef boost::shared_ptr< Point > PointPtr;
--typedef std::vector< PointPtr > Points;
--/** A point
-+ This method loads the diagram data fragments from the given paths,
-+ generate and layout the shapes, and push it as children into the
-+ referenced shape.
- */
--class Point
--{
--public:
-- Point();
-- ShapePtr & getShape( )
-- { return mpShape; }
--
-- void setCnxId( const ::rtl::OUString & sCnxId )
-- { msCnxId = sCnxId; }
-- void setModelId( const ::rtl::OUString & sModelId );
-- const ::rtl::OUString & getModelId() const
-- { return msModelId; }
-- void setType( const sal_Int32 nType )
-- { mnType = nType; }
-- sal_Int32 getType() const
-- { return mnType; }
--
-- void dump();
--private:
-- ShapePtr mpShape;
-- ::rtl::OUString msCnxId;
-- ::rtl::OUString msModelId;
-- sal_Int32 mnType;
--};
--
--
--class PointsTree;
--typedef boost::shared_ptr< PointsTree > PointsTreePtr;
--
--/** a points tree node */
--class PointsTree
-- : public boost::enable_shared_from_this< PointsTree >
--{
--public:
-- typedef std::vector< PointsTreePtr > Childrens;
-- PointsTree()
-- {};
-- PointsTree( const PointPtr & pPoint )
-- : mpNode( pPoint )
-- { }
-- bool addChild( const PointsTreePtr & pChild );
-- const PointPtr & getPoint() const
-- { return mpNode; }
-- PointsTreePtr getParent() const;
-- Childrens::const_iterator beginChild() const
-- { return maChildrens.begin(); }
-- Childrens::const_iterator endChild() const
-- { return maChildrens.end(); }
--private:
-- PointPtr mpNode;
-- boost::weak_ptr< PointsTree > mpParent;
-- Childrens maChildrens;
--};
--
--}
--
--////////////////////
--
--class DiagramData
--{
--public:
--
-- DiagramData();
-- FillPropertiesPtr & getFillProperties()
-- { return mpFillProperties; }
-- dgm::Connections & getConnections()
-- { return maConnections; }
-- dgm::Points & getPoints()
-- { return maPoints; }
-- void dump();
--private:
-- FillPropertiesPtr mpFillProperties;
-- dgm::Connections maConnections;
-- dgm::Points maPoints;
--};
--
--typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
--
--
--
--////////////////////
--
--class DiagramLayout
--{
--public:
-- void setDefStyle( const ::rtl::OUString & sDefStyle )
-- { msDefStyle = sDefStyle; }
-- void setMinVer( const ::rtl::OUString & sMinVer )
-- { msMinVer = sMinVer; }
-- void setUniqueId( const ::rtl::OUString & sUniqueId )
-- { msUniqueId = sUniqueId; }
-- const ::rtl::OUString & getUniqueId()
-- { return msUniqueId; }
-- void setTitle( const ::rtl::OUString & sTitle )
-- { msTitle = sTitle; }
-- void setDesc( const ::rtl::OUString & sDesc )
-- { msDesc = sDesc; }
--
-- LayoutNodePtr & getNode()
-- { return mpNode; }
-- const LayoutNodePtr & getNode() const
-- { return mpNode; }
-- DiagramDataPtr & getSampData()
-- { return mpSampData; }
-- const DiagramDataPtr & getSampData() const
-- { return mpSampData; }
-- DiagramDataPtr & getStyleData()
-- { return mpStyleData; }
-- const DiagramDataPtr & getStyleData() const
-- { return mpStyleData; }
--
-- void layout( const dgm::PointsTreePtr & pTree, const com::sun::star::awt::Point & pt );
--private:
-- ::rtl::OUString msDefStyle;
-- ::rtl::OUString msMinVer;
-- ::rtl::OUString msUniqueId;
--
-- ::rtl::OUString msTitle;
-- ::rtl::OUString msDesc;
-- LayoutNodePtr mpNode;
-- DiagramDataPtr mpSampData;
-- DiagramDataPtr mpStyleData;
-- // TODO
-- // catLst
-- // clrData
--};
--
--typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
--
--///////////////////////
--
--class DiagramQStyles
--{
--
--};
--
--typedef boost::shared_ptr< DiagramQStyles > DiagramQStylesPtr;
--
--///////////////////////
--
--class DiagramColors
--{
--
--};
--
--typedef boost::shared_ptr< DiagramColors > DiagramColorsPtr;
--
--///////////////////////
--
--class Diagram
--{
--public:
-- void setData( const DiagramDataPtr & );
-- void setLayout( const DiagramLayoutPtr & );
-- DiagramLayoutPtr getLayout() const
-- {
-- return mpLayout;
-- }
-- void setQStyles( const DiagramQStylesPtr & );
-- void setColors( const DiagramColorsPtr & );
--
-- void addTo( const ShapePtr & pShape );
-- ::rtl::OUString getLayoutId() const;
--private:
-- void build( );
-- DiagramDataPtr mpData;
-- DiagramLayoutPtr mpLayout;
-- DiagramQStylesPtr mpQStyles;
-- DiagramColorsPtr mpColors;
-- std::map< ::rtl::OUString, ShapePtr > maShapeMap;
-- dgm::PointsTreePtr mpRoot;
--};
--
--
--typedef boost::shared_ptr< Diagram > DiagramPtr;
--
-+void loadDiagram( const ShapePtr& pShape,
-+ core::XmlFilterBase& rFilter,
-+ const ::rtl::OUString& rDataModelPath,
-+ const ::rtl::OUString& rLayoutPath,
-+ const ::rtl::OUString& rQStylePath,
-+ const ::rtl::OUString& rColorStylePath );
-+
-+void loadDiagram( const ShapePtr& pShape,
-+ core::XmlFilterBase& rFilter,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
- } }
-
- #endif
-diff --git oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
-deleted file mode 100644
-index 278dfe5..0000000
---- oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
-+++ /dev/null
-@@ -1,103 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: diagramfragmenthandler.hxx,v $
-- * $Revision: 1.4 $
-- *
-- * 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 OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
--#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
--
--#include "oox/core/fragmenthandler.hxx"
--#include "oox/drawingml/diagram/diagram.hxx"
--
--namespace oox { namespace drawingml {
--
--
--class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
--{
--public:
-- DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
-- virtual ~DiagramDataFragmentHandler() throw();
--
-- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
--
--private:
--
-- DiagramDataPtr mpDataPtr;
--};
--
--
--
--class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
--{
--public:
-- DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
-- virtual ~DiagramLayoutFragmentHandler() throw();
--
-- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
--
--private:
--
-- DiagramLayoutPtr mpDataPtr;
--};
--
--class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler
--{
--public:
-- DiagramQStylesFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramQStylesPtr pDataPtr ) throw();
-- virtual ~DiagramQStylesFragmentHandler() throw();
--
-- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
--
--private:
--
-- DiagramQStylesPtr mpDataPtr;
--};
--
--
--class DiagramColorsFragmentHandler : public ::oox::core::FragmentHandler
--{
--public:
-- DiagramColorsFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramColorsPtr pDataPtr ) throw();
-- virtual ~DiagramColorsFragmentHandler() throw();
--
-- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
--
--private:
--
-- DiagramColorsPtr mpDataPtr;
--};
--
--} }
--
--
--#endif
-diff --git oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
-deleted file mode 100644
-index 80c2dcd..0000000
---- oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
-+++ /dev/null
-@@ -1,212 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: diagramlayoutatoms.hxx,v $
-- * $Revision: 1.3 $
-- *
-- * 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 OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
--#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
--
--#include <map>
--#include <string>
--
--#include <boost/shared_ptr.hpp>
--#include <boost/array.hpp>
--
--#include <com/sun/star/uno/Any.hxx>
--#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
--
--#include "oox/drawingml/shape.hxx"
--
--
--namespace oox { namespace drawingml {
--
--
--// AG_IteratorAttributes
--class IteratorAttr
--{
--public:
-- IteratorAttr();
--
-- // not sure this belong here, but wth
-- void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
--
--private:
-- sal_Int32 mnAxis;
-- sal_Int32 mnCnt;
-- sal_Bool mbHideLastTrans;
-- sal_Int32 mnPtType;
-- sal_Int32 mnSt;
-- sal_Int32 mnStep;
--};
--
--class ConditionAttr
--{
--public:
-- ConditionAttr();
--
-- // not sure this belong here, but wth
-- void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
--
--private:
-- sal_Int32 mnFunc;
-- sal_Int32 mnArg;
-- sal_Int32 mnOp;
-- ::rtl::OUString msVal;
--};
--
--class LayoutAtom;
--
--typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
--
--/** abstract Atom for the layout */
--class LayoutAtom
--{
--public:
-- virtual ~LayoutAtom()
-- {}
-- // TODO change signature to the proper one
-- virtual void processAtom() = 0;
-- void setName( const ::rtl::OUString & sName )
-- { msName = sName; }
-- void addChild( const LayoutAtomPtr & pNode )
-- { mpChildNodes.push_back( pNode ); }
--
-- // dump for debug
-- virtual void dump(int level = 0);
--protected:
-- std::vector< LayoutAtomPtr > mpChildNodes;
-- ::rtl::OUString msName;
--};
--
--class AlgAtom
-- : public LayoutAtom
--{
--public:
-- virtual ~AlgAtom()
-- {}
-- typedef std::map< std::string, ::com::sun::star::uno::Any > ParamMap;
--
-- virtual void processAtom()
-- {}
--private:
-- ParamMap mParams;
--};
--
--
--class ForEachAtom
-- : public LayoutAtom
--{
--public:
-- virtual ~ForEachAtom()
-- {}
--
-- IteratorAttr & iterator()
-- { return maIter; }
-- virtual void processAtom();
--private:
-- IteratorAttr maIter;
--};
--
--typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
--
--
--class ConditionAtom
-- : public LayoutAtom
--{
--public:
-- ConditionAtom( bool bElse = false )
-- : LayoutAtom( )
-- , mbElse( bElse )
-- {}
-- virtual ~ConditionAtom()
-- {}
-- bool test();
-- virtual void processAtom()
-- {}
-- IteratorAttr & iterator()
-- { return maIter; }
-- ConditionAttr & cond()
-- { return maCond; }
--private:
-- bool mbElse;
-- IteratorAttr maIter;
-- ConditionAttr maCond;
--};
--
--typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
--
--
--/** "choose" statements. Atoms will be tested in order. */
--class ChooseAtom
-- : public LayoutAtom
--{
--public:
-- virtual ~ChooseAtom()
-- {}
-- virtual void processAtom();
--};
--
--class LayoutNode
-- : public LayoutAtom
--{
--public:
-- enum {
-- VAR_animLvl = 0,
-- VAR_animOne,
-- VAR_bulletEnabled,
-- VAR_chMax,
-- VAR_chPref,
-- VAR_dir,
-- VAR_hierBranch,
-- VAR_orgChart,
-- VAR_resizeHandles
-- };
-- // we know that the array is of fixed size
-- // the use of Any allow having empty values
-- typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
--
-- virtual ~LayoutNode()
-- {}
-- virtual void processAtom()
-- {}
-- VarMap & variables()
-- { return mVariables; }
--private:
-- VarMap mVariables;
-- std::vector< ShapePtr > mpShapes;
--};
--
--typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
--
--} }
--
--#endif
-diff --git oox/inc/oox/drawingml/drawingmltypes.hxx oox/inc/oox/drawingml/drawingmltypes.hxx
-index 50cf46a..6df0017 100644
---- oox/inc/oox/drawingml/drawingmltypes.hxx
-+++ oox/inc/oox/drawingml/drawingmltypes.hxx
-@@ -50,6 +50,9 @@ typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
- struct FillProperties;
- typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
-
-+struct Shape3DProperties;
-+typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
-+
- struct TextCharacterProperties;
- typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
-
-diff --git oox/inc/oox/drawingml/graphicshapecontext.hxx oox/inc/oox/drawingml/graphicshapecontext.hxx
-index f6093ac..605c39e 100644
---- oox/inc/oox/drawingml/graphicshapecontext.hxx
-+++ oox/inc/oox/drawingml/graphicshapecontext.hxx
-@@ -33,7 +33,6 @@
-
- #include "oox/drawingml/shape.hxx"
- #include "oox/drawingml/shapecontext.hxx"
--#include "oox/drawingml/diagram/diagram.hxx"
-
- namespace oox { namespace drawingml {
-
-@@ -78,6 +77,8 @@ private:
-
- // ====================================================================
-
-+class Diagram;
-+
- class DiagramGraphicDataContext
- : public ShapeContext
- {
-@@ -87,8 +88,6 @@ public:
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
- private:
-- DiagramPtr loadDiagram();
--
- ::rtl::OUString msDm;
- ::rtl::OUString msLo;
- ::rtl::OUString msQs;
-diff --git oox/inc/oox/drawingml/shape.hxx oox/inc/oox/drawingml/shape.hxx
-index 9e584c6..144263f 100644
---- oox/inc/oox/drawingml/shape.hxx
-+++ oox/inc/oox/drawingml/shape.hxx
-@@ -83,7 +83,8 @@ class Shape
- {
- public:
-
-- Shape( const sal_Char* pServiceType = NULL );
-+ explicit Shape( const sal_Char* pServiceType = NULL );
-+ explicit Shape( const ShapePtr& pSourceShape );
- virtual ~Shape();
-
- rtl::OUString& getServiceName(){ return msServiceName; }
-@@ -100,10 +101,17 @@ public:
- FillPropertiesPtr getGraphicProperties() { return mpGraphicPropertiesPtr; }
- CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
-
-+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
-+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
-+
- table::TablePropertiesPtr getTableProperties();
-
-- void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
-- void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
-+ void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
-+ const com::sun::star::awt::Point& getPosition() const { return maPosition; }
-+
-+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
-+ const com::sun::star::awt::Size& getSize() const { return maSize; }
-+
- void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
- void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
- void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
-@@ -139,6 +147,13 @@ public:
- const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
- ShapeIdMap* pShapeMap = 0 );
-
-+ void addChildren(
-+ const ::oox::core::XmlFilterBase& rFilterBase,
-+ const ThemePtr& rxTheme,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
-+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
-+ ShapeIdMap* pShapeMap = 0 );
-+
- void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
- { mxShape = rXShape; };
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
-@@ -171,6 +186,7 @@ protected:
- FillPropertiesPtr mpGraphicPropertiesPtr;
- CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
- table::TablePropertiesPtr mpTablePropertiesPtr;
-+ Shape3DPropertiesPtr mp3DPropertiesPtr;
- PropertyMap maShapeProperties;
- TextListStylePtr mpMasterTextListStyle;
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
-@@ -193,7 +209,11 @@ private:
- sal_Bool mbFlipV;
- };
-
--::rtl::OUString GetShapeType( sal_Int32 nType );
-+// ---------------------------------------------------------------------
-+
-+/** Get custom shape preset string from xml token id
-+ */
-+::rtl::OUString GetShapePresetType( sal_Int32 nType );
-
- } }
-
-diff --git oox/inc/oox/drawingml/theme.hxx oox/inc/oox/drawingml/theme.hxx
-index 17f23e5..2f34a33 100644
---- oox/inc/oox/drawingml/theme.hxx
-+++ oox/inc/oox/drawingml/theme.hxx
-@@ -35,6 +35,7 @@
- #include "oox/drawingml/clrscheme.hxx"
- #include "oox/drawingml/shape.hxx"
- #include "oox/drawingml/textfont.hxx"
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-
- namespace oox {
- namespace drawingml {
-@@ -97,6 +98,11 @@ public:
- inline Shape& getTxDef() { return maTxDef; }
- inline const Shape& getTxDef() const { return maTxDef; }
-
-+ void setFragment( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
-+
- private:
- ::rtl::OUString maStyleName;
- ClrScheme maClrScheme;
-@@ -108,6 +114,8 @@ private:
- Shape maSpDef;
- Shape maLnDef;
- Shape maTxDef;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> mxFragment;
- };
-
- // ============================================================================
-diff --git oox/inc/oox/ppt/dgmimport.hxx oox/inc/oox/ppt/dgmimport.hxx
-new file mode 100644
-index 0000000..bfb2f38
---- /dev/null
-+++ oox/inc/oox/ppt/dgmimport.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: pptimport.hxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
-+#define OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
-+
-+#include "oox/core/xmlfilterbase.hxx"
-+
-+#include <com/sun/star/animations/XAnimationNode.hpp>
-+#include <oox/drawingml/theme.hxx>
-+#include "oox/ppt/presentationfragmenthandler.hxx"
-+#include "oox/ppt/slidepersist.hxx"
-+#include "tokens.hxx"
-+#include <vector>
-+#include <map>
-+
-+namespace oox { namespace ppt {
-+
-+// ---------------------------------------------------------------------
-+
-+class QuickDiagrammingImport : public oox::core::XmlFilterBase
-+{
-+public:
-+
-+ QuickDiagrammingImport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
-+
-+ // from FilterBase
-+ virtual bool importDocument() throw();
-+ virtual bool exportDocument() throw();
-+
-+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
-+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
-+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
-+
-+private:
-+ virtual ::rtl::OUString implGetImplementationName() const;
-+};
-+
-+} }
-+
-+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
-diff --git oox/inc/oox/ppt/dgmlayout.hxx oox/inc/oox/ppt/dgmlayout.hxx
-new file mode 100644
-index 0000000..d597ef4
---- /dev/null
-+++ oox/inc/oox/ppt/dgmlayout.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: pptimport.hxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
-+#define OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
-+
-+#include "oox/core/xmlfilterbase.hxx"
-+
-+#include <com/sun/star/animations/XAnimationNode.hpp>
-+#include <oox/drawingml/theme.hxx>
-+#include "oox/ppt/presentationfragmenthandler.hxx"
-+#include "oox/ppt/slidepersist.hxx"
-+#include "tokens.hxx"
-+#include <vector>
-+#include <map>
-+
-+namespace oox { namespace ppt {
-+
-+// ---------------------------------------------------------------------
-+
-+class QuickDiagrammingLayout : public oox::core::XmlFilterBase
-+{
-+public:
-+
-+ QuickDiagrammingLayout( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
-+
-+ // from FilterBase
-+ virtual bool importDocument() throw();
-+ virtual bool exportDocument() throw();
-+
-+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
-+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
-+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
-+
-+private:
-+ virtual ::rtl::OUString implGetImplementationName() const;
-+ drawingml::ThemePtr mpThemePtr;
-+};
-+
-+} }
-+
-+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
-diff --git oox/inc/oox/ppt/pptimport.hxx oox/inc/oox/ppt/pptimport.hxx
-index 2df0f71..c1a62f5 100644
---- oox/inc/oox/ppt/pptimport.hxx
-+++ oox/inc/oox/ppt/pptimport.hxx
-@@ -62,7 +62,7 @@ public:
-
- virtual const oox::vml::DrawingPtr getDrawings();
- virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
-- virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
-+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
-
- void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
- std::map< rtl::OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
-diff --git oox/inc/oox/xls/excelfilter.hxx oox/inc/oox/xls/excelfilter.hxx
-index cff5f5a..7dada9c 100644
---- oox/inc/oox/xls/excelfilter.hxx
-+++ oox/inc/oox/xls/excelfilter.hxx
-@@ -56,7 +56,7 @@ public:
-
- virtual const ::oox::vml::DrawingPtr getDrawings();
- virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
-- virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
-+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
-
- virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
-
-diff --git oox/inc/oox/xls/workbookhelper.hxx oox/inc/oox/xls/workbookhelper.hxx
-index e9f5ed9..11120a9 100644
---- oox/inc/oox/xls/workbookhelper.hxx
-+++ oox/inc/oox/xls/workbookhelper.hxx
-@@ -231,7 +231,7 @@ public:
- /** Returns the converter for string to cell address/range conversion. */
- AddressConverter& getAddressConverter() const;
- /** Returns the chart object converter. */
-- ExcelChartConverter& getChartConverter() const;
-+ ExcelChartConverter* getChartConverter() const;
-
- // property helpers -------------------------------------------------------
-
-diff --git oox/source/core/facreg.cxx oox/source/core/facreg.cxx
-index f1ead12..e3daa0d 100644
---- oox/source/core/facreg.cxx
-+++ oox/source/core/facreg.cxx
-@@ -60,6 +60,8 @@ extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance(
- namespace oox {
- namespace core { SERVICE( FilterDetect ); }
- namespace ppt { SERVICE( PowerPointImport ); }
-+ namespace ppt { SERVICE( QuickDiagrammingImport ); }
-+ namespace ppt { SERVICE( QuickDiagrammingLayout ); }
- namespace xls { SERVICE( BiffDetector ); }
- namespace xls { SERVICE( ExcelFilter ); }
- namespace xls { SERVICE( ExcelBiffFilter ); }
-@@ -102,6 +104,8 @@ OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKe
-
- WRITEINFO( ::oox::core::FilterDetect );
- WRITEINFO( ::oox::ppt::PowerPointImport );
-+ WRITEINFO( ::oox::ppt::QuickDiagrammingImport );
-+ WRITEINFO( ::oox::ppt::QuickDiagrammingLayout );
- WRITEINFO( ::oox::xls::BiffDetector );
- WRITEINFO( ::oox::xls::ExcelFilter );
- WRITEINFO( ::oox::xls::ExcelBiffFilter );
-@@ -150,6 +154,8 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
- // impress oasis import
- SINGLEFACTORY( ::oox::core::FilterDetect )
- else SINGLEFACTORY( oox::ppt::PowerPointImport )
-+ else SINGLEFACTORY( oox::ppt::QuickDiagrammingImport )
-+ else SINGLEFACTORY( oox::ppt::QuickDiagrammingLayout )
- else SINGLEFACTORY( ::oox::xls::BiffDetector )
- else SINGLEFACTORY( ::oox::xls::ExcelFilter )
- else SINGLEFACTORY( ::oox::xls::ExcelBiffFilter )
-diff --git oox/source/core/filterbase.cxx oox/source/core/filterbase.cxx
-index e3babee..37e7128 100644
---- oox/source/core/filterbase.cxx
-+++ oox/source/core/filterbase.cxx
-@@ -32,6 +32,7 @@
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/task/XStatusIndicator.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
- #include <rtl/uri.hxx>
- #include <comphelper/mediadescriptor.hxx>
-
-@@ -52,6 +53,7 @@ using ::com::sun::star::io::XOutputStream;
- using ::com::sun::star::io::XStream;
- using ::com::sun::star::task::XStatusIndicator;
- using ::com::sun::star::task::XInteractionHandler;
-+using ::com::sun::star::drawing::XShape;
- using ::comphelper::MediaDescriptor;
-
- namespace oox {
-@@ -72,6 +74,7 @@ struct FilterBaseImpl
- Reference< XStream > mxStream;
- Reference< XStatusIndicator > mxStatusIndicator;
- Reference< XInteractionHandler > mxInteractionHandler;
-+ Reference< XShape > mxParentShape;
-
- explicit FilterBaseImpl( const Reference< XMultiServiceFactory >& rxFactory );
- void setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor );
-@@ -89,14 +92,15 @@ void FilterBaseImpl::setMediaDescriptor( const Sequence< PropertyValue >& rDescr
- {
- maDescriptor = rDescriptor;
-
-+ mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
-+ if( !mxStream.is() )
-+ maDescriptor.addInputStream();
-+
- maFileUrl = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), maFileUrl );
- mxInStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), mxInStream );
-- mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
- mxStatusIndicator = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), mxStatusIndicator );
- mxInteractionHandler = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), mxInteractionHandler );
--
-- if( mxInStream.is() )
-- maDescriptor.addInputStream();
-+ mxParentShape = maDescriptor.getUnpackedValueOrDefault( CREATE_OUSTRING( "ParentShape" ), mxParentShape );
- }
-
- // ============================================================================
-@@ -137,6 +141,11 @@ const Reference< XModel >& FilterBase::getModel() const
- return mxImpl->mxModel;
- }
-
-+const Reference< XShape >& FilterBase::getParentShape() const
-+{
-+ return mxImpl->mxParentShape;
-+}
-+
- const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
- {
- return mxImpl->mxStatusIndicator;
-diff --git oox/source/core/xmlfilterbase.cxx oox/source/core/xmlfilterbase.cxx
-index 545ef5c..f143761 100644
---- oox/source/core/xmlfilterbase.cxx
-+++ oox/source/core/xmlfilterbase.cxx
-@@ -43,16 +43,20 @@
- #include <cstdio>
-
- #include <rtl/ustrbuf.hxx>
-+#include <rtl/instance.hxx>
-
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
-+#include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/embed/ElementModes.hpp>
- #include <com/sun/star/embed/XTransactedObject.hpp>
- #include <com/sun/star/embed/XRelationshipAccess.hpp>
- #include <com/sun/star/xml/sax/InputSource.hpp>
- #include <com/sun/star/xml/sax/XFastParser.hpp>
--#include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
- #include <sax/fshelper.hxx>
-
- #include "tokens.hxx"
-@@ -61,6 +65,7 @@ using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::beans::StringPair;
-+using ::com::sun::star::beans::Pair;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Exception;
-@@ -78,6 +83,8 @@ using ::com::sun::star::io::XOutputStream;
- using ::com::sun::star::io::XStream;
- using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::document::XDocumentSubStorageSupplier;
-+using ::com::sun::star::xml::dom::XDocument;
-+using ::com::sun::star::xml::dom::XDocumentBuilder;
- using ::com::sun::star::xml::sax::XFastParser;
- using ::com::sun::star::xml::sax::XFastTokenHandler;
- using ::com::sun::star::xml::sax::XFastDocumentHandler;
-@@ -87,6 +94,7 @@ using ::com::sun::star::document::XDocumentProperties;
- using ::com::sun::star::util::DateTime;
- using ::sax_fastparser::FastSerializerHelper;
- using ::sax_fastparser::FSHelperPtr;
-+using namespace ::com::sun::star;
-
- namespace oox {
- namespace core {
-@@ -119,6 +127,64 @@ XmlFilterBaseImpl::XmlFilterBaseImpl() :
-
- // ============================================================================
-
-+namespace
-+{
-+ struct NamespaceIds: public rtl::StaticWithInit<
-+ Sequence< Pair< OUString, sal_Int32 > >,
-+ NamespaceIds>
-+ {
-+ Sequence< Pair< OUString, sal_Int32 > > operator()()
-+ {
-+ static const char* const namespaceURIs[] = {
-+ "http://www.w3.org/XML/1998/namespace",
-+ "http://schemas.openxmlformats.org/package/2006/relationships",
-+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
-+ "http://schemas.openxmlformats.org/drawingml/2006/main",
-+ "http://schemas.openxmlformats.org/drawingml/2006/diagram",
-+ "http://schemas.openxmlformats.org/drawingml/2006/chart",
-+ "urn:schemas-microsoft-com:vml",
-+ "urn:schemas-microsoft-com:office:office",
-+ "urn:schemas-microsoft-com:office:word",
-+ "urn:schemas-microsoft-com:office:excel",
-+ "urn:schemas-microsoft-com:office:powerpoint",
-+ "http://schemas.microsoft.com/office/2006/activeX",
-+ "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
-+ "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
-+ "http://schemas.microsoft.com/office/excel/2006/main",
-+ "http://schemas.openxmlformats.org/presentationml/2006/main"
-+ };
-+
-+ static const sal_Int32 namespaceIds[] = {
-+ NMSP_XML,
-+ NMSP_PACKAGE_RELATIONSHIPS,
-+ NMSP_RELATIONSHIPS,
-+ NMSP_DRAWINGML,
-+ NMSP_DIAGRAM,
-+ NMSP_CHART,
-+ NMSP_VML,
-+ NMSP_OFFICE,
-+ NMSP_VML_DOC,
-+ NMSP_VML_XLS,
-+ NMSP_VML_PPT,
-+ NMSP_AX,
-+ NMSP_XLS,
-+ NMSP_XDR,
-+ NMSP_XM,
-+ NMSP_PPT
-+ };
-+
-+ Sequence< Pair< OUString, sal_Int32 > > aRet(STATIC_ARRAY_SIZE(namespaceIds));
-+ for( sal_Int32 i=0; i<aRet.getLength(); ++i )
-+ aRet[i] = beans::make_Pair(
-+ ::rtl::OUString::createFromAscii(namespaceURIs[i]),
-+ namespaceIds[i]);
-+ return aRet;
-+ }
-+ };
-+}
-+
-+// ============================================================================
-+
- XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxFactory ) :
- FilterBase( rxFactory ),
- mxImpl( new XmlFilterBaseImpl ),
-@@ -133,6 +199,18 @@ XmlFilterBase::~XmlFilterBase()
-
- // ----------------------------------------------------------------------------
-
-+const ::oox::vml::DrawingPtr XmlFilterBase::getDrawings()
-+{
-+ return ::oox::vml::DrawingPtr();
-+}
-+
-+::oox::drawingml::chart::ChartConverter* XmlFilterBase::getChartConverter()
-+{
-+ return 0;
-+}
-+
-+// ----------------------------------------------------------------------------
-+
- OUString XmlFilterBase::getFragmentPathFromType( const OUString& rType )
- {
- return importRelations( OUString() )->getTargetFromType( rType );
-@@ -193,26 +271,10 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
- xParser->setTokenHandler( mxImpl->mxTokenHandler );
-
- // register XML namespaces
-- xParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
--
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART );
--
-- xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
-- xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
-- xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC );
-- xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS );
-- xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX );
--
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR );
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM );
--
-- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT );
-+ const Sequence< Pair< OUString, sal_Int32 > > ids=
-+ NamespaceIds::get();
-+ for( sal_Int32 i=0; i<ids.getLength(); ++i )
-+ xParser->registerNamespace( ids[i].First, ids[i].Second );
-
- // create the input source and parse the stream
- InputSource aSource;
-@@ -227,6 +289,66 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
- return false;
- }
-
-+Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFragmentPath )
-+{
-+ Reference<XDocument> xRet;
-+
-+ // path to fragment stream valid?
-+ OSL_ENSURE( aFragmentPath.getLength() > 0, "XmlFilterBase::importFragment - empty fragment path" );
-+ if( aFragmentPath.getLength() == 0 )
-+ return xRet;
-+
-+ // try to open the fragment stream (this may fail - do not assert)
-+ Reference< XInputStream > xInStrm = openInputStream( aFragmentPath );
-+ if( !xInStrm.is() )
-+ return xRet;
-+
-+ // binary streams (fragment extension is '.bin') currently not supported
-+ sal_Int32 nBinSuffixPos = aFragmentPath.getLength() - mxImpl->maBinSuffix.getLength();
-+ if( (nBinSuffixPos >= 0) && aFragmentPath.match( mxImpl->maBinSuffix, nBinSuffixPos ) )
-+ return xRet;
-+
-+ // try to import XML stream
-+ try
-+ {
-+ // create the dom parser
-+ Reference<XDocumentBuilder> xDomBuilder(
-+ getGlobalFactory()->createInstance(
-+ CREATE_OUSTRING( "com.sun.star.xml.dom.DocumentBuilder" ) ),
-+ UNO_QUERY_THROW );
-+
-+ // create DOM from fragment
-+ xRet = xDomBuilder->parse(xInStrm);
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+
-+ return xRet;
-+}
-+
-+bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
-+ const Reference< xml::sax::XFastSAXSerializable >& rxSerializer )
-+{
-+ Reference< XFastDocumentHandler > xDocHandler( rxHandler.get() );
-+ if( !xDocHandler.is() )
-+ return false;
-+
-+ // try to import XML stream
-+ try
-+ {
-+ rxSerializer->fastSerialize( xDocHandler,
-+ mxImpl->mxTokenHandler,
-+ uno::Sequence< beans::StringPair >(),
-+ NamespaceIds::get() );
-+ return true;
-+ }
-+ catch( Exception& )
-+ {}
-+
-+ return false;
-+}
-+
- RelationsRef XmlFilterBase::importRelations( const OUString& rFragmentPath )
- {
- // try to find cached relations
-diff --git oox/source/drawingml/chart/chartspaceconverter.cxx oox/source/drawingml/chart/chartspaceconverter.cxx
-index 22e4be7..1957245 100644
---- oox/source/drawingml/chart/chartspaceconverter.cxx
-+++ oox/source/drawingml/chart/chartspaceconverter.cxx
-@@ -67,9 +67,12 @@ ChartSpaceConverter::~ChartSpaceConverter()
-
- void ChartSpaceConverter::convertFromModel()
- {
-+ if( !getChartConverter() )
-+ return;
-+
- /* create data provider (virtual function in the ChartConverter class,
- derived converters may create an external data provider) */
-- getChartConverter().createDataProvider( getChartDocument() );
-+ getChartConverter()->createDataProvider( getChartDocument() );
-
- // attach number formatter of container document to data receiver
- try
-diff --git oox/source/drawingml/chart/converterbase.cxx oox/source/drawingml/chart/converterbase.cxx
-index c9b91e3..c5509c2 100644
---- oox/source/drawingml/chart/converterbase.cxx
-+++ oox/source/drawingml/chart/converterbase.cxx
-@@ -145,9 +145,9 @@ XmlFilterBase& ConverterRoot::getFilter() const
- return mxData->mrFilter;
- }
-
--ChartConverter& ConverterRoot::getChartConverter() const
-+ChartConverter* ConverterRoot::getChartConverter() const
- {
-- return mxData->mrConverter;
-+ return &mxData->mrConverter;
- }
-
- Reference< XChartDocument > ConverterRoot::getChartDocument() const
-diff --git oox/source/drawingml/chart/datasourceconverter.cxx oox/source/drawingml/chart/datasourceconverter.cxx
-index be55030..ee880cc 100644
---- oox/source/drawingml/chart/datasourceconverter.cxx
-+++ oox/source/drawingml/chart/datasourceconverter.cxx
-@@ -56,11 +56,15 @@ DataSequenceConverter::~DataSequenceConverter()
- Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
- {
- // create data sequence from data source model (virtual call at chart converter)
-- Reference< XDataSequence > xDataSeq = getChartConverter().createDataSequence( getChartDocument()->getDataProvider(), mrModel );
-+ Reference< XDataSequence > xDataSeq;
-+ if( getChartConverter() )
-+ {
-+ getChartConverter()->createDataSequence( getChartDocument()->getDataProvider(), mrModel );
-
-- // set sequence role
-- PropertySet aSeqProp( xDataSeq );
-- aSeqProp.setProperty( CREATE_OUSTRING( "Role" ), rRole );
-+ // set sequence role
-+ PropertySet aSeqProp( xDataSeq );
-+ aSeqProp.setProperty( CREATE_OUSTRING( "Role" ), rRole );
-+ }
-
- return xDataSeq;
- }
-diff --git oox/source/drawingml/clrscheme.cxx oox/source/drawingml/clrscheme.cxx
-index 131fdb5..9f2582c 100644
---- oox/source/drawingml/clrscheme.cxx
-+++ oox/source/drawingml/clrscheme.cxx
-@@ -28,6 +28,7 @@
- *
- ************************************************************************/
-
-+#include <osl/diagnose.h>
- #include "oox/drawingml/clrscheme.hxx"
- #include "tokens.hxx"
-
-@@ -64,6 +65,7 @@ ClrScheme::~ClrScheme()
-
- sal_Bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
- {
-+ OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0);
- switch( nSchemeClrToken )
- {
- case XML_bg1 : nSchemeClrToken = XML_lt1; break;
-diff --git oox/source/drawingml/color.cxx oox/source/drawingml/color.cxx
-index b5b02cd..3931ea4 100644
---- oox/source/drawingml/color.cxx
-+++ oox/source/drawingml/color.cxx
-@@ -116,6 +116,7 @@ Color::~Color()
-
- sal_Int32 Color::getPresetColor( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_aliceBlue: return 0xF0F8FF;
-@@ -265,6 +266,8 @@ sal_Int32 Color::getPresetColor( sal_Int32 nToken )
-
- sal_Int32 Color::getSystemColor( sal_Int32 nToken, sal_Int32 nDefault )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
-+
- //! TODO: get colors from system
- switch( nToken )
- {
-@@ -381,6 +384,7 @@ sal_Int32 Color::getColor( const ::oox::core::XmlFilterBase& rFilter, sal_Int32
-
- for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt )
- {
-+ OSL_ASSERT((aIt->mnToken & sal_Int32(0xFFFF0000))==0);
- switch( aIt->mnToken )
- {
- case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break;
-diff --git oox/source/drawingml/customshapegeometry.cxx oox/source/drawingml/customshapegeometry.cxx
-index e7acf6a..2277ccf 100644
---- oox/source/drawingml/customshapegeometry.cxx
-+++ oox/source/drawingml/customshapegeometry.cxx
-@@ -269,8 +269,9 @@ void PathListContext::endFastElement( sal_Int32 aElementToken ) throw (SAXExcept
-
- // ---------------------------------------------------------------------
-
--OUString GetShapeType( sal_Int32 nType )
-+OUString GetShapePresetType( sal_Int32 nType )
- {
-+ OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
- OUString sType;
- switch( nType )
- {
-@@ -898,6 +899,7 @@ OUString GetShapeType( sal_Int32 nType )
-
- static OUString GetTextShapeType( sal_Int32 nType )
- {
-+ OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
- OUString sType;
- switch( nType )
- {
-@@ -1104,7 +1106,7 @@ PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent,
- OUString sShapeType;
- sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
- if ( nShapeType != FastToken::DONTKNOW )
-- sShapeType = GetShapeType( nShapeType );
-+ sShapeType = GetShapePresetType( nShapeType );
- OSL_ENSURE( sShapeType.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
- mrCustomShapeProperties.setShapePresetType( sShapeType );
- }
-diff --git oox/source/drawingml/diagram/constraintlistcontext.cxx oox/source/drawingml/diagram/constraintlistcontext.cxx
-new file mode 100644
-index 0000000..6ef7f18
---- /dev/null
-+++ oox/source/drawingml/diagram/constraintlistcontext.cxx
-@@ -0,0 +1,102 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * 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 "constraintlistcontext.hxx"
-+#include "oox/helper/attributelist.hxx"
-+#include "oox/core/namespaces.hxx"
-+
-+using namespace ::oox::core;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::xml::sax;
-+using ::rtl::OUString;
-+
-+namespace oox { namespace drawingml {
-+
-+// CT_ConstraintLists
-+ConstraintListContext::ConstraintListContext( ContextHandler& rParent,
-+ const Reference< XFastAttributeList >&,
-+ const LayoutAtomPtr &pNode )
-+ : ContextHandler( rParent )
-+ , mpNode( pNode )
-+{
-+ OSL_ENSURE( pNode, "Node must NOT be NULL" );
-+}
-+
-+
-+ConstraintListContext::~ConstraintListContext()
-+{
-+}
-+
-+void SAL_CALL ConstraintListContext::endFastElement( ::sal_Int32 )
-+ throw (SAXException, RuntimeException)
-+{
-+}
-+
-+Reference< XFastContextHandler > SAL_CALL
-+ConstraintListContext::createFastChildContext( ::sal_Int32 aElement,
-+ const Reference< XFastAttributeList >& xAttribs )
-+ throw (SAXException, RuntimeException)
-+{
-+ Reference< XFastContextHandler > xRet;
-+
-+ OUString aEmptyStr;
-+
-+ switch( aElement )
-+ {
-+ case NMSP_DIAGRAM|XML_constr:
-+ {
-+ ConstraintAtomPtr pNode( new ConstraintAtom() );
-+ mpNode->addChild( pNode );
-+
-+ AttributeList aAttribs( xAttribs );
-+ pNode->setFor( aAttribs.getToken( XML_for, XML_none ) );
-+ pNode->setForName( aAttribs.getString( XML_forName, aEmptyStr ) );
-+ pNode->setPointType( aAttribs.getToken( XML_ptType, XML_none ) );
-+ pNode->setType( aAttribs.getToken( XML_type, XML_none ) );
-+ pNode->setRefFor( aAttribs.getToken( XML_refFor, XML_none ) );
-+ pNode->setRefForName( aAttribs.getString( XML_refForName, aEmptyStr ) );
-+ pNode->setRefType( aAttribs.getToken( XML_refType, XML_none ) );
-+ pNode->setRefPointType( aAttribs.getToken( XML_refPtType, XML_none ) );
-+ pNode->setFactor( aAttribs.getDouble( XML_fact, 1.0 ) );
-+ pNode->setValue( aAttribs.getDouble( XML_val, 0.0 ) );
-+ pNode->setOperator( aAttribs.getToken( XML_op, XML_none ) );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ if( !xRet.is() )
-+ xRet.set(this);
-+
-+ return xRet;
-+}
-+
-+
-+} }
-diff --git oox/source/drawingml/diagram/constraintlistcontext.hxx oox/source/drawingml/diagram/constraintlistcontext.hxx
-new file mode 100644
-index 0000000..7d48811
---- /dev/null
-+++ oox/source/drawingml/diagram/constraintlistcontext.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * 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 OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
-+#define OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
-+
-+#include "oox/core/contexthandler.hxx"
-+#include "diagramlayoutatoms.hxx"
-+#include "diagram.hxx"
-+
-+namespace oox { namespace drawingml {
-+
-+class ConstraintListContext : public ::oox::core::ContextHandler
-+{
-+public:
-+ ConstraintListContext( ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, const LayoutAtomPtr &pNode );
-+ virtual ~ConstraintListContext();
-+
-+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+private:
-+ LayoutAtomPtr mpNode;
-+};
-+
-+} }
-+
-+#endif
-diff --git oox/source/drawingml/diagram/datamodelcontext.cxx oox/source/drawingml/diagram/datamodelcontext.cxx
-index d4dc7ad..f3db16c 100644
---- oox/source/drawingml/diagram/datamodelcontext.cxx
-+++ oox/source/drawingml/diagram/datamodelcontext.cxx
-@@ -28,7 +28,7 @@
- *
- ************************************************************************/
-
--#include "oox/drawingml/diagram/datamodelcontext.hxx"
-+#include "datamodelcontext.hxx"
- #include "oox/helper/attributelist.hxx"
- #include "oox/core/skipcontext.hxx"
- #include "oox/core/namespaces.hxx"
-@@ -43,43 +43,46 @@ using ::rtl::OUString;
-
- namespace oox { namespace drawingml {
-
--
--
--// CL_Cxn
--class CxnContext
-+// CT_CxnList
-+class CxnListContext
- : public ContextHandler
- {
- public:
-- CxnContext( ContextHandler& rParent,
-- const Reference< XFastAttributeList >& xAttribs,
-- const dgm::ConnectionPtr & pConnection )
-+ CxnListContext( ContextHandler& rParent, dgm::Connections & aConnections )
- : ContextHandler( rParent )
-- , mpConnection( pConnection )
-+ , mrConnections( aConnections )
- {
-- sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
-- pConnection->mnType = nType;
-- pConnection->msModelId = xAttribs->getOptionalValue( XML_modelId );
-- pConnection->msSourceId = xAttribs->getOptionalValue( XML_srcId );
-- pConnection->msDestId = xAttribs->getOptionalValue( XML_destId );
-- pConnection->msPresId = xAttribs->getOptionalValue( XML_presId );
-- pConnection->msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
-- AttributeList attribs( xAttribs );
-- pConnection->mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
-- pConnection->mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
- }
--
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( sal_Int32 aElementToken,
-- const Reference< XFastAttributeList >& /*xAttribs*/ )
-+ const Reference< XFastAttributeList >& xAttribs )
- throw (SAXException, RuntimeException)
- {
- Reference< XFastContextHandler > xRet;
-
- switch( aElementToken )
- {
-- case NMSP_DIAGRAM|XML_extLst:
-+ case NMSP_DIAGRAM|XML_cxn:
-+ {
-+ mrConnections.push_back( dgm::Connection() );
-+ dgm::Connection& rConnection=mrConnections.back();
-+
-+ const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
-+ rConnection.mnType = nType;
-+ rConnection.msModelId = xAttribs->getOptionalValue( XML_modelId );
-+ rConnection.msSourceId = xAttribs->getOptionalValue( XML_srcId );
-+ rConnection.msDestId = xAttribs->getOptionalValue( XML_destId );
-+ rConnection.msPresId = xAttribs->getOptionalValue( XML_presId );
-+ rConnection.msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
-+ rConnection.msParTransId = xAttribs->getOptionalValue( XML_parTransId );
-+ const AttributeList attribs( xAttribs );
-+ rConnection.mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
-+ rConnection.mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
-+
-+ // skip CT_extLst
- xRet.set( new SkipContext( *this ) );
- break;
-+ }
- default:
- break;
- }
-@@ -87,35 +90,135 @@ public:
- xRet.set( this );
- return xRet;
- }
-+
- private:
-- dgm::ConnectionPtr mpConnection;
-+ dgm::Connections& mrConnections;
- };
-
-
--// CT_CxnList
--class CxnListContext
-+// CT_presLayoutVars
-+class PresLayoutVarsContext
- : public ContextHandler
- {
- public:
-- CxnListContext( ContextHandler& rParent, dgm::Connections & aConnections )
-- : ContextHandler( rParent )
-- , maConnections( aConnections )
-+ PresLayoutVarsContext( ContextHandler& rParent,
-+ dgm::Point & rPoint ) :
-+ ContextHandler( rParent ),
-+ mrPoint( rPoint )
-+ {
-+ }
-+ virtual Reference< XFastContextHandler > SAL_CALL
-+ createFastChildContext( sal_Int32 aElementToken,
-+ const Reference< XFastAttributeList >& xAttribs )
-+ throw (SAXException, RuntimeException)
- {
-+ Reference< XFastContextHandler > xRet;
-+ AttributeList aAttribs( xAttribs );
-+
-+ switch( aElementToken )
-+ {
-+ // TODO
-+ case NMSP_DIAGRAM|XML_animLvl:
-+ case NMSP_DIAGRAM|XML_animOne:
-+ break;
-+ case NMSP_DIAGRAM|XML_bulletEnabled:
-+ mrPoint.mbBulletEnabled = aAttribs.getBool( XML_val, false );
-+ break;
-+ case NMSP_DIAGRAM|XML_chMax:
-+ mrPoint.mnMaxChildren = aAttribs.getInteger( XML_val, -1 );
-+ break;
-+ case NMSP_DIAGRAM|XML_chPref:
-+ mrPoint.mnPreferredChildren = aAttribs.getInteger( XML_val, -1 );
-+ break;
-+ case NMSP_DIAGRAM|XML_dir:
-+ mrPoint.mnDirection = aAttribs.getToken( XML_val, XML_norm );
-+ break;
-+ case NMSP_DIAGRAM|XML_hierBranch:
-+ mrPoint.mnHierarchyBranch = aAttribs.getToken( XML_val, XML_std );
-+ break;
-+ case NMSP_DIAGRAM|XML_orgChart:
-+ mrPoint.mbOrgChartEnabled = aAttribs.getBool( XML_val, false );
-+ break;
-+ case NMSP_DIAGRAM|XML_resizeHandles:
-+ mrPoint.mnResizeHandles = aAttribs.getToken( XML_val, XML_rel );
-+ break;
-+ default:
-+ break;
-+ }
-+ if( !xRet.is() )
-+ xRet.set( this );
-+ return xRet;
- }
-+
-+private:
-+ dgm::Point& mrPoint;
-+};
-+
-+
-+// CT_prSet
-+class PropertiesContext
-+ : public ContextHandler
-+{
-+public:
-+ PropertiesContext( ContextHandler& rParent,
-+ dgm::Point & rPoint,
-+ const Reference< XFastAttributeList >& xAttribs ) :
-+ ContextHandler( rParent ),
-+ mrPoint( rPoint )
-+ {
-+ OUString aEmptyStr;
-+ AttributeList aAttribs( xAttribs );
-+
-+ mrPoint.msColorTransformCategoryId = aAttribs.getString( XML_csCatId, aEmptyStr );
-+ mrPoint.msColorTransformTypeId = aAttribs.getString( XML_csTypeId, aEmptyStr );
-+ mrPoint.msLayoutCategoryId = aAttribs.getString( XML_loCatId, aEmptyStr );
-+ mrPoint.msLayoutTypeId = aAttribs.getString( XML_loTypeId, aEmptyStr );
-+ mrPoint.msPlaceholderText = aAttribs.getString( XML_phldrT, aEmptyStr );
-+ mrPoint.msPresentationAssociationId = aAttribs.getString( XML_presAssocID, aEmptyStr );
-+ mrPoint.msPresentationLayoutName = aAttribs.getString( XML_presName, aEmptyStr );
-+ mrPoint.msPresentationLayoutStyleLabel = aAttribs.getString( XML_presStyleLbl, aEmptyStr );
-+ mrPoint.msQuickStyleCategoryId = aAttribs.getString( XML_qsCatId, aEmptyStr );
-+ mrPoint.msQuickStyleTypeId = aAttribs.getString( XML_qsTypeId, aEmptyStr );
-+
-+ mrPoint.mnCustomAngle = aAttribs.getInteger( XML_custAng, -1 );
-+ mrPoint.mnPercentageNeighbourWidth = aAttribs.getInteger( XML_custLinFactNeighborX, -1 );
-+ mrPoint.mnPercentageNeighbourHeight = aAttribs.getInteger( XML_custLinFactNeighborY, -1 );
-+ mrPoint.mnPercentageOwnWidth = aAttribs.getInteger( XML_custLinFactX, -1 );
-+ mrPoint.mnPercentageOwnHeight = aAttribs.getInteger( XML_custLinFactY, -1 );
-+ mrPoint.mnIncludeAngleScale = aAttribs.getInteger( XML_custRadScaleInc, -1 );
-+ mrPoint.mnRadiusScale = aAttribs.getInteger( XML_custRadScaleRad, -1 );
-+ mrPoint.mnWidthScale = aAttribs.getInteger( XML_custScaleX, -1 );
-+ mrPoint.mnHeightScale = aAttribs.getInteger( XML_custScaleY, -1 );
-+ mrPoint.mnWidthOverride = aAttribs.getInteger( XML_custSzX, -1 );
-+ mrPoint.mnHeightOverride = aAttribs.getInteger( XML_custSzY, -1 );
-+ mrPoint.mnLayoutStyleCount = aAttribs.getInteger( XML_presStyleCnt, -1 );
-+ mrPoint.mnLayoutStyleIndex = aAttribs.getInteger( XML_presStyleIdx, -1 );
-+
-+ mrPoint.mbCoherent3DOffset = aAttribs.getBool( XML_coherent3DOff, false );
-+ mrPoint.mbCustomHorizontalFlip = aAttribs.getBool( XML_custFlipHor, false );
-+ mrPoint.mbCustomVerticalFlip = aAttribs.getBool( XML_custFlipVert, false );
-+ mrPoint.mbCustomText = aAttribs.getBool( XML_custT, false );
-+ mrPoint.mbIsPlaceholder = aAttribs.getBool( XML_phldr, false );
-+ }
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( sal_Int32 aElementToken,
-- const Reference< XFastAttributeList >& xAttribs )
-+ const Reference< XFastAttributeList >& )
- throw (SAXException, RuntimeException)
- {
- Reference< XFastContextHandler > xRet;
-
- switch( aElementToken )
- {
-- case NMSP_DIAGRAM|XML_cxn:
-+ case NMSP_DIAGRAM|XML_presLayoutVars:
-+ {
-+ xRet.set( new PresLayoutVarsContext( *this, mrPoint ) );
-+ break;
-+ }
-+ case NMSP_DIAGRAM|XML_style:
- {
-- dgm::ConnectionPtr pConnection( new dgm::Connection() );
-- maConnections.push_back( pConnection );
-- xRet.set( new CxnContext( *this, xAttribs, pConnection ) );
-+ // TODO
-+ // skip CT_shapeStyle
-+ xRet.set( new SkipContext( *this ) );
- break;
- }
- default:
-@@ -127,11 +230,10 @@ public:
- }
-
- private:
-- dgm::Connections & maConnections;
-+ dgm::Point& mrPoint;
- };
-
-
--
- // CL_Pt
- class PtContext
- : public ContextHandler
-@@ -139,27 +241,25 @@ class PtContext
- public:
- PtContext( ContextHandler& rParent,
- const Reference< XFastAttributeList >& xAttribs,
-- const dgm::PointPtr & pPoint)
-- : ContextHandler( rParent )
-- , mpPoint( pPoint )
-- {
-- mpPoint->setModelId( xAttribs->getOptionalValue( XML_modelId ) );
-- //
-- // the default type is XML_node
-- sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
-- mpPoint->setType( nType );
--
-- // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
-- if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
-- {
-- mpPoint->setCnxId( xAttribs->getOptionalValue( XML_cxnId ) );
-- }
-- }
-+ dgm::Point & rPoint):
-+ ContextHandler( rParent ),
-+ mrPoint( rPoint )
-+ {
-+ mrPoint.msModelId = xAttribs->getOptionalValue( XML_modelId );
-+
-+ // the default type is XML_node
-+ const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
-+ mrPoint.mnType = nType;
-+
-+ // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
-+ if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
-+ mrPoint.msCnxId = xAttribs->getOptionalValue( XML_cxnId );
-+ }
-
-
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( sal_Int32 aElementToken,
-- const Reference< XFastAttributeList >& /*xAttribs*/ )
-+ const Reference< XFastAttributeList >& xAttribs )
- throw (SAXException, RuntimeException)
- {
- Reference< XFastContextHandler > xRet;
-@@ -170,18 +270,22 @@ public:
- xRet.set( new SkipContext( *this ) );
- break;
- case NMSP_DIAGRAM|XML_prSet:
-- // TODO
-- // CT_ElemPropSet
-+ OSL_TRACE( "diagram property set for point");
-+ xRet = new PropertiesContext( *this, mrPoint, xAttribs );
- break;
- case NMSP_DIAGRAM|XML_spPr:
- OSL_TRACE( "shape props for point");
-- xRet = new ShapePropertiesContext( *this, *mpPoint->getShape() );
-+ if( !mrPoint.mpShape )
-+ mrPoint.mpShape.reset( new Shape() );
-+ xRet = new ShapePropertiesContext( *this, *(mrPoint.mpShape) );
- break;
- case NMSP_DIAGRAM|XML_t:
- {
- OSL_TRACE( "shape text body for point");
- TextBodyPtr xTextBody( new TextBody );
-- mpPoint->getShape()->setTextBody( xTextBody );
-+ if( !mrPoint.mpShape )
-+ mrPoint.mpShape.reset( new Shape() );
-+ mrPoint.mpShape->setTextBody( xTextBody );
- xRet = new TextBodyContext( *this, *xTextBody );
- break;
- }
-@@ -194,7 +298,7 @@ public:
- }
-
- private:
-- dgm::PointPtr mpPoint;
-+ dgm::Point& mrPoint;
- };
-
-
-@@ -204,11 +308,10 @@ class PtListContext
- : public ContextHandler
- {
- public:
-- PtListContext( ContextHandler& rParent, dgm::Points & aPoints)
-- : ContextHandler( rParent )
-- , maPoints( aPoints )
-- {
-- }
-+ PtListContext( ContextHandler& rParent, dgm::Points& rPoints) :
-+ ContextHandler( rParent ),
-+ mrPoints( rPoints )
-+ {}
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( sal_Int32 aElementToken,
- const Reference< XFastAttributeList >& xAttribs )
-@@ -221,9 +324,8 @@ public:
- case NMSP_DIAGRAM|XML_pt:
- {
- // CT_Pt
-- dgm::PointPtr pPoint( new dgm::Point() );
-- maPoints.push_back( pPoint );
-- xRet.set( new PtContext( *this, xAttribs, pPoint ) );
-+ mrPoints.push_back( dgm::Point() );
-+ xRet.set( new PtContext( *this, xAttribs, mrPoints.back() ) );
- break;
- }
- default:
-@@ -235,7 +337,7 @@ public:
- }
-
- private:
-- dgm::Points & maPoints;
-+ dgm::Points& mrPoints;
- };
-
- // CT_BackgroundFormatting
-diff --git oox/source/drawingml/diagram/datamodelcontext.hxx oox/source/drawingml/diagram/datamodelcontext.hxx
-new file mode 100644
-index 0000000..526385b
---- /dev/null
-+++ oox/source/drawingml/diagram/datamodelcontext.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datamodelcontext.hxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * 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 OOX_DRAWINGML_SHAPECONTEXT_HXX
-+#define OOX_DRAWINGML_SHAPECONTEXT_HXX
-+
-+#include <com/sun/star/drawing/XShapes.hpp>
-+
-+#include "oox/core/contexthandler.hxx"
-+#include "diagram.hxx"
-+
-+namespace oox { namespace drawingml {
-+
-+// CT_DataModel
-+class DataModelContext : public ::oox::core::ContextHandler
-+{
-+public:
-+ DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
-+ virtual ~DataModelContext();
-+
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+
-+protected:
-+ DiagramDataPtr mpDataModel;
-+};
-+
-+} }
-+
-+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
-diff --git oox/source/drawingml/diagram/diagram.cxx oox/source/drawingml/diagram/diagram.cxx
-index 9499d54..7044130 100644
---- oox/source/drawingml/diagram/diagram.cxx
-+++ oox/source/drawingml/diagram/diagram.cxx
-@@ -34,10 +34,22 @@
-
- #include <com/sun/star/awt/Point.hpp>
- #include <com/sun/star/awt/Size.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "oox/drawingml/textbody.hxx"
-+#include "oox/drawingml/textparagraph.hxx"
-+#include "oox/drawingml/textrun.hxx"
- #include "oox/drawingml/diagram/diagram.hxx"
- #include "oox/drawingml/fillproperties.hxx"
- #include "oox/core/namespaces.hxx"
- #include "tokens.hxx"
-+#include "diagram.hxx"
-+#include "diagramlayoutatoms.hxx"
-+#include "diagramfragmenthandler.hxx"
-+
-+#include <iostream>
-+#include <fstream>
-
- using rtl::OUString;
- using namespace ::com::sun::star;
-@@ -49,58 +61,26 @@ namespace dgm {
-
- void Connection::dump()
- {
-- OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s",
-- OUSTRING_TO_CSTR( msModelId ),
-+ OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s, parTransId %s, presId %s, sibTransId %s, srcOrd %d, dstOrd %d",
-+ OUSTRING_TO_CSTR( msModelId ),
- OUSTRING_TO_CSTR( msSourceId ),
-- OUSTRING_TO_CSTR( msDestId ) );
--}
--
--Point::Point()
-- : mpShape( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) )
-- , mnType( 0 )
--{
-+ OUSTRING_TO_CSTR( msDestId ),
-+ OUSTRING_TO_CSTR( msParTransId ),
-+ OUSTRING_TO_CSTR( msPresId ),
-+ OUSTRING_TO_CSTR( msSibTransId ),
-+ mnSourceOrder,
-+ mnDestOrder );
- }
-
- void Point::dump()
- {
-- OSL_TRACE( "dgm: pt cnxId %s, modelId %s",
-+ OSL_TRACE( "dgm: pt text %x, cnxId %s, modelId %s, type %d",
-+ mpShape.get(),
- OUSTRING_TO_CSTR( msCnxId ),
-- OUSTRING_TO_CSTR( msModelId ) );
--}
--
--void Point::setModelId( const ::rtl::OUString & sModelId )
--{
-- msModelId = sModelId;
-- mpShape->setName( msModelId );
-+ OUSTRING_TO_CSTR( msModelId ),
-+ mnType );
- }
-
--
--bool PointsTree::addChild( const PointsTreePtr & pChild )
--{
-- bool added = false;
--
-- OSL_ENSURE( pChild->mpParent.expired(), "can't add, has already a parent" );
-- OSL_ENSURE( mpNode, "has no node" );
-- if( mpNode && pChild->mpParent.expired() )
-- {
-- pChild->mpParent = shared_from_this();
-- maChildrens.push_back( pChild );
-- added = true;
-- }
--
-- return added;
--}
--
--PointsTreePtr PointsTree::getParent() const
--{
-- if( !mpParent.expired() )
-- {
-- return mpParent.lock() ;
-- }
-- return PointsTreePtr();
--}
--
--
- } // dgm namespace
-
- DiagramData::DiagramData()
-@@ -118,18 +98,10 @@ void DiagramData::dump()
- boost::bind( &dgm::Point::dump, _1 ) );
- }
-
--static void setPosition( const dgm::PointPtr & pPoint, const awt::Point & pt )
--{
-- ShapePtr pShape = pPoint->getShape();
-- awt::Size sz;
-- sz.Width = 50;
-- sz.Height = 50;
-- pShape->setPosition( pt );
-- pShape->setSize( sz );
--}
--
--void DiagramLayout::layout( const dgm::PointsTreePtr & pTree, const awt::Point & pt )
-+void DiagramLayout::layout( const dgm::Points & pTree, const awt::Point & pt )
- {
-+ // TODO
-+#if 0
- setPosition( pTree->getPoint(), pt );
- awt::Point nextPt = pt;
- nextPt.Y += 50;
-@@ -139,6 +111,7 @@ void DiagramLayout::layout( const dgm::PointsTreePtr & pTree, const awt::Point &
- layout( *iter, nextPt );
- nextPt.X += 50;
- }
-+#endif
- }
-
- void Diagram::setData( const DiagramDataPtr & pData)
-@@ -152,19 +125,244 @@ void Diagram::setLayout( const DiagramLayoutPtr & pLayout)
- mpLayout = pLayout;
- }
-
--void Diagram::setQStyles( const DiagramQStylesPtr & pStyles)
-+#if OSL_DEBUG_LEVEL > 1
-+rtl::OString normalizeDotName( const rtl::OUString& rStr )
- {
-- mpQStyles = pStyles;
--}
-+ rtl::OUStringBuffer aBuf;
-+ aBuf.append((sal_Unicode)'N');
-
-+ const sal_Int32 nLen(rStr.getLength());
-+ sal_Int32 nCurrIndex(0);
-+ while( nCurrIndex < nLen )
-+ {
-+ const sal_Int32 aChar=rStr.iterateCodePoints(&nCurrIndex);
-+ if( aChar != '-' && aChar != '{' && aChar != '}' )
-+ aBuf.append((sal_Unicode)aChar);
-+ }
-
--void Diagram::setColors( const DiagramColorsPtr & pColors)
-+ return rtl::OUStringToOString(aBuf.makeStringAndClear(),
-+ RTL_TEXTENCODING_UTF8);
-+}
-+#endif
-+
-+static sal_Int32 calcDepth( const rtl::OUString& rNodeName,
-+ const dgm::Connections& rCnx )
- {
-- mpColors = pColors;
-+ // find length of longest path in 'isChild' graph, ending with rNodeName
-+ dgm::Connections::const_iterator aCurrCxn( rCnx.begin() );
-+ const dgm::Connections::const_iterator aEndCxn( rCnx.end() );
-+ while( aCurrCxn != aEndCxn )
-+ {
-+ if( aCurrCxn->msParTransId.getLength() &&
-+ aCurrCxn->msSibTransId.getLength() &&
-+ aCurrCxn->msSourceId.getLength() &&
-+ aCurrCxn->msDestId.getLength() &&
-+ aCurrCxn->mnType != XML_presOf &&
-+ aCurrCxn->mnType != XML_presParOf &&
-+ rNodeName == aCurrCxn->msDestId )
-+ {
-+ return calcDepth(aCurrCxn->msSourceId,
-+ rCnx) + 1;
-+ }
-+ ++aCurrCxn;
-+ }
-+
-+ return 0;
- }
-
-+
- void Diagram::build( )
- {
-+ // build name-object maps
-+ // ======================
-+
-+#if OSL_DEBUG_LEVEL > 1
-+ std::ofstream output("/tmp/tree.dot");
-+
-+ output << "digraph datatree {" << std::endl;
-+#endif
-+
-+ dgm::Points::iterator aCurrPoint( getData()->getPoints( ).begin() );
-+ const dgm::Points::iterator aEndPoint( getData()->getPoints( ).end() );
-+ while( aCurrPoint != aEndPoint )
-+ {
-+#if OSL_DEBUG_LEVEL > 1
-+ output << "\t"
-+ << normalizeDotName(aCurrPoint->msModelId).getStr()
-+ << "[";
-+
-+ if( aCurrPoint->msPresentationLayoutName.getLength() )
-+ output << "label=\""
-+ << rtl::OUStringToOString(
-+ aCurrPoint->msPresentationLayoutName,
-+ RTL_TEXTENCODING_UTF8).getStr() << "\", ";
-+ else
-+ output << "label=\""
-+ << rtl::OUStringToOString(
-+ aCurrPoint->msModelId,
-+ RTL_TEXTENCODING_UTF8).getStr() << "\", ";
-+
-+ switch( aCurrPoint->mnType )
-+ {
-+ case XML_doc: output << "style=filled, color=red"; break;
-+ case XML_asst: output << "style=filled, color=green"; break;
-+ default:
-+ case XML_node: output << "style=filled, color=blue"; break;
-+ case XML_pres: output << "style=filled, color=yellow"; break;
-+ case XML_parTrans: output << "color=grey"; break;
-+ case XML_sibTrans: output << " "; break;
-+ }
-+
-+ output << "];" << std::endl;
-+
-+ // does currpoint have any text set?
-+ if( aCurrPoint->mpShape &&
-+ aCurrPoint->mpShape->getTextBody() &&
-+ !aCurrPoint->mpShape->getTextBody()->getParagraphs().empty() &&
-+ !aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
-+ {
-+ static sal_Int32 nCount=0;
-+
-+ output << "\t"
-+ << "textNode" << nCount
-+ << " ["
-+ << "label=\""
-+ << rtl::OUStringToOString(
-+ aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(),
-+ RTL_TEXTENCODING_UTF8).getStr()
-+ << "\"" << "];" << std::endl;
-+ output << "\t"
-+ << normalizeDotName(aCurrPoint->msModelId).getStr()
-+ << " -> "
-+ << "textNode" << nCount++
-+ << ";" << std::endl;
-+ }
-+
-+
-+#if 0
-+ // msPresentationAssociationId does not appear to be
-+ // valid/used, the relation this imposed for several examples
-+ // was ~broken
-+ if( aCurrPoint->msPresentationAssociationId.getLength() )
-+ output << "\t"
-+ << normalizeDotName(aCurrPoint->msModelId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrPoint->msPresentationAssociationId).getStr()
-+ << " [style=dotted, color=red, "
-+ << "label=\"presAssocID\"];" << std::endl;
-+#endif
-+
-+#endif
-+
-+ const bool bInserted1=getData()->getPointNameMap().insert(
-+ std::make_pair(aCurrPoint->msModelId,&(*aCurrPoint))).second;
-+ (void)bInserted1;
-+
-+ OSL_ENSURE(bInserted1,"Diagram::build(): non-unique point model id");
-+
-+ if( aCurrPoint->msPresentationLayoutName.getLength() )
-+ {
-+ DiagramData::PointsNameMap::value_type::second_type& rVec=
-+ getData()->getPointsPresNameMap()[aCurrPoint->msPresentationLayoutName];
-+ rVec.push_back(&(*aCurrPoint));
-+ }
-+ ++aCurrPoint;
-+ }
-+
-+ dgm::Connections::const_iterator aCurrCxn( getData()->getConnections( ).begin() );
-+ const dgm::Connections::const_iterator aEndCxn( getData()->getConnections( ).end() );
-+ while( aCurrCxn != aEndCxn )
-+ {
-+#if OSL_DEBUG_LEVEL > 1
-+ if( aCurrCxn->msParTransId.getLength() ||
-+ aCurrCxn->msSibTransId.getLength() )
-+ {
-+ if( aCurrCxn->msSourceId.getLength() ||
-+ aCurrCxn->msDestId.getLength() )
-+ {
-+ output << "\t"
-+ << normalizeDotName(aCurrCxn->msSourceId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrCxn->msParTransId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrCxn->msSibTransId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrCxn->msDestId).getStr()
-+ << " [style=dotted,"
-+ << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
-+ << "label=\""
-+ << rtl::OUStringToOString(aCurrCxn->msModelId,
-+ RTL_TEXTENCODING_UTF8 ).getStr()
-+ << "\"];" << std::endl;
-+ }
-+ else
-+ {
-+ output << "\t"
-+ << normalizeDotName(aCurrCxn->msParTransId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrCxn->msSibTransId).getStr()
-+ << " ["
-+ << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
-+ << "label=\""
-+ << rtl::OUStringToOString(aCurrCxn->msModelId,
-+ RTL_TEXTENCODING_UTF8 ).getStr()
-+ << "\"];" << std::endl;
-+ }
-+ }
-+ else if( aCurrCxn->msSourceId.getLength() ||
-+ aCurrCxn->msDestId.getLength() )
-+ output << "\t"
-+ << normalizeDotName(aCurrCxn->msSourceId).getStr()
-+ << " -> "
-+ << normalizeDotName(aCurrCxn->msDestId).getStr()
-+ << " [label=\""
-+ << rtl::OUStringToOString(aCurrCxn->msModelId,
-+ RTL_TEXTENCODING_UTF8 ).getStr()
-+ << ((aCurrCxn->mnType == XML_presOf) ? "\", color=red]" : ((aCurrCxn->mnType == XML_presParOf) ? "\", color=green]" : "\"]"))
-+ << ";" << std::endl;
-+#endif
-+
-+ const bool bInserted1=getData()->getConnectionNameMap().insert(
-+ std::make_pair(aCurrCxn->msModelId,&(*aCurrCxn))).second;
-+ (void)bInserted1;
-+
-+ OSL_ENSURE(bInserted1,"Diagram::build(): non-unique connection model id");
-+
-+ if( aCurrCxn->mnType == XML_presOf )
-+ {
-+ DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[aCurrCxn->msDestId];
-+ rVec.push_back(
-+ std::make_pair(
-+ aCurrCxn->msSourceId,sal_Int32(0)));
-+ }
-+
-+ ++aCurrCxn;
-+ }
-+
-+ // assign outline levels
-+ DiagramData::StringMap::iterator aPresOfIter=getData()->getPresOfNameMap().begin();
-+ const DiagramData::StringMap::iterator aPresOfEnd=getData()->getPresOfNameMap().end();
-+ while( aPresOfIter != aPresOfEnd )
-+ {
-+ DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeIterCalcLevel=aPresOfIter->second.begin();
-+ const DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeEnd=aPresOfIter->second.end();
-+ while(aPresOfNodeIterCalcLevel != aPresOfNodeEnd)
-+ {
-+ const sal_Int32 nDepth=calcDepth(aPresOfNodeIterCalcLevel->first,
-+ getData()->getConnections());
-+ aPresOfNodeIterCalcLevel->second = nDepth != 0 ? nDepth : -1;
-+ ++aPresOfNodeIterCalcLevel;
-+ }
-+
-+ ++aPresOfIter;
-+ }
-+
-+#if OSL_DEBUG_LEVEL > 1
-+ output << "}" << std::endl;
-+#endif
-+
-+ // TODO
-+#if 0
- OSL_TRACE( "building diagram" );
- typedef std::map< OUString, dgm::PointPtr > PointsMap;
- PointsMap aPointsMap;
-@@ -240,30 +438,33 @@ void Diagram::build( )
- }
- // check bounds
- OSL_ENSURE( aRoots.size() == 1, "more than one root" );
-- // #i92239# roots may be empty
-- if( !aRoots.empty() )
-- {
-- mpRoot = aRoots.begin()->second;
-- OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
-- for( PointsTreeMap::iterator iter = aTreeMap.begin();
-- iter != aTreeMap.end(); iter++ )
-- {
-- if(! iter->second->getParent() )
-- {
-- OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
-- }
-- }
-- }
-+ mpRoot = aRoots.begin()->second;
-+ OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
-+ for( PointsTreeMap::iterator iter = aTreeMap.begin();
-+ iter != aTreeMap.end(); iter++ )
-+ {
-+ if(! iter->second->getParent() )
-+ {
-+ OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
-+ }
-+ }
-+#endif
- }
-
-
- void Diagram::addTo( const ShapePtr & pParentShape )
- {
-+ // collect data, init maps
-+ build( );
-+
-+ // create Shape hierarchy
-+ ShapeCreationVisitor aCreationVisitor(pParentShape, *this);
-+ mpLayout->getNode()->accept(aCreationVisitor);
-+
-+#if 0
- dgm::Points & aPoints( mpData->getPoints( ) );
- dgm::Points::iterator aPointsIter;
-- build( );
-- if( mpRoot.get() )
-- mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
-+ mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
-
- for( aPointsIter = aPoints.begin(); aPointsIter != aPoints.end(); ++aPointsIter )
- {
-@@ -286,6 +487,7 @@ void Diagram::addTo( const ShapePtr & pParentShape )
- {
- OSL_TRACE( "Dgm: shape name %s", OUSTRING_TO_CSTR( (*iter)->getName() ) );
- }
-+#endif
- }
-
- OUString Diagram::getLayoutId() const
-@@ -298,5 +500,152 @@ OUString Diagram::getLayoutId() const
- return sLayoutId;
- }
-
-+uno::Reference<xml::dom::XDocument> loadFragment(
-+ core::XmlFilterBase& rFilter,
-+ const rtl::Reference< core::FragmentHandler >& rxHandler )
-+{
-+ // load diagramming fragments into DOM representation, that later
-+ // gets serialized back to SAX events and parsed
-+ return rFilter.importFragment( rxHandler->getFragmentPath() );
-+}
-+
-+void importFragment( core::XmlFilterBase& rFilter,
-+ const uno::Reference<xml::dom::XDocument>& rXDom,
-+ const char* pPropName,
-+ const ShapePtr& pShape,
-+ const rtl::Reference< core::FragmentHandler >& rxHandler )
-+{
-+ uno::Reference<xml::sax::XFastSAXSerializable> xSerializer(
-+ rXDom, uno::UNO_QUERY_THROW);
-+
-+ // now serialize DOM tree into internal data structures
-+ rFilter.importFragment( rxHandler, xSerializer );
-+
-+ // tack XDocument onto shape
-+ pShape->getShapeProperties().setProperty(
-+ OUString::createFromAscii(pPropName),
-+ rXDom);
-+}
-+
-+void loadDiagram( const ShapePtr& pShape,
-+ core::XmlFilterBase& rFilter,
-+ const ::rtl::OUString& rDataModelPath,
-+ const ::rtl::OUString& rLayoutPath,
-+ const ::rtl::OUString& rQStylePath,
-+ const ::rtl::OUString& rColorStylePath )
-+{
-+ DiagramPtr pDiagram( new Diagram() );
-+
-+ DiagramDataPtr pData( new DiagramData() );
-+ pDiagram->setData( pData );
-+
-+ DiagramLayoutPtr pLayout( new DiagramLayout() );
-+ pDiagram->setLayout( pLayout );
-+
-+ // data
-+ if( rDataModelPath.getLength() > 0 )
-+ {
-+ rtl::Reference< core::FragmentHandler > xRef(
-+ new DiagramDataFragmentHandler( rFilter, rDataModelPath, pData ));
-+
-+ importFragment(rFilter,
-+ loadFragment(rFilter,xRef),
-+ "DiagramData",
-+ pShape,
-+ xRef);
-+ }
-+
-+ // layout
-+ if( rLayoutPath.getLength() > 0 )
-+ {
-+ rtl::Reference< core::FragmentHandler > xRef(
-+ new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
-+ importFragment(rFilter,
-+ loadFragment(rFilter,xRef),
-+ "DiagramLayout",
-+ pShape,
-+ xRef);
-+ }
-+
-+ // style
-+ if( rQStylePath.getLength() > 0 )
-+ {
-+ rtl::Reference< core::FragmentHandler > xRef(
-+ new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
-+ importFragment(rFilter,
-+ loadFragment(rFilter,xRef),
-+ "DiagramQStyle",
-+ pShape,
-+ xRef);
-+ }
-+
-+ // colors
-+ if( rColorStylePath.getLength() > 0 )
-+ {
-+ rtl::Reference< core::FragmentHandler > xRef(
-+ new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
-+ importFragment(rFilter,
-+ loadFragment(rFilter,xRef),
-+ "DiagramColorStyle",
-+ pShape,
-+ xRef);
-+ }
-+
-+ // diagram loaded. now lump together & attach to shape
-+ pDiagram->addTo(pShape);
-+}
-+
-+void loadDiagram( const ShapePtr& pShape,
-+ core::XmlFilterBase& rFilter,
-+ const uno::Reference<xml::dom::XDocument>& rXDataModelDom,
-+ const uno::Reference<xml::dom::XDocument>& rXLayoutDom,
-+ const uno::Reference<xml::dom::XDocument>& rXQStyleDom,
-+ const uno::Reference<xml::dom::XDocument>& rXColorStyleDom )
-+{
-+ DiagramPtr pDiagram( new Diagram() );
-+
-+ DiagramDataPtr pData( new DiagramData() );
-+ pDiagram->setData( pData );
-+
-+ DiagramLayoutPtr pLayout( new DiagramLayout() );
-+ pDiagram->setLayout( pLayout );
-+
-+ OUString aEmpty;
-+
-+ // data
-+ if( rXDataModelDom.is() )
-+ importFragment(rFilter,
-+ rXDataModelDom,
-+ "DiagramData",
-+ pShape,
-+ new DiagramDataFragmentHandler( rFilter, aEmpty, pData ));
-+
-+ // layout
-+ if( rXLayoutDom.is() )
-+ importFragment(rFilter,
-+ rXLayoutDom,
-+ "DiagramLayout",
-+ pShape,
-+ new DiagramLayoutFragmentHandler( rFilter, aEmpty, pLayout ));
-+
-+ // style
-+ if( rXQStyleDom.is() )
-+ importFragment(rFilter,
-+ rXQStyleDom,
-+ "DiagramQStyle",
-+ pShape,
-+ new DiagramQStylesFragmentHandler( rFilter, aEmpty, pDiagram->getStyles() ));
-+
-+ // colors
-+ if( rXColorStyleDom.is() )
-+ importFragment(rFilter,
-+ rXColorStyleDom,
-+ "DiagramColorStyle",
-+ pShape,
-+ new ColorFragmentHandler( rFilter, aEmpty, pDiagram->getColors() ));
-+
-+ // diagram loaded. now lump together & attach to shape
-+ pDiagram->addTo(pShape);
-+}
-
- } }
-diff --git oox/source/drawingml/diagram/diagram.hxx oox/source/drawingml/diagram/diagram.hxx
-new file mode 100644
-index 0000000..cb932d4
---- /dev/null
-+++ oox/source/drawingml/diagram/diagram.hxx
-@@ -0,0 +1,320 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * 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 OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
-+#define OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
-+
-+#include <map>
-+#include <vector>
-+
-+#include <boost/shared_ptr.hpp>
-+#include <boost/enable_shared_from_this.hpp>
-+
-+#include <rtl/ustring.hxx>
-+
-+#include "oox/drawingml/shape.hxx"
-+#include "oox/drawingml/fillproperties.hxx"
-+#include "tokens.hxx"
-+
-+namespace com { namespace sun { namespace star {
-+ namespace xml { namespace dom { class XDocument; } }
-+} } }
-+
-+namespace oox { namespace drawingml {
-+
-+namespace dgm {
-+
-+/** A Connection
-+ */
-+struct Connection
-+{
-+ Connection() :
-+ mnType( 0 ),
-+ mnSourceOrder( 0 ),
-+ mnDestOrder( 0 )
-+ {}
-+
-+ void dump();
-+
-+ sal_Int32 mnType;
-+ ::rtl::OUString msModelId;
-+ ::rtl::OUString msSourceId;
-+ ::rtl::OUString msDestId;
-+ ::rtl::OUString msParTransId;
-+ ::rtl::OUString msPresId;
-+ ::rtl::OUString msSibTransId;
-+ sal_Int32 mnSourceOrder;
-+ sal_Int32 mnDestOrder;
-+
-+};
-+
-+typedef std::vector< Connection > Connections;
-+
-+
-+/** A point
-+ */
-+struct Point
-+{
-+ Point() :
-+ mnType(0),
-+ mnMaxChildren(-1),
-+ mnPreferredChildren(-1),
-+ mnDirection(XML_norm),
-+ mnHierarchyBranch(XML_std),
-+ mnResizeHandles(XML_rel),
-+ mnCustomAngle(-1),
-+ mnPercentageNeighbourWidth(-1),
-+ mnPercentageNeighbourHeight(-1),
-+ mnPercentageOwnWidth(-1),
-+ mnPercentageOwnHeight(-1),
-+ mnIncludeAngleScale(-1),
-+ mnRadiusScale(-1),
-+ mnWidthScale(-1),
-+ mnHeightScale(-1),
-+ mnWidthOverride(-1),
-+ mnHeightOverride(-1),
-+ mnLayoutStyleCount(-1),
-+ mnLayoutStyleIndex(-1),
-+
-+ mbOrgChartEnabled(false),
-+ mbBulletEnabled(false),
-+ mbCoherent3DOffset(false),
-+ mbCustomHorizontalFlip(false),
-+ mbCustomVerticalFlip(false),
-+ mbCustomText(false),
-+ mbIsPlaceholder(false)
-+ {}
-+ void dump();
-+
-+ ShapePtr mpShape;
-+
-+ rtl::OUString msCnxId;
-+ rtl::OUString msModelId;
-+ rtl::OUString msColorTransformCategoryId;
-+ rtl::OUString msColorTransformTypeId;
-+ rtl::OUString msLayoutCategoryId;
-+ rtl::OUString msLayoutTypeId;
-+ rtl::OUString msPlaceholderText;
-+ rtl::OUString msPresentationAssociationId;
-+ rtl::OUString msPresentationLayoutName;
-+ rtl::OUString msPresentationLayoutStyleLabel;
-+ rtl::OUString msQuickStyleCategoryId;
-+ rtl::OUString msQuickStyleTypeId;
-+
-+ sal_Int32 mnType;
-+ sal_Int32 mnMaxChildren;
-+ sal_Int32 mnPreferredChildren;
-+ sal_Int32 mnDirection;
-+ sal_Int32 mnHierarchyBranch;
-+ sal_Int32 mnResizeHandles;
-+ sal_Int32 mnCustomAngle;
-+ sal_Int32 mnPercentageNeighbourWidth;
-+ sal_Int32 mnPercentageNeighbourHeight;
-+ sal_Int32 mnPercentageOwnWidth;
-+ sal_Int32 mnPercentageOwnHeight;
-+ sal_Int32 mnIncludeAngleScale;
-+ sal_Int32 mnRadiusScale;
-+ sal_Int32 mnWidthScale;
-+ sal_Int32 mnHeightScale;
-+ sal_Int32 mnWidthOverride;
-+ sal_Int32 mnHeightOverride;
-+ sal_Int32 mnLayoutStyleCount;
-+ sal_Int32 mnLayoutStyleIndex;
-+
-+ bool mbOrgChartEnabled;
-+ bool mbBulletEnabled;
-+ bool mbCoherent3DOffset;
-+ bool mbCustomHorizontalFlip;
-+ bool mbCustomVerticalFlip;
-+ bool mbCustomText;
-+ bool mbIsPlaceholder;
-+};
-+
-+typedef std::vector< Point > Points;
-+
-+}
-+
-+class LayoutNode;
-+typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
-+
-+////////////////////
-+
-+class DiagramData
-+{
-+public:
-+ typedef std::map< rtl::OUString, dgm::Point* > PointNameMap;
-+ typedef std::map< rtl::OUString,
-+ std::vector<dgm::Point*> > PointsNameMap;
-+ typedef std::map< rtl::OUString, const dgm::Connection* > ConnectionNameMap;
-+ typedef std::map< rtl::OUString,
-+ std::vector<std::pair<rtl::OUString,sal_Int32> > > StringMap;
-+
-+ DiagramData();
-+ FillPropertiesPtr & getFillProperties()
-+ { return mpFillProperties; }
-+ dgm::Connections & getConnections()
-+ { return maConnections; }
-+ dgm::Points & getPoints()
-+ { return maPoints; }
-+ ConnectionNameMap & getConnectionNameMap()
-+ { return maConnectionNameMap; }
-+ StringMap & getPresOfNameMap()
-+ { return maPresOfNameMap; }
-+ PointNameMap & getPointNameMap()
-+ { return maPointNameMap; }
-+ PointsNameMap & getPointsPresNameMap()
-+ { return maPointsPresNameMap; }
-+ void dump();
-+private:
-+ FillPropertiesPtr mpFillProperties;
-+ dgm::Connections maConnections;
-+ dgm::Points maPoints;
-+ PointNameMap maPointNameMap;
-+ PointsNameMap maPointsPresNameMap;
-+ ConnectionNameMap maConnectionNameMap;
-+ StringMap maPresOfNameMap;
-+};
-+
-+typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
-+
-+
-+
-+////////////////////
-+
-+class DiagramLayout
-+{
-+public:
-+ void setDefStyle( const ::rtl::OUString & sDefStyle )
-+ { msDefStyle = sDefStyle; }
-+ void setMinVer( const ::rtl::OUString & sMinVer )
-+ { msMinVer = sMinVer; }
-+ void setUniqueId( const ::rtl::OUString & sUniqueId )
-+ { msUniqueId = sUniqueId; }
-+ const ::rtl::OUString & getUniqueId()
-+ { return msUniqueId; }
-+ void setTitle( const ::rtl::OUString & sTitle )
-+ { msTitle = sTitle; }
-+ void setDesc( const ::rtl::OUString & sDesc )
-+ { msDesc = sDesc; }
-+
-+ LayoutNodePtr & getNode()
-+ { return mpNode; }
-+ const LayoutNodePtr & getNode() const
-+ { return mpNode; }
-+ DiagramDataPtr & getSampData()
-+ { return mpSampData; }
-+ const DiagramDataPtr & getSampData() const
-+ { return mpSampData; }
-+ DiagramDataPtr & getStyleData()
-+ { return mpStyleData; }
-+ const DiagramDataPtr & getStyleData() const
-+ { return mpStyleData; }
-+
-+ void layout( const dgm::Points & pTree, const com::sun::star::awt::Point & pt );
-+
-+private:
-+ ::rtl::OUString msDefStyle;
-+ ::rtl::OUString msMinVer;
-+ ::rtl::OUString msUniqueId;
-+
-+ ::rtl::OUString msTitle;
-+ ::rtl::OUString msDesc;
-+ LayoutNodePtr mpNode;
-+ DiagramDataPtr mpSampData;
-+ DiagramDataPtr mpStyleData;
-+ // TODO
-+ // catLst
-+ // clrData
-+};
-+
-+typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
-+
-+///////////////////////
-+
-+struct DiagramStyle
-+{
-+ ShapeStyleRef maFillStyle;
-+ ShapeStyleRef maLineStyle;
-+ ShapeStyleRef maEffectStyle;
-+ ShapeStyleRef maTextStyle;
-+};
-+
-+typedef std::map<rtl::OUString,DiagramStyle> DiagramQStyleMap;
-+
-+struct DiagramColor
-+{
-+ oox::drawingml::Color maFillColor;
-+ oox::drawingml::Color maLineColor;
-+ oox::drawingml::Color maEffectColor;
-+ oox::drawingml::Color maTextFillColor;
-+ oox::drawingml::Color maTextLineColor;
-+ oox::drawingml::Color maTextEffectColor;
-+};
-+
-+typedef std::map<rtl::OUString,DiagramColor> DiagramColorMap;
-+
-+///////////////////////
-+
-+class Diagram
-+{
-+public:
-+ void setData( const DiagramDataPtr & );
-+ DiagramDataPtr getData() const
-+ {
-+ return mpData;
-+ }
-+ void setLayout( const DiagramLayoutPtr & );
-+ DiagramLayoutPtr getLayout() const
-+ {
-+ return mpLayout;
-+ }
-+
-+ DiagramQStyleMap& getStyles() { return maStyles; }
-+ const DiagramQStyleMap& getStyles() const { return maStyles; }
-+ DiagramColorMap& getColors() { return maColors; }
-+ const DiagramColorMap& getColors() const { return maColors; }
-+
-+ void addTo( const ShapePtr & pShape );
-+ ::rtl::OUString getLayoutId() const;
-+private:
-+ void build( );
-+ DiagramDataPtr mpData;
-+ DiagramLayoutPtr mpLayout;
-+ DiagramQStyleMap maStyles;
-+ DiagramColorMap maColors;
-+ std::map< ::rtl::OUString, ShapePtr > maShapeMap;
-+};
-+
-+
-+typedef boost::shared_ptr< Diagram > DiagramPtr;
-+
-+} }
-+
-+#endif
-diff --git oox/source/drawingml/diagram/diagramdefinitioncontext.cxx oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
-index e4ba441..4098d40 100644
---- oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
-+++ oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
-@@ -30,10 +30,9 @@
-
- #include "oox/core/skipcontext.hxx"
- #include "oox/core/namespaces.hxx"
--#include "oox/helper/helper.hxx"
--#include "layoutnodecontext.hxx"
- #include "diagramdefinitioncontext.hxx"
--#include "oox/drawingml/diagram/datamodelcontext.hxx"
-+#include "layoutnodecontext.hxx"
-+#include "datamodelcontext.hxx"
- #include "tokens.hxx"
-
- using namespace ::oox::core;
-@@ -91,9 +90,15 @@ DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement,
- mpLayout->setDesc( xAttribs->getOptionalValue( XML_val ) );
- break;
- case NMSP_DIAGRAM|XML_layoutNode:
-- mpLayout->getNode().reset( new LayoutNode() );
-- xRet.set( new LayoutNodeContext( *this, xAttribs, mpLayout->getNode() ) );
-+ {
-+ LayoutNodePtr pNode( new LayoutNode() );
-+ mpLayout->getNode() = pNode;
-+ pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
-+ pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
-+ pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
-+ xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
- break;
-+ }
- case NMSP_DIAGRAM|XML_clrData:
- // TODO, does not matter for the UI. skip.
- xRet.set( new SkipContext( *this ) );
-diff --git oox/source/drawingml/diagram/diagramdefinitioncontext.hxx oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
-index bfe44ca..ed0ec6a 100644
---- oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
-+++ oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
-@@ -32,7 +32,7 @@
- #define OOX_DRAWINGML_DIAGRAMDEFINITIONCONTEXT_HXX
-
- #include "oox/core/contexthandler.hxx"
--#include "oox/drawingml/diagram/diagram.hxx"
-+#include "diagram.hxx"
-
- namespace oox { namespace drawingml {
-
-diff --git oox/source/drawingml/diagram/diagramfragmenthandler.cxx oox/source/drawingml/diagram/diagramfragmenthandler.cxx
-index 00ad2a8..a4e5b66 100644
---- oox/source/drawingml/diagram/diagramfragmenthandler.cxx
-+++ oox/source/drawingml/diagram/diagramfragmenthandler.cxx
-@@ -30,10 +30,12 @@
-
- #include <osl/diagnose.h>
-
--#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
--#include "oox/drawingml/diagram/datamodelcontext.hxx"
- #include "oox/core/namespaces.hxx"
-+#include "oox/drawingml/colorchoicecontext.hxx"
-+#include "oox/drawingml/stylematrixreferencecontext.hxx"
- #include "diagramdefinitioncontext.hxx"
-+#include "diagramfragmenthandler.hxx"
-+#include "datamodelcontext.hxx"
- #include "tokens.hxx"
-
- using namespace ::oox::core;
-@@ -134,94 +136,144 @@ DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
- ///////////////////////
-
- DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFilter,
-- const OUString& rFragmentPath,
-- const DiagramQStylesPtr pDataPtr )
-- throw( )
-- : FragmentHandler( rFilter, rFragmentPath )
-- , mpDataPtr( pDataPtr )
-+ const OUString& rFragmentPath,
-+ DiagramQStyleMap& rStylesMap ) :
-+ FragmentHandler2( rFilter, rFragmentPath ),
-+ maStyleName(),
-+ maStyleEntry(),
-+ mrStylesMap( rStylesMap )
-+{}
-+
-+::oox::core::ContextWrapper DiagramQStylesFragmentHandler::createStyleMatrixContext(
-+ sal_Int32 nElement,
-+ const AttributeList& rAttribs,
-+ ShapeStyleRef& o_rStyle )
- {
-+ o_rStyle.mnThemedIdx = (nElement == (NMSP_DRAWINGML|XML_fontRef)) ?
-+ rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 );
-+ return new StyleMatrixReferenceContext( *this,
-+ o_rStyle.maPhClr );
- }
-
--DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw ()
-+::oox::core::ContextWrapper DiagramQStylesFragmentHandler::onCreateContext( sal_Int32 nElement,
-+ const AttributeList& rAttribs )
- {
-+ // state-table like way of navigating the color fragment. we
-+ // currently ignore everything except styleLbl in the colorsDef
-+ // element
-+ switch( getCurrentElement() )
-+ {
-+ case XML_ROOT_CONTEXT:
-+ return nElement == (NMSP_DIAGRAM|XML_styleDef);
-+ case NMSP_DIAGRAM|XML_styleDef:
-+ return nElement == (NMSP_DIAGRAM|XML_styleLbl);
-+ case NMSP_DIAGRAM|XML_styleLbl:
-+ return nElement == (NMSP_DIAGRAM|XML_style);
-+ case NMSP_DIAGRAM|XML_style:
-+ {
-+ switch( nElement )
-+ {
-+ case NMSP_DRAWINGML|XML_lnRef : // CT_StyleMatrixReference
-+ return createStyleMatrixContext(nElement,rAttribs,
-+ maStyleEntry.maLineStyle);
-+ case NMSP_DRAWINGML|XML_fillRef : // CT_StyleMatrixReference
-+ return createStyleMatrixContext(nElement,rAttribs,
-+ maStyleEntry.maFillStyle);
-+ case NMSP_DRAWINGML|XML_effectRef : // CT_StyleMatrixReference
-+ return createStyleMatrixContext(nElement,rAttribs,
-+ maStyleEntry.maEffectStyle);
-+ case NMSP_DRAWINGML|XML_fontRef : // CT_FontRe ference
-+ return createStyleMatrixContext(nElement,rAttribs,
-+ maStyleEntry.maTextStyle);
-+ }
-+ return false;
-+ }
-+ }
-
-+ return false;
- }
-
--void SAL_CALL DiagramQStylesFragmentHandler::endDocument()
-- throw (SAXException, RuntimeException)
-+void DiagramQStylesFragmentHandler::onStartElement( const AttributeList& rAttribs )
- {
--
-+ if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
-+ {
-+ maStyleName = rAttribs.getString( XML_name, OUString() );
-+ maStyleEntry = mrStylesMap[maStyleName];
-+ }
- }
-
--
--Reference< XFastContextHandler > SAL_CALL
--DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
-- const Reference< XFastAttributeList >& )
-- throw ( SAXException, RuntimeException)
-+void DiagramQStylesFragmentHandler::onEndElement( const ::rtl::OUString& )
- {
-- Reference< XFastContextHandler > xRet;
--
-- switch( aElement )
-- {
-- case NMSP_DIAGRAM|XML_styleDef:
-- // TODO
-- break;
-- default:
-- break;
-- }
--
-- if( !xRet.is() )
-- xRet = getFastContextHandler();
--
-- return xRet;
-+ if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
-+ mrStylesMap[maStyleName] = maStyleEntry;
- }
-
--/////////////////////
--
--DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase& rFilter,
-- const OUString& rFragmentPath,
-- const DiagramColorsPtr pDataPtr )
-- throw( )
-- : FragmentHandler( rFilter, rFragmentPath )
-- , mpDataPtr( pDataPtr )
--{
--}
-+///////////////////////
-
--DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw ()
-+ColorFragmentHandler::ColorFragmentHandler( ::oox::core::XmlFilterBase& rFilter,
-+ const ::rtl::OUString& rFragmentPath,
-+ DiagramColorMap& rColorsMap ) :
-+ FragmentHandler2(rFilter,rFragmentPath),
-+ maColorName(),
-+ maColorEntry(),
-+ mrColorsMap(rColorsMap)
-+{}
-+
-+::oox::core::ContextWrapper ColorFragmentHandler::onCreateContext( sal_Int32 nElement,
-+ const AttributeList& /*rAttribs*/ )
- {
-+ // state-table like way of navigating the color fragment. we
-+ // currently ignore everything except styleLbl in the colorsDef
-+ // element
-+ switch( getCurrentElement() )
-+ {
-+ case XML_ROOT_CONTEXT:
-+ return nElement == (NMSP_DIAGRAM|XML_colorsDef);
-+ case NMSP_DIAGRAM|XML_colorsDef:
-+ return nElement == (NMSP_DIAGRAM|XML_styleLbl);
-+ case NMSP_DIAGRAM|XML_styleLbl:
-+ return (nElement == (NMSP_DIAGRAM|XML_fillClrLst)) ||
-+ (nElement == (NMSP_DIAGRAM|XML_linClrLst)) ||
-+ (nElement == (NMSP_DIAGRAM|XML_effectClrLst)) ||
-+ (nElement == (NMSP_DIAGRAM|XML_txLinClrLst)) ||
-+ (nElement == (NMSP_DIAGRAM|XML_txFillClrLst)) ||
-+ (nElement == (NMSP_DIAGRAM|XML_txEffectClrLst));
-+
-+ // the actual colors - defer to color fragment handlers.
-+
-+ // TODO(F1): well, actually, there might be *several* color
-+ // definitions in it, after all it's called list. but
-+ // apparently colorChoiceContext doesn't handle that anyway...
-+ case NMSP_DIAGRAM|XML_fillClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maFillColor );
-+ case NMSP_DIAGRAM|XML_linClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maLineColor );
-+ case NMSP_DIAGRAM|XML_effectClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maEffectColor );
-+ case NMSP_DIAGRAM|XML_txFillClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maTextFillColor );
-+ case NMSP_DIAGRAM|XML_txLinClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maTextLineColor );
-+ case NMSP_DIAGRAM|XML_txEffectClrLst:
-+ return new colorChoiceContext( *this, maColorEntry.maTextEffectColor );
-+ }
-
-+ return false;
- }
-
--void SAL_CALL DiagramColorsFragmentHandler::endDocument()
-- throw (SAXException, RuntimeException)
-+void ColorFragmentHandler::onStartElement( const AttributeList& rAttribs )
- {
--
-+ if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
-+ {
-+ maColorName = rAttribs.getString( XML_name, OUString() );
-+ maColorEntry = mrColorsMap[maColorName];
-+ }
- }
-
--
--Reference< XFastContextHandler > SAL_CALL
--DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
-- const Reference< XFastAttributeList >& )
-- throw ( SAXException, RuntimeException)
-+void ColorFragmentHandler::onEndElement( const ::rtl::OUString& )
- {
-- Reference< XFastContextHandler > xRet;
--
-- switch( aElement )
-- {
-- case NMSP_DIAGRAM|XML_colorsDef:
-- // TODO
-- break;
-- default:
-- break;
-- }
--
-- if( !xRet.is() )
-- xRet = getFastContextHandler();
--
-- return xRet;
-+ if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
-+ mrColorsMap[maColorName] = maColorEntry;
- }
-
--
--
--
- } }
-diff --git oox/source/drawingml/diagram/diagramfragmenthandler.hxx oox/source/drawingml/diagram/diagramfragmenthandler.hxx
-new file mode 100644
-index 0000000..67bfbb2
---- /dev/null
-+++ oox/source/drawingml/diagram/diagramfragmenthandler.hxx
-@@ -0,0 +1,117 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: diagramfragmenthandler.hxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * 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 OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
-+#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
-+
-+#include "oox/core/fragmenthandler.hxx"
-+#include "oox/core/fragmenthandler2.hxx"
-+#include "oox/drawingml/diagram/diagram.hxx"
-+
-+namespace oox { namespace drawingml {
-+
-+
-+class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
-+{
-+public:
-+ DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
-+ virtual ~DiagramDataFragmentHandler() throw();
-+
-+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+
-+private:
-+
-+ DiagramDataPtr mpDataPtr;
-+};
-+
-+
-+
-+class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
-+{
-+public:
-+ DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
-+ virtual ~DiagramLayoutFragmentHandler() throw();
-+
-+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-+
-+private:
-+
-+ DiagramLayoutPtr mpDataPtr;
-+};
-+
-+class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler2
-+{
-+public:
-+ DiagramQStylesFragmentHandler(
-+ oox::core::XmlFilterBase& rFilter,
-+ const ::rtl::OUString& rFragmentPath,
-+ DiagramQStyleMap& rStylesMap );
-+
-+ virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
-+
-+ virtual void onStartElement( const AttributeList& rAttribs );
-+ virtual void onEndElement( const ::rtl::OUString& rChars );
-+
-+private:
-+ ::oox::core::ContextWrapper createStyleMatrixContext(sal_Int32 nElement,
-+ const AttributeList& rAttribs,
-+ ShapeStyleRef& o_rStyle);
-+
-+ ::rtl::OUString maStyleName;
-+ DiagramStyle maStyleEntry;
-+ DiagramQStyleMap& mrStylesMap;
-+};
-+
-+class ColorFragmentHandler : public ::oox::core::FragmentHandler2
-+{
-+public:
-+ ColorFragmentHandler(
-+ ::oox::core::XmlFilterBase& rFilter,
-+ const ::rtl::OUString& rFragmentPath,
-+ DiagramColorMap& rColorMap );
-+
-+ virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
-+
-+ virtual void onStartElement( const AttributeList& rAttribs );
-+ virtual void onEndElement( const ::rtl::OUString& rChars );
-+
-+private:
-+ ::rtl::OUString maColorName;
-+ DiagramColor maColorEntry;
-+ DiagramColorMap& mrColorsMap;
-+};
-+
-+} }
-+
-+
-+#endif
-diff --git oox/source/drawingml/diagram/diagramlayoutatoms.cxx oox/source/drawingml/diagram/diagramlayoutatoms.cxx
-index 4b1d6e4..654c2c5 100644
---- oox/source/drawingml/diagram/diagramlayoutatoms.cxx
-+++ oox/source/drawingml/diagram/diagramlayoutatoms.cxx
-@@ -28,14 +28,24 @@
- *
- ************************************************************************/
-
--#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
-+#include "diagramlayoutatoms.hxx"
-
- #include <functional>
- #include <boost/bind.hpp>
-
-+#include <basegfx/numeric/ftools.hxx>
-+
- #include "oox/helper/attributelist.hxx"
-+#include "oox/drawingml/customshapeproperties.hxx"
-+#include "oox/drawingml/fillproperties.hxx"
-+#include "oox/drawingml/lineproperties.hxx"
-+#include "oox/drawingml/textbody.hxx"
-+#include "oox/drawingml/textparagraph.hxx"
-+#include "oox/drawingml/textrun.hxx"
-+#include "diagramlayoutatoms.hxx"
- #include "layoutnodecontext.hxx"
-
-+using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::xml::sax;
- using namespace ::oox::core;
-@@ -45,7 +55,7 @@ namespace oox { namespace drawingml {
-
- IteratorAttr::IteratorAttr( )
- : mnAxis( 0 )
-- , mnCnt( 0 )
-+ , mnCnt( -1 )
- , mbHideLastTrans( false )
- , mnPtType( 0 )
- , mnSt( 0 )
-@@ -57,7 +67,7 @@ void IteratorAttr::loadFromXAttr( const Reference< XFastAttributeList >& xAttr )
- {
- AttributeList attr( xAttr );
- mnAxis = xAttr->getOptionalValueToken( XML_axis, 0 );
-- mnCnt = attr.getInteger( XML_cnt, 0 );
-+ mnCnt = attr.getInteger( XML_cnt, -1 );
- mbHideLastTrans = attr.getBool( XML_hideLastTrans, false );
- mnPtType = xAttr->getOptionalValueToken( XML_ptType, 0 );
- mnSt = attr.getInteger( XML_st, 0 );
-@@ -90,55 +100,803 @@ void LayoutAtom::dump(int level)
- OSL_TRACE( "level = %d - %s of type %s", level,
- OUSTRING_TO_CSTR( msName ),
- typeid(*this).name() );
-- std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
-- boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
-+ const std::vector<LayoutAtomPtr>& pChildren=getChildren();
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
-+}
-+
-+
-+ForEachAtom::ForEachAtom(const Reference< XFastAttributeList >& xAttributes)
-+{
-+ maIter.loadFromXAttr(xAttributes);
-+}
-+
-+void ForEachAtom::accept( LayoutAtomVisitor& rVisitor )
-+{
-+ rVisitor.visit(*this);
- }
-
-+void ChooseAtom::accept( LayoutAtomVisitor& rVisitor )
-+{
-+ rVisitor.visit(*this);
-+}
-
--void ForEachAtom::processAtom()
-+ConditionAtom::ConditionAtom(const Reference< XFastAttributeList >& xAttributes) :
-+ mbElse( false )
- {
-- // TODO there is likely some conditions
-- std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
-- boost::bind( &LayoutAtom::processAtom, _1 ) );
-+ maIter.loadFromXAttr( xAttributes );
-+ maCond.loadFromXAttr( xAttributes );
- }
-
--/** call ConditionAtom::test() if pAtom is one
-- * if it is not a ConditionAtom, then return false.
-- */
--static bool _test_atom( const LayoutAtomPtr & pAtom)
-+const std::vector<LayoutAtomPtr>& ConditionAtom::getChildren() const
- {
-- try {
-- bool bResult = false;
-- const ConditionAtomPtr pCond = boost::dynamic_pointer_cast< ConditionAtom >(pAtom);
-- if( pCond )
-- {
-- bResult = pCond->test();
-- }
-- return bResult;
-- }
-- catch(...)
-- {
-- }
-- return false;
-+ bool bDecisionVar=true;
-+ // HACK
-+ if( maCond.mnFunc==XML_var && maCond.mnArg==XML_dir &&
-+ maCond.mnOp==XML_equ && !maCond.msVal.equalsAscii("norm") )
-+ bDecisionVar=false;
-+
-+ if( bDecisionVar )
-+ return mpChildNodes;
-+ else
-+ return mpElseChildNodes;
- }
-
--void ChooseAtom::processAtom()
-+void ConditionAtom::accept( LayoutAtomVisitor& rVisitor )
- {
-- std::vector< LayoutAtomPtr >::iterator
-- iter = std::find_if( mpChildNodes.begin(), mpChildNodes.end(),
-- boost::bind( &_test_atom, _1 ) );
-- if( iter != mpChildNodes.end() )
-- {
-- // TODO do something
-- (*iter)->processAtom();
-- }
-+ rVisitor.visit(*this);
- }
-
--bool ConditionAtom::test()
-+void ConditionAtom::addChild( const LayoutAtomPtr & pNode )
- {
-- // TODO
-- return false;
-+ if( mbElse )
-+ mpElseChildNodes.push_back( pNode );
-+ else
-+ mpChildNodes.push_back( pNode );
- }
-
-+void ConstraintAtom::accept( LayoutAtomVisitor& rVisitor )
-+{
-+ rVisitor.visit(*this);
-+}
-+
-+void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
-+{
-+ rVisitor.visit(*this);
-+}
-+
-+void AlgAtom::layoutShape( const ShapePtr& rShape,
-+ const Diagram& rDgm,
-+ const rtl::OUString& rName ) const
-+{
-+ switch(mnType)
-+ {
-+ case XML_composite:
-+ {
-+ if( rShape->getChildren().empty() )
-+ {
-+ rShape->setSize(awt::Size(50,50));
-+ break;
-+ }
-+
-+ // just put stuff below each other
-+ const sal_Int32 nIncX=0;
-+ const sal_Int32 nIncY=1;
-+
-+ std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
-+ const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-+
-+ // find biggest shape
-+ awt::Size aMaxSize;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ aMaxSize.Width = std::max(
-+ aMaxSize.Width,
-+ sz.Width);
-+ aMaxSize.Height = std::max(
-+ aMaxSize.Height,
-+ sz.Height);
-+
-+ ++aCurrShape;
-+ }
-+
-+ aCurrShape=rShape->getChildren().begin();
-+ const awt::Point aStartPos=(*aCurrShape)->getPosition();
-+ awt::Point aCurrPos=aStartPos;
-+ awt::Size aTotalSize;
-+ aTotalSize.Width = aMaxSize.Width;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+ (*aCurrShape)->setPosition(aCurrPos);
-+ (*aCurrShape)->setSize(
-+ awt::Size(aMaxSize.Width,
-+ sz.Height));
-+
-+ aTotalSize.Height = std::max(
-+ aTotalSize.Height,
-+ aCurrPos.Y + sz.Height);
-+
-+ aCurrPos.X += nIncX*sz.Width;
-+ aCurrPos.Y += nIncY*sz.Height;
-+
-+ ++aCurrShape;
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ break;
-+ }
-+
-+ case XML_conn:
-+ break;
-+
-+ case XML_cycle:
-+ {
-+ if( rShape->getChildren().empty() )
-+ {
-+ rShape->setSize(awt::Size(50,50));
-+ break;
-+ }
-+
-+ const sal_Int32 nStartAngle=maMap.count(XML_stAng) ? maMap.find(XML_stAng)->second : 0;
-+ const sal_Int32 nSpanAngle=maMap.count(XML_spanAng) ? maMap.find(XML_spanAng)->second : 360;
-+
-+ std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
-+ const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-+ const sal_Int32 nShapes=aLastShape-aCurrShape;
-+
-+ // find biggest shape
-+ awt::Size aMaxSize;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ aMaxSize.Width = std::max(
-+ aMaxSize.Width,
-+ sz.Width);
-+ aMaxSize.Height = std::max(
-+ aMaxSize.Height,
-+ sz.Height);
-+
-+ ++aCurrShape;
-+ }
-+
-+ // layout shapes
-+ const sal_Int32 nMaxDim=std::max(aMaxSize.Width,aMaxSize.Height);
-+ awt::Size aTotalSize;
-+ aCurrShape=rShape->getChildren().begin();
-+ for( sal_Int32 i=0; i<nShapes; ++i, ++aCurrShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ const double r=nShapes*nMaxDim/F_2PI * 360.0/nSpanAngle;
-+ const awt::Point aCurrPos(
-+ r + r*sin( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ),
-+ r - r*cos( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ) );
-+ (*aCurrShape)->setPosition(aCurrPos);
-+
-+ aTotalSize.Width = std::max(
-+ aTotalSize.Width,
-+ aCurrPos.X + sz.Width);
-+ aTotalSize.Height = std::max(
-+ aTotalSize.Height,
-+ aCurrPos.Y + sz.Height);
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ break;
-+ }
-+
-+ case XML_hierChild:
-+ // FALLTHROUGH intended
-+ case XML_hierRoot:
-+ // FALLTHROUGH intended
-+ case XML_lin:
-+ {
-+ if( rShape->getChildren().empty() )
-+ {
-+ rShape->setSize(awt::Size(50,50));
-+ break;
-+ }
-+
-+ const sal_Int32 nDir=maMap.count(XML_linDir) ? maMap.find(XML_linDir)->second : XML_fromL;
-+ const sal_Int32 nIncX=nDir==XML_fromL ? 1 : (nDir==XML_fromR ? -1 : 0);
-+ const sal_Int32 nIncY=nDir==XML_fromT ? 1 : (nDir==XML_fromB ? -1 : 0);
-+
-+ std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
-+ const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-+ const awt::Point aStartPos=(*aCurrShape)->getPosition();
-+ awt::Point aCurrPos=aStartPos;
-+ awt::Size aTotalSize;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+ (*aCurrShape)->setPosition(aCurrPos);
-+
-+ aTotalSize.Width = std::max(
-+ aTotalSize.Width,
-+ aCurrPos.X + sz.Width);
-+ aTotalSize.Height = std::max(
-+ aTotalSize.Height,
-+ aCurrPos.Y + sz.Height);
-+
-+ // HACK: the spacing is arbitrary
-+ aCurrPos.X += nIncX*(sz.Width+5);
-+ aCurrPos.Y += nIncY*(sz.Height+5);
-+
-+ ++aCurrShape;
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ break;
-+ }
-+
-+ case XML_pyra:
-+ {
-+ if( rShape->getChildren().empty() )
-+ {
-+ rShape->setSize(awt::Size(50,50));
-+ break;
-+ }
-+
-+ std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
-+ const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-+ const sal_Int32 nShapes=aLastShape-aCurrShape;
-+
-+ // find biggest shape
-+ awt::Size aMaxSize;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ aMaxSize.Width = std::max(
-+ aMaxSize.Width,
-+ sz.Width);
-+ aMaxSize.Height = std::max(
-+ aMaxSize.Height,
-+ sz.Height);
-+
-+ ++aCurrShape;
-+ }
-+
-+ // calc levels of pyramid - number of elements is one more
-+ // per row, so total number is
-+ // n=height(height+1)/2. Solving for height (and not
-+ // filling the last row completely):
-+ //
-+ // height=ceil( sqrt(0.25+2n) - 0.5 )
-+ //
-+ const sal_Int32 nHeight( ceil(sqrt(0.25+2*nShapes) - 0.5) );
-+
-+ // layout shapes
-+ awt::Size aTotalSize;
-+ aCurrShape=rShape->getChildren().begin();
-+ for( sal_Int32 i=0, nLevel=0, k=0; i<nShapes; ++i, ++aCurrShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ const awt::Point aCurrPos(
-+ aMaxSize.Width*(nHeight - nLevel)/2 + k*aMaxSize.Width,
-+ aMaxSize.Height*nLevel );
-+ (*aCurrShape)->setPosition(aCurrPos);
-+
-+ aTotalSize.Width = std::max(
-+ aTotalSize.Width,
-+ aCurrPos.X + sz.Width);
-+ aTotalSize.Height = std::max(
-+ aTotalSize.Height,
-+ aCurrPos.Y + sz.Height);
-+
-+ ++k;
-+ if( k > nLevel )
-+ {
-+ k=0; ++nLevel;
-+ }
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ break;
-+ }
-+
-+ case XML_snake:
-+ {
-+ if( rShape->getChildren().empty() )
-+ {
-+ rShape->setSize(awt::Size(50,50));
-+ break;
-+ }
-+
-+ std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
-+ const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-+ const sal_Int32 nShapes=aLastShape-aCurrShape;
-+
-+ // find biggest shape
-+ awt::Size aMaxSize;
-+ while( aCurrShape != aLastShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ aMaxSize.Width = std::max(
-+ aMaxSize.Width,
-+ sz.Width);
-+ aMaxSize.Height = std::max(
-+ aMaxSize.Height,
-+ sz.Height);
-+
-+ ++aCurrShape;
-+ }
-+
-+ // assume square snake, leave last row partially filled:
-+ //
-+ // nRows or nCols=ceil( sqrt(nShapes) )
-+ //
-+ const sal_Int32 nShapesPerDimension( ceil(sqrt(nShapes)) );
-+
-+ // layout shapes
-+ awt::Size aTotalSize;
-+ aCurrShape=rShape->getChildren().begin();
-+ for( sal_Int32 i=0, nRow=0, nCol=0; i<nShapes; ++i, ++aCurrShape )
-+ {
-+ const awt::Size& sz=(*aCurrShape)->getSize();
-+
-+ const awt::Point aCurrPos(
-+ nRow % 2 ?
-+ (nShapesPerDimension-nCol)*aMaxSize.Width :
-+ nCol*aMaxSize.Width,
-+ aMaxSize.Height*nRow );
-+ (*aCurrShape)->setPosition(aCurrPos);
-+
-+ aTotalSize.Width = std::max(
-+ aTotalSize.Width,
-+ aCurrPos.X + sz.Width);
-+ aTotalSize.Height = std::max(
-+ aTotalSize.Height,
-+ aCurrPos.Y + sz.Height);
-+
-+ ++nCol;
-+ if( nCol >= nShapesPerDimension )
-+ {
-+ nCol=0; ++nRow;
-+ }
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ break;
-+ }
-+
-+ case XML_sp:
-+ // HACK. Handled one level higher. Or rather, planned to
-+ break;
-+
-+ case XML_tx:
-+ {
-+ TextBodyPtr pTextBody=rShape->getTextBody();
-+ if( !pTextBody ||
-+ pTextBody->getParagraphs().empty() ||
-+ pTextBody->getParagraphs().front()->getRuns().empty() )
-+ {
-+ rShape->setSize(awt::Size(5,5));
-+ break;
-+ }
-+
-+ // HACK - count chars & paragraphs to come up with *some*
-+ // notion of necessary size
-+ const sal_Int32 nHackyFontHeight=50;
-+ const sal_Int32 nHackyFontWidth=20;
-+ awt::Size aTotalSize;
-+ for( sal_Int32 nPara=0; nPara<pTextBody->getParagraphs().size(); ++nPara )
-+ {
-+ aTotalSize.Height += nHackyFontHeight;
-+
-+ sal_Int32 nLocalWidth=0;
-+ for( sal_Int32 nRun=0; nRun<pTextBody->getParagraphs().at(nPara)->getRuns().size(); ++nRun )
-+ nLocalWidth +=
-+ pTextBody->getParagraphs().at(nPara)->getRuns().at(nRun)->getText().getLength()
-+ * nHackyFontWidth;
-+
-+ aTotalSize.Width = std::max(
-+ aTotalSize.Width,
-+ nLocalWidth);
-+ }
-+
-+ rShape->setSize(aTotalSize);
-+ }
-+
-+ default:
-+ break;
-+ }
-+
-+ OSL_TRACE("Layouting shape %s: (%d,%d,%d,%d)",
-+ OUSTRING_TO_CSTR( rName ),
-+ rShape->getPosition().X,
-+ rShape->getPosition().Y,
-+ rShape->getSize().Width,
-+ rShape->getSize().Height);
-+}
-+
-+void LayoutNode::accept( LayoutAtomVisitor& rVisitor )
-+{
-+ rVisitor.visit(*this);
-+}
-+
-+bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_Int32 nIdx ) const
-+{
-+ // find the data node to grab text from
-+ DiagramData::PointsNameMap::const_iterator aDataNode=rDgm.getData()->getPointsPresNameMap().find(msName);
-+ if( aDataNode->second.size() > nIdx &&
-+ aDataNode != rDgm.getData()->getPointsPresNameMap().end() )
-+ {
-+ OSL_TRACE( "Filling content from %d th layout node named \"%s\", modelId \"%s\"",
-+ nIdx,
-+ OUSTRING_TO_CSTR( msName ),
-+ OUSTRING_TO_CSTR( aDataNode->second.at(nIdx)->msModelId ) );
-+
-+ // got the presentation node - now, need the actual data node:
-+ const DiagramData::StringMap::const_iterator aNodeName=rDgm.getData()->getPresOfNameMap().find(
-+ aDataNode->second.at(nIdx)->msModelId);
-+ if( aNodeName != rDgm.getData()->getPresOfNameMap().end() )
-+ {
-+ DiagramData::StringMap::value_type::second_type::const_iterator aVecIter=aNodeName->second.begin();
-+ const DiagramData::StringMap::value_type::second_type::const_iterator aVecEnd=aNodeName->second.end();
-+ while( aVecIter != aVecEnd )
-+ {
-+ DiagramData::PointNameMap::const_iterator aDataNode2=rDgm.getData()->getPointNameMap().find(aVecIter->first);
-+ if( aVecIter->second == 0 || aVecIter->second == -1 )
-+ {
-+ // grab shape attr from topmost element(s)
-+ rShape->getShapeProperties() = aDataNode2->second->mpShape->getShapeProperties();
-+ rShape->getLineProperties() = aDataNode2->second->mpShape->getLineProperties();
-+ rShape->getFillProperties() = aDataNode2->second->mpShape->getFillProperties();
-+ rShape->getCustomShapeProperties() = aDataNode2->second->mpShape->getCustomShapeProperties();
-+ rShape->setMasterTextListStyle( aDataNode2->second->mpShape->getMasterTextListStyle() );
-+
-+ OSL_TRACE( "Custom shape with preset type %s added for layout node named \"%s\"",
-+ OUSTRING_TO_CSTR(
-+ rShape->getCustomShapeProperties()->getShapePresetType()),
-+ OUSTRING_TO_CSTR( msName ) );
-+ }
-+
-+ // append text with right outline level
-+ if( aDataNode2->second->mpShape->getTextBody() &&
-+ !aDataNode2->second->mpShape->getTextBody()->getParagraphs().empty() &&
-+ !aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
-+ {
-+ TextBodyPtr pTextBody=rShape->getTextBody();
-+ if( !pTextBody )
-+ {
-+ pTextBody.reset( new TextBody() );
-+
-+ // also copy text attrs
-+ pTextBody->getTextListStyle() =
-+ aDataNode2->second->mpShape->getTextBody()->getTextListStyle();
-+ pTextBody->getTextProperties() =
-+ aDataNode2->second->mpShape->getTextBody()->getTextProperties();
-+
-+ rShape->setTextBody(pTextBody);
-+ }
-+
-+ TextParagraph& rPara=pTextBody->addParagraph();
-+ if( aVecIter->second != -1 )
-+ rPara.getProperties().setLevel(aVecIter->second);
-+
-+ rPara.addRun(
-+ aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().front());
-+ rPara.getProperties().apply(
-+ aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getProperties());
-+ }
-+
-+ ++aVecIter;
-+ }
-+ }
-+ else
-+ {
-+ OSL_TRACE("ShapeCreationVisitor::visit: no data node name found while processing shape type %s for layout node named \"%s\"",
-+ OUSTRING_TO_CSTR(
-+ rShape->getCustomShapeProperties()->getShapePresetType()),
-+ OUSTRING_TO_CSTR( msName ) );
-+ }
-+
-+ // TODO(Q1): apply styling & coloring - taking
-+ // layout node's styleLbl for both style & color
-+ // now, but docs are a bit unclear on this
-+ if( msStyleLabel.getLength() )
-+ {
-+ OSL_TRACE("setting style with label %s",
-+ OUSTRING_TO_CSTR( msStyleLabel ) );
-+
-+ const DiagramQStyleMap::const_iterator aStyle=rDgm.getStyles().find(msStyleLabel);
-+ if( aStyle != rDgm.getStyles().end() )
-+ {
-+ rShape->getShapeStyleRefs()[XML_fillRef] = aStyle->second.maFillStyle;
-+ OSL_TRACE("added fill style with id %d", aStyle->second.maFillStyle.mnThemedIdx);
-+ rShape->getShapeStyleRefs()[XML_lnRef] = aStyle->second.maLineStyle;
-+ OSL_TRACE("added line style with id %d", aStyle->second.maLineStyle.mnThemedIdx);
-+ rShape->getShapeStyleRefs()[XML_effectRef] = aStyle->second.maEffectStyle;
-+ OSL_TRACE("added effect style with id %d", aStyle->second.maEffectStyle.mnThemedIdx);
-+ rShape->getShapeStyleRefs()[XML_fontRef] = aStyle->second.maTextStyle;
-+ OSL_TRACE("added fontref style with id %d", aStyle->second.maTextStyle.mnThemedIdx);
-+ Color aColor=aStyle->second.maTextStyle.maPhClr;
-+ OSL_TRACE("added fontref color with alpha %d", aColor.getTransparence() );
-+ }
-+
-+ const DiagramColorMap::const_iterator aColor=rDgm.getColors().find(msStyleLabel);
-+ if( aColor != rDgm.getColors().end() )
-+ {
-+ const DiagramColor& rColor=aColor->second;
-+ if( rColor.maFillColor.isUsed() )
-+ rShape->getShapeStyleRefs()[XML_fillRef].maPhClr = rColor.maFillColor;
-+ if( rColor.maLineColor.isUsed() )
-+ rShape->getShapeStyleRefs()[XML_lnRef].maPhClr = rColor.maLineColor;
-+ if( rColor.maEffectColor.isUsed() )
-+ rShape->getShapeStyleRefs()[XML_effectRef].maPhClr = rColor.maEffectColor;
-+ if( rColor.maTextFillColor.isUsed() )
-+ rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rColor.maTextFillColor;
-+ }
-+ }
-+
-+ // even if no data node found, successful anyway. it's
-+ // contained at the layoutnode
-+ return true;
-+ }
-+ else
-+ {
-+ OSL_TRACE("ShapeCreationVisitor::visit: no text found while processing shape type %s for layout node named \"%s\"",
-+ OUSTRING_TO_CSTR(
-+ rShape->getCustomShapeProperties()->getShapePresetType()),
-+ OUSTRING_TO_CSTR( msName ) );
-+ }
-+
-+ return false;
-+}
-+
-+///////////////////////////////////////////////////////////////////////
-+//
-+// Visitation
-+//
-+
-+class ShapeLayoutingVisitor : public LayoutAtomVisitor
-+{
-+ ShapePtr mpParentShape;
-+ const Diagram& mrDgm;
-+ rtl::OUString maName;
-+
-+ virtual void visit(ConstraintAtom& rAtom);
-+ virtual void visit(AlgAtom& rAtom);
-+ virtual void visit(ForEachAtom& rAtom);
-+ virtual void visit(ConditionAtom& rAtom);
-+ virtual void visit(ChooseAtom& rAtom);
-+ virtual void visit(LayoutNode& rAtom);
-+
-+public:
-+ ShapeLayoutingVisitor(const ShapePtr& rParentShape,
-+ const Diagram& rDgm,
-+ const rtl::OUString& rName) :
-+ mpParentShape(rParentShape),
-+ mrDgm(rDgm),
-+ maName(rName)
-+ {}
-+
-+ void defaultVisit(LayoutAtom& rAtom);
-+};
-+
-+class ShallowPresNameVisitor : public LayoutAtomVisitor
-+{
-+ const Diagram& mrDgm;
-+ size_t mnCnt;
-+
-+ void defaultVisit(LayoutAtom& rAtom);
-+ virtual void visit(ConstraintAtom& rAtom);
-+ virtual void visit(AlgAtom& rAtom);
-+ virtual void visit(ForEachAtom& rAtom);
-+ virtual void visit(ConditionAtom& rAtom);
-+ virtual void visit(ChooseAtom& rAtom);
-+ virtual void visit(LayoutNode& rAtom);
-+
-+public:
-+ ShallowPresNameVisitor(const Diagram& rDgm) :
-+ mrDgm(rDgm),
-+ mnCnt(0)
-+ {}
-+
-+ size_t getCount() const
-+ { return mnCnt; }
-+};
-+
-+void ShapeCreationVisitor::defaultVisit(LayoutAtom& rAtom)
-+{
-+ const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::accept,
-+ _1,
-+ boost::ref(*this)) );
-+}
-+
-+void ShapeCreationVisitor::visit(ConstraintAtom& /*rAtom*/)
-+{
-+ // TODO: eval the constraints
-+}
-+
-+void ShapeCreationVisitor::visit(AlgAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
-+{
-+ const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
-+
-+ sal_Int32 nChildren=1;
-+ if( rAtom.iterator().mnPtType == XML_node )
-+ {
-+ // cound child data nodes - check all child Atoms for "name"
-+ // attribute that is contained in diagram's
-+ // getPointsPresNameMap()
-+ ShallowPresNameVisitor aVisitor(mrDgm);
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::accept,
-+ _1,
-+ boost::ref(aVisitor)) );
-+ nChildren = aVisitor.getCount();
-+ }
-+
-+ const sal_Int32 nCnt = std::min(
-+ nChildren,
-+ rAtom.iterator().mnCnt==-1 ? nChildren : rAtom.iterator().mnCnt);
-+
-+ const sal_Int32 nOldIdx=mnCurrIdx;
-+ const sal_Int32 nStep=rAtom.iterator().mnStep;
-+ for( mnCurrIdx=0; mnCurrIdx<nCnt && nStep>0; mnCurrIdx+=nStep )
-+ {
-+ // TODO there is likely some conditions
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::accept,
-+ _1,
-+ boost::ref(*this)) );
-+ }
-+
-+ // and restore idx
-+ mnCurrIdx = nOldIdx;
-+}
-+
-+void ShapeCreationVisitor::visit(ConditionAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShapeCreationVisitor::visit(ChooseAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShapeCreationVisitor::visit(LayoutNode& rAtom)
-+{
-+ ShapePtr pCurrParent(mpParentShape);
-+ ShapePtr pCurrShape(rAtom.getShape());
-+ if( pCurrShape )
-+ {
-+ OSL_TRACE("ShapeCreationVisitor::visit: processing shape type %s",
-+ OUSTRING_TO_CSTR(
-+ pCurrShape->getCustomShapeProperties()->getShapePresetType()) );
-+
-+ // TODO(F3): cloned shape shares all properties by reference,
-+ // don't change them!
-+ ShapePtr pClonedShape(
-+ new Shape( pCurrShape ));
-+
-+ if( rAtom.setupShape(pClonedShape, mrDgm, mnCurrIdx) )
-+ {
-+ pCurrParent->addChild(pClonedShape);
-+ pCurrParent = pClonedShape;
-+ }
-+ }
-+ else
-+ {
-+ OSL_TRACE("ShapeCreationVisitor::visit: no shape set while processing layoutnode named %s",
-+ OUSTRING_TO_CSTR( rAtom.getName() ) );
-+ }
-+
-+ // set new parent for children
-+ ShapePtr pPreviousParent(mpParentShape);
-+ mpParentShape=pCurrParent;
-+
-+ // process children
-+ defaultVisit(rAtom);
-+
-+ // restore parent
-+ mpParentShape=pPreviousParent;
-+
-+ // layout shapes - now all child shapes are created
-+ ShapeLayoutingVisitor aLayoutingVisitor(pCurrParent,
-+ mrDgm,
-+ rAtom.getName());
-+ aLayoutingVisitor.defaultVisit(rAtom);
-+}
-+
-+void ShapeLayoutingVisitor::defaultVisit(LayoutAtom& rAtom)
-+{
-+ // visit all children, one of them need to be the layout algoritm
-+ const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::accept,
-+ _1,
-+ boost::ref(*this)) );
-+}
-+
-+void ShapeLayoutingVisitor::visit(ConstraintAtom& rAtom)
-+{
-+ // stop processing
-+}
-+
-+void ShapeLayoutingVisitor::visit(AlgAtom& rAtom)
-+{
-+ rAtom.layoutShape(mpParentShape,mrDgm,maName);
-+}
-+
-+void ShapeLayoutingVisitor::visit(ForEachAtom& rAtom)
-+{
-+ // stop processing
-+}
-+
-+void ShapeLayoutingVisitor::visit(ConditionAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShapeLayoutingVisitor::visit(ChooseAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShapeLayoutingVisitor::visit(LayoutNode& rAtom)
-+{
-+ // stop processing - only traverse Condition/Choose atoms
-+}
-+
-+void ShallowPresNameVisitor::defaultVisit(LayoutAtom& rAtom)
-+{
-+ // visit all children, at least one of them needs to have proper
-+ // name set
-+ const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
-+ std::for_each( pChildren.begin(), pChildren.end(),
-+ boost::bind( &LayoutAtom::accept,
-+ _1,
-+ boost::ref(*this)) );
-+}
-+
-+void ShallowPresNameVisitor::visit(ConstraintAtom& rAtom)
-+{
-+ // stop processing
-+}
-+
-+void ShallowPresNameVisitor::visit(AlgAtom& rAtom)
-+{
-+ // stop processing
-+}
-+
-+void ShallowPresNameVisitor::visit(ForEachAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShallowPresNameVisitor::visit(ConditionAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShallowPresNameVisitor::visit(ChooseAtom& rAtom)
-+{
-+ defaultVisit(rAtom);
-+}
-+
-+void ShallowPresNameVisitor::visit(LayoutNode& rAtom)
-+{
-+ DiagramData::PointsNameMap::const_iterator aDataNode=
-+ mrDgm.getData()->getPointsPresNameMap().find(rAtom.getName());
-+ if( aDataNode != mrDgm.getData()->getPointsPresNameMap().end() )
-+ mnCnt = std::max(mnCnt,
-+ aDataNode->second.size());
-+}
-
- } }
-diff --git oox/source/drawingml/diagram/diagramlayoutatoms.hxx oox/source/drawingml/diagram/diagramlayoutatoms.hxx
-new file mode 100644
-index 0000000..ae9e7c3
---- /dev/null
-+++ oox/source/drawingml/diagram/diagramlayoutatoms.hxx
-@@ -0,0 +1,318 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: diagramlayoutatoms.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
-+#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
-+
-+#include <map>
-+#include <string>
-+
-+#include <boost/shared_ptr.hpp>
-+#include <boost/array.hpp>
-+
-+#include <com/sun/star/uno/Any.hxx>
-+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
-+
-+#include "oox/drawingml/shape.hxx"
-+#include "diagram.hxx"
-+
-+
-+namespace oox { namespace drawingml {
-+
-+class DiagramLayout;
-+typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
-+
-+// AG_IteratorAttributes
-+struct IteratorAttr
-+{
-+ IteratorAttr();
-+
-+ // not sure this belong here, but wth
-+ void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
-+
-+ sal_Int32 mnAxis;
-+ sal_Int32 mnCnt;
-+ sal_Bool mbHideLastTrans;
-+ sal_Int32 mnPtType;
-+ sal_Int32 mnSt;
-+ sal_Int32 mnStep;
-+};
-+
-+struct ConditionAttr
-+{
-+ ConditionAttr();
-+
-+ // not sure this belong here, but wth
-+ void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
-+
-+ sal_Int32 mnFunc;
-+ sal_Int32 mnArg;
-+ sal_Int32 mnOp;
-+ ::rtl::OUString msVal;
-+};
-+
-+struct LayoutAtomVisitor;
-+class LayoutAtom;
-+
-+typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
-+
-+/** abstract Atom for the layout */
-+class LayoutAtom
-+{
-+public:
-+ /** visitor acceptance
-+ */
-+ virtual void accept( LayoutAtomVisitor& ) = 0;
-+
-+ void setName( const ::rtl::OUString& sName )
-+ { msName = sName; }
-+ const ::rtl::OUString& getName() const
-+ { return msName; }
-+
-+ virtual void addChild( const LayoutAtomPtr & pNode )
-+ { mpChildNodes.push_back( pNode ); }
-+ virtual const std::vector<LayoutAtomPtr>& getChildren() const
-+ { return mpChildNodes; }
-+
-+ // dump for debug
-+ void dump(int level = 0);
-+protected:
-+ std::vector< LayoutAtomPtr > mpChildNodes;
-+ ::rtl::OUString msName;
-+};
-+
-+class ConstraintAtom
-+ : public LayoutAtom
-+{
-+public:
-+ ConstraintAtom() :
-+ mnFor(-1), msForName(), mnPointType(-1), mnType(-1), mnRefFor(-1), msRefForName(),
-+ mnRefType(-1), mnRefPointType(-1), mfFactor(1.0), mfValue(0.0), mnOperator(0)
-+ {}
-+
-+ virtual void accept( LayoutAtomVisitor& );
-+
-+ void setFor( sal_Int32 nToken )
-+ { mnFor = nToken; }
-+ void setForName( const ::rtl::OUString & sName )
-+ { msForName = sName; }
-+ void setPointType( sal_Int32 nToken )
-+ { mnPointType = nToken; }
-+ void setType( sal_Int32 nToken )
-+ { mnType = nToken; }
-+ void setRefFor( sal_Int32 nToken )
-+ { mnRefFor = nToken; }
-+ void setRefForName( const ::rtl::OUString & sName )
-+ { msRefForName = sName; }
-+ void setRefType( sal_Int32 nToken )
-+ { mnRefType = nToken; }
-+ void setRefPointType( sal_Int32 nToken )
-+ { mnRefPointType = nToken; }
-+ void setFactor( const double& fVal )
-+ { mfFactor = fVal; }
-+ void setValue( const double& fVal )
-+ { mfValue = fVal; }
-+ void setOperator( sal_Int32 nToken )
-+ { mnOperator = nToken; }
-+private:
-+ sal_Int32 mnFor;
-+ ::rtl::OUString msForName;
-+ sal_Int32 mnPointType;
-+ sal_Int32 mnType;
-+ sal_Int32 mnRefFor;
-+ ::rtl::OUString msRefForName;
-+ sal_Int32 mnRefType;
-+ sal_Int32 mnRefPointType;
-+ double mfFactor;
-+ double mfValue;
-+ sal_Int32 mnOperator;
-+};
-+
-+typedef boost::shared_ptr< ConstraintAtom > ConstraintAtomPtr;
-+
-+class AlgAtom
-+ : public LayoutAtom
-+{
-+public:
-+ AlgAtom() : mnType(0), maMap() {}
-+
-+ typedef std::map<sal_Int32,sal_Int32> ParamMap;
-+
-+ virtual void accept( LayoutAtomVisitor& );
-+
-+ void setType( sal_Int32 nToken )
-+ { mnType = nToken; }
-+ void addParam( sal_Int32 nType, sal_Int32 nVal )
-+ { maMap[nType]=nVal; }
-+ void layoutShape( const ShapePtr& rShape,
-+ const Diagram& rDgm,
-+ const rtl::OUString& rName ) const;
-+private:
-+ sal_Int32 mnType;
-+ ParamMap maMap;
-+};
-+
-+typedef boost::shared_ptr< AlgAtom > AlgAtomPtr;
-+
-+class ForEachAtom
-+ : public LayoutAtom
-+{
-+public:
-+ explicit ForEachAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
-+
-+ IteratorAttr & iterator()
-+ { return maIter; }
-+ virtual void accept( LayoutAtomVisitor& );
-+
-+private:
-+ IteratorAttr maIter;
-+};
-+
-+typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
-+
-+
-+class ConditionAtom
-+ : public LayoutAtom
-+{
-+public:
-+ explicit ConditionAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
-+ bool test();
-+ virtual void accept( LayoutAtomVisitor& );
-+ IteratorAttr & iterator()
-+ { return maIter; }
-+ ConditionAttr & cond()
-+ { return maCond; }
-+ void readElseBranch()
-+ { mbElse=true; }
-+ virtual void addChild( const LayoutAtomPtr & pNode );
-+ virtual const std::vector<LayoutAtomPtr>& getChildren() const;
-+private:
-+ bool mbElse;
-+ IteratorAttr maIter;
-+ ConditionAttr maCond;
-+ std::vector< LayoutAtomPtr > mpElseChildNodes;
-+};
-+
-+typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
-+
-+
-+/** "choose" statements. Atoms will be tested in order. */
-+class ChooseAtom
-+ : public LayoutAtom
-+{
-+public:
-+ virtual void accept( LayoutAtomVisitor& );
-+};
-+
-+class LayoutNode
-+ : public LayoutAtom
-+{
-+public:
-+ enum {
-+ VAR_animLvl = 0,
-+ VAR_animOne,
-+ VAR_bulletEnabled,
-+ VAR_chMax,
-+ VAR_chPref,
-+ VAR_dir,
-+ VAR_hierBranch,
-+ VAR_orgChart,
-+ VAR_resizeHandles
-+ };
-+ // we know that the array is of fixed size
-+ // the use of Any allow having empty values
-+ typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
-+
-+ LayoutNode() : mnChildOrder(0) {}
-+ virtual void accept( LayoutAtomVisitor& );
-+ VarMap & variables()
-+ { return mVariables; }
-+ void setMoveWith( const ::rtl::OUString & sName )
-+ { msMoveWith = sName; }
-+ void setStyleLabel( const ::rtl::OUString & sLabel )
-+ { msStyleLabel = sLabel; }
-+ void setChildOrder( sal_Int32 nOrder )
-+ { mnChildOrder = nOrder; }
-+ void setShape( const ShapePtr& pShape )
-+ { mpShape = pShape; }
-+ const ShapePtr& getShape() const
-+ { return mpShape; }
-+
-+ bool setupShape( const ShapePtr& rShape,
-+ const Diagram& rDgm,
-+ sal_Int32 nIdx ) const;
-+
-+private:
-+ VarMap mVariables;
-+ ::rtl::OUString msMoveWith;
-+ ::rtl::OUString msStyleLabel;
-+ ShapePtr mpShape;
-+ sal_Int32 mnChildOrder;
-+};
-+
-+typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
-+
-+struct LayoutAtomVisitor
-+{
-+ virtual ~LayoutAtomVisitor() {}
-+ virtual void visit(ConstraintAtom& rAtom) = 0;
-+ virtual void visit(AlgAtom& rAtom) = 0;
-+ virtual void visit(ForEachAtom& rAtom) = 0;
-+ virtual void visit(ConditionAtom& rAtom) = 0;
-+ virtual void visit(ChooseAtom& rAtom) = 0;
-+ virtual void visit(LayoutNode& rAtom) = 0;
-+};
-+
-+class ShapeCreationVisitor : public LayoutAtomVisitor
-+{
-+ ShapePtr mpParentShape;
-+ const Diagram& mrDgm;
-+ sal_Int32 mnCurrIdx;
-+
-+ void defaultVisit(LayoutAtom& rAtom);
-+ virtual void visit(ConstraintAtom& rAtom);
-+ virtual void visit(AlgAtom& rAtom);
-+ virtual void visit(ForEachAtom& rAtom);
-+ virtual void visit(ConditionAtom& rAtom);
-+ virtual void visit(ChooseAtom& rAtom);
-+ virtual void visit(LayoutNode& rAtom);
-+
-+public:
-+ ShapeCreationVisitor(const ShapePtr& rParentShape,
-+ const Diagram& rDgm) :
-+ mpParentShape(rParentShape),
-+ mrDgm(rDgm),
-+ mnCurrIdx(0)
-+ {}
-+};
-+
-+} }
-+
-+#endif
-diff --git oox/source/drawingml/diagram/layoutnodecontext.cxx oox/source/drawingml/diagram/layoutnodecontext.cxx
-index 40d0245..81c6ed7 100644
---- oox/source/drawingml/diagram/layoutnodecontext.cxx
-+++ oox/source/drawingml/diagram/layoutnodecontext.cxx
-@@ -35,7 +35,9 @@
- #include "oox/core/namespaces.hxx"
- #include "oox/drawingml/diagram/diagram.hxx"
- #include "oox/drawingml/shapecontext.hxx"
-+#include "oox/drawingml/customshapeproperties.hxx"
- #include "diagramdefinitioncontext.hxx"
-+#include "constraintlistcontext.hxx"
-
- using namespace ::oox::core;
- using namespace ::com::sun::star::uno;
-@@ -50,15 +52,9 @@ class IfContext
- public:
- IfContext( ContextHandler& rParent,
- const Reference< XFastAttributeList >& xAttribs,
-- const LayoutAtomPtr & pNode )
-- : LayoutNodeContext( rParent, xAttribs, pNode )
-- {
-- ConditionAtomPtr pAtom( boost::dynamic_pointer_cast< ConditionAtom >(pNode) );
-- OSL_ENSURE( pAtom, "Must pass a ConditionAtom" );
--
-- pAtom->iterator().loadFromXAttr( xAttribs );
-- pAtom->cond().loadFromXAttr( xAttribs );
-- }
-+ const ConditionAtomPtr& pAtom )
-+ : LayoutNodeContext( rParent, xAttribs, pAtom )
-+ {}
- };
-
-
-@@ -67,21 +63,47 @@ class AlgorithmContext
- : public ContextHandler
- {
- public:
-- AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
-+ AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const AlgAtomPtr & pNode )
- : ContextHandler( rParent )
- , mnRevision( 0 )
-- , mnType( 0 )
- , mpNode( pNode )
- {
- AttributeList aAttribs( xAttribs );
- mnRevision = aAttribs.getInteger( XML_rev, 0 );
-- mnType = xAttribs->getOptionalValueToken( XML_type, 0 );
-+ pNode->setType(xAttribs->getOptionalValueToken(XML_type, 0));
-+ }
-+
-+ virtual Reference< XFastContextHandler > SAL_CALL
-+ createFastChildContext( ::sal_Int32 aElement,
-+ const Reference< XFastAttributeList >& xAttribs )
-+ throw (SAXException, RuntimeException)
-+ {
-+ Reference< XFastContextHandler > xRet;
-+
-+ switch( getToken(aElement) )
-+ {
-+ case XML_param:
-+ {
-+ AttributeList aAttribs( xAttribs );
-+ const sal_Int32 nValTok=aAttribs.getToken( XML_val, 0 );
-+ mpNode->addParam(
-+ aAttribs.getToken( XML_type, 0 ),
-+ nValTok>0 ? nValTok : aAttribs.getInteger( XML_val, 0 ) );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+
-+ if( !xRet.is() )
-+ xRet.set(this);
-+
-+ return xRet;
- }
-
- private:
-- sal_Int32 mnRevision;
-- sal_Int32 mnType;
-- LayoutAtomPtr mpNode;
-+ sal_Int32 mnRevision;
-+ AlgAtomPtr mpNode;
- };
-
-
-@@ -91,7 +113,6 @@ class ChooseContext
- public:
- ChooseContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
- : ContextHandler( rParent )
-- , mbHasElse( false )
- , mpNode( pNode )
- {
- msName = xAttribs->getOptionalValue( XML_name );
-@@ -104,24 +125,23 @@ public:
- {
- Reference< XFastContextHandler > xRet;
-
-- switch( aElement )
-+ switch( getToken(aElement) )
- {
- case XML_if:
- {
- // CT_When
-- LayoutAtomPtr pAtom( new ConditionAtom( false ) );
-- mpNode->addChild( pAtom );
-- xRet.set( new IfContext( *this, xAttribs, pAtom ) );
-+ mpConditionNode.reset( new ConditionAtom(xAttribs) );
-+ mpNode->addChild( mpConditionNode );
-+ xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
- break;
- }
- case XML_else:
- // CT_Otherwise
-- if( !mbHasElse )
-+ if( mpConditionNode )
- {
-- LayoutAtomPtr pAtom( new ConditionAtom( true ) );
-- mpNode->addChild( pAtom );
-- xRet.set( new IfContext( *this, xAttribs, pAtom ) );
-- mbHasElse = true;
-+ mpConditionNode->readElseBranch();
-+ xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
-+ mpConditionNode.reset();
- }
- else
- {
-@@ -138,9 +158,9 @@ public:
- return xRet;
- }
- private:
-- bool mbHasElse;
- OUString msName;
- LayoutAtomPtr mpNode;
-+ ConditionAtomPtr mpConditionNode;
- };
-
-
-@@ -150,13 +170,10 @@ class ForEachContext
- : public LayoutNodeContext
- {
- public:
-- ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
-- : LayoutNodeContext( rParent, xAttribs, pNode )
-+ ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const ForEachAtomPtr& pAtom )
-+ : LayoutNodeContext( rParent, xAttribs, pAtom )
- {
-- ForEachAtomPtr pAtom( boost::dynamic_pointer_cast< ForEachAtom >(pNode) );
-- OSL_ENSURE( pAtom, "Must pass a ForEachAtom" );
- xAttribs->getOptionalValue( XML_ref );
--
- pAtom->iterator().loadFromXAttr( xAttribs );
- }
- };
-@@ -200,17 +217,12 @@ private:
- // CT_LayoutNode
- LayoutNodeContext::LayoutNodeContext( ContextHandler& rParent,
- const Reference< XFastAttributeList >& xAttribs,
-- const LayoutAtomPtr &pNode )
-+ const LayoutAtomPtr& pAtom )
- : ContextHandler( rParent )
-- , mpNode( pNode )
-+ , mpNode( pAtom )
- {
-- OSL_ENSURE( pNode, "Node must NOT be NULL" );
-+ OSL_ENSURE( pAtom, "Node must NOT be NULL" );
- mpNode->setName( xAttribs->getOptionalValue( XML_name ) );
-- // TODO shall we even bother?
-- // b or t
--// sal_Int32 nChOrder = xAttributes->getOptionalValueToken( XML_chOrder, XML_b );
--// OUString sMoveWith = xAttributes->getOptionalValue( XML_moveWith );
--// OUString sStyleLbl = xAttributes->getOptionalValue( XML_styleLbl );
- }
-
-
-@@ -231,33 +243,33 @@ void SAL_CALL LayoutNodeContext::endFastElement( ::sal_Int32 )
- sal_Int32 LayoutNodeContext::tagToVarIdx( sal_Int32 aTag )
- {
- sal_Int32 nIdx = -1;
-- switch( aTag )
-+ switch( aTag & ~NMSP_DIAGRAM )
- {
-- case NMSP_DIAGRAM|XML_animLvl:
-+ case XML_animLvl:
- nIdx = LayoutNode::VAR_animLvl;
- break;
-- case NMSP_DIAGRAM|XML_animOne:
-+ case XML_animOne:
- nIdx = LayoutNode::VAR_animOne;
- break;
-- case NMSP_DIAGRAM|XML_bulletEnabled:
-+ case XML_bulletEnabled:
- nIdx = LayoutNode::VAR_bulletEnabled;
- break;
-- case NMSP_DIAGRAM|XML_chMax:
-+ case XML_chMax:
- nIdx = LayoutNode::VAR_chMax;
- break;
-- case NMSP_DIAGRAM|XML_chPref:
-+ case XML_chPref:
- nIdx = LayoutNode::VAR_chPref;
- break;
-- case NMSP_DIAGRAM|XML_dir:
-+ case XML_dir:
- nIdx = LayoutNode::VAR_dir;
- break;
-- case NMSP_DIAGRAM|XML_hierBranch:
-+ case XML_hierBranch:
- nIdx = LayoutNode::VAR_hierBranch;
- break;
-- case NMSP_DIAGRAM|XML_orgChart:
-+ case XML_orgChart:
- nIdx = LayoutNode::VAR_orgChart;
- break;
-- case NMSP_DIAGRAM|XML_resizeHandles:
-+ case XML_resizeHandles:
- nIdx = LayoutNode::VAR_resizeHandles;
- break;
- default:
-@@ -280,13 +292,39 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
- {
- LayoutNodePtr pNode( new LayoutNode() );
- mpNode->addChild( pNode );
-+ pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
-+ pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
-+ pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
- xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
- break;
- }
- case NMSP_DIAGRAM|XML_shape:
- {
-- ShapePtr pShape( new Shape() );
-- xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
-+ LayoutNodePtr pNode( boost::dynamic_pointer_cast< LayoutNode >( mpNode ) );
-+ if( pNode )
-+ {
-+ ShapePtr pShape;
-+
-+ if( xAttribs->hasAttribute( XML_type ) )
-+ {
-+ pShape.reset( new Shape("com.sun.star.drawing.CustomShape") );
-+ const sal_Int32 nType(xAttribs->getOptionalValueToken( XML_type, XML_obj ));
-+ pShape->setSubType( nType );
-+ pShape->getCustomShapeProperties()->setShapePresetType(
-+ GetShapePresetType( nType ) );
-+ }
-+ else
-+ {
-+ pShape.reset( new Shape("com.sun.star.drawing.GroupShape") );
-+ }
-+
-+ pNode->setShape( pShape );
-+ xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
-+ }
-+ else
-+ {
-+ OSL_TRACE( "OOX: encountered a shape in a non layoutNode context" );
-+ }
- break;
- }
- case NMSP_DIAGRAM|XML_extLst:
-@@ -295,7 +333,7 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
- case NMSP_DIAGRAM|XML_alg:
- {
- // CT_Algorithm
-- LayoutAtomPtr pAtom( new AlgAtom );
-+ AlgAtomPtr pAtom( new AlgAtom );
- mpNode->addChild( pAtom );
- xRet.set( new AlgorithmContext( *this, xAttribs, pAtom ) );
- break;
-@@ -311,14 +349,14 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
- case NMSP_DIAGRAM|XML_forEach:
- {
- // CT_ForEach
-- LayoutAtomPtr pAtom( new ForEachAtom );
-+ ForEachAtomPtr pAtom( new ForEachAtom(xAttribs) );
- mpNode->addChild( pAtom );
- xRet.set( new ForEachContext( *this, xAttribs, pAtom ) );
- break;
- }
- case NMSP_DIAGRAM|XML_constrLst:
- // CT_Constraints
-- // TODO
-+ xRet.set( new ConstraintListContext( *this, xAttribs, mpNode ) );
- break;
- case NMSP_DIAGRAM|XML_presOf:
- {
-diff --git oox/source/drawingml/diagram/layoutnodecontext.hxx oox/source/drawingml/diagram/layoutnodecontext.hxx
-index 8555825..1be9b79 100644
---- oox/source/drawingml/diagram/layoutnodecontext.hxx
-+++ oox/source/drawingml/diagram/layoutnodecontext.hxx
-@@ -32,7 +32,8 @@
- #define OOX_DRAWINGML_LAYOUTNODECONTEXT_HXX
-
- #include "oox/core/contexthandler.hxx"
--#include "oox/drawingml/diagram/diagram.hxx"
-+#include "diagramlayoutatoms.hxx"
-+#include "diagram.hxx"
-
- namespace oox { namespace drawingml {
-
-diff --git oox/source/drawingml/diagram/makefile.mk oox/source/drawingml/diagram/makefile.mk
-index bf8c6f9..3c48afc 100644
---- oox/source/drawingml/diagram/makefile.mk
-+++ oox/source/drawingml/diagram/makefile.mk
-@@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Files --------------------------------------------------------
-
- SLOFILES = \
-+ $(SLO)$/constraintlistcontext.obj \
- $(SLO)$/diagram.obj \
- $(SLO)$/diagramfragmenthandler.obj \
- $(SLO)$/diagramdefinitioncontext.obj \
-diff --git oox/source/drawingml/drawingmltypes.cxx oox/source/drawingml/drawingmltypes.cxx
-index 89eaf02..3208b0f 100644
---- oox/source/drawingml/drawingmltypes.cxx
-+++ oox/source/drawingml/drawingmltypes.cxx
-@@ -162,6 +162,7 @@ float GetFontHeight( sal_Int32 nHeight )
-
- sal_Int16 GetFontUnderline( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_none: return FontUnderline::NONE;
-@@ -188,6 +189,7 @@ sal_Int16 GetFontUnderline( sal_Int32 nToken )
-
- sal_Int16 GetFontStrikeout( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_dblStrike: return FontStrikeout::DOUBLE;
-@@ -210,6 +212,7 @@ sal_Int16 GetCaseMap( sal_Int32 nToken )
- /** converts a paragraph align to a ParaAdjust */
- sal_Int16 GetParaAdjust( sal_Int32 nAlign )
- {
-+ OSL_ASSERT((nAlign & sal_Int32(0xFFFF0000))==0);
- sal_Int16 nEnum;
- switch( nAlign )
- {
-@@ -238,6 +241,7 @@ sal_Int16 GetParaAdjust( sal_Int32 nAlign )
-
- TabAlign GetTabAlign( sal_Int32 aToken )
- {
-+ OSL_ASSERT((aToken & sal_Int32(0xFFFF0000))==0);
- TabAlign nEnum;
- switch( aToken )
- {
-diff --git oox/source/drawingml/fillproperties.cxx oox/source/drawingml/fillproperties.cxx
-index 57148fa..8d0645e 100644
---- oox/source/drawingml/fillproperties.cxx
-+++ oox/source/drawingml/fillproperties.cxx
-@@ -83,6 +83,7 @@ static const sal_Char* const sppcDefaultPicNames[] =
-
- BitmapMode lclGetBitmapMode( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_tile: return BitmapMode_REPEAT;
-@@ -93,6 +94,7 @@ BitmapMode lclGetBitmapMode( sal_Int32 nToken )
-
- RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_tl: return RectanglePoint_LEFT_TOP;
-@@ -276,6 +278,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
- nShapeRotation = 0;
-
- FillStyle eFillStyle = FillStyle_NONE;
-+ OSL_ASSERT((moFillType.get() & sal_Int32(0xFFFF0000))==0);
- switch( moFillType.get() )
- {
- case XML_noFill:
-diff --git oox/source/drawingml/graphicshapecontext.cxx oox/source/drawingml/graphicshapecontext.cxx
-index de32569..0f43eb0 100644
---- oox/source/drawingml/graphicshapecontext.cxx
-+++ oox/source/drawingml/graphicshapecontext.cxx
-@@ -33,7 +33,6 @@
- #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
- #include "oox/drawingml/graphicshapecontext.hxx"
- #include "oox/drawingml/customshapeproperties.hxx"
--#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
- #include "oox/drawingml/table/tablecontext.hxx"
- #include "oox/core/namespaces.hxx"
- #include "oox/core/xmlfilterbase.hxx"
-@@ -43,6 +42,7 @@
- #include "oox/drawingml/chart/chartconverter.hxx"
- #include "oox/drawingml/chart/chartspacefragment.hxx"
- #include "oox/drawingml/chart/chartspacemodel.hxx"
-+#include "oox/drawingml/diagram/diagram.hxx"
- #include "tokens.hxx"
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/io/XStream.hpp>
-@@ -92,7 +92,7 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
- (mpShapePtr->getCustomShapeProperties());
-
- sal_uInt32 nType = aElementToken & (~ NMSP_MASK);
-- OUString sType(GetShapeType(nType));
-+ OUString sType(GetShapePresetType(nType));
-
- if (sType.getLength() > 0)
- pCstmShpProps->setShapePresetType(sType);
-@@ -115,6 +115,7 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon
- {
- Reference< XFastContextHandler > xRet;
-
-+ OSL_ASSERT(((aElementToken &(~NMSP_MASK)) & sal_Int32(0xFFFF0000))==0);
- switch( aElementToken &(~NMSP_MASK) )
- {
- // CT_ShapeProperties
-@@ -236,6 +237,7 @@ Reference< XFastContextHandler > PresentationOle2006Context::createFastChildCont
- {
- Reference< XFastContextHandler > xRet;
-
-+ OSL_ASSERT(((aElementToken &(~NMSP_MASK)) & sal_Int32(0xFFFF0000))==0);
- switch( aElementToken &(~NMSP_MASK) )
- {
- case XML_oleObj:
-@@ -266,7 +268,7 @@ Reference< XFastContextHandler > PresentationOle2006Context::createFastChildCont
- DiagramGraphicDataContext::DiagramGraphicDataContext( ContextHandler& rParent, ShapePtr pShapePtr )
- : ShapeContext( rParent, ShapePtr(), pShapePtr )
- {
-- pShapePtr->setServiceName( "com.sun.star.drawing.GroupShape" );
-+ pShapePtr->setServiceName( "com.sun.star.drawing.DiagramShape" );
- pShapePtr->setSubType( 0 );
- }
-
-@@ -277,48 +279,6 @@ DiagramGraphicDataContext::~DiagramGraphicDataContext()
-
- }
-
--DiagramPtr DiagramGraphicDataContext::loadDiagram()
--{
-- DiagramPtr pDiagram( new Diagram() );
-- XmlFilterBase& rFilter = getFilter();
--
-- // data
-- OUString sDmPath = getFragmentPathFromRelId( msDm );
-- if( sDmPath.getLength() > 0 )
-- {
-- DiagramDataPtr pData( new DiagramData() );
-- pDiagram->setData( pData );
-- rFilter.importFragment( new DiagramDataFragmentHandler( rFilter, sDmPath, pData ) );
-- }
-- // layout
-- OUString sLoPath = getFragmentPathFromRelId( msLo );
-- if( sLoPath.getLength() > 0 )
-- {
-- DiagramLayoutPtr pLayout( new DiagramLayout() );
-- pDiagram->setLayout( pLayout );
-- rFilter.importFragment( new DiagramLayoutFragmentHandler( rFilter, sLoPath, pLayout ) );
-- }
-- // style
-- OUString sQsPath = getFragmentPathFromRelId( msQs );
-- if( sQsPath.getLength() > 0 )
-- {
-- DiagramQStylesPtr pStyles( new DiagramQStyles() );
-- pDiagram->setQStyles( pStyles );
-- rFilter.importFragment( new DiagramQStylesFragmentHandler( rFilter, sQsPath, pStyles ) );
-- }
-- // colors
-- OUString sCsPath = getFragmentPathFromRelId( msCs );
-- if( sCsPath.getLength() > 0 )
-- {
-- DiagramColorsPtr pColors( new DiagramColors() );
-- pDiagram->setColors( pColors );
-- rFilter.importFragment( new DiagramColorsFragmentHandler( rFilter, sCsPath, pColors ) ) ;
-- }
--
-- return pDiagram;
--}
--
--
- Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
- throw (SAXException, RuntimeException)
- {
-@@ -332,8 +292,12 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte
- msLo = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_lo );
- msQs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_qs );
- msCs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_cs );
-- DiagramPtr pDiagram = loadDiagram();
-- pDiagram->addTo( mpShapePtr );
-+ loadDiagram(mpShapePtr,
-+ getFilter(),
-+ getFragmentPathFromRelId( msDm ),
-+ getFragmentPathFromRelId( msLo ),
-+ getFragmentPathFromRelId( msQs ),
-+ getFragmentPathFromRelId( msCs ));
- OSL_TRACE("diagram added shape %s of type %s", OUSTRING_TO_CSTR( mpShapePtr->getName() ),
- OUSTRING_TO_CSTR( mpShapePtr->getServiceName() ) );
- break;
-@@ -388,7 +352,8 @@ void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rx
-
- // convert imported chart model to chart document
- Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
-- mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc );
-+ if( mrFilter.getChartConverter() )
-+ mrFilter.getChartConverter()->convertFromModel( mrFilter, aModel, xChartDoc );
- }
- catch( Exception& )
- {
-diff --git oox/source/drawingml/lineproperties.cxx oox/source/drawingml/lineproperties.cxx
-index d46d46e..4e7a591 100644
---- oox/source/drawingml/lineproperties.cxx
-+++ oox/source/drawingml/lineproperties.cxx
-@@ -76,6 +76,7 @@ static const sal_Char* const sppcDefaultLineNames[] =
-
- DashStyle lclGetDashStyle( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_rnd: return DashStyle_ROUNDRELATIVE;
-@@ -87,6 +88,7 @@ DashStyle lclGetDashStyle( sal_Int32 nToken )
-
- LineJoint lclGetLineJoint( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_round: return LineJoint_ROUND;
-@@ -102,6 +104,7 @@ const sal_Int32 OOX_ARROWSIZE_LARGE = 2;
-
- sal_Int32 lclGetArrowSize( sal_Int32 nToken )
- {
-+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
- switch( nToken )
- {
- case XML_sm: return OOX_ARROWSIZE_SMALL;
-@@ -123,6 +126,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
-
- OUStringBuffer aBuffer;
- sal_Int32 nArrowType = rArrowProps.moArrowType.get( XML_none );
-+ OSL_ASSERT((nArrowType & sal_Int32(0xFFFF0000))==0);
- switch( nArrowType )
- {
- case XML_triangle:
-@@ -179,6 +183,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
- #define OOX_ARROW_POINT( x, y ) Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) )
-
- ::std::vector< Point > aPoints;
-+ OSL_ASSERT((rArrowProps.moArrowType.get() & sal_Int32(0xFFFF0000))==0);
- switch( rArrowProps.moArrowType.get() )
- {
- case XML_triangle:
-@@ -347,6 +352,7 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyNam
- aLineDash.DashLen = 8 * nLineWidth;
- aLineDash.Distance = 3 * nLineWidth;
-
-+ OSL_ASSERT((moPresetDash.get() & sal_Int32(0xFFFF0000))==0);
- switch( moPresetDash.get() )
- {
- default:
-diff --git oox/source/drawingml/shape.cxx oox/source/drawingml/shape.cxx
-index 19b2f5f..8cf3b14 100644
---- oox/source/drawingml/shape.cxx
-+++ oox/source/drawingml/shape.cxx
-@@ -43,8 +43,10 @@
- #include <tools/solar.h> // for the F_PI180 define
- #include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/beans/XMultiPropertySet.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/xml/AttributeData.hpp>
- #include <com/sun/star/drawing/HomogenMatrix3.hpp>
- #include <com/sun/star/text/XText.hpp>
- #include <basegfx/point/b2dpoint.hxx>
-@@ -87,6 +89,30 @@ Shape::Shape( const sal_Char* pServiceName )
- msServiceName = OUString::createFromAscii( pServiceName );
- setDefaults();
- }
-+
-+Shape::Shape( const ShapePtr& pSourceShape )
-+: maChildren()
-+, mpTextBody(pSourceShape->mpTextBody)
-+, mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
-+, mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
-+, mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
-+, mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
-+, maShapeProperties( pSourceShape->maShapeProperties )
-+, mpMasterTextListStyle( pSourceShape->mpMasterTextListStyle )
-+, mxShape()
-+, msServiceName( pSourceShape->msServiceName )
-+, msName( pSourceShape->msName )
-+, msId( pSourceShape->msId )
-+, mnSubType( pSourceShape->mnSubType )
-+, mnIndex( pSourceShape->mnIndex )
-+, maSize( pSourceShape->maSize )
-+, maPosition( pSourceShape->maPosition )
-+, mxCreateCallback( pSourceShape->mxCreateCallback )
-+, mnRotation( pSourceShape->mnRotation )
-+, mbFlipH( pSourceShape->mbFlipH )
-+, mbFlipV( pSourceShape->mbFlipV )
-+{}
-+
- Shape::~Shape()
- {
- }
-@@ -176,6 +202,19 @@ void Shape::applyShapeReference( const Shape& rReferencedShape )
- mbFlipV = rReferencedShape.mbFlipV;
- }
-
-+void Shape::addChildren( const ::oox::core::XmlFilterBase& rFilterBase,
-+ const ThemePtr& rxTheme,
-+ const Reference< XShapes >& rxShapes,
-+ const awt::Rectangle* pShapeRect,
-+ ShapeIdMap* pShapeMap )
-+{
-+ addChildren(rFilterBase, *this, rxTheme, rxShapes,
-+ pShapeRect ?
-+ *pShapeRect :
-+ awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ),
-+ pShapeMap);
-+}
-+
- // for group shapes, the following method is also adding each child
- void Shape::addChildren(
- const ::oox::core::XmlFilterBase& rFilterBase,
-@@ -474,6 +513,40 @@ Reference< XShape > Shape::createAndInsert(
- getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle );
- }
- }
-+
-+ if ( rServiceName.equalsAscii( "com.sun.star.drawing.DiagramShape" ) )
-+ {
-+ // TEMP: set fragment URIs also as alien attributes
-+ Reference< container::XNameContainer > xCont( xSet->getPropertyValue(
-+ OUString::createFromAscii("UserDefinedAttributes")),
-+ UNO_QUERY_THROW );
-+
-+ xml::AttributeData attrData;
-+ attrData.Namespace = OUString::createFromAscii( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:diagram:1.0" );
-+ attrData.Type = OUString::createFromAscii( "CDATA" );
-+
-+ // TEMP: dummy URI
-+ attrData.Value = OUString::createFromAscii("../pictures/data1.xml");
-+
-+ const OUString sDiagramData(OUString::createFromAscii("diagram:data"));
-+ // if( (maShapeProperties[sDiagramData] >>= attrData.Value) )
-+ xCont->insertByName(sDiagramData, makeAny(attrData));
-+
-+ const OUString sDiagramLayout(OUString::createFromAscii("diagram:layout"));
-+ // if( (maShapeProperties[sDiagramLayout] >>= attrData.Value) )
-+ xCont->insertByName(sDiagramLayout, makeAny(attrData));
-+
-+ const OUString sDiagramQStyle(OUString::createFromAscii("diagram:quick-style"));
-+ // if( (maShapeProperties[sDiagramQStyle] >>= attrData.Value) )
-+ xCont->insertByName(sDiagramQStyle, makeAny(attrData));
-+
-+ const OUString sDiagramColorStyle(OUString::createFromAscii("diagram:color-style"));
-+ // if( (maShapeProperties[sDiagramColorStyle] >>= attrData.Value) )
-+ xCont->insertByName(sDiagramColorStyle, makeAny(attrData));
-+
-+ xSet->setPropertyValue( OUString::createFromAscii("UserDefinedAttributes"),
-+ makeAny(xCont) );
-+ }
- }
-
- // use a callback for further processing on the XShape (e.g. charts)
-diff --git oox/source/drawingml/shapepropertiescontext.cxx oox/source/drawingml/shapepropertiescontext.cxx
-index 1c02068..b135a6d 100644
---- oox/source/drawingml/shapepropertiescontext.cxx
-+++ oox/source/drawingml/shapepropertiescontext.cxx
-@@ -108,8 +108,11 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
- case NMSP_DRAWINGML|XML_effectDag: // CT_EffectContainer
- break;
-
-- // todo
- case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
-+// xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) );
-+ break;
-+
-+ // todo
- case NMSP_DRAWINGML|XML_sp3d: // CT_Shape3D
- break;
- }
-diff --git oox/source/drawingml/textparagraph.cxx oox/source/drawingml/textparagraph.cxx
-index 383d02d..8c7f3c2 100644
---- oox/source/drawingml/textparagraph.cxx
-+++ oox/source/drawingml/textparagraph.cxx
-@@ -64,6 +64,9 @@ void TextParagraph::insertAt(
- Reference< XTextRange > xStart( xAt, UNO_QUERY );
-
- sal_Int16 nLevel = maProperties.getLevel();
-+
-+ OSL_TRACE("TextParagraph::insertAt() - level %d", nLevel);
-+
- const TextParagraphPropertiesVector& rListStyle = rTextListStyle.getListStyle();
- if ( nLevel >= static_cast< sal_Int16 >( rListStyle.size() ) )
- nLevel = 0;
-@@ -114,6 +117,12 @@ void TextParagraph::insertAt(
- const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
- xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( -1 ) ) );
- }
-+ else if ( nLevel > 1 )
-+ {
-+ // Even more UGLY HACK
-+ const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
-+ xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( nLevel-1 ) ) );
-+ }
-
- // FIXME this is causing a lot of dispruption (ie does not work). I wonder what to do -- Hub
- // Reference< XTextRange > xEnd( xAt, UNO_QUERY );
-diff --git oox/source/drawingml/textparagraphproperties.cxx oox/source/drawingml/textparagraphproperties.cxx
-index a3ffc48..168e25f 100644
---- oox/source/drawingml/textparagraphproperties.cxx
-+++ oox/source/drawingml/textparagraphproperties.cxx
-@@ -113,6 +113,7 @@ void BulletList::setSuffixMinusRight()
-
- void BulletList::setType( sal_Int32 nType )
- {
-+ OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
- // OSL_TRACE( "OOX: set list numbering type %d", nType);
- switch( nType )
- {
-diff --git oox/source/helper/storagebase.cxx oox/source/helper/storagebase.cxx
-index 9b853e0..1933257 100644
---- oox/source/helper/storagebase.cxx
-+++ oox/source/helper/storagebase.cxx
-@@ -49,17 +49,25 @@ namespace oox {
-
- namespace {
-
--void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, const OUString& rFullName )
-+void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, OUString aFullName )
- {
-- sal_Int32 nSlashPos = rFullName.indexOf( '/' );
-- if( (0 <= nSlashPos) && (nSlashPos < rFullName.getLength()) )
-+ sal_Int32 nSlashPos = aFullName.indexOf( '/' );
-+
-+ // strip leading slashes
-+ while( nSlashPos == 0 )
-+ {
-+ aFullName = aFullName.copy(1);
-+ nSlashPos = aFullName.indexOf( '/' );
-+ }
-+
-+ if( (0 <= nSlashPos) && (nSlashPos < aFullName.getLength()) )
- {
-- orElement = rFullName.copy( 0, nSlashPos );
-- orRemainder = rFullName.copy( nSlashPos + 1 );
-+ orElement = aFullName.copy( 0, nSlashPos );
-+ orRemainder = aFullName.copy( nSlashPos + 1 );
- }
- else
- {
-- orElement = rFullName;
-+ orElement = aFullName;
- }
- }
-
-diff --git oox/source/ppt/dgmimport.cxx oox/source/ppt/dgmimport.cxx
-new file mode 100644
-index 0000000..a091212
---- /dev/null
-+++ oox/source/ppt/dgmimport.cxx
-@@ -0,0 +1,124 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: pptimport.cxx,v $
-+ * $Revision: 1.8.6.1 $
-+ *
-+ * 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 "oox/ppt/dgmimport.hxx"
-+#include "oox/drawingml/theme.hxx"
-+#include "oox/drawingml/diagram/diagram.hxx"
-+#include "oox/dump/pptxdumper.hxx"
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+
-+using ::rtl::OUString;
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::xml::sax;
-+using namespace oox::core;
-+
-+namespace oox { namespace ppt {
-+
-+OUString SAL_CALL QuickDiagrammingImport_getImplementationName() throw()
-+{
-+ return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
-+}
-+
-+uno::Sequence< OUString > SAL_CALL QuickDiagrammingImport_getSupportedServiceNames() throw()
-+{
-+ const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.import" );
-+ const Sequence< OUString > aSeq( &aServiceName, 1 );
-+ return aSeq;
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
-+{
-+ return (cppu::OWeakObject*)new QuickDiagrammingImport( rSMgr );
-+}
-+
-+QuickDiagrammingImport::QuickDiagrammingImport( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
-+ : XmlFilterBase( rSMgr )
-+{}
-+
-+bool QuickDiagrammingImport::importDocument() throw()
-+{
-+ /* to activate the PPTX dumper, define the environment variable
-+ OOO_PPTXDUMPER and insert the full path to the file
-+ file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
-+ OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
-+
-+ OUString aEmpty;
-+ OUString aFragmentPath = getFragmentPathFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "diagramLayout" ) );
-+
-+ Reference<drawing::XShapes> xParentShape(getParentShape(),
-+ UNO_QUERY_THROW);
-+ oox::drawingml::ShapePtr pShape(
-+ new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
-+ drawingml::loadDiagram(pShape,
-+ *this,
-+ aEmpty,
-+ aFragmentPath,
-+ aEmpty,
-+ aEmpty);
-+ pShape->addShape( *this,
-+ oox::drawingml::ThemePtr(
-+ new oox::drawingml::Theme()),
-+ xParentShape,
-+ NULL,
-+ NULL );
-+
-+ return true;
-+}
-+
-+bool QuickDiagrammingImport::exportDocument() throw()
-+{
-+ return false;
-+}
-+
-+const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
-+{
-+ // TODO
-+ return 0;
-+}
-+
-+sal_Int32 QuickDiagrammingImport::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
-+{
-+ // TODO
-+ return 0;
-+}
-+
-+const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
-+{
-+ return oox::drawingml::table::TableStyleListPtr();
-+}
-+
-+OUString QuickDiagrammingImport::implGetImplementationName() const
-+{
-+ return QuickDiagrammingImport_getImplementationName();
-+}
-+
-+}}
-diff --git oox/source/ppt/dgmlayout.cxx oox/source/ppt/dgmlayout.cxx
-new file mode 100644
-index 0000000..f893b18
---- /dev/null
-+++ oox/source/ppt/dgmlayout.cxx
-@@ -0,0 +1,183 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: pptimport.cxx,v $
-+ * $Revision: 1.8.6.1 $
-+ *
-+ * 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 "oox/ppt/dgmlayout.hxx"
-+#include "oox/drawingml/theme.hxx"
-+#include "oox/drawingml/themefragmenthandler.hxx"
-+#include "oox/drawingml/diagram/diagram.hxx"
-+#include "oox/dump/pptxdumper.hxx"
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
-+#include <com/sun/star/container/XChild.hpp>
-+
-+using ::rtl::OUString;
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::xml::sax;
-+using namespace oox::core;
-+using namespace ::oox::drawingml;
-+
-+namespace oox { namespace ppt {
-+
-+OUString SAL_CALL QuickDiagrammingLayout_getImplementationName() throw()
-+{
-+ return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingLayout" );
-+}
-+
-+uno::Sequence< OUString > SAL_CALL QuickDiagrammingLayout_getSupportedServiceNames() throw()
-+{
-+ const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.layout" );
-+ const Sequence< OUString > aSeq( &aServiceName, 1 );
-+ return aSeq;
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingLayout_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
-+{
-+ return (cppu::OWeakObject*)new QuickDiagrammingLayout( rSMgr );
-+}
-+
-+QuickDiagrammingLayout::QuickDiagrammingLayout( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
-+ : XmlFilterBase( rSMgr ),
-+ mpThemePtr(new drawingml::Theme())
-+{}
-+
-+bool QuickDiagrammingLayout::importDocument() throw()
-+{
-+ Reference<drawing::XShape> xParentShape(getParentShape(),
-+ UNO_QUERY_THROW);
-+ Reference<drawing::XShapes> xParentShapes(xParentShape,
-+ UNO_QUERY_THROW);
-+ Reference<beans::XPropertySet> xPropSet(xParentShape,
-+ UNO_QUERY_THROW);
-+
-+ // can we grab the theme from the master page?
-+ Reference<container::XChild> xChild(xParentShape,
-+ UNO_QUERY);
-+ if( xChild.is() )
-+ {
-+ // TODO: cater for diagram shapes inside groups
-+ Reference<drawing::XMasterPageTarget> xMasterPageTarget(xChild->getParent(),
-+ UNO_QUERY);
-+ if( xMasterPageTarget.is() )
-+ {
-+ uno::Reference<drawing::XDrawPage> xMasterPage(
-+ xMasterPageTarget->getMasterPage());
-+
-+ Reference<beans::XPropertySet> xPropSet2(xMasterPage,
-+ UNO_QUERY_THROW);
-+ Reference<xml::dom::XDocument> xThemeFragment;
-+ xPropSet2->getPropertyValue(
-+ CREATE_OUSTRING("PPTTheme")) >>= xThemeFragment;
-+
-+ importFragment(
-+ new ThemeFragmentHandler(
-+ *this, OUString(), *mpThemePtr ),
-+ Reference<xml::sax::XFastSAXSerializable>(
-+ xThemeFragment,
-+ UNO_QUERY_THROW));
-+ }
-+ }
-+
-+ Reference<xml::dom::XDocument> xDataModelDom;
-+ Reference<xml::dom::XDocument> xLayoutDom;
-+ Reference<xml::dom::XDocument> xQStyleDom;
-+ Reference<xml::dom::XDocument> xColorStyleDom;
-+
-+ xPropSet->getPropertyValue(
-+ CREATE_OUSTRING("DiagramData")) >>= xDataModelDom;
-+ xPropSet->getPropertyValue(
-+ CREATE_OUSTRING("DiagramLayout")) >>= xLayoutDom;
-+ xPropSet->getPropertyValue(
-+ CREATE_OUSTRING("DiagramQStyle")) >>= xQStyleDom;
-+ xPropSet->getPropertyValue(
-+ CREATE_OUSTRING("DiagramColorStyle")) >>= xColorStyleDom;
-+
-+ oox::drawingml::ShapePtr pShape(
-+ new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
-+ drawingml::loadDiagram(pShape,
-+ *this,
-+ xDataModelDom,
-+ xLayoutDom,
-+ xQStyleDom,
-+ xColorStyleDom);
-+
-+ // don't add pShape itself, but only its children
-+ pShape->setXShape(getParentShape());
-+
-+ const awt::Size& rSize=xParentShape->getSize();
-+ const awt::Point& rPoint=xParentShape->getPosition();
-+ const long nScaleFactor=360;
-+ const awt::Rectangle aRect(nScaleFactor*rPoint.X,
-+ nScaleFactor*rPoint.Y,
-+ nScaleFactor*rSize.Width,
-+ nScaleFactor*rSize.Height);
-+
-+ pShape->addChildren( *this,
-+ mpThemePtr,
-+ xParentShapes,
-+ &aRect,
-+ NULL );
-+
-+ return true;
-+}
-+
-+bool QuickDiagrammingLayout::exportDocument() throw()
-+{
-+ return false;
-+}
-+
-+const ::oox::drawingml::Theme* QuickDiagrammingLayout::getCurrentTheme() const
-+{
-+ return mpThemePtr.get();
-+}
-+
-+sal_Int32 QuickDiagrammingLayout::getSchemeClr( sal_Int32 nColorSchemeToken ) const
-+{
-+ sal_Int32 nColor = 0;
-+ if( mpThemePtr )
-+ mpThemePtr->getClrScheme().getColor( nColorSchemeToken,
-+ nColor );
-+ return nColor;
-+}
-+
-+const oox::drawingml::table::TableStyleListPtr QuickDiagrammingLayout::getTableStyles()
-+{
-+ return oox::drawingml::table::TableStyleListPtr();
-+}
-+
-+OUString QuickDiagrammingLayout::implGetImplementationName() const
-+{
-+ return QuickDiagrammingLayout_getImplementationName();
-+}
-+
-+}}
-diff --git oox/source/ppt/makefile.mk oox/source/ppt/makefile.mk
-index 3e9372b..ecaf0dc 100644
---- oox/source/ppt/makefile.mk
-+++ oox/source/ppt/makefile.mk
-@@ -54,6 +54,8 @@ SLOFILES = \
- $(SLO)$/commontimenodecontext.obj \
- $(SLO)$/conditioncontext.obj \
- $(SLO)$/customshowlistcontext.obj \
-+ $(SLO)$/dgmimport.obj\
-+ $(SLO)$/dgmlayout.obj\
- $(SLO)$/layoutfragmenthandler.obj\
- $(SLO)$/pptfilterhelpers.obj\
- $(SLO)$/pptgraphicshapecontext.obj \
-diff --git oox/source/ppt/pptimport.cxx oox/source/ppt/pptimport.cxx
-index 9f4668f..657795f 100644
---- oox/source/ppt/pptimport.cxx
-+++ oox/source/ppt/pptimport.cxx
-@@ -177,9 +177,9 @@ const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles(
- return mpTableStyleList;;
- }
-
--::oox::drawingml::chart::ChartConverter& PowerPointImport::getChartConverter()
-+::oox::drawingml::chart::ChartConverter* PowerPointImport::getChartConverter()
- {
-- return *mxChartConv;
-+ return mxChartConv.get();
- }
-
- OUString PowerPointImport::implGetImplementationName() const
-diff --git oox/source/ppt/presentationfragmenthandler.cxx oox/source/ppt/presentationfragmenthandler.cxx
-index af27b6a..ce48fd9 100644
---- oox/source/ppt/presentationfragmenthandler.cxx
-+++ oox/source/ppt/presentationfragmenthandler.cxx
-@@ -35,6 +35,8 @@
- #include <com/sun/star/drawing/XDrawPages.hpp>
- #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
- #include <com/sun/star/drawing/XMasterPageTarget.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/style/XStyle.hpp>
- #include <com/sun/star/presentation/XPresentationPage.hpp>
-@@ -176,8 +178,17 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
- {
- oox::drawingml::ThemePtr pThemePtr( new oox::drawingml::Theme() );
- pMasterPersistPtr->setTheme( pThemePtr );
-- rFilter.importFragment( new ThemeFragmentHandler( rFilter, aThemeFragmentPath, *pThemePtr ) );
-+ Reference<xml::dom::XDocument> xDoc=
-+ rFilter.importFragment(aThemeFragmentPath);
-+
-+ rFilter.importFragment(
-+ new ThemeFragmentHandler(
-+ rFilter, aThemeFragmentPath, *pThemePtr ),
-+ Reference<xml::sax::XFastSAXSerializable>(
-+ xDoc,
-+ UNO_QUERY_THROW));
- rThemes[ aThemeFragmentPath ] = pThemePtr;
-+ pThemePtr->setFragment(xDoc);
- }
- else
- {
-@@ -188,6 +199,15 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
- rFilter.importFragment( new LayoutFragmentHandler( rFilter, aLayoutFragmentPath, pMasterPersistPtr ) );
- pMasterPersistPtr->createBackground( rFilter );
- pMasterPersistPtr->createXShapes( rFilter );
-+
-+ if( pMasterPersistPtr->getTheme() )
-+ {
-+ uno::Reference< beans::XPropertySet > xPagePropSet( xMasterPage,
-+ uno::UNO_QUERY_THROW );
-+ xPagePropSet->setPropertyValue(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PPTTheme" )),
-+ uno::makeAny(pMasterPersistPtr->getTheme()->getFragment()));
-+ }
- }
- }
- }
-diff --git oox/source/shape/ShapeFilterBase.cxx oox/source/shape/ShapeFilterBase.cxx
-index c43eadd..a5e2c4d 100644
---- oox/source/shape/ShapeFilterBase.cxx
-+++ oox/source/shape/ShapeFilterBase.cxx
-@@ -68,9 +68,9 @@ const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles
- return ::oox::drawingml::table::TableStyleListPtr();
- }
-
--::oox::drawingml::chart::ChartConverter& ShapeFilterBase::getChartConverter()
-+::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
- {
-- return *mxChartConv;
-+ return mxChartConv.get();
- }
-
- ::rtl::OUString ShapeFilterBase::implGetImplementationName() const
-diff --git oox/source/shape/ShapeFilterBase.hxx oox/source/shape/ShapeFilterBase.hxx
-index 0657aea..007142d 100644
---- oox/source/shape/ShapeFilterBase.hxx
-+++ oox/source/shape/ShapeFilterBase.hxx
-@@ -64,7 +64,7 @@ public:
- /** Has to be implemented by each filter to return TableStyles. */
- virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
-
-- virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
-+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
-
- virtual rtl::OUString implGetImplementationName() const;
-
-diff --git oox/source/token/makefile.mk oox/source/token/makefile.mk
-index 8966dda..d776ed3 100644
---- oox/source/token/makefile.mk
-+++ oox/source/token/makefile.mk
-@@ -54,7 +54,8 @@ $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$
- @@noop $(assign do_phony:=.PHONY)
-
- $(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
-- $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
-+ @echo "Making: " $(@:f)
-+ $(QUIET_BUILD) $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
-
- $(INCCOM)$/oox:
- $(MKDIR) $(INCCOM)$/oox
-@@ -63,11 +64,13 @@ $(INCCOM)$/oox$/core: $(INCCOM)$/oox
- $(MKDIR) $(INCCOM)$/oox$/core
-
- $(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
-+ @echo "Making: " $(@:f)
- $(MKDIRHIER) $(INCCOM)$/oox$/core
-- $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
-+ $(QUIET_BUILD) $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
-
- $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
-- gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
-+ @echo "Making: " $(@:f)
-+ $(QUIET_BUILD) gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
-
--$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
-+$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces makefile.mk
-
-diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
-index b9dfbfd..b066fb8 100644
---- oox/source/xls/excelfilter.cxx
-+++ oox/source/xls/excelfilter.cxx
-@@ -139,7 +139,7 @@ const TableStyleListPtr ExcelFilter::getTableStyles()
- return TableStyleListPtr();
- }
-
--::oox::drawingml::chart::ChartConverter& ExcelFilter::getChartConverter()
-+::oox::drawingml::chart::ChartConverter* ExcelFilter::getChartConverter()
- {
- OSL_ENSURE( mpHelper, "ExcelFilter::getChartConverter - no workbook helper" );
- return mpHelper->getChartConverter();
-diff --git oox/source/xls/workbookhelper.cxx oox/source/xls/workbookhelper.cxx
-index 03a0cc8..49cb5b6 100644
---- oox/source/xls/workbookhelper.cxx
-+++ oox/source/xls/workbookhelper.cxx
-@@ -230,7 +230,7 @@ public:
- /** Returns the converter for string to cell address/range conversion. */
- inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
- /** Returns the chart object converter. */
-- inline ExcelChartConverter& getChartConverter() const { return *mxChartConverter; }
-+ inline ExcelChartConverter* getChartConverter() const { return mxChartConverter.get(); }
-
- // property helpers -------------------------------------------------------
-
-@@ -846,7 +846,7 @@ AddressConverter& WorkbookHelper::getAddressConverter() const
- return mrBookData.getAddressConverter();
- }
-
--ExcelChartConverter& WorkbookHelper::getChartConverter() const
-+ExcelChartConverter* WorkbookHelper::getChartConverter() const
- {
- return mrBookData.getChartConverter();
- }
-diff --git sc/source/filter/excel/xestream.cxx sc/source/filter/excel/xestream.cxx
-index a279b9d..0f8262c 100644
---- sc/source/filter/excel/xestream.cxx
-+++ sc/source/filter/excel/xestream.cxx
-@@ -1001,10 +1001,9 @@ const oox::drawingml::table::TableStyleListPtr XclExpXmlStream::getTableStyles()
- return oox::drawingml::table::TableStyleListPtr();
- }
-
--oox::drawingml::chart::ChartConverter& XclExpXmlStream::getChartConverter()
-+oox::drawingml::chart::ChartConverter* XclExpXmlStream::getChartConverter()
- {
-- // DO NOT CALL
-- return * (oox::drawingml::chart::ChartConverter*) NULL;
-+ return NULL;
- }
-
- bool XclExpXmlStream::exportDocument() throw()
-diff --git sc/source/filter/inc/xestream.hxx sc/source/filter/inc/xestream.hxx
-index 2a819d7..84bf4ce 100644
---- sc/source/filter/inc/xestream.hxx
-+++ sc/source/filter/inc/xestream.hxx
-@@ -341,7 +341,7 @@ public:
- virtual const oox::vml::DrawingPtr getDrawings();
- virtual const oox::drawingml::Theme* getCurrentTheme() const;
- virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
-- virtual oox::drawingml::chart::ChartConverter& getChartConverter();
-+ virtual oox::drawingml::chart::ChartConverter* getChartConverter();
-
- void Trace( const char* format, ...);
- private:
-diff --git sd/inc/glob.hrc sd/inc/glob.hrc
-index 3fb822e..c80c253 100644
---- sd/inc/glob.hrc
-+++ sd/inc/glob.hrc
-@@ -152,4 +152,5 @@
- #define STR_TABLEOBJECTBARSHELL RID_GLOB_START+225
- #define RID_TABPAGE_PARA_NUMBERING RID_GLOB_START+226
-
-+#define DLG_DIAGRAMDESIGNPANE RID_GLOB_START+227
-
-diff --git sd/inc/helpids.h sd/inc/helpids.h
-index 9d5260e..7bcd779 100644
---- sd/inc/helpids.h
-+++ sd/inc/helpids.h
-@@ -280,3 +280,4 @@
- #define HID_SD_CELL_STYLE_LAST_COLUMN (HID_SD_START + 199)
-
- #define HID_SD_TABLE_DESIGN (HID_SD_START + 200)
-+#define HID_SD_DIAGRAM_DESIGN (HID_SD_START + 201)
-diff --git sd/inc/sdpage.hxx sd/inc/sdpage.hxx
-index bb7d6b8..729fcd0 100644
---- sd/inc/sdpage.hxx
-+++ sd/inc/sdpage.hxx
-@@ -58,8 +58,11 @@
- #include "misc/scopelock.hxx"
- #include "sddllapi.h"
-
--namespace com { namespace sun { namespace star { namespace animations {
-- class XAnimationNode;
-+namespace com { namespace sun { namespace star {
-+ namespace xml { namespace dom {
-+ class XDocument; } }
-+ namespace animations {
-+ class XAnimationNode;
- } } } }
-
- class SfxStyleSheet;
-@@ -148,6 +151,8 @@ protected:
- USHORT mnPaperBin; // PaperBin
- Orientation meOrientation; // Print-Orientation
- SdPageLink* mpPageLink; // PageLink (nur bei gelinkten Seiten)
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> mxTheme;
-
- /** holds the smil animation sequences for this page */
- ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
-@@ -276,6 +281,11 @@ public:
- double getTransitionDuration() const;
- void setTransitionDuration( double fTranstionDuration );
-
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> getPPTTheme() const;
-+ void setPPTTheme( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& );
-+
- // Virtuelle Methoden von SdrObjUserCall
- virtual void Changed(const SdrObject& rObj, SdrUserCallType eType,
- const Rectangle& rOldBoundRect);
-diff --git sd/prj/build.lst sd/prj/build.lst
-index 949153b..325b203 100644
---- sd/prj/build.lst
-+++ sd/prj/build.lst
-@@ -26,6 +26,7 @@ sd sd\source\ui\slidesorter\controller nmake - all sd_slscontroller sd_sdi sd_i
- sd sd\source\ui\slidesorter\cache nmake - all sd_slscache sd_inc NULL
- sd sd\source\ui\notes nmake - all sd_notes sd_inc NULL
- sd sd\source\ui\table nmake - all sd_table sd_inc NULL
-+sd sd\source\ui\diagram nmake - all sd_diagram sd_inc NULL
- sd sd\source\filter\ppt nmake - all sd_ppt sd_inc NULL
- sd sd\source\filter nmake - all sd_filt sd_sdi sd_ppt sd_inc NULL
- sd sd\source\filter\cgm nmake - all sd_cgm sd_inc NULL
-@@ -41,5 +42,5 @@ sd sd\source\ui\framework\configuration nmake - all sd_framework_configuration s
- sd sd\source\ui\framework\module nmake - all sd_framework_module sd_inc NULL
- sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd_inc NULL
- sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL
--sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_pptx sd_filt sd_func sd_grf sd_unid sd_view sd_filter_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories NULL
-+sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_pptx sd_filt sd_func sd_grf sd_unid sd_view sd_filter_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_diagram sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories NULL
- sd sd\xml nmake - all sd_xml NULL
-diff --git sd/source/core/sdpage2.cxx sd/source/core/sdpage2.cxx
-index 93e39e8..2c41294 100644
---- sd/source/core/sdpage2.cxx
-+++ sd/source/core/sdpage2.cxx
-@@ -586,3 +586,13 @@ void SdPage::setTransitionDuration ( double fTranstionDuration )
- mfTransitionDuration = fTranstionDuration;
- ActionChanged();
- }
-+
-+uno::Reference<xml::dom::XDocument> SdPage::getPPTTheme() const
-+{
-+ return mxTheme;
-+}
-+
-+void SdPage::setPPTTheme( const uno::Reference<xml::dom::XDocument>& xRef )
-+{
-+ mxTheme = xRef;
-+}
-diff --git sd/source/filter/pptx/epptooxml.hxx sd/source/filter/pptx/epptooxml.hxx
-index 2c850bd..729ad80 100644
---- sd/source/filter/pptx/epptooxml.hxx
-+++ sd/source/filter/pptx/epptooxml.hxx
-@@ -57,7 +57,7 @@ public:
- virtual const oox::vml::DrawingPtr getDrawings() { return oox::vml::DrawingPtr(); }
- virtual const oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
- virtual const oox::drawingml::table::TableStyleListPtr getTableStyles() { return oox::drawingml::table::TableStyleListPtr(); }
-- virtual oox::drawingml::chart::ChartConverter& getChartConverter();
-+ virtual oox::drawingml::chart::ChartConverter* getChartConverter();
-
- static const char* GetSideDirection( sal_uInt8 nDirection );
- static const char* GetCornerDirection( sal_uInt8 nDirection );
-diff --git sd/source/filter/pptx/pptx-epptooxml.cxx sd/source/filter/pptx/pptx-epptooxml.cxx
-index 50862df..746168f 100644
---- sd/source/filter/pptx/pptx-epptooxml.cxx
-+++ sd/source/filter/pptx/pptx-epptooxml.cxx
-@@ -1882,9 +1882,9 @@ sal_Bool PowerPointExport::ImplCreateMainNotes()
-
- //------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
--drawingml::chart::ChartConverter& PowerPointExport::getChartConverter()
-+drawingml::chart::ChartConverter* PowerPointExport::getChartConverter()
- {
-- return *mxChartConv;
-+ return mxChartConv.get();
- }
-
- #define IMPL_NAME "com.sun.star.comp.Impress.oox.PowerPointExport"
-diff --git sd/source/filter/xml/sdxmlwrp.cxx sd/source/filter/xml/sdxmlwrp.cxx
-index 05d9ec6..3c619b9 100644
---- sd/source/filter/xml/sdxmlwrp.cxx
-+++ sd/source/filter/xml/sdxmlwrp.cxx
-@@ -42,6 +42,7 @@
- #include "drawdoc.hxx"
- #include <unotools/streamwrap.hxx>
- #include <svx/xmlgrhlp.hxx>
-+#include <svx/svdodiagram.hxx>
-
- #include "../../ui/inc/DrawDocShell.hxx"
-
-@@ -485,6 +486,9 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
- { MAP_LEN( "BaseURI" ), 0,
- &::getCppuType( (OUString *)0 ),
- ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
-+ { MAP_LEN( "SourceStorage" ), 0,
-+ &::getCppuType( (Reference<embed::XStorage> *)0 ),
-+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
- { MAP_LEN( "StreamRelPath" ), 0,
- &::getCppuType( (OUString *)0 ),
- ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
-@@ -591,6 +595,10 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
- const OUString sBaseURI( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
- xInfoSet->setPropertyValue( sBaseURI, makeAny( mrMedium.GetBaseURL() ) );
-
-+ // set document storage
-+ const OUString sSourceStorage( RTL_CONSTASCII_USTRINGPARAM("SourceStorage") );
-+ xInfoSet->setPropertyValue( sSourceStorage, makeAny( xStorage ) );
-+
- if( 0 == nRet && SFX_CREATE_MODE_EMBEDDED == mrDocShell.GetCreateMode() )
- {
- OUString aName;
-@@ -803,6 +811,29 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
-
- if( bTransform )
- TransformOOo2xDocument( pDoc );
-+
-+ // HACK. force relayout of diagramming shapes. misplaced
-+ // here, and totally ignores groups
-+ sal_uInt16 nPageCount = pDoc->GetPageCount();
-+ for( sal_uInt16 nPage = 0; nPage < nPageCount; nPage++ )
-+ {
-+ SdrObjList* pPage = pDoc->GetPage( nPage );
-+ if( pPage )
-+ {
-+ sal_uInt32 nShapeCount = pPage->GetObjCount();
-+ for( sal_uInt32 nShape = 0; nShape < nShapeCount; nShape++ )
-+ {
-+ SdrObject* pObj = pPage->GetObj( nShape );
-+ if( pObj )
-+ {
-+ sdr::diagram::SdrDiagramObj* pDgmShape =
-+ dynamic_cast<sdr::diagram::SdrDiagramObj*>(pObj);
-+ if( pDgmShape )
-+ pDgmShape->LayoutShape();
-+ }
-+ }
-+ }
-+ }
- }
- }
-
-diff --git sd/source/ui/animations/CustomAnimationCreateDialog.cxx sd/source/ui/animations/CustomAnimationCreateDialog.cxx
-index e244486..6b715d2 100644
---- sd/source/ui/animations/CustomAnimationCreateDialog.cxx
-+++ sd/source/ui/animations/CustomAnimationCreateDialog.cxx
-@@ -672,10 +672,10 @@ void CustomAnimationCreateDialog::preview( const CustomAnimationPresetPtr& pPres
-
- namespace
- {
--Window * lcl_GetTopmostParent( Window * pWindow )
-+::Window * lcl_GetTopmostParent( ::Window * pWindow )
- {
-- Window * pResult = 0;
-- Window * pCurrent = pWindow ? pWindow->GetParent() : 0;
-+ ::Window * pResult = 0;
-+ ::Window * pCurrent = pWindow ? pWindow->GetParent() : 0;
- while( pCurrent )
- {
- pResult = pCurrent;
-diff --git sd/source/ui/animations/motionpathtag.cxx sd/source/ui/animations/motionpathtag.cxx
-index 34942f4..b37c359 100644
---- sd/source/ui/animations/motionpathtag.cxx
-+++ sd/source/ui/animations/motionpathtag.cxx
-@@ -499,7 +499,7 @@ void MotionPathTag::MovePath( int nDX, int nDY )
- // --------------------------------------------------------------------
-
- /** returns true if the MotionPathTag handled the event. */
--bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl )
-+bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl, const sd::Window& )
- {
- if( !mpPathObj )
- return false;
-@@ -520,6 +520,7 @@ bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl )
- }
- else if( rMEvt.IsLeft() )
- {
-+ // TODO: this should be rWin from above, I guess...
- OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow();
- Point aMDPos( pOut->PixelToLogic( rMEvt.GetPosPixel() ) );
-
-@@ -629,7 +630,7 @@ bool MotionPathTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& rHdl )
- // --------------------------------------------------------------------
-
- /** returns true if the SmartTag consumes this event. */
--bool MotionPathTag::KeyInput( const KeyEvent& rKEvt )
-+bool MotionPathTag::KeyInput( const KeyEvent& rKEvt, const Window& rWin )
- {
- if( !mpPathObj )
- return false;
-diff --git sd/source/ui/animations/motionpathtag.hxx sd/source/ui/animations/motionpathtag.hxx
-index e22b418..7310f7e 100644
---- sd/source/ui/animations/motionpathtag.hxx
-+++ sd/source/ui/animations/motionpathtag.hxx
-@@ -61,10 +61,10 @@ public:
- SdrPathObj* getPathObj() const { return mpPathObj; }
-
- /** returns true if the SmartTag handled the event. */
-- virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
-+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl&, const Window& );
-
- /** returns true if the SmartTag consumes this event. */
-- virtual bool KeyInput( const KeyEvent& rKEvt );
-+ virtual bool KeyInput( const KeyEvent& rKEvt, const Window& rWin );
-
- // callbacks from sdr view
- virtual ULONG GetMarkablePointCount() const;
-diff --git sd/source/ui/app/strings.src sd/source/ui/app/strings.src
-index fbffd33..f27dcf8 100644
---- sd/source/ui/app/strings.src
-+++ sd/source/ui/app/strings.src
-@@ -1241,6 +1241,10 @@ String DLG_TABLEDESIGNPANE
- {
- Text [ en-US ] = "Table Designs";
- };
-+String DLG_DIAGRAMDESIGNPANE
-+{
-+ Text [ en-US ] = "QuickDiagram Designs";
-+};
- String STR_NAVIGATOR_SHOW_NAMED_SHAPES
- {
- Text [ en-US ] = "Named shapes";
-@@ -1258,4 +1262,4 @@ String STR_SET_BACKGROUND_PICTURE
- Text [ en-US ] = "Set Background Picture for Slide ..." ;
- };
-
--
-\ No newline at end of file
-+
-diff --git sd/source/ui/diagram/DiagramDesignPane.cxx sd/source/ui/diagram/DiagramDesignPane.cxx
-new file mode 100644
-index 0000000..9031342
---- /dev/null
-+++ sd/source/ui/diagram/DiagramDesignPane.cxx
-@@ -0,0 +1,685 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPane.cxx,v $
-+ * $Revision: 1.4 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sd.hxx"
-+
-+#include "sddll.hxx"
-+
-+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+
-+#include <comphelper/processfactory.hxx>
-+
-+#include <sfx2/viewfrm.hxx>
-+
-+#include <vcl/bmpacc.hxx>
-+
-+#include <svtools/style.hxx>
-+
-+#include <sfx2/viewfrm.hxx>
-+#include <sfx2/bindings.hxx>
-+#include <sfx2/app.hxx>
-+#include <sfx2/request.hxx>
-+#include <sfx2/dispatch.hxx>
-+
-+#include <svx/svdodiagram.hxx>
-+#include <svx/svdetc.hxx>
-+#include <svx/boxitem.hxx>
-+#include <svx/borderline.hxx>
-+#include <svx/colritem.hxx>
-+#include <svx/eeitem.hxx>
-+#include <svx/unoshape.hxx>
-+
-+#include "DiagramDesignPane.hxx"
-+#include "diagramtag.hxx"
-+
-+#include "DrawDocShell.hxx"
-+#include "ViewShellBase.hxx"
-+#include "DrawViewShell.hxx"
-+#include "DrawController.hxx"
-+#include "glob.hrc"
-+#include "sdresid.hxx"
-+#include "EventMultiplexer.hxx"
-+
-+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
-+using ::rtl::OUString;
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::drawing;
-+using namespace ::com::sun::star::container;
-+using namespace ::com::sun::star::beans;
-+using namespace ::com::sun::star::view;
-+using namespace ::com::sun::star::style;
-+using namespace ::com::sun::star::frame;
-+using namespace ::com::sun::star::lang;
-+using namespace ::com::sun::star::ui;
-+
-+namespace sd {
-+
-+static const sal_Int32 nPreviewColumns = 5;
-+static const sal_Int32 nPreviewRows = 5;
-+
-+// --------------------------------------------------------------------
-+
-+DiagramDesignPane::DiagramDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal )
-+: Control( pParent, SdResId(DLG_DIAGRAMDESIGNPANE) )
-+, mrBase( rBase )
-+, msDiagramTemplate( RTL_CONSTASCII_USTRINGPARAM( "DiagramTemplate" ) )
-+, mpTag()
-+, mbModal( bModal )
-+, mbStyleSelected( false )
-+, mbOptionsChanged( false )
-+{
-+ Window* pControlParent = mbModal ? pParent : this;
-+
-+ mxControls[FL_DIAGRAM_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_DIAGRAM_STYLES + 1 ) ) );
-+
-+ ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_DIAGRAM_STYLES+1 ) );
-+ mxControls[CT_DIAGRAM_STYLES].reset( pValueSet );
-+ if( !mbModal )
-+ {
-+ pValueSet->SetStyle( pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER );
-+ pValueSet->SetColor();
-+ pValueSet->SetExtraSpacing(8);
-+ }
-+ else
-+ {
-+ pValueSet->SetColor( Color( COL_WHITE ) );
-+ pValueSet->SetBackground( Color( COL_WHITE ) );
-+ }
-+ pValueSet->SetSelectHdl (LINK(this, DiagramDesignPane, implValueSetHdl));
-+
-+ mxControls[FL_DIAGRAM_LIST].reset( new FixedLine( pControlParent, SdResId( FL_DIAGRAM_LIST + 1 ) ) );
-+
-+ pValueSet = new ValueSet( pControlParent, SdResId( CT_DIAGRAM_LIST+1 ) );
-+ mxControls[CT_DIAGRAM_LIST].reset( pValueSet );
-+ if( !mbModal )
-+ {
-+ pValueSet->SetStyle( pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER );
-+ pValueSet->SetColor();
-+ pValueSet->SetExtraSpacing(8);
-+ }
-+ else
-+ {
-+ pValueSet->SetColor( Color( COL_WHITE ) );
-+ pValueSet->SetBackground( Color( COL_WHITE ) );
-+ }
-+ pValueSet->SetSelectHdl (LINK(this, DiagramDesignPane, implValueSetHdl));
-+
-+ mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) );
-+ USHORT i;
-+ for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
-+ {
-+ CheckBox *pCheckBox = new CheckBox( pControlParent, SdResId( i+1 ) );
-+ mxControls[i].reset( pCheckBox );
-+ pCheckBox->SetClickHdl( LINK( this, DiagramDesignPane, implCheckBoxHdl ) );
-+ }
-+
-+ for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ )
-+ mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y();
-+
-+ // get current controller and initialize listeners
-+ try
-+ {
-+ mxView = Reference< XDrawView >::query(mrBase.GetController());
-+ addListener();
-+
-+ Reference< XController > xController( mrBase.GetController(), UNO_QUERY_THROW );
-+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( xController->getModel(), UNO_QUERY_THROW );
-+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
-+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("diagram" ) );
-+ mxDiagramFamily = Reference< XIndexAccess >( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
-+
-+ }
-+ catch( Exception& e )
-+ {
-+ (void)e;
-+ DBG_ERROR( "sd::CustomAnimationPane::CustomAnimationPane(), Exception caught!" );
-+ }
-+
-+ onSelectionChanged();
-+ updateControls();
-+
-+ FreeResource();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+DiagramDesignPane::~DiagramDesignPane()
-+{
-+ if( mpTag.is() )
-+ {
-+ mpTag->Dispose();
-+ mpTag.clear();
-+ }
-+ removeListener();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::DataChanged( const DataChangedEvent& /*rDCEvt*/ )
-+{
-+ updateLayout();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::Resize()
-+{
-+ updateLayout();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+static SfxBindings* getBindings( ViewShellBase& rBase )
-+{
-+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
-+ return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings();
-+ else
-+ return 0;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+static SfxDispatcher* getDispatcher( ViewShellBase& rBase )
-+{
-+ if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
-+ return rBase.GetMainViewShell()->GetViewFrame()->GetDispatcher();
-+ else
-+ return 0;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+IMPL_LINK( DiagramDesignPane, implValueSetHdl, Control*, EMPTYARG )
-+{
-+ mbStyleSelected = true;
-+ if( !mbModal )
-+ ApplyStyle();
-+ return 0;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::ApplyStyle()
-+{
-+ try
-+ {
-+ OUString sStyleName;
-+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_DIAGRAM_STYLES].get() );
-+ sal_Int32 nIndex = static_cast< sal_Int32 >( pValueSet->GetSelectItemId() ) - 1;
-+
-+ if( (nIndex >= 0) && (nIndex < mxDiagramFamily->getCount()) )
-+ {
-+ Reference< XNameAccess > xNames( mxDiagramFamily, UNO_QUERY_THROW );
-+ sStyleName = xNames->getElementNames()[nIndex];
-+ }
-+
-+ if( sStyleName.getLength() == 0 )
-+ return;
-+
-+ SdrView* pView = mrBase.GetDrawView();
-+ if( mxSelectedDiagram.is() )
-+ {
-+ if( pView )
-+ {
-+#if 0
-+ SfxRequest aReq( SID_DIAGRAM_STYLE, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
-+ aReq.AppendItem( SfxStringItem( SID_DIAGRAM_STYLE, sStyleName ) );
-+
-+ rtl::Reference< sdr::SelectionController > xController( pView->getSelectionController() );
-+ if( xController.is() )
-+ xController->Execute( aReq );
-+
-+ SfxBindings* pBindings = getBindings( mrBase );
-+ if( pBindings )
-+ {
-+ pBindings->Invalidate( SID_UNDO );
-+ pBindings->Invalidate( SID_REDO );
-+ }
-+#endif
-+ }
-+ }
-+ else
-+ {
-+#if 0
-+ SfxDispatcher* pDispatcher = getDispatcher( mrBase );
-+ SfxStringItem aArg( SID_DIAGRAM_STYLE, sStyleName );
-+ pDispatcher->Execute(SID_INSERT_DIAGRAM, SFX_CALLMODE_ASYNCHRON, &aArg, 0 );
-+#endif
-+ }
-+ }
-+ catch( Exception& )
-+ {
-+ DBG_ERROR("DiagramDesignPane::implValueSetHdl(), exception caught!");
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+IMPL_LINK( DiagramDesignPane, implCheckBoxHdl, Control*, EMPTYARG )
-+{
-+ mbOptionsChanged = true;
-+
-+ if( !mbModal )
-+ ApplyOptions();
-+
-+ FillDesignPreviewControl();
-+ return 0;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::ApplyOptions()
-+{
-+ static sal_uInt16 gParamIds[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] =
-+ {
-+ ID_VAL_USEFIRSTROWSTYLE, ID_VAL_USELASTROWSTYLE, ID_VAL_USEBANDINGROWSTYLE,
-+ ID_VAL_USEFIRSTCOLUMNSTYLE, ID_VAL_USELASTCOLUMNSTYLE, ID_VAL_USEBANDINGCOLUMNSTYLE
-+ };
-+
-+ if( mxSelectedDiagram.is() )
-+ {
-+#if 0
-+ SfxRequest aReq( SID_DIAGRAM_STYLE_SETTINGS, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
-+
-+ for( sal_uInt16 i = 0; i < (CB_BANDED_COLUMNS-CB_HEADER_ROW+1); ++i )
-+ {
-+ aReq.AppendItem( SfxBoolItem( gParamIds[i], static_cast< CheckBox* >( mxControls[CB_HEADER_ROW+i].get() )->IsChecked() ) );
-+ }
-+
-+ SdrView* pView = mrBase.GetDrawView();
-+ if( pView )
-+ {
-+ rtl::Reference< sdr::SelectionController > xController( pView->getSelectionController() );
-+ if( xController.is() )
-+ {
-+ xController->Execute( aReq );
-+
-+ SfxBindings* pBindings = getBindings( mrBase );
-+ if( pBindings )
-+ {
-+ pBindings->Invalidate( SID_UNDO );
-+ pBindings->Invalidate( SID_REDO );
-+ }
-+ }
-+ }
-+#endif
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::onSelectionChanged()
-+{
-+ Reference< XPropertySet > xNewSelection;
-+
-+ if( mpTag.is() )
-+ {
-+ mpTag->Dispose();
-+ mpTag.clear();
-+ }
-+
-+ if( mxView.is() ) try
-+ {
-+ Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW );
-+ if (xSel.is())
-+ {
-+ Any aSel( xSel->getSelection() );
-+ Sequence< XShape > xShapeSeq;
-+ if( aSel >>= xShapeSeq )
-+ {
-+ if( xShapeSeq.getLength() == 1 )
-+ aSel <<= xShapeSeq[0];
-+ }
-+ else
-+ {
-+ Reference< XShapes > xShapes( aSel, UNO_QUERY );
-+ if( xShapes.is() && (xShapes->getCount() == 1) )
-+ aSel <<= xShapes->getByIndex(0);
-+ }
-+
-+ Reference< XShapeDescriptor > xDesc( aSel, UNO_QUERY );
-+ if( xDesc.is() && xDesc->getShapeType().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DiagramShape" ) ) )
-+ {
-+ xNewSelection = Reference< XPropertySet >::query( xDesc );
-+ }
-+ }
-+ }
-+ catch( Exception& )
-+ {
-+ DBG_ERROR( "sd::DiagramDesignPane::onSelectionChanged(), Exception caught!" );
-+ }
-+
-+ ::sd::View* pView = 0;
-+ if( mxView.is() )
-+ {
-+ ::boost::shared_ptr<ViewShell> xViewShell( mrBase.GetMainViewShell() );
-+ if( xViewShell.get() )
-+ pView = xViewShell->GetView();
-+ }
-+
-+ if( mxSelectedDiagram != xNewSelection )
-+ {
-+ mxSelectedDiagram = xNewSelection;
-+ updateControls();
-+
-+ SvxShape* pShape=dynamic_cast<SvxShape*>(mxSelectedDiagram.get());
-+ if( pShape )
-+ {
-+ sdr::diagram::SdrDiagramObj* pDgmShape=
-+ dynamic_cast<sdr::diagram::SdrDiagramObj*>(pShape->GetSdrObject());
-+ if( pDgmShape && pView )
-+ {
-+ mpTag.set( new DiagramTag( *pDgmShape,
-+ *pView,
-+ true ));
-+ }
-+ }
-+ }
-+
-+ if( pView )
-+ pView->updateHandles();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::updateLayout()
-+{
-+ ::Size aPaneSize( GetSizePixel() );
-+ if(IsVisible() && aPaneSize.Width() > 0)
-+ {
-+ Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) );
-+
-+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_DIAGRAM_STYLES].get() );
-+ Size aValueSetSize;
-+
-+ if( !mbModal )
-+ {
-+ const long nOptionsHeight = mnOrgOffsetY[CB_BANDED_COLUMNS] + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height() + aOffset.Y();
-+
-+ const long nStylesHeight = aPaneSize.Height() - nOptionsHeight;
-+
-+ // set with of controls to size of pane
-+ for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId )
-+ {
-+ Size aSize( mxControls[nId]->GetSizePixel() );
-+ aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X();
-+ mxControls[nId]->SetSizePixel( aSize );
-+ mxControls[nId]->SetPaintTransparent(TRUE);
-+ mxControls[nId]->SetBackground();
-+ }
-+ aValueSetSize = Size( aPaneSize.Width() - 2 * aOffset.X(), nStylesHeight - mxControls[FL_DIAGRAM_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_DIAGRAM_STYLES] );
-+ }
-+ else
-+ {
-+ aValueSetSize = pValueSet->GetSizePixel();
-+ }
-+
-+
-+ // Calculate the number of rows and columns.
-+ if( pValueSet->GetItemCount() > 0 )
-+ {
-+ Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0));
-+ Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel());
-+ pValueSet->SetItemWidth( aItemSize.Width() );
-+ pValueSet->SetItemHeight( aItemSize.Height() );
-+
-+ aItemSize.Width() += 10;
-+ aItemSize.Height() += 10;
-+ int nColumnCount = (aValueSetSize.Width() - pValueSet->GetScrollWidth()) / aItemSize.Width();
-+ if (nColumnCount < 1)
-+ nColumnCount = 1;
-+
-+ int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount;
-+ if (nRowCount < 1)
-+ nRowCount = 1;
-+
-+ int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height();
-+
-+ pValueSet->SetLineCount ( (nRowCount < nVisibleRowCount) ? (USHORT)nRowCount : 0 );
-+
-+ pValueSet->SetColCount ((USHORT)nColumnCount);
-+ pValueSet->SetLineCount ((USHORT)nRowCount);
-+
-+ if( !mbModal )
-+ {
-+ WinBits nStyle = pValueSet->GetStyle() & ~(WB_VSCROLL);
-+ if( nRowCount < nVisibleRowCount )
-+ {
-+ aValueSetSize.Height() = nRowCount * aItemSize.Height();
-+ }
-+ else if( nRowCount > nVisibleRowCount )
-+ {
-+ nStyle |= WB_VSCROLL;
-+ }
-+ pValueSet->SetStyle( nStyle );
-+ }
-+ }
-+
-+ ValueSet* pValueSet2 = static_cast< ValueSet* >( mxControls[CT_DIAGRAM_LIST].get() );
-+ FixedLine* pFlList = static_cast< FixedLine* >( mxControls[FL_DIAGRAM_LIST].get() );
-+
-+ if( !mbModal )
-+ {
-+ pValueSet->SetSizePixel( Size(aValueSetSize.Width(),
-+ aValueSetSize.Height()/2) );
-+ pFlList->SetPosPixel( pValueSet->GetPosPixel() +
-+ Point(0,pValueSet->GetSizePixel().Height()+2) );
-+ pValueSet2->SetSizePixel( Size(aValueSetSize.Width(),
-+ aValueSetSize.Height()/2 - 13) );
-+ pValueSet2->SetPosPixel( pFlList->GetPosPixel() +
-+ Point(0,30) );
-+
-+ pValueSet->SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
-+ pValueSet->SetColor( GetSettings().GetStyleSettings().GetWindowColor() );
-+
-+ pValueSet2->SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
-+ pValueSet2->SetColor( GetSettings().GetStyleSettings().GetWindowColor() );
-+
-+ Point aPos( pValueSet->GetPosPixel() );
-+
-+ // shift show options section down
-+ const long nOptionsPos = aPos.Y() + aValueSetSize.Height();
-+ for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId )
-+ {
-+ Point aCPos( mxControls[nId]->GetPosPixel() );
-+ aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X();
-+ aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos;
-+ mxControls[nId]->SetPosPixel( aCPos );
-+ }
-+ }
-+ }
-+
-+ if( !mbModal )
-+ SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::updateControls()
-+{
-+ static sal_Bool gDefaults[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False };
-+
-+ const bool bHasDiagram = mxSelectedDiagram.is();
-+ for( USHORT i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
-+ {
-+ static_cast< CheckBox* >( mxControls[i].get() )->Check( TRUE );
-+ mxControls[i]->Enable(bHasDiagram ? TRUE : FALSE );
-+ }
-+
-+ FillDesignPreviewControl();
-+ updateLayout();
-+
-+
-+ USHORT nSelection = 0;
-+ if( mxSelectedDiagram.is() )
-+ {
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::addListener()
-+{
-+ Link aLink( LINK(this,DiagramDesignPane,EventMultiplexerListener) );
-+ mrBase.GetEventMultiplexer()->AddEventListener (
-+ aLink,
-+ tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
-+ | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
-+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
-+ | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
-+ | tools::EventMultiplexerEvent::EID_DISPOSING);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::removeListener()
-+{
-+ Link aLink( LINK(this,DiagramDesignPane,EventMultiplexerListener) );
-+ mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
-+}
-+
-+// --------------------------------------------------------------------
-+
-+IMPL_LINK(DiagramDesignPane,EventMultiplexerListener,
-+ tools::EventMultiplexerEvent*,pEvent)
-+{
-+ switch (pEvent->meEventId)
-+ {
-+ case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
-+ case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
-+ onSelectionChanged();
-+ break;
-+
-+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
-+ mxView = Reference<XDrawView>();
-+ onSelectionChanged();
-+ break;
-+
-+ case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
-+ mxView = Reference<XDrawView>::query( mrBase.GetController() );
-+ onSelectionChanged();
-+ break;
-+ }
-+ return 0;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramDesignPane::FillDesignPreviewControl()
-+{
-+ ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_DIAGRAM_STYLES].get() );
-+
-+ USHORT nSelectedItem = pValueSet->GetSelectItemId();
-+ pValueSet->Clear();
-+ try
-+ {
-+ if( mxSelectedDiagram.is() )
-+ {
-+ // settings
-+ }
-+
-+ sal_Bool bIsPageDark = sal_False;
-+ if( mxView.is() )
-+ {
-+ Reference< XPropertySet > xPageSet( mxView->getCurrentPage(), UNO_QUERY );
-+ if( xPageSet.is() )
-+ {
-+ const OUString sIsBackgroundDark( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) );
-+ xPageSet->getPropertyValue(sIsBackgroundDark) >>= bIsPageDark;
-+ }
-+ }
-+
-+ // write settings
-+ }
-+ catch( Exception& )
-+ {
-+ DBG_ERROR("sd::DiagramDesignPane::FillDesignPreviewControl(), exception caught!");
-+ }
-+ pValueSet->SelectItem(nSelectedItem);
-+}
-+
-+// ====================================================================
-+
-+DiagramDesignDialog::DiagramDesignDialog(::Window* pParent, ViewShellBase& rBase )
-+: ModalDialog( pParent, SdResId( DLG_DIAGRAMDESIGNPANE ))
-+, mrBase( rBase )
-+{
-+ mxFlSep1.reset( new FixedLine( this, SdResId( FL_SEP1 ) ) );
-+ mxFlSep2.reset( new FixedLine( this, SdResId( FL_SEP2 ) ) );
-+ mxHelpButton.reset( new HelpButton( this, SdResId( BTN_HELP ) ) );
-+ mxOkButton.reset( new OKButton( this, SdResId( BTN_OK ) ) );
-+ mxCancelButton.reset( new CancelButton( this, SdResId( BTN_CANCEL ) ) );
-+ FreeResource();
-+
-+ mpDesignPane.reset( new DiagramDesignPane( this, rBase, true ) );
-+ mpDesignPane->Hide();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+short DiagramDesignDialog::Execute()
-+{
-+ if( ModalDialog::Execute() )
-+ {
-+ if( mpDesignPane->isStyleChanged() )
-+ mpDesignPane->ApplyStyle();
-+
-+ if( mpDesignPane->isOptionsChanged() )
-+ mpDesignPane->ApplyOptions();
-+ return TRUE;
-+ }
-+ return FALSE;
-+}
-+
-+// ====================================================================
-+
-+::Window * createDiagramDesignPanel( ::Window* pParent, ViewShellBase& rBase )
-+{
-+ return new DiagramDesignPane( pParent, rBase, false );
-+}
-+
-+// ====================================================================
-+
-+void showDiagramDesignDialog( ::Window* pParent, ViewShellBase& rBase )
-+{
-+ boost::scoped_ptr< DiagramDesignDialog > xDialog( new DiagramDesignDialog( pParent, rBase ) );
-+ xDialog->Execute();
-+}
-+
-+
-+}
-+
-+
-diff --git sd/source/ui/diagram/DiagramDesignPane.hrc sd/source/ui/diagram/DiagramDesignPane.hrc
-new file mode 100644
-index 0000000..3ffecd9
---- /dev/null
-+++ sd/source/ui/diagram/DiagramDesignPane.hrc
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPane.hrc,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 _SD_DIAGRAMDESIGNPANE_HRC
-+#define _SD_DIAGRAMDESIGNPANE_HRC
-+
-+#define FL_STYLE_OPTIONS 0
-+#define CB_HEADER_ROW 1
-+#define CB_TOTAL_ROW 2
-+#define CB_BANDED_ROWS 3
-+#define CB_FIRST_COLUMN 4
-+#define CB_LAST_COLUMN 5
-+#define CB_BANDED_COLUMNS 6
-+
-+#define FL_DIAGRAM_STYLES 7
-+#define CT_DIAGRAM_STYLES 8
-+
-+#define FL_DIAGRAM_LIST 9
-+#define CT_DIAGRAM_LIST 10
-+
-+#define DESIGNPANE_CONTROL_COUNT 11
-+
-+#define FL_SEP1 20
-+#define FL_SEP2 21
-+#define BTN_HELP 22
-+#define BTN_OK 23
-+#define BTN_CANCEL 24
-+
-+#endif // _SD_DIAGRAMDESIGNPANE_HRC
-diff --git sd/source/ui/diagram/DiagramDesignPane.hxx sd/source/ui/diagram/DiagramDesignPane.hxx
-new file mode 100644
-index 0000000..b2d3486
---- /dev/null
-+++ sd/source/ui/diagram/DiagramDesignPane.hxx
-@@ -0,0 +1,131 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPane.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 _SD_TABLEDESIGNPANE_HXX
-+#define _SD_TABLEDESIGNPANE_HXX
-+
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/ui/XUIElement.hpp>
-+#include <com/sun/star/drawing/XDrawView.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+#include <vcl/dialog.hxx>
-+#include <vcl/fixed.hxx>
-+#include <vcl/button.hxx>
-+#include <svtools/valueset.hxx>
-+
-+#include <boost/scoped_ptr.hpp>
-+
-+#include "DiagramDesignPane.hrc"
-+#include "diagramtag.hxx"
-+
-+namespace sd
-+{
-+
-+namespace tools {
-+class EventMultiplexerEvent;
-+}
-+
-+class ViewShellBase;
-+
-+// --------------------------------------------------------------------
-+
-+class DiagramDesignPane : public Control
-+{
-+public:
-+ DiagramDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
-+ virtual ~DiagramDesignPane();
-+
-+ // callbacks
-+ void onSelectionChanged();
-+
-+ // Control
-+ virtual void Resize();
-+
-+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
-+
-+ void ApplyOptions();
-+ void ApplyStyle();
-+
-+ bool isStyleChanged() const { return mbStyleSelected; }
-+ bool isOptionsChanged() const { return mbOptionsChanged; }
-+
-+private:
-+ void addListener();
-+ void removeListener();
-+ void updateLayout();
-+ void updateControls();
-+
-+ void FillDesignPreviewControl();
-+
-+ DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
-+ DECL_LINK(implValueSetHdl, Control* );
-+ DECL_LINK(implCheckBoxHdl, Control* );
-+
-+private:
-+ ViewShellBase& mrBase;
-+ const rtl::OUString msDiagramTemplate;
-+
-+ boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
-+ int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedDiagram;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxDiagramFamily;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > mxToolbar;
-+
-+ rtl::Reference< DiagramTag > mpTag;
-+ bool mbModal;
-+ bool mbStyleSelected;
-+ bool mbOptionsChanged;
-+};
-+
-+// --------------------------------------------------------------------
-+
-+class DiagramDesignDialog : public ModalDialog
-+{
-+public:
-+ DiagramDesignDialog( ::Window* pParent, ViewShellBase& rBase );
-+
-+ virtual short Execute();
-+private:
-+ ViewShellBase& mrBase;
-+ boost::scoped_ptr< DiagramDesignPane > mpDesignPane;
-+
-+ boost::scoped_ptr< FixedLine > mxFlSep1;
-+ boost::scoped_ptr< FixedLine > mxFlSep2;
-+ boost::scoped_ptr< HelpButton > mxHelpButton;
-+ boost::scoped_ptr< OKButton > mxOkButton;
-+ boost::scoped_ptr< CancelButton > mxCancelButton;
-+};
-+
-+}
-+
-+#endif // _SD_TABLEFORMATPANE_HXX
-diff --git sd/source/ui/diagram/DiagramDesignPane.src sd/source/ui/diagram/DiagramDesignPane.src
-new file mode 100644
-index 0000000..32ef4d6
---- /dev/null
-+++ sd/source/ui/diagram/DiagramDesignPane.src
-@@ -0,0 +1,173 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPane.src,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 "DiagramDesignPane.hrc"
-+#include "glob.hrc"
-+
-+Control DLG_DIAGRAMDESIGNPANE
-+{
-+ OutputSize = TRUE;
-+ DialogControl = TRUE;
-+ Border = FALSE;
-+
-+ Size = MAP_APPFONT( 264, 160 );
-+ Text [ en-US ] = "Diagram Design";
-+
-+ FixedLine FL_STYLE_OPTIONS+1
-+ {
-+ Pos = MAP_APPFONT ( 143, 3 ) ;
-+ Size = MAP_APPFONT ( 120, 10 ) ;
-+ OutputSize = TRUE;
-+ Text [ en-US ] = "Show";
-+ };
-+
-+ CheckBox CB_HEADER_ROW+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 16 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Header Row" ;
-+ };
-+
-+ CheckBox CB_TOTAL_ROW+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 29 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Total Row" ;
-+ };
-+
-+ CheckBox CB_BANDED_ROWS+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 42 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Banded Rows" ;
-+ };
-+
-+ CheckBox CB_FIRST_COLUMN+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 55 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "First Column" ;
-+ };
-+
-+ CheckBox CB_LAST_COLUMN+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 68 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Last Column" ;
-+ };
-+
-+ CheckBox CB_BANDED_COLUMNS+1
-+ {
-+ Pos = MAP_APPFONT ( 146, 82 ) ;
-+ Size = MAP_APPFONT ( 120 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Banded Columns" ;
-+ };
-+
-+ FixedLine FL_DIAGRAM_STYLES+1
-+ {
-+ Pos = MAP_APPFONT ( 6, 3 ) ;
-+ Size = MAP_APPFONT( 120, 8 );
-+ OutputSize = TRUE;
-+ Text [ en-US ] = "Styles";
-+ };
-+
-+ Control CT_DIAGRAM_STYLES+1
-+ {
-+ Pos = MAP_APPFONT ( 6, 14 ) ;
-+ Size = MAP_APPFONT( 120, 143 );
-+ Border = TRUE ;
-+ TabStop = TRUE ;
-+ };
-+
-+ FixedLine FL_DIAGRAM_LIST+1
-+ {
-+ Pos = MAP_APPFONT ( 6, 3 ) ;
-+ Size = MAP_APPFONT( 120, 8 );
-+ OutputSize = TRUE;
-+ Text [ en-US ] = "List";
-+ };
-+
-+ Control CT_DIAGRAM_LIST+1
-+ {
-+ Pos = MAP_APPFONT ( 6, 14 ) ;
-+ Size = MAP_APPFONT( 120, 143 );
-+ Border = TRUE ;
-+ TabStop = TRUE ;
-+ };
-+};
-+
-+ModalDialog DLG_DIAGRAMDESIGNPANE
-+{
-+ OutputSize = TRUE;
-+ SVLook = TRUE ;
-+ Moveable = TRUE ;
-+ Closeable = TRUE ;
-+ Size = MAP_APPFONT( 272, 198 );
-+
-+ Text [ en-US ] = "Diagram Design";
-+
-+ FixedLine FL_SEP1
-+ {
-+ Pos = MAP_APPFONT( 135, 14 );
-+ Size = MAP_APPFONT( 8, 143 );
-+ Vert = TRUE ;
-+ };
-+ FixedLine FL_SEP2
-+ {
-+ Pos = MAP_APPFONT ( 0 , 160 ) ;
-+ Size = MAP_APPFONT ( 272 , 12 ) ;
-+ };
-+
-+ HelpButton BTN_HELP
-+ {
-+ Pos = MAP_APPFONT ( 6 , 176 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ };
-+ OKButton BTN_OK
-+ {
-+ Pos = MAP_APPFONT ( 158 , 176 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ DefButton = TRUE ;
-+ };
-+ CancelButton BTN_CANCEL
-+ {
-+ Pos = MAP_APPFONT ( 211 , 176 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ };
-+};
-diff --git sd/source/ui/diagram/diagramtag.cxx sd/source/ui/diagram/diagramtag.cxx
-new file mode 100644
-index 0000000..16309b3
---- /dev/null
-+++ sd/source/ui/diagram/diagramtag.cxx
-@@ -0,0 +1,671 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: motionpathtag.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sd.hxx"
-+
-+#include <com/sun/star/util/XChangesNotifier.hpp>
-+#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/dom/XCharacterData.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+
-+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-+#include <basegfx/range/b2drange.hxx>
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
-+#include <basegfx/polygon/b2dpolygontools.hxx>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <vcl/canvastools.hxx>
-+#include <comphelper/processfactory.hxx>
-+
-+#include <sfx2/viewfrm.hxx>
-+#include <sfx2/dispatch.hxx>
-+#include <sfx2/request.hxx>
-+
-+#include <svx/sdr/overlay/overlaymanager.hxx>
-+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
-+#include <svx/svdetc.hxx>
-+#include <svx/svdorect.hxx>
-+#include <svx/outliner.hxx>
-+#include <svx/svdpagv.hxx>
-+#include <svx/sdrpagewindow.hxx>
-+#include <svx/sdrpaintwindow.hxx>
-+#include <svx/svddrgmt.hxx>
-+#include <svx/svdodiagram.hxx>
-+#include <svx/svdotext.hxx>
-+#include <svx/svdpool.hxx>
-+#include <svx/xflclit.hxx>
-+#include <svx/xfltrit.hxx>
-+#include <svx/xlnclit.hxx>
-+#include <svx/xlnwtit.hxx>
-+#include <svx/xfillit.hxx>
-+#include <svx/xenum.hxx>
-+
-+#include "View.hxx"
-+#include "futext.hxx"
-+#include "diagramtag.hxx"
-+#include "sdpage.hxx"
-+#include "drawdoc.hxx"
-+#include "ViewShell.hxx"
-+#include "zoomlist.hxx"
-+#include "app.hrc"
-+#include "Window.hxx"
-+
-+#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
-+using ::rtl::OUString;
-+using namespace ::com::sun::star::beans;
-+using namespace ::com::sun::star::xml;
-+using namespace ::com::sun::star::text;
-+using namespace ::com::sun::star::container;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::lang;
-+using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::drawing;
-+
-+namespace sd
-+{
-+
-+const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32;
-+static const int DRGPIX = 2; // Drag MinMove in Pixel
-+
-+// --------------------------------------------------------------------
-+
-+class SdDiagramHdl : public SmartHdl
-+{
-+public:
-+ SdDiagramHdl( const SmartTagReference& xTag );
-+ virtual void CreateB2dIAObject();
-+ virtual BOOL IsFocusHdl() const;
-+ virtual Pointer GetSdrDragPointer() const;
-+ virtual bool isMarkable() const;
-+ virtual bool IsHdlHit(const Point& rPnt) const;
-+
-+private:
-+ const SdrPageWindow* GetBoundRects(basegfx::B2DRange& rInnerBounds,
-+ basegfx::B2DRange& rOuterBounds,
-+ basegfx::B2DVector* pScale=NULL) const;
-+
-+ rtl::Reference< DiagramTag > mxTag;
-+};
-+
-+// --------------------------------------------------------------------
-+
-+SdDiagramHdl::SdDiagramHdl( const SmartTagReference& xTag )
-+: SmartHdl( xTag, Point() )
-+, mxTag( dynamic_cast< DiagramTag* >( xTag.get() ) )
-+{
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdDiagramHdl::CreateB2dIAObject()
-+{
-+ // first throw away old one
-+ GetRidOfIAObject();
-+
-+ basegfx::B2DRange aInnerBounds;
-+ basegfx::B2DRange aOuterBounds;
-+ basegfx::B2DVector aScale;
-+ const SdrPageWindow* pPageWindow=NULL;
-+ if( !(pPageWindow=GetBoundRects(aInnerBounds, aOuterBounds, &aScale)) )
-+ return;
-+
-+ static const double fSelectedAlpha(0.3);
-+ static const double fUnselectedAlpha(0.1);
-+ static const basegfx::BColor aTagColor(79/256.0,
-+ 129/256.0,
-+ 189/256.0);
-+
-+ const double fMaxExtend(std::max(aInnerBounds.getWidth(),
-+ aInnerBounds.getHeight()));
-+ basegfx::B2DPolyPolygon aBorderPoly=
-+ basegfx::tools::solvePolygonOperationDiff(
-+ basegfx::tools::prepareForPolygonOperation(
-+ basegfx::tools::createPolygonFromRect(aOuterBounds,
-+ 2*aScale.getX()/fMaxExtend)),
-+ basegfx::tools::prepareForPolygonOperation(
-+ basegfx::tools::createPolygonFromRect(aInnerBounds,
-+ aScale.getX()/fMaxExtend)));
-+
-+ drawinglayer::primitive2d::Primitive2DSequence aBorder;
-+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
-+ aBorder,
-+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
-+ aBorderPoly,
-+ aTagColor));
-+
-+ drawinglayer::primitive2d::Primitive2DReference aAlphaGroup(
-+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
-+ aBorder,
-+ IsSelected() ? fSelectedAlpha : fUnselectedAlpha));
-+ drawinglayer::primitive2d::Primitive2DSequence aResultTransparent =
-+ drawinglayer::primitive2d::Primitive2DSequence(&aAlphaGroup, 1);
-+
-+ sdr::overlay::OverlayObject* pNewOverlayObject =
-+ new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent);
-+
-+ // OVERLAYMANAGER
-+ if(pNewOverlayObject)
-+ {
-+ pNewOverlayObject->setHittable(true);
-+ pPageWindow->GetOverlayManager()->add(*pNewOverlayObject);
-+ maOverlayGroup.append(*pNewOverlayObject);
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+BOOL SdDiagramHdl::IsFocusHdl() const
-+{
-+ return TRUE;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+bool SdDiagramHdl::isMarkable() const
-+{
-+ return true;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+const SdrPageWindow* SdDiagramHdl::GetBoundRects(basegfx::B2DRange& rInnerBounds,
-+ basegfx::B2DRange& rOuterBounds,
-+ basegfx::B2DVector* pScale ) const
-+{
-+ if(!pHdlList)
-+ return NULL;
-+
-+ SdrMarkView* pView = pHdlList->GetView();
-+ if(!pView || pView->areMarkHandlesHidden())
-+ return NULL;
-+
-+ SdrPageView* pPageView = pView->GetSdrPageView();
-+ if(!pPageView)
-+ return NULL;
-+
-+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
-+ {
-+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
-+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-+
-+ if(rPageWindow.GetPaintWindow().OutputToWindow())
-+ {
-+ if(rPageWindow.GetOverlayManager())
-+ {
-+ static const double fPixelWidth=5.0;
-+
-+ const basegfx::B2DVector aScale=
-+ rPageWindow.GetOverlayManager()->getOutputDevice().GetInverseViewTransformation() *
-+ basegfx::B2DVector(fPixelWidth,
-+ fPixelWidth);
-+ rInnerBounds = vcl::unotools::b2DRectangleFromRectangle(
-+ GetObj()->GetLastBoundRect());
-+ rOuterBounds = rInnerBounds; rOuterBounds.grow(aScale.getX());
-+
-+ if( pScale )
-+ *pScale = aScale;
-+
-+ return &rPageWindow;
-+ }
-+ }
-+ }
-+
-+ return NULL;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+bool SdDiagramHdl::IsHdlHit(const Point& rPnt) const
-+{
-+ basegfx::B2DRange aInnerBounds;
-+ basegfx::B2DRange aOuterBounds;
-+ if( !GetBoundRects(aInnerBounds, aOuterBounds) )
-+ return false;
-+
-+ const basegfx::B2DPoint aPt(rPnt.X(), rPnt.Y());
-+ return aOuterBounds.isInside(aPt) && !aInnerBounds.isInside(aPt);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+Pointer SdDiagramHdl::GetSdrDragPointer() const
-+{
-+ PointerStyle eStyle = POINTER_NOTALLOWED;
-+ if( mxTag.is() )
-+ {
-+ if( mxTag->isSelected() )
-+ {
-+ if( !mxTag->getView().IsFrameDragSingles() && mxTag->getView().IsInsObjPointMode() )
-+ eStyle = POINTER_CROSS;
-+ else
-+ eStyle = POINTER_MOVE;
-+ }
-+ else
-+ {
-+ eStyle = POINTER_ARROW;
-+
-+ }
-+ }
-+ return Pointer( eStyle );
-+}
-+
-+// ====================================================================
-+
-+DiagramTag::DiagramTag( sdr::diagram::SdrDiagramObj& rObj, ::sd::View& rView, bool bSelected )
-+: SmartTag( rView )
-+, mrObj( rObj )
-+, mpTextObj()
-+{
-+ if( bSelected )
-+ mrView.getSmartTags().select(this);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::extractText( const Reference<XShape>& rxShape )
-+{
-+ // current layout node we write into. if the mrShape's data DOM
-+ // tree does not have enough, we create new ones on the fly
-+ sal_Int32 nCurrNode=0;
-+
-+ // grab data DOM tree from shape
-+ Reference< XPropertySet > xDiagramShapePropSet( mrObj.getUnoShape(),
-+ UNO_QUERY_THROW );
-+ Reference<dom::XDocument> xDom;
-+ if( !(xDiagramShapePropSet->getPropertyValue(String( RTL_CONSTASCII_USTRINGPARAM("DiagramData")))
-+ >>= xDom) )
-+ {
-+ // TODO: fill in default tree
-+ }
-+
-+ Reference< XMultiServiceFactory > xSMgr =
-+ ::comphelper::getProcessServiceFactory();
-+ Reference< xpath::XXPathAPI > xXPath(
-+ xSMgr->createInstance(
-+ String( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.xpath.XPathAPI"))),
-+ UNO_QUERY_THROW);
-+
-+ xXPath->registerNS(
-+ String( RTL_CONSTASCII_USTRINGPARAM("dgm")),
-+ String( RTL_CONSTASCII_USTRINGPARAM("http://schemas.openxmlformats.org/drawingml/2006/diagram")) );
-+ xXPath->registerNS(
-+ String( RTL_CONSTASCII_USTRINGPARAM("a")),
-+ String( RTL_CONSTASCII_USTRINGPARAM("http://schemas.openxmlformats.org/drawingml/2006/main")) );
-+
-+ Reference< dom::XNode > xNode(xDom, UNO_QUERY_THROW);
-+ Reference< dom::XNodeList > xNodeList;
-+ try {
-+ // select all pt nodes with non-empty text
-+ xNodeList = xXPath->selectNodeList(
-+ xNode,
-+ String( RTL_CONSTASCII_USTRINGPARAM(
-+ "/dgm:dataModel/dgm:ptLst/dgm:pt/dgm:t/a:p/*/a:t[count(child::text())>0]")));
-+ } catch(xpath::XPathException&) {}
-+
-+
-+ Reference< XEnumerationAccess > access( rxShape,
-+ UNO_QUERY_THROW );
-+ Reference< XEnumeration > enumeration( access->createEnumeration() );
-+
-+ while( enumeration->hasMoreElements() )
-+ {
-+ Reference< XTextContent > paragraph;
-+ Any any ( enumeration->nextElement() );
-+
-+ if( (any >>= paragraph) )
-+ {
-+ access.set( paragraph,
-+ UNO_QUERY_THROW );
-+ Reference< XPropertySet > rXPropSet( paragraph,
-+ UNO_QUERY_THROW );
-+
-+ any = rXPropSet->getPropertyValue(
-+ String( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ));
-+ sal_Int16 nOutlineLevel = -1;
-+ any >>= nOutlineLevel;
-+
-+ // throw away all non-outline text
-+ if( nOutlineLevel != -1 )
-+ {
-+ Reference< XEnumeration > enumeration2( access->createEnumeration() );
-+
-+ bool bPropertiesWritten = false;
-+ while( enumeration2->hasMoreElements() )
-+ {
-+ Reference< XTextRange > run;
-+ any = enumeration2->nextElement();
-+
-+ if (any >>= run)
-+ {
-+ if( nCurrNode < xNodeList->getLength() )
-+ {
-+ // enough nodes left, stuff text into
-+ // child of this node
-+ Reference<dom::XCharacterData> xChar(
-+ xNodeList->item(nCurrNode++)->getFirstChild(),
-+ UNO_QUERY_THROW);
-+ xChar->setData(run->getString());
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+
-+ // force reload of diagram content
-+ mrObj.LayoutShape();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/ )
-+{
-+}
-+
-+// --------------------------------------------------------------------
-+
-+/** returns true if the DiagramTag handled the event. */
-+bool DiagramTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/, const Window& rWin )
-+{
-+ if( !isSelected() )
-+ {
-+ SmartTagReference xTag( this );
-+ mrView.getSmartTags().select( xTag );
-+ return true;
-+ }
-+
-+ return false;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+/** returns true if the DiagramTag handled the event. */
-+bool DiagramTag::MouseButtonUp( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/, const Window& rWin )
-+{
-+ if( rMEvt.IsLeft() )
-+ {
-+ // launch TextObj in edit mode
-+ Rectangle aBounds=mrObj.GetLastBoundRect();
-+ aBounds+=Point(-6000,0);
-+
-+ // move & zoom view onto text object
-+ long nW = (long) (aBounds.GetWidth() * 1.53);
-+ long nH = (long) (aBounds.GetHeight() * 1.53);
-+ Point aPos = aBounds.Center();
-+ aPos.X() -= nW / 2;
-+ aPos.Y() -= nH / 2;
-+ if ( nW && nH )
-+ {
-+ mrView.GetViewShell()->SetZoomRect(Rectangle(aPos, Size(nW, nH)));
-+
-+ Rectangle aVisAreaWin = mrView.GetViewShell()->GetActiveWindow()->PixelToLogic(
-+ Rectangle( Point(0,0),
-+ mrView.GetViewShell()->GetActiveWindow()->GetOutputSizePixel()) );
-+ mrView.GetViewShell()->GetZoomList()->InsertZoomRect(aVisAreaWin);
-+ }
-+
-+ // actually create it & fill content
-+ aBounds.setWidth(5900);
-+ mpTextObj.reset( new SdrRectObj( OBJ_OUTLINETEXT,
-+ aBounds ));
-+
-+ // make sure object has given height
-+ const bool bVertical=false; // TODO
-+
-+ if(bVertical)
-+ mpTextObj->SetVerticalWriting(TRUE);
-+
-+ SfxItemSet aTempAttr( ((SdDrawDocument*) mrObj.GetModel())->GetPool() );
-+ if( bVertical )
-+ aTempAttr.Put( SdrTextMinFrameWidthItem( aBounds.GetSize().Width() ) );
-+ else
-+ aTempAttr.Put( SdrTextMinFrameHeightItem( aBounds.GetSize().Height() ) );
-+
-+ // get us some fill
-+ const OUString aDummyName(C2U("dummycolor"));
-+ aTempAttr.Put( XFillStyleItem(XFILL_SOLID) );
-+ aTempAttr.Put( XLineStyleItem(XLINE_SOLID) );
-+ aTempAttr.Put( XFillColorItem(aDummyName, ::Color(255,0,0)) );
-+ aTempAttr.Put( XLineColorItem(aDummyName, ::Color(0,255,0)) );
-+ aTempAttr.Put( XFillTransparenceItem(128) );
-+ aTempAttr.Put( XLineWidthItem(60) );
-+
-+ mpTextObj->SetMergedItemSet(aTempAttr);
-+ mpTextObj->SetModel(mrObj.GetModel());
-+
-+ // grab text ifc for shape
-+ Reference<XShape> xShape(
-+ mpTextObj->getUnoShape(),
-+ UNO_QUERY_THROW);
-+ Reference< XText > xText( xShape, UNO_QUERY_THROW );
-+ Reference< XTextCursor > xAt = xText->createTextCursor();
-+
-+ Reference< XTextRange > xStart( xAt, UNO_QUERY_THROW );
-+ Reference< XPropertySet > xProps( xStart, UNO_QUERY);
-+
-+ const OUString sNumberingLevel( C2U( "NumberingLevel" ) );
-+
-+ // select all text data text nodes (if any)
-+ Reference< XPropertySet > xDiagramShapePropSet( mrObj.getUnoShape(),
-+ UNO_QUERY_THROW );
-+ Reference<dom::XDocument> xDom;
-+ if( (xDiagramShapePropSet->getPropertyValue(String( RTL_CONSTASCII_USTRINGPARAM("DiagramData")))
-+ >>= xDom) )
-+ {
-+ Reference< XMultiServiceFactory > xSMgr =
-+ ::comphelper::getProcessServiceFactory();
-+ Reference< xpath::XXPathAPI > xXPath(
-+ xSMgr->createInstance(
-+ String( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.xpath.XPathAPI"))),
-+ UNO_QUERY_THROW);
-+
-+ xXPath->registerNS(
-+ String( RTL_CONSTASCII_USTRINGPARAM("dgm")),
-+ String( RTL_CONSTASCII_USTRINGPARAM("http://schemas.openxmlformats.org/drawingml/2006/diagram")) );
-+ xXPath->registerNS(
-+ String( RTL_CONSTASCII_USTRINGPARAM("a")),
-+ String( RTL_CONSTASCII_USTRINGPARAM("http://schemas.openxmlformats.org/drawingml/2006/main")) );
-+
-+ Reference< dom::XNode > xNode(xDom, UNO_QUERY_THROW);
-+ Reference< dom::XNodeList > xNodeList;
-+ try {
-+ // select all pt nodes with non-empty text
-+ xNodeList = xXPath->selectNodeList(
-+ xNode,
-+ String( RTL_CONSTASCII_USTRINGPARAM(
-+ "/dgm:dataModel/dgm:ptLst/dgm:pt/dgm:t/a:p/*/a:t[count(child::text())>0]")));
-+ } catch(xpath::XPathException&) {}
-+
-+ // push diagram data text into shape
-+ for( sal_Int32 i=0; i < xNodeList->getLength(); ++i )
-+ {
-+ if( i>0 )
-+ {
-+ xText->insertControlCharacter( xStart, ControlCharacter::APPEND_PARAGRAPH, sal_False );
-+ xAt->gotoEnd( sal_True );
-+ }
-+
-+ Reference<dom::XCharacterData> xChar(
-+ xNodeList->item(i)->getFirstChild(),
-+ UNO_QUERY_THROW);
-+
-+ xText->insertString( xStart, xChar->getData(), sal_False );
-+ xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( 0 ) ) );
-+ xAt->gotoEnd( sal_True );
-+ }
-+ }
-+
-+ // Put text object into edit mode.
-+ if( mrView.SdrBeginTextEdit(mpTextObj.get(),
-+ mrView.GetSdrPageView()) )
-+ {
-+ // Make FuText the current function.
-+ SfxUInt16Item aItem (SID_TEXTEDIT, 1);
-+ mrView.GetViewShell()->GetViewFrame()->GetDispatcher()->
-+ Execute(SID_TEXTEDIT, SFX_CALLMODE_ASYNCHRON |
-+ SFX_CALLMODE_RECORD, &aItem, 0L);
-+
-+ OutlinerView* pOLV = mrView.GetTextEditOutlinerView();
-+
-+ // Move cursor to end of text
-+ ESelection aNewSelection(EE_PARA_NOT_FOUND,
-+ EE_INDEX_NOT_FOUND,
-+ EE_PARA_NOT_FOUND,
-+ EE_INDEX_NOT_FOUND);
-+ pOLV->SetSelection(aNewSelection);
-+
-+ // TODO: fill outliner with diagramming text
-+
-+ return true;
-+ }
-+ }
-+
-+ return false;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+/** returns true if the SmartTag consumes this event. */
-+bool DiagramTag::KeyInput( const KeyEvent& rKEvt, const Window& rWin )
-+{
-+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
-+ switch( nCode )
-+ {
-+ case KEY_ESCAPE:
-+ {
-+ SmartTagReference xThis( this );
-+ mrView.getSmartTags().deselect();
-+ if( mpTextObj )
-+ {
-+ mrView.SdrEndTextEdit(true);
-+
-+ // grab text from object
-+ extractText(
-+ Reference<XShape>(
-+ mpTextObj->getUnoShape(),
-+ UNO_QUERY_THROW) );
-+
-+ mpTextObj.reset();
-+ }
-+ return true;
-+ }
-+
-+ default:
-+ return mrView.KeyInput(rKEvt, const_cast<Window*>(&rWin));
-+ }
-+
-+ return false;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::addCustomHandles( SdrHdlList& rHandlerList )
-+{
-+ SmartTagReference xThis( this );
-+ SdDiagramHdl* pHdl = new SdDiagramHdl(xThis);
-+ pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
-+ pHdl->SetPageView( mrView.GetSdrPageView() );
-+ pHdl->SetObj(&mrObj);
-+ rHandlerList.AddHdl( pHdl );
-+
-+ if( isSelected() )
-+ {
-+ mrView.GetSdrPageView()->SetHasMarkedObj(TRUE);
-+
-+ if( !mrView.IsFrameDragSingles() )
-+ pHdl->SetSelected(TRUE);
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::disposing()
-+{
-+ mrView.updateHandles();
-+ SmartTag::disposing();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::select()
-+{
-+ SmartTag::select();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void DiagramTag::deselect()
-+{
-+ SmartTag::deselect();
-+ Dispose();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+// XChangesListener
-+void SAL_CALL DiagramTag::changesOccurred( const ChangesEvent& /*Event*/ ) throw (RuntimeException)
-+{
-+}
-+
-+void SAL_CALL DiagramTag::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
-+{
-+}
-+
-+Any SAL_CALL DiagramTag::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (RuntimeException)
-+{
-+ if( aType == XChangesListener::static_type() )
-+ return Any( Reference< XChangesListener >( this ) );
-+ if( aType == XEventListener::static_type() )
-+ return Any( Reference< XEventListener >( this ) );
-+ if( aType == XInterface::static_type() )
-+ return Any( Reference< XInterface >( this ) );
-+
-+ return Any();
-+}
-+
-+void SAL_CALL DiagramTag::acquire() throw ()
-+{
-+ SimpleReferenceComponent::acquire();
-+}
-+
-+void SAL_CALL DiagramTag::release( ) throw ()
-+{
-+ SimpleReferenceComponent::release();
-+}
-+
-+} // end of namespace sd
-+
-diff --git sd/source/ui/diagram/diagramtag.hxx sd/source/ui/diagram/diagramtag.hxx
-new file mode 100644
-index 0000000..3753211
---- /dev/null
-+++ sd/source/ui/diagram/diagramtag.hxx
-@@ -0,0 +1,94 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: motionpathtag.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 _SD_DIAGRAMTAG_HXX_
-+#define _SD_DIAGRAMTAG_HXX_
-+
-+#include <com/sun/star/util/XChangesListener.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <basegfx/polygon/b2dpolypolygon.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include "smarttag.hxx"
-+
-+#include <boost/shared_ptr.hpp>
-+
-+class SdrRectObj;
-+namespace sdr { namespace diagram {
-+ class SdrDiagramObj;
-+}}
-+
-+namespace sd {
-+
-+class View;
-+class CustomAnimationPane;
-+
-+class DiagramTag : public SmartTag, public SfxListener, public ::com::sun::star::util::XChangesListener
-+{
-+public:
-+ DiagramTag( sdr::diagram::SdrDiagramObj& rObj, ::sd::View& rView, bool bSelected );
-+
-+ virtual void SAL_CALL acquire( ) throw ();
-+ virtual void SAL_CALL release( ) throw ();
-+
-+private:
-+ /** returns true if the SmartTag handled the event. */
-+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl&, const Window& );
-+
-+ /** returns true if the SmartTag handled the event. */
-+ virtual bool MouseButtonUp( const MouseEvent&, SmartHdl&, const Window& );
-+
-+ /** returns true if the SmartTag consumes this event. */
-+ virtual bool KeyInput( const KeyEvent& rKEvt, const Window& rWin );
-+
-+ // callbacks from sdr view
-+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-+
-+ // XChangesListener
-+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual void addCustomHandles( SdrHdlList& rHandlerList );
-+ virtual void disposing();
-+
-+ virtual void select();
-+ virtual void deselect();
-+
-+ void extractText( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape>& xShape );
-+
-+ sdr::diagram::SdrDiagramObj& mrObj;
-+ boost::shared_ptr<SdrRectObj> mpTextObj;
-+};
-+
-+} // end of namespace sd
-+
-+#endif // _SD_DIAGRAMTAG_HXX_
-+
-diff --git sd/source/ui/diagram/makefile.mk sd/source/ui/diagram/makefile.mk
-new file mode 100644
-index 0000000..3a5c95b
---- /dev/null
-+++ sd/source/ui/diagram/makefile.mk
-@@ -0,0 +1,59 @@
-+#*************************************************************************
-+#
-+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+#
-+# Copyright 2008 by Sun Microsystems, Inc.
-+#
-+# OpenOffice.org - a multi-platform office productivity suite
-+#
-+# $RCSfile: makefile.mk,v $
-+#
-+# $Revision: 1.3 $
-+#
-+# 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=..$/..$/..
-+
-+PROJECTPCH=sd
-+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
-+PRJNAME=sd
-+TARGET=uidiagram
-+ENABLE_EXCEPTIONS=TRUE
-+AUTOSEG=true
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+.INCLUDE : $(PRJ)$/util$/makefile.pmk
-+
-+# --- Files --------------------------------------------------------
-+
-+SRS1NAME=$(TARGET)
-+SRC1FILES =\
-+ DiagramDesignPane.src\
-+
-+SLOFILES = \
-+ $(SLO)$/DiagramDesignPane.obj \
-+ $(SLO)$/diagramtag.obj
-+
-+
-+# --- Tagets -------------------------------------------------------
-+
-+.INCLUDE : target.mk
-diff --git sd/source/ui/framework/tools/FrameworkHelper.cxx sd/source/ui/framework/tools/FrameworkHelper.cxx
-index 69fddfe..2e3285f 100644
---- sd/source/ui/framework/tools/FrameworkHelper.cxx
-+++ sd/source/ui/framework/tools/FrameworkHelper.cxx
-@@ -228,6 +228,8 @@ const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL(
- msTaskPanelURLPrefix + OUString::createFromAscii("Layouts"));
- const ::rtl::OUString FrameworkHelper::msTableDesignPanelURL(
- msTaskPanelURLPrefix + OUString::createFromAscii("TableDesign"));
-+const ::rtl::OUString FrameworkHelper::msDiagramDesignPanelURL(
-+ msTaskPanelURLPrefix + OUString::createFromAscii("DiagramDesign"));
- const ::rtl::OUString FrameworkHelper::msCustomAnimationTaskPanelURL(
- msTaskPanelURLPrefix + OUString::createFromAscii("CustomAnimations"));
- const ::rtl::OUString FrameworkHelper::msSlideTransitionTaskPanelURL(
-diff --git sd/source/ui/func/smarttag.cxx sd/source/ui/func/smarttag.cxx
-index f22c710..56c4bc9 100644
---- sd/source/ui/func/smarttag.cxx
-+++ sd/source/ui/func/smarttag.cxx
-@@ -57,13 +57,18 @@ SmartTag::~SmartTag()
-
- // --------------------------------------------------------------------
-
--bool SmartTag::MouseButtonDown( const MouseEvent&, SmartHdl& )
-+bool SmartTag::MouseButtonDown( const MouseEvent&, SmartHdl&, const Window& )
-+{
-+ return false;
-+}
-+
-+bool SmartTag::MouseButtonUp( const MouseEvent&, SmartHdl&, const Window& )
- {
- return false;
- }
-
- /** returns true if the SmartTag consumes this event. */
--bool SmartTag::KeyInput( const KeyEvent& /*rKEvt*/ )
-+bool SmartTag::KeyInput( const KeyEvent& /*rKEvt*/, const Window& /*rWin*/ )
- {
- return false;
- }
-@@ -217,7 +222,7 @@ void SmartTagSet::deselect()
-
- // --------------------------------------------------------------------
-
--bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt )
-+bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt, const Window& rWin )
- {
- Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
- SdrHdl* pHdl = mrView.PickHandle(aMDPos);
-@@ -235,7 +240,29 @@ bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt )
- if(pSmartHdl && pSmartHdl->getTag().is() )
- {
- SmartTagReference xTag( pSmartHdl->getTag() );
-- return xTag->MouseButtonDown( rMEvt, *pSmartHdl );
-+ return xTag->MouseButtonDown( rMEvt, *pSmartHdl, rWin );
-+ }
-+
-+ return false;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+bool SmartTagSet::MouseButtonUp( const MouseEvent& rMEvt, const Window& rWin )
-+{
-+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
-+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
-+
-+ // check if a smart tag is selected and no handle is hit
-+ if( mxSelectedTag.is() && !pHdl )
-+ return false;
-+
-+ // if a smart tag handle is hit, foreward event to its smart tag
-+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
-+ if(pSmartHdl && pSmartHdl->getTag().is() )
-+ {
-+ SmartTagReference xTag( pSmartHdl->getTag() );
-+ return xTag->MouseButtonUp( rMEvt, *pSmartHdl, rWin );
- }
-
- return false;
-@@ -243,10 +270,10 @@ bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt )
-
- // --------------------------------------------------------------------
-
--bool SmartTagSet::KeyInput( const KeyEvent& rKEvt )
-+bool SmartTagSet::KeyInput( const KeyEvent& rKEvt, const Window& rWin )
- {
- if( mxSelectedTag.is() )
-- return mxSelectedTag->KeyInput( rKEvt );
-+ return mxSelectedTag->KeyInput( rKEvt, rWin );
- else
- return false;
- }
-diff --git sd/source/ui/inc/TaskPaneViewShell.hxx sd/source/ui/inc/TaskPaneViewShell.hxx
-index 7251b27..8b1880a 100644
---- sd/source/ui/inc/TaskPaneViewShell.hxx
-+++ sd/source/ui/inc/TaskPaneViewShell.hxx
-@@ -77,6 +77,7 @@ public:
- PID_MASTER_PAGES,
- PID_LAYOUT,
- PID_TABLE_DESIGN,
-+ PID_DIAGRAM_DESIGN,
- PID_ANIMATION_SCHEMES,
- PID_CUSTOM_ANIMATION,
- PID_SLIDE_TRANSITION,
-diff --git sd/source/ui/inc/framework/FrameworkHelper.hxx sd/source/ui/inc/framework/FrameworkHelper.hxx
-index 3e06aac..f992a2c 100644
---- sd/source/ui/inc/framework/FrameworkHelper.hxx
-+++ sd/source/ui/inc/framework/FrameworkHelper.hxx
-@@ -101,6 +101,7 @@ public:
- static const ::rtl::OUString msMasterPagesTaskPanelURL;
- static const ::rtl::OUString msLayoutTaskPanelURL;
- static const ::rtl::OUString msTableDesignPanelURL;
-+ static const ::rtl::OUString msDiagramDesignPanelURL;
- static const ::rtl::OUString msCustomAnimationTaskPanelURL;
- static const ::rtl::OUString msSlideTransitionTaskPanelURL;
-
-diff --git sd/source/ui/inc/smarttag.hxx sd/source/ui/inc/smarttag.hxx
-index 4432dad..1ecb6a8 100644
---- sd/source/ui/inc/smarttag.hxx
-+++ sd/source/ui/inc/smarttag.hxx
-@@ -44,6 +44,7 @@ class SdrHdlList;
- namespace sd {
-
- class View;
-+class Window;
- class SmartHdl;
-
- /** a smart tag represents a visual user interface element on the documents edit view
-@@ -62,10 +63,13 @@ public:
- virtual ~SmartTag();
-
- /** returns true if the SmartTag consumes this event. */
-- virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
-+ virtual bool MouseButtonDown( const MouseEvent&, SmartHdl&, const Window& rWin );
-
- /** returns true if the SmartTag consumes this event. */
-- virtual bool KeyInput( const KeyEvent& rKEvt );
-+ virtual bool MouseButtonUp( const MouseEvent&, SmartHdl&, const Window& rWin );
-+
-+ /** returns true if the SmartTag consumes this event. */
-+ virtual bool KeyInput( const KeyEvent& rKEvt, const Window& rWin );
-
- /** returns true if this smart tag is currently selected */
- bool isSelected() const;
-@@ -114,10 +118,13 @@ public:
- const SmartTagReference& getSelected() const { return mxSelectedTag; }
-
- /** returns true if a SmartTag consumes this event. */
-- bool MouseButtonDown( const MouseEvent& );
-+ bool MouseButtonDown( const MouseEvent&, const Window& rWin );
-+
-+ /** returns true if the SmartTag consumes this event. */
-+ virtual bool MouseButtonUp( const MouseEvent&, const Window& rWin );
-
- /** returns true if a SmartTag consumes this event. */
-- bool KeyInput( const KeyEvent& rKEvt );
-+ bool KeyInput( const KeyEvent& rKEvt, const Window& rWin );
-
- /** disposes all smart tags and clears the set */
- void Dispose();
-diff --git sd/source/ui/toolpanel/TaskPaneViewShell.cxx sd/source/ui/toolpanel/TaskPaneViewShell.cxx
-index df81def..8dbb4e6 100644
---- sd/source/ui/toolpanel/TaskPaneViewShell.cxx
-+++ sd/source/ui/toolpanel/TaskPaneViewShell.cxx
-@@ -47,6 +47,7 @@
- #include "controls/MasterPagesPanel.hxx"
- #include "controls/MasterPagesSelector.hxx"
- #include "controls/TableDesignPanel.hxx"
-+#include "controls/DiagramDesignPanel.hxx"
- #include "controls/CustomAnimationPanel.hxx"
- #include "controls/SlideTransitionPanel.hxx"
- #include "controls/AnimationSchemesPanel.hxx"
-@@ -263,6 +264,22 @@ void TaskPaneViewShell::Implementation::Setup (
- AddPanel (nId, PID_TABLE_DESIGN);
- }
-
-+ {
-+ DummyControl aControl (pToolPanel, SdResId(DLG_DIAGRAMDESIGNPANE));
-+
-+ // (Quick)DiagramDesignPanel
-+ nId = pToolPanel->AddControl (
-+ controls::DiagramDesignPanel::CreateControlFactory(rBase),
-+ aControl.GetText(),
-+ HID_SD_DIAGRAM_DESIGN,
-+ ResourceActivationClickHandler(
-+ pFrameworkHelper,
-+ pFrameworkHelper->CreateResourceId(
-+ FrameworkHelper::msDiagramDesignPanelURL, xTaskPaneId),
-+ pToolPanel->GetControlContainer()));
-+ AddPanel (nId, PID_DIAGRAM_DESIGN);
-+ }
-+
- {
- DummyControl aControl (pToolPanel, SdResId(RID_CUSTOMANIMATION_START+0));
-
-diff --git sd/source/ui/toolpanel/controls/DiagramDesignPanel.cxx sd/source/ui/toolpanel/controls/DiagramDesignPanel.cxx
-new file mode 100644
-index 0000000..b38cf56
---- /dev/null
-+++ sd/source/ui/toolpanel/controls/DiagramDesignPanel.cxx
-@@ -0,0 +1,104 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPanel.cxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sd.hxx"
-+
-+#include "DiagramDesignPanel.hxx"
-+
-+#include "taskpane/TaskPaneControlFactory.hxx"
-+
-+#include "strings.hrc"
-+#include "sdresid.hxx"
-+
-+namespace sd
-+{
-+
-+ class ViewShellBase;
-+ extern ::Window * createDiagramDesignPanel( ::Window* pParent, ViewShellBase& rBase );
-+
-+namespace toolpanel { namespace controls {
-+
-+
-+DiagramDesignPanel::DiagramDesignPanel(TreeNode* pParent, ViewShellBase& rBase)
-+ : SubToolPanel (pParent)
-+{
-+ mpWrappedControl = createDiagramDesignPanel( pParent->GetWindow(), rBase );
-+ mpWrappedControl->Show();
-+}
-+
-+DiagramDesignPanel::~DiagramDesignPanel()
-+{
-+ delete mpWrappedControl;
-+}
-+
-+std::auto_ptr<ControlFactory> DiagramDesignPanel::CreateControlFactory (ViewShellBase& rBase)
-+{
-+ return std::auto_ptr<ControlFactory>(
-+ new ControlFactoryWithArgs1<DiagramDesignPanel,ViewShellBase>(rBase));
-+}
-+
-+Size DiagramDesignPanel::GetPreferredSize()
-+{
-+ return maPreferredSize;
-+}
-+sal_Int32 DiagramDesignPanel::GetPreferredWidth(sal_Int32 )
-+{
-+ return maPreferredSize.Width();
-+}
-+sal_Int32 DiagramDesignPanel::GetPreferredHeight(sal_Int32 )
-+{
-+ return maPreferredSize.Height();
-+}
-+::Window* DiagramDesignPanel::GetWindow()
-+{
-+ return mpWrappedControl;
-+}
-+bool DiagramDesignPanel::IsResizable()
-+{
-+ return true;
-+}
-+bool DiagramDesignPanel::IsExpandable() const
-+{
-+ return true;
-+}
-+
-+::com::sun::star::uno::Reference<
-+ ::com::sun::star::accessibility::XAccessible> DiagramDesignPanel::CreateAccessibleObject (
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::accessibility::XAccessible>& )
-+{
-+ if (GetWindow() != NULL)
-+ return GetWindow()->GetAccessible();
-+ else
-+ return NULL;
-+}
-+
-+} } } // end of namespace ::sd::toolpanel::controls
-diff --git sd/source/ui/toolpanel/controls/DiagramDesignPanel.hxx sd/source/ui/toolpanel/controls/DiagramDesignPanel.hxx
-new file mode 100644
-index 0000000..f026f3a
---- /dev/null
-+++ sd/source/ui/toolpanel/controls/DiagramDesignPanel.hxx
-@@ -0,0 +1,78 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: TableDesignPanel.hxx,v $
-+ * $Revision: 1.3 $
-+ *
-+ * 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 SD_TOOLPANEL_CONTROLS_DIAGRAM_DESIGN_PANEL_HXX
-+#define SD_TOOLPANEL_CONTROLS_DIAGRAM_DESIGN_PANEL_HXX
-+
-+#include "taskpane/SubToolPanel.hxx"
-+
-+namespace sd {
-+class ViewShellBase;
-+}
-+
-+namespace sd { namespace toolpanel {
-+class TreeNode;
-+class ControlFactory;
-+} }
-+
-+namespace sd { namespace toolpanel { namespace controls {
-+
-+class DiagramDesignPanel
-+ : public SubToolPanel
-+{
-+public:
-+ DiagramDesignPanel (
-+ TreeNode* pParent,
-+ ViewShellBase& rBase);
-+ virtual ~DiagramDesignPanel (void);
-+
-+ static std::auto_ptr<ControlFactory> CreateControlFactory (ViewShellBase& rBase);
-+
-+ virtual Size GetPreferredSize (void);
-+ virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
-+ virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-+ virtual ::Window* GetWindow (void);
-+ virtual bool IsResizable (void);
-+ virtual bool IsExpandable (void) const;
-+
-+ virtual ::com::sun::star::uno::Reference<
-+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::accessibility::XAccessible>& rxParent);
-+
-+ using Window::GetWindow;
-+private:
-+ Size maPreferredSize;
-+ ::Window* mpWrappedControl;
-+};
-+
-+} } } // end of namespace ::sd::toolpanel::controls
-+
-+#endif
-diff --git sd/source/ui/toolpanel/controls/makefile.mk sd/source/ui/toolpanel/controls/makefile.mk
-index 4741144..60fa5b3 100644
---- sd/source/ui/toolpanel/controls/makefile.mk
-+++ sd/source/ui/toolpanel/controls/makefile.mk
-@@ -49,6 +49,7 @@ PRJINC=..$/..$/ ..$/..$/slidesorter
- SLOFILES = \
- $(SLO)$/AllMasterPagesSelector.obj \
- $(SLO)$/CurrentMasterPagesSelector.obj \
-+ $(SLO)$/DiagramDesignPanel.obj \
- $(SLO)$/DocumentHelper.obj \
- $(SLO)$/MasterPageObserver.obj \
- $(SLO)$/MasterPagesPanel.obj \
-diff --git sd/source/ui/unoidl/unopage.cxx sd/source/ui/unoidl/unopage.cxx
-index 69e73bb..5b5a478 100644
---- sd/source/ui/unoidl/unopage.cxx
-+++ sd/source/ui/unoidl/unopage.cxx
-@@ -40,6 +40,7 @@
- #include <com/sun/star/animations/AnimationNodeType.hpp>
- #include <com/sun/star/presentation/EffectNodeType.hpp>
- #include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
- #include <comphelper/processfactory.hxx>
- #include <rtl/ustrbuf.hxx>
- #include <vcl/bitmapex.hxx>
-@@ -119,7 +120,7 @@ enum WID_PAGE
- WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
- WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
- WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
-- WID_NAVORDER
-+ WID_NAVORDER, WID_PPT_THEME
- };
-
- #ifndef SEQTYPE
-@@ -266,6 +267,7 @@ const SfxItemPropertyMap* ImplGetMasterPagePropertyMap( PageKind ePageKind )
- { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL, &::getBooleanCppuType(), 0, 0},
- { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
-+ { MAP_CHAR_LEN("PPTTheme"), WID_PPT_THEME, &::getCppuType((uno::Reference<xml::dom::XDocument>*)0), 0, 0},
- {0,0,0,0,0,0}
- };
-
-@@ -876,6 +878,16 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
- break;
- }
-
-+ case WID_PPT_THEME:
-+ {
-+ uno::Reference<xml::dom::XDocument> xRef;
-+ if( ! ( aValue >>= xRef ) )
-+ throw lang::IllegalArgumentException();
-+
-+ GetPage()->setPPTTheme( xRef );
-+ break;
-+ }
-+
- default:
- throw beans::UnknownPropertyException();
- }
-@@ -1173,6 +1185,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
- aAny <<= GetPage()->getTransitionDuration();
- break;
-
-+ case WID_PPT_THEME:
-+ aAny <<= GetPage()->getPPTTheme();
-+ break;
-+
- default:
- throw beans::UnknownPropertyException();
- }
-diff --git sd/source/ui/view/drviewse.cxx sd/source/ui/view/drviewse.cxx
-index 76348e6..a08ac7e 100644
---- sd/source/ui/view/drviewse.cxx
-+++ sd/source/ui/view/drviewse.cxx
-@@ -859,7 +859,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
- KeyCode aKCode(KEY_DELETE);
- KeyEvent aKEvt( 0, aKCode);
-
-- bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt );
-+ ::sd::Window* pWindow = GetActiveWindow();
-+ bool bConsumed=false;
-+ if( pWindow )
-+ bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt, *pWindow );
-
- if( !bConsumed && HasCurrentFunction() )
- bConsumed = GetCurrentFunction()->KeyInput(aKEvt);
-diff --git sd/source/ui/view/viewshel.cxx sd/source/ui/view/viewshel.cxx
-index aae2f89..ef1e060 100644
---- sd/source/ui/view/viewshel.cxx
-+++ sd/source/ui/view/viewshel.cxx
-@@ -489,8 +489,8 @@ BOOL ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
- else
- {
- bool bConsumed = false;
-- if( GetView() )
-- bConsumed = GetView()->getSmartTags().KeyInput(rKEvt);
-+ if( GetView() && pWin )
-+ bConsumed = GetView()->getSmartTags().KeyInput(rKEvt, *pWin);
-
-
- if( !bConsumed )
-@@ -554,8 +554,8 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
- GetView()->SetMouseEvent(rMEvt);
-
- bool bConsumed = false;
-- if( GetView() )
-- bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
-+ if( GetView() && pWin )
-+ bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt, *pWin );
-
- if( !bConsumed )
- {
-@@ -626,7 +626,11 @@ void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
- if (GetView() != NULL)
- GetView()->SetMouseEvent(rMEvt);
-
-- if( HasCurrentFunction())
-+ bool bConsumed = false;
-+ if( GetView() && pWin )
-+ bConsumed = GetView()->getSmartTags().MouseButtonUp( rMEvt, *pWin );
-+
-+ if( !bConsumed && HasCurrentFunction())
- {
- rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
- if( !xSelectionController.is() || !xSelectionController->onMouseButtonUp( rMEvt, pWin ) )
-diff --git sd/util/makefile.mk sd/util/makefile.mk
-index 551d73d..2458fb2 100644
---- sd/util/makefile.mk
-+++ sd/util/makefile.mk
-@@ -54,6 +54,7 @@ RESLIB1SRSFILES=\
- $(SRS)$/notes.srs \
- $(SRS)$/animui.srs \
- $(SRS)$/slideshow.srs \
-+ $(SRS)$/uidiagram.srs \
- $(SRS)$/uitable.srs \
- $(SOLARCOMMONRESDIR)$/sfx.srs
-
-@@ -123,6 +124,7 @@ LIB3FILES= \
- $(SLB)$/helper.lib \
- $(SLB)$/xml.lib \
- $(SLB)$/cgm.lib \
-+ $(SLB)$/uidiagram.lib \
- $(SLB)$/uitable.lib \
- $(SLB)$/grf.lib
-
-diff --git svx/inc/svdstr.hrc svx/inc/svdstr.hrc
-index 68a1eec..59a3dcc 100644
---- svx/inc/svdstr.hrc
-+++ svx/inc/svdstr.hrc
-@@ -188,7 +188,10 @@
- #define STR_ObjNameSingulMEDIA (STR_ObjNameBegin + 143)
- #define STR_ObjNamePluralMEDIA (STR_ObjNameBegin + 144)
-
--#define STR_ObjNameEnd (STR_ObjNamePluralMEDIA)
-+#define STR_ObjNameSingulDiagram (STR_ObjNameBegin + 145)
-+#define STR_ObjNamePluralDiagram (STR_ObjNameBegin + 146)
-+
-+#define STR_ObjNameEnd (STR_ObjNamePluralDiagram)
-
- #define STR_EditBegin (STR_ObjNameEnd+1)
- #define STR_EditWithCopy (STR_EditBegin + 0)
-diff --git svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
-index 8208e1a..ad26e1c 100644
---- svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
-+++ svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
-@@ -41,7 +41,7 @@ namespace sdr
- {
- namespace overlay
- {
-- class OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition
-+ class SVX_DLLPUBLIC OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition
- {
- protected:
- // the sequence of primitives to show
-diff --git svx/inc/svx/svdobj.hxx svx/inc/svx/svdobj.hxx
-index 8e59967..7b240f7 100644
---- svx/inc/svx/svdobj.hxx
-+++ svx/inc/svx/svdobj.hxx
-@@ -135,6 +135,7 @@ enum SdrObjKind {OBJ_NONE = 0, // Abstraktes Objekt (SdrObject)
- OBJ_CUSTOMSHAPE=33, // CustomShape
- OBJ_MEDIA =34, // Media shape
- OBJ_TABLE =35, // Table
-+ OBJ_DIAGRAM =36, // DiagramShape
- OBJ_MAXI};
-
- enum SdrUserCallType {SDRUSERCALL_MOVEONLY, // Nur verschoben, Groesse unveraendert
-diff --git svx/inc/svx/svdodiagram.hxx svx/inc/svx/svdodiagram.hxx
-new file mode 100644
-index 0000000..51ccfcc
---- /dev/null
-+++ svx/inc/svx/svdodiagram.hxx
-@@ -0,0 +1,118 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: svdotable.hxx,v $
-+ * $Revision: 1.4.18.1 $
-+ *
-+ * 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 _SVX_SVDODIAGRAM_HXX
-+#define _SVX_SVDODIAGRAM_HXX
-+
-+#include "svx/svxdllapi.h"
-+#include "svx/svdogrp.hxx"
-+#include <com/sun/star/text/WritingMode.hpp>
-+
-+#include <boost/shared_ptr.hpp>
-+
-+//------------------------------------------------------------------------
-+
-+namespace com { namespace sun { namespace star { namespace xml { namespace dom {
-+ class XDocument;
-+}}}}};
-+
-+class SfxStyleSheet;
-+
-+namespace sdr { namespace diagram {
-+
-+//------------------------------------------------------------------------
-+// SdrDiagramObj
-+//------------------------------------------------------------------------
-+
-+struct SdrDiagramObjImpl;
-+class SVX_DLLPUBLIC SdrDiagramObj : public ::SdrObjGroup
-+{
-+public:
-+ explicit SdrDiagramObj(SdrModel* _pModel);
-+ virtual void operator=(const SdrObject& rObj);
-+
-+ TYPEINFO();
-+
-+ virtual UINT16 GetObjIdentifier() const;
-+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
-+
-+ virtual void SetObjList(SdrObjList* pNewObjList);
-+ virtual void SetPage(SdrPage* pNewPage);
-+ virtual void SetModel(SdrModel* pNewModel);
-+
-+ virtual SdrObjList* GetSubList() const;
-+
-+ virtual void TakeObjNameSingul(String& rName) const;
-+ virtual void TakeObjNamePlural(String& rName) const;
-+
-+ // trigger updates
-+ //virtual void SetChanged();
-+
-+ //virtual void RecalcSnapRect();
-+ //virtual void NbcSetSnapRect(const Rectangle& rRect);
-+ //virtual void NbcSetLogicRect(const Rectangle& rRect);
-+
-+ //virtual void NbcReformatText();
-+ //virtual void ReformatText();
-+
-+ //virtual SdrObject* DoConvertToPolyObj(BOOL bBezier) const;
-+
-+ void LayoutShape() const;
-+
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> GetDataFragment() const;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> GetLayoutFragment() const;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> GetQStyleFragment() const;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument> GetColorStyleFragment() const;
-+
-+ void SetDataFragment( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rxFragment );
-+ void SetLayoutFragment( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rxFragment );
-+ void SetQStyleFragment( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rxFragment );
-+ void SetColorStyleFragment( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::dom::XDocument>& rxFragment );
-+
-+private:
-+ // DrawContact section
-+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
-+
-+ boost::shared_ptr<SdrDiagramObjImpl> mpImpl;
-+};
-+
-+////////////////////////////////////////////////////////////////////////////////////////////////////
-+
-+} }
-+
-+#endif
-diff --git svx/inc/svx/unoprov.hxx svx/inc/svx/unoprov.hxx
-index d3ea6ff..b3e6a05 100644
---- svx/inc/svx/unoprov.hxx
-+++ svx/inc/svx/unoprov.hxx
-@@ -95,7 +95,8 @@ public:
- #define SVXMAP_CUSTOMSHAPE 22
- #define SVXMAP_MEDIA 23
- #define SVXMAP_TABLE 24
--#define SVXMAP_END 25 // last+1 !
-+#define SVXMAP_DIAGRAM 25
-+#define SVXMAP_END 26 // last+1 !
- /***********************************************************************
- * SvxUnoPropertyMapProvider *
- ***********************************************************************/
-diff --git svx/inc/svx/unoshape.hxx svx/inc/svx/unoshape.hxx
-index 9741878..e581d37 100644
---- svx/inc/svx/unoshape.hxx
-+++ svx/inc/svx/unoshape.hxx
-@@ -388,6 +388,7 @@ public:
- // XServiceInfo
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
- };
-+
- #include <com/sun/star/drawing/XShapes.hpp>
- #include <com/sun/star/drawing/XShapeGroup.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-@@ -403,6 +404,7 @@ private:
- rtl::Reference< SvxDrawPage> mxPage;
-
- public:
-+ SvxShapeGroup( SdrObject* pObj,SvxDrawPage* pDrawPage, const SfxItemPropertyMap* pPropertyMap ) throw();
- SvxShapeGroup( SdrObject* pObj,SvxDrawPage* pDrawPage ) throw ();
- virtual ~SvxShapeGroup() throw ();
-
-@@ -451,6 +453,28 @@ public:
- /***********************************************************************
- * *
- ***********************************************************************/
-+class SvxShapeDiagram : public SvxShapeGroup
-+{
-+public:
-+ SvxShapeDiagram( SdrObject*, SvxDrawPage* ) throw();
-+ virtual ~SvxShapeDiagram() throw ();
-+
-+ virtual bool setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-+ virtual bool getPropertyValueImpl( const SfxItemPropertyMap* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-+
-+ // XInterface
-+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL acquire() throw();
-+ virtual void SAL_CALL release() throw();
-+
-+ // XServiceInfo
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
-+};
-+
-+/***********************************************************************
-+* *
-+***********************************************************************/
- class SvxShapeConnector : public ::com::sun::star::drawing::XConnectorShape,
- public SvxShapeText
- {
-diff --git svx/inc/svx/unoshprp.hxx svx/inc/svx/unoshprp.hxx
-index 7366f1a..98fdebe 100644
---- svx/inc/svx/unoshprp.hxx
-+++ svx/inc/svx/unoshprp.hxx
-@@ -161,6 +161,12 @@
- #define OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS (OWN_ATTR_VALUE_START+54)
- #define OWN_ATTR_TABLEBORDER (OWN_ATTR_VALUE_START+55)
-
-+// reuse one own attr from ole shapes for diagram
-+#define OWN_ATTR_DIAGRAM_DATA (OWN_ATTR_VALUE_START+48)
-+#define OWN_ATTR_DIAGRAM_LAYOUT (OWN_ATTR_VALUE_START+49)
-+#define OWN_ATTR_DIAGRAM_QSTYLE (OWN_ATTR_VALUE_START+50)
-+#define OWN_ATTR_DIAGRAM_COLORSTYLE (OWN_ATTR_VALUE_START+51)
-+
- #define OWN_ATTR_OLE_VISAREA (OWN_ATTR_VALUE_START+63)
- #define OWN_ATTR_CAPTION_POINT (OWN_ATTR_VALUE_START+64)
- #define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65)
-diff --git svx/prj/d.lst svx/prj/d.lst
-index 37c75fb..5d34ef6 100644
---- svx/prj/d.lst
-+++ svx/prj/d.lst
-@@ -233,6 +233,7 @@ mkdir: %_DEST%\inc%_EXT%\svx
- ..\inc\svx\sdrobjectuser.hxx %_DEST%\inc%_EXT%\svx\sdrobjectuser.hxx
- ..\inc\svx\svdocapt.hxx %_DEST%\inc%_EXT%\svx\svdocapt.hxx
- ..\inc\svx\svdocirc.hxx %_DEST%\inc%_EXT%\svx\svdocirc.hxx
-+..\inc\svx\svdodiagram.hxx %_DEST%\inc%_EXT%\svx\svdodiagram.hxx
- ..\inc\svx\svdoedge.hxx %_DEST%\inc%_EXT%\svx\svdoedge.hxx
- ..\inc\svx\svdograf.hxx %_DEST%\inc%_EXT%\svx\svdograf.hxx
- ..\inc\svx\svdogrp.hxx %_DEST%\inc%_EXT%\svx\svdogrp.hxx
-@@ -606,6 +607,7 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay
- ..\inc\svx\sdr\overlay\overlaypolypolygon.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaypolypolygon.hxx
- ..\inc\svx\sdr\overlay\overlayobjectcell.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayobjectcell.hxx
- ..\inc\svx\sdr\overlay\overlaysdrobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaysdrobject.hxx
-+..\inc\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayprimitive2dsequenceobject.hxx
-
- mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation
- ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx
-diff --git svx/source/svdraw/makefile.mk svx/source/svdraw/makefile.mk
-index dddf655..ca96e09 100644
---- svx/source/svdraw/makefile.mk
-+++ svx/source/svdraw/makefile.mk
-@@ -68,6 +68,7 @@ LIB1OBJFILES= \
- $(SLO)$/svdtext.obj \
- $(SLO)$/svdoashp.obj \
- $(SLO)$/svdoattr.obj \
-+ $(SLO)$/svdodiagram.obj \
- $(SLO)$/svdotext.obj \
- $(SLO)$/svdotxat.obj \
- $(SLO)$/svdotxdr.obj \
-diff --git svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdobj.cxx
-index fecc430..1823689 100644
---- svx/source/svdraw/svdobj.cxx
-+++ svx/source/svdraw/svdobj.cxx
-@@ -126,6 +126,7 @@
- #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
- #include <svx/polysc3d.hxx>
- #include "svx/svdotable.hxx"
-+#include "svx/svdodiagram.hxx"
-
- using namespace ::com::sun::star;
-
-@@ -3173,6 +3174,7 @@ SdrObject* SdrObjFactory::MakeNewObject(UINT32 nInvent, UINT16 nIdent, SdrPage*
- case USHORT(OBJ_PAGE ): pObj=new SdrPageObj; break;
- case USHORT(OBJ_UNO ): pObj=new SdrUnoObj(String()); break;
- case USHORT(OBJ_CUSTOMSHAPE ): pObj=new SdrObjCustomShape(); break;
-+ case USHORT(OBJ_DIAGRAM ): pObj=new ::sdr::diagram::SdrDiagramObj(pModel); break;
- case USHORT(OBJ_MEDIA ): pObj=new SdrMediaObj(); break;
- case USHORT(OBJ_TABLE ): pObj=new ::sdr::table::SdrTableObj(pModel); break;
- }
-diff --git svx/source/svdraw/svdodiagram.cxx svx/source/svdraw/svdodiagram.cxx
-new file mode 100644
-index 0000000..78bc4e8
---- /dev/null
-+++ svx/source/svdraw/svdodiagram.cxx
-@@ -0,0 +1,309 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: svdotable.cxx,v $
-+ * $Revision: 1.4.18.1 $
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svx.hxx"
-+
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+#include <com/sun/star/style/XStyle.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/document/XFilter.hpp>
-+#include <com/sun/star/document/XImporter.hpp>
-+#include <svtools/style.hxx>
-+#include <comphelper/processfactory.hxx>
-+
-+#include "editstat.hxx"
-+#include "svx/outlobj.hxx"
-+#include "svx/svdview.hxx"
-+#include "svx/svdpage.hxx"
-+#include "svx/sdr/properties/textproperties.hxx"
-+#include "svx/sdr/contact/viewcontactofgroup.hxx"
-+#include "svx/svdodiagram.hxx"
-+#include "svx/svdhdl.hxx"
-+#include "svx/svdoutl.hxx"
-+#include "svx/svddrag.hxx"
-+#include "svx/svdpagv.hxx"
-+#include "svx/svdetc.hxx"
-+#include "svx/svdobj.hxx"
-+#include "svx/svdundo.hxx"
-+#include "svx/svdoutl.hxx"
-+#include "svdstr.hrc"
-+#include "svdglob.hxx"
-+#include "svx/writingmodeitem.hxx"
-+#include "svx/frmdiritem.hxx"
-+
-+// -----------------------------------------------------------------------------
-+
-+using namespace ::com::sun::star;
-+
-+namespace sdr { namespace diagram {
-+
-+// -----------------------------------------------------------------------------
-+
-+struct SdrDiagramObjImpl
-+{
-+ explicit SdrDiagramObjImpl(SdrDiagramObj& rOwner);
-+ void layout( const Rectangle& );
-+
-+ uno::Reference<xml::dom::XDocument> mxDataFragment;
-+ uno::Reference<xml::dom::XDocument> mxLayoutFragment;
-+ uno::Reference<xml::dom::XDocument> mxQStyleFragment;
-+ uno::Reference<xml::dom::XDocument> mxColorStyleFragment;
-+
-+ SdrDiagramObj* mpOwner;
-+};
-+
-+// -----------------------------------------------------------------------------
-+
-+SdrDiagramObjImpl::SdrDiagramObjImpl(SdrDiagramObj& rOwner) :
-+ mpOwner(&rOwner)
-+{}
-+
-+// -----------------------------------------------------------------------------
-+
-+void SdrDiagramObjImpl::layout( const Rectangle& rRect )
-+{
-+ try
-+ {
-+ uno::Reference<drawing::XShape> xShape( mpOwner->getUnoShape(),
-+ uno::UNO_QUERY_THROW );
-+ uno::Reference<beans::XPropertySet> xPropSet( xShape,
-+ uno::UNO_QUERY_THROW );
-+
-+ if( mpOwner->GetLayoutFragment().is() )
-+ {
-+ // make sure aOutRect is calculated from children
-+ mpOwner->GetCurrentBoundRect();
-+
-+ // delete old content
-+ mpOwner->GetSubList()->Clear();
-+
-+ uno::Reference<lang::XMultiServiceFactory> xFactory(
-+ ::comphelper::getProcessServiceFactory(),
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference<uno::XInterface> xInt(
-+ xFactory->createInstance(
-+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Impress.oox.QuickDiagrammingLayout")) ) );
-+
-+ uno::Reference<document::XFilter> xFilter( xInt,
-+ uno::UNO_QUERY_THROW );
-+ uno::Reference<document::XImporter> xImporter( xInt,
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference<lang::XComponent> xComp( mpOwner->GetModel()->getUnoModel(),
-+ uno::UNO_QUERY_THROW );
-+ xImporter->setTargetDocument(xComp);
-+ uno::Sequence< beans::PropertyValue > aDescriptor(2);
-+ aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
-+ aDescriptor[0].Value <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///home/me/text/bugdoc/impress/pptx_Matrix.glox"));
-+ aDescriptor[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentShape"));
-+ aDescriptor[1].Value <<= xShape;
-+ xFilter->filter(aDescriptor);
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {}
-+}
-+
-+// -----------------------------------------------------------------------------
-+// DrawContact section
-+// -----------------------------------------------------------------------------
-+
-+sdr::contact::ViewContact* SdrDiagramObj::CreateObjectSpecificViewContact()
-+{
-+ return new sdr::contact::ViewContactOfGroup(*this);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+TYPEINIT1(SdrDiagramObj,SdrObjGroup);
-+
-+// --------------------------------------------------------------------
-+
-+SdrDiagramObj::SdrDiagramObj(SdrModel* _pModel) :
-+ mpImpl( new SdrDiagramObjImpl( *this ) )
-+{
-+ pModel = _pModel;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::operator=(const SdrObject& rObj)
-+{
-+ SdrObjGroup::operator=(rObj);
-+
-+ const SdrDiagramObj* pTableObj = dynamic_cast< const SdrDiagramObj* >( &rObj );
-+ if (pTableObj!=NULL)
-+ *mpImpl = *pTableObj->mpImpl;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+UINT16 SdrDiagramObj::GetObjIdentifier() const
-+{
-+ return static_cast<UINT16>(OBJ_DIAGRAM);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
-+{
-+ rInfo.bResizeFreeAllowed=TRUE;
-+ rInfo.bResizePropAllowed=TRUE;
-+ rInfo.bRotateFreeAllowed=FALSE;
-+ rInfo.bRotate90Allowed =FALSE;
-+ rInfo.bMirrorFreeAllowed=FALSE;
-+ rInfo.bMirror45Allowed =FALSE;
-+ rInfo.bMirror90Allowed =FALSE;
-+
-+ // allow transparence
-+ rInfo.bTransparenceAllowed = TRUE;
-+
-+ // gradient depends on fillstyle
-+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue();
-+ rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
-+ rInfo.bShearAllowed =FALSE;
-+ rInfo.bEdgeRadiusAllowed=FALSE;
-+ rInfo.bCanConvToPath =FALSE;
-+ rInfo.bCanConvToPoly =FALSE;
-+ rInfo.bCanConvToPathLineToArea=FALSE;
-+ rInfo.bCanConvToPolyLineToArea=FALSE;
-+ rInfo.bCanConvToContour = FALSE;
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::SetObjList(SdrObjList* pNewObjList)
-+{
-+ // TODO: only for noticing this
-+ SdrObjGroup::SetObjList(pNewObjList);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::SetPage(SdrPage* pNewPage)
-+{
-+ // TODO: only for noticing this
-+ SdrObjGroup::SetPage(pNewPage);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::SetModel(SdrModel* pNewModel)
-+{
-+ // TODO: only for noticing this
-+ SdrObjGroup::SetModel(pNewModel);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+SdrObjList* SdrDiagramObj::GetSubList() const
-+{
-+ // TODO: only for noticing this
-+ return SdrObjGroup::GetSubList();
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::TakeObjNameSingul(XubString& rName) const
-+{
-+ rName = ImpGetResStr(STR_ObjNameSingulDiagram);
-+
-+ String aName( GetName() );
-+ if(aName.Len())
-+ {
-+ rName += sal_Unicode(' ');
-+ rName += sal_Unicode('\'');
-+ rName += aName;
-+ rName += sal_Unicode('\'');
-+ }
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::TakeObjNamePlural(XubString& rName) const
-+{
-+ rName = ImpGetResStr(STR_ObjNamePluralDiagram);
-+}
-+
-+// --------------------------------------------------------------------
-+
-+void SdrDiagramObj::LayoutShape() const
-+{
-+ mpImpl->layout( aOutRect );
-+}
-+
-+uno::Reference<xml::dom::XDocument> SdrDiagramObj::GetDataFragment() const
-+{
-+ return mpImpl->mxDataFragment;
-+}
-+
-+uno::Reference<xml::dom::XDocument> SdrDiagramObj::GetLayoutFragment() const
-+{
-+ return mpImpl->mxLayoutFragment;
-+}
-+
-+uno::Reference<xml::dom::XDocument> SdrDiagramObj::GetQStyleFragment() const
-+{
-+ return mpImpl->mxQStyleFragment;
-+}
-+
-+uno::Reference<xml::dom::XDocument> SdrDiagramObj::GetColorStyleFragment() const
-+{
-+ return mpImpl->mxColorStyleFragment;
-+}
-+
-+void SdrDiagramObj::SetDataFragment( const uno::Reference<xml::dom::XDocument>& rxFragment )
-+{
-+ mpImpl->mxDataFragment = rxFragment;
-+}
-+
-+void SdrDiagramObj::SetLayoutFragment( const uno::Reference<xml::dom::XDocument>& rxFragment )
-+{
-+ mpImpl->mxLayoutFragment = rxFragment;
-+}
-+
-+void SdrDiagramObj::SetQStyleFragment( const uno::Reference<xml::dom::XDocument>& rxFragment )
-+{
-+ mpImpl->mxQStyleFragment = rxFragment;
-+}
-+
-+void SdrDiagramObj::SetColorStyleFragment( const uno::Reference<xml::dom::XDocument>& rxFragment )
-+{
-+ mpImpl->mxColorStyleFragment = rxFragment;
-+}
-+
-+} }
-diff --git svx/source/svdraw/svdstr.src svx/source/svdraw/svdstr.src
-index f577928..9e5ddfd 100644
---- svx/source/svdraw/svdstr.src
-+++ svx/source/svdraw/svdstr.src
-@@ -2829,6 +2829,15 @@ String STR_ObjNamePluralTable
- Text [ en-US ] = "Tables";
- };
-
-+String STR_ObjNameSingulDiagram
-+{
-+ Text [ en-US ] = "Diagram";
-+};
-+String STR_ObjNamePluralDiagram
-+{
-+ Text [ en-US ] = "Diagram";
-+};
-+
- Bitmap SIP_SA_CROP_MARKERS
- {
- File = "cropmarkers.bmp";
-diff --git svx/source/unodraw/unopage.cxx svx/source/unodraw/unopage.cxx
-index 0171d42..b50d59e 100644
---- svx/source/unodraw/unopage.cxx
-+++ svx/source/unodraw/unopage.cxx
-@@ -855,6 +855,9 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt3
- case OBJ_CUSTOMSHAPE:
- pRet = new SvxCustomShape( pObj );
- break;
-+ case OBJ_DIAGRAM:
-+ pRet = new SvxShapeDiagram( pObj, mpPage );
-+ break;
- case OBJ_MEDIA:
- pRet = new SvxMediaShape( pObj );
- break;
-diff --git svx/source/unodraw/unoprov.cxx svx/source/unodraw/unoprov.cxx
-index 1cf5bda..62a3aea 100644
---- svx/source/unodraw/unoprov.cxx
-+++ svx/source/unodraw/unoprov.cxx
-@@ -38,6 +38,8 @@
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/embed/XEmbeddedObject.hpp>
-+#include <com/sun/star/beans/Pair.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
- #include <com/sun/star/util/MeasureUnit.hpp>
- #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
- #ifndef _COM_SUN_STAR_MEDIA_ZOOMLEVEL_HDL_
-@@ -799,6 +801,28 @@ SfxItemPropertyMap* ImplGetSvxTableShapePropertyMap()
- return aTableShapePropertyMap_Impl;
- }
-
-+SfxItemPropertyMap* ImplGetSvxDiagramShapePropertyMap()
-+{
-+ static SfxItemPropertyMap aDiagramShapePropertyMap_Impl[] =
-+ {
-+ SHAPE_DESCRIPTOR_PROPERTIES
-+ MISC_OBJ_PROPERTIES
-+ LINKTARGET_PROPERTIES
-+ { MAP_CHAR_LEN("DiagramData"), OWN_ATTR_DIAGRAM_DATA,
-+ &::getCppuType((uno::Reference<xml::dom::XDocument>*)0), 0, 0},
-+ { MAP_CHAR_LEN("DiagramLayout"), OWN_ATTR_DIAGRAM_LAYOUT,
-+ &::getCppuType((uno::Reference<xml::dom::XDocument>*)0), 0, 0},
-+ { MAP_CHAR_LEN("DiagramQStyle"), OWN_ATTR_DIAGRAM_QSTYLE,
-+ &::getCppuType((uno::Reference<xml::dom::XDocument>*)0), 0, 0},
-+ { MAP_CHAR_LEN("DiagramColorStyle"), OWN_ATTR_DIAGRAM_COLORSTYLE,
-+ &::getCppuType((uno::Reference<xml::dom::XDocument>*)0), 0, 0},
-+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
-+ {0,0,0,0,0,0}
-+ };
-+
-+ return aDiagramShapePropertyMap_Impl;
-+}
-+
- comphelper::PropertyMapEntry* ImplGetSvxDrawingDefaultsPropertyMap()
- {
- static comphelper::PropertyMapEntry aSvxDrawingDefaultsPropertyMap_Impl[] =
-@@ -863,6 +887,7 @@ UHashMapEntry pSdrShapeIdentifierMap[] =
- UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PluginShape"), OBJ_OLE2_PLUGIN ),
- UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.AppletShape"), OBJ_OLE2_APPLET ),
- UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CustomShape"), OBJ_CUSTOMSHAPE ),
-+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DiagramShape"), OBJ_DIAGRAM ),
- UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MediaShape"), OBJ_MEDIA ),
-
- UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"), E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG ),
-@@ -985,6 +1010,7 @@ SfxItemPropertyMap* SvxUnoPropertyMapProvider::GetMap(UINT16 nPropertyId)
- case SVXMAP_CUSTOMSHAPE: aMapArr[SVXMAP_CUSTOMSHAPE]=ImplGetSvxCustomShapePropertyMap(); break;
- case SVXMAP_MEDIA: aMapArr[SVXMAP_MEDIA]=ImplGetSvxMediaShapePropertyMap(); break;
- case SVXMAP_TABLE: aMapArr[SVXMAP_TABLE]=ImplGetSvxTableShapePropertyMap(); break;
-+ case SVXMAP_DIAGRAM: aMapArr[SVXMAP_DIAGRAM]=ImplGetSvxDiagramShapePropertyMap(); break;
-
- default:
- DBG_ERROR( "Unknown property map for SvxUnoPropertyMapProvider!" );
-diff --git svx/source/unodraw/unoshap2.cxx svx/source/unodraw/unoshap2.cxx
-index 5994304..1f3b371 100644
---- svx/source/unodraw/unoshap2.cxx
-+++ svx/source/unodraw/unoshap2.cxx
-@@ -107,6 +107,13 @@ SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw(
- }
-
- //----------------------------------------------------------------------
-+SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage, const SfxItemPropertyMap* pPropertyMap ) throw() :
-+ SvxShape( pObj, pPropertyMap ),
-+ mxPage( pDrawPage )
-+{
-+}
-+
-+//----------------------------------------------------------------------
- SvxShapeGroup::~SvxShapeGroup() throw()
- {
- }
-diff --git svx/source/unodraw/unoshape.cxx svx/source/unodraw/unoshape.cxx
-index edf2f81..53628b4 100644
---- svx/source/unodraw/unoshape.cxx
-+++ svx/source/unodraw/unoshape.cxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/awt/XBitmap.hpp>
- #include <com/sun/star/awt/Rectangle.hpp>
- #include <com/sun/star/drawing/CircleKind.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
- #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
- #include <cppuhelper/interfacecontainer.hxx>
- #include <vcl/svapp.hxx>
-@@ -62,6 +63,7 @@
- #include "svx/xlnstit.hxx"
- #include "svx/xlnedit.hxx"
- #include "svx/svdogrp.hxx"
-+#include "svx/svdodiagram.hxx"
- #include "svx/scene3d.hxx"
- #include "svx/svdmodel.hxx"
- #include "globl3d.hxx"
-@@ -967,6 +969,7 @@ uno::Sequence< uno::Type > SAL_CALL SvxShape::_getTypes()
- case OBJ_TEXT:
- case OBJ_CAPTION:
- case OBJ_TABLE:
-+ case OBJ_DIAGRAM:
- default:
- {
- static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
-@@ -3751,6 +3754,7 @@ uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
-
- case OBJ_OUTLINETEXT:
- case OBJ_TITLETEXT:
-+ case OBJ_DIAGRAM:
- case OBJ_TEXT:
- {
- static uno::Sequence< OUString > *pSeq = 0;
-@@ -4524,6 +4528,115 @@ uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( un
- return SvxShape::getSupportedServiceNames();
- }
-
-+/***********************************************************************
-+* class SvxShapeDiagram *
-+***********************************************************************/
-+DBG_NAME(SvxShapeDiagram)
-+SvxShapeDiagram::SvxShapeDiagram( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw() :
-+ SvxShapeGroup( pObj, pDrawPage, aSvxMapProvider.GetMap(SVXMAP_DIAGRAM) )
-+{
-+ DBG_CTOR(SvxShapeDiagram,NULL);
-+}
-+
-+SvxShapeDiagram::~SvxShapeDiagram() throw()
-+{
-+ DBG_DTOR(SvxShapeDiagram,NULL);
-+}
-+
-+uno::Any SAL_CALL SvxShapeDiagram::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
-+{
-+ return SvxShapeGroup::queryInterface( rType );
-+}
-+
-+uno::Any SAL_CALL SvxShapeDiagram::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-+{
-+ return SvxShapeGroup::queryAggregation( rType );
-+}
-+
-+void SAL_CALL SvxShapeDiagram::acquire() throw()
-+{
-+ OWeakAggObject::acquire();
-+}
-+
-+void SAL_CALL SvxShapeDiagram::release() throw()
-+{
-+ OWeakAggObject::release();
-+}
-+
-+bool SvxShapeDiagram::setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+{
-+ switch( pProperty->nWID )
-+ {
-+ case OWN_ATTR_DIAGRAM_DATA:
-+ {
-+ uno::Reference<xml::dom::XDocument> xVal( rValue,
-+ uno::UNO_QUERY );
-+ ((sdr::diagram::SdrDiagramObj*)mpObj.get())->SetDataFragment(xVal);
-+ return true;
-+ }
-+
-+ case OWN_ATTR_DIAGRAM_LAYOUT:
-+ {
-+ uno::Reference<xml::dom::XDocument> xVal( rValue,
-+ uno::UNO_QUERY );
-+ ((sdr::diagram::SdrDiagramObj*)mpObj.get())->SetLayoutFragment(xVal);
-+ return true;
-+ }
-+
-+ case OWN_ATTR_DIAGRAM_QSTYLE:
-+ {
-+ uno::Reference<xml::dom::XDocument> xVal( rValue,
-+ uno::UNO_QUERY );
-+ ((sdr::diagram::SdrDiagramObj*)mpObj.get())->SetQStyleFragment(xVal);
-+ return true;
-+ }
-+
-+ case OWN_ATTR_DIAGRAM_COLORSTYLE:
-+ {
-+ uno::Reference<xml::dom::XDocument> xVal( rValue,
-+ uno::UNO_QUERY );
-+ ((sdr::diagram::SdrDiagramObj*)mpObj.get())->SetColorStyleFragment(xVal);
-+ return true;
-+ }
-+
-+ default:
-+ return SvxShapeGroup::setPropertyValueImpl( pProperty, rValue );
-+ }
-+}
-+
-+bool SvxShapeDiagram::getPropertyValueImpl( const SfxItemPropertyMap* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+{
-+ switch( pProperty->nWID )
-+ {
-+ case OWN_ATTR_DIAGRAM_DATA:
-+ rValue <<= ((sdr::diagram::SdrDiagramObj*)mpObj.get())->GetDataFragment();
-+ return true;
-+
-+ case OWN_ATTR_DIAGRAM_LAYOUT:
-+ rValue <<= ((sdr::diagram::SdrDiagramObj*)mpObj.get())->GetLayoutFragment();
-+ return true;
-+
-+ case OWN_ATTR_DIAGRAM_QSTYLE:
-+ rValue <<= ((sdr::diagram::SdrDiagramObj*)mpObj.get())->GetQStyleFragment();
-+ return true;
-+
-+ case OWN_ATTR_DIAGRAM_COLORSTYLE:
-+ rValue <<= ((sdr::diagram::SdrDiagramObj*)mpObj.get())->GetColorStyleFragment();
-+ return true;
-+
-+ default:
-+ return SvxShapeGroup::getPropertyValueImpl( pProperty, rValue );
-+ }
-+}
-+
-+//----------------------------------------------------------------------
-+// XServiceInfo
-+//----------------------------------------------------------------------
-+uno::Sequence< OUString > SvxShapeDiagram::getSupportedServiceNames(void) throw( uno::RuntimeException )
-+{
-+ return SvxShape::getSupportedServiceNames();
-+}
-+
- /** returns a StarOffice API wrapper for the given SdrObject */
- uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
- {
-diff --git svx/source/unodraw/unoshtxt.cxx svx/source/unodraw/unoshtxt.cxx
-index 75ba1ec..68746c6 100644
---- svx/source/unodraw/unoshtxt.cxx
-+++ svx/source/unodraw/unoshtxt.cxx
-@@ -615,7 +615,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
- mbForwarderIsEditMode = sal_False;
- }
-
-- if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )
-+ if( mpObject && mpText && !mbDataValid )
- {
- mpTextForwarder->flushCache();
-
-@@ -630,32 +630,40 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
- else
- mpOutlinerParaObject = mpText->GetOutlinerParaObject();
-
-- if( mpOutlinerParaObject && ( bTextEditActive || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
-+ if( mpObject->IsInserted() && mpObject->GetPage() )
- {
-- mpOutliner->SetText( *mpOutlinerParaObject );
-+ if( mpOutlinerParaObject && ( bTextEditActive || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
-+ {
-+ mpOutliner->SetText( *mpOutlinerParaObject );
-
-- // #91254# put text to object and set EmptyPresObj to FALSE
-- if( mpText && bTextEditActive && mpOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() )
-+ // #91254# put text to object and set EmptyPresObj to FALSE
-+ if( mpText && bTextEditActive && mpOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() )
-+ {
-+ mpObject->SetEmptyPresObj( FALSE );
-+ static_cast< SdrTextObj* >( mpObject)->NbcSetOutlinerParaObjectForText( mpOutlinerParaObject, mpText );
-+ }
-+ }
-+ else
- {
-- mpObject->SetEmptyPresObj( FALSE );
-- static_cast< SdrTextObj* >( mpObject)->NbcSetOutlinerParaObjectForText( mpOutlinerParaObject, mpText );
-+ sal_Bool bVertical = mpOutlinerParaObject ? mpOutlinerParaObject->IsVertical() : sal_False;
-+
-+ // set objects style sheet on empty outliner
-+ SfxStyleSheetPool* pPool = (SfxStyleSheetPool*)mpObject->GetModel()->GetStyleSheetPool();
-+ if( pPool )
-+ mpOutliner->SetStyleSheetPool( pPool );
-+
-+ SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
-+ if( pStyleSheet )
-+ mpOutliner->SetStyleSheet( 0, pStyleSheet );
-+
-+ if( bVertical )
-+ mpOutliner->SetVertical( sal_True );
- }
- }
- else
- {
-- sal_Bool bVertical = mpOutlinerParaObject ? mpOutlinerParaObject->IsVertical() : sal_False;
--
-- // set objects style sheet on empty outliner
-- SfxStyleSheetPool* pPool = (SfxStyleSheetPool*)mpObject->GetModel()->GetStyleSheetPool();
-- if( pPool )
-- mpOutliner->SetStyleSheetPool( pPool );
--
-- SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
-- if( pStyleSheet )
-- mpOutliner->SetStyleSheet( 0, pStyleSheet );
--
-- if( bVertical )
-- mpOutliner->SetVertical( sal_True );
-+ if( mpOutlinerParaObject )
-+ mpOutliner->SetText( *mpOutlinerParaObject );
- }
-
- // evtually we have to set the border attributes
-diff --git xmloff/inc/xmlnmspe.hxx xmloff/inc/xmlnmspe.hxx
-index ed02f95..c3aefd2 100644
---- xmloff/inc/xmlnmspe.hxx
-+++ xmloff/inc/xmlnmspe.hxx
-@@ -96,6 +96,7 @@ XML_OLD_NAMESPACE( META, 6U )
- // experimental namespaces
- XML_NAMESPACE( FIELD, 100U )
- XML_NAMESPACE( FORMX, 101U ) // form interop extensions
-+XML_NAMESPACE( INTEROP, 102U ) // general interop extensions
-
-
- #endif // _XMLOFF_XMLNMSPE_HXX
-diff --git xmloff/inc/xmloff/shapeexport.hxx xmloff/inc/xmloff/shapeexport.hxx
-index 25e57fe..11a728b 100644
---- xmloff/inc/xmloff/shapeexport.hxx
-+++ xmloff/inc/xmloff/shapeexport.hxx
-@@ -128,6 +128,7 @@ enum XmlShapeType
- XmlShapeTypeDrawMediaShape, // "com.sun.star.draw.MediaShape"
-
- XmlShapeTypeDrawTableShape, // "com.sun.star.drawing.TableShape"
-+ XmlShapeTypeDrawDiagramShape, // "com.sun.star.drawing.DiagramShape"
-
- XmlShapeTypeNotYetSet
- };
-@@ -227,6 +228,7 @@ private:
-
- // single shape exporters
- SAL_DLLPRIVATE void ImpExportGroupShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
-+ SAL_DLLPRIVATE void ImpExportDiagramShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
- SAL_DLLPRIVATE void ImpExport3DSceneShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
- SAL_DLLPRIVATE void ImpExportRectangleShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
- SAL_DLLPRIVATE void ImpExportLineShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL );
-diff --git xmloff/inc/xmloff/xmlexp.hxx xmloff/inc/xmloff/xmlexp.hxx
-index cb6f4c8..43ee30a 100644
---- xmloff/inc/xmloff/xmlexp.hxx
-+++ xmloff/inc/xmloff/xmlexp.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
- #include <com/sun/star/xml/sax/XAttributeList.hpp>
- #include <com/sun/star/xml/sax/XLocator.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
- #include <rtl/ustring.hxx>
-@@ -578,6 +579,9 @@ public:
- // --> OD 2008-11-26 #158694#
- const sal_Bool exportTextNumberElement() const;
- // <--
-+
-+ SAL_DLLPRIVATE ::rtl::OUString ImpExportFragment( const com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument>& xFragment,
-+ const ::rtl::OUString& rPrefix );
- };
-
- inline UniReference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport()
-diff --git xmloff/inc/xmloff/xmlimp.hxx xmloff/inc/xmloff/xmlimp.hxx
-index 610819d..71337c6 100644
---- xmloff/inc/xmloff/xmlimp.hxx
-+++ xmloff/inc/xmloff/xmlimp.hxx
-@@ -63,6 +63,7 @@ namespace rtl { class OUString; }
- namespace com { namespace sun { namespace star {
- namespace frame { class XModel; }
- namespace io { class XOutputStream; }
-+ namespace embed { class XStorage; }
- } } }
- namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
-
-@@ -414,6 +415,9 @@ public:
- sal_Bool IsTextDocInOOoFileFormat() const;
- // <--
-
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::embed::XStorage> GetSourceStorage() const;
-+
- String GetBaseURL() const;
- String GetDocumentBase() const;
-
-@@ -425,6 +429,11 @@ public:
- ::com::sun::star::uno::XInterface> const & i_xIfc,
- ::rtl::OUString const & i_rXmlId);
-
-+ void ImpLoadFragment(const com::sun::star::uno::Reference<
-+ com::sun::star::beans::XPropertySet>& xPropSet,
-+ const rtl::OUString& rAttrValue,
-+ const char* sPropName );
-+
- // #i31958# XForms helper method
- // (to be implemented by applications suporting XForms)
- virtual void initXForms();
-diff --git xmloff/inc/xmloff/xmltoken.hxx xmloff/inc/xmloff/xmltoken.hxx
-index f233002..8e4cca2 100644
---- xmloff/inc/xmloff/xmltoken.hxx
-+++ xmloff/inc/xmloff/xmltoken.hxx
-@@ -3089,6 +3089,15 @@ namespace xmloff { namespace token {
- XML_AT_AXIS,
- XML_AT_LABELS_AND_AXIS,
-
-+ // quick diagramming
-+ XML_DIAGRAM_DATA_URL,
-+ XML_DIAGRAM_LAYOUT_URL,
-+ XML_DIAGRAM_QSTYLE_URL,
-+ XML_DIAGRAM_COLORSTYLE_URL,
-+ XML_THEME_URL,
-+ XML_N_INTEROP,
-+ XML_NP_INTEROP,
-+
- XML_TOKEN_END
- };
-
-diff --git xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
-index beda63a..324936b 100644
---- xmloff/source/core/xmlexp.cxx
-+++ xmloff/source/core/xmlexp.cxx
-@@ -46,6 +46,13 @@
- #include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp>
- #include <com/sun/star/uri/XUriReferenceFactory.hpp>
- #include <com/sun/star/uri/UriReferenceFactory.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
-+#include <com/sun/star/embed/XTransactedObject.hpp>
-+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-+#include <com/sun/star/xml/sax/XSAXSerializable.hpp>
-+#include <com/sun/star/io/XOutputStream.hpp>
-+#include <com/sun/star/io/XActiveDataSource.hpp>
- #include <comphelper/processfactory.hxx>
- #include <comphelper/configurationhelper.hxx>
- #include <xmloff/attrlist.hxx>
-@@ -308,6 +315,7 @@ void SvXMLExport::_InitCtor()
- {
- mpNamespaceMap->Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
-+ mpNamespaceMap->Add( GetXMLToken(XML_NP_INTEROP), GetXMLToken(XML_N_INTEROP), XML_NAMESPACE_INTEROP );
- }
- if( (getExportFlags() & EXPORT_CONTENT ) != 0 )
- {
-@@ -316,6 +324,7 @@ void SvXMLExport::_InitCtor()
- mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
-+ mpNamespaceMap->Add( GetXMLToken(XML_NP_INTEROP), GetXMLToken(XML_N_INTEROP), XML_NAMESPACE_INTEROP );
- }
- if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
- {
-@@ -2394,6 +2403,76 @@ const sal_Bool SvXMLExport::exportTextNumberElement() const
- }
- // <--
-
-+
-+OUString SvXMLExport::ImpExportFragment( const uno::Reference<xml::dom::XDocument>& xFragment,
-+ const OUString& sPrefix )
-+{
-+ // TODO: flat xml?! const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
-+ if( !xFragment.is() )
-+ return OUString();
-+
-+ const OUString sPath(RTL_CONSTASCII_USTRINGPARAM( "ooxml-fragments" ));
-+
-+ uno::Reference< embed::XStorage > xStorage(
-+ GetTargetStorage(),
-+ uno::UNO_QUERY_THROW );
-+ uno::Reference< embed::XStorage > xFragmentStorage(
-+ xStorage->openStorageElement( sPath,
-+ ::embed::ElementModes::READWRITE ),
-+ uno::UNO_QUERY_THROW );
-+
-+ OUString sFragmentName;
-+ const OUString sSuffix( RTL_CONSTASCII_USTRINGPARAM(".xml") );
-+
-+ // search unused filename
-+ sal_Int32 nIndex = 0;
-+ do
-+ {
-+ sFragmentName = sPrefix;
-+ sFragmentName += OUString::valueOf( ++nIndex );
-+ sFragmentName += sSuffix;
-+ }
-+ while( xFragmentStorage->hasByName( sFragmentName ) );
-+
-+ uno::Reference< io::XOutputStream > xFragmentStream(
-+ xFragmentStorage->openStreamElement(
-+ sFragmentName,
-+ ::embed::ElementModes::WRITE ),
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< lang::XMultiServiceFactory > xFactory(
-+ ::comphelper::getProcessServiceFactory() );
-+ uno::Reference<xml::sax::XDocumentHandler> xHandler(
-+ xFactory->createInstance(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ))),
-+ uno::UNO_QUERY_THROW);
-+ uno::Reference<io::XActiveDataSource> xMetaSrc( xHandler,
-+ uno::UNO_QUERY_THROW );
-+ xMetaSrc->setOutputStream( xFragmentStream );
-+
-+#if 0
-+ // enable pretty printing
-+ uno::Reference<xml::sax::XExtendedDocumentHandler> xHandler(
-+ if( 0 != (mrExport.getExportFlags() & EXPORT_PRETTY) )
-+ xHandler->allowLineBreak();
-+#endif
-+
-+ // serialize xFragment to sax handler
-+ uno::Reference<xml::sax::XSAXSerializable> xSerializable(
-+ xFragment,
-+ uno::UNO_QUERY_THROW);
-+ xSerializable->serialize(xHandler,
-+ uno::Sequence<beans::StringPair>());
-+
-+ // try to commit to disk immediately
-+ uno::Reference< embed::XTransactedObject > xTrans( xFragmentStorage,
-+ uno::UNO_QUERY );
-+ if( xTrans.is() )
-+ xTrans->commit();
-+
-+ return sPath + OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sFragmentName;
-+}
-+
- //=============================================================================
-
- void SvXMLElementExport::StartElement( SvXMLExport& rExp,
-diff --git xmloff/source/core/xmlimp.cxx xmloff/source/core/xmlimp.cxx
-index 9a37d8f..7b15100 100644
---- xmloff/source/core/xmlimp.cxx
-+++ xmloff/source/core/xmlimp.cxx
-@@ -57,8 +57,14 @@
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
- #include <com/sun/star/io/XOutputStream.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
- #include <com/sun/star/document/XBinaryStreamResolver.hpp>
- #include <com/sun/star/xml/sax/XLocator.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
-+#include <com/sun/star/io/XInputStream.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
-+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
- #include <comphelper/namecontainer.hxx>
- #include <rtl/logfile.hxx>
- #include <tools/string.hxx> // used in StartElement for logging
-@@ -175,6 +181,8 @@ public:
-
- ::rtl::OUString aODFVersion;
-
-+ uno::Reference<embed::XStorage> mxSourceStorage;
-+
- // --> OD 2004-08-10 #i28749# - boolean, indicating that position attributes
- // of shapes are given in horizontal left-to-right layout. This is the case
- // for the OpenOffice.org file format.
-@@ -985,6 +993,12 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
- uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
- aAny >>= (mpImpl->mbShapePositionInHoriL2R);
- }
-+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("SourceStorage" ) );
-+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
-+ {
-+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
-+ aAny >>= (mpImpl->mxSourceStorage);
-+ }
- // <--
- // --> OD 2007-12-19 #152540#
- sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("TextDocInOOoFileFormat" ) );
-@@ -1823,6 +1837,11 @@ sal_Bool SvXMLImport::IsTextDocInOOoFileFormat() const
-
- // <--
-
-+uno::Reference<embed::XStorage> SvXMLImport::GetSourceStorage() const
-+{
-+ return mpImpl->mxSourceStorage;
-+}
-+
- void SvXMLImport::initXForms()
- {
- // dummy method; to be implemented by derived classes supporting XForms
-@@ -1908,3 +1927,35 @@ void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
- }
- }
-
-+void SvXMLImport::ImpLoadFragment(const uno::Reference< beans::XPropertySet >& xPropSet,
-+ const rtl::OUString& rAttrValue,
-+ const char* sPropName )
-+{
-+ if( !GetSourceStorage().is() )
-+ return; // TODO: set that in other apps, not only Impress
-+
-+ uno::Reference< embed::XStorage > xStorage(
-+ GetSourceStorage(),
-+ uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 nDummy=0;
-+ uno::Reference< embed::XStorage > xFragmentStorage(
-+ xStorage->openStorageElement( rAttrValue.getToken(0,'/',nDummy),
-+ ::embed::ElementModes::READ ),
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< io::XInputStream > xFragmentStream(
-+ xFragmentStorage->openStreamElement(
-+ rAttrValue.getToken(0,'/',nDummy),
-+ embed::ElementModes::READ ),
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(
-+ getServiceFactory()->createInstance(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder") )),
-+ uno::UNO_QUERY_THROW );
-+
-+ // create DOM from fragment, set at shape
-+ xPropSet->setPropertyValue( OUString::createFromAscii(sPropName),
-+ uno::makeAny(xDomBuilder->parse(xFragmentStream)) );
-+}
-diff --git xmloff/source/core/xmltoken.cxx xmloff/source/core/xmltoken.cxx
-index 5e5f1ef..8d2c8d6 100644
---- xmloff/source/core/xmltoken.cxx
-+++ xmloff/source/core/xmltoken.cxx
-@@ -3091,6 +3091,14 @@ namespace xmloff { namespace token {
- TOKEN( "at-axis", XML_AT_AXIS ),
- TOKEN( "at-labels-and-axis", XML_AT_LABELS_AND_AXIS ),
-
-+ TOKEN( "diagram-data-url", XML_DIAGRAM_DATA_URL ),
-+ TOKEN( "diagram-layout-url", XML_DIAGRAM_LAYOUT_URL ),
-+ TOKEN( "diagram-qstyle-url", XML_DIAGRAM_QSTYLE_URL ),
-+ TOKEN( "diagram-colorstyle-url",XML_DIAGRAM_COLORSTYLE_URL ),
-+ TOKEN( "theme-url", XML_THEME_URL ),
-+ TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:diagram:1.0", XML_N_INTEROP ),
-+ TOKEN( "interop", XML_NP_INTEROP ),
-+
- #if OSL_DEBUG_LEVEL > 0
- { 0, NULL, NULL, XML_TOKEN_END }
- #else
-diff --git xmloff/source/draw/sdxmlexp.cxx xmloff/source/draw/sdxmlexp.cxx
-index fce9ef0..49c1510 100644
---- xmloff/source/draw/sdxmlexp.cxx
-+++ xmloff/source/draw/sdxmlexp.cxx
-@@ -66,6 +66,7 @@
- #include <xmloff/xmlaustp.hxx>
- #include <xmloff/families.hxx>
- #include <xmloff/styleexp.hxx>
-+#include <xmloff/shapeexport.hxx>
- #include "sdpropls.hxx"
- #include <xmloff/xmlexppr.hxx>
- #include <com/sun/star/beans/XPropertyState.hpp>
-@@ -2521,6 +2522,20 @@ void SdXMLExport::_ExportMasterStyles()
- AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
- maMasterPagesStyleNames[nMPageId]);
-
-+ // interop:theme-url (maste page theme ooxml fragment)
-+ Reference< beans::XPropertySet > xPropSet( xMasterPage, UNO_QUERY );
-+ if( !xPropSet.is() )
-+ return;
-+ Reference<xml::dom::XDocument> xThemeFragment;
-+ xPropSet->getPropertyValue(
-+ OUString(RTL_CONSTASCII_USTRINGPARAM("PPTTheme"))) >>= xThemeFragment;
-+ AddAttribute(
-+ XML_NAMESPACE_INTEROP, XML_THEME_URL,
-+ ImpExportFragment(
-+ xThemeFragment,
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "theme" ) )));
-+
- // write masterpage
- SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, sal_True, sal_True);
-
-diff --git xmloff/source/draw/sdxmlimp.cxx xmloff/source/draw/sdxmlimp.cxx
-index 463c7d9..50b11cc 100644
---- xmloff/source/draw/sdxmlimp.cxx
-+++ xmloff/source/draw/sdxmlimp.cxx
-@@ -120,6 +120,7 @@ static __FAR_DATA SvXMLTokenMapEntry aMasterPageAttrTokenMap[] =
- { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_MASTERPAGE_USE_HEADER_NAME },
- { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_MASTERPAGE_USE_FOOTER_NAME },
- { XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME },
-+ { XML_NAMESPACE_INTEROP, XML_THEME_URL, XML_TOK_MASTERPAGE_THEME_URL },
- XML_TOKEN_MAP_END
- };
-
-@@ -467,6 +468,11 @@ SdXMLImport::SdXMLImport(
- GetXMLToken(XML_NP_ANIMATION),
- GetXMLToken(XML_N_ANIMATION),
- XML_NAMESPACE_ANIMATION);
-+
-+ GetNamespaceMap().Add(
-+ GetXMLToken(XML_NP_INTEROP),
-+ GetXMLToken(XML_N_INTEROP),
-+ XML_NAMESPACE_INTEROP);
- }
-
- // XImporter
-diff --git xmloff/source/draw/sdxmlimp_impl.hxx xmloff/source/draw/sdxmlimp_impl.hxx
-index 3cf1468..00b580a 100644
---- xmloff/source/draw/sdxmlimp_impl.hxx
-+++ xmloff/source/draw/sdxmlimp_impl.hxx
-@@ -94,7 +94,8 @@ enum SdXMLMasterPageAttrTokenMap
- XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME,
- XML_TOK_MASTERPAGE_USE_HEADER_NAME,
- XML_TOK_MASTERPAGE_USE_FOOTER_NAME,
-- XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
-+ XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME,
-+ XML_TOK_MASTERPAGE_THEME_URL
- };
-
- enum SdXMLPageMasterAttrTokenMap
-diff --git xmloff/source/draw/shapeexport.cxx xmloff/source/draw/shapeexport.cxx
-index 75298f8..b6ec8c7 100644
---- xmloff/source/draw/shapeexport.cxx
-+++ xmloff/source/draw/shapeexport.cxx
-@@ -237,7 +237,8 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap
- aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject &&
- aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape &&
- aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
-- aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
-+ aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape &&
-+ aShapeInfo.meShapeType != XmlShapeTypeDrawDiagramShape;
-
- const bool bObjSupportsStyle =
- aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
-@@ -763,6 +764,12 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
- break;
- }
-
-+ case XmlShapeTypeDrawDiagramShape:
-+ {
-+ ImpExportDiagramShape( xShape, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint );
-+ break;
-+ }
-+
- case XmlShapeTypeDrawPageShape:
- case XmlShapeTypePresPageShape:
- case XmlShapeTypeHandoutShape:
-@@ -1060,6 +1067,7 @@ void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& x
- else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; }
- else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; }
- else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; }
-+ else if(aType.EqualsAscii("DiagramShape", 21, 12)) { eShapeType = XmlShapeTypeDrawDiagramShape; }
-
- // 3D shapes
- else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
-diff --git xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport2.cxx
-index 8a446a8..b095661 100644
---- xmloff/source/draw/shapeexport2.cxx
-+++ xmloff/source/draw/shapeexport2.cxx
-@@ -42,8 +42,11 @@
- #include <com/sun/star/document/XEventsSupplier.hpp>
- #include <com/sun/star/drawing/HomogenMatrix3.hpp>
- #include <com/sun/star/media/ZoomLevel.hpp>
-+#include <com/sun/star/xml/dom/XDocument.hpp>
- #include "anim.hxx"
-
-+#include <comphelper/processfactory.hxx>
-+
- #ifndef _XMLOFF_SHAPEEXPORT_HXX
- #include <xmloff/shapeexport.hxx>
- #endif
-@@ -623,6 +626,59 @@ void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape
-
- //////////////////////////////////////////////////////////////////////////////
-
-+void XMLShapeExport::ImpExportDiagramShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eType, sal_Int32 nFeatures, awt::Point* pRefPoint)
-+{
-+ uno::Reference< beans::XPropertySet > xSet( xShape,
-+ uno::UNO_QUERY );
-+ if( !xSet.is() )
-+ return;
-+
-+ uno::Reference<xml::dom::XDocument> xDoc;
-+ xSet->getPropertyValue(
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DiagramData" ) ) ) >>= xDoc;
-+ mrExport.AddAttribute(
-+ XML_NAMESPACE_INTEROP, XML_DIAGRAM_DATA_URL,
-+ mrExport.ImpExportFragment(
-+ xDoc,
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "data" ) )));
-+
-+ xSet->getPropertyValue(
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DiagramLayout" ) ) ) >>= xDoc;
-+ mrExport.AddAttribute(
-+ XML_NAMESPACE_INTEROP, XML_DIAGRAM_LAYOUT_URL,
-+ mrExport.ImpExportFragment(
-+ xDoc,
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "layout" ) )));
-+
-+ xSet->getPropertyValue(
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DiagramQStyle" ) ) ) >>= xDoc;
-+ mrExport.AddAttribute(
-+ XML_NAMESPACE_INTEROP, XML_DIAGRAM_QSTYLE_URL,
-+ mrExport.ImpExportFragment(
-+ xDoc,
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "qstyle" ) )));
-+
-+ xSet->getPropertyValue(
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DiagramColorStyle" ) ) ) >>= xDoc;
-+ mrExport.AddAttribute(
-+ XML_NAMESPACE_INTEROP, XML_DIAGRAM_COLORSTYLE_URL,
-+ mrExport.ImpExportFragment(
-+ xDoc,
-+ OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "colorstyle" ) )));
-+
-+ ImpExportGroupShape( xShape, eType, nFeatures, pRefPoint );
-+}
-+
-+//////////////////////////////////////////////////////////////////////////////
-+
- void XMLShapeExport::ImpExportTextBoxShape(
- const uno::Reference< drawing::XShape >& xShape,
- XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
-diff --git xmloff/source/draw/shapeexport4.cxx xmloff/source/draw/shapeexport4.cxx
-index d3025e0..1980af3 100644
---- xmloff/source/draw/shapeexport4.cxx
-+++ xmloff/source/draw/shapeexport4.cxx
-@@ -1132,20 +1132,23 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape
-
- const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
-
-- while( pEntry->msApiName ) try
-+ while( pEntry->msApiName )
- {
-- sal_Bool bBool = sal_False;
-- const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
--
-- xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
-- if( bBool )
-- mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
-+ try
-+ {
-+ sal_Bool bBool = sal_False;
-+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
-+
-+ xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
-+ if( bBool )
-+ mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!");
-+ }
- pEntry++;
- }
-- catch( uno::Exception& )
-- {
-- DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!");
-- }
- }
- }
- uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
-diff --git xmloff/source/draw/ximpgrp.cxx xmloff/source/draw/ximpgrp.cxx
-index 89e2a4e..f6c1b43 100644
---- xmloff/source/draw/ximpgrp.cxx
-+++ xmloff/source/draw/ximpgrp.cxx
-@@ -102,11 +102,46 @@ SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( USHORT nPrefix,
-
- //////////////////////////////////////////////////////////////////////////////
-
--void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
-+void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrs)
- {
-+ // HACK: when interop:diagram-data-url attribute is there, create
-+ // a diagram shape instead
-+ if( xAttrs->getValueByName(OUString::createFromAscii("interop:diagram-data-url")).getLength() )
-+ {
-+ AddShape( "com.sun.star.drawing.DiagramShape" );
-+
-+ uno::Reference< beans::XPropertySet > xPropSet(mxShape,
-+ uno::UNO_QUERY);
-+ if(xPropSet.is())
-+ {
-+ GetImport().ImpLoadFragment(
-+ xPropSet,
-+ xAttrs->getValueByName(
-+ OUString::createFromAscii("interop:diagram-data-url")),
-+ "DiagramData");
-+ GetImport().ImpLoadFragment(
-+ xPropSet,
-+ xAttrs->getValueByName(
-+ OUString::createFromAscii("interop:diagram-layout-url")),
-+ "DiagramLayout");
-+ GetImport().ImpLoadFragment(
-+ xPropSet,
-+ xAttrs->getValueByName(
-+ OUString::createFromAscii("interop:diagram-qstyle-url")),
-+ "DiagramQStyle");
-+ GetImport().ImpLoadFragment(
-+ xPropSet,
-+ xAttrs->getValueByName(
-+ OUString::createFromAscii("interop:diagram-colorstyle-url")),
-+ "DiagramColorStyle");
-+ }
-+ }
-+ else
-+ AddShape( "com.sun.star.drawing.GroupShape" );
-+
- // create new group shape and add it to rShapes, use it
- // as base for the new group import
-- AddShape( "com.sun.star.drawing.GroupShape" );
-+ // AddShape( "com.sun.star.drawing.GroupShape" );
-
- if(mxShape.is())
- {
-diff --git xmloff/source/draw/ximpshap.cxx xmloff/source/draw/ximpshap.cxx
-index 770366b..827f8d1 100644
---- xmloff/source/draw/ximpshap.cxx
-+++ xmloff/source/draw/ximpshap.cxx
-@@ -3597,16 +3597,20 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc
-
- const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
- int i = 0;
-- while( pEntry->msApiName && (i < 6) ) try
-+ while( pEntry->msApiName && (i < 6) )
- {
-- const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
-- xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i++] ) );
-+ try
-+ {
-+ const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
-+ xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
-+ }
-+ catch( Exception& )
-+ {
-+ DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
-+ }
- pEntry++;
-+ i++;
- }
-- catch( Exception& )
-- {
-- DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
-- }
- }
-
- GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
-diff --git xmloff/source/draw/ximpstyl.cxx xmloff/source/draw/ximpstyl.cxx
-index a96b5bf..eb1226e 100644
---- xmloff/source/draw/ximpstyl.cxx
-+++ xmloff/source/draw/ximpstyl.cxx
-@@ -870,6 +870,13 @@ SdXMLMasterPageContext::SdXMLMasterPageContext(
- maUseDateTimeDeclName = sValue;
- break;
- }
-+ case XML_TOK_MASTERPAGE_THEME_URL:
-+ {
-+ Reference <beans::XPropertySet> xSet(rShapes,
-+ uno::UNO_QUERY_THROW );
-+ GetImport().ImpLoadFragment(xSet, sValue, "PPTTheme" );
-+ break;
-+ }
- }
- }
-
diff --git a/patches/test/sal-constfoo.diff b/patches/test/sal-constfoo.diff
deleted file mode 100644
index d0638e416..000000000
--- a/patches/test/sal-constfoo.diff
+++ /dev/null
@@ -1,461 +0,0 @@
-Index: rdbmaker/inc/codemaker/global.hxx
-===================================================================
-RCS file: /cvs/udk/rdbmaker/inc/codemaker/global.hxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 global.hxx
---- rdbmaker/inc/codemaker/global.hxx 19 Jul 2006 16:24:51 -0000 1.6
-+++ rdbmaker/inc/codemaker/global.hxx 26 Jan 2007 15:20:30 -0000
-@@ -94,10 +94,6 @@ sal_Bool fileExists(const ::rtl::OString
- sal_Bool checkFileContent(const ::rtl::OString& targetFileName, const ::rtl::OString& tmpFileName);
-
- const ::rtl::OString inGlobalSet(const ::rtl::OUString & r);
--inline const ::rtl::OString inGlobalSet(sal_Char* p)
--{
-- return inGlobalSet( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(p) ) );
--}
-
- ::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
-
-Index: configmgr/source/backend/multistratumbackend.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/backend/multistratumbackend.cxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 multistratumbackend.cxx
---- configmgr/source/backend/multistratumbackend.cxx 16 Sep 2006 15:06:31 -0000 1.11
-+++ configmgr/source/backend/multistratumbackend.cxx 26 Jan 2007 16:43:38 -0000
-@@ -359,8 +359,7 @@ void MultiStratumBackend::initializeBack
- {
- if(!bOptional)
- {
-- static const sal_Char sErrContext[] = "MultiStratumBackend: Could not create Backend Stratum Service: ";
-- OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
-+ OUString const sContext(RTL_CONSTASCII_USTRINGPARAM("MultiStratumBackend: Could not create Backend Stratum Service: "));
- OUString const sMessage = sContext.concat(exception.Message);
-
- backenduno::StratumCreationException error(sMessage,*this,
-@@ -817,10 +816,8 @@ void SAL_CALL MultiStratumBackend::dispo
- }
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.Backend" ;
--
--static const sal_Char * const kImplementation =
-- "com.sun.star.comp.configuration.backend.MultiStratumBackend" ;
-+#define kBackendService "com.sun.star.configuration.backend.Backend"
-+#define kImplementation "com.sun.star.comp.configuration.backend.MultiStratumBackend"
-
- static const AsciiServiceName kServiceNames [] =
- {
-Index: configmgr/source/backend/singlebackendadapter.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/backend/singlebackendadapter.cxx,v
-retrieving revision 1.12
-diff -u -p -u -r1.12 singlebackendadapter.cxx
---- configmgr/source/backend/singlebackendadapter.cxx 16 Sep 2006 15:06:59 -0000 1.12
-+++ configmgr/source/backend/singlebackendadapter.cxx 26 Jan 2007 16:43:38 -0000
-@@ -295,12 +295,10 @@ uno::Reference<backenduno::XUpdateHandle
- }
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.Backend" ;
--static const sal_Char * const kAdapterService = "com.sun.star.configuration.backend.BackendAdapter" ;
--static const sal_Char * const kOnlineService = "com.sun.star.configuration.backend.OnlineBackend" ;
--
--static const sal_Char * const kImplementation =
-- "com.sun.star.comp.configuration.backend.SingleBackendAdapter" ;
-+#define kBackendService "com.sun.star.configuration.backend.Backend"
-+#define kAdapterService "com.sun.star.configuration.backend.BackendAdapter"
-+#define kOnlineService "com.sun.star.configuration.backend.OnlineBackend"
-+#define kImplementation "com.sun.star.comp.configuration.backend.SingleBackendAdapter"
-
- static const AsciiServiceName kServiceNames [] =
- {
-Index: configmgr/source/inc/strings.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/inc/strings.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 strings.hxx
---- configmgr/source/inc/strings.hxx 8 Sep 2005 03:57:34 -0000 1.5
-+++ configmgr/source/inc/strings.hxx 26 Jan 2007 16:43:38 -0000
-@@ -63,7 +63,6 @@ struct UStringDescription
- , m_aString (_pName, _nLen, _encoding)
- {
- }
--
- sal_Int32 getLength() const { return m_nLen; }
- operator ::rtl::OUString const&() const { return m_aString; }
- operator const sal_Char*() const { return m_pZeroTerminatedName; }
-@@ -77,7 +76,8 @@ private:
- extern ::configmgr::UStringDescription name
-
- #define IMPLEMENT_CONSTASCII_USTRING(name, asciivalue) \
-- ::configmgr::UStringDescription name(RTL_CONSTASCII_USTRINGPARAM(asciivalue))
-+ ::configmgr::UStringDescription name( \
-+ asciivalue, ((sal_Int32)(sizeof(asciivalue)-1)), RTL_TEXTENCODING_ASCII_US )
-
- //.........................................................................
- } // namespace frm
-Index: configmgr/source/localbe/localmultistratum.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localmultistratum.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 localmultistratum.cxx
---- configmgr/source/localbe/localmultistratum.cxx 16 Sep 2006 15:12:17 -0000 1.8
-+++ configmgr/source/localbe/localmultistratum.cxx 26 Jan 2007 16:43:38 -0000
-@@ -247,12 +247,9 @@ void LocalMultiStratum::getLayerDirector
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kMultiStratumImplementation =
-- "com.sun.star.comp.configuration.backend.LocalMultiStratum" ;
--static const sal_Char * const kBackendService =
-- "com.sun.star.configuration.backend.MultiStratum" ;
--static const sal_Char * const kLocalService =
-- "com.sun.star.configuration.backend.LocalMultiStratum" ;
-+#define kLocalService "com.sun.star.configuration.backend.LocalMultiStratum"
-+#define kBackendService "com.sun.star.configuration.backend.MultiStratum"
-+#define kMultiStratumImplementation "com.sun.star.comp.configuration.backend.LocalMultiStratum"
-
- static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
- static const ServiceImplementationInfo kMultiStratumServiceInfo = { kMultiStratumImplementation , kServiceNames, kServiceNames + 2 } ;
-Index: configmgr/source/localbe/localschemasupplier.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localschemasupplier.cxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 localschemasupplier.cxx
---- configmgr/source/localbe/localschemasupplier.cxx 16 Sep 2006 15:12:46 -0000 1.5
-+++ configmgr/source/localbe/localschemasupplier.cxx 26 Jan 2007 16:43:38 -0000
-@@ -277,12 +277,9 @@ uno::Reference<backend::XSchema> SAL_CAL
-
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kImplementation =
-- "com.sun.star.comp.configuration.backend.LocalSchemaSupplier" ;
--static const sal_Char * const kSchemaService =
-- "com.sun.star.configuration.backend.SchemaSupplier" ;
--static const sal_Char * const kLocalService =
-- "com.sun.star.configuration.backend.LocalSchemaSupplier" ;
-+#define kImplementation "com.sun.star.comp.configuration.backend.LocalSchemaSupplier"
-+#define kSchemaService "com.sun.star.configuration.backend.SchemaSupplier"
-+#define kLocalService "com.sun.star.configuration.backend.LocalSchemaSupplier"
-
- static AsciiServiceName kServiceNames [] = {kLocalService, 0, kSchemaService, 0 } ;
- static const ServiceImplementationInfo kServiceInfo = { kImplementation, kServiceNames,kServiceNames+2 } ;
-Index: configmgr/source/localbe/localsinglebackend.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localsinglebackend.cxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 localsinglebackend.cxx
---- configmgr/source/localbe/localsinglebackend.cxx 16 Sep 2006 15:13:02 -0000 1.21
-+++ configmgr/source/localbe/localsinglebackend.cxx 26 Jan 2007 16:43:38 -0000
-@@ -789,12 +789,9 @@ uno::Reference<backend::XUpdatableLayer>
- }
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kImplementation =
-- "com.sun.star.comp.configuration.backend.LocalSingleBackend" ;
--static const sal_Char * const kBackendService =
-- "com.sun.star.configuration.backend.SingleBackend" ;
--static const sal_Char * const kLocalService =
-- "com.sun.star.configuration.backend.LocalSingleBackend" ;
-+#define kImplementation "com.sun.star.comp.configuration.backend.LocalSingleBackend"
-+#define kBackendService "com.sun.star.configuration.backend.SingleBackend"
-+#define kLocalService "com.sun.star.configuration.backend.LocalSingleBackend"
-
- static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
- static const ServiceImplementationInfo kServiceInfo = { kImplementation, kServiceNames, kServiceNames + 2 } ;
-Index: configmgr/source/localbe/localsinglestratum.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localsinglestratum.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 localsinglestratum.cxx
---- configmgr/source/localbe/localsinglestratum.cxx 16 Sep 2006 15:13:17 -0000 1.8
-+++ configmgr/source/localbe/localsinglestratum.cxx 26 Jan 2007 16:43:38 -0000
-@@ -178,18 +178,12 @@ void LocalResourceStratum::getLayerDirec
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
-
--static const sal_Char * const kLegacyStratumImplementation =
-- "com.sun.star.comp.configuration.backend.LocalSingleStratum" ;
--static const sal_Char * const kDataStratumImplementation =
-- "com.sun.star.comp.configuration.backend.LocalStratum" ;
--static const sal_Char * const kReadonlyStratumImplementation =
-- "com.sun.star.comp.configuration.backend.LocalReadonlyStratum" ;
--static const sal_Char * const kResourceStratumImplementation =
-- "com.sun.star.comp.configuration.backend.LocalResourceStratum" ;
--static const sal_Char * const kBackendService =
-- "com.sun.star.configuration.backend.SingleStratum" ;
--static const sal_Char * const kLocalService =
-- "com.sun.star.configuration.backend.LocalSingleStratum" ;
-+#define kLegacyStratumImplementation "com.sun.star.comp.configuration.backend.LocalSingleStratum"
-+#define kDataStratumImplementation "com.sun.star.comp.configuration.backend.LocalStratum"
-+#define kReadonlyStratumImplementation "com.sun.star.comp.configuration.backend.LocalReadonlyStratum"
-+#define kResourceStratumImplementation "com.sun.star.comp.configuration.backend.LocalResourceStratum"
-+#define kBackendService "com.sun.star.configuration.backend.SingleStratum"
-+#define kLocalService "com.sun.star.configuration.backend.LocalSingleStratum"
-
- static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
- static const ServiceImplementationInfo kLegacyStratumServiceInfo = { kLegacyStratumImplementation , kServiceNames, kServiceNames + 2 } ;
-Index: configmgr/source/localbe/localstratumbase.hxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/localbe/localstratumbase.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 localstratumbase.hxx
---- configmgr/source/localbe/localstratumbase.hxx 8 Sep 2005 04:07:34 -0000 1.3
-+++ configmgr/source/localbe/localstratumbase.hxx 26 Jan 2007 16:43:38 -0000
-@@ -89,7 +89,7 @@ typedef cppu::WeakComponentImplHelper3<l
-
- struct LocalStratumMutexHolder { osl::Mutex mMutex; };
- //------------------------------------------------------------------------------
--static const char kLocalDataSuffix[] = ".xcu";
-+#define kLocalDataSuffix ".xcu"
- //------------------------------------------------------------------------------
-
- /**
-Index: configmgr/source/misc/bootstrapcontext.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/bootstrapcontext.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 bootstrapcontext.cxx
---- configmgr/source/misc/bootstrapcontext.cxx 16 Sep 2006 15:14:28 -0000 1.6
-+++ configmgr/source/misc/bootstrapcontext.cxx 26 Jan 2007 16:43:38 -0000
-@@ -275,7 +275,7 @@ bool ComponentContext::lookupInBootstrap
- // ---------------------------------------------------------------------------
- // ---------------------------------------------------------------------------
-
--static const char k_TunneledContext[] = "/services/com.sun.star.configuration.bootstrap.Context";
-+#define k_TunneledContext "/services/com.sun.star.configuration.bootstrap.Context"
-
- class UnoContextTunnel::Tunnel
- : public ::cppu::WeakImplHelper2< uno::XCurrentContext, lang::XUnoTunnel >
-Index: configmgr/source/misc/configinteractionhandler.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/configinteractionhandler.cxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 configinteractionhandler.cxx
---- configmgr/source/misc/configinteractionhandler.cxx 16 Sep 2006 15:14:56 -0000 1.5
-+++ configmgr/source/misc/configinteractionhandler.cxx 26 Jan 2007 16:43:38 -0000
-@@ -55,7 +55,7 @@ namespace {
-
- namespace css = com::sun::star;
-
--static char const INTERACTION_HANDLER[] = "configuration.interaction-handler";
-+#define INTERACTION_HANDLER "configuration.interaction-handler"
-
- }
-
-Index: configmgr/source/misc/providerfactory.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/misc/providerfactory.cxx,v
-retrieving revision 1.23
-diff -u -p -u -r1.23 providerfactory.cxx
---- configmgr/source/misc/providerfactory.cxx 16 Sep 2006 15:16:55 -0000 1.23
-+++ configmgr/source/misc/providerfactory.cxx 26 Jan 2007 16:43:39 -0000
-@@ -102,9 +102,7 @@ namespace configmgr
- {
- using ::com::sun::star::configuration::CannotLoadConfigurationException;
-
-- static sal_Char const sCannotCreate[] = "Cannot create ConfigurationProvider. Unknown backend or factory error.";
--
-- throw CannotLoadConfigurationException( OUString(RTL_CONSTASCII_USTRINGPARAM(sCannotCreate)), *this );
-+ throw CannotLoadConfigurationException( OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot create ConfigurationProvider. Unknown backend or factory error.")), *this );
- }
-
- return xResult;
-@@ -132,8 +130,7 @@ namespace configmgr
-
- OSL_ASSERT(aContext.isBootstrapValid());
-
-- static const sal_Char sErrContext[] = "Cannot open Configuration: ";
-- OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
-+ OUString const sContext(RTL_CONSTASCII_USTRINGPARAM("Cannot open Configuration: "));
- e.Message = sContext.concat(e.Message);
- throw;
- }
-Index: configmgr/source/treemgr/configexcept.cxx
-===================================================================
-RCS file: /cvs/util/configmgr/source/treemgr/configexcept.cxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 configexcept.cxx
---- configmgr/source/treemgr/configexcept.cxx 16 Sep 2006 15:27:40 -0000 1.5
-+++ configmgr/source/treemgr/configexcept.cxx 26 Jan 2007 16:43:39 -0000
-@@ -73,8 +73,8 @@ namespace configmgr
- }
- //---------------------------------------------------------------------
-
-- static const char c_sInvalidNamePre[] = "CONFIGURATION: Invalid Path or Name: ";
-- static const char c_sInvalidName[] = "CONFIGURATION: <Invalid Path or Name>";
-+#define c_sInvalidNamePre "CONFIGURATION: Invalid Path or Name: "
-+#define c_sInvalidName "CONFIGURATION: <Invalid Path or Name>"
- //-----------------------------------------------------------------------------
-
- InvalidName::InvalidName(OUString const& sName)
-@@ -112,7 +112,8 @@ namespace configmgr
-
- //-----------------------------------------------------------------------------
-
-- static const char c_sTypeMismatch[] = "CONFIGURATION: Data Types do not match: ";
-+#define c_sTypeMismatch "CONFIGURATION: Data Types do not match: "
-+
- //---------------------------------------------------------------------
- OUString TypeMismatch::describe(OUString const& sFoundType, OUString const& sExpectedType)
- {
-? eventattacher/unxlngx6.pro
-Index: eventattacher/source/eventattacher.cxx
-===================================================================
-RCS file: /cvs/util/eventattacher/source/eventattacher.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 eventattacher.cxx
---- eventattacher/source/eventattacher.cxx 20 Jun 2006 00:15:13 -0000 1.6
-+++ eventattacher/source/eventattacher.cxx 26 Jan 2007 16:59:16 -0000
-@@ -925,7 +925,7 @@ void * SAL_CALL component_getFactory(
- {
- Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM( pImplName ) ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ),
- ::comp_EventAttacher::EventAttacherImpl_CreateInstance,
- ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ) );
-
-Index: tools/source/fsys/urlobj.cxx
-===================================================================
-RCS file: /cvs/util/tools/source/fsys/urlobj.cxx,v
-retrieving revision 1.59
-diff -u -p -u -r1.59 urlobj.cxx
---- tools/source/fsys/urlobj.cxx 17 Sep 2006 00:54:24 -0000 1.59
-+++ tools/source/fsys/urlobj.cxx 26 Jan 2007 17:07:36 -0000
-@@ -4777,8 +4777,7 @@ bool INetURLObject::setFSysPath(rtl::OUS
- }
-
- rtl::OUStringBuffer aSynAbsURIRef(
-- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://"),
-- RTL_TEXTENCODING_ASCII_US));
-+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://")));
- switch (eStyle)
- {
- case FSYS_VOS:
-Index: tools/inc/string.hxx
-===================================================================
-RCS file: /cvs/util/tools/inc/string.hxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 string.hxx
---- tools/inc/string.hxx 19 Jun 2006 13:30:16 -0000 1.11
-+++ tools/inc/string.hxx 26 Jan 2007 17:43:39 -0000
-@@ -489,6 +489,7 @@ public:
- UniString( const ResId& rResId );
- UniString( const UniString& rStr );
- UniString( const UniString& rStr, xub_StrLen nPos, xub_StrLen nLen );
-+ UniString( rtl_uString * str, __sal_NoAcquire );
- UniString( const rtl::OUString& rStr );
- UniString( const sal_Unicode* pCharStr );
- UniString( const sal_Unicode* pCharStr, xub_StrLen nLen );
-Index: tools/source/string/strucvt.cxx
-===================================================================
-RCS file: /cvs/util/tools/source/string/strucvt.cxx,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 strucvt.cxx
---- tools/source/string/strucvt.cxx 17 Sep 2006 01:03:58 -0000 1.10
-+++ tools/source/string/strucvt.cxx 26 Jan 2007 17:43:58 -0000
-@@ -143,6 +143,25 @@ UniString::UniString( const rtl::OUStrin
- }
- }
-
-+UniString::UniString( rtl_uString * pData, __sal_NoAcquire )
-+ : mpData(NULL)
-+{
-+ DBG_CTOR( UniString, DbgCheckUniString );
-+
-+ OSL_ENSURE(rStr.pData->length < STRING_MAXLEN,
-+ "Overflowing rtl::OUString -> UniString cut to zero length");
-+
-+ if (pData->length < STRING_MAXLEN)
-+ {
-+ mpData = reinterpret_cast< UniStringData * >(pData);
-+ STRING_ACQUIRE((STRING_TYPE *)mpData);
-+ }
-+ else
-+ {
-+ STRING_NEW((STRING_TYPE **)&mpData);
-+ }
-+}
-+
- // -----------------------------------------------------------------------
-
- UniString& UniString::Assign( const rtl::OUString& rStr )
-Index: svtools/source/config/colorcfg.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/config/colorcfg.cxx,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 colorcfg.cxx
---- svtools/source/config/colorcfg.cxx 12 Oct 2006 15:07:43 -0000 1.14
-+++ svtools/source/config/colorcfg.cxx 26 Jan 2007 18:50:24 -0000
-@@ -178,9 +178,14 @@ uno::Sequence< OUString> ColorConfig_Imp
- OUString* pNames = aNames.getArray();
- struct ColorConfigEntryData_Impl
- {
-+#ifdef RTL_INLINE_STRINGS
-+ rtl_uString * pString;
-+ __sal_NoAcquire eDummy;
-+#else
- const sal_Char* cName;
- sal_Int32 nLength;
- rtl_TextEncoding eEncoding;
-+#endif
- sal_Bool bCanBeVisible;
- };
- static const ColorConfigEntryData_Impl cNames[] =
-@@ -235,7 +240,11 @@ uno::Sequence< OUString> ColorConfig_Imp
- {
- rtl::OUString sBaseName(sBase);
- sal_Int32 nPos = i / 4;
-+#ifdef RTL_INLINE_STRINGS
-+ sBaseName += OUString(cNames[nPos].pString);
-+#else
- sBaseName += OUString(cNames[nPos].cName, cNames[nPos].nLength, cNames[nPos].eEncoding);
-+#endif
- pNames[nIndex] += sBaseName;
- pNames[nIndex++] += sColor;
- if(cNames[nPos].bCanBeVisible)
-Index: svtools/source/uno/unoevent.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/uno/unoevent.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 unoevent.cxx
---- svtools/source/uno/unoevent.cxx 17 Sep 2006 15:30:27 -0000 1.9
-+++ svtools/source/uno/unoevent.cxx 26 Jan 2007 18:59:33 -0000
-@@ -77,8 +77,8 @@ using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
-
-
--const sal_Char sAPI_ServiceName[] = "com.sun.star.container.XNameReplace";
--const sal_Char sAPI_SvDetachedEventDescriptor[] = "SvDetachedEventDescriptor";
-+#define sAPI_ServiceName "com.sun.star.container.XNameReplace"
-+#define sAPI_SvDetachedEventDescriptor "SvDetachedEventDescriptor"
-
- //
- // SvBaseEventDescriptor
-Index: xmloff/source/core/DomBuilderContext.cxx
-===================================================================
-RCS file: /cvs/xml/xmloff/source/core/DomBuilderContext.cxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 DomBuilderContext.cxx
---- xmloff/source/core/DomBuilderContext.cxx 17 Sep 2006 10:18:13 -0000 1.4
-+++ xmloff/source/core/DomBuilderContext.cxx 26 Jan 2007 19:17:13 -0000
-@@ -206,8 +206,6 @@ void DomBuilderContext::Characters( cons
- // helper function implementations
- //
-
--const sal_Char sDocumentBuilder[] = "com.sun.star.xml.dom.DocumentBuilder";
--
- Reference<XNode> lcl_createDomInstance()
- {
- Reference<XMultiServiceFactory> xFactory = utl::getProcessServiceFactory();
-@@ -215,7 +213,7 @@ Reference<XNode> lcl_createDomInstance()
-
- Reference<XDocumentBuilder> xBuilder(
- xFactory->createInstance(
-- OUString( RTL_CONSTASCII_USTRINGPARAM( sDocumentBuilder ) ) ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.dom.DocumentBuilder" ) ) ),
- UNO_QUERY_THROW );
-
- return Reference<XNode>( xBuilder->newDocument(), UNO_QUERY_THROW );
diff --git a/patches/test/sal-instrument.diff b/patches/test/sal-instrument.diff
deleted file mode 100644
index c5b1a1fa8..000000000
--- a/patches/test/sal-instrument.diff
+++ /dev/null
@@ -1,38 +0,0 @@
-Index: sal/osl/unx/module.c
-===================================================================
-RCS file: /cvs/porting/sal/osl/unx/module.c,v
-retrieving revision 1.31
-diff -u -r1.31 module.c
---- sal/osl/unx/module.c 8 Sep 2005 14:57:52 -0000 1.31
-+++ sal/osl/unx/module.c 31 Oct 2005 21:18:46 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -133,6 +133,11 @@
- if (pszModuleName)
- {
- #ifndef NO_DL_FUNCTIONS
-+ static sal_Int64 cuml_usecs = 0;
-+ struct timeval start, end;
-+ gettimeofday (&start, NULL);
-+ if (getenv("SAL_LOCAL") && (rtld_mode & RTLD_GLOBAL))
-+ rtld_mode ^= RTLD_GLOBAL;
- void* pLib = dlopen(pszModuleName, rtld_mode);
- if ((pLib == 0) && (strchr (pszModuleName, '/') == 0))
- {
-@@ -144,7 +144,12 @@
-
- pLib = dlopen(buffer, rtld_mode);
- }
--
-+ gettimeofday (&end, NULL);
-+ cuml_usecs += 1000000 * (end.tv_sec - start.tv_sec);
-+ cuml_usecs += end.tv_usec - start.tv_usec;
-+ fprintf (stderr, "Load '%s' (0x%x) cuml time %d.%0.6d\n",
-+ pszModuleName, rtld_mode, (int) (cuml_usecs / 1000000),
-+ (int)(cuml_usecs % 1000000));
- #if OSL_DEBUG_LEVEL > 1
- if (pLib == 0)
- {
diff --git a/patches/test/sal-relaxed-maxpath.diff b/patches/test/sal-relaxed-maxpath.diff
deleted file mode 100644
index 0ff104a5f..000000000
--- a/patches/test/sal-relaxed-maxpath.diff
+++ /dev/null
@@ -1,165 +0,0 @@
---- sal/osl/os2/file.cxx 2 Nov 2007 12:30:51 -0000 1.4
-+++ sal/osl/os2/file.cxx 6 Mar 2008 14:53:47 -0000
-@@ -582,7 +582,7 @@ oslFileError SAL_CALL osl_getDirectoryIt
- if (osl_File_E_None != error)
- return error;
-
-- dwPathType = IsValidFilePath( strSysFilePath->buffer, NULL, VALIDATEPATH_NORMAL );
-+ dwPathType = IsValidFilePath( strSysFilePath->buffer, VALIDATEPATH_NORMAL );
-
- if ( dwPathType & PATHTYPE_IS_VOLUME )
- type = PATHTYPE_VOLUME;
---- sal/osl/os2/file_url.cxx 25 Sep 2007 09:48:07 -0000 1.3
-+++ sal/osl/os2/file_url.cxx 6 Mar 2008 14:53:48 -0000
-@@ -369,7 +369,7 @@ BOOL WINAPI IsValidFilePathComponent(
- }
-
- //#####################################################
--DWORD WINAPI IsValidFilePath(LPCTSTR lpszPath, LPCTSTR *lppError, DWORD dwFlags)
-+DWORD WINAPI IsValidFilePath(LPCTSTR lpszPath, DWORD dwFlags)
- {
- LPCTSTR lpComponent;
- BOOL fValid = TRUE;
-@@ -490,19 +490,10 @@ DWORD WINAPI IsValidFilePath(LPCTSTR lps
- /* If the string behind the backslash is empty, we've done */
-
- if ( !*lpComponent )
-- lpComponent = NULL;
-+ break;
- }
- }
-
-- if ( fValid && _tcslen( lpszPath ) >= _MAX_PATH )
-- {
-- fValid = FALSE;
-- lpComponent = lpszPath + _MAX_PATH;
-- }
--
-- if ( lppError )
-- *lppError = lpComponent;
--
- return fValid ? dwPathType : PATHTYPE_ERROR;
- }
-
-@@ -646,7 +637,7 @@ oslFileError SAL_CALL _osl_getFileURLFro
- DWORD dwPathType = PATHTYPE_ERROR;
-
- if (strPath)
-- dwPathType = IsValidFilePath(strPath->buffer, NULL, VALIDATEPATH_ALLOW_RELATIVE);
-+ dwPathType = IsValidFilePath(strPath->buffer, VALIDATEPATH_ALLOW_RELATIVE);
-
- if (dwPathType)
- {
-@@ -887,14 +878,14 @@ oslFileError SAL_CALL _osl_getSystemPath
- else
- rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
-
-- if ( IsValidFilePath( strTempPath->buffer, NULL, VALIDATEPATH_ALLOW_ELLIPSE ) )
-+ if ( IsValidFilePath( strTempPath->buffer, VALIDATEPATH_ALLOW_ELLIPSE ) )
- nError = osl_File_E_None;
- }
- else if ( bAllowRelative ) /* This maybe a relative file URL */
- {
- rtl_uString_assign( &strTempPath, strDecodedURL );
-
-- if ( IsValidFilePath( strTempPath->buffer, NULL, VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE ) )
-+ if ( IsValidFilePath( strTempPath->buffer, VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE ) )
- nError = osl_File_E_None;
- }
- /*
---- sal/osl/os2/file_url.h 25 Sep 2007 09:51:30 -0000 1.3
-+++ sal/osl/os2/file_url.h 6 Mar 2008 14:53:48 -0000
-@@ -136,7 +136,7 @@ typedef enum _PATHTYPE
- PATHTYPE_FILE
- } PATHTYPE;
-
--DWORD WINAPI IsValidFilePath(LPCTSTR, LPCTSTR*, DWORD);
-+DWORD WINAPI IsValidFilePath(LPCTSTR, DWORD);
-
- typedef struct
- {
---- sal/osl/w32/file.cxx 24 Jan 2008 14:27:40 -0000 1.14.96.1
-+++ sal/osl/w32/file.cxx 6 Mar 2008 14:53:54 -0000
-@@ -232,7 +232,7 @@ namespace /* private */
- // forward
- void _osl_warnFile(const char*, rtl_uString*);
- oslFileError SAL_CALL _osl_getFileURLFromSystemPath(rtl_uString* , rtl_uString**);
-- DWORD WINAPI IsValidFilePath(LPCTSTR, LPCTSTR*, DWORD);
-+ DWORD WINAPI IsValidFilePath(LPCTSTR, DWORD);
- HANDLE WINAPI OpenLogicalDrivesEnum(void);
- BOOL WINAPI EnumLogicalDrives(HANDLE, LPTSTR);
- BOOL WINAPI CloseLogicalDrivesEnum(HANDLE);
-@@ -1262,7 +1262,7 @@ namespace /* private */
- }
-
- //#####################################################
-- DWORD WINAPI IsValidFilePath(LPCTSTR lpszPath, LPCTSTR *lppError, DWORD dwFlags)
-+ DWORD WINAPI IsValidFilePath(LPCTSTR lpszPath, DWORD dwFlags)
- {
- LPCTSTR lpComponent;
- BOOL fValid = TRUE;
-@@ -1383,19 +1383,10 @@ namespace /* private */
- /* If the string behind the backslash is empty, we've done */
-
- if ( !*lpComponent )
-- lpComponent = NULL;
-+ break;
- }
- }
-
-- if ( fValid && _tcslen( lpszPath ) >= MAX_PATH )
-- {
-- fValid = FALSE;
-- lpComponent = lpszPath + MAX_PATH;
-- }
--
-- if ( lppError )
-- *lppError = lpComponent;
--
- return fValid ? dwPathType : PATHTYPE_ERROR;
- }
-
-@@ -2178,14 +2169,14 @@ namespace /* private */
- else
- rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
-
-- if ( IsValidFilePath( reinterpret_cast<LPCTSTR>(strTempPath->buffer), NULL, VALIDATEPATH_ALLOW_ELLIPSE ) )
-+ if ( IsValidFilePath( reinterpret_cast<LPCTSTR>(strTempPath->buffer), VALIDATEPATH_ALLOW_ELLIPSE ) )
- nError = osl_File_E_None;
- }
- else if ( bAllowRelative ) /* This maybe a relative file URL */
- {
- rtl_uString_assign( &strTempPath, strDecodedURL );
-
-- if ( IsValidFilePath( reinterpret_cast<LPCTSTR>(strTempPath->buffer), NULL, VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE ) )
-+ if ( IsValidFilePath( reinterpret_cast<LPCTSTR>(strTempPath->buffer), VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE ) )
- nError = osl_File_E_None;
- }
- /*
-@@ -2219,7 +2210,7 @@ namespace /* private */
- DWORD dwPathType = PATHTYPE_ERROR;
-
- if (strPath)
-- dwPathType = IsValidFilePath(reinterpret_cast<LPCTSTR>(strPath->buffer), NULL, VALIDATEPATH_ALLOW_RELATIVE);
-+ dwPathType = IsValidFilePath(reinterpret_cast<LPCTSTR>(strPath->buffer), VALIDATEPATH_ALLOW_RELATIVE);
-
- if (dwPathType)
- {
-@@ -3083,7 +3074,7 @@ oslFileError SAL_CALL osl_openDirectory(
- }
- */
-
-- dwPathType = IsValidFilePath( reinterpret_cast<LPCTSTR>(strSysDirectoryPath->buffer), NULL, VALIDATEPATH_NORMAL );
-+ dwPathType = IsValidFilePath( reinterpret_cast<LPCTSTR>(strSysDirectoryPath->buffer), VALIDATEPATH_NORMAL );
-
- if ( dwPathType & PATHTYPE_IS_SERVER )
- {
-@@ -3187,7 +3178,7 @@ oslFileError SAL_CALL osl_getDirectoryIt
- }
- */
-
-- dwPathType = IsValidFilePath( reinterpret_cast<LPCTSTR>(strSysFilePath->buffer), NULL, VALIDATEPATH_NORMAL );
-+ dwPathType = IsValidFilePath( reinterpret_cast<LPCTSTR>(strSysFilePath->buffer), VALIDATEPATH_NORMAL );
-
- if ( dwPathType & PATHTYPE_IS_VOLUME )
- type = PATHTYPE_VOLUME;
diff --git a/patches/test/sal-string-instrument.diff b/patches/test/sal-string-instrument.diff
deleted file mode 100644
index e36b237ce..000000000
--- a/patches/test/sal-string-instrument.diff
+++ /dev/null
@@ -1,327 +0,0 @@
-Index: sal/rtl/source/makefile.mk
-===================================================================
-RCS file: /cvs/porting/sal/rtl/source/makefile.mk,v
-retrieving revision 1.25
-diff -u -p -u -r1.25 makefile.mk
---- sal/rtl/source/makefile.mk 20 Jun 2006 04:30:12 -0000 1.25
-+++ sal/rtl/source/makefile.mk 23 Aug 2006 10:24:47 -0000
-@@ -48,6 +48,8 @@ PROJECTPCHSOURCE=cont_pch
-
- .INCLUDE : settings.mk
-
-+CFLAGS+=`pkg-config --cflags glib-2.0`
-+
- .IF "$(ALLOC)" == "SYS_ALLOC" || "$(ALLOC)" == "TCMALLOC"
- CDEFS+= -DFORCE_SYSALLOC
- .ENDIF
-Index: sal/rtl/source/string.c
-===================================================================
-RCS file: /cvs/porting/sal/rtl/source/string.c,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 string.c
---- sal/rtl/source/string.c 4 May 2006 15:14:41 -0000 1.14
-+++ sal/rtl/source/string.c 23 Aug 2006 10:24:47 -0000
-@@ -254,6 +254,7 @@ sal_Bool SAL_CALL rtl_impl_convertUStrin
- nLength--;
- }
- while ( nLength );
-+ IMPL_ACCOUNT_STRING_NEW( *pTarget );
- return sal_True;
- }
-
-@@ -330,6 +331,9 @@ sal_Bool SAL_CALL rtl_impl_convertUStrin
- if ( pTemp && !nDestBytes )
- rtl_string_new( pTarget );
- }
-+
-+ IMPL_ACCOUNT_STRING_NEW( *pTarget );
-+
- return sal_True;
- }
-
-@@ -352,3 +356,4 @@ sal_Bool SAL_CALL rtl_convertUStringToSt
- return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
- nFlags, sal_True);
- }
-+
-Index: sal/rtl/source/strtmpl.c
-===================================================================
-RCS file: /cvs/porting/sal/rtl/source/strtmpl.c,v
-retrieving revision 1.22
-diff -u -p -u -r1.22 strtmpl.c
---- sal/rtl/source/strtmpl.c 20 Jun 2006 04:30:39 -0000 1.22
-+++ sal/rtl/source/strtmpl.c 23 Aug 2006 10:24:47 -0000
-@@ -1,3 +1,5 @@
-+#include <glib/ghash.h>
-+
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -53,6 +55,68 @@ inline void rtl_str_ImplCopy( IMPL_RTL_S
- }
- */
-
-+#if 1
-+#include <stdio.h>
-+#define IMPL_VAR(a) IMPL_RTL_STRINGNAME(a)
-+GHashTable *IMPL_VAR(strhash) = NULL;
-+long IMPL_VAR(threshold) = 0;
-+
-+static void
-+dumpString (gpointer key, gpointer value, gpointer user_data)
-+{
-+ IMPL_RTL_STRINGDATA *pStr = (IMPL_RTL_STRINGDATA *) key;
-+ int i;
-+ for (i = 0; i < pStr->length; i++)
-+ fprintf (stderr, "%c", pStr->buffer[i]);
-+ fprintf (stderr, "\n");
-+}
-+
-+static void
-+doInit()
-+{
-+ if (IMPL_VAR(strhash))
-+ return;
-+ IMPL_VAR(strhash) = g_hash_table_new (NULL, NULL);
-+ if (getenv("SAL_STR_COUNT"))
-+ IMPL_VAR(threshold) = atoi (getenv("SAL_STR_COUNT"));
-+}
-+
-+static void
-+checkDump()
-+{
-+ if (!IMPL_VAR(threshold))
-+ fprintf (stderr, "hash size %d\n", g_hash_table_size (IMPL_VAR(strhash)));
-+ else
-+ {
-+ static int doneIt = 0;
-+ if (!doneIt && g_hash_table_size (IMPL_VAR(strhash)) >= IMPL_VAR(threshold))
-+ {
-+ doneIt++;
-+ fprintf (stderr, "hash size %d\n", g_hash_table_size (IMPL_VAR(strhash)));
-+ g_hash_table_foreach (IMPL_VAR(strhash), dumpString, NULL);
-+ }
-+ }
-+}
-+
-+#define IMPL_ACCOUNT_STRING_NEW(str) \
-+ do { \
-+ doInit(); \
-+ g_hash_table_insert (IMPL_VAR(strhash), str, str); \
-+ checkDump(); \
-+ } while(0)
-+
-+#define IMPL_ACCOUNT_STRING_ALLOC(ptr, len)
-+
-+#define IMPL_ACCOUNT_STRING_DELETE(str) \
-+ do { \
-+ g_hash_table_remove (IMPL_VAR(strhash), str); \
-+ } while (0)
-+
-+#else
-+#define IMPL_ACCOUNT_STRING_NEW(str)
-+#define IMPL_ACCOUNT_STRING_DELETE(str)
-+#endif
-+
- #define rtl_str_ImplCopy( _pDest, _pSrc, _nCount ) \
- { \
- IMPL_RTL_STRCODE* __mm_pDest = _pDest; \
-@@ -991,6 +1055,7 @@ static IMPL_RTL_STRINGDATA* IMPL_RTL_STR
- pData->length = nLen;
- pData->buffer[nLen] = 0;
- }
-+ IMPL_ACCOUNT_STRING_ALLOC(pData, nLen);
- return pData;
- }
-
-@@ -1046,11 +1111,13 @@ void SAL_CALL IMPL_RTL_STRINGNAME( relea
- if ( pThis->refCount == 1 )
- {
- OSL_ENSURE( pThis != &IMPL_RTL_EMPTYSTRING, "static empty string: refCount < 1" );
-+ IMPL_ACCOUNT_STRING_DELETE( pThis );
- rtl_freeMemory( pThis );
- }
- else if ( !osl_decrementInterlockedCount( &(pThis->refCount) ) )
- {
- OSL_ENSURE( IMPL_RTL_EMPTYSTRING.refCount >= 1, "static empty string: refCount < 1" );
-+ IMPL_ACCOUNT_STRING_DELETE( pThis );
- rtl_freeMemory( pThis );
- }
- }
-@@ -1063,6 +1130,9 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new )
- IMPL_RTL_STRINGNAME( release )( *ppThis );
-
- *ppThis = &IMPL_RTL_EMPTYSTRING;
-+
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- IMPL_RTL_AQUIRE( *ppThis );
- }
-
-@@ -1091,6 +1161,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new_W
- }
- }
- }
-+
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- }
-
- /* ----------------------------------------------------------------------- */
-@@ -1114,6 +1186,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFr
- /* must be done at least, if pStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-+
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- }
-
- /* ----------------------------------------------------------------------- */
-@@ -1153,6 +1227,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFr
- }
- while ( *pCharStr );
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pCharStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1177,6 +1253,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFr
- OSL_ASSERT(*ppThis != NULL);
- rtl_str_ImplCopy( (*ppThis)->buffer, pCharStr, nLen );
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pCharStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1236,6 +1314,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newCo
- rtl_str_ImplCopy( pTempStr->buffer, pLeft->buffer, pLeft->length );
- rtl_str_ImplCopy( pTempStr->buffer+pLeft->length, pRight->buffer, pRight->length );
- *ppThis = pTempStr;
-+
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- }
-
- /* must be done at least, if left or right == *ppThis */
-@@ -1277,7 +1357,10 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newRe
- if ( !pNewSubStr )
- IMPL_RTL_STRINGNAME( new )( ppThis );
- else
-+ {
- IMPL_RTL_STRINGNAME( assign )( ppThis, pNewSubStr );
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+ }
- return;
- }
- }
-@@ -1286,6 +1369,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newRe
- if ( !nCount && (!pNewSubStr || !pNewSubStr->length) )
- {
- IMPL_RTL_STRINGNAME( assign )( ppThis, pStr );
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- return;
- }
-
-@@ -1315,6 +1399,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newRe
- }
- rtl_str_ImplCopy( pBuffer, pStr->buffer+nIndex+nCount, pStr->length-nIndex-nCount );
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pStr or pNewSubStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1375,6 +1461,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newRe
- IMPL_RTL_AQUIRE( pStr );
- }
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1435,6 +1523,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newTo
- IMPL_RTL_AQUIRE( pStr );
- }
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1495,6 +1585,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newTo
- IMPL_RTL_AQUIRE( pStr );
- }
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-@@ -1535,6 +1627,8 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newTr
- rtl_str_ImplCopy( (*ppThis)->buffer, pStr->buffer+nPreSpaces, nLen );
- }
-
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
-+
- /* must be done at least, if pStr == *ppThis */
- if ( pOrg )
- IMPL_RTL_STRINGNAME( release )( pOrg );
-Index: sal/rtl/source/ustring.c
-===================================================================
-RCS file: /cvs/porting/sal/rtl/source/ustring.c,v
-retrieving revision 1.22
-diff -u -p -u -r1.22 ustring.c
---- sal/rtl/source/ustring.c 4 May 2006 15:15:15 -0000 1.22
-+++ sal/rtl/source/ustring.c 23 Aug 2006 10:24:47 -0000
-@@ -89,6 +89,9 @@ static rtl_uString aImplEmpty_rtl_uStrin
-
- #include "strtmpl.c"
-
-+volatile long IMPL_VAR(nCount) = 0;
-+volatile long IMPL_VAR(nSize) = 0;
-+
- sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * pStr, float f)
- {
- rtl_uString * pResult = NULL;
-@@ -432,6 +435,8 @@ void SAL_CALL rtl_uString_newFromAscii(
- pCharStr++;
- }
- while ( *pCharStr );
-+
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- }
- }
-
-@@ -547,6 +552,7 @@ void SAL_CALL rtl_string2UString( rtl_uS
- nLen--;
- }
- while ( nLen );
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- return;
- }
- }
-@@ -611,4 +617,8 @@ void SAL_CALL rtl_string2UString( rtl_uS
- rtl_uString_new( ppThis );
- }
- }
-+ IMPL_ACCOUNT_STRING_NEW( *ppThis );
- }
-+
-+#if 0
-+#endif
-Index: sal/util/makefile.mk
-===================================================================
-RCS file: /cvs/porting/sal/util/makefile.mk,v
-retrieving revision 1.39
-diff -u -p -u -r1.39 makefile.mk
---- sal/util/makefile.mk 7 Apr 2006 08:07:35 -0000 1.39
-+++ sal/util/makefile.mk 23 Aug 2006 10:25:11 -0000
-@@ -164,6 +164,7 @@ SHL1STDLIBS+=-lpam
- .IF "$(CRYPT_LINK)" == "YES"
- SHL1STDLIBS+=-lcrypt
- .ENDIF
-+SHL1STDLIBS+=`pkg-config --libs glib-2.0`
- .ENDIF
-
- SHL1LIBS+=$(SLB)$/$(TARGET).lib
diff --git a/patches/test/sc-dp-debug.diff b/patches/test/sc-dp-debug.diff
deleted file mode 100644
index 4ccfffe4a..000000000
--- a/patches/test/sc-dp-debug.diff
+++ /dev/null
@@ -1,29 +0,0 @@
-Index: sc/source/core/data/dptabsrc.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/dptabsrc.cxx,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 dptabsrc.cxx
---- sc/source/core/data/dptabsrc.cxx 7 Nov 2005 14:41:01 -0000 1.14
-+++ sc/source/core/data/dptabsrc.cxx 21 Apr 2006 15:42:29 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -2426,7 +2427,15 @@ BOOL ScDPMember::IsNamedItem( const ScDP
- return nComp == fValue;
- }
-
-- return r.IsCaseInsEqual( ScDPItemData( aName, fValue, bHasValue ) );
-+ fprintf (stderr, "IsNamedItem '%s' (%d) %g vs ",
-+ rtl::OUStringToOString (aName, RTL_TEXTENCODING_UTF8).getStr(),
-+ bHasValue, bHasValue ? fValue : 0);
-+
-+ fprintf (stderr, "'%s' (%d) %g\n",
-+ rtl::OUStringToOString (r.aString, RTL_TEXTENCODING_UTF8).getStr(),
-+ r.bHasValue, r.bHasValue ? r.fValue : 0);
-+
-+ return r.IsCaseInsEqualVals( aName, fValue, bHasValue );
- }
-
- sal_Int32 ScDPMember::Compare( const ScDPMember& rOther ) const
diff --git a/patches/test/sc-dp-speed.diff b/patches/test/sc-dp-speed.diff
deleted file mode 100644
index efb24e1cc..000000000
--- a/patches/test/sc-dp-speed.diff
+++ /dev/null
@@ -1,438 +0,0 @@
-Index: sc/source/core/data/dptabdat.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/dptabdat.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 dptabdat.cxx
---- sc/source/core/data/dptabdat.cxx 8 Sep 2005 18:24:11 -0000 1.9
-+++ sc/source/core/data/dptabdat.cxx 24 Apr 2006 19:29:25 -0000
-@@ -53,13 +53,33 @@
-
- // -----------------------------------------------------------------------
-
--BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
-+void ScDPItemData::operator=( const ScDPItemData& r )
-+{
-+ aString = r.aString;
-+ fValue = r.fValue;
-+ bHasValue = r.bHasValue;
-+}
-+
-+bool ScDPItemData::operator==( const ScDPItemData& r ) const
-+{
-+ return ( ( ( bHasValue && r.bHasValue ) &&
-+ fValue == r.fValue ) ||
-+ ( !bHasValue && !r.bHasValue ) ) &&
-+ aString == r.aString;
-+}
-+
-+BOOL ScDPItemData::IsCaseInsEqualVals( const String &_aString, double _fValue, BOOL _bHasValue ) const
- {
- //! pass Transliteration?
- //! inline?
-- return bHasValue ? ( r.bHasValue && rtl::math::approxEqual( fValue, r.fValue ) ) :
-- ( !r.bHasValue &&
-- ScGlobal::pTransliteration->isEqual( aString, r.aString ) );
-+ return bHasValue ? ( _bHasValue && rtl::math::approxEqual( fValue, _fValue ) ) :
-+ ( !_bHasValue &&
-+ ScGlobal::pTransliteration->isEqual( aString, _aString ) );
-+}
-+
-+BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
-+{
-+ return IsCaseInsEqualVals( r.aString, r.fValue, r.bHasValue );
- }
-
- // -----------------------------------------------------------------------
-Index: sc/source/core/data/dptabres.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/dptabres.cxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 dptabres.cxx
---- sc/source/core/data/dptabres.cxx 8 Sep 2005 18:24:27 -0000 1.7
-+++ sc/source/core/data/dptabres.cxx 24 Apr 2006 19:29:27 -0000
-@@ -47,6 +47,7 @@
- #include <float.h> //! Test !!!
-
- #include <algorithm>
-+#include <hash_map>
-
- #include "dptabres.hxx"
- #include "dptabsrc.hxx"
-@@ -2469,6 +2470,42 @@ BOOL ScDPGroupCompare::TestIncluded( con
-
- // -----------------------------------------------------------------------
-
-+struct ScDPItemDataHash
-+{
-+ size_t operator()(const ScDPItemData & rItem) const
-+ {
-+ size_t nVal;
-+ if (rItem.bHasValue)
-+ nVal = rItem.fValue;
-+ nVal ^= rtl_ustr_hashCode_WithLength( rItem.aString.GetBuffer(),
-+ rItem.aString.Len());
-+
-+ return nVal;
-+ }
-+};
-+
-+class ScDPResultDimensionCache
-+{
-+ std::hash_map<ScDPItemData,ScDPResultMember *, ScDPItemDataHash> aCache;
-+public:
-+ void Clear() { if (this) aCache.clear(); }
-+ ScDPResultMember *Lookup(const ScDPItemData *pElem)
-+ {
-+ std::hash_map<ScDPItemData,ScDPResultMember *, ScDPItemDataHash>::const_iterator aIter;
-+ aIter = aCache.find (*pElem);
-+ if (aIter != aCache.end())
-+ return aIter->second;
-+ else
-+ return NULL;
-+ }
-+ void Insert (const ScDPItemData *pElem, ScDPResultMember *pVal)
-+ {
-+ aCache[*pElem] = pVal;
-+ }
-+};
-+
-+// -----------------------------------------------------------------------
-+
- ScDPResultDimension::ScDPResultDimension( ScDPResultData* pData ) :
- pResultData( pData ),
- bInitialized( FALSE ),
-@@ -2479,12 +2516,14 @@ ScDPResultDimension::ScDPResultDimension
- bAutoShow( FALSE ),
- bAutoTopItems( FALSE ),
- nAutoMeasure( 0 ),
-- nAutoCount( 0 )
-+ nAutoCount( 0 ),
-+ pCache( NULL )
- {
- }
-
- ScDPResultDimension::~ScDPResultDimension()
- {
-+ delete pCache;
- }
-
- void ScDPResultDimension::InitFrom( ScDPDimension** ppDim, ScDPLevel** ppLev, ScDPInitState& rInitState )
-@@ -2534,6 +2573,7 @@ void ScDPResultDimension::InitFrom( ScDP
- ScDPResultMember* pNew = new ScDPResultMember( pResultData, pThisDim,
- pThisLevel, pMember, FALSE );
- aMembers.Insert( pNew, aMembers.Count() );
-+ pCache->Clear();
-
- ScDPItemData aMemberData;
- pMember->FillItemData( aMemberData );
-@@ -2601,6 +2641,7 @@ void ScDPResultDimension::LateInitFrom(
- ScDPResultMember* pNew = new ScDPResultMember( pResultData, pThisDim,
- pThisLevel, pMember, FALSE );
- aMembers.Insert( pNew, aMembers.Count() );
-+ pCache->Clear();
- }
- }
- bInitialized = TRUE; // don't call again, even if no members were included
-@@ -2651,48 +2692,57 @@ long ScDPResultDimension::GetSize(long n
- BOOL ScDPResultDimension::IsValidEntry( const ScDPItemData* pMembers ) const
- {
- // the ScDPItemData array must contain enough entries for all dimensions - this isn't checked
--
-- long nCount = aMembers.Count();
-- for (long i=0; i<nCount; i++)
-+ ScDPResultMember* pMember = ((ScDPResultDimension *)this)->getMember (pMembers);
-+ if (!pMember)
- {
-- ScDPResultMember* pMember = aMembers[(USHORT)i];
-- if ( bIsDataLayout || pMember->IsNamedItem( *pMembers ) )
-- {
-- if ( !pMember->IsValid() )
-- return FALSE;
--
-- ScDPResultDimension* pChildDim = pMember->GetChildDimension();
-- if (pChildDim)
-- return pChildDim->IsValidEntry( pMembers + 1 );
-- else
-- return TRUE;
-- }
-+ DBG_ERROR("IsValidEntry: Member not found");
-+ return FALSE;
- }
-+ if ( !pMember->IsValid() )
-+ return FALSE;
-
-- DBG_ERROR("IsValidEntry: Member not found");
-- return FALSE;
-+ ScDPResultDimension* pChildDim = pMember->GetChildDimension();
-+ if (pChildDim)
-+ return pChildDim->IsValidEntry( pMembers + 1 );
-+ else
-+ return TRUE;
- }
-
--void ScDPResultDimension::ProcessData( const ScDPItemData* pMembers,
-- ScDPResultDimension* pDataDim, const ScDPItemData* pDataMembers,
-- const ScDPValueData* pValues )
-+ScDPResultMember* ScDPResultDimension::getMember (const ScDPItemData* pElem)
- {
-- // the ScDPItemData array must contain enough entries for all dimensions - this isn't checked
-+ ScDPResultMember* pMember;
-
-+ if (!pCache)
-+ pCache = new ScDPResultDimensionCache();
-+ pMember = pCache->Lookup (pElem);
-+ if (pMember)
-+ return pMember;
-+ // the ScDPItemData array must contain enough entries for all dimensions - this isn't checked
- long nCount = aMembers.Count();
- for (long i=0; i<nCount; i++)
- {
-- ScDPResultMember* pMember = aMembers[(USHORT)i];
-+ pMember = aMembers[(USHORT)i];
-
- // always first member for data layout dim
-- if ( bIsDataLayout || pMember->IsNamedItem( *pMembers ) )
-- {
-- pMember->ProcessData( pMembers + 1, pDataDim, pDataMembers, pValues );
-- return;
-- }
-+ if ( bIsDataLayout || pMember->IsNamedItem( *pElem ) )
-+ break;
- }
-+ if (!bIsDataLayout)
-+ pCache->Insert (pElem, pMember);
-
-- DBG_ERROR("ProcessData: Member not found");
-+ return NULL;
-+}
-+
-+void ScDPResultDimension::ProcessData( const ScDPItemData* pMembers,
-+ ScDPResultDimension* pDataDim, const ScDPItemData* pDataMembers,
-+ const ScDPValueData* pValues )
-+{
-+ // the ScDPItemData array must contain enough entries for all dimensions - this isn't checked
-+ ScDPResultMember* pMember = ((ScDPResultDimension *)this)->getMember (pMembers);
-+ if (pMember)
-+ pMember->ProcessData( pMembers + 1, pDataDim, pDataMembers, pValues );
-+ else
-+ DBG_ERROR("ProcessData: Member not found");
- }
-
- void ScDPResultDimension::FillMemberResults( uno::Sequence<sheet::MemberResult>* pSequences,
-Index: sc/source/core/data/dptabsrc.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/dptabsrc.cxx,v
-retrieving revision 1.14
-diff -u -p -u -r1.14 dptabsrc.cxx
---- sc/source/core/data/dptabsrc.cxx 7 Nov 2005 14:41:01 -0000 1.14
-+++ sc/source/core/data/dptabsrc.cxx 24 Apr 2006 19:29:27 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -2426,7 +2427,17 @@ BOOL ScDPMember::IsNamedItem( const ScDP
- return nComp == fValue;
- }
-
-- return r.IsCaseInsEqual( ScDPItemData( aName, fValue, bHasValue ) );
-+#if 0
-+ fprintf (stderr, "IsNamedItem '%s' (%d) %g vs ",
-+ rtl::OUStringToOString (aName, RTL_TEXTENCODING_UTF8).getStr(),
-+ bHasValue, bHasValue ? fValue : 0);
-+
-+ fprintf (stderr, "'%s' (%d) %g\n",
-+ rtl::OUStringToOString (r.aString, RTL_TEXTENCODING_UTF8).getStr(),
-+ r.bHasValue, r.bHasValue ? r.fValue : 0);
-+#endif
-+
-+ return r.IsCaseInsEqualVals( aName, fValue, bHasValue );
- }
-
- sal_Int32 ScDPMember::Compare( const ScDPMember& rOther ) const
-Index: sc/inc/dpobject.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dpobject.hxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 dpobject.hxx
---- sc/inc/dpobject.hxx 28 Sep 2005 11:26:37 -0000 1.11
-+++ sc/inc/dpobject.hxx 24 Apr 2006 19:30:40 -0000
-@@ -52,11 +52,14 @@
- #include "collect.hxx"
- #endif
-
-+#ifndef SC_DPOUTPUT_HXX
-+#include "dpoutput.hxx"
-+#endif
-+
- #ifndef _COM_SUN_STAR_SHEET_XDIMENSIONSSUPPLIER_HPP_
- #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
- #endif
-
--
- //------------------------------------------------------------------
-
-
-@@ -116,6 +119,7 @@ private:
- ScDPOutput* pOutput;
- BOOL bSettingsChanged;
- BOOL bAlive; // FALSE if only used to hold settings
-+ USHORT nAutoFormatIndex;
- BOOL bAllowMove;
- BOOL bInfoValid; // affects: nHeaderRows
- long nHeaderRows; // page fields plus filter button
-@@ -146,6 +150,9 @@ public:
- void SetOutRange(const ScRange& rRange);
- const ScRange& GetOutRange() const { return aOutRange; }
-
-+ void SetAutoFormatIndex (const USHORT nIndex);
-+ const USHORT GetAutoFormatIndex () { if (this == NULL) return 65535; else return nAutoFormatIndex; }
-+
- void SetSheetDesc(const ScSheetSourceDesc& rDesc);
- void SetImportDesc(const ScImportSourceDesc& rDesc);
- void SetServiceData(const ScDPServiceDesc& rDesc);
-@@ -173,6 +180,8 @@ public:
- BOOL IsDuplicated( long nDim );
- long GetDimCount();
- void GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
-+ BOOL GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */
-+ const std::vector< ScDPGetPivotDataField >& rFilters );
- long GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
- BOOL GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
- long nDragDim,
-Index: sc/inc/dpoutput.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dpoutput.hxx,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 dpoutput.hxx
---- sc/inc/dpoutput.hxx 8 Sep 2005 17:35:15 -0000 1.7
-+++ sc/inc/dpoutput.hxx 24 Apr 2006 19:30:40 -0000
-@@ -56,6 +56,10 @@
- #include "address.hxx"
- #endif
-
-+#ifndef __SGI_STL_VECTOR
-+#include <vector>
-+#endif
-+
- class Rectangle;
- class SvStream;
- class ScDocument;
-@@ -77,6 +81,15 @@ struct ScDPPositionData
- ScDPPositionData() { nDimension = nHierarchy = nLevel = -1; nFlags = 0; } // invalid
- };
-
-+struct ScDPGetPivotDataField
-+{
-+ String maFieldName;
-+
-+ bool mbValIsStr;
-+ String maValStr;
-+ double mnValNum;
-+};
-+
-
-
- class ScDPOutput //! name???
-@@ -143,6 +156,8 @@ public:
- BOOL HasError(); // range overflow or exception from source
-
- void GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
-+ BOOL GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */
-+ const std::vector< ScDPGetPivotDataField >& rFilters );
- long GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
- BOOL GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
- long nDragDim,
-Index: sc/inc/dpsave.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dpsave.hxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 dpsave.hxx
---- sc/inc/dpsave.hxx 8 Sep 2005 17:35:34 -0000 1.8
-+++ sc/inc/dpsave.hxx 24 Apr 2006 19:30:40 -0000
-@@ -51,6 +51,7 @@
- #ifndef INCLUDED_SCDLLAPI_H
- #include "scdllapi.h"
- #endif
-+#include <hash_map>
-
- namespace com { namespace sun { namespace star { namespace sheet {
- struct DataPilotFieldReference;
-@@ -119,8 +120,15 @@ private:
- ::com::sun::star::sheet::DataPilotFieldSortInfo* pSortInfo; // (level)
- ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level)
- ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
-- List aMemberList;
-
-+ struct MemberHashFunc : public std::unary_function< const String &, size_t >
-+ {
-+ size_t operator() (const String &member_name) const;
-+ };
-+public :
-+ typedef std::hash_map <String, ScDPSaveMember *, MemberHashFunc> MemberHash;
-+private :
-+ MemberHash aMembers;
- public:
- ScDPSaveDimension(const String& rName, BOOL bDataLayout);
- ScDPSaveDimension(const ScDPSaveDimension& r);
-@@ -129,8 +137,8 @@ public:
-
- BOOL operator== ( const ScDPSaveDimension& r ) const;
-
-- const List& GetMembers() const { return aMemberList; }
-- void AddMember(ScDPSaveMember* pMember) { aMemberList.Insert(pMember, LIST_APPEND); };
-+ const MemberHash& GetMembers() const { return aMembers; }
-+ void AddMember(ScDPSaveMember* pMember) { aMembers[pMember->GetName()] = pMember; }
-
- void SetDupFlag(BOOL bSet) { bDupFlag = bSet; }
- BOOL GetDupFlag() const { return bDupFlag; }
-Index: sc/inc/dptabdat.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dptabdat.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 dptabdat.hxx
---- sc/inc/dptabdat.hxx 8 Sep 2005 17:36:18 -0000 1.5
-+++ sc/inc/dptabdat.hxx 24 Apr 2006 19:30:40 -0000
-@@ -84,8 +84,12 @@ struct ScDPItemData
- void SetString( const String& rS ) { aString = rS; bHasValue = FALSE; }
-
- BOOL IsCaseInsEqual( const ScDPItemData& r ) const;
-+ BOOL IsCaseInsEqualVals( const String &aString, double fValue, BOOL bHasValue ) const;
-+ bool operator==( const ScDPItemData& r ) const;
-+ void operator=( const ScDPItemData& r );
- };
-
-+
- #define SC_VALTYPE_EMPTY 0
- #define SC_VALTYPE_VALUE 1
- #define SC_VALTYPE_STRING 2
-Index: sc/inc/dptabres.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/dptabres.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 dptabres.hxx
---- sc/inc/dptabres.hxx 8 Sep 2005 17:36:34 -0000 1.5
-+++ sc/inc/dptabres.hxx 24 Apr 2006 19:30:41 -0000
-@@ -451,11 +451,13 @@ SV_DECL_PTRARR_DEL(ScDPDataMembers, ScDP
-
- // result dimension contains only members
-
-+class ScDPResultDimensionCache;
- class ScDPResultDimension
- {
- private:
- ScDPResultData* pResultData;
- ScDPResultMembers aMembers;
-+ ScDPResultDimensionCache *pCache;
- BOOL bInitialized;
- String aDimensionName; //! or ptr to IntDimension?
- BOOL bIsDataLayout; //! or ptr to IntDimension?
-@@ -468,6 +470,8 @@ private:
- long nAutoMeasure;
- long nAutoCount;
-
-+ ScDPResultMember* getMember (const ScDPItemData* pElem);
-+
- public:
- ScDPResultDimension( ScDPResultData* pData );
- ~ScDPResultDimension();
diff --git a/patches/test/sc-ecma-filter.diff b/patches/test/sc-ecma-filter.diff
deleted file mode 100644
index 99aae3cf9..000000000
--- a/patches/test/sc-ecma-filter.diff
+++ /dev/null
@@ -1,100 +0,0 @@
---- /dev/null 2006-04-07 20:25:18.000000000 +0100
-+++ filter/source/config/fragments/filters/OfficeOpen.xcu 2006-04-19 13:57:17.000000000 +0100
-@@ -0,1 +1,14 @@
-+ <node oor:name="Office Open XML" oor:op="replace">
-+ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE</value></prop>
-+ <prop oor:name="UIComponent"/>
-+ <prop oor:name="FilterService"/>
-+ <prop oor:name="UserData"><value></value></prop>
-+ <prop oor:name="FileFormatVersion"><value>6800</value></prop>
-+ <prop oor:name="Type"><value>calc_OfficeOpen</value></prop>
-+ <prop oor:name="TemplateName"/>
-+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
-+ <prop oor:name="UIName">
-+ <value xml:lang="x-default">ECMA Office Open</value>
-+ </prop>
-+ </node>
---- /dev/null 2006-04-07 20:25:18.000000000 +0100
-+++ filter/source/config/fragments/types/calc_OfficeOpen.xcu 2006-04-19 13:55:29.000000000 +0100
-@@ -0,0 +1,12 @@
-+ <node oor:name="calc_OfficeOpen" oor:op="replace">
-+ <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
-+ <prop oor:name="URLPattern"/>
-+ <prop oor:name="Extensions"><value>xlsx</value></prop>
-+ <prop oor:name="MediaType"><value>application/vnd.ms-excel-FIXME</value></prop>
-+ <prop oor:name="Preferred"><value>false</value></prop>
-+ <prop oor:name="PreferredFilter"><value>Office Open XML</value></prop>
-+ <prop oor:name="UIName">
-+ <value>ECMA Office Open</value>
-+ </prop>
-+ <prop oor:name="ClipboardFormat"><value>OfficeOpen</value></prop>
-+ </node>
-Index: sc/source/ui/docshell/docsh.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/docshell/docsh.cxx,v
-retrieving revision 1.83
-diff -u -p -u -r1.83 docsh.cxx
---- sc/source/ui/docshell/docsh.cxx 27 Jan 2006 15:51:57 -0000 1.83
-+++ sc/source/ui/docshell/docsh.cxx 20 Apr 2006 10:51:09 -0000
-@@ -185,6 +185,7 @@ static const sal_Char __FAR_DATA pFilter
- static const sal_Char __FAR_DATA pFilterHtml[] = "HTML (StarCalc)";
- static const sal_Char __FAR_DATA pFilterHtmlWebQ[] = "calc_HTML_WebQuery";
- static const sal_Char __FAR_DATA pFilterRtf[] = "Rich Text Format (StarCalc)";
-+static const sal_Char __FAR_DATA pFilterOOXml[] = "ooxml";
-
- //----------------------------------------------------------------------
-
-@@ -886,6 +888,14 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
- bSetColWidths = TRUE;
- bSetRowHeights = TRUE;
- }
-+ else if (aFltName.EqualsAscii(pFilterOOXml))
-+ {
-+ fprintf (stderr, "Load OO.o XML\n");
-+ ScColumn::bDoubleAlloc = TRUE;
-+ FltError eError = ScImportECMA( rMedium, &aDocument);
-+ ScColumn::bDoubleAlloc = FALSE;
-+ bRet = TRUE;
-+ }
- else if ( aFltName.EqualsAscii(pFilterExcel4) || aFltName.EqualsAscii(pFilterExcel5) ||
- aFltName.EqualsAscii(pFilterExcel95) || aFltName.EqualsAscii(pFilterExcel97) ||
- aFltName.EqualsAscii(pFilterEx4Temp) || aFltName.EqualsAscii(pFilterEx5Temp) ||
-
-Index: sc/util/makefile.mk
-===================================================================
-RCS file: /cvs/sc/sc/util/makefile.mk,v
-retrieving revision 1.33
-diff -u -p -u -r1.33 makefile.mk
---- sc/util/makefile.mk 27 Jan 2006 15:52:35 -0000 1.33
-+++ sc/util/makefile.mk 19 Apr 2006 13:08:14 -0000
-@@ -182,6 +182,7 @@ LIB4FILES= \
- $(SLB)$/html.lib \
- $(SLB)$/lotus.lib \
- $(SLB)$/qpro.lib\
-+ $(SLB)$/ecma.lib\
- $(SLB)$/rtf.lib \
- $(SLB)$/xml.lib \
- $(SLB)$/accessibility.lib \
-
-
-Index: sc/prj/build.lst
-===================================================================
-RCS file: /cvs/sc/sc/prj/build.lst,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 build.lst
---- sc/prj/build.lst 27 Jan 2006 15:49:40 -0000 1.11
-+++ sc/prj/build.lst 19 Apr 2006 13:08:47 -0000
-@@ -39,6 +40,7 @@ sc sc\source\filter\pch get - all s
- sc sc\source\filter\excel nmake - all sc_excel sc_sdi NULL
- sc sc\source\filter\lotus nmake - all sc_lotus sc_sdi NULL
- sc sc\source\filter\qpro nmake - all sc_qpro sc_sdi NULL
-+sc sc\source\filter\ecma nmake - all sc_ecma sc_sdi NULL
- sc sc\source\filter\starcalc nmake - all sc_scalc sc_sdi NULL
- sc sc\source\filter\dif nmake - all sc_dif sc_sdi NULL
- sc sc\source\filter\rtf nmake - all sc_rtf sc_sdi NULL
-@@ -48,4 +50,4 @@ sc sc\source\filter\xcl97 nmake - al
- sc sc\addin\datefunc nmake - all sc_addfu sc_sdi NULL
- sc sc\addin\rot13 nmake - all sc_adrot sc_sdi NULL
- sc sc\addin\util nmake - all sc_adutil sc_addfu sc_adrot sc_sdi NULL
--sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_vba NULL
-+sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_ecma sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_vba NULL
diff --git a/patches/test/sc-highlight-current-row.diff b/patches/test/sc-highlight-current-row.diff
deleted file mode 100644
index 4952500b9..000000000
--- a/patches/test/sc-highlight-current-row.diff
+++ /dev/null
@@ -1,157 +0,0 @@
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/gridwin.hxx sc/source/ui/inc/gridwin.hxx
---- sc.clean/source/ui/inc/gridwin.hxx 2008-04-01 12:26:31.000000000 -0400
-+++ sc/source/ui/inc/gridwin.hxx 2008-04-14 09:09:24.000000000 -0400
-@@ -169,6 +169,7 @@ private:
- ::sdr::overlay::OverlayObjectList* mpOODragRect;
- ::sdr::overlay::OverlayObjectList* mpOOHeader;
- ::sdr::overlay::OverlayObjectList* mpOOShrink;
-+ ::sdr::overlay::OverlayObjectList* mpOORowHighlight;
-
- private:
- ScViewData* pViewData;
-@@ -446,6 +447,8 @@ public:
- void UpdateHeaderOverlay();
- void DeleteShrinkOverlay();
- void UpdateShrinkOverlay();
-+ void DeleteRowHighlightOverlay();
-+ void UpdateRowHighlightOverlay( const MapMode& rDrawMode );
- void UpdateAllOverlays();
-
- protected:
-@@ -453,6 +456,12 @@ protected:
- void ImpCreateOverlayObjects();
- void ImpDestroyOverlayObjects();
-
-+private:
-+
-+ void ConvertPixelRectsToRangeVector(
-+ const ::std::vector< Rectangle >& rPixelRects,
-+ sdr::overlay::OverlayObjectCell::RangeVector& rRanges,
-+ const MapMode& rDrawMode );
- };
-
-
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
---- sc.clean/source/ui/view/gridwin.cxx 2008-04-13 06:12:16.000000000 -0400
-+++ sc/source/ui/view/gridwin.cxx 2008-04-26 19:57:38.000000000 -0400
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
-
--
-+#include <stdio.h>
-
- //------------------------------------------------------------------
-
-@@ -421,6 +421,7 @@ ScGridWindow::ScGridWindow( Window* pPar
- mpOODragRect( NULL ),
- mpOOHeader( NULL ),
- mpOOShrink( NULL ),
-+ mpOORowHighlight( NULL ),
- pViewData( pData ),
- eWhich( eWhichPos ),
- pNoteMarker( NULL ),
-@@ -5022,6 +5023,7 @@ void ScGridWindow::ImpDestroyOverlayObje
- DeleteDragRectOverlay();
- DeleteHeaderOverlay();
- DeleteShrinkOverlay();
-+ DeleteRowHighlightOverlay();
- }
-
- void ScGridWindow::UpdateAllOverlays()
-@@ -5048,6 +5050,9 @@ void ScGridWindow::UpdateCursorOverlay()
- // For now, just re-create them.
-
- DeleteCursorOverlay();
-+ DeleteRowHighlightOverlay();
-+
-+ UpdateRowHighlightOverlay(aDrawMode);
-
- std::vector<Rectangle> aPixelRects;
-
-@@ -5159,8 +5164,16 @@ void ScGridWindow::UpdateCursorOverlay()
- sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aCursorColor, aRanges );
-
- pOverlayManager->add(*pOverlay);
-- mpOOCursors = new ::sdr::overlay::OverlayObjectList;
-- mpOOCursors->append(*pOverlay);
-+ mpOOCursors = new ::sdr::overlay::OverlayObjectList;
-+ mpOOCursors->append(*pOverlay);
-+ const basegfx::B2DRange range = pOverlay->getBaseRange();
-+
-+ double minX = range.getMinX();
-+ double minY = range.getMinY();
-+ double maxX = range.getMaxX();
-+ double maxY = range.getMaxY();
-+ double w = range.getWidth();
-+ double h = range.getHeight();
- }
- }
-
-@@ -5584,6 +5597,41 @@ void ScGridWindow::UpdateShrinkOverlay()
- SetMapMode( aOldMode );
- }
-
-+void ScGridWindow::DeleteRowHighlightOverlay()
-+{
-+ DELETEZ( mpOORowHighlight );
-+}
-+
-+void ScGridWindow::UpdateRowHighlightOverlay( const MapMode& rDrawMode )
-+{
-+ ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
-+ if (!pOverlayManager)
-+ return;
-+
-+ std::vector<Rectangle> aPixelRects;
-+
-+ SCCOL nCurX = pViewData->GetCurX();
-+ SCCOL nCurY = pViewData->GetCurY();
-+ Point aCurPtStart = pViewData->GetScrPos(nCurX, nCurY, eWhich);
-+ Point aCurPtEnd = pViewData->GetScrPos(nCurX+1, nCurY+1, eWhich);
-+ Size aScrSize = pViewData->GetScrSize();
-+
-+ aPixelRects.push_back(Rectangle(0, aCurPtStart.Y()-4, aScrSize.getWidth(), aCurPtStart.Y()-2));
-+ aPixelRects.push_back(Rectangle(0, aCurPtEnd.Y(), aScrSize.getWidth(), aCurPtEnd.Y()+2));
-+
-+ sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-+ ConvertPixelRectsToRangeVector( aPixelRects, aRanges, rDrawMode );
-+
-+ ScOverlayType eType = SC_OVERLAY_TRANSPARENT;
-+
-+ Color aHighlight(140, 100, 24);
-+ sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
-+
-+ pOverlayManager->add(*pOverlay);
-+ mpOORowHighlight = new ::sdr::overlay::OverlayObjectList;
-+ mpOORowHighlight->append(*pOverlay);
-+}
-+
- // #i70788# central method to get the OverlayManager safely
- ::sdr::overlay::OverlayManager* ScGridWindow::getOverlayManager()
- {
-@@ -5613,6 +5661,24 @@ void ScGridWindow::flushOverlayManager()
- }
- }
-
-+void ScGridWindow::ConvertPixelRectsToRangeVector( const ::std::vector< Rectangle >& rPixelRects,
-+ sdr::overlay::OverlayObjectCell::RangeVector& rRanges,
-+ const MapMode& rDrawMode )
-+{
-+ std::vector<Rectangle>::const_iterator aPixelEnd( rPixelRects.end() );
-+ for ( std::vector<Rectangle>::const_iterator aPixelIter( rPixelRects.begin() );
-+ aPixelIter != aPixelEnd; ++aPixelIter )
-+ {
-+ Rectangle aLogic( PixelToLogic( *aPixelIter, rDrawMode ) );
-+
-+ const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
-+ const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
-+ const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-+
-+ rRanges.push_back( a2DRange );
-+ }
-+}
-+
- // ---------------------------------------------------------------------------
-
- // #114409#
diff --git a/patches/test/sc-postit.diff b/patches/test/sc-postit.diff
deleted file mode 100644
index b986db859..000000000
--- a/patches/test/sc-postit.diff
+++ /dev/null
@@ -1,2351 +0,0 @@
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/cell.hxx sc/inc/cell.hxx
---- sc-pristine/inc/cell.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/cell.hxx 2006-08-17 14:06:13.000000000 +0100
-@@ -83,10 +83,10 @@
- class ScBaseCell
- {
- protected:
-- ScPostIt* pNote;
- SvtBroadcaster* pBroadcaster;
- USHORT nTextWidth;
-- BYTE eCellType; // enum CellType - BYTE spart Speicher
-+ BYTE eCellType : 7; // enum CellType - BYTE spart Speicher
-+ bool bSpecial : 1;
- BYTE nScriptType;
-
- public: // fuer Idle-Berechnung
-@@ -107,17 +107,12 @@
- void Delete(); // simulierter virtueller Destructor
- CellType GetCellType() const;
-
-- void SetNote( const ScPostIt& rNote );
-- BOOL GetNote( ScPostIt& rNote ) const;
-- const ScPostIt* GetNotePtr() const;
-- inline void DeleteNote();
--
- inline SvtBroadcaster* GetBroadcaster() const;
- void SetBroadcaster(SvtBroadcaster* pNew);
- inline void ForgetBroadcaster();
- inline void SwapBroadcaster(ScBaseCell& rOther); // zum Sortieren
-
-- void LoadNote( SvStream& rStream, ScDocument* pDoc );
-+// void LoadNote( SvStream& rStream, ScDocument* pDoc );
-
- // String- oder EditCell
- static ScBaseCell* CreateTextCell( const String& rString, ScDocument* );
-@@ -133,8 +128,10 @@
- String GetStringData() const; // nur echte Strings
-
- static BOOL CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 );
--};
-
-+ bool IsSpecial() const;
-+ void SetSpecial(bool bSpecial);
-+};
-
-
- class ScValueCell : public ScBaseCell
-@@ -449,8 +446,8 @@
- #endif
-
- ScNoteCell();
-- ScNoteCell( const ScPostIt& rNote );
- ScNoteCell( const ScNoteCell& rScNoteCell, ScDocument* pDoc );
-+// ScNoteCell( const ScPostIt& rNote );
- ScNoteCell( SvStream& rStream, USHORT nVer );
- ScBaseCell* Clone(ScDocument* pDoc) const;
-
-@@ -461,41 +458,37 @@
- // ScBaseCell
-
- inline ScBaseCell::ScBaseCell( CellType eNewType ) :
-- pNote( NULL ),
- pBroadcaster( NULL ),
- nTextWidth( TEXTWIDTH_DIRTY ),
- eCellType( eNewType ),
-+ bSpecial( false ),
- nScriptType( SC_SCRIPTTYPE_UNKNOWN )
- {
- }
-
-+// FIXME: should we have a copy constructor - cf. Note transferal
- inline ScBaseCell::ScBaseCell( const ScBaseCell& rBaseCell, ScDocument* pDoc ) :
- pBroadcaster( NULL ),
- nTextWidth( rBaseCell.nTextWidth ),
- eCellType( rBaseCell.eCellType ),
-+ bSpecial( false ),
- nScriptType( SC_SCRIPTTYPE_UNKNOWN )
- {
-- if (rBaseCell.pNote)
-- pNote = new ScPostIt( *rBaseCell.pNote, pDoc );
-- else
-- pNote = NULL;
- }
-
--
--inline CellType ScBaseCell::GetCellType() const
-+inline bool ScBaseCell::IsSpecial() const
- {
-- return (CellType)eCellType;
-+ return bSpecial;
- }
-
--inline const ScPostIt* ScBaseCell::GetNotePtr() const
-+inline void ScBaseCell::SetSpecial( bool _bSpecial )
- {
-- return pNote;
-+ bSpecial = _bSpecial;
- }
-
--inline void ScBaseCell::DeleteNote()
-+inline CellType ScBaseCell::GetCellType() const
- {
-- delete pNote;
-- pNote = NULL;
-+ return (CellType)eCellType;
- }
-
- inline SvtBroadcaster* ScBaseCell::GetBroadcaster() const
-@@ -606,22 +599,26 @@
- {
- }
-
-+
- inline ScNoteCell::ScNoteCell( const ScNoteCell& rScNoteCell, ScDocument* pDoc ) :
- ScBaseCell( rScNoteCell, pDoc )
--{
-+{
- }
-+/*
-
-+// This is screwed up ! :-)
- inline ScNoteCell::ScNoteCell( const ScPostIt& rNote ) :
- ScBaseCell( CELLTYPE_NOTE )
- {
-- ScBaseCell::SetNote(rNote);
-+ fprintf (stderr, "ScNoteCell::constructir - this API is totally broken\n");
-+// ScBaseCell::SetNote(rNote, rNote.GetDocument());
- }
-+*/
-
- inline ScBaseCell* ScNoteCell::Clone(ScDocument* pDoc) const
- {
- return new ScNoteCell(*this, pDoc);
- }
-
--
- #endif
-
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/column.hxx sc/inc/column.hxx
---- sc-pristine/inc/column.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/column.hxx 2006-08-17 16:40:57.000000000 +0100
-@@ -195,6 +195,7 @@
-
- USHORT GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
- BOOL HasSelectionMatrixFragment(const ScMarkData& rMark) const;
-+ BOOL CellVisible( const ScBaseCell* pCell, bool bNotesVisible = true ) const;
-
- // Daten oder Attribute:
- SCROW GetFirstEntryPos() const;
-@@ -267,7 +268,7 @@
- BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString,
- ScAddress::Convention conv = ScAddress::CONV_OOO );
- void SetValue( SCROW nRow, const double& rVal);
-- void SetNote( SCROW nRow, const ScPostIt& rNote );
-+ ScBaseCell* SetNoteInternal( SCROW nRow, bool bEmpty );
- void SetError( SCROW nRow, const USHORT nError);
-
- void GetString( SCROW nRow, String& rString ) const;
-@@ -275,7 +276,6 @@
- double GetValue( SCROW nRow ) const;
- void GetFormula( SCROW nRow, String& rFormula,
- BOOL bAsciiExport = FALSE ) const;
-- BOOL GetNote( SCROW nRow, ScPostIt& rNote ) const;
- CellType GetCellType( SCROW nRow ) const;
- SCSIZE GetCellCount() const { return nCount; }
- ULONG GetWeightedCount() const;
-@@ -429,6 +429,12 @@
- SCROW nRowStart, SCROW nRowEnd ) const;
-
- private:
-+ ScBaseCell *CopyCellTo( const ScBaseCell *pCell, const ScDocument *pSrcDoc,
-+ ScDocument *pDestDoc) const;
-+ void DeleteCell( ScBaseCell *pCell );
-+ const ScPostIt* GetNotePtr( const ScBaseCell* pCell ) const;
-+ bool GetNote( const ScBaseCell* pCell, ScPostIt &rNote );
-+ void SetNote( ScBaseCell* pCell, const ScPostIt &rNote );
- ScBaseCell* CloneCell(SCSIZE nIndex, USHORT nFlags,
- ScDocument* pDestDoc, const ScAddress& rDestPos);
- void CorrectSymbolCells( CharSet eStreamCharSet );
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/dociter.hxx sc/inc/dociter.hxx
---- sc-pristine/inc/dociter.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/dociter.hxx 2006-08-17 14:06:13.000000000 +0100
-@@ -54,6 +54,7 @@
- class ScAttrArray;
- class ScAttrIterator;
- class ScRange;
-+class ScPostIt;
-
- class ScDocumentIterator // alle nichtleeren Zellen durchgehen
- {
-@@ -180,6 +181,7 @@
-
- ScBaseCell* GetThis();
- public:
-+ const ScPostIt* GetNotePtr();
- ScCellIterator(ScDocument* pDocument,
- SCCOL nSCol, SCROW nSRow, SCTAB nSTab,
- SCCOL nECol, SCROW nERow, SCTAB nETab,
-@@ -381,6 +383,7 @@
-
- ScBaseCell* GetNext( SCCOL& rCol, SCROW& rRow );
- BOOL ReturnNext( SCCOL& rCol, SCROW& rRow );
-+ ScDocument* GetDocument() const { return pDoc; }
-
- private:
- void Advance();
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/document.hxx sc/inc/document.hxx
---- sc-pristine/inc/document.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/document.hxx 2006-08-17 15:11:11.000000000 +0100
-@@ -100,6 +100,7 @@
- class Window;
- class XColorTable;
- class List;
-+class ScNoteTracker;
-
- class ScAutoFormatData;
- class ScBaseCell;
-@@ -402,6 +403,7 @@
- BOOL bInUnoBroadcast;
- BOOL bInUnoListenerCall;
- ScAddress::Convention eAddrConv;
-+ ScNoteTracker* pNoteTracker;
-
- mutable BOOL bStyleSheetUsageInvalid;
-
-@@ -409,6 +411,7 @@
- inline BOOL RowHidden( SCROW nRow, SCTAB nTab ); // FillInfo
-
- public:
-+ ScNoteTracker *GetNoteTracker() const;
- ULONG GetCellCount() const; // alle Zellen
- ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet
- ULONG GetCodeCount() const; // RPN-Code in Formeln
-@@ -707,6 +710,8 @@
- BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
- void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
- void SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote );
-+ void SetNote( ScBaseCell *pNote, const ScPostIt& rNote );
-+ void DeleteNote( ScBaseCell *pNote );
- void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError);
-
- void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
-@@ -732,7 +737,8 @@
- const ScAddress& rPos, const ScFormulaCell& rFCell ) const;
- void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula,
- BOOL bAsciiExport = FALSE ) const;
-- BOOL GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote);
-+ BOOL GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote ) const;
-+ const ScPostIt *GetNotePtr( const ScBaseCell* pCell ) const;
- void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
- CellType GetCellType( const ScAddress& rPos ) const;
- void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const;
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/fillinfo.hxx sc/inc/fillinfo.hxx
---- sc-pristine/inc/fillinfo.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/fillinfo.hxx 2006-08-17 14:06:13.000000000 +0100
-@@ -50,6 +50,7 @@
- class SvxLineItem;
- class SvxShadowItem;
-
-+class ScPostIt;
- class ScBaseCell;
- class ScPatternAttr;
-
-@@ -80,6 +81,7 @@
- struct CellInfo
- {
- ScBaseCell* pCell;
-+ const ScPostIt* pNote;
-
- const ScPatternAttr* pPatternAttr;
- const SfxItemSet* pConditionSet;
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/postit.hxx sc/inc/postit.hxx
---- sc-pristine/inc/postit.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/postit.hxx 2006-08-21 15:03:16.000000000 +0100
-@@ -108,6 +108,7 @@
- const String& GetAuthor() const { return maStrAuthor; }
- BOOL IsShown() const { return mbShown; }
-
-+ ScDocument* GetDocument() const { return mpDoc; };
- void SetEditTextObject( const EditTextObject* pTextObj);
- void SetText( const String& rText );
- void SetDate( const String& rNew ) { maStrDate = rNew; }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/inc/table.hxx sc/inc/table.hxx
---- sc-pristine/inc/table.hxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/inc/table.hxx 2006-08-17 14:06:13.000000000 +0100
-@@ -268,7 +268,7 @@
- // TRUE = Zahlformat gesetzt
- BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
- void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
-- void SetNote( SCCOL nCol, SCROW nRow, const ScPostIt& rNote);
-+ ScBaseCell *SetNoteInternal( SCCOL nCol, SCROW nRow, bool bEmpty );
- void SetError( SCCOL nCol, SCROW nRow, USHORT nError);
-
- void GetString( SCCOL nCol, SCROW nRow, String& rString );
-@@ -278,7 +278,6 @@
- double GetValue( SCCOL nCol, SCROW nRow );
- void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
- BOOL bAsciiExport = FALSE );
-- BOOL GetNote( SCCOL nCol, SCROW nRow, ScPostIt& rNote);
-
- CellType GetCellType( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetCellType( rPos.Row() ); }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/cell.cxx sc/source/core/data/cell.cxx
---- sc-pristine/source/core/data/cell.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/cell.cxx 2006-08-17 17:53:05.000000000 +0100
-@@ -46,6 +46,7 @@
- #endif
-
- #include <svtools/zforlist.hxx>
-+#include <hash_map>
-
- #include "scitems.hxx"
- #include "attrib.hxx"
-@@ -78,6 +79,7 @@
- #ifndef _SVT_BROADCAST_HXX
- #include <svtools/broadcast.hxx>
- #endif
-+#include <notetracker.hxx>
-
- // More or less arbitrary, of course all recursions must fit into available
- // stack space (which is what on all systems we don't know yet?). Choosing a
-@@ -110,8 +112,15 @@
-
- // -----------------------------------------------------------------------
-
-+// -----------------------------------------------------------------------
- ScBaseCell* ScBaseCell::Clone(ScDocument* pDoc) const
- {
-+ fprintf (stderr, "Clone a cell...\n");
-+ if (bSpecial)
-+ {
-+// fscanf (stdin, "");
-+ fprintf (stderr, "Terminal problem - not cloning note contents\n");
-+ }
- switch (eCellType)
- {
- case CELLTYPE_VALUE:
-@@ -133,14 +142,17 @@
-
- ScBaseCell::~ScBaseCell()
- {
-- delete pNote;
-+ if (bSpecial)
-+ {
-+ fscanf (stdin, "");
-+ fprintf (stderr, "Darstardly error - not released hash ptr\n");
-+ }
- delete pBroadcaster;
- DBG_ASSERT( eCellType == CELLTYPE_DESTROYED, "BaseCell Destructor" );
- }
-
--void ScBaseCell::Delete()
-+void ScBaseCell::Delete ()
- {
-- DELETEZ(pNote);
- switch (eCellType)
- {
- case CELLTYPE_VALUE:
-@@ -164,29 +176,6 @@
- }
- }
-
--void ScBaseCell::SetNote( const ScPostIt& rNote )
--{
-- if (!rNote.IsEmpty())
-- {
-- if (!pNote)
-- pNote = new ScPostIt(rNote);
-- else
-- *pNote = rNote;
-- }
-- else
-- DELETEZ(pNote);
--}
--
--BOOL ScBaseCell::GetNote( ScPostIt& rNote ) const
--{
-- if ( pNote )
-- rNote = *pNote;
-- else
-- rNote.Clear();
--
-- return ( pNote != NULL );
--}
--
- ScBaseCell* ScBaseCell::CreateTextCell( const String& rString, ScDocument* pDoc )
- {
- if ( rString.Search('\n') != STRING_NOTFOUND || rString.Search(CHAR_CR) != STRING_NOTFOUND )
-@@ -195,12 +184,6 @@
- return new ScStringCell( rString );
- }
-
--void ScBaseCell::LoadNote( SvStream& rStream, ScDocument* pDoc )
--{
-- pNote = new ScPostIt(pDoc);
-- rStream >> *pNote;
--}
--
- void ScBaseCell::SetBroadcaster(SvtBroadcaster* pNew)
- {
- delete pBroadcaster;
-@@ -2065,7 +2048,3 @@
- eCellType = CELLTYPE_DESTROYED;
- }
- #endif
--
--
--
--
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/column2.cxx sc/source/core/data/column2.cxx
---- sc-pristine/source/core/data/column2.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/column2.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -84,11 +84,6 @@
-
- // -----------------------------------------------------------------------
-
--inline BOOL CellVisible( const ScBaseCell* pCell )
--{
-- return ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() );
--}
--
- inline BOOL IsAmbiguousScript( BYTE nScript )
- {
- //! move to a header file
-@@ -437,7 +432,11 @@
- nPos = i;
- #endif
- if (nPos < nCount)
-- pItems[nPos].pCell->LoadNote(rStream, pDocument);
-+ {
-+ ScPostIt aNote( pDocument );
-+ rStream >> aNote;
-+ pDocument->SetNote( pItems[nPos].pCell, aNote );
-+ }
- else
- {
- DBG_ERROR("falsche Pos in ScColumn::LoadNotes");
-@@ -452,7 +451,7 @@
- SCSIZE i;
-
- for (i=0; i<nCount; i++)
-- if ( pItems[i].pCell->GetNotePtr() && pItems[i].nRow<=nMaxRow )
-+ if ( GetNotePtr( pItems[i].pCell ) && pItems[i].nRow<=nMaxRow )
- ++nNoteCount;
-
- return nNoteCount;
-@@ -471,7 +470,7 @@
-
- nNoteCount = 0;
- for (i=0; i<nCount; i++)
-- if ( pItems[i].pCell->GetNotePtr() && pItems[i].nRow<=nSaveMaxRow &&
-+ if ( GetNotePtr( pItems[i].pCell ) && pItems[i].nRow<=nSaveMaxRow &&
- !lcl_RemoveThis( pDocument, nCol, pItems[i].nRow, nTab ) )
- ++nNoteCount;
- }
-@@ -494,7 +493,7 @@
- SCROW nRow = pItems[i].nRow;
- if ( !bRemoveAny || !lcl_RemoveThis( pDocument, nCol, nRow, nTab ) )
- {
-- const ScPostIt* pNote = pItems[i].pCell->GetNotePtr();
-+ const ScPostIt* pNote = GetNotePtr( pItems[i].pCell );
- if ( pNote && nRow <= nSaveMaxRow )
- {
- rStream << nDestPos;
-@@ -1495,8 +1494,9 @@
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
-- if (pOldCell->GetNotePtr())
-- pNewCell->SetNote( *pOldCell->GetNotePtr() );
-+ const ScPostIt *pNote;
-+ if ( ( pNote = GetNotePtr( pOldCell ) ) )
-+ pDocument->SetNote( pNewCell, *pNote );
- pItems[i].pCell = pNewCell;
- delete pOldCell;
- }
-@@ -1570,8 +1570,8 @@
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
-- if (pOldCell->GetNotePtr())
-- pNewCell->SetNote( *pOldCell->GetNotePtr() );
-+ if (GetNotePtr( pOldCell ))
-+ pDocument->SetNote( pNewCell, *GetNotePtr( pOldCell ) );
- pItems[i].pCell = pNewCell;
- delete pOldCell;
- }
-@@ -1720,7 +1720,7 @@
- for (i=0; i<nCount && !bVisData; i++)
- {
- ScBaseCell* pCell = pItems[i].pCell;
-- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
-+ if ( CellVisible( pCell, bNotes ) )
- bVisData = TRUE;
- }
- return !bVisData;
-@@ -1757,7 +1757,7 @@
- {
- --i;
- ScBaseCell* pCell = pItems[i].pCell;
-- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
-+ if ( CellVisible( pCell, bNotes ) )
- {
- bFound = TRUE;
- nRet = pItems[i].nRow;
-@@ -1777,7 +1777,7 @@
- for (i=0; i<nCount && !bFound; i++)
- {
- ScBaseCell* pCell = pItems[i].pCell;
-- if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->GetNotePtr()) )
-+ if ( CellVisible( pCell, bNotes ) )
- {
- bFound = TRUE;
- nRet = pItems[i].nRow;
-@@ -2159,7 +2159,7 @@
-
- if (!pBC->HasListeners())
- {
-- if (pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetNotePtr())
-+ if (pCell->GetCellType() == CELLTYPE_NOTE && !GetNotePtr(pCell))
- DeleteAtIndex(nIndex);
- else
- pCell->SetBroadcaster(NULL);
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/column3.cxx sc/source/core/data/column3.cxx
---- sc-pristine/source/core/data/column3.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/column3.cxx 2006-08-17 17:45:34.000000000 +0100
-@@ -89,8 +89,9 @@
- pNewCell->SetBroadcaster( pBC );
- pOldCell->ForgetBroadcaster();
- }
-- if (pOldCell->GetNotePtr() && !pNewCell->GetNotePtr())
-- pNewCell->SetNote( *pOldCell->GetNotePtr() );
-+ const ScPostIt *pNote;
-+ if ( ( pNote = GetNotePtr( pOldCell ) ) && !GetNotePtr( pNewCell ))
-+ SetNote( pNewCell, *pNote );
- if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
- {
- pOldCell->EndListeningTo( pDocument );
-@@ -98,7 +99,8 @@
- if ( nIndex >= nCount || pItems[nIndex].nRow != nRow )
- Search(nRow, nIndex);
- }
-- pOldCell->Delete();
-+ DeleteCell( pOldCell );
-+
- pItems[nIndex].pCell = pNewCell;
- }
- else
-@@ -228,7 +230,7 @@
- // Soll man hier den Speicher freigeben (delta)? Wird dann langsamer!
- }
- pCell->EndListeningTo( pDocument );
-- pCell->Delete();
-+ DeleteCell(pCell);
- }
- }
-
-@@ -246,7 +248,7 @@
- pItems[nCount].nRow = 0;
- pItems[nCount].pCell = NULL;
- pCell->EndListeningTo( pDocument );
-- pCell->Delete();
-+ DeleteCell( pCell );
- }
-
-
-@@ -255,7 +257,7 @@
- if (pItems)
- {
- for (SCSIZE i = 0; i < nCount; i++)
-- pItems[i].pCell->Delete();
-+ DeleteCell( pItems[i].pCell );
- delete[] pItems;
- pItems = NULL;
- }
-@@ -388,7 +390,7 @@
- {
- for ( i = nStartIndex; i <= nEndIndex; i++ )
- {
-- const ScPostIt* pNote = pItems[i].pCell->GetNotePtr();
-+ const ScPostIt* pNote = GetNotePtr( pItems[i].pCell );
- if ( pNote && pNote->IsShown() )
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, pItems[i].nRow );
-@@ -422,7 +424,7 @@
- aHint.GetAddress().SetRow( pItems[i].nRow );
- aHint.SetCell( pOldCell );
- pDocument->Broadcast( aHint );
-- pOldCell->Delete();
-+ DeleteCell( pOldCell );
- }
- }
- delete pNoteCell;
-@@ -478,9 +480,12 @@
- {
- if ((nDelFlag & IDF_NOTE) == 0)
- {
-- const ScPostIt* pNote = pOldCell->GetNotePtr();
-+ const ScPostIt* pNote = GetNotePtr( pOldCell );
- if (pNote)
-- pNoteCell = new ScNoteCell(*pNote);
-+ {
-+ pNoteCell = new ScNoteCell();
-+ pDocument->SetNote( pNoteCell, *pNote );
-+ }
- }
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- if (pBC)
-@@ -517,14 +522,14 @@
- pDocument->Broadcast( aHint );
- if (eCellType != CELLTYPE_NOTE)
- pOldCell->ForgetBroadcaster();
-- pOldCell->Delete();
-+ DeleteCell( pOldCell );
- }
- }
- else
- {
- if (nDelFlag & IDF_NOTE)
-- if (pItems[j].pCell->GetNotePtr())
-- pItems[j].pCell->DeleteNote();
-+ if (GetNotePtr( pItems[j].pCell ))
-+ pDocument->DeleteNote( pItems[j].pCell );
- ++j;
- }
- }
-@@ -553,7 +558,7 @@
- aHint.SetCell( pOldCell );
- pDocument->Broadcast( aHint );
- pOldCell->ForgetBroadcaster();
-- pOldCell->Delete();
-+ DeleteCell( pOldCell );
- }
-
- delete[] ppDelCells;
-@@ -779,20 +784,20 @@
- {
- pNew = rColumn.CloneCell( i, nInsFlag, pDocument, ScAddress(nCol,(SCROW)nDestRow,nTab) );
-
-- if ( pNew && pNew->GetNotePtr())
-+ if (pNew && GetNotePtr(pNew))
- {
- if((nInsFlag & IDF_NOTE) == 0 )
-- pNew->DeleteNote();
-+ pDocument->DeleteNote( pNew );
- else
- {
- // Set the cell note rectangle dimensions to default position
- // following the paste.
- ScPostIt aCellNote(pDocument);
-- if(pNew->GetNote(aCellNote))
-+ if( GetNote( pNew, aCellNote ) )
- {
- Rectangle aRect = aCellNote.DefaultRectangle(ScAddress(nCol,nDestRow,nTab));
- aCellNote.SetRectangle(aRect);
-- pNew->SetNote(aCellNote);
-+ SetNote( pNew, aCellNote );
- }
- }
- }
-@@ -917,23 +922,21 @@
- // #33224# LeerStrings nicht kopieren
- }
- }
-- if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
-- {
-- // #i52342# the note must be constructed with the destination document pointer
-- ScPostIt aNewNote( *pSource->GetNotePtr(), pDestDoc );
-- pNew->SetNote( aNewNote );
-- }
- }
- }
- break;
- }
-
-- if ( !pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
-- {
-+ // Copy note across ...
-+ const ScPostIt *pNote;
-+ if ( ( nFlags & IDF_NOTE ) && (pNote = GetNotePtr( pSource ) ) )
-+ {
- // #i52342# the note must be constructed with the destination document pointer
-- ScPostIt aNewNote( *pSource->GetNotePtr(), pDestDoc );
-- pNew = new ScNoteCell( aNewNote );
-- }
-+ ScPostIt aNewNote( *pNote, pDestDoc );
-+ if (!pNew)
-+ pNew = new ScNoteCell();
-+ pDestDoc->SetNote( pNew, *pNote );
-+ }
-
- return pNew;
- }
-@@ -1043,9 +1046,7 @@
- if ( bSkipEmpty && bDestEmpty ) // Originalzelle wiederherstellen
- {
- if ( pSrc ) // war da eine Zelle?
-- {
-- pNew = pSrc->Clone( pDocument );
-- }
-+ pNew = CopyCellTo( pSrc, pDocument, pDocument );
- }
- else if ( nFunction ) // wirklich Rechenfunktion angegeben
- {
-@@ -1100,7 +1101,7 @@
- // mit Texten wird nicht gerechnet - immer "alte" Zelle, also pSrc
-
- if (pSrc)
-- pNew = pSrc->Clone( pDocument );
-+ pNew = CopyCellTo( pSrc, pDocument, pDocument );
- else if (pDest)
- bDelete = TRUE;
- }
-@@ -1394,14 +1395,14 @@
- if (Search(nRow, i))
- {
- ScBaseCell* pOldCell = pItems[i].pCell;
-- const ScPostIt* pNote = pOldCell->GetNotePtr();
-+ const ScPostIt* pNote = GetNotePtr( pOldCell );
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- if (pNewCell || pNote || pBC)
- {
- if (!pNewCell)
- pNewCell = new ScNoteCell();
- if (pNote)
-- pNewCell->SetNote(*pNote);
-+ SetNote( pNewCell, *pNote );
- if (pBC)
- {
- pNewCell->SetBroadcaster(pBC);
-@@ -1416,7 +1417,7 @@
- if ( i >= nCount || pItems[i].nRow != nRow )
- Search(nRow, i);
- }
-- pOldCell->Delete();
-+ DeleteCell( pOldCell );
- pItems[i].pCell = pNewCell; // ersetzen
- if ( pNewCell->GetCellType() == CELLTYPE_FORMULA )
- {
-@@ -1493,11 +1494,11 @@
- }
- ScPostIt aCellNote(pDocument);
- // Hide visible notes during Filtering.
-- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
- aCellNote.SetShown(FALSE);
-- pCell->SetNote(aCellNote);
-+ SetNote( pCell, aCellNote );
- }
-
- if ( !rStrings.Insert( pData ) )
-@@ -1658,25 +1659,30 @@
- }
- }
-
--
--void ScColumn::SetNote( SCROW nRow, const ScPostIt& rNote)
-+// Manages the cell magic necessary to create ScNoteCells where necessary
-+ScBaseCell *ScColumn::SetNoteInternal( SCROW nRow, bool bEmpty )
- {
-- BOOL bEmpty = rNote.IsEmpty();
-+ ScBaseCell* pCell = NULL;
-
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- {
-- ScBaseCell* pCell = pItems[nIndex].pCell;
-+ pCell = pItems[nIndex].pCell;
- if (bEmpty && pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetBroadcaster())
-+ {
- DeleteAtIndex(nIndex);
-- else
-- pCell->SetNote(rNote);
-+ pCell = NULL;
-+ }
- }
- else
- {
- if (!bEmpty)
-- Insert(nRow, new ScNoteCell(rNote, pDocument));
-+ {
-+ pCell = new ScNoteCell();
-+ Insert(nRow, pCell);
-+ }
- }
-+ return pCell;
- }
-
-
-@@ -1762,19 +1768,19 @@
- rFormula.Erase();
- }
-
--
-+#if 0
- BOOL ScColumn::GetNote( SCROW nRow, ScPostIt& rNote) const
- {
- BOOL bHasNote = FALSE;
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
-- bHasNote = pItems[nIndex].pCell->GetNote(rNote);
-+ bHasNote = pItems[nIndex].pCell->GetNote(rNote, pDocument);
- else
- rNote.Clear();
-
- return bHasNote;
- }
--
-+#endif
-
- CellType ScColumn::GetCellType( SCROW nRow ) const
- {
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/column.cxx sc/source/core/data/column.cxx
---- sc-pristine/source/core/data/column.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/column.cxx 2006-08-17 16:52:23.000000000 +0100
-@@ -65,11 +65,6 @@
- // STATIC DATA -----------------------------------------------------------
-
-
--inline BOOL CellVisible( const ScBaseCell* pCell ) //! an Zelle verschieben
--{
-- return ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() );
--}
--
- inline BOOL IsAmbiguousScriptNonZero( BYTE nScript )
- {
- //! move to a header file
-@@ -81,7 +76,6 @@
-
- // -----------------------------------------------------------------------------------------
-
--
- ScColumn::ScColumn() :
- nCol( 0 ),
- nCount( 0 ),
-@@ -108,6 +102,49 @@
- pAttrArray = new ScAttrArray( nCol, nTab, pDocument );
- }
-
-+const ScPostIt* ScColumn::GetNotePtr( const ScBaseCell* pCell ) const
-+{
-+ return pDocument->GetNotePtr( pCell );
-+}
-+
-+bool ScColumn::GetNote( const ScBaseCell* pCell, ScPostIt &rNote )
-+{
-+ const ScPostIt *pNote;
-+ if (! ( pNote = GetNotePtr( pCell ) ) )
-+ return false;
-+ rNote = *pNote;
-+ return true;
-+}
-+
-+void ScColumn::SetNote( ScBaseCell* pCell, const ScPostIt &rNote )
-+{
-+ pDocument->SetNote( pCell, rNote );
-+}
-+
-+void ScColumn::DeleteCell( ScBaseCell* pCell )
-+{
-+ pDocument->DeleteNote( pCell );
-+ pCell->Delete();
-+}
-+
-+ScBaseCell *ScColumn::CopyCellTo( const ScBaseCell *pCell, const ScDocument *pSrcDoc,
-+ ScDocument *pDestDoc) const
-+{
-+ const ScPostIt *pNote;
-+ ScBaseCell *pNewCell = pCell->Clone( pDestDoc );
-+
-+ if( ( pNote = pSrcDoc->GetNotePtr( pCell ) ) )
-+ pDestDoc->SetNote( pNewCell, *pNote );
-+
-+ return pNewCell;
-+}
-+
-+BOOL ScColumn::CellVisible( const ScBaseCell* pCell, bool bNotesVisible ) const
-+{
-+ return pCell->GetCellType() != CELLTYPE_NOTE
-+ || ( bNotesVisible && GetNotePtr( pCell ) );
-+}
-+
-
- SCsROW ScColumn::GetNextUnprotected( SCROW nRow, BOOL bUp ) const
- {
-@@ -960,17 +997,17 @@
- }
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
-- if(pCell1 && pCell1->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(pCell1 && GetNote( pCell1, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 );
-- aCellNote.SetShown(FALSE);
-- pCell1->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell1, aCellNote );
- }
-- if(pCell2 && pCell2->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(pCell2 && GetNote( pCell2, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 );
-- aCellNote.SetShown(FALSE);
-- pCell2->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell2, aCellNote );
- }
-
- return ;
-@@ -1025,11 +1062,11 @@
- pCell1->ForgetBroadcaster();
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
-- if(pCell1->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell1, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow1 );
-- aCellNote.SetShown(FALSE);
-- pCell1->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell1, aCellNote );
- }
- if ( eType1 == CELLTYPE_FORMULA )
- {
-@@ -1054,11 +1091,11 @@
- pCell2->ForgetBroadcaster();
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
-- if(pCell2->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell2, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow2 );
-- aCellNote.SetShown(FALSE);
-- pCell2->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell2, aCellNote );
- }
- if ( eType2 == CELLTYPE_FORMULA )
- {
-@@ -1084,9 +1121,9 @@
- // Delete nur, wenn es keine neue Zelle gibt (Insert loescht die alte Zelle auch)
- // Notizen muessen aber einzeln geloescht werden, weil Insert sie stehenlaesst
-
-- if ( pCell1 && ( !pNew1 || (pCell1->GetNotePtr() && !pNew1->GetNotePtr()) ) )
-+ if ( pCell1 && ( !pNew1 || ( GetNotePtr( pCell1 ) && !GetNotePtr( pNew1 ) ) ) )
- Delete( nRow1 );
-- if ( pCell2 && ( !pNew2 || (pCell2->GetNotePtr() && !pNew2->GetNotePtr()) ) )
-+ if ( pCell2 && ( !pNew2 || ( GetNotePtr( pCell2 ) && !GetNotePtr( pNew2 ) ) ) )
- Delete( nRow2 );
-
- if (pNew1)
-@@ -1127,17 +1164,17 @@
- ScFormulaCell* pCell2 = (ScFormulaCell*) rCol.pItems[nIndex2].pCell;
- ScPostIt aCellNote(pDocument);
- // Hide the visible note if doing a swap.
-- if(pCell1->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell1, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
-- aCellNote.SetShown(FALSE);
-- pCell1->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell1, aCellNote );
- }
-- if(pCell2->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell2, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( rCol.nCol, nRow );
-- aCellNote.SetShown(FALSE);
-- pCell2->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell2, aCellNote );
- }
- pItems[nIndex1].pCell = pCell2;
- rCol.pItems[nIndex2].pCell = pCell1;
-@@ -1162,11 +1199,11 @@
- {
- ScFormulaCell* pCell = (ScFormulaCell*) pItems[nIndex1].pCell;
- ScPostIt aCellNote(pDocument);
-- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
-- aCellNote.SetShown(FALSE);
-- pCell->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell, aCellNote );
- }
- // Loeschen
- --nCount;
-@@ -1189,11 +1226,11 @@
- {
- ScFormulaCell* pCell = (ScFormulaCell*) rCol.pItems[nIndex2].pCell;
- ScPostIt aCellNote(pDocument);
-- if(pCell->GetNote(aCellNote) && aCellNote.IsShown())
-+ if(GetNote( pCell, aCellNote ) && aCellNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( rCol.nCol, nRow );
-- aCellNote.SetShown(FALSE);
-- pCell->SetNote(aCellNote);
-+ aCellNote.SetShown( FALSE );
-+ SetNote( pCell, aCellNote );
- }
- // Loeschen
- --(rCol.nCount);
-@@ -1362,8 +1399,9 @@
- {
- MoveListeners( *pBC, pDelRows[i] - nSize );
- pCell->SetBroadcaster(NULL);
-- pCell->Delete();
-+ DeleteCell( pCell );
- }
-+ // FIXME: is it correct only to -Delete- cells wiht a broadcaster ?
- }
-
- delete pDelRows;
-@@ -1408,11 +1446,12 @@
- {
- rColumn.Resize( rColumn.GetCellCount() + nBlockCount );
- for (i = nStartIndex; i <= nEndIndex; i++)
-- {
-+ {
- if ( pDocument->RowFiltered( pItems[i].nRow , nTab))
- continue;
-- rColumn.Append(pItems[i].nRow, pItems[i].pCell->Clone(rColumn.pDocument));
-- }
-+ rColumn.Append(pItems[i].nRow,
-+ CopyCellTo( pItems[i].pCell, pDocument, rColumn.pDocument ));
-+ }
- }
- }
-
-@@ -1484,17 +1523,10 @@
- aAdr.SetRow( pItems[i].nRow );
- ScBaseCell* pNew;
- if (bAsLink)
-- {
- pNew = CreateRefCell( rColumn.pDocument, aAdr, i, nFlags );
-- }
- else
-- {
- pNew = CloneCell( i, nFlags, rColumn.pDocument, aAdr );
-
-- if ( pNew && pNew->GetNotePtr() && (nFlags & IDF_NOTE) == 0 )
-- pNew->DeleteNote();
-- }
--
- if (pNew)
- rColumn.Insert(pItems[i].nRow, pNew);
- }
-@@ -1526,10 +1558,8 @@
- SCROW nRow = rPosCol.pItems[nPosIndex].nRow;
- SCSIZE nThisIndex;
- if ( Search( nRow, nThisIndex ) )
-- {
-- ScBaseCell* pNew = pItems[nThisIndex].pCell->Clone(pDestDoc);
-- rDestCol.Insert( nRow, pNew );
-- }
-+ rDestCol.Insert( nRow, CopyCellTo( pItems[nThisIndex].pCell,
-+ pDocument, pDestDoc ) );
- }
-
- // Dummy:
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/dociter.cxx sc/source/core/data/dociter.cxx
---- sc-pristine/source/core/data/dociter.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/dociter.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -737,6 +737,15 @@
- }
- }
-
-+const ScPostIt* ScCellIterator::GetNotePtr()
-+{
-+ ScBaseCell *pCell = GetThis();
-+ if( pCell->IsSpecial() )
-+ return pDoc->GetNotePtr( pCell );
-+ else
-+ return NULL;
-+}
-+
- ScBaseCell* ScCellIterator::GetFirst()
- {
- if ( !ValidTab(nTab) )
-@@ -1601,7 +1610,8 @@
- if ( pCell && IsGreater( nNextCol, nNextRow, nCellCol, nCellRow ) )
- pCell = aCellIter.GetNext( nCellCol, nCellRow );
-
-- while ( pCell && pCell->GetCellType() == CELLTYPE_NOTE && !pCell->GetNotePtr() )
-+ while ( pCell && pCell->GetCellType() == CELLTYPE_NOTE
-+ && !aCellIter.GetDocument()->GetNotePtr( pCell ) )
- pCell = aCellIter.GetNext( nCellCol, nCellRow );
-
- if ( pPattern && IsGreater( nNextCol, nNextRow, nAttrCol2, nAttrRow ) )
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
---- sc-pristine/source/core/data/documen2.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/documen2.cxx 2006-08-17 16:50:25.000000000 +0100
-@@ -286,6 +286,7 @@
- #include "poolhelp.hxx"
- #include "listenercalls.hxx"
- #include "recursionhelper.hxx"
-+#include "notetracker.hxx"
-
- // STATIC DATA -----------------------------------------------------------
-
-@@ -415,6 +416,7 @@
-
- aTrackTimer.SetTimeoutHdl( LINK( this, ScDocument, TrackTimeHdl ) );
- aTrackTimer.SetTimeout( 100 );
-+ pNoteTracker = new ScNoteTracker( this );
- }
-
-
-@@ -581,6 +583,13 @@
- delete pScriptTypeData;
- delete pOtherObjects;
- delete pRecursionHelper;
-+ if (pNoteTracker->aNotes.size())
-+ {
-+ fprintf (stderr, "Hideous leak: %p notes left\n",
-+ pNoteTracker->aNotes.size());
-+ pNoteTracker->dump();
-+ }
-+ delete pNoteTracker;
-
- DBG_ASSERT( !pAutoNameCache, "AutoNameCache still set in dtor" );
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/documen3.cxx sc/source/core/data/documen3.cxx
---- sc-pristine/source/core/data/documen3.cxx 2006-08-16 17:28:38.000000000 +0100
-+++ sc/source/core/data/documen3.cxx 2006-08-18 15:23:54.000000000 +0100
-@@ -1888,7 +1888,8 @@
- {
- if (aCellNote.IsShown())
- ScDetectiveFunc( this, nTab ).HideComment( nCol, nRow );
-- SetNote(nCol,nRow,nTab,ScPostIt(this));
-+ ScPostIt aNote(this); // urk ...
-+ SetNote(nCol,nRow,nTab,aNote);//ScPostIt(this));
- bDoNote = TRUE;
- }
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/document.cxx sc/source/core/data/document.cxx
---- sc-pristine/source/core/data/document.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/document.cxx 2006-08-21 16:06:26.000000000 +0100
-@@ -105,6 +105,7 @@
- #include <set>
- #endif
- #include "autonamecache.hxx"
-+#include "notetracker.hxx"
-
- struct ScDefaultAttr
- {
-@@ -2119,14 +2120,100 @@
- pTab[nTab]->SetValue( nCol, nRow, rVal );
- }
-
-+void ScDocument::SetNote( ScBaseCell *pCell, const ScPostIt& rNote )
-+{
-+ ScPostIt *pNote;
-+
-+ if (!pCell) {
-+ fprintf (stderr, "evil error - set note on Null\n");
-+// fscanf (stdin, "");
-+ }
-+
-+ if ( rNote.IsEmpty() )
-+ DeleteNote( pCell );
-+
-+ else if ( !pCell->IsSpecial() )
-+ {
-+ pNote = new ScPostIt( rNote, this );
-+ GetNoteTracker()->aNotes[ pCell ] = pNote;
-+ pCell->SetSpecial( TRUE );
-+ }
-+ else
-+ *(GetNoteTracker()->aNotes[ pCell ]) = ScPostIt( rNote, this );
-+
-+ fprintf (stderr, "Doc::SetNote on %p -> ('%s')\n",
-+ pCell, rtl::OUStringToOString( rNote.GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
-+}
-
- void ScDocument::SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote )
- {
-- if (VALIDTAB(nTab))
-- if (pTab[nTab])
-- pTab[nTab]->SetNote( nCol, nRow, rNote );
-+ if ( VALIDTAB(nTab) && pTab[nTab] )
-+ {
-+ ScBaseCell *pCell;
-+ pCell = pTab[nTab]->SetNoteInternal( nCol, nRow,
-+ rNote.IsEmpty() );
-+
-+ fprintf (stderr, "Doc::SetNote on %p at (%d,%d,%d) -> ('%s') (%d)\n",
-+ pCell, nTab, nCol, nRow,
-+ rtl::OUStringToOString( rNote.GetText(), RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rNote.IsEmpty());
-+
-+ if (pCell)
-+ SetNote( pCell, rNote );
-+ else if (!rNote.IsEmpty()) {
-+ fprintf (stderr, "evil error - set note on bogus null\n");
-+// fscanf (stdin, "");
-+ }
-+ }
-+}
-+
-+void ScDocument::DeleteNote( ScBaseCell *pCell )
-+{
-+ if ( !pCell->IsSpecial() )
-+ return;
-+ fprintf (stderr, "Doc::DeleteNote %p\n", pCell );
-+ delete GetNoteTracker()->aNotes[ pCell ];
-+ GetNoteTracker()->aNotes.erase( pCell );
-+ pCell->SetSpecial( false );
-+}
-+
-+const ScPostIt *ScDocument::GetNotePtr( const ScBaseCell* pCell ) const
-+{
-+ if ( !pCell->IsSpecial() )
-+ return NULL;
-+ fprintf (stderr, "Doc::GetNotePtr %p -> %p ('%s')\n",
-+ pCell, GetNoteTracker()->aNotes[ pCell ],
-+ rtl::OUStringToOString( GetNoteTracker()->aNotes[ pCell ]->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
-+ return GetNoteTracker()->aNotes[ pCell ];
-+}
-+
-+ScNoteTracker *ScDocument::GetNoteTracker() const
-+{
-+ return pNoteTracker;
- }
-
-+BOOL ScDocument::GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote ) const
-+{
-+ ScBaseCell *pCell = NULL;
-+ GetCell( nCol, nRow, nTab, pCell );
-+
-+ rNote.Clear();
-+ if( !pCell || !pCell->IsSpecial() )
-+ return FALSE;
-+
-+ ScPostIt *pPostIt = GetNoteTracker()->aNotes[ pCell ];
-+ if (!pPostIt)
-+ {
-+ fprintf( stderr, "Odd special cell %p with no note at s %d c %d r %d\n",
-+ pCell, nTab, nCol, nRow );
-+ return FALSE;
-+ }
-+ rNote = *pPostIt;
-+
-+ fprintf (stderr, "Doc::GetNote on %p -> ('%s')\n",
-+ pCell, rtl::OUStringToOString( rNote.GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
-+ return true;
-+}
-
- void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString )
- {
-@@ -2216,19 +2303,6 @@
- }
-
-
--BOOL ScDocument::GetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt& rNote )
--{
-- BOOL bHasNote = FALSE;
--
-- if ( VALIDTAB(nTab) && pTab[nTab] )
-- bHasNote = pTab[nTab]->GetNote( nCol, nRow, rNote );
-- else
-- rNote.Clear();
--
-- return bHasNote;
--}
--
--
- CellType ScDocument::GetCellType( const ScAddress& rPos ) const
- {
- SCTAB nTab = rPos.Tab();
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/fillinfo.cxx sc/source/core/data/fillinfo.cxx
---- sc-pristine/source/core/data/fillinfo.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/fillinfo.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -326,6 +326,7 @@
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[nArrX];
- pInfo->bEmptyCellText = TRUE;
- pInfo->pCell = NULL;
-+ pInfo->pNote = NULL;
- if (bPaintMarks)
- pInfo->bMarked = ( nX >= nBlockStartX && nX <= nBlockEndX
- && nY >= nBlockStartY && nY <= nBlockEndY );
-@@ -409,6 +410,7 @@
- RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[nArrX];
- pInfo->pCell = pThisCol->pItems[nUIndex].pCell;
-+ pInfo->pNote = GetNotePtr( pInfo->pCell );
- if (pInfo->pCell->GetCellType() != CELLTYPE_NOTE)
- {
- pThisRowInfo->bEmptyText = FALSE; // Zeile nicht leer
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/postit.cxx sc/source/core/data/postit.cxx
---- sc-pristine/source/core/data/postit.cxx 2006-07-21 12:07:51.000000000 +0100
-+++ sc/source/core/data/postit.cxx 2006-08-21 17:30:13.000000000 +0100
-@@ -165,6 +165,21 @@
- {
- }
-
-+#if 0
-+// Not handling the document pointer explicitely is risky
-+ScPostIt::ScPostIt( const ScPostIt &rCopy ) :
-+ mpEditObj( rCopy.mpEditObj ),
-+ mpDoc( rCopy.mpDoc ),
-+ maStrDate( rCopy.maStrDate ),
-+ maStrAuthor( rCopy.maStrAuthor ),
-+ mbShown( rCopy.mbShown ),
-+ maRectangle( rCopy.maRectangle ),
-+ maItemSet( rCopy.maItemSet )
-+{
-+ DBG_ASSERT( true, "ScPostIt: dangerous copy constr." );
-+}
-+#endif
-+
- const ScPostIt& ScPostIt::operator=( const ScPostIt& rCpy )
- {
- mpDoc = rCpy.mpDoc;
-@@ -379,6 +394,9 @@
- {
- SdrPage* pPage = NULL;
- ScDrawLayer* pDrawModel = rDoc.GetDrawLayer();
-+
-+ fprintf (stderr, "InsertObject\n");
-+
- // Copying note cells between documents is one user scenario where the
- // DrawLayer may not exist. Use the ScModelObj() to create
- // and ensure there is a DrawLayer.
-@@ -392,10 +410,13 @@
- pDrawModel= pScModelObj->MakeDrawLayer();
- if(pDrawModel)
- pPage = pDrawModel->GetPage(nTab);
-+ fprintf (stderr, "attempt create model\n");
- }
- else
- pPage = pDrawModel->GetPage(nTab);
-
-+ fprintf (stderr, "InsertObject : %p %p\n", pDrawModel, rDoc.GetDrawLayer());
-+
- if(pPage && pObj)
- {
- if (!bVisible)
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/table2.cxx sc/source/core/data/table2.cxx
---- sc-pristine/source/core/data/table2.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/table2.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -850,11 +850,12 @@
- aCol[nCol].SetValue( nRow, rVal );
- }
-
--
--void ScTable::SetNote( SCCOL nCol, SCROW nRow, const ScPostIt& rNote)
-+ScBaseCell *ScTable::SetNoteInternal( SCCOL nCol, SCROW nRow, bool bEmpty )
- {
-- if (ValidColRow(nCol, nRow))
-- aCol[nCol].SetNote(nRow, rNote);
-+ if (ValidColRow( nCol, nRow ))
-+ return aCol[nCol].SetNoteInternal( nRow, bEmpty );
-+ else
-+ return NULL;
- }
-
-
-@@ -893,7 +894,7 @@
- rFormula.Erase();
- }
-
--
-+/*
- BOOL ScTable::GetNote( SCCOL nCol, SCROW nRow, ScPostIt& rNote)
- {
- BOOL bHasNote = FALSE;
-@@ -905,7 +906,7 @@
-
- return bHasNote;
- }
--
-+*/
-
- CellType ScTable::GetCellType( SCCOL nCol, SCROW nRow ) const
- {
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/data/table6.cxx sc/source/core/data/table6.cxx
---- sc-pristine/source/core/data/table6.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/data/table6.cxx 2006-08-21 14:12:20.000000000 +0100
-@@ -135,11 +135,11 @@
- break;
- case SVX_SEARCHIN_NOTE:
- {
-- ScPostIt aNote(pDocument);
-- if(pCell->GetNote( aNote ))
-+ const ScPostIt *pNote;
-+ if( ( pNote = pDocument->GetNotePtr( pCell ) ) != NULL)
- {
-- aString = aNote.GetText();
-- bMultiLine = ( ((aNote.GetEditTextObject())->GetParagraphCount()) > 1 );
-+ aString = pNote->GetText();
-+ bMultiLine = ( ((pNote->GetEditTextObject())->GetParagraphCount()) > 1 );
- }
- }
- break;
-@@ -253,21 +253,23 @@
- while (bRepeat);
- if (rSearchItem.GetCellType() == SVX_SEARCHIN_NOTE)
- {
-- ScPostIt aNote(pDocument);
-- if(pCell->GetNote( aNote ))
-+ const ScPostIt *pNote;
-+ if ( ( pNote = pDocument->GetNotePtr( pCell ) ) != NULL )
- {
-+ ScPostIt aNote( *pNote, pDocument );
- aNote.SetText( aString );
-
- // if note is visible - hide it to force a refresh of replaced text
- if (aNote.IsShown())
- {
- ScDetectiveFunc( pDocument, nTab ).HideComment( nCol, nRow );
-+#warning Ropey - no idea what's going on ...
- aNote.SetShown(FALSE);
- }
-
- // NB: rich text format is lost.
- // This is also true of Cells.
-- aCol[nCol].SetNote( nRow, aNote );
-+ pDocument->SetNote( nCol, nRow, nTab, aNote );
- }
- }
- else if ( cMatrixFlag != MM_NONE )
-Only in sc/source/core/inc: notetracker.hxx
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/tool/chgtrack.cxx sc/source/core/tool/chgtrack.cxx
---- sc-pristine/source/core/tool/chgtrack.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/tool/chgtrack.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -1929,6 +1929,8 @@
- {
- if ( pCell )
- {
-+ fprintf (stderr, "TESTME: SetValueString destroys note ?\n");
-+ pDoc->DeleteNote( pCell );
- pCell->Delete();
- pCell = NULL;
- }
-@@ -2228,7 +2230,10 @@
- {
- rStr.Erase();
- if ( pCell )
-+ {
-+ pToDoc->DeleteNote( pCell );
- pCell->Delete();
-+ }
- if ( ScChangeActionContent::GetContentCellType( pOrgCell ) )
- {
- pCell = pOrgCell->Clone( pToDoc );
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/core/tool/interpr2.cxx sc/source/core/tool/interpr2.cxx
---- sc-pristine/source/core/tool/interpr2.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/core/tool/interpr2.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -1484,7 +1484,7 @@
- if ( bTempCell )
- {
- if ( bHasNote = (pVCell != NULL) )
-- bHasNote = pVCell->GetNote( aNote );
-+ bHasNote = pDok->GetNotePtr( pVCell ) != NULL;
- fSaveVal = 0.0;
- pVCell = new ScValueCell( fSaveVal );
- pDok->PutCell( aValueAdr, pVCell );
-@@ -1631,9 +1631,10 @@
- }
- if ( bTempCell )
- {
-- if ( bHasNote )
-- pVCell = new ScNoteCell( aNote, pDok );
-- else
-+ if ( bHasNote ) {
-+ pVCell = new ScNoteCell();
-+ pDok->SetNote( pVCell, aNote );
-+ } else
- pVCell = NULL;
- pDok->PutCell( aValueAdr, pVCell );
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/excel/excel.cxx sc/source/filter/excel/excel.cxx
---- sc-pristine/source/filter/excel/excel.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/filter/excel/excel.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -95,7 +95,7 @@
- DBG_ASSERT( pDocument, "::ScImportExcel - no document" );
- if( !pDocument ) return eERR_INTERN; // should not happen
-
--#if SCF_INCL_DUMPER
-+#if 0
- {
- ::scf::dump::xls::Dumper aDumper( rMedium, pDocument->GetDocumentShell() );
- aDumper.Dump();
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/excel/xetable.cxx sc/source/filter/excel/xetable.cxx
---- sc-pristine/source/filter/excel/xetable.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/filter/excel/xetable.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -2146,7 +2146,7 @@
- maRowBfr.AppendCell( xCell );
-
- // notes
-- const ScPostIt* pScNote = pScCell ? pScCell->GetNotePtr() : 0;
-+ const ScPostIt* pScNote = rDoc.GetNotePtr( pScCell );
- if( pScNote || aAddNoteText.Len() )
- mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, aAddNoteText ) );
-
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/xml/XMLChangeTrackingImportHelper.cxx sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
---- sc-pristine/source/filter/xml/XMLChangeTrackingImportHelper.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -98,8 +98,10 @@
-
- ScMyCellInfo::~ScMyCellInfo()
- {
-- if (pCell)
-+/* if (pCell)
- pCell->Delete();
-+*/
-+ fprintf (stderr, "FIXME: PostIt Note leaked");
- }
-
- ScBaseCell* ScMyCellInfo::CreateCell(ScDocument* pDoc)
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/xml/XMLExportIterator.cxx sc/source/filter/xml/XMLExportIterator.cxx
---- sc-pristine/source/filter/xml/XMLExportIterator.cxx 2006-07-21 13:46:39.000000000 +0100
-+++ sc/source/filter/xml/XMLExportIterator.cxx 2006-08-22 16:04:51.000000000 +0100
-@@ -56,6 +56,9 @@
- #ifndef _COM_SUN_STAR_SHEET_XSHEETANNOTATIONSSUPPLIER_HPP_
- #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
- #endif
-+#ifndef _COM_SUN_STAR_SHEET_XSHEETANNOTATIONSHAPESUPPLIER_HPP_
-+#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
-+#endif
- #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #endif
-@@ -738,12 +741,18 @@
- void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell)
- {
- aCell.bHasAnnotation = sal_False;
-+ fprintf( stderr, "HasAnnotation %d, %d (nelems %d) ",
-+ aCell.aCellAddress.Column, aCell.aCellAddress.Row,
-+ aAnnotations.size() );
- if (!aAnnotations.empty())
- {
- ScMyExportAnnotationList::iterator aItr(aAnnotations.begin());
-+ fprintf( stderr, " match %d, %d ? ",
-+ aItr->aCellAddress.Column, aItr->aCellAddress.Row );
- if ((aCell.aCellAddress.Column == aItr->aCellAddress.Column) &&
- (aCell.aCellAddress.Row == aItr->aCellAddress.Row))
- {
-+ fprintf (stderr, "yes");
- aCell.xAnnotation.set(aItr->xAnnotation);
- uno::Reference<text::XSimpleText> xSimpleText(aCell.xAnnotation, uno::UNO_QUERY);
- if (aCell.xAnnotation.is() && xSimpleText.is())
-@@ -754,7 +763,10 @@
- }
- aAnnotations.erase(aItr);
- }
-+ else
-+ fprintf (stderr, "no");
- }
-+ fprintf (stderr, "has annotation %d\n", aCell.bHasAnnotation);
-
- // test - bypass the API
- // if (xCellRange.is())
-@@ -793,6 +805,17 @@
- if (aAnnotation.xAnnotation.is())
- {
- aAnnotation.aCellAddress = aAnnotation.xAnnotation->getPosition();
-+#if 0
-+ uno::Reference<sheet::XSheetAnnotationShapeSupplier> xAnSup(aAnnotation.xAnnotation, uno::UNO_QUERY);
-+ if (xAnSup.is())
-+ {
-+ aAnnotation.xNoteShape = xAnSup->getAnnotationShape();
-+ fprintf (stderr, "Forced drawing layer create [!?]\n");
-+ // Force construction of Drawing Layer & postit layout
-+ (void)aAnnotation.xNoteShape->getPosition();
-+ } else
-+ fprintf (stderr, "Missing xAnSup ptr\n");
-+#endif
- aAnnotations.push_back(aAnnotation);
- }
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
---- sc-pristine/source/filter/xml/xmlexprt.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/filter/xml/xmlexprt.cxx 2006-08-22 16:53:29.000000000 +0100
-@@ -64,6 +64,9 @@
- #ifndef SC_CELLSUNO_HXX
- #include "cellsuno.hxx"
- #endif
-+#ifndef SC_NOTESUNO_HXX
-+#include "notesuno.hxx"
-+#endif
- #ifndef SC_CELL_HXX
- #include "cell.hxx"
- #endif
-@@ -676,6 +679,8 @@
- if (!pSharedData)
- CreateSharedData(nTableCount);
- pCellStyles->AddNewTable(nTableCount - 1);
-+ fprintf (stderr, "ScXMLExport::CollectSharedData::HasDrawPages ? %d\n",
-+ HasDrawPages(xSpreadDoc));
- if (HasDrawPages(xSpreadDoc))
- {
- rtl::OUString sCaptionPoint( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ));
-@@ -683,6 +688,8 @@
- {
- nCurrentTable = nTable;
- uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-+ fprintf (stderr, "ScXMLExport::CollectSharedData::tab %d ? %d\n",
-+ nTable, xDrawPageSupplier.is());
- if (xDrawPageSupplier.is())
- {
- uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
-@@ -765,8 +772,11 @@
- GetProgressBarHelper()->SetValue(0);
- }
-
--void ScXMLExport::CollectShapesAutoStyles(const sal_Int32 nTableCount)
-+void ScXMLExport::CollectShapesAutoStyles(
-+ const uno::Reference<container::XIndexAccess> &xIndex,
-+ const sal_Int32 nTableCount)
- {
-+ fprintf (stderr, "CollectShapesAutoStyles\n");
- pSharedData->SortShapesContainer();
- pSharedData->SortNoteShapes();
- const ScMyShapeList* pShapeList(NULL);
-@@ -776,100 +786,125 @@
- pShapeList = pSharedData->GetShapesContainer()->GetShapes();
- aShapeItr = pShapeList->begin();
- }
-- if (pSharedData->HasDrawPage())
-+
-+ for (SCTAB nTable = 0; nTable < nTableCount; ++nTable)
- {
-- for (SCTAB nTable = 0; nTable < nTableCount; ++nTable)
-+ uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-+ if (!xTable.is())
-+ continue;
-+
-+ /*
-+ * This Cell / Note scanning code may cause the creation of a
-+ * DrawPage, check for that later.
-+ */
-+ uno::Reference<sheet::XSheetAnnotationsSupplier> xSheetAnnotationsSupplier (xTable, uno::UNO_QUERY);
-+ if (xSheetAnnotationsSupplier.is())
- {
-- uno::Reference<drawing::XDrawPage> xDrawPage(pSharedData->GetDrawPage(nTable));
-- uno::Reference<drawing::XShapes> xShapes (xDrawPage, uno::UNO_QUERY);
-+ uno::Reference<container::XEnumerationAccess> xAnnotationAccess (
-+ xSheetAnnotationsSupplier->getAnnotations(), uno::UNO_QUERY);
-+ if (xAnnotationAccess.is())
-+ {
-+ uno::Reference<container::XEnumeration> xAnnotations(xAnnotationAccess->createEnumeration());
-+ if (xAnnotations.is())
-+ {
-+ while (xAnnotations->hasMoreElements())
-+ {
-+ uno::Reference<sheet::XSheetAnnotation> xAnnotation(
-+ xAnnotations->nextElement(), uno::UNO_QUERY);
-+ if (!xAnnotation.is() || xAnnotation->getIsVisible())
-+ continue;
-
-- uno::Reference<drawing::XShapes> xNoteShapes;
-- ::std::vector < uno::Reference < drawing::XShape > > aNoteShapes;
-- ScCellIterator aCellIter( pDoc, 0,0, nTable, MAXCOL,MAXROW, nTable );
-- ScBaseCell* pCell = aCellIter.GetFirst();
-- while (pCell)
-- {
-- const ScPostIt* pScNote = pCell->GetNotePtr();
-- if (pScNote && !pScNote->IsShown())
-- {
-- const SfxItemSet& rSet = pScNote->GetItemSet();
-+ uno::Reference<sheet::XSheetAnnotationShapeSupplier> xAnSup(xAnnotation, uno::UNO_QUERY);
-+ if (!xAnSup.is())
-+ continue;
-
-- // In order to transform the SfxItemSet to an EscherPropertyContainer
-- // and export the properties, we need to recreate the drawing object and
-- // pass this to XclObjComment() for processing.
-- SdrCaptionObj* pCaption = new SdrCaptionObj( pScNote->GetRectangle() );
-- pCaption->SetMergedItemSet(rSet);
-+ uno::Reference < drawing::XShape > xShape(xAnSup->getAnnotationShape(), uno::UNO_QUERY);
-+ if (!xShape.is())
-+ continue;
-
-- if(const EditTextObject* pEditText = pScNote->GetEditTextObject())
-- {
-- OutlinerParaObject* pOPO = new OutlinerParaObject( *pEditText );
-- pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT );
-- pCaption->NbcSetOutlinerParaObject( pOPO );
-- }
-+ fprintf (stderr, "woah ... forced drawing layer create [!?]\n");
-+ // can forces construction of Drawing Layer
-+ (void)xShape->getPosition();
-
-- pScNote->InsertObject(pCaption, *pDoc, aCellIter.GetTab(), sal_False);
-+ ScAddress aCellPos;
-+ table::CellAddress aCellAddress = xAnnotation->getPosition();
-+ ScUnoConversion::FillScAddress( aCellPos, aCellAddress );
-
-- uno::Reference<drawing::XShape> xShape(pCaption->getUnoShape(), uno::UNO_QUERY);
-- if (xShape.is())
-- pSharedData->AddNoteObj(xShape, ScAddress(aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab()));
-- }
-- pCell = aCellIter.GetNext();
-- }
-+ fprintf (stderr, "AddNoteObj!\n");
-+ pSharedData->AddNoteObj( xShape, aCellPos );
-+ GetShapeExport()->collectShapeAutoStyles( xShape );
-+ }
-+ }
-+ }
-+ }
-
-- if (xShapes.is())
-- {
-+ // Now look for sheet shapes NB. re-check for the DrawPage ...
-+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTable, uno::UNO_QUERY);
-+ if (xDrawPageSupplier.is())
-+ {
-+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
-+ uno::Reference<drawing::XShapes> xShapes(xDrawPage, uno::UNO_QUERY);
-+
-+/*
-+ uno::Reference<drawing::XDrawPage> xDrawPage(pSharedData->GetDrawPage(nTable));
-+ uno::Reference<drawing::XShapes> xShapes (xDrawPage, uno::UNO_QUERY);
-+*/
-+
-+ fprintf (stderr, "Sheet shapes... %d\n", xShapes.is());
-+ if (xShapes.is())
-+ {
- GetShapeExport()->seekShapes(xShapes);
- uno::Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, uno::UNO_QUERY );
-- if( xFormsSupplier.is() && xFormsSupplier->hasForms() )
-+ if( xFormsSupplier.is() && xFormsSupplier->hasForms() )
-+ {
-+ GetFormExport()->examineForms(xDrawPage);
-+ pSharedData->SetDrawPageHasForms(nTable, sal_True);
-+ }
-+ ScMyTableShapes* pTableShapes(pSharedData->GetTableShapes());
-+ if (pTableShapes)
-+ {
-+ ScMyTableXShapes::iterator aItr((*pTableShapes)[nTable].begin());
-+ ScMyTableXShapes::iterator aEndItr((*pTableShapes)[nTable].end());
-+ while (aItr != aEndItr)
- {
-- GetFormExport()->examineForms(xDrawPage);
-- pSharedData->SetDrawPageHasForms(nTable, sal_True);
-+ GetShapeExport()->collectShapeAutoStyles(*aItr);
-+ IncrementProgressBar(sal_False);
-+ ++aItr;
- }
-- ScMyTableShapes* pTableShapes(pSharedData->GetTableShapes());
-- if (pTableShapes)
-+ }
-+ if (pShapeList)
-+ {
-+ ScMyShapeList::const_iterator aEndItr(pShapeList->end());
-+ while (aShapeItr != aEndItr && (static_cast<sal_Int32>(aShapeItr->aAddress.Tab()) == nTable))
- {
-- ScMyTableXShapes::iterator aItr((*pTableShapes)[nTable].begin());
-- ScMyTableXShapes::iterator aEndItr((*pTableShapes)[nTable].end());
-- while (aItr != aEndItr)
-- {
-- GetShapeExport()->collectShapeAutoStyles(*aItr);
-- IncrementProgressBar(sal_False);
-- ++aItr;
-- }
-+ GetShapeExport()->collectShapeAutoStyles(aShapeItr->xShape);
-+ IncrementProgressBar(sal_False);
-+ ++aShapeItr;
- }
-- if (pShapeList)
-+ }
-+ const ScMyNoteShapeList* pNoteShapes = NULL;
-+ ScMyNoteShapeList::const_iterator aNoteShapeItr;
-+ ScMyNoteShapeList::const_iterator aNoteShapeEndItr;
-+ if (pSharedData->GetNoteShapes())
-+ {
-+ pNoteShapes = pSharedData->GetNoteShapes()->GetNotes();
-+ if (pNoteShapes)
- {
-- ScMyShapeList::const_iterator aEndItr(pShapeList->end());
-- while (aShapeItr != aEndItr && (static_cast<sal_Int32>(aShapeItr->aAddress.Tab()) == nTable))
-- {
-- GetShapeExport()->collectShapeAutoStyles(aShapeItr->xShape);
-- IncrementProgressBar(sal_False);
-- ++aShapeItr;
-- }
-+ aNoteShapeItr = pNoteShapes->begin();
-+ aNoteShapeEndItr = pNoteShapes->end();
- }
-- const ScMyNoteShapeList* pNoteShapes = NULL;
-- ScMyNoteShapeList::const_iterator aNoteShapeItr;
-- ScMyNoteShapeList::const_iterator aNoteShapeEndItr;
-- if (pSharedData->GetNoteShapes())
-- {
-- pNoteShapes = pSharedData->GetNoteShapes()->GetNotes();
-- if (pNoteShapes)
-- {
-- aNoteShapeItr = pNoteShapes->begin();
-- aNoteShapeEndItr = pNoteShapes->end();
-- }
-- }
-- if (pNoteShapes)
-- {
-- while (aNoteShapeItr != aNoteShapeEndItr)
-- {
-- if (static_cast<sal_Int32>(aNoteShapeItr->aPos.Tab()) == nTable)
-- GetShapeExport()->collectShapeAutoStyles(aNoteShapeItr->xShape);
-- ++aNoteShapeItr;
-- }
-- }
- }
-- }
-+ if (pNoteShapes)
-+ {
-+ while (aNoteShapeItr != aNoteShapeEndItr)
-+ {
-+ if (static_cast<sal_Int32>(aNoteShapeItr->aPos.Tab()) == nTable)
-+ GetShapeExport()->collectShapeAutoStyles(aNoteShapeItr->xShape);
-+ ++aNoteShapeItr;
-+ }
-+ }
-+ }
-+ }
- }
- pSharedData->SortNoteShapes(); // sort twice, because some more shapes are added
- }
-@@ -1801,7 +1836,7 @@
- rtl::OUString SC_NUMBERFORMAT(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT));
- sal_Int32 nTableCount(xIndex->getCount());
- pCellStyles->AddNewTable(nTableCount - 1);
-- CollectShapesAutoStyles(nTableCount);
-+ CollectShapesAutoStyles(xIndex, nTableCount);
- for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
- {
- uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-@@ -2809,7 +2844,13 @@
- pCurrentCell = &rMyCell;
-
- if(rMyCell.xNoteShape.is())
-+ {
-+ fprintf (stderr, "xNoteShape: export ...\n");
- GetShapeExport()->exportShape(rMyCell.xNoteShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL);
-+ } else {
-+ fprintf (stderr, "xNoteShape - is not ...\n");
-+ // URGH !? bug here ...
-+ }
-
- pCurrentCell = NULL;
-
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/filter/xml/xmlexprt.hxx sc/source/filter/xml/xmlexprt.hxx
---- sc-pristine/source/filter/xml/xmlexprt.hxx 2006-01-31 18:37:13.000000000 +0000
-+++ sc/source/filter/xml/xmlexprt.hxx 2006-08-22 15:55:35.000000000 +0100
-@@ -140,7 +140,8 @@
-
- sal_Bool HasDrawPages(com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xDoc);
- void CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCount, const sal_Int32 nCellCount);
-- void CollectShapesAutoStyles(const sal_Int32 nTableCount);
-+ void CollectShapesAutoStyles(const com::sun::star::uno::Reference <com::sun::star::container::XIndexAccess>& xIndex,
-+ const sal_Int32 nTableCount);
- void WriteTablesView(const com::sun::star::uno::Any& aTableView);
- void WriteView(const com::sun::star::uno::Any& aView);
- virtual void _ExportFontDecls();
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/docshell/dbdocfun.cxx sc/source/ui/docshell/dbdocfun.cxx
---- sc-pristine/source/ui/docshell/dbdocfun.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/docshell/dbdocfun.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -1120,7 +1120,7 @@
- ScBaseCell* pCell = aIter.GetFirst();
- while (pCell)
- {
-- if ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() ) // real content?
-+ if ( pCell->GetCellType() != CELLTYPE_NOTE || aIter.GetNotePtr() ) // real content?
- {
- if ( !rExcept.In( ScAddress( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ) ) )
- return FALSE; // cell found
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
---- sc-pristine/source/ui/docshell/docfunc.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/docshell/docfunc.cxx 2006-08-17 14:49:22.000000000 +0100
-@@ -721,6 +721,7 @@
-
- SCTAB* pTabs = NULL;
- ScBaseCell** ppOldCells = NULL;
-+ ScPostIt** ppOldPostIts = NULL;
- BOOL* pHasFormat = NULL;
- ULONG* pOldFormats = NULL;
- ScBaseCell* pDocCell = pDoc->GetCell( rPos );
-@@ -731,6 +732,9 @@
- pTabs[0] = rPos.Tab();
- ppOldCells = new ScBaseCell*[1];
- ppOldCells[0] = pDocCell ? pDocCell->Clone(pDoc) : NULL;
-+ const ScPostIt *pNote = pDocCell ? pDoc->GetNotePtr( pDocCell ) : NULL;
-+ ppOldPostIts = new ScPostIt*[1];
-+ ppOldPostIts[0] = pNote ? new ScPostIt( *pNote, pDoc ) : NULL;
-
- pHasFormat = new BOOL[1];
- pOldFormats = new ULONG[1];
-@@ -752,7 +756,7 @@
- {
- // wegen ChangeTracking darf UndoAction erst nach SetString angelegt werden
- rDocShell.GetUndoManager()->AddUndoAction(new ScUndoEnterData( &rDocShell, rPos.Col(),rPos.Row(),rPos.Tab(), 1,pTabs,
-- ppOldCells, pHasFormat, pOldFormats, rText, NULL ) );
-+ ppOldCells, ppOldPostIts, pHasFormat, pOldFormats, rText, NULL ) );
- }
-
- if ( bEditDeleted || pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
-@@ -770,7 +774,6 @@
-
- BOOL ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi )
- {
--
- ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo (pDoc->IsUndoEnabled());
-@@ -784,6 +787,7 @@
- {
- if (!bApi)
- rDocShell.ErrorMessage(aTester.GetMessageId());
-+ pDoc->DeleteNote( pNewCell );
- pNewCell->Delete();
- return FALSE;
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
---- sc-pristine/source/ui/docshell/docsh.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/docshell/docsh.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -511,7 +511,7 @@
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell && !bFound)
- {
-- if (pCell->GetNotePtr())
-+ if (aCellIter.GetNotePtr())
- bFound = sal_True;
- pCell = aCellIter.GetNext();
- }
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/inc/undocell.hxx sc/source/ui/inc/undocell.hxx
---- sc-pristine/source/ui/inc/undocell.hxx 2005-09-08 23:02:19.000000000 +0100
-+++ sc/source/ui/inc/undocell.hxx 2006-08-17 14:12:27.000000000 +0100
-@@ -91,7 +91,8 @@
- ScUndoEnterData( ScDocShell* pNewDocShell,
- SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
- SCTAB nNewCount, SCTAB* pNewTabs,
-- ScBaseCell** ppOldData, BOOL* pHasForm, ULONG* pOldForm,
-+ ScBaseCell** ppOldData, ScPostIt** ppOldPostIts,
-+ BOOL* pHasForm, ULONG* pOldForm,
- const String& rNewStr, EditTextObject* pObj = NULL );
- virtual ~ScUndoEnterData();
-
-@@ -106,6 +107,7 @@
- String aNewString;
- SCTAB* pTabs;
- ScBaseCell** ppOldCells;
-+ ScPostIt** ppOldPostIts;
- BOOL* pHasFormat;
- ULONG* pOldFormats;
- EditTextObject* pNewEditData;
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/navipi/content.cxx sc/source/ui/navipi/content.cxx
---- sc-pristine/source/ui/navipi/content.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/navipi/content.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -901,7 +901,7 @@
- ScBaseCell* pCell = aIter.GetFirst();
- while (pCell)
- {
-- const ScPostIt* pNote = pCell->GetNotePtr();
-+ const ScPostIt* pNote = aIter.GetNotePtr();
- if (pNote)
- InsertContent( SC_CONTENT_NOTE, lcl_NoteString(*pNote) );
-
-@@ -924,7 +924,7 @@
- ScBaseCell* pCell = aIter.GetFirst();
- while (pCell)
- {
-- const ScPostIt* pNote = pCell->GetNotePtr();
-+ const ScPostIt* pNote = aIter.GetNotePtr();
- if (pNote)
- {
- if (nFound == nIndex)
-@@ -959,7 +959,7 @@
- ScBaseCell* pCell = aIter.GetFirst();
- while (pCell && bEqual)
- {
-- const ScPostIt* pNote = pCell->GetNotePtr();
-+ const ScPostIt* pNote = aIter.GetNotePtr();
- if (pNote)
- {
- if ( !pEntry )
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/undo/undocell.cxx sc/source/ui/undo/undocell.cxx
---- sc-pristine/source/ui/undo/undocell.cxx 2006-07-21 15:26:49.000000000 +0100
-+++ sc/source/ui/undo/undocell.cxx 2006-08-21 14:24:59.000000000 +0100
-@@ -187,7 +187,8 @@
-
- ScUndoEnterData::ScUndoEnterData( ScDocShell* pNewDocShell,
- SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
-- SCTAB nNewCount, SCTAB* pNewTabs, ScBaseCell** ppOldData,
-+ SCTAB nNewCount, SCTAB* pNewTabs,
-+ ScBaseCell** ppOldData, ScPostIt** ppOldPostItData,
- BOOL* pHasForm, ULONG* pOldForm,
- const String& rNewStr, EditTextObject* pObj ) :
- ScSimpleUndo( pNewDocShell ),
-@@ -197,6 +198,7 @@
- nCount( nNewCount ),
- pTabs( pNewTabs ),
- ppOldCells( ppOldData ),
-+ ppOldPostIts( ppOldPostItData ),
- pHasFormat( pHasForm ),
- pOldFormats( pOldForm ),
- aNewString( rNewStr ),
-@@ -210,8 +212,11 @@
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
-
- for (USHORT i=0; i<nCount; i++)
-+ {
- if (ppOldCells[i])
- ppOldCells[i]->Delete();
-+ delete ppOldPostIts[i];
-+ }
- delete[] ppOldCells;
-
- delete[] pHasFormat;
-@@ -289,6 +294,9 @@
- pNewCell = NULL;
- pDoc->PutCell( nCol, nRow, pTabs[i], pNewCell );
-
-+ if ( pNewCell && ppOldPostIts[i] )
-+ pDoc->SetNote( pNewCell, *ppOldPostIts[i] );
-+
- if (pHasFormat && pOldFormats)
- {
- if ( pHasFormat[i] )
-@@ -316,6 +324,8 @@
- {
- BeginRedo();
-
-+ fprintf (stderr, "TESTME: wtf... ScUndoEnterData::Redo()\n");
-+
- ScDocument* pDoc = pDocShell->GetDocument();
- for (USHORT i=0; i<nCount; i++)
- {
-@@ -917,8 +927,8 @@
- const ScPostIt& rOld, const ScPostIt& rNew ) :
- ScSimpleUndo( pNewDocShell ),
- aPos ( rNewPos ),
-- aOldNote ( rOld ),
-- aNewNote ( rNew )
-+ aOldNote ( rOld, rOld.GetDocument() ),
-+ aNewNote ( rNew, rNew.GetDocument() )
- {
- }
-
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/unoobj/cellsuno.cxx sc/source/ui/unoobj/cellsuno.cxx
---- sc-pristine/source/ui/unoobj/cellsuno.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/unoobj/cellsuno.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -3430,7 +3430,7 @@
- while (pCell)
- {
- // Notizen zaehlen als nicht-leer
-- if ( pCell->GetCellType() != CELLTYPE_NOTE || pCell->GetNotePtr() )
-+ if ( pCell->GetCellType() != CELLTYPE_NOTE || aIter.GetNotePtr() )
- aMarkData.SetMultiMarkArea(
- ScRange( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ),
- FALSE );
-@@ -3472,7 +3472,7 @@
- while (pCell)
- {
- BOOL bAdd = FALSE;
-- if ( pCell->GetNotePtr() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
-+ if ( aIter.GetNotePtr() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
- bAdd = TRUE;
- else
- switch ( pCell->GetCellType() )
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
---- sc-pristine/source/ui/unoobj/docuno.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/unoobj/docuno.cxx 2006-08-22 16:09:20.000000000 +0100
-@@ -1469,6 +1469,8 @@
- }
- else if ( aString.EqualsAscii( SC_UNO_HASDRAWPAGES ) )
- {
-+ fprintf (stderr, "get prop 'HasDrawPages: %d'\n",
-+ pDocShell->GetDocument()->GetDrawLayer() != 0);
- ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument()->GetDrawLayer() != 0) );
- }
- else if ( aString.EqualsAscii( SC_UNO_BASICLIBRARIES ) )
-@@ -2778,10 +2780,11 @@
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
- {
-- if (pCell->GetNotePtr())
-+ if (pDoc->GetNotePtr( pCell ))
- {
- if (nFound == nIndex)
- {
-+ fprintf (stderr, "ScAnnotationsObj::getbyindex(%d) found\n", nFound);
- rPos = ScAddress( aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab() );
- return TRUE;
- }
-@@ -2790,6 +2793,7 @@
- pCell = aCellIter.GetNext();
- }
- }
-+ fprintf (stderr, "ScAnnotationsObj::getbyindex(%d) not found\n", nIndex);
- return FALSE; // nicht gefunden
- }
-
-@@ -2859,15 +2863,19 @@
- if (pDocShell)
- {
- ScDocument* pDoc = pDocShell->GetDocument();
-- ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
-- ScBaseCell* pCell = aCellIter.GetFirst();
-- while (pCell)
-- {
-- if (pCell->GetNotePtr())
-- ++nCount;
-- pCell = aCellIter.GetNext();
-+ if (1) // pDoc->GetNoteTracker()->aNotes.size())
-+ { /* FIXME: iterate over the note tracker instead ... (way faster) */
-+ ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
-+ ScBaseCell* pCell = aCellIter.GetFirst();
-+ while (pCell)
-+ {
-+ if (aCellIter.GetNotePtr())
-+ ++nCount;
-+ pCell = aCellIter.GetNext();
-+ }
- }
- }
-+ fprintf (stderr, "ScAnnotationsObj::getCount -> %d\n", nCount);
- return nCount;
- }
-
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/view/output.cxx sc/source/ui/view/output.cxx
---- sc-pristine/source/ui/view/output.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/view/output.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -2236,7 +2236,7 @@
- // use origin's pCell for NotePtr test below
- }
-
-- if ( pCell && pCell->GetNotePtr() && ( bIsMerged ||
-+ if ( pCell && pInfo->pNote && ( bIsMerged ||
- ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
- {
- if (bFirst)
-@@ -2264,7 +2264,11 @@
- }
- }
- if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
-+ {
-+ fprintf (stderr, "Render note mark %p size %d\n", pInfo->pNote,
-+ sizeof (CellInfo));
- pDev->DrawRect( Rectangle( nMarkX,nPosY,nMarkX+2*nLayoutSign,nPosY+2 ) );
-+ }
- }
-
- nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
-@@ -2314,7 +2318,7 @@
- // use origin's pCell for NotePtr test below
- }
-
-- if ( pCell && pCell->GetNotePtr() && ( bIsMerged ||
-+ if ( pCell && pInfo->pNote && ( bIsMerged ||
- ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
- {
- long nNoteWidth = (long)( SC_CLIPMARK_SIZE * nPPTX );
-@@ -2334,7 +2338,6 @@
- if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
- {
- Rectangle aNoteRect( nMarkX, nPosY, nMarkX+nNoteWidth*nLayoutSign, nPosY+nNoteHeight );
-- const ScPostIt* pNote = pCell->GetNotePtr();
-
- // Note title is the cell address (as on printed note pages)
- String aTitle;
-@@ -2342,7 +2345,7 @@
- aAddress.Format( aTitle, SCA_VALID, pDoc );
-
- // Content has to be a simple string without line breaks
-- String aContent = pNote->GetText();
-+ String aContent = pInfo->pNote->GetText();
- aContent.ConvertLineEnd(LINEEND_LF);
- xub_StrLen nPos;
- while ( (nPos=aContent.Search('\n')) != STRING_NOTFOUND )
-@@ -2395,7 +2398,7 @@
- {
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
- ScBaseCell* pCell = pInfo->pCell;
-- if ( pCell && pCell->GetNotePtr() ) // auch verdeckte wegen der Numerierung
-+ if ( pCell && pInfo->pNote ) // auch verdeckte wegen der Numerierung
- {
- aStr = String::CreateFromInt32( lcl_FindInList( rPosList,
- ScAddress( nX, pThisRowInfo->nRowNo, nTab)));
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/view/prevwsh.cxx sc/source/ui/view/prevwsh.cxx
---- sc-pristine/source/ui/view/prevwsh.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/view/prevwsh.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -928,7 +928,7 @@
- if (pAccessibilityBroadcaster)
- rObject.EndListening( *pAccessibilityBroadcaster );
- else
-- DBG_ERROR("kein Accessibility-Broadcaster??!?");
-+ DBG_ERROR("kein Accessibility-Broadcaster?!?");
- }
-
- void ScPreviewShell::BroadcastAccessibility( const SfxHint &rHint )
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/view/printfun.cxx sc/source/ui/view/printfun.cxx
---- sc-pristine/source/ui/view/printfun.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/view/printfun.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -1979,8 +1979,8 @@
- if (pPos)
- {
- ScBaseCell* pCell = pDoc->GetCell( *pPos);
-- const ScPostIt* pNote = pCell->GetNotePtr();
-- if (pNote)
-+ const ScPostIt* pNote = pDoc->GetNotePtr( pCell );
-+ if( pNote )
- {
- if(const EditTextObject *pEditText = pNote->GetEditTextObject())
- pEditEngine->SetText(*pEditText);
-@@ -2625,7 +2625,7 @@
- ScBaseCell* pCell = aIter.GetNext( nCol, nRow );
- while (pCell)
- {
-- if (pCell->GetNotePtr())
-+ if ( pDoc->GetNotePtr( pCell ) )
- {
- aNotePosList.Insert( new ScAddress( nCol,nRow,nPrintTab ), LIST_APPEND );
- ++nCount;
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/view/tabvwshh.cxx sc/source/ui/view/tabvwshh.cxx
---- sc-pristine/source/ui/view/tabvwshh.cxx 2006-08-17 14:01:43.000000000 +0100
-+++ sc/source/ui/view/tabvwshh.cxx 2006-08-17 14:06:13.000000000 +0100
-@@ -259,7 +259,7 @@
- pDoc->RemoveUnoObject(rObject);
- }
- else
-- DBG_ERROR("kein Accessibility-Broadcaster??!?");
-+ DBG_ERROR("kein Accessibility-Broadcaster?!?");
- }
-
- void ScTabViewShell::BroadcastAccessibility( const SfxHint &rHint )
-diff -x unxlngi6.pro -x '*~' -x '*.orig' -u -r sc-pristine/source/ui/view/viewfunc.cxx sc/source/ui/view/viewfunc.cxx
---- sc-pristine/source/ui/view/viewfunc.cxx 2006-08-16 17:28:38.000000000 +0100
-+++ sc/source/ui/view/viewfunc.cxx 2006-08-17 14:45:42.000000000 +0100
-@@ -370,6 +370,7 @@
- BYTE nOldScript = 0;
-
- ScBaseCell** ppOldCells = NULL;
-+ ScPostIt** ppOldPostIts = NULL;
- BOOL* pHasFormat = NULL;
- ULONG* pOldFormats = NULL;
- SCTAB* pTabs = NULL;
-@@ -377,6 +378,7 @@
- if ( bRecord )
- {
- ppOldCells = new ScBaseCell*[nSelCount];
-+ ppOldPostIts = new ScPostIt*[nSelCount];
- pHasFormat = new BOOL[nSelCount];
- pOldFormats = new ULONG[nSelCount];
- pTabs = new SCTAB[nSelCount];
-@@ -390,6 +392,9 @@
- pDoc->GetCell( nCol, nRow, i, pDocCell );
- if ( pDocCell )
- {
-+ const ScPostIt *pNote = pDoc->GetNotePtr( pDocCell );
-+ ppOldPostIts[nUndoPos] = pNote ? new ScPostIt( *pNote, pDoc ) : NULL;
-+
- ppOldCells[nUndoPos] = pDocCell->Clone(pDoc);
- if ( pDocCell->GetCellType() == CELLTYPE_EDIT )
- bEditDeleted = TRUE;
-@@ -403,6 +408,7 @@
- else
- {
- ppOldCells[nUndoPos] = NULL;
-+ ppOldPostIts[nUndoPos] = NULL;
- }
-
- const SfxPoolItem* pItem;
-@@ -599,7 +605,7 @@
- { // wg. ChangeTrack erst jetzt
- pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nUndoPos, pTabs,
-- ppOldCells, pHasFormat, pOldFormats,
-+ ppOldCells, ppOldPostIts, pHasFormat, pOldFormats,
- rString, NULL ) );
- }
-
-@@ -732,13 +738,15 @@
- SCTAB nTabCount = pDoc->GetTableCount();
- SCTAB nSelCount = rMark.GetSelectCount();
- SCTAB i;
-- ScBaseCell** ppOldCells = NULL;
-+ ScBaseCell** ppOldCells = NULL;
-+ ScPostIt** ppOldPostIts = NULL;
- SCTAB* pTabs = NULL;
- SCTAB nPos = 0;
- EditTextObject* pUndoData = NULL;
- if (bRecord && !bSimple)
- {
- ppOldCells = new ScBaseCell*[nSelCount];
-+ ppOldPostIts = new ScPostIt*[nSelCount];
- pTabs = new SCTAB[nSelCount];
- nPos = 0;
-
-@@ -749,9 +757,16 @@
- ScBaseCell* pDocCell;
- pDoc->GetCell( nCol, nRow, i, pDocCell );
- if ( pDocCell )
-+ {
-+ const ScPostIt *pNote = pDoc->GetNotePtr( pDocCell );
-+ ppOldPostIts[nPos] = pNote ? new ScPostIt( *pNote, pDoc ) : NULL;
- ppOldCells[nPos] = pDocCell->Clone( pDoc );
-+ }
- else
-+ {
- ppOldCells[nPos] = NULL;
-+ ppOldPostIts[nPos] = NULL;
-+ }
- ++nPos;
- }
-
-@@ -784,7 +799,7 @@
- { // wg. ChangeTrack erst jetzt
- pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nPos, pTabs,
-- ppOldCells, NULL, NULL, String(),
-+ ppOldCells, ppOldPostIts, NULL, NULL, String(),
- pUndoData ) );
- }
-
---- /dev/null 2006-06-16 14:07:58.000000000 +0100
-+++ sc/source/core/inc/notetracker.hxx 2006-08-17 16:49:50.000000000 +0100
-@@ -0,0 +1,28 @@
-+#ifndef _SC_NOTE_TRACKER
-+#define _SC_NOTE_TRACKER
-+
-+#include <hash_map>
-+
-+class ScNoteTracker
-+{
-+ struct foo
-+ {
-+ size_t operator () (const ScBaseCell *cell) const
-+ { return (size_t) cell; }
-+ };
-+
-+public:
-+ std::hash_map< const ScBaseCell *, ScPostIt *, foo > aNotes;
-+ ScNoteTracker( ScDocument *pDoc ) { aNotes.clear(); }
-+ void dump()
-+ {
-+ std::hash_map< const ScBaseCell *, ScPostIt *, foo >::const_iterator aIter;
-+ for (aIter = aNotes.begin(); aIter != aNotes.end(); aIter++)
-+ fprintf (stderr, "Cell %p -> note '%s'\n",
-+ aIter->first,
-+ rtl::OUStringToOString( aIter->second->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
-+ }
-+};
-+
-+
-+#endif // _SC_NOTE_TRACKER
diff --git a/patches/test/sc-sheet-name-disallow-dos-chars.diff b/patches/test/sc-sheet-name-disallow-dos-chars.diff
deleted file mode 100644
index be611ebe1..000000000
--- a/patches/test/sc-sheet-name-disallow-dos-chars.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
-index b3d0607..372fb72 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -193,7 +193,34 @@ BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
-
- BOOL ScDocument::ValidTabName( const String& rName ) const
- {
-- return rName.Len() > 0;
-+ xub_StrLen nLen = rName.Len();
-+ if (!nLen)
-+ return false;
-+
-+ for (xub_StrLen i = 0; i < nLen; ++i)
-+ {
-+ const sal_Unicode c = rName.GetChar(i);
-+ switch (c)
-+ {
-+ case ':':
-+ case '\\':
-+ case '/':
-+ case '?':
-+ case '*':
-+ case '[':
-+ case ']':
-+ // these characters are not allowed to match XL's convention.
-+ return false;
-+ case '\'':
-+ if (i == 0 || i == nLen - 1)
-+ // single quote is not allowed at the first or last
-+ // character position.
-+ return false;
-+ break;
-+ }
-+ }
-+
-+ return true;
- }
-
-
diff --git a/patches/test/sc-source-filter-ecma-ecma-cxx.diff b/patches/test/sc-source-filter-ecma-ecma-cxx.diff
deleted file mode 100644
index 1e33f2968..000000000
--- a/patches/test/sc-source-filter-ecma-ecma-cxx.diff
+++ /dev/null
@@ -1,318 +0,0 @@
---- /dev/null
-+++ sc/source/filter/ecma/ecma.cxx
-@@ -0,0 +1,315 @@
-+#include <sal/config.h>
-+#include <stdio.h>
-+#include <sfx2/docfile.hxx>
-+
-+#include "global.hxx"
-+#include "docpool.hxx"
-+#include "patattr.hxx"
-+#include "document.hxx"
-+#include "cell.hxx"
-+#include "biff.hxx"
-+#include <tools/stream.hxx>
-+#include <com/sun/star/embed/ElementModes.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <comphelper/processfactory.hxx>
-+#include <unotools/streamwrap.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <parsebase.hxx>
-+
-+#define SCHEMA_OFFICEDOCUMENT "http://schemas.microsoft.com/office/2006/relationships/officeDocument"
-+
-+using namespace com::sun::star;
-+
-+namespace {
-+ inline rtl::OUString getBase (const rtl::OUString &rPath)
-+ {
-+ return rtl::OUString (rPath.copy (0, rPath.lastIndexOf('/')));
-+ }
-+ inline rtl::OUString getSuffix (const rtl::OUString &rPath)
-+ {
-+ return rtl::OUString (rPath.copy (rPath.lastIndexOf('/') + 1));
-+ }
-+};
-+
-+class ScECMAParseRel : public ScECMAParseBase
-+{
-+ struct Rel {
-+ rtl::OUString m_aId;
-+ rtl::OUString m_aType;
-+ rtl::OUString m_aTarget;
-+ };
-+ std::list<Rel> m_aRels;
-+ public:
-+ ScECMAParseRel() :
-+ ScECMAParseBase(),
-+ m_aRels()
-+ {
-+ }
-+ virtual ~ScECMAParseRel() {}
-+
-+ rtl::OUString getDocument()
-+ {
-+ std::list<Rel>::const_iterator iter;
-+ for (iter = m_aRels.begin(); iter != m_aRels.end(); iter++)
-+ {
-+ if (iter->m_aType.equalsAscii(SCHEMA_OFFICEDOCUMENT))
-+ return iter->m_aTarget;
-+ }
-+ return rtl::OUString();
-+ }
-+ rtl::OUString getTargetById(const rtl::OUString &rId)
-+ {
-+ std::list<Rel>::const_iterator iter;
-+ for (iter = m_aRels.begin(); iter != m_aRels.end(); iter++)
-+ {
-+ if (iter->m_aId == rId)
-+ return iter->m_aTarget;
-+ }
-+ return rtl::OUString();
-+ }
-+ // rStreamPath is the stream for which to read the rels
-+ FltError parseRels(const css::uno::Reference<css::lang::XMultiServiceFactory> &xServiceFactory,
-+ const css::uno::Reference<css::embed::XStorage> &xStorage,
-+ const rtl::OUString &rStreamPath)
-+ {
-+ return doParse(xServiceFactory, xStorage,
-+ getBase (rStreamPath) + rtl::OUString::createFromAscii("/_rels/")
-+ + getSuffix (rStreamPath) + rtl::OUString::createFromAscii(".rels"));
-+ }
-+ virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ fprintf (stderr, "startElement '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
-+ if (aName.equalsAscii ("Relationship"))
-+ {
-+ Rel aRel;
-+ aRel.m_aId = xAttribs->getValueByName(rtl::OUString::createFromAscii("Id"));
-+ aRel.m_aType = xAttribs->getValueByName(rtl::OUString::createFromAscii("Type"));
-+ aRel.m_aTarget = xAttribs->getValueByName(rtl::OUString::createFromAscii("Target"));
-+ m_aRels.push_back (aRel);
-+ }
-+ }
-+};
-+
-+class ScECMAParseContentTypes : public ScECMAParseBase
-+{
-+ struct Override {
-+ rtl::OUString m_aPartName;
-+ rtl::OUString m_aType;
-+ };
-+ struct Default {
-+ rtl::OUString m_aExtension;
-+ rtl::OUString m_aType;
-+ };
-+ std::list<Default> m_aDefaults;
-+ std::list<Override> m_aOverrides;
-+ public:
-+ ScECMAParseContentTypes() :
-+ ScECMAParseBase(),
-+ m_aDefaults(),
-+ m_aOverrides()
-+ {
-+ }
-+ virtual ~ScECMAParseContentTypes() {}
-+ rtl::OUString getType (const rtl::OUString &aPath)
-+ { // FIXME: implement me
-+ return rtl::OUString();
-+ }
-+ virtual void SAL_CALL startElement (const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ fprintf (stderr, "startElement '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
-+ }
-+};
-+
-+class ScECMAParseSheet : public ScECMAParseBase
-+{
-+ css::uno::Reference<css::lang::XMultiServiceFactory> m_xServiceFactory;
-+ css::uno::Reference<css::embed::XStorage> m_xStorage;
-+ ScDocument *m_pDoc;
-+ SCTAB m_nTab;
-+
-+ rtl::OUString m_aBasePath;
-+ uno::Reference<ScECMAParseRel> m_xRels;
-+
-+ // Cell reading
-+ rtl::OUString m_aContent;
-+ ScAddress m_aAddr;
-+ rtl::OUString m_aType;
-+ public:
-+ ScECMAParseSheet(const css::uno::Reference<css::lang::XMultiServiceFactory> &xServiceFactory,
-+ const css::uno::Reference<css::embed::XStorage> &xStorage,
-+ ScDocument *pDoc,
-+ SCTAB nTab) :
-+ ScECMAParseBase(),
-+ m_xServiceFactory(xServiceFactory),
-+ m_xStorage(xStorage),
-+ m_pDoc(pDoc),
-+ m_nTab(nTab),
-+ m_xRels(),
-+ m_aContent(),
-+ m_aAddr(0, 0, nTab)
-+ {
-+ }
-+ virtual ~ScECMAParseSheet() {}
-+ void parseSheet (const rtl::OUString &rStreamPath)
-+ {
-+ doParse (m_xServiceFactory, m_xStorage, rStreamPath);
-+ }
-+ virtual void SAL_CALL startElement (const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ fprintf (stderr, "startElement '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
-+ if (aName.equalsAscii("c"))
-+ {
-+ m_aAddr.Parse(xAttribs->getValueByName(rtl::OUString::createFromAscii("r")));
-+ m_aType = xAttribs->getValueByName(rtl::OUString::createFromAscii("t"));
-+ if (!m_aType.getLength()) // nice & slow
-+ m_aType = rtl::OUString::createFromAscii("n");
-+ }
-+ }
-+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ if (aName.equalsAscii("c"))
-+ m_pDoc->PutCell( m_aAddr, new ScStringCell( m_aContent ), (BOOL) TRUE );
-+ }
-+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ m_aContent = aChars;
-+ }
-+};
-+
-+class ScECMAParseWorkbook : public ScECMAParseBase
-+{
-+ css::uno::Reference<css::lang::XMultiServiceFactory> m_xServiceFactory;
-+ css::uno::Reference<css::embed::XStorage> m_xStorage;
-+ ScDocument *m_pDoc;
-+
-+ rtl::OUString m_aBasePath;
-+ uno::Reference<ScECMAParseRel> m_xRels;
-+ public:
-+ ScECMAParseWorkbook(const css::uno::Reference<css::lang::XMultiServiceFactory> &xServiceFactory,
-+ const css::uno::Reference<css::embed::XStorage> &xStorage,
-+ ScDocument *pDoc) :
-+ ScECMAParseBase(),
-+ m_xServiceFactory(xServiceFactory),
-+ m_xStorage(xStorage),
-+ m_pDoc(pDoc),
-+ m_aBasePath(),
-+ m_xRels(new ScECMAParseRel())
-+ {
-+ }
-+ virtual ~ScECMAParseWorkbook() {}
-+
-+ FltError parseWorkbook(const rtl::OUString &rStreamPath)
-+ {
-+ FltError nErr;
-+ nErr = m_xRels->parseRels (m_xServiceFactory, m_xStorage, rStreamPath);
-+ if (nErr != eERR_OK)
-+ return nErr;
-+ m_aBasePath = getBase (rStreamPath) + rtl::OUString::createFromAscii ("/");
-+ return doParse (m_xServiceFactory, m_xStorage, rStreamPath);
-+ }
-+
-+ virtual void SAL_CALL startElement (const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+ {
-+ // FIXME: yes - a validation needed: workbook/sheets/sheet
-+ if (aName.equalsAscii("sheet"))
-+ {
-+ // <sheet name="Sheet1" tabId="1" r:id="rId1"/>
-+ sal_Int32 nTabId = xAttribs->getValueByName(rtl::OUString::createFromAscii("tabId")).toInt32();
-+ // FIXME: hideous lack of namespace handling / hardcoding ! ...
-+ rtl::OUString aTarget = m_xRels->getTargetById (
-+ xAttribs->getValueByName(rtl::OUString::createFromAscii("r:id")));
-+ rtl::OUString aName = m_xRels->getTargetById (
-+ xAttribs->getValueByName(rtl::OUString::createFromAscii("name")));
-+ // FIXME: why have a 'name' here ? ... is that the user-visible name ?
-+ fprintf (stderr, "Sheet %d '%s'\n", nTabId,
-+ rtl::OUStringToOString(m_aBasePath + aTarget, RTL_TEXTENCODING_UTF8).getStr());
-+ // FIXME: WTF do we have to deal with an 'nTabId' instead of a pointer ?
-+ m_pDoc->InsertTab (nTabId, aName);
-+ SCTAB nTab;
-+// if (!m_pDoc->GetTable (aName, nTab))
-+// fprintf (stderr, "Failed to create sheet\n");
-+// else
-+ {
-+ uno::Reference<ScECMAParseSheet> xSheet = new
-+ ScECMAParseSheet(m_xServiceFactory, m_xStorage, m_pDoc, nTabId);
-+ xSheet->parseSheet (m_aBasePath + aTarget);
-+ }
-+ }
-+ }
-+};
-+
-+static void
-+recursiveDump (uno::Reference < embed::XStorage > xStorage, int nDepth = 0)
-+{
-+ uno::Reference< container::XNameAccess > xName ( xStorage, uno::UNO_QUERY );
-+ if (!xName.is())
-+ return;
-+ uno::Sequence<rtl::OUString> aElements = xName->getElementNames();
-+ for (int i = 0; i < aElements.getLength(); i++)
-+ {
-+ bool isDir = xStorage->isStorageElement(aElements[i]);
-+ for (int j = 0; j < nDepth; j++)
-+ fprintf (stderr, "\t");
-+ fprintf (stderr, "Item '%s' (%s)\n",
-+ rtl::OUStringToOString (aElements[i], RTL_TEXTENCODING_UTF8).getStr(),
-+ isDir ? "storage" : "stream");
-+ if (isDir)
-+ {
-+ uno::Reference < embed::XStorage > xSubStor;
-+ xSubStor = xStorage->openStorageElement (aElements[i],
-+ embed::ElementModes::READ);
-+ recursiveDump (xSubStor, nDepth+1);
-+ }
-+ }
-+}
-+
-+FltError ScImportECMA( SfxMedium &rMedium, ScDocument *pDoc )
-+{
-+ fprintf (stderr, "ScImportECMA\n");
-+
-+ uno::Reference < embed::XStorage > xStorage;
-+
-+ FltError eRet = eERR_OK;
-+
-+ xStorage = rMedium.GetStorage();
-+ if ( !xStorage.is() )
-+ {
-+ fprintf (stderr, "No storage!\n");
-+ return eERR_OPEN;
-+ }
-+
-+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory =
-+ ::comphelper::getProcessServiceFactory();
-+
-+ // Common doc bits
-+ uno::Reference<ScECMAParseContentTypes> xTypes = new ScECMAParseContentTypes();
-+ xTypes->doParse(xServiceFactory, xStorage,
-+ rtl::OUString::createFromAscii("[Content_Types].xml"));
-+ // Dump the contents: FIXME: dump the types from Content_Types.xml etc.
-+ recursiveDump (xStorage);
-+
-+ uno::Reference<ScECMAParseRel> xRootRel = new ScECMAParseRel();
-+ xRootRel->parseRels (xServiceFactory, xStorage,
-+ rtl::OUString::createFromAscii(""));
-+
-+ // XL specific foo
-+ fprintf (stderr, "The doc path is: '%s'\n",
-+ rtl::OUStringToOString(xRootRel->getDocument(), RTL_TEXTENCODING_UTF8).getStr());
-+
-+ uno::Reference<ScECMAParseWorkbook> xWorkbook = new ScECMAParseWorkbook(xServiceFactory, xStorage, pDoc);
-+ xWorkbook->parseWorkbook (xRootRel->getDocument());
-+
-+ pDoc->CalcAfterLoad();
-+
-+ return eRet;
-+}
diff --git a/patches/test/sc-source-filter-ecma-parsebase-cxx.diff b/patches/test/sc-source-filter-ecma-parsebase-cxx.diff
deleted file mode 100644
index 192ce818a..000000000
--- a/patches/test/sc-source-filter-ecma-parsebase-cxx.diff
+++ /dev/null
@@ -1,113 +0,0 @@
---- /dev/null
-+++ sc/source/filter/ecma/parsebase.cxx
-@@ -0,0 +1,110 @@
-+#include <stdio.h>
-+#include <list>
-+#include <com/sun/star/xml/sax/XParser.hpp>
-+#include <com/sun/star/xml/sax/InputSource.hpp>
-+#include <com/sun/star/xml/sax/SAXParseException.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+#include <parsebase.hxx>
-+#include <unotools/streamwrap.hxx>
-+
-+using namespace com::sun::star;
-+
-+class ScPathRefHolder
-+{
-+ std::list< uno::Reference<embed::XStorage> > m_aUgly;
-+ uno::Reference<io::XStream> m_xRef;
-+ public:
-+ ScPathRefHolder(uno::Reference<embed::XStorage> xStorage,
-+ rtl::OUString aPath, long nOpenMode)
-+ {
-+ rtl::OUString aTok;
-+ sal_Int32 nIdx = 0;
-+ uno::Reference<io::XStream> xStream;
-+ if (aPath[0] == sal_Unicode('/'))
-+ nIdx++;
-+ do
-+ {
-+ m_aUgly.push_back (xStorage);
-+ aTok = aPath.getToken (0, sal_Unicode('/'), nIdx);
-+// fprintf (stderr, "Tok '%s' (%d)\n",
-+// rtl::OUStringToOString (aTok, RTL_TEXTENCODING_UTF8).getStr(),
-+// nIdx);
-+ if (nIdx >= 0)
-+ xStorage = xStorage->openStorageElement (aTok, nOpenMode);
-+ else
-+ m_xRef = xStorage->openStreamElement (aTok, nOpenMode);
-+ }
-+ while (nIdx >= 0);
-+ }
-+ uno::Reference<io::XStream> get()
-+ {
-+ return m_xRef;
-+ }
-+};
-+
-+ScECMAParseBase::~ScECMAParseBase()
-+{
-+ if (m_pPath)
-+ delete m_pPath;
-+}
-+
-+FltError
-+ScECMAParseBase::doParse(const uno::Reference<lang::XMultiServiceFactory> &xServiceFactory,
-+ const uno::Reference<embed::XStorage> &xStorage,
-+ const rtl::OUString &rStreamPath)
-+{
-+ // get parser
-+ uno::Reference<xml::sax::XParser> xParser (
-+ xServiceFactory->createInstance(
-+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" )) ),
-+ uno::UNO_QUERY);
-+ if (!xParser.is())
-+ return eERR_OPEN;
-+
-+ xParser->setDocumentHandler (this);
-+
-+ xml::sax::InputSource aParserInput;
-+
-+ m_pPath = new ScPathRefHolder(xStorage, rStreamPath,
-+ embed::ElementModes::READ);
-+
-+ uno::Reference<io::XStream> xDocStream = m_pPath->get();
-+ if (!xDocStream.is())
-+ fprintf (stderr, "Foo\n");
-+ else
-+ aParserInput.aInputStream = xDocStream->getInputStream();
-+
-+ aParserInput.sSystemId = rtl::OUString(); // hmm ?
-+
-+ try
-+ {
-+ fprintf (stderr, "Do Parse\n");
-+ xParser->parseStream( aParserInput );
-+ }
-+ catch( xml::sax::SAXParseException& r )
-+ {
-+ fprintf (stderr, "SAX parse exception '%s'\n",
-+ rtl::OUStringToOString (r.Message, RTL_TEXTENCODING_UTF8).getStr());
-+ }
-+#if 0
-+ catch( packages::WrongPasswordException& )
-+ {
-+ }
-+ catch( packages::zip::ZipIOException& )
-+ {
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+#endif
-+ return eERR_OK;
-+}
-+
-+void SAL_CALL
-+ScECMAParseBase::startElement(const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException )
-+{
-+ fprintf (stderr, "startElement '%s'\n", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
-+}
diff --git a/patches/test/sc-source-filter-ecma-parsebase-hxx.diff b/patches/test/sc-source-filter-ecma-parsebase-hxx.diff
deleted file mode 100644
index 0969be550..000000000
--- a/patches/test/sc-source-filter-ecma-parsebase-hxx.diff
+++ /dev/null
@@ -1,50 +0,0 @@
---- /dev/null
-+++ sc/source/filter/ecma/parsebase.hxx
-@@ -0,0 +1,47 @@
-+#ifndef SC_ECMA_PARSEBASE_HXX
-+#define SC_ECMA_PARSEBASE_HXX
-+
-+#include "filter.hxx"
-+#include "scerrors.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-+
-+#define css ::com::sun::star
-+
-+class ScPathRefHolder;
-+
-+class ScECMAParseBase : public ::cppu::WeakImplHelper1<
-+ css::xml::sax::XDocumentHandler >
-+{
-+ private:
-+ ScPathRefHolder *m_pPath;
-+ public:
-+ ScECMAParseBase() : m_pPath(NULL) {}
-+ virtual ~ScECMAParseBase();
-+
-+ FltError doParse(const css::uno::Reference<css::lang::XMultiServiceFactory> &xServiceFactory,
-+ const css::uno::Reference<css::embed::XStorage> &xStorage,
-+ const rtl::OUString &rStreamPath);
-+
-+ // css::xml::sax::XDocumentHandler
-+ virtual void SAL_CALL startDocument(void)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL endDocument(void)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
-+ const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException );
-+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget,
-+ const ::rtl::OUString& aData)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+ virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator)
-+ throw( css::xml::sax::SAXException, css::uno::RuntimeException ) {}
-+};
-+
-+#endif // SC_ECMA_PARSEBASE_HXX
diff --git a/patches/test/sc-vba-worksheet-changed-event-by-fong.diff b/patches/test/sc-vba-worksheet-changed-event-by-fong.diff
deleted file mode 100644
index 91afabdf4..000000000
--- a/patches/test/sc-vba-worksheet-changed-event-by-fong.diff
+++ /dev/null
@@ -1,201 +0,0 @@
---- backup/sc/source/ui/inc/docsh.hxx 2008-04-23 14:28:42.000000000 +0800
-+++ sc/source/ui/inc/docsh.hxx 2008-04-28 14:38:07.000000000 +0800
-@@ -347,6 +348,7 @@ public:
- void PostPaintExtras();
-
- void PostDataChanged();
-+ void PostContentChanged( const ScRange& rRange ); // for worsheet/workbook changed event
-
- void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
---- backup/sc/source/ui/docshell/docsh.cxx 2008-04-23 14:28:47.000000000 +0800
-+++ sc/source/ui/docshell/docsh.cxx 2008-04-28 14:42:40.000000000 +0800
-@@ -2460,6 +2519,31 @@ void ScDocShell::SetModified( BOOL bModi
- }
- }
-
-+void ScDocShell::PostContentChanged( const ScRange& rRange )
-+{
-+ OSL_TRACE("ScDocShell::PostContentChanged. Changed Range Address: nTab1 = %d, nCol1 = %d, nRow1 = %d; nTab2 = %d, nCol2 = %d, nRow2 = %d;", rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row() );
-+ ScCellRangesBase* pObj = NULL;
-+
-+ if (rRange.aStart == rRange.aEnd)
-+ {
-+ pObj = new ScCellObj( this, rRange.aStart );
-+ }
-+ else
-+ {
-+ pObj = new ScCellRangeObj( this, rRange );
-+ }
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+
-+ SCTAB nTab1 = rRange.aStart.Tab();
-+ aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab1, aArgs );
-+
-+ SCTAB nTab2 = rRange.aEnd.Tab();
-+ if( nTab1 != nTab2 )
-+ aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab2, aArgs );
-+}
-+
-
- void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
- {
---- backup/sc/source/ui/undo/undocell.cxx 2008-04-23 13:51:53.000000000 +0800
-+++ sc/source/ui/undo/undocell.cxx 2008-04-28 14:40:30.000000000 +0800
-@@ -202,6 +202,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
- nTab( nNewTab ),
- nCount( nNewCount )
- {
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- SetChangeTrack();
- }
-
-@@ -238,6 +239,7 @@ void ScUndoEnterData::DoChange() const
- pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, FALSE, FALSE );
- }
-
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- pDocShell->PostDataChanged();
- }
-
-@@ -359,6 +361,7 @@ ScUndoEnterValue::ScUndoEnterValue( ScDo
- nValue ( nVal ),
- bNeedHeight ( bHeight )
- {
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- SetChangeTrack();
- }
-
-@@ -409,6 +412,8 @@ void __EXPORT ScUndoEnterValue::Undo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- if ( pChangeTrack )
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-@@ -424,6 +429,8 @@ void __EXPORT ScUndoEnterValue::Redo()
- pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- SetChangeTrack();
-
- EndRedo();
-@@ -453,6 +460,7 @@ ScUndoPutCell::ScUndoPutCell( ScDocShell
- pEnteredCell( pRedoCell ),
- bNeedHeight ( bHeight )
- {
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- SetChangeTrack();
- }
-
-@@ -505,6 +513,8 @@ void __EXPORT ScUndoPutCell::Undo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- if ( pChangeTrack )
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-@@ -535,6 +545,8 @@ void __EXPORT ScUndoPutCell::Redo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- SetChangeTrack();
-
- EndRedo();
---- backup/sc/source/ui/undo/undoblk.cxx 2008-04-23 13:51:53.000000000 +0800
-+++ sc/source/ui/undo/undoblk.cxx 2008-04-28 14:40:30.000000000 +0800
-@@ -129,6 +129,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
- aEffRange.aEnd.SetRow(MAXROW);
- }
-
-+ pDocShell->PostContentChanged( aEffRange );
- SetChangeTrack();
- }
-
-@@ -264,6 +265,7 @@ void ScUndoInsertCells::DoChange( const
- if (pViewShell)
- pViewShell->CellContentChanged();
-
-+ pDocShell->PostContentChanged( aEffRange );
- ShowTable( aEffRange.aStart.Tab() );
- }
-
-@@ -337,6 +339,8 @@ ScUndoDeleteCells::ScUndoDeleteCells( Sc
- aEffRange.aEnd.SetRow(MAXROW);
- }
-
-+ pDocShell->PostContentChanged( aEffRange );
-+
- SetChangeTrack();
- }
-
-@@ -469,6 +473,7 @@ void ScUndoDeleteCells::DoChange( const
-
- pDocShell->PostDataChanged();
- // CellContentChanged kommt mit der Markierung
-+ pDocShell->PostContentChanged( aWorkRange );
-
- ShowTable( aEffRange.aStart.Tab() );
- }
-@@ -718,6 +723,7 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDo
- pUndoDoc( pNewUndoDoc ),
- aExtendedRange( aRange )
- {
-+ pDocShell->PostContentChanged( aExtendedRange );
- SetChangeTrack();
- }
-
-@@ -776,6 +782,7 @@ void ScUndoCut::DoChange( const BOOL bUn
- pDocShell->PostDataChanged();
- if (pViewShell)
- pViewShell->CellContentChanged();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Undo()
-@@ -842,6 +849,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pN
-
- if ( pOptions )
- aPasteOptions = *pOptions; // used only for Repeat
-+ pDocShell->PostContentChanged( aBlockRange );
-
- SetChangeTrack();
- }
-@@ -1017,6 +1025,7 @@ void ScUndoPaste::DoChange( const BOOL b
- pDocShell->PostDataChanged();
- if (pViewShell)
- pViewShell->CellContentChanged();
-+ pDocShell->PostContentChanged( aDrawRange );
- }
-
- void __EXPORT ScUndoPaste::Undo()
---- backup/sc/source/ui/undo/undoblk3.cxx 2008-04-23 13:51:53.000000000 +0800
-+++ sc/source/ui/undo/undoblk3.cxx 2008-04-28 14:40:30.000000000 +0800
-@@ -116,7 +116,8 @@ ScUndoDeleteContents::ScUndoDeleteConten
-
- if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // keine Zelle markiert:
- aMarkData.SetMarkArea( aRange ); // Zelle unter Cursor markieren
--
-+
-+ pDocShell->PostContentChanged( aRange );
- SetChangeTrack();
- }
-
-@@ -207,6 +208,7 @@ void ScUndoDeleteContents::DoChange( con
- if (pViewShell)
- pViewShell->CellContentChanged();
-
-+ pDocShell->PostContentChanged( aRange );
- ShowTable( aRange );
- }
-
diff --git a/patches/test/sc-vba-worksheet-changed.diff b/patches/test/sc-vba-worksheet-changed.diff
deleted file mode 100644
index 023398d99..000000000
--- a/patches/test/sc-vba-worksheet-changed.diff
+++ /dev/null
@@ -1,246 +0,0 @@
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
---- sc.clean/source/ui/docshell/docsh.cxx 2008-04-29 13:02:31.000000000 -0400
-+++ sc/source/ui/docshell/docsh.cxx 2008-04-29 17:55:02.000000000 -0400
-@@ -140,6 +140,7 @@
- #include "compiler.hxx"
- #include "cfgids.hxx"
- #include "warnpassword.hxx"
-+#include "cellsuno.hxx"
-
- #include "docsh.hxx"
- #include "docshimp.hxx"
-@@ -2490,6 +2491,48 @@ void ScDocShell::SetModified( BOOL bModi
- }
- }
-
-+void ScDocShell::PostContentChanged( const ScRange& rRange )
-+{
-+// OSL_TRACE("ScDocShell::PostContentChanged. Changed Range Address: nTab1 = %d, nCol1 = %d, nRow1 = %d; nTab2 = %d, nCol2 = %d, nRow2 = %d;", rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row() );
-+
-+ ScRangeList aList;
-+ aList.Append(rRange);
-+ PostContentChanged(aList);
-+}
-+
-+void ScDocShell::PostContentChanged( const ScRangeList& rList )
-+{
-+ String aStr;
-+ rList.Format(aStr, SCR_ABS, &aDocument, ScAddress::CONV_XL_A1);
-+ fprintf(stdout, "ScDocShell::PostContentChanged: range = '%s'\n",
-+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+
-+ // do your VBA stuff...
-+
-+#if 0 // disabled since this part didn't work in my build. (kohei)
-+ ScCellRangesBase* pObj = NULL;
-+
-+ if (rRange.aStart == rRange.aEnd)
-+ {
-+ pObj = new ScCellObj( this, rRange.aStart );
-+ } else
-+ {
-+ pObj = new ScCellRangeObj( this, rRange );
-+ }
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+
-+ SCTAB nTab1 = rRange.aStart.Tab();
-+ aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab1, aArgs );
-+
-+ SCTAB nTab2 = rRange.aEnd.Tab();
-+ if ( nTab1 != nTab2 )
-+ {
-+ aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab2, aArgs );
-+ }
-+#endif
-+}
-
- void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
- {
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
---- sc.clean/source/ui/inc/docsh.hxx 2008-04-29 13:02:28.000000000 -0400
-+++ sc/source/ui/inc/docsh.hxx 2008-04-29 16:31:03.000000000 -0400
-@@ -343,6 +343,8 @@ public:
- void PostPaintExtras();
-
- void PostDataChanged();
-+ void PostContentChanged( const ScRange& rRange ); // for worsheet/workbook changed event
-+ void PostContentChanged( const ScRangeList& rList );
-
- void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk3.cxx sc/source/ui/undo/undoblk3.cxx
---- sc.clean/source/ui/undo/undoblk3.cxx 2008-04-29 13:02:30.000000000 -0400
-+++ sc/source/ui/undo/undoblk3.cxx 2008-04-29 17:38:27.000000000 -0400
-@@ -117,6 +117,15 @@ ScUndoDeleteContents::ScUndoDeleteConten
- if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // keine Zelle markiert:
- aMarkData.SetMarkArea( aRange ); // Zelle unter Cursor markieren
-
-+ if (aMarkData.IsMarked() || aMarkData.IsMultiMarked())
-+ {
-+ ScRangeList aList;
-+ aMarkData.FillRangeListWithMarks(&aList, false);
-+ pDocShell->PostContentChanged(aList);
-+ }
-+ else
-+ pDocShell->PostContentChanged( aRange );
-+
- SetChangeTrack();
- }
-
-@@ -211,6 +220,15 @@ void ScUndoDeleteContents::DoChange( con
- if (pViewShell)
- pViewShell->CellContentChanged();
-
-+ if (aMarkData.IsMarked() || aMarkData.IsMultiMarked())
-+ {
-+ ScRangeList aList;
-+ aMarkData.FillRangeListWithMarks(&aList, false);
-+ pDocShell->PostContentChanged(aList);
-+ }
-+ else
-+ pDocShell->PostContentChanged( aRange );
-+
- ShowTable( aRange );
- }
-
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk.cxx sc/source/ui/undo/undoblk.cxx
---- sc.clean/source/ui/undo/undoblk.cxx 2008-04-29 13:02:30.000000000 -0400
-+++ sc/source/ui/undo/undoblk.cxx 2008-04-29 17:13:01.000000000 -0400
-@@ -129,6 +129,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
- aEffRange.aEnd.SetRow(MAXROW);
- }
-
-+ pDocShell->PostContentChanged( aEffRange );
- SetChangeTrack();
- }
-
-@@ -264,6 +265,7 @@ void ScUndoInsertCells::DoChange( const
- if (pViewShell)
- pViewShell->CellContentChanged();
-
-+ pDocShell->PostContentChanged( aEffRange );
- ShowTable( aEffRange.aStart.Tab() );
- }
-
-@@ -337,6 +339,8 @@ ScUndoDeleteCells::ScUndoDeleteCells( Sc
- aEffRange.aEnd.SetRow(MAXROW);
- }
-
-+ pDocShell->PostContentChanged( aEffRange );
-+
- SetChangeTrack();
- }
-
-@@ -469,6 +473,7 @@ void ScUndoDeleteCells::DoChange( const
-
- pDocShell->PostDataChanged();
- // CellContentChanged kommt mit der Markierung
-+ pDocShell->PostContentChanged( aWorkRange );
-
- ShowTable( aEffRange.aStart.Tab() );
- }
-@@ -718,6 +723,7 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDo
- pUndoDoc( pNewUndoDoc ),
- aExtendedRange( aRange )
- {
-+ pDocShell->PostContentChanged( aExtendedRange );
- SetChangeTrack();
- }
-
-@@ -776,6 +782,7 @@ void ScUndoCut::DoChange( const BOOL bUn
- pDocShell->PostDataChanged();
- if (pViewShell)
- pViewShell->CellContentChanged();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Undo()
-@@ -842,6 +849,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pN
-
- if ( pOptions )
- aPasteOptions = *pOptions; // used only for Repeat
-+ pDocShell->PostContentChanged( aBlockRange );
-
- SetChangeTrack();
- }
-@@ -1017,6 +1025,7 @@ void ScUndoPaste::DoChange( const BOOL b
- pDocShell->PostDataChanged();
- if (pViewShell)
- pViewShell->CellContentChanged();
-+ pDocShell->PostContentChanged( aDrawRange );
- }
-
- void __EXPORT ScUndoPaste::Undo()
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undocell.cxx sc/source/ui/undo/undocell.cxx
---- sc.clean/source/ui/undo/undocell.cxx 2008-04-29 13:02:30.000000000 -0400
-+++ sc/source/ui/undo/undocell.cxx 2008-04-29 13:07:44.000000000 -0400
-@@ -218,6 +218,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
- nTab( nNewTab ),
- nCount( nNewCount )
- {
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- SetChangeTrack();
- }
-
-@@ -254,6 +255,7 @@ void ScUndoEnterData::DoChange() const
- pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, FALSE, FALSE );
- }
-
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- pDocShell->PostDataChanged();
- }
-
-@@ -375,6 +377,7 @@ ScUndoEnterValue::ScUndoEnterValue( ScDo
- nValue ( nVal ),
- bNeedHeight ( bHeight )
- {
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- SetChangeTrack();
- }
-
-@@ -425,6 +428,8 @@ void __EXPORT ScUndoEnterValue::Undo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- if ( pChangeTrack )
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-@@ -440,6 +445,8 @@ void __EXPORT ScUndoEnterValue::Redo()
- pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- SetChangeTrack();
-
- EndRedo();
-@@ -469,6 +476,7 @@ ScUndoPutCell::ScUndoPutCell( ScDocShell
- pEnteredCell( pRedoCell ),
- bNeedHeight ( bHeight )
- {
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- SetChangeTrack();
- }
-
-@@ -521,6 +529,8 @@ void __EXPORT ScUndoPutCell::Undo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- if ( pChangeTrack )
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-@@ -551,6 +561,8 @@ void __EXPORT ScUndoPutCell::Redo()
-
- pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
-
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
-+
- SetChangeTrack();
-
- EndRedo();
diff --git a/patches/test/sd-export-html-thumbnails.diff b/patches/test/sd-export-html-thumbnails.diff
deleted file mode 100644
index 7679b88fe..000000000
--- a/patches/test/sd-export-html-thumbnails.diff
+++ /dev/null
@@ -1,148 +0,0 @@
---- /opt/OpenOffice/openoffice/build/OOO_1_1_0/sd/source/filter/html/htmlex.cxx 2003-11-21 06:55:21.000000000 +0000
-+++ sd/source/filter/html/htmlex.cxx 2003-12-10 14:07:14.000000000 +0000
-@@ -510,7 +510,7 @@
- m_eMode( PUBLISH_HTML ),
- m_eFormat( FORMAT_JPG ),
- m_nCompression( -1 ),
-- m_nWidthPixel( PUB_LOWRES_WIDTH ),
-+ m_nWidthPixel( PUB_MEDRES_WIDTH ),
- m_bDownload( false ),
- m_eScript( SCRIPT_ASP )
- {
-@@ -821,6 +821,10 @@
- if( !CreateImagesForPresPages() )
- break;
-
-+ if( m_bContentsPage &&
-+ !CreateImagesForPresPages( true ) )
-+ break;
-+
- if( !CreateHtmlForPresPages() )
- break;
-
-@@ -1049,7 +1053,7 @@
- // =====================================================================
- // Image-Dateien anlegen
- // =====================================================================
--bool HtmlExport::CreateImagesForPresPages()
-+bool HtmlExport::CreateImagesForPresPages( bool bThumbnail )
- {
- try
- {
-@@ -1066,9 +1070,9 @@
-
- Sequence< PropertyValue > aFilterData(((m_eFormat==FORMAT_JPG)&&(m_nCompression != -1))? 3 : 2);
- aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelWidth") );
-- aFilterData[0].Value <<= (sal_Int32)m_nWidthPixel;
-+ aFilterData[0].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_WIDTH : m_nWidthPixel );
- aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelHeight") );
-- aFilterData[1].Value <<= (sal_Int32)m_nHeightPixel;
-+ aFilterData[1].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_HEIGHT : m_nHeightPixel);
- if((m_eFormat==FORMAT_JPG)&&(m_nCompression != -1))
- {
- aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Quality") );
-@@ -1087,7 +1091,10 @@
- SdPage* pPage = pDoc->GetSdPage( nSdPage, PK_STANDARD );
-
- OUString aFull(m_aExportPath);
-- aFull += *m_pImageFiles[nSdPage];
-+ if (bThumbnail)
-+ aFull += *m_pThumbnailFiles[nSdPage];
-+ else
-+ aFull += *m_pImageFiles[nSdPage];
-
- aDescriptor[0].Value <<= aFull;
-
-@@ -1905,7 +1912,7 @@
- aStr.AppendAscii( "<center><table width=90%><TR>\r\n" );
-
- // Inhaltsverzeichnis
-- aStr.AppendAscii( "<td valign=top align=left width=50%>\r\n" );
-+ aStr.AppendAscii( "<td valign=top align=left width=25%>\r\n" );
- aStr.AppendAscii( "<h3><u>" );
- aStr += RESTOHTML(STR_HTMLEXP_CONTENTS);
- aStr.AppendAscii( "</u></h3>" );
-@@ -1925,7 +1932,7 @@
- aStr.AppendAscii( "</td>\r\n" );
-
- // Dokument Infos
-- aStr.AppendAscii( "<td valign=top width=50%>\r\n" );
-+ aStr.AppendAscii( "<td valign=top align=left width=75%>\r\n" );
-
- if(m_aAuthor.Len())
- {
-@@ -1976,6 +1983,21 @@
- aStr.AppendAscii( "</a></p>\r\n" );
- }
-
-+ for(nSdPage = 0; nSdPage < m_nSdPageCount; nSdPage++)
-+ {
-+ SdPage* pPage = pDoc->GetSdPage(nSdPage, PK_STANDARD);
-+ String aText;
-+
-+ aText.AppendAscii( "<img src=\"" );
-+ aText += StringToURL( *m_pThumbnailFiles[nSdPage] );
-+ aText.AppendAscii( "\" width=256 height=192 alt=\"" );
-+ aText += StringToHTMLString( *m_pPageNames[nSdPage] );
-+ aText.AppendAscii( "\">" );
-+
-+ aStr += CreateLink(*m_pHTMLFiles[nSdPage], aText);
-+ aStr.AppendAscii( "\r\n" );
-+ }
-+
- aStr.AppendAscii( "</td></tr></table></center>\r\n" );
-
- aStr.AppendAscii( "</body>\r\n</html>" );
-@@ -2096,6 +2118,7 @@
- // Listen mit neuen Dateinamen anlegen
- m_pHTMLFiles = new String*[m_nSdPageCount];
- m_pImageFiles = new String*[m_nSdPageCount];
-+ m_pThumbnailFiles = new String*[m_nSdPageCount];
- m_pPageNames = new String*[m_nSdPageCount];
- m_pTextFiles = new String*[m_nSdPageCount];
-
-@@ -2124,6 +2147,15 @@
-
- m_pImageFiles[nSdPage] = pName;
-
-+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("thumb") );
-+ *pName += String::CreateFromInt32(nSdPage);
-+ if( m_eFormat!=FORMAT_JPG )
-+ pName->AppendAscii( ".png" );
-+ else
-+ pName->AppendAscii( ".jpg" );
-+
-+ m_pThumbnailFiles[nSdPage] = pName;
-+
- pName = new String( RTL_CONSTASCII_USTRINGPARAM("text"));
- *pName += String::CreateFromInt32(nSdPage);
- *pName += m_aHTMLExtension;
---- /opt/OpenOffice/openoffice/build/OOO_1_1_0/sd/source/filter/html/htmlex.hxx 2003-06-04 12:02:33.000000000 +0100
-+++ sd/source/filter/html/htmlex.hxx 2003-12-10 13:41:26.000000000 +0000
-@@ -112,6 +112,9 @@
- #define PUB_HIGHRES_WIDTH 1024
- #define PUB_HIGHRES_HEIGHT 768
-
-+#define PUB_THUMBNAIL_WIDTH 256
-+#define PUB_THUMBNAIL_HEIGHT 192
-+
- #define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons";
-
- class List;
-@@ -197,6 +200,7 @@
- String m_aHTMLExtension;
- String** m_pHTMLFiles;
- String** m_pImageFiles;
-+ String** m_pThumbnailFiles;
- String** m_pPageNames;
- String** m_pTextFiles;
-
-@@ -210,7 +214,7 @@
-
- void SetDocColors( SdPage* pPage = NULL );
-
-- bool CreateImagesForPresPages();
-+ bool CreateImagesForPresPages( bool bThumbnails = false );
- bool CreateHtmlTextForPresPages();
- bool CreateHtmlForPresPages();
- bool CreateContentPage();
diff --git a/patches/test/service-log.diff b/patches/test/service-log.diff
deleted file mode 100644
index 130ba000d..000000000
--- a/patches/test/service-log.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-Index: cppuhelper/source/factory.cxx
-===================================================================
-RCS file: /cvs/udk/cppuhelper/source/factory.cxx,v
-retrieving revision 1.23
-diff -u -p -u -r1.23 factory.cxx
---- cppuhelper/source/factory.cxx 8 Sep 2005 09:26:13 -0000 1.23
-+++ cppuhelper/source/factory.cxx 9 Nov 2005 11:58:29 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -192,6 +193,10 @@ Reference<XInterface > OSingleFactoryHel
- Reference< XComponentContext > const & xContext )
- throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
- {
-+ fprintf (stderr, "SingleFactoryHelper::createInstanceWAAC '%s'\n",
-+ (const sal_Char *) rtl::OUStringToOString (aImplementationName,
-+ RTL_TEXTENCODING_UTF8));
-+
- if (m_fptr)
- {
- return (*m_fptr)( xContext );
-
-Index: stoc/source/servicemanager/servicemanager.cxx
-===================================================================
-RCS file: /cvs/udk/stoc/source/servicemanager/servicemanager.cxx,v
-retrieving revision 1.24
-diff -u -p -u -r1.24 servicemanager.cxx
---- stoc/source/servicemanager/servicemanager.cxx 8 Sep 2005 08:11:34 -0000 1.24
-+++ stoc/source/servicemanager/servicemanager.cxx 9 Nov 2005 11:59:22 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -1273,6 +1274,9 @@ Reference< XInterface > OServiceManager:
- Reference< XComponentContext > const & xContext )
- throw (Exception, RuntimeException)
- {
-+ fprintf (stderr, "CreateInstanceWithContext '%s'\n",
-+ (const sal_Char *) rtl::OUStringToOString (rServiceSpecifier, RTL_TEXTENCODING_UTF8));
-+
- check_undisposed();
- #if OSL_DEBUG_LEVEL > 0
- Reference< beans::XPropertySet > xProps( xContext->getServiceManager(), UNO_QUERY );
-@@ -1335,6 +1339,9 @@ Reference< XInterface > OServiceManager:
- Reference< XComponentContext > const & xContext )
- throw (Exception, RuntimeException)
- {
-+ fprintf (stderr, "CreateInstanceWC&Args '%s'\n",
-+ (const sal_Char *) rtl::OUStringToOString (rServiceSpecifier, RTL_TEXTENCODING_UTF8));
-+
- check_undisposed();
- #if OSL_DEBUG_LEVEL > 0
- Reference< beans::XPropertySet > xProps( xContext->getServiceManager(), UNO_QUERY );
-
diff --git a/patches/test/sfx-broadcaster-hashset-svtools.diff b/patches/test/sfx-broadcaster-hashset-svtools.diff
deleted file mode 100644
index 3036ae3a8..000000000
--- a/patches/test/sfx-broadcaster-hashset-svtools.diff
+++ /dev/null
@@ -1,886 +0,0 @@
-diff --git a/svtools/inc/svtools/brdcst.hxx b/svtools/inc/svtools/brdcst.hxx
-index 6734f63..105f69d 100644
---- svtools/inc/svtools/brdcst.hxx
-+++ svtools/inc/svtools/brdcst.hxx
-@@ -31,35 +31,25 @@
- #define _SFXBRDCST_HXX
-
- #include "svtools/svldllapi.h"
-+#include "svtools/svarray.hxx"
- #include <tools/rtti.hxx>
--#include <svtools/svarray.hxx>
-+
-+#include <memory>
-
- class SfxListener;
- class SfxHint;
-
--#ifndef _SFX_BRDCST_CXX
--typedef SvPtrarr SfxListenerArr_Impl;
--#endif
--
--#define SFX_FORWARD( rBC, rBCT, rHint, rHintT ) \
-- Forward( rBC, rHint )
--
--//-------------------------------------------------------------------------
-+struct SfxBroadcasterImpl;
-
- class SVL_DLLPUBLIC SfxBroadcaster
- {
--friend class SfxListener;
--
-- SfxListenerArr_Impl aListeners;
-+ ::std::auto_ptr<SfxBroadcasterImpl> mpImpl;
-
- private:
-- BOOL AddListener( SfxListener& rListener );
-- void RemoveListener( SfxListener& rListener );
- const SfxBroadcaster& operator=(const SfxBroadcaster &); // verboten
-
- protected:
-- void SFX_FORWARD(SfxBroadcaster& rBC, const TypeId& rBCType,
-- const SfxHint& rHint, const TypeId& rHintType);
-+ void Forward(SfxBroadcaster& rBC, const SfxHint& rHint);
- virtual void ListenersGone();
-
- public:
-@@ -73,10 +63,11 @@ public:
- void BroadcastDelayed( const SfxHint& rHint );
- void BroadcastInIdle( const SfxHint& rHint );
-
-+ BOOL AddListener( SfxListener& rListener );
-+ void RemoveListener( SfxListener& rListener );
- BOOL HasListeners() const;
-- USHORT GetListenerCount() const { return aListeners.Count(); }
-- SfxListener* GetListener( USHORT nNo ) const
-- { return (SfxListener*) aListeners[nNo]; }
-+ size_t GetListenerCount() const;
-+ SfxListener* GetListener( size_t nNo ) const;
- };
-
- #endif
-diff --git a/svtools/inc/svtools/lstner.hxx b/svtools/inc/svtools/lstner.hxx
-index e60c028..47cdbc5 100644
---- svtools/inc/svtools/lstner.hxx
-+++ svtools/inc/svtools/lstner.hxx
-@@ -31,24 +31,19 @@
- #define _SFXLSTNER_HXX
-
- #include "svtools/svldllapi.h"
-+#include "svtools/svarray.hxx"
- #include <tools/rtti.hxx>
--#include <svtools/svarray.hxx>
-+
-+#include <memory>
-
- class SfxBroadcaster;
- class SfxHint;
-
--#ifndef _SFX_LSTNER_CXX
--typedef SvPtrarr SfxBroadcasterArr_Impl;
--#endif
--
--#define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \
-- Notify( rBC, rHint )
--
--//-------------------------------------------------------------------------
-+struct SfxListenerImpl;
-
- class SVL_DLLPUBLIC SfxListener
- {
-- SfxBroadcasterArr_Impl aBCs;
-+ ::std::auto_ptr<SfxListenerImpl> mpImpl;
-
- private:
- const SfxListener& operator=(const SfxListener &); // n.i., ist verboten
-@@ -62,14 +57,12 @@ public:
-
- BOOL StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups = FALSE );
- BOOL EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups = FALSE );
-- void EndListening( USHORT nNo );
-+ void EndListening( size_t nNo );
- void EndListeningAll();
- BOOL IsListening( SfxBroadcaster& rBroadcaster ) const;
-
-- USHORT GetBroadcasterCount() const
-- { return aBCs.Count(); }
-- SfxBroadcaster* GetBroadcasterJOE( USHORT nNo ) const
-- { return (SfxBroadcaster*) aBCs.GetObject(nNo); }
-+ size_t GetBroadcasterCount() const;
-+ SfxBroadcaster* GetBroadcasterJOE( size_t nNo ) const;
-
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
-diff --git a/svtools/source/items/style.cxx b/svtools/source/items/style.cxx
-index cc3b525..519f5fe 100644
---- svtools/source/items/style.cxx
-+++ svtools/source/items/style.cxx
-@@ -1286,7 +1286,7 @@ BOOL SfxStyleSheet::SetParent( const XubString& rName )
- void SfxStyleSheet::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
- const SfxHint& rHint, const TypeId& rHintType )
- {
-- SFX_FORWARD(rBC, rBCType, rHint, rHintType);
-+ Forward(rBC, rHint);
- }
-
- //////////////////////// SfxStyleSheetPool ///////////////////////////////
-diff --git a/svtools/source/notify/brdcst.cxx b/svtools/source/notify/brdcst.cxx
-index 4e7f5c5..ad8019e 100644
---- svtools/source/notify/brdcst.cxx
-+++ svtools/source/notify/brdcst.cxx
-@@ -39,17 +39,122 @@
- #include <svtools/smplhint.hxx>
- #include <svtools/lstner.hxx>
-
--SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 )
--
--#define _SFX_BRDCST_CXX
- #include <svtools/brdcst.hxx>
-
-+#include <algorithm>
-+#include <hash_set>
-+
-+#define USE_NEW_IMPL 0
-+
-+using ::std::find;
-+using ::std::unary_function;
-+
- //====================================================================
- DBG_NAME(SfxBroadcaster)
- TYPEINIT0(SfxBroadcaster);
-
- //====================================================================
-
-+struct SfxListenerHash
-+{
-+ size_t operator()(SfxListener* p) const
-+ {
-+ return reinterpret_cast<size_t>(p);
-+ }
-+};
-+
-+#if USE_NEW_IMPL
-+typedef ::std::hash_set<SfxListener*, SfxListenerHash> ListenerArray;
-+#else
-+
-+//#ifndef _SFX_BRDCST_CXX
-+//typedef SvPtrarr ListenerArray;
-+//#endif
-+
-+SV_DECL_PTRARR( ListenerArray, SfxListener*, 0, 2 )
-+
-+#endif
-+
-+struct SfxBroadcasterImpl
-+{
-+ ListenerArray maListeners;
-+
-+// SfxBroadcasterImpl() {}
-+
-+// explicit SfxBroadcasterImpl(const SfxBroadcasterImpl& r)
-+// {
-+// }
-+};
-+
-+// ----------------------------------------------------------------------------
-+
-+class NotifyListenerFunc : public unary_function<SfxListener*, void>
-+{
-+public:
-+ explicit NotifyListenerFunc(const SfxHint& rHint, SfxBroadcaster& rParent) :
-+ mrHint(rHint),
-+ mrParentBC(rParent)
-+ {
-+ }
-+
-+ void operator()(SfxListener* pListener)
-+ {
-+ if (pListener)
-+ pListener->Notify(mrParentBC, mrHint);
-+ }
-+private:
-+ NotifyListenerFunc(); // disable
-+
-+private:
-+ const SfxHint& mrHint;
-+ SfxBroadcaster& mrParentBC;
-+};
-+
-+// ----------------------------------------------------------------------------
-+
-+class UnregisterListenerFunc : public unary_function<SfxListener*, void>
-+{
-+public:
-+ explicit UnregisterListenerFunc(SfxBroadcaster& rParent) :
-+ mrParentBC(rParent)
-+ {
-+ }
-+
-+ void operator()(SfxListener* pListener)
-+ {
-+ if (pListener)
-+ pListener->RemoveBroadcaster_Impl(mrParentBC);
-+ }
-+private:
-+ UnregisterListenerFunc(); // disable
-+
-+private:
-+ SfxBroadcaster& mrParentBC;
-+};
-+
-+// ----------------------------------------------------------------------------
-+
-+class RegisterListenerFunc : public ::std::unary_function<SfxListener*, void>
-+{
-+public:
-+ explicit RegisterListenerFunc(SfxBroadcaster& rParent) :
-+ mrParentBC(rParent)
-+ {
-+ }
-+
-+ void operator()(SfxListener* pListener)
-+ {
-+ if (pListener)
-+ pListener->StartListening(mrParentBC);
-+ }
-+
-+private:
-+ RegisterListenerFunc(); // disabled
-+
-+private:
-+ SfxBroadcaster& mrParentBC;
-+};
-+
- //====================================================================
- // broadcast immediately
-
-@@ -58,27 +163,42 @@ void SfxBroadcaster::Broadcast( const SfxHint &rHint )
- {
- DBG_CHKTHIS(SfxBroadcaster, 0);
-
-+#if USE_NEW_IMPL
- // is anybody to notify?
-- if ( aListeners.Count() /*! || aGlobListeners.Count() */ )
-+ if ( !mpImpl->maListeners.empty() /*! || aGlobListeners.Count() */ )
-+ {
-+ // notify all registered listeners exactly once
-+#if 1
-+ ListenerArray::iterator itrEnd = mpImpl->maListeners.end();
-+ for (ListenerArray::iterator itr = mpImpl->maListeners.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxListener* pLis = *itr;
-+ if (pLis)
-+ {
-+ fprintf(stdout, "SfxBroadcaster::Broadcast: notifying\n");
-+ pLis->Notify(*this, rHint);
-+ }
-+ else
-+ fprintf(stdout, "SfxBroadcaster::Broadcast: not\n");
-+ }
-+#else
-+ NotifyListenerFunc f(rHint, *this);
-+ for_each(mpImpl->maListeners.begin(), mpImpl->maListeners.end(), f);
-+#endif
-+ }
-+#else
-+ // is anybody to notify?
-+ if ( mpImpl->maListeners.Count() /*! || aGlobListeners.Count() */ )
- {
-- #if 0
-- // determine the type only once, because of its expensiveness
-- const TypeId& rBCType = Type();
-- const TypeId& rHintType = rHint.Type();
-- #endif
--
- // notify all registered listeners exactly once
-- for ( USHORT n = 0; n < aListeners.Count(); ++n )
-+ for ( USHORT n = 0; n < mpImpl->maListeners.Count(); ++n )
- {
-- SfxListener* pListener = aListeners[n];
-+ SfxListener* pListener = (SfxListener*)mpImpl->maListeners[n];
- if ( pListener )
-- #if 0
-- pListener->SFX_NOTIFY( *this, rBCType, rHint, rHintType );
-- #else
- pListener->Notify( *this, rHint );
-- #endif
- }
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -111,19 +231,35 @@ SfxBroadcaster::~SfxBroadcaster()
- Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
-
- // remove all still registered listeners
-- for ( USHORT nPos = 0; nPos < aListeners.Count(); ++nPos )
-+#if USE_NEW_IMPL
-+#if 1
-+ ListenerArray::iterator itrEnd = mpImpl->maListeners.end();
-+ for (ListenerArray::iterator itr = mpImpl->maListeners.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxListener* pLis = *itr;
-+ if (pLis)
-+ pLis->RemoveBroadcaster_Impl(*this);
-+ }
-+#else
-+ UnregisterListenerFunc f(*this);
-+ for_each(mpImpl->maListeners.begin(), mpImpl->maListeners.end(), f);
-+#endif
-+#else
-+ for ( USHORT nPos = 0; nPos < mpImpl->maListeners.Count(); ++nPos )
- {
-- SfxListener *pListener = aListeners[nPos];
-+ SfxListener *pListener = static_cast<SfxListener*>(mpImpl->maListeners[nPos]);
- if ( pListener )
- pListener->RemoveBroadcaster_Impl(*this);
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-
- // simple ctor of class SfxBroadcaster
-
--SfxBroadcaster::SfxBroadcaster()
-+SfxBroadcaster::SfxBroadcaster() :
-+ mpImpl(new SfxBroadcasterImpl)
- {
- DBG_CTOR(SfxBroadcaster, 0);
- }
-@@ -133,16 +269,32 @@ SfxBroadcaster::SfxBroadcaster()
- // copy ctor of class SfxBroadcaster
-
-
--SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC )
-+SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC ) :
-+ mpImpl(new SfxBroadcasterImpl)
- {
- DBG_CTOR(SfxBroadcaster, 0);
-
-- for ( USHORT n = 0; n < rBC.aListeners.Count(); ++n )
-+#if USE_NEW_IMPL
-+#if 1
-+ ListenerArray::iterator itrEnd = mpImpl->maListeners.end();
-+ for (ListenerArray::iterator itr = mpImpl->maListeners.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxListener* pLis = *itr;
-+ if (pLis)
-+ pLis->StartListening(*this);
-+ }
-+#else
-+ RegisterListenerFunc f(*this);
-+ for_each(rBC.mpImpl->maListeners.begin(), rBC.mpImpl->maListeners.end(), f);
-+#endif
-+#else
-+ for ( USHORT n = 0; n < rBC.mpImpl->maListeners.Count(); ++n )
- {
-- SfxListener *pListener = rBC.aListeners[n];
-+ SfxListener *pListener = static_cast<SfxListener*>(rBC.mpImpl->maListeners[n]);
- if ( pListener )
- pListener->StartListening( *this );
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -152,21 +304,26 @@ SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC )
- BOOL SfxBroadcaster::AddListener( SfxListener& rListener )
- {
- DBG_CHKTHIS(SfxBroadcaster, 0);
-+#if USE_NEW_IMPL
-+ SfxListener *pListener = &rListener;
-+ mpImpl->maListeners.insert(pListener);
-+#else
- const SfxListener *pListener = &rListener;
- const SfxListener *pNull = 0;
-- USHORT nFreePos = aListeners.GetPos( pNull );
-- if ( nFreePos < aListeners.Count() )
-- aListeners.GetData()[nFreePos] = pListener;
-- else if ( aListeners.Count() < (USHRT_MAX-1) )
-- aListeners.Insert( pListener, aListeners.Count() );
-+ USHORT nFreePos = mpImpl->maListeners.GetPos( pNull );
-+ if ( nFreePos < mpImpl->maListeners.Count() )
-+ mpImpl->maListeners.GetData()[nFreePos] = pListener;
-+ else if ( mpImpl->maListeners.Count() < (USHRT_MAX-1) )
-+ mpImpl->maListeners.Insert( pListener, mpImpl->maListeners.Count() );
- else
- {
- DBG_ERROR( "array overflow" );
- return FALSE;
- }
-
-- DBG_ASSERT( USHRT_MAX != aListeners.GetPos(pListener),
-+ DBG_ASSERT( USHRT_MAX != mpImpl->maListeners.GetPos(pListener),
- "AddListener failed" );
-+#endif
- return TRUE;
- }
-
-@@ -182,17 +339,30 @@ void SfxBroadcaster::ListenersGone()
- //--------------------------------------------------------------------
-
- // forward a notification to all registered listeners
--
--void SfxBroadcaster::SFX_FORWARD(SfxBroadcaster& rBC, const TypeId& rBCType,
-- const SfxHint& rHint, const TypeId& rHintType)
-+void SfxBroadcaster::Forward(SfxBroadcaster& rBC, const SfxHint& rHint)
- {
-- const USHORT nCount = aListeners.Count();
-+#if USE_NEW_IMPL
-+#if 1
-+ ListenerArray::iterator itrEnd = mpImpl->maListeners.end();
-+ for (ListenerArray::iterator itr = mpImpl->maListeners.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxListener* pLis = *itr;
-+ if (pLis)
-+ pLis->Notify(rBC, rHint);
-+ }
-+#else
-+ NotifyListenerFunc f(rHint, rBC);
-+ for_each(mpImpl->maListeners.begin(), mpImpl->maListeners.end(), f);
-+#endif
-+#else
-+ const USHORT nCount = mpImpl->maListeners.Count();
- for ( USHORT i = 0; i < nCount; ++i )
- {
-- SfxListener *pListener = aListeners[i];
-+ SfxListener *pListener = mpImpl->maListeners[i];
- if ( pListener )
-- pListener->SFX_NOTIFY( rBC, rBCType, rHint, rHintType);
-+ pListener->Notify( rBC, rHint );
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -202,22 +372,71 @@ void SfxBroadcaster::SFX_FORWARD(SfxBroadcaster& rBC, const TypeId& rBCType,
- void SfxBroadcaster::RemoveListener( SfxListener& rListener )
- {
- {DBG_CHKTHIS(SfxBroadcaster, 0);}
-+#if USE_NEW_IMPL
-+ SfxListener *pListener = &rListener;
-+ fprintf(stdout, "SfxBroadcaster::RemoveListener: removing listener %p\n", pListener);
-+ ListenerArray::iterator itr = find(mpImpl->maListeners.begin(), mpImpl->maListeners.end(), pListener);
-+ if (itr == mpImpl->maListeners.end())
-+ {
-+ fprintf(stdout, "SfxBroadcaster::RemoveListener: listener not found!\n");
-+ // listener not found!
-+ return;
-+ }
-+
-+ fprintf(stdout, "SfxBroadcaster::RemoveListener: # listeners before removal: %d\n", mpImpl->maListeners.size());
-+ mpImpl->maListeners.erase(itr);
-+
-+ fprintf(stdout, "SfxBroadcaster::RemoveListener: # listeners after removal: %d\n", mpImpl->maListeners.size());
-+ for (itr = mpImpl->maListeners.begin(); itr != mpImpl->maListeners.end(); ++itr)
-+ fprintf(stdout, "SfxBroadcaster::RemoveListener: - listener %p\n", *itr);
-+
-+ if ( !HasListeners() )
-+ ListenersGone();
-+#else
- const SfxListener *pListener = &rListener;
-- USHORT nPos = aListeners.GetPos(pListener);
-+ USHORT nPos = mpImpl->maListeners.GetPos(pListener);
- DBG_ASSERT( nPos != USHRT_MAX, "RemoveListener: Listener unknown" );
-- aListeners.GetData()[nPos] = 0;
-+ mpImpl->maListeners.GetData()[nPos] = 0;
- if ( !HasListeners() )
- ListenersGone();
-+#endif
- }
-
- //--------------------------------------------------------------------
-
- BOOL SfxBroadcaster::HasListeners() const
- {
-- for ( USHORT n = 0; n < aListeners.Count(); ++n )
-- if ( aListeners.GetObject(n) != 0 )
-+#if USE_NEW_IMPL
-+ return !mpImpl->maListeners.empty();
-+#else
-+ for ( USHORT n = 0; n < mpImpl->maListeners.Count(); ++n )
-+ if ( mpImpl->maListeners.GetObject(n) != 0 )
- return TRUE;
- return FALSE;
-+#endif
- }
-
--//--------------------------------------------------------------------
-+// ----------------------------------------------------------------------------
-+
-+size_t SfxBroadcaster::GetListenerCount() const
-+{
-+#if USE_NEW_IMPL
-+ return mpImpl->maListeners.size();
-+#else
-+ return mpImpl->maListeners.Count();
-+#endif
-+}
-+
-+SfxListener* SfxBroadcaster::GetListener( size_t nNo ) const
-+{
-+#if USE_NEW_IMPL
-+ if (nNo >= mpImpl->maListeners.size())
-+ return NULL;
-+
-+ ListenerArray::const_iterator itr = mpImpl->maListeners.begin();
-+ ::std::advance(itr, nNo);
-+ return *itr;
-+#else
-+ return (SfxListener*) mpImpl->maListeners[nNo];
-+#endif
-+}
-diff --git a/svtools/source/notify/lstner.cxx b/svtools/source/notify/lstner.cxx
-index 25246c0..3f31a3f 100644
---- svtools/source/notify/lstner.cxx
-+++ svtools/source/notify/lstner.cxx
-@@ -39,20 +39,87 @@
-
- #include <svtools/hint.hxx>
- #include <svtools/brdcst.hxx>
-+#include <svtools/lstner.hxx>
-
--SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 )
-+#include <algorithm>
-+#include <hash_set>
-
--#define _SFX_LSTNER_CXX
--#include <svtools/lstner.hxx>
-+#define USE_NEW_IMPL 0
-+
-+using ::std::find;
-+using ::std::unary_function;
-+using ::std::advance;
-
- //====================================================================
- DBG_NAME(SfxListener)
- TYPEINIT0(SfxListener);
-
-+// ----------------------------------------------------------------------------
-+
-+struct SfxBroadcasterHash
-+{
-+ size_t operator()(SfxBroadcaster* p) const
-+ {
-+ return reinterpret_cast<size_t>(p);
-+ }
-+};
-+
-+#if USE_NEW_IMPL
-+typedef ::std::hash_multiset<SfxBroadcaster*, SfxBroadcasterHash> BroadcasterArray;
-+#else
-+SV_DECL_PTRARR( BroadcasterArray, SfxBroadcaster*, 0, 2 )
-+#endif
-+
-+struct SfxListenerImpl
-+{
-+ BroadcasterArray maBCs;
-+};
-+
-+// ----------------------------------------------------------------------------
-+
-+class StartListeningToBC : public unary_function<SfxBroadcaster*, void>
-+{
-+public:
-+ explicit StartListeningToBC(SfxListener& rListener) :
-+ mrListener(rListener)
-+ {
-+ }
-+
-+ void operator()(SfxBroadcaster* pBC)
-+ {
-+ mrListener.StartListening(*pBC);
-+ }
-+private:
-+ StartListeningToBC(); // disabled
-+
-+private:
-+ SfxListener& mrListener;
-+};
-+
-+class RemoveListenerFromBC : public unary_function<SfxBroadcaster*, void>
-+{
-+public:
-+ explicit RemoveListenerFromBC(SfxListener& rListener) :
-+ mrListener(rListener)
-+ {
-+ }
-+
-+ void operator()(SfxBroadcaster* pBC)
-+ {
-+ pBC->RemoveListener(mrListener);
-+ }
-+private:
-+ RemoveListenerFromBC(); // disabled
-+
-+private:
-+ SfxListener& mrListener;
-+};
-+
- //====================================================================
- // simple ctor of class SfxListener
-
--SfxListener::SfxListener()
-+SfxListener::SfxListener() :
-+ mpImpl(new SfxListenerImpl)
- {
- DBG_CTOR(SfxListener, 0);
- }
-@@ -60,13 +127,28 @@ SfxListener::SfxListener()
-
- // copy ctor of class SfxListener
-
--SfxListener::SfxListener( const SfxListener &rListener )
-+SfxListener::SfxListener( const SfxListener &rListener ) :
-+ mpImpl(new SfxListenerImpl)
- {
- DBG_CTOR(SfxListener, 0);
--
-- for ( USHORT n = 0; n < rListener.aBCs.Count(); ++n )
-- StartListening( *rListener.aBCs[n] );
-+#if USE_NEW_IMPL
-+#if 1
-+ BroadcasterArray::iterator itrEnd = rListener.mpImpl->maBCs.end();
-+ for (BroadcasterArray::iterator itr = rListener.mpImpl->maBCs.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxBroadcaster* pBC = *itr;
-+ StartListening(*pBC);
-+ }
-+#else
-+ StartListeningToBC f(*this);
-+ for_each(rListener.mpImpl->maBCs.begin(), rListener.mpImpl->maBCs.end(), f);
-+#endif
-+#else
-+ for ( USHORT n = 0; n < rListener.mpImpl->maBCs.Count(); ++n )
-+ StartListening( *rListener.mpImpl->maBCs[n] );
-+#endif
- }
-+
- //--------------------------------------------------------------------
-
- // unregisteres the SfxListener from its SfxBroadcasters
-@@ -76,11 +158,25 @@ SfxListener::~SfxListener()
- DBG_DTOR(SfxListener, 0);
-
- // unregister at all remainding broadcasters
-- for ( USHORT nPos = 0; nPos < aBCs.Count(); ++nPos )
-+#if USE_NEW_IMPL
-+#if 1
-+ BroadcasterArray::iterator itrEnd = mpImpl->maBCs.end();
-+ for (BroadcasterArray::iterator itr = mpImpl->maBCs.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxBroadcaster* pBC = *itr;
-+ pBC->RemoveListener(*this);
-+ }
-+#else
-+ RemoveListenerFromBC f(*this);
-+ for_each(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), f);
-+#endif
-+#else
-+ for ( USHORT nPos = 0; nPos < mpImpl->maBCs.Count(); ++nPos )
- {
-- SfxBroadcaster *pBC = aBCs[nPos];
-+ SfxBroadcaster *pBC = mpImpl->maBCs[nPos];
- pBC->RemoveListener(*this);
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -91,8 +187,20 @@ void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBC )
- {
- DBG_CHKTHIS(SfxListener, 0);
-
-+#if USE_NEW_IMPL
-+ SfxBroadcaster *pBC = &rBC;
-+ BroadcasterArray::iterator itr = ::std::find(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), pBC);
-+ if (itr == mpImpl->maBCs.end())
-+ {
-+ fprintf(stdout, "SfxListener::RemoveBroadcaster_Impl: broadcaster not found!!!\n");
-+ return;
-+ }
-+
-+ mpImpl->maBCs.erase(itr);
-+#else
- const SfxBroadcaster *pBC = &rBC;
-- aBCs.Remove( aBCs.GetPos(pBC), 1 );
-+ mpImpl->maBCs.Remove( mpImpl->maBCs.GetPos(pBC), 1 );
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -107,8 +215,13 @@ BOOL SfxListener::StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDup
- {
- if ( rBroadcaster.AddListener(*this) )
- {
-- const SfxBroadcaster *pBC = &rBroadcaster;
-- aBCs.Insert( pBC, aBCs.Count() );
-+#if USE_NEW_IMPL
-+ SfxBroadcaster *pBC = &rBroadcaster;
-+ mpImpl->maBCs.insert(pBC);
-+#else
-+ const SfxBroadcaster *pBC = &rBroadcaster;
-+ mpImpl->maBCs.Insert( pBC, mpImpl->maBCs.Count() );
-+#endif
-
- DBG_ASSERT( IsListening(rBroadcaster), "StartListening failed" );
- return TRUE;
-@@ -129,27 +242,50 @@ BOOL SfxListener::EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups )
- if ( !IsListening( rBroadcaster ) )
- return FALSE;
-
-+#if USE_NEW_IMPL
-+ do
-+ {
-+ rBroadcaster.RemoveListener(*this);
-+ SfxBroadcaster *pBC = &rBroadcaster;
-+ BroadcasterArray::iterator itr = ::std::find(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), pBC);
-+ if (itr != mpImpl->maBCs.end())
-+ mpImpl->maBCs.erase(itr);
-+ }
-+ while ( bAllDups && IsListening( rBroadcaster ) );
-+ return TRUE;
-+#else
- do
- {
- rBroadcaster.RemoveListener(*this);
- const SfxBroadcaster *pBC = &rBroadcaster;
-- aBCs.Remove( aBCs.GetPos(pBC), 1 );
-+ mpImpl->maBCs.Remove( mpImpl->maBCs.GetPos(pBC), 1 );
- }
- while ( bAllDups && IsListening( rBroadcaster ) );
- return TRUE;
-+#endif
- }
-
- //--------------------------------------------------------------------
-
- // unregisteres at a specific SfxBroadcaster by index
-
--void SfxListener::EndListening( USHORT nNo )
-+void SfxListener::EndListening( size_t nNo )
- {
- DBG_CHKTHIS(SfxListener, 0);
--
-- SfxBroadcaster *pBC = aBCs.GetObject(nNo);
-+#if USE_NEW_IMPL
-+ if (nNo >= mpImpl->maBCs.size())
-+ return;
-+
-+ BroadcasterArray::iterator itr = mpImpl->maBCs.begin();
-+ advance(itr, nNo);
-+ SfxBroadcaster* pBC = *itr;
-+ pBC->RemoveListener(*this);
-+ mpImpl->maBCs.erase(itr);
-+#else
-+ SfxBroadcaster *pBC = mpImpl->maBCs.GetObject(nNo);
- pBC->RemoveListener(*this);
-- aBCs.Remove( nNo, 1 );
-+ mpImpl->maBCs.Remove( nNo, 1 );
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -159,22 +295,64 @@ void SfxListener::EndListening( USHORT nNo )
- void SfxListener::EndListeningAll()
- {
- DBG_CHKTHIS(SfxListener, 0);
--
-- // MI: bei Optimierung beachten: Seiteneffekte von RemoveListener beachten!
-- while ( aBCs.Count() )
-+#if USE_NEW_IMPL
-+#if 1
-+ BroadcasterArray::iterator itrEnd = mpImpl->maBCs.end();
-+ for (BroadcasterArray::iterator itr = mpImpl->maBCs.begin(); itr != itrEnd; ++itr)
-+ {
-+ SfxBroadcaster* pBC = *itr;
-+ pBC->RemoveListener(*this);
-+ }
-+#else
-+ RemoveListenerFromBC f(*this);
-+ for_each(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), f);
-+#endif
-+ mpImpl->maBCs.clear();
-+#else
-+ while ( mpImpl->maBCs.Count() )
- {
-- SfxBroadcaster *pBC = aBCs.GetObject(0);
-+ SfxBroadcaster *pBC = mpImpl->maBCs.GetObject(0);
- pBC->RemoveListener(*this);
-- aBCs.Remove( 0, 1 );
-+ mpImpl->maBCs.Remove( 0, 1 );
- }
-+#endif
- }
-
- //--------------------------------------------------------------------
-
- BOOL SfxListener::IsListening( SfxBroadcaster& rBroadcaster ) const
- {
-+#if USE_NEW_IMPL
-+ SfxBroadcaster *pBC = &rBroadcaster;
-+ BroadcasterArray::const_iterator itr = find(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), pBC);
-+ return itr != mpImpl->maBCs.end();
-+#else
- const SfxBroadcaster *pBC = &rBroadcaster;
-- return USHRT_MAX != aBCs.GetPos( pBC );
-+ return USHRT_MAX != mpImpl->maBCs.GetPos( pBC );
-+#endif
-+}
-+
-+size_t SfxListener::GetBroadcasterCount() const
-+{
-+#if USE_NEW_IMPL
-+ return mpImpl->maBCs.size();
-+#else
-+ return mpImpl->maBCs.Count();
-+#endif
-+}
-+
-+SfxBroadcaster* SfxListener::GetBroadcasterJOE( size_t nNo ) const
-+{
-+#if USE_NEW_IMPL
-+ if (nNo >= mpImpl->maBCs.size())
-+ return NULL;
-+
-+ BroadcasterArray::const_iterator itr = mpImpl->maBCs.begin();
-+ advance(itr, nNo);
-+ return *itr;
-+#else
-+ return (SfxBroadcaster*) mpImpl->maBCs.GetObject(nNo);
-+#endif
- }
-
- //--------------------------------------------------------------------
-@@ -182,17 +360,22 @@ BOOL SfxListener::IsListening( SfxBroadcaster& rBroadcaster ) const
- // base implementation of notification handler
-
- #ifdef DBG_UTIL
--void SfxListener::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
-- const SfxHint&, const TypeId& rHintType )
-+void SfxListener::Notify( SfxBroadcaster& rBC, const SfxHint& )
- #else
--void SfxListener::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
-- const SfxHint&, const TypeId& )
-+void SfxListener::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& )
- #endif
- {
-- #ifdef DBG_UTIL
-+#ifdef DBG_UTIL
-+#if USE_NEW_IMPL
-+ SfxBroadcaster *pBC = &rBC;
-+ BroadcasterArray::const_iterator itr = find(mpImpl->maBCs.begin(), mpImpl->maBCs.end(), pBC);
-+ DBG_ASSERT( itr != mpImpl->maBCs.end(),
-+ "notification from unregistered broadcaster" );
-+#else
- const SfxBroadcaster *pBC = &rBC;
-- DBG_ASSERT( USHRT_MAX != aBCs.GetPos(pBC),
-+ DBG_ASSERT( USHRT_MAX != mpImpl->maBCs.GetPos(pBC),
- "notification from unregistered broadcaster" );
-- #endif
-+#endif
-+#endif
- }
-
diff --git a/patches/test/sfx2-test-kde-systray-stuff.diff b/patches/test/sfx2-test-kde-systray-stuff.diff
deleted file mode 100644
index 68b34e5b9..000000000
--- a/patches/test/sfx2-test-kde-systray-stuff.diff
+++ /dev/null
@@ -1,455 +0,0 @@
---- /dev/null 2007-04-20 17:59:41.000000000 +0200
-+++ sfx2/source/appl/shutdowniconkde.hxx 2007-06-29 20:10:18.000000000 +0200
-@@ -0,0 +1,50 @@
-+/***************************************************************************
-+ * Copyright (C) 2004 by Matthew Wlazlo *
-+ * mwlazlo@gmail.com *
-+ * *
-+ * This program is free software; you can redistribute it and/or modify *
-+ * it under the terms of the GNU General Public License as published by *
-+ * the Free Software Foundation; either version 2 of the License, or *
-+ * (at your option) any later version. *
-+ * *
-+ * This program 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 General Public License for more details. *
-+ * *
-+ * You should have received a copy of the GNU General Public License *
-+ * along with this program; if not, write to the *
-+ * Free Software Foundation, Inc., *
-+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
-+ ***************************************************************************/
-+
-+#ifndef KCHECKMAILTRAY_H
-+#define KCHECKMAILTRAY_H
-+
-+#include <ksystemtray.h>
-+#include <kiconeffect.h>
-+#include <qpixmap.h>
-+#include <qstring.h>
-+
-+class QMouseEvent;
-+
-+class KCheckGmailTray : public KSystemTray
-+{
-+ Q_OBJECT
-+
-+public:
-+ KCheckGmailTray(QWidget *parent = 0, const char *name = 0);
-+
-+protected:
-+ void mousePressEvent(QMouseEvent*);
-+
-+protected slots:
-+ // KPopupMenu
-+ void slotContextMenuActivated(int);
-+
-+private:
-+ void openDialog(const QString &url = QString::null);
-+};
-+
-+
-+#endif
---- /dev/null 2007-04-20 17:59:41.000000000 +0200
-+++ sfx2/source/appl/shutdowniconkde.cxx 2007-06-29 20:12:43.000000000 +0200
-@@ -0,0 +1,206 @@
-+#include "shutdowniconkde.hxx"
-+
-+#include <klocale.h>
-+#include <kcmdlineargs.h>
-+#include <kaboutdata.h>
-+#include <kglobal.h>
-+#include <kiconloader.h>
-+
-+#include <stdlib.h>
-+
-+#include <kapplication.h>
-+#include <kdebug.h>
-+#include <kglobal.h>
-+#include <kiconloader.h>
-+#include <kmessagebox.h>
-+#include <kpopupmenu.h>
-+#include <kuniqueapplication.h>
-+#include <kfiledialog.h>
-+
-+#include <qtooltip.h>
-+
-+#ifndef _SV_BITMAPEX_HXX
-+//#include <vcl/bitmapex.hxx>
-+#endif
-+#ifndef _SV_BMPACC_HXX
-+//#include <vcl/bmpacc.hxx>
-+#endif
-+#ifndef _SFXAPP_HXX
-+#include "app.hxx"
-+#endif
-+#ifndef _SFX_APP_HRC
-+#include "app.hrc"
-+#endif
-+#ifndef __SHUTDOWNICON_HXX__
-+#define USE_APP_SHORTCUTS
-+#include "shutdownicon.hxx"
-+#endif
-+
-+#include <vos/mutex.hxx>
-+
-+
-+
-+#define CONTEXT_OPEN_DIALOG 101
-+
-+#define Icon(x) KGlobal::instance()->iconLoader()->loadIcon(x, KIcon::Toolbar)
-+
-+KCheckGmailTray::KCheckGmailTray(QWidget *parent, const char *name)
-+ : KSystemTray(parent, name)
-+{
-+ setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-+ connect(this, SIGNAL(quitSelected()), kapp, SLOT(quit()));
-+
-+ QToolTip::add(this, i18n("KCheckGMail"));
-+ setPixmap(Icon("ooo-gulls"));
-+
-+ // initialise the menu
-+ KPopupMenu *menu = contextMenu();
-+ menu->clear();
-+ menu->insertTitle(SmallIcon("ooo-gulls"), i18n("KCheckGMail"));
-+ menu->insertItem(SmallIcon("konqueror"),
-+ i18n("&Open File"), CONTEXT_OPEN_DIALOG);
-+
-+ connect(menu, SIGNAL(activated(int)), SLOT(slotContextMenuActivated(int)));
-+}
-+
-+///////////////////////////////////////////////////////////////////////////
-+// Menu functions
-+///////////////////////////////////////////////////////////////////////////
-+
-+void KCheckGmailTray::slotContextMenuActivated(int n)
-+{
-+ fprintf (stderr, "KCheckGmailTray::slotContextMenuActivated\n");
-+
-+ kdDebug() << k_funcinfo << "context=" << n << endl;
-+
-+ switch(n) {
-+ case CONTEXT_OPEN_DIALOG:
-+ fprintf (stderr, "openDialog\n");
-+ openDialog();
-+ break;
-+ }
-+}
-+
-+void KCheckGmailTray::openDialog(const QString &url)
-+{
-+// QString text = KFileDialog::getOpenFileName();
-+
-+// if ( !text.isEmpty() )
-+// KMessageBox::information( NULL, text, "Your Path" );
-+// else
-+ KMessageBox::information( NULL, "No path selected\n");
-+}
-+
-+///////////////////////////////////////////////////////////////////////////
-+// Menu - related slots
-+///////////////////////////////////////////////////////////////////////////
-+
-+void KCheckGmailTray::mousePressEvent(QMouseEvent *ev)
-+{
-+ if(ev->button() == QMouseEvent::LeftButton) {
-+ openDialog();
-+ } else
-+ KSystemTray::mousePressEvent(ev);
-+
-+}
-+
-+static const char kcheckgmailVersion[] = "1.1";
-+static const KCmdLineOptions gOptions[] =
-+{
-+ { "legal", I18N_NOOP("Display legal information"), 0 },
-+ KCmdLineLastOption
-+};
-+
-+/*
-+int main(int argc, char **argv)
-+{
-+// KAboutData about("kcheckgmail",
-+ KAboutData about("ooo-gulls",
-+ I18N_NOOP("KCheckGMail"),
-+ kcheckgmailVersion,
-+ I18N_NOOP(
-+ "System tray application to display how many\nnew email "
-+ "messages you have in your Gmail account."),
-+ KAboutData::License_GPL,
-+ "(C) 2004 Matthew Wlazlo",
-+ 0, // text
-+ "http://kcheckgmail.sf.net",
-+ "kcheckgmail-development@lists.sourceforge.net");
-+
-+ about.addAuthor("Matthew Wlazlo", I18N_NOOP("Original author"), "mwlazlo@gmail.com");
-+ about.addAuthor("Raphael Geissert", I18N_NOOP("Maintainer"), "atomo64@gmail.com");
-+
-+ about.addCredit(I18N_NOOP("Everybody who helped testing and translating KCheckGMail"), 0, 0, 0);
-+
-+ KGlobal::locale()->setMainCatalogue("kcheckgmail");
-+
-+ KCmdLineArgs::init(argc, argv, &about);
-+ KCmdLineArgs::addCmdLineOptions(gOptions);
-+
-+ KUniqueApplication a;
-+ //KApplication a;
-+ KCheckGmailTray *hello = new KCheckGmailTray(0, "KCheckGmailTray");
-+ a.setMainWidget(hello);
-+
-+// hello->connect (&a, SIGNAL (shutDown()), oooqs, SLOT (killQuickstart()));
-+ hello->show();
-+
-+ return a.exec();
-+}
-+*/
-+
-+void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
-+{
-+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
-+
-+ if (KApplication::kApplication() == NULL)
-+ return;
-+
-+/*
-+ KAboutData about("ooo-gulls",
-+ I18N_NOOP("KCheckGMail"),
-+ kcheckgmailVersion,
-+ I18N_NOOP(
-+ "System tray application to display how many\nnew email "
-+ "messages you have in your Gmail account."),
-+ KAboutData::License_GPL,
-+ "(C) 2004 Matthew Wlazlo",
-+ 0, // text
-+ "http://kcheckgmail.sf.net",
-+ "kcheckgmail-development@lists.sourceforge.net");
-+
-+ about.addAuthor("Matthew Wlazlo", I18N_NOOP("Original author"), "mwlazlo@gmail.com");
-+ about.addAuthor("Raphael Geissert", I18N_NOOP("Maintainer"), "atomo64@gmail.com");
-+
-+ about.addCredit(I18N_NOOP("Everybody who helped testing and translating KCheckGMail"), 0, 0, 0);
-+
-+ KGlobal::locale()->setMainCatalogue("kcheckgmail");
-+
-+ char *my_argv[] = { "/usr/lib64/ooo-2.0/program/soffice.bin" };
-+ int my_argc = 1;
-+ KCmdLineArgs::init(my_argc, my_argv, &about);
-+ KCmdLineArgs::addCmdLineOptions(gOptions);
-+*/
-+
-+// KUniqueApplication a;
-+ //KApplication a;
-+ printf ("0\n");
-+ KCheckGmailTray *hello = new KCheckGmailTray(0, "KCheckGmailTray");
-+// KApplication::kApplication()->setMainWidget(hello);
-+
-+ printf ("1\n");
-+
-+// hello->connect (&a, SIGNAL (shutDown()), oooqs, SLOT (killQuickstart()));
-+ hello->show();
-+ printf ("2\n");
-+
-+// a.exec();
-+ printf ("3\n");
-+// KApplication::kApplication()->exec();
-+}
-+
-+void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
-+{
-+}
-+
-+#include <shutdowniconkde.moc.cxx>
---- /dev/null 2007-04-20 17:59:41.000000000 +0200
-+++ sfx2/source/appl/shutdowniconkde.moc.cxx 2007-06-28 16:04:04.000000000 +0200
-@@ -0,0 +1,104 @@
-+/****************************************************************************
-+** KCheckGmailTray meta object code from reading C++ file 'shutdowniconkde.hxx'
-+**
-+** Created: Thu Jun 28 14:04:04 2007
-+** by: The Qt MOC ($Id: qt/moc_yacc.cpp 3.3.7 edited Oct 19 16:22 $)
-+**
-+** WARNING! All changes made in this file will be lost!
-+*****************************************************************************/
-+
-+#undef QT_NO_COMPAT
-+#include "shutdowniconkde.hxx"
-+#include <qmetaobject.h>
-+#include <qapplication.h>
-+
-+#include <private/qucomextra_p.h>
-+#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
-+#error "This file was generated using the moc from 3.3.7. It"
-+#error "cannot be used with the include files from this version of Qt."
-+#error "(The moc has changed too much.)"
-+#endif
-+
-+const char *KCheckGmailTray::className() const
-+{
-+ return "KCheckGmailTray";
-+}
-+
-+QMetaObject *KCheckGmailTray::metaObj = 0;
-+static QMetaObjectCleanUp cleanUp_KCheckGmailTray( "KCheckGmailTray", &KCheckGmailTray::staticMetaObject );
-+
-+#ifndef QT_NO_TRANSLATION
-+QString KCheckGmailTray::tr( const char *s, const char *c )
-+{
-+ if ( qApp )
-+ return qApp->translate( "KCheckGmailTray", s, c, QApplication::DefaultCodec );
-+ else
-+ return QString::fromLatin1( s );
-+}
-+#ifndef QT_NO_TRANSLATION_UTF8
-+QString KCheckGmailTray::trUtf8( const char *s, const char *c )
-+{
-+ if ( qApp )
-+ return qApp->translate( "KCheckGmailTray", s, c, QApplication::UnicodeUTF8 );
-+ else
-+ return QString::fromUtf8( s );
-+}
-+#endif // QT_NO_TRANSLATION_UTF8
-+
-+#endif // QT_NO_TRANSLATION
-+
-+QMetaObject* KCheckGmailTray::staticMetaObject()
-+{
-+ if ( metaObj )
-+ return metaObj;
-+ QMetaObject* parentObject = KSystemTray::staticMetaObject();
-+ static const QUParameter param_slot_0[] = {
-+ { 0, &static_QUType_int, 0, QUParameter::In }
-+ };
-+ static const QUMethod slot_0 = {"slotContextMenuActivated", 1, param_slot_0 };
-+ static const QMetaData slot_tbl[] = {
-+ { "slotContextMenuActivated(int)", &slot_0, QMetaData::Protected }
-+ };
-+ metaObj = QMetaObject::new_metaobject(
-+ "KCheckGmailTray", parentObject,
-+ slot_tbl, 1,
-+ 0, 0,
-+#ifndef QT_NO_PROPERTIES
-+ 0, 0,
-+ 0, 0,
-+#endif // QT_NO_PROPERTIES
-+ 0, 0 );
-+ cleanUp_KCheckGmailTray.setMetaObject( metaObj );
-+ return metaObj;
-+}
-+
-+void* KCheckGmailTray::qt_cast( const char* clname )
-+{
-+ if ( !qstrcmp( clname, "KCheckGmailTray" ) )
-+ return this;
-+ return KSystemTray::qt_cast( clname );
-+}
-+
-+bool KCheckGmailTray::qt_invoke( int _id, QUObject* _o )
-+{
-+ switch ( _id - staticMetaObject()->slotOffset() ) {
-+ case 0: slotContextMenuActivated((int)static_QUType_int.get(_o+1)); break;
-+ default:
-+ return KSystemTray::qt_invoke( _id, _o );
-+ }
-+ return TRUE;
-+}
-+
-+bool KCheckGmailTray::qt_emit( int _id, QUObject* _o )
-+{
-+ return KSystemTray::qt_emit(_id,_o);
-+}
-+#ifndef QT_NO_PROPERTIES
-+
-+bool KCheckGmailTray::qt_property( int id, int f, QVariant* v)
-+{
-+ return KSystemTray::qt_property( id, f, v);
-+}
-+
-+bool KCheckGmailTray::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
-+#endif // QT_NO_PROPERTIES
---- sfx2/source/appl/shutdownicon.cxx.old 2007-04-26 12:07:39.000000000 +0200
-+++ sfx2/source/appl/shutdownicon.cxx 2007-06-29 19:57:36.000000000 +0200
-@@ -231,6 +231,7 @@ void ShutdownIcon::initSystray()
- return;
- m_bInitialized = true;
-
-+ fprintf(stderr, "Loading module\n");
- (void) LoadModule( &m_pPlugin, &m_pInitSystray, &m_pDeInitSystray );
- m_bVeto = true;
- m_pInitSystray();
-@@ -826,6 +827,7 @@ bool ShutdownIcon::GetAutostart( )
-
- void ShutdownIcon::SetAutostart( bool bActivate )
- {
-+fprintf(stderr, "ShutdownIcon::SetAutostart\n");
- #ifdef ENABLE_QUICKSTART_APPLET
- OUString aShortcut( getShortcutName() );
-
---- sfx2/source/appl/makefile.mk.old 2007-03-26 17:03:27.000000000 +0200
-+++ sfx2/source/appl/makefile.mk 2007-06-28 16:02:38.000000000 +0200
-@@ -55,13 +55,18 @@ CFLAGS+=-DENABLE_QUICKSTART_APPLET
-
- .IF "$(GUI)"=="UNX"
- CDEFS+=-DDLL_NAME=libsfx$(UPD)$(DLLPOSTFIX)$(DLLPOST)
--.IF "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
-- PKGCONFIG_MODULES=gtk+-2.0
-- .INCLUDE: pkg_config.mk
-- CFLAGS+=$(PKGCONFIG_CFLAGS)
-+#.IF "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
-+# PKGCONFIG_MODULES=gtk+-2.0
-+# .INCLUDE: pkg_config.mk
-+# CFLAGS+=$(PKGCONFIG_CFLAGS)
-+# CFLAGS+=-DENABLE_QUICKSTART_APPLET
-+# CDEFS+=-DPLUGIN_NAME=libqstart_gtk$(UPD)$(DLLPOSTFIX)$(DLLPOST)
-+#.ENDIF # "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
-+.IF "$(ENABLE_KDE)" != ""
-+ CFLAGS+=$(KDE_CFLAGS)
- CFLAGS+=-DENABLE_QUICKSTART_APPLET
-- CDEFS+=-DPLUGIN_NAME=libqstart_gtk$(UPD)$(DLLPOSTFIX)$(DLLPOST)
--.ENDIF # "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
-+ CDEFS+=-DPLUGIN_NAME=libqstart_kde$(UPD)$(DLLPOSTFIX)$(DLLPOST)
-+.ENDIF # "$(ENABLE_KDE)" != ""
- .ELSE
- CDEFS+=-DDLL_NAME=sfx$(UPD)$(DLLPOSTFIX)$(DLLPOST)
- .ENDIF
-@@ -125,6 +130,15 @@ LIB2TARGET= $(SLB)$/quickstart.lib
- LIB2OBJFILES= $(QUICKSTART_OBJECTS)
- .ENDIF
-
-+.IF "$(ENABLE_KDE)" != ""
-+QUICKSTART_KDE_OBJECTS = $(SLO)$/shutdowniconkde.obj
-+SLOFILES += $(QUICKSTART_KDE_OBJECTS)
-+
-+LIB3TARGET= $(SLB)$/quickstartkde.lib
-+LIB3OBJFILES= $(QUICKSTART_KDE_OBJECTS)
-+.ENDIF
-+
-+
- EXCEPTIONSFILES=\
- $(SLO)$/imagemgr.obj \
- $(SLO)$/appopen.obj \
---- sfx2/util/makefile.mk.old 2007-04-11 23:32:57.000000000 +0200
-+++ sfx2/util/makefile.mk 2007-06-29 20:08:20.000000000 +0200
-@@ -161,6 +161,22 @@ SHL3NOCHECK=TRUE
- .ENDIF # "$(ENABLE_SYSTRAY_GTK)"=="TRUE"
- .ENDIF # "$(GUI)"=="UNX"
-
-+# kde quick-starter
-+.IF "$(GUI)"=="UNX"
-+.IF "$(ENABLE_KDE)" != ""
-+CFLAGS+=$(KDE_CFLAGS)
-+
-+SHL4TARGET=qstart_kde$(UPD)$(DLLPOSTFIX)
-+SHL4LIBS=$(SLB)$/quickstartkde.lib
-+SHL4DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN)
-+# libs for kde plugin
-+SHL4STDLIBS=$(SHL1STDLIBS) $(SFX2LIB)
-+SHL4STDLIBS+=$(KDE_LIBS)
-+# FIXME: -lkio is needed just to show that the open dialog works
-+#SHL4STDLIBS+=-lkio
-+.ENDIF # "$(ENABLE_KDE)" != ""
-+.ENDIF # "$(GUI)"=="UNX"
-+
- # --- Targets ------------------------------------------------------
-
-
diff --git a/patches/test/size-intern.diff b/patches/test/size-intern.diff
deleted file mode 100644
index 290aa1832..000000000
--- a/patches/test/size-intern.diff
+++ /dev/null
@@ -1,180 +0,0 @@
---- framework/source/services/urltransformer.cxx 2007-01-29 18:25:38.000000000 +0000
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/services/urltransformer.cxx 2006-12-01 17:54:13.000000000 +0000
-@@ -229,7 +229,6 @@
- // INetURLObject supports only an intelligent method of parsing URL's. So write
- // back Complete to have a valid encoded URL in all cases!
- aURL.Complete = aParser.GetMainURL( INetURLObject::NO_DECODE );
-- aURL.Complete = aURL.Complete.intern();
-
- aParser.SetMark ( OUString() );
- aParser.SetParam( OUString() );
-diff -r -u framework/source/xml/menudocumenthandler.cxx /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/menudocumenthandler.cxx
---- configmgr/source/backend/binaryreader.cxx 2007-01-29 18:22:49.000000000 +0000
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/configmgr/source/backend/binaryreader.cxx 2006-12-01 17:52:27.000000000 +0000
-@@ -542,8 +542,8 @@
-
- rtl_TextEncoding const enc = bIsAscii ? RTL_TEXTENCODING_ASCII_US : RTL_TEXTENCODING_UTF8;
-
-- rtl_uString_internConvert( &result.pData, pUTF, nStrLength,
-- enc, OSTRING_TO_OUSTRING_CVTFLAGS);
-+ rtl_string2UString( &result.pData, pUTF, nStrLength,
-+ enc, OSTRING_TO_OUSTRING_CVTFLAGS);
- }
-
- return result;
---- vcl/source/gdi/impimagetree.cxx 2007-01-29 18:28:35.000000000 +0000
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/vcl/source/gdi/impimagetree.cxx 2006-12-01 17:58:01.000000000 +0000
-@@ -594,7 +594,7 @@
- }
-
- if( !rReturn.IsEmpty() )
-- aBmpExHashMap[ rName.intern() ] = rReturn;
-+ aBmpExHashMap[ rName ] = rReturn;
-
- return( !rReturn.IsEmpty() );
- }
---- package/source/zipapi/ZipFile.cxx 2007-01-29 18:31:27.000000000 +0000
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/package/source/zipapi/ZipFile.cxx 2006-12-01 17:55:38.000000000 +0000
-@@ -798,9 +798,9 @@
- if ( aEntry.nExtraLen > ZIP_MAXEXTRA )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "extra header info exceeds ZIP_MAXEXTRA bytes") ), Reference < XInterface > () );
-
-- aEntry.sName = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
-- aEntry.nNameLen,
-- RTL_TEXTENCODING_ASCII_US);
-+ aEntry.sName = OUString ( (sal_Char *) aMemGrabber.getCurrentPos(),
-+ aEntry.nNameLen,
-+ RTL_TEXTENCODING_ASCII_US);
-
- aMemGrabber.skipBytes( aEntry.nNameLen + aEntry.nExtraLen + nCommentLen );
- aEntries[aEntry.sName] = aEntry;
---- vcl/source/gdi/impimage.cxx 2007-01-29 19:19:06.000000000 +0000
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/vcl/source/gdi/impimage.cxx 2007-01-26 17:25:30.000000000 +0000
-@@ -142,11 +142,10 @@
- void ImplImageList::AddImage( const ::rtl::OUString &aName,
- USHORT nId, const BitmapEx &aBitmapEx )
- {
-- rtl::OUString aIName = aName.intern();
-- ImageAryData *pImg = new ImageAryData( aIName, nId, aBitmapEx );
-+ ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx );
- maImages.push_back( pImg );
-- if( aIName.getLength() )
-- maNameHash [ aIName ] = pImg;
-+ if( aName.getLength() )
-+ maNameHash [ aName ] = pImg;
- }
-
- void ImplImageList::RemoveImage( USHORT nPos )
---- psprint/source/fontmanager/fontcache.cxx 2007-01-29 23:22:49.000000000 +0100
-+++ /opt/OpenOffice/HEAD/build/OOE680_m6/psprint/source/fontmanager/fontcache.cxx 2007-01-26 18:25:30.000000000 +0100
-@@ -462,9 +462,7 @@
- default: break;
- }
- if( nTokens > nStyleTokenNr )
-- pFont->m_aStyleName = OUString::intern( pLine + nTokenPos[nStyleTokenNr],
-- nLen - nTokenPos[nStyleTokenNr],
-- RTL_TEXTENCODING_UTF8 );
-+ pFont->m_aStyleName = OUString( pLine + nTokenPos[nStyleTokenNr], nLen - nTokenPos[nStyleTokenNr], RTL_TEXTENCODING_UTF8 );
-
- bool bObsolete = false;
- if( bKeepOnlyUserOverridden )
-diff -r -u /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/acceleratorconfigurationreader.cxx framework/source/xml/acceleratorconfigurationreader.cxx
---- /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/acceleratorconfigurationreader.cxx 2007-01-29 23:38:23.000000000 +0100
-+++ framework/source/xml/acceleratorconfigurationreader.cxx 2007-01-29 23:38:23.000000000 +0100
-@@ -185,7 +185,7 @@
- switch(eAttribute)
- {
- case E_ATTRIBUTE_URL :
-- sCommand = sValue;
-+ sCommand = sValue.intern();
- break;
-
- case E_ATTRIBUTE_KEYCODE :
-Only in framework/source/xml: acceleratorconfigurationreader.cxx~
-diff -r -u /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/menudocumenthandler.cxx framework/source/xml/menudocumenthandler.cxx
---- /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/menudocumenthandler.cxx 2007-01-29 23:38:23.000000000 +0100
-+++ framework/source/xml/menudocumenthandler.cxx 2007-01-29 23:41:53.000000000 +0100
-@@ -163,6 +163,7 @@
- if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
- {
- rProp[i].Value >>= rCommandURL;
-+ rCommandURL = rCommandURL.intern();
- }
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- {
-@@ -258,7 +259,7 @@
- rProps[4].Name = m_aType;
-
- // Common values
-- rProps[0].Value <<= rCommandURL;
-+ rProps[0].Value <<= rCommandURL.intern();
- rProps[1].Value <<= rHelpId;
- rProps[2].Value <<= Reference< XIndexContainer >();
- rProps[3].Value <<= rLabel;
-Only in framework/source/xml: menudocumenthandler.cxx~
-diff -r -u /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/statusbardocumenthandler.cxx framework/source/xml/statusbardocumenthandler.cxx
---- /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/statusbardocumenthandler.cxx 2007-01-29 23:38:23.000000000 +0100
-+++ framework/source/xml/statusbardocumenthandler.cxx 2007-01-29 23:38:23.000000000 +0100
-@@ -151,6 +151,7 @@
- if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
- {
- rProp[i].Value >>= rCommandURL;
-+ rCommandURL = rCommandURL.intern();
- }
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- {
-Only in framework/source/xml: statusbardocumenthandler.cxx~
-diff -r -u /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/toolboxdocumenthandler.cxx framework/source/xml/toolboxdocumenthandler.cxx
---- /opt/OpenOffice/HEAD/build/OOE680_m6/framework/source/xml/toolboxdocumenthandler.cxx 2007-01-29 23:38:23.000000000 +0100
-+++ framework/source/xml/toolboxdocumenthandler.cxx 2007-01-29 23:43:18.000000000 +0100
-@@ -122,7 +122,10 @@
- for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
- {
- if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
-+ {
- rProp[i].Value >>= rCommandURL;
-+ rCommandURL = rCommandURL.intern();
-+ }
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- rProp[i].Value >>= rHelpURL;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
-@@ -362,7 +365,7 @@
- case TB_ATTRIBUTE_URL:
- {
- bAttributeURL = sal_True;
-- aCommandURL = xAttribs->getValueByIndex( n );
-+ aCommandURL = xAttribs->getValueByIndex( n ).intern();
- }
- break;
-
-diff -r -u /opt/OpenOffice/HEAD/build/OOE680_m6/tools/source/string/strucvt.cxx tools/source/string/strucvt.cxx
---- /opt/OpenOffice/HEAD/build/OOE680_m6/tools/source/string/strucvt.cxx 2006-12-01 18:57:51.000000000 +0100
-+++ tools/source/string/strucvt.cxx 2007-01-30 15:38:26.000000000 +0100
-@@ -167,6 +167,16 @@
- return *this;
- }
-
-+UniString UniString::intern() const
-+{
-+ UniString aStr;
-+
-+ rtl_uString_intern( reinterpret_cast<rtl_uString **>(&aStr.mpData),
-+ (rtl_uString *)(&mpData) );
-+
-+ return aStr;
-+}
-+
- // =======================================================================
-
- #ifndef _TOOLS_RC_HXX
---- /opt/OpenOffice/HEAD/build/OOE680_m6/tools/inc/string.hxx 2006-12-01 18:57:51.000000000 +0100
-+++ tools/inc/string.hxx 2007-01-30 15:38:07.000000000 +0100
-@@ -516,6 +516,8 @@
- return rtl::OUString (reinterpret_cast<rtl_uString*>(mpData));
- }
-
-+ UniString intern() const;
-+
- static UniString CreateFromAscii( const sal_Char* pAsciiStr );
- static UniString CreateFromAscii( const sal_Char* pAsciiStr, xub_StrLen nLen );
-
diff --git a/patches/test/size-sound-framework.diff b/patches/test/size-sound-framework.diff
deleted file mode 100644
index cad91170c..000000000
--- a/patches/test/size-sound-framework.diff
+++ /dev/null
@@ -1,117 +0,0 @@
-Index: framework/inc/dispatch/soundhandler.hxx
-===================================================================
-RCS file: /cvs/framework/framework/inc/dispatch/soundhandler.hxx,v
-retrieving revision 1.4
-diff -u -r1.4 soundhandler.hxx
---- framework/inc/dispatch/soundhandler.hxx 9 Sep 2005 00:14:47 -0000 1.4
-+++ framework/inc/dispatch/soundhandler.hxx 1 Nov 2005 12:07:58 -0000
-@@ -120,10 +120,6 @@
- #include <cppuhelper/weak.hxx>
- #endif
-
--#ifndef _SV_SOUND_HXX
--#include <vcl/sound.hxx>
--#endif
--
- //_________________________________________________________________________________________________________________
- // namespace
- //_________________________________________________________________________________________________________________
-@@ -209,7 +205,9 @@
- // private methods
- //-------------------------------------------------------------------------------------------------------------
- private:
-+#if 0
- DECL_LINK( implts_PlayerNotify, void* );
-+#endif
-
- //-------------------------------------------------------------------------------------------------------------
- // variables
-@@ -219,7 +217,9 @@
-
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// global uno service factory to create new services
- css::uno::Reference< css::uno::XInterface > m_xSelfHold ; /// we must protect us against dieing during async(!) dispatch() call!
-+#if 0
- Sound m_aPlayer ; /// used vcl player to play sounds ... works asynchron ... That's why "self hold" and "request count" ...
-+#endif
- css::uno::Reference< css::frame::XDispatchResultListener > m_xListener ;
-
- }; // class SoundHandler
-Index: framework/source/dispatch/soundhandler.cxx
-===================================================================
-RCS file: /cvs/framework/framework/source/dispatch/soundhandler.cxx,v
-retrieving revision 1.12
-diff -u -r1.12 soundhandler.cxx
---- framework/source/dispatch/soundhandler.cxx 9 Sep 2005 01:22:06 -0000 1.12
-+++ framework/source/dispatch/soundhandler.cxx 1 Nov 2005 12:07:59 -0000
-@@ -159,9 +159,13 @@
- , ::cppu::OWeakObject ( )
- // Init member
- , m_xFactory ( xFactory )
-+#if 0
- , m_aPlayer ( )
-+#endif
- {
-+#if 0
- m_aPlayer.SetNotifyHdl( LINK( this, SoundHandler, implts_PlayerNotify ) );
-+#endif
- }
-
- /*-************************************************************************************************************//**
-@@ -216,6 +220,7 @@
- // SAFE {
- ResetableGuard aLock( m_aLock );
-
-+#if 0
- // If player currently used for other dispatch() requests ...
- // cancel it by calling stop()!
- if (m_aPlayer.IsPlaying())
-@@ -234,6 +239,7 @@
- m_xSelfHold = css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- m_aPlayer.Play();
- }
-+#endif
-
- // } SAFE
- aLock.unlock();
-@@ -242,7 +248,9 @@
- void SAL_CALL SoundHandler::dispatch( const css::util::URL& aURL ,
- const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException )
- {
-+#if 0
- dispatchWithNotification(aURL, lArguments, css::uno::Reference< css::frame::XDispatchResultListener >());
-+#endif
- }
-
- /*-************************************************************************************************************//**
-@@ -274,6 +282,7 @@
- // Our default is "nothing". So we can return it, if detection failed or fily type is realy unknown.
- ::rtl::OUString sTypeName;
-
-+#if 0
- // Analyze given descriptor to find filename or input stream or ...
- ::comphelper::MediaDescriptor aDescriptor(lDescriptor);
- ::rtl::OUString sURL = aDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_URL(), ::rtl::OUString());
-@@ -293,7 +302,7 @@
- aDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] <<= sTypeName;
- aDescriptor >> lDescriptor;
- }
--
-+#endif
- // Return our decision.
- return sTypeName;
- }
-@@ -311,6 +320,7 @@
- @onerror -
- @threadsafe yes
- *//*-*************************************************************************************************************/
-+#if 0
- IMPL_LINK( SoundHandler, implts_PlayerNotify, void*, pVoid )
- {
- // SAFE {
-@@ -344,5 +354,6 @@
-
- return 0;
- }
-+#endif
-
- } // namespace framework
diff --git a/patches/test/size-sound-sc.diff b/patches/test/size-sound-sc.diff
deleted file mode 100644
index 9b080b29b..000000000
--- a/patches/test/size-sound-sc.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-Index: sc/source/ui/view/tabvwshg.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/ui/view/tabvwshg.cxx,v
-retrieving revision 1.9
-diff -u -r1.9 tabvwshg.cxx
---- sc/source/ui/view/tabvwshg.cxx 8 Sep 2005 23:12:04 -0000 1.9
-+++ sc/source/ui/view/tabvwshg.cxx 1 Nov 2005 12:43:25 -0000
-@@ -60,9 +60,6 @@
- #include "document.hxx"
- #include "drawview.hxx"
- #include "globstr.hrc"
--#ifndef _SV_SOUND_HXX
--#include <vcl/sound.hxx>
--#endif
-
- //------------------------------------------------------------------------
-
-@@ -117,12 +114,14 @@
- aAny <<= eButtonType;
- xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "ButtonType" ), aAny );
-
-+#if 0
- if ( Sound::IsSoundFile( rURL ) )
- {
- // #105638# OJ
- aAny <<= sal_True;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aAny );
- }
-+#endif
-
- Point aPos;
- if (pInsPos)
diff --git a/patches/test/size-sound-sd.diff b/patches/test/size-sound-sd.diff
deleted file mode 100644
index cf75f15bd..000000000
--- a/patches/test/size-sound-sd.diff
+++ /dev/null
@@ -1,249 +0,0 @@
-Index: sd/source/ui/dlg/filedlg.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/dlg/filedlg.cxx,v
-retrieving revision 1.13
-diff -u -p -u -r1.13 filedlg.cxx
---- sd/source/ui/dlg/filedlg.cxx 9 Sep 2005 04:00:47 -0000 1.13
-+++ sd/source/ui/dlg/filedlg.cxx 1 Nov 2005 12:42:01 -0000
-@@ -75,9 +75,6 @@
- #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
- #endif
-
--#ifndef _SOUND_HXX //autogen
--#include <vcl/sound.hxx>
--#endif
- #ifndef _SV_MSGBOX_HXX
- #include <vcl/msgbox.hxx>
- #endif
-@@ -126,7 +123,6 @@ private:
-
- css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > mxControlAccess;
-
-- Sound maSound;
- ULONG mnPlaySoundEvent;
- BOOL mbUsableSelection;
- BOOL mbLabelPlaying;
-@@ -180,11 +176,11 @@ IMPL_LINK( SdFileDialog_Imp, PlayMusicHd
- if( mbLabelPlaying )
- {
- // switch from playing to not playing
--
-+#if 0
- // reset, so that sound file gets unlocked
- maSound.Stop();
- maSound.SetSoundName( String() );
--
-+#endif
- try
- {
- mxControlAccess->setLabel( css::ui::dialogs::ExtendedFilePickerElementIds::PUSHBUTTON_PLAY,
-@@ -201,6 +197,7 @@ IMPL_LINK( SdFileDialog_Imp, PlayMusicHd
- }
- else
- {
-+#if 0
- // switch from not playing to playing of current file
- if( maSound.IsPlaying() )
- {
-@@ -243,6 +241,7 @@ IMPL_LINK( SdFileDialog_Imp, PlayMusicHd
- maSound.SetSoundName( String() );
- }
- }
-+#endif
- }
-
- return 0;
-@@ -257,8 +256,10 @@ IMPL_LINK( SdFileDialog_Imp, StopMusicHd
-
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
-+#if 0
- // reset, so that sound file gets unlocked
- maSound.SetSoundName( String() );
-+#endif
-
- if( mxControlAccess.is() )
- {
-Index: sd/source/ui/view/drviewse.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/view/drviewse.cxx,v
-retrieving revision 1.55
-diff -u -p -u -r1.55 drviewse.cxx
---- sd/source/ui/view/drviewse.cxx 9 Sep 2005 07:12:08 -0000 1.55
-+++ sd/source/ui/view/drviewse.cxx 1 Nov 2005 12:45:23 -0000
-@@ -122,9 +122,6 @@
- #ifndef _URLOBJ_HXX //autogen
- #include <tools/urlobj.hxx>
- #endif
--#ifndef _SV_SOUND_HXX
--#include <vcl/sound.hxx>
--#endif
-
- // #UndoRedo#
- #ifndef _SFXSLSTITM_HXX
-@@ -1717,12 +1714,14 @@ void DrawViewShell::InsertURLButton(cons
- form::FormButtonType eButtonType = form::FormButtonType_URL;
- aTmp <<= eButtonType;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), aTmp );
-+#if 0
- if ( Sound::IsSoundFile( rURL ) )
- {
- // #105638# OJ
- aTmp <<= sal_True;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aTmp );
- }
-+#endif
- }
- }
-
-@@ -1757,12 +1756,14 @@ void DrawViewShell::InsertURLButton(cons
- form::FormButtonType eButtonType = form::FormButtonType_URL;
- aTmp <<= eButtonType;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), aTmp );
-+#if 0
- // #105638# OJ
- if ( Sound::IsSoundFile( rURL ) )
- {
- aTmp <<= sal_True;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aTmp );
- }
-+#endif
-
- Point aPos;
-
-Index: sd/source/ui/inc/fusel.hxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/inc/fusel.hxx,v
-retrieving revision 1.5
-diff -u -r1.5 fusel.hxx
---- sd/source/ui/inc/fusel.hxx 9 Sep 2005 05:39:10 -0000 1.5
-+++ sd/source/ui/inc/fusel.hxx 1 Nov 2005 13:05:00 -0000
-@@ -42,7 +42,6 @@
-
- class SdrHdl;
- class SdrObject;
--class Sound;
-
-
- namespace sd {
-@@ -92,10 +91,12 @@
- BOOL bSuppressChangesOfSelection;
- BOOL bMirrorSide0;
- USHORT nEditMode;
-+#if 0
- Sound* pSound;
-
- DECL_LINK( SoundHasStoppedHdl, void* );
- DECL_STATIC_LINK( FuSelection, StaticSoundHasStoppedHdl, Sound* );
-+#endif
-
- private:
- /** This pointer stores a canidate for assigning a style in the water
-Index: sd/source/ui/func/fusel.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/func/fusel.cxx,v
-retrieving revision 1.34
-diff -u -r1.34 fusel.cxx
---- sd/source/ui/func/fusel.cxx 23 Sep 2005 11:01:07 -0000 1.34
-+++ sd/source/ui/func/fusel.cxx 1 Nov 2005 13:05:32 -0000
-@@ -58,9 +58,6 @@
- #ifndef _GOODIES_IMAPOBJ_HXX //autogen
- #include <svtools/imapobj.hxx>
- #endif
--#ifndef _SV_SOUND_HXX //autogen
--#include <vcl/sound.hxx>
--#endif
- #include <svtools/urihelper.hxx>
- #include <unotools/localfilehelper.hxx>
- #include <svx/svxids.hrc>
-@@ -170,7 +167,9 @@
- bSuppressChangesOfSelection(FALSE),
- bMirrorSide0(FALSE),
- nEditMode(SID_BEZIER_MOVE),
-+#if 0
- pSound(NULL),
-+#endif
- pWaterCanCandidate(NULL)
- {
- // Objektbar auswaehlen
-@@ -189,8 +188,10 @@
- pView->UnmarkAllPoints();
- pView->ShowMirrored();
- pView->ResetCreationActive();
-+#if 0
- delete pSound;
- pSound = NULL;
-+#endif
-
- if ( pView->GetDragMode() != SDRDRAG_MOVE )
- {
-@@ -1218,12 +1219,14 @@
- |*
- \************************************************************************/
-
-+#if 0
- IMPL_LINK( FuSelection, SoundHasStoppedHdl, void*, p )
- {
- pSound->SetNotifyHdl( Link() );
- pSound->SetSoundName( String() );
- return 0L;
- }
-+#endif
-
-
- /*************************************************************************
-@@ -1378,6 +1381,7 @@
-
- case presentation::ClickAction_SOUND:
- {
-+#if 0
- // Sound asynchron abspielen
- if( !pSound )
- {
-@@ -1388,6 +1392,7 @@
- pSound->SetSoundName( pInfo->aBookmark );
- pSound->Play();
- bAnimated = TRUE;
-+#endif
- }
- break;
-
-Index: sd/source/ui/func/fuslsel.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/func/fuslsel.cxx,v
-retrieving revision 1.18
-diff -u -r1.18 fuslsel.cxx
---- sd/source/ui/func/fuslsel.cxx 9 Sep 2005 04:51:14 -0000 1.18
-+++ sd/source/ui/func/fuslsel.cxx 1 Nov 2005 13:05:35 -0000
-@@ -102,7 +102,9 @@
- bPageHit(FALSE),
- bDragSelection(FALSE)
- {
-+#if 0
- pSound = new Sound;
-+#endif
-
- pIsShowingEffectInfo = new FSS_IsShowingEffectInfo;
- pIsShowingEffectInfo->bDisposed = FALSE;
-@@ -117,7 +119,9 @@
- FuSlideSelection::~FuSlideSelection()
- {
- aDragTimer.Stop();
-+#if 0
- delete pSound;
-+#endif
-
- if( pIsShowingEffectInfo && pIsShowingEffectInfo->bIsShowingEffect )
- {
-@@ -483,9 +487,11 @@
-
- void FuSlideSelection::Deactivate()
- {
-+#if 0
- // Sound nicht mehr blockieren, damit er in der Show gespielt werden kann
- if (pSound)
- pSound->Stop();
-+#endif
-
- FuSlide::Deactivate();
- }
diff --git a/patches/test/size-sound-svx.diff b/patches/test/size-sound-svx.diff
deleted file mode 100644
index 07df9fdf6..000000000
--- a/patches/test/size-sound-svx.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-Index: svx/source/gallery2/galctrl.cxx
-===================================================================
-RCS file: /cvs/graphics/svx/source/gallery2/galctrl.cxx,v
-retrieving revision 1.21
-diff -u -p -u -r1.21 galctrl.cxx
---- svx/source/gallery2/galctrl.cxx 8 Sep 2005 23:06:32 -0000 1.21
-+++ svx/source/gallery2/galctrl.cxx 1 Nov 2005 11:57:49 -0000
-@@ -64,7 +64,6 @@ GalleryPreview::GalleryPreview( GalleryB
- {
- SetHelpId( HID_GALLERY_WINDOW );
- InitSettings();
-- aSound.SetNotifyHdl( LINK( this, GalleryPreview, SoundEndHdl ) );
- }
-
- // ------------------------------------------------------------------------
-@@ -77,7 +76,6 @@ GalleryPreview::GalleryPreview( Window*
- {
- SetHelpId( HID_GALLERY_PREVIEW );
- InitSettings();
-- aSound.SetNotifyHdl( LINK( this, GalleryPreview, SoundEndHdl ) );
- }
-
- // ------------------------------------------------------------------------
-@@ -276,14 +274,6 @@ void GalleryPreview::PreviewMedia( const
- }
- }
-
--// ------------------------------------------------------------------------
--
--IMPL_LINK( GalleryPreview, SoundEndHdl, Sound*, pSound )
--{
-- aSound.SetSoundName( String() );
-- return 0L;
--}
--
- // -------------------
- // - GalleryIconView -
- // -------------------
-Index: svx/inc/galctrl.hxx
-===================================================================
-RCS file: /cvs/graphics/svx/inc/galctrl.hxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 galctrl.hxx
---- svx/inc/galctrl.hxx 8 Sep 2005 17:48:15 -0000 1.5
-+++ svx/inc/galctrl.hxx 1 Nov 2005 11:57:49 -0000
-@@ -45,7 +45,6 @@
- #include <vcl/menu.hxx>
- #include <vcl/edit.hxx>
- #include <vcl/combobox.hxx>
--#include <vcl/sound.hxx>
- #include <svtools/slstitm.hxx>
- #include <svtools/transfer.hxx>
- #include <svtools/valueset.hxx>
-@@ -74,7 +73,6 @@ private:
-
- GraphicObject aGraphicObj;
- Rectangle aPreviewRect;
-- Sound aSound;
- GalleryTheme* mpTheme;
-
- SVX_DLLPRIVATE BOOL ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
-@@ -95,8 +93,7 @@ private:
- // DragSourceHelper
- SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
-
-- DECL_LINK( MenuSelectHdl, Menu* );
-- DECL_LINK( SoundEndHdl, Sound* );
-+ DECL_LINK( MenuSelectHdl, Menu* );
-
- public:
-
diff --git a/patches/test/size-sound-sw.diff b/patches/test/size-sound-sw.diff
deleted file mode 100644
index ed02d9727..000000000
--- a/patches/test/size-sound-sw.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-Index: sw/source/ui/shells/textdrw.cxx
-===================================================================
-RCS file: /cvs/sw/sw/source/ui/shells/textdrw.cxx,v
-retrieving revision 1.9
-diff -u -r1.9 textdrw.cxx
---- sw/source/ui/shells/textdrw.cxx 9 Sep 2005 10:53:22 -0000 1.9
-+++ sw/source/ui/shells/textdrw.cxx 1 Nov 2005 12:43:59 -0000
-@@ -84,9 +84,6 @@
- #ifndef SVTOOLS_URIHELPER_HXX
- #include <svtools/urihelper.hxx>
- #endif
--#ifndef _SV_SOUND_HXX
--#include <vcl/sound.hxx>
--#endif
-
- #define C2U(cChar) rtl::OUString::createFromAscii(cChar)
- using namespace ::com::sun::star;
-@@ -158,12 +155,14 @@
- aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
- xPropSet->setPropertyValue( C2U("ButtonType"), aTmp );
-
-+#if 0
- if ( Sound::IsSoundFile( rURL ) )
- {
- // #105638# OJ
- aTmp <<= sal_True;
- xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aTmp );
- }
-+#endif
- }
-
- if (rSh.IsObjSelected())
diff --git a/patches/test/size-sound-vcl.diff b/patches/test/size-sound-vcl.diff
deleted file mode 100644
index d5ee4def9..000000000
--- a/patches/test/size-sound-vcl.diff
+++ /dev/null
@@ -1,640 +0,0 @@
-Index: vcl/inc/salinst.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/salinst.hxx,v
-retrieving revision 1.14
-diff -u -r1.14 salinst.hxx
---- vcl/inc/salinst.hxx 9 Sep 2005 11:20:23 -0000 1.14
-+++ vcl/inc/salinst.hxx 1 Nov 2005 12:05:25 -0000
-@@ -60,7 +60,6 @@
- class SalGraphics;
- class SalFrame;
- class SalObject;
--class SalSound;
- class SalOpenGL;
- class SalMenu;
- class SalMenuItem;
-@@ -135,8 +134,6 @@
- virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
- virtual String GetDefaultPrinter() = 0;
-
-- // SalSound
-- virtual SalSound* CreateSalSound() = 0;
- // SalTimer
- virtual SalTimer* CreateSalTimer() = 0;
- // SalOpenGL
-Index: vcl/inc/sound.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/sound.hxx,v
-retrieving revision 1.7
-diff -u -r1.7 sound.hxx
---- vcl/inc/sound.hxx 9 Sep 2005 11:26:37 -0000 1.7
-+++ vcl/inc/sound.hxx 1 Nov 2005 12:05:30 -0000
-@@ -36,102 +36,14 @@
- #ifndef _SV_SOUND_HXX
- #define _SV_SOUND_HXX
-
--#ifndef _VCL_DLLAPI_H
--#include "dllapi.h"
--#endif
--
- #ifndef _SV_SNDSTYLE_HXX
- #include <sndstyle.hxx>
- #endif
-
--#ifndef _STRING_HXX
--#include <tools/string.hxx>
--#endif
--#ifndef _LINK_HXX
--#include <tools/link.hxx>
--#endif
--#ifndef _TIME_HXX
--#include <tools/time.hxx>
--#endif
--#ifndef _SV_SALSTYPE_HXX
--#include <salstype.hxx>
--#endif
--
- class Window;
--class Timer;
--class SalSound;
--class RMSound;
--
--// ---------
--// - Sound -
--// ---------
--
--class VCL_DLLPUBLIC Sound
--{
--private:
--
-- SalSound* mpSound;
-- XubString maSoundName;
-- Window* mpWindow;
-- BYTE* mpSoundData_NOTUSED;
-- ULONG mnDataLen;
-- ULONG mnSoundLen;
-- ULONG mnStartTime;
-- ULONG mnPlayTime;
-- ULONG mnErrorCode;
-- SoundNotification meNotification;
-- BOOL mbPlaying;
-- BOOL mbLoopMode;
-- Link maNotifyHdl;
-- void* mpExtraData;
--
--private:
--
-- Sound( const Sound& rSound );
-- Sound& operator=( const Sound& rSound );
--
--#if _SOLAR__PRIVATE
--public:
-- SAL_DLLPRIVATE void ImplNotify( SoundNotification eNotification, ULONG nError );
--#endif // __PRIVATE
--
--public:
-- Sound( Window* pWindow = NULL );
-- virtual ~Sound();
--
-- virtual void Notify();
--
-- void SetWindow( Window* pWindow ) { mpWindow = pWindow; }
-- Window* GetWindow() const { return mpWindow; }
-- BOOL SetSoundName( const XubString& rSoundName );
-- const XubString& GetSoundName() const { return maSoundName; }
-- ULONG GetSoundLen() const { return mnSoundLen; }
--
-- void Play();
-- void Stop();
-- void Pause();
-- BOOL IsPlaying() const { return mbPlaying; }
--
-- void SetStartTime( ULONG nStartTime = 0 );
-- ULONG GetStartTime() const { return mnStartTime; }
-- void SetPlayTime( ULONG nPlayTime = SOUND_PLAYALL );
-- ULONG GetPlayTime() const { return mnPlayTime; }
-- void SetLoopMode( BOOL bLoop );
-- BOOL IsLoopMode() const { return mbLoopMode; }
--
-- void ClearError();
-- ULONG GetLastError() const { return mnErrorCode; }
-- SoundNotification GetNotification() const { return meNotification; }
--
-- void SetNotifyHdl( const Link& rLink ) { maNotifyHdl = rLink; }
-- const Link& GetNotifyHdl() const { return maNotifyHdl; }
--
-- static void Beep( SoundType eType = SOUND_DEFAULT, Window* pWindow = NULL );
--
-- static void SetSoundPath( const XubString& rSoundPath );
-- static const XubString& GetSoundPath();
-
-- static BOOL IsSoundFile( const XubString& rSoundPath );
-+namespace Sound {
-+ void Beep( SoundType eType = SOUND_DEFAULT, Window* pWindow = NULL );
- };
-
- #endif // _SV_SOUND_HXX
-Index: vcl/source/app/salvtables.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/app/salvtables.cxx,v
-retrieving revision 1.5
-diff -u -r1.5 salvtables.cxx
---- vcl/source/app/salvtables.cxx 9 Sep 2005 11:41:19 -0000 1.5
-+++ vcl/source/app/salvtables.cxx 1 Nov 2005 12:05:31 -0000
-@@ -38,7 +38,6 @@
- #include <salvd.hxx>
- #include <salprn.hxx>
- #include <saltimer.hxx>
--#include <salsound.hxx>
- #include <salogl.hxx>
- #include <salimestatus.hxx>
- #include <salsys.hxx>
-@@ -58,10 +57,6 @@
- {
- }
-
--SalSound::~SalSound()
--{
--}
--
- SalTimer::~SalTimer()
- {
- }
-Index: vcl/source/app/sound.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/app/sound.cxx,v
-retrieving revision 1.10
-diff -u -r1.10 sound.cxx
---- vcl/source/app/sound.cxx 9 Sep 2005 11:42:15 -0000 1.10
-+++ vcl/source/app/sound.cxx 1 Nov 2005 12:05:37 -0000
-@@ -33,236 +33,10 @@
- *
- ************************************************************************/
-
--#ifndef _URLOBJ_HXX
--#include <tools/urlobj.hxx>
--#endif
--#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
--#include <unotools/localfilehelper.hxx>
--#endif
--#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
--#include <unotools/ucbstreamhelper.hxx>
--#endif
--#ifndef _SV_SVSYS_HXX
--#include <svsys.h>
--#endif
--#ifndef _SV_SALSOUND_HXX
--#include <salsound.hxx>
--#endif
--#ifndef _SV_SALFRAME_HXX
-+#include <window.hxx>
- #include <salframe.hxx>
--#endif
--#ifndef _DEBUG_HXX
--#include <tools/debug.hxx>
--#endif
--#ifndef _NEW_HXX
--#include <tools/new.hxx>
--#endif
--#ifndef _SV_SVDATA_HXX
- #include <svdata.hxx>
--#endif
--#ifndef _SV_WINDOW_HXX
--#include <window.hxx>
--#endif
--#ifndef _SV_SALSOUND_HXX
--#include <salsound.hxx>
--#endif
--#ifndef _SV_SALBTYPE_HXX
--#include <salbtype.hxx>
--#endif
--#ifndef _SV_SOUND_HXX
- #include <sound.hxx>
--#endif
--#ifndef _SV_SALINST_HXX
--#include <salinst.hxx>
--#endif
--
--
--
--// ----------------------
--// - SalSound-Callback -
--// ----------------------
--
--void SalSoundProc( void* pInst, SoundNotification eNotification, ULONG nError )
--{
-- ( (Sound*) pInst )->ImplNotify( eNotification, nError );
--}
--
--// ---------
--// - Sound -
--// ---------
--
--Sound::Sound( Window* pWindow ) :
-- mpWindow ( pWindow ),
-- mnDataLen ( 0UL ),
-- mnSoundLen ( 0UL ),
-- mnStartTime ( 0UL ),
-- mnPlayTime ( SOUND_PLAYALL ),
-- mnErrorCode ( 0UL ),
-- meNotification ( SOUND_NOTIFY_SUCCESS ),
-- mbPlaying ( FALSE ),
-- mbLoopMode ( FALSE )
--{
-- mpSound = ImplGetSVData()->mpDefInst->CreateSalSound();
--
-- if( mpSound->IsValid() )
-- mpSound->SetNotifyProc( this, SalSoundProc );
--}
--
--// -----------------------------------------------------------------------
--
--Sound::~Sound()
--{
-- delete mpSound;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::ImplNotify( SoundNotification eNotification, ULONG nError )
--{
-- meNotification = eNotification;
-- mbPlaying = FALSE;
--
-- if( SOUND_NOTIFY_ERROR == meNotification )
-- mnErrorCode = nError;
--
-- Notify();
--
-- if( maNotifyHdl.IsSet() )
-- maNotifyHdl.Call( this );
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::Notify()
--{
--}
--
--// -----------------------------------------------------------------------
--
--BOOL Sound::SetSoundName( const XubString& rSoundName )
--{
-- BOOL bRet( FALSE );
--
-- if( !rSoundName.Len() )
-- {
-- mnDataLen = 0UL;
-- mnSoundLen = 0UL;
-- mnStartTime = 0UL;
-- mnPlayTime = SOUND_PLAYALL;
-- mnErrorCode = 0UL;
-- meNotification = SOUND_NOTIFY_SUCCESS;
-- mbPlaying = FALSE;
-- mbLoopMode = FALSE;
-- bRet = TRUE;
--
-- mpSound->Init( rSoundName, mnSoundLen );
-- }
-- else if( mpSound->IsValid() )
-- {
-- INetURLObject aSoundURL( rSoundName );
-- String aSoundName, aTmp;
-- BOOL bValidName( FALSE );
--
-- // #106654# Accept only local sound files
-- if( aSoundURL.GetProtocol() == INET_PROT_FILE )
-- {
-- utl::LocalFileHelper::ConvertURLToPhysicalName( aSoundURL.GetMainURL( INetURLObject::NO_DECODE ), aSoundName );
-- bValidName = TRUE;
-- }
-- else if( aSoundURL.GetProtocol() == INET_PROT_NOT_VALID &&
-- ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rSoundName, aTmp ) )
-- {
-- aSoundName = rSoundName;
-- bValidName = TRUE;
-- }
-- else
-- {
-- // no valid sound file name
-- aSoundName = String();
--
-- // #106654# Don't set bRet to true for invalid sound file
-- // names, but init with empty string, anyway
-- mpSound->Init( aSoundName, mnSoundLen );
-- }
--
-- if( bValidName )
-- bRet = mpSound->Init( aSoundName, mnSoundLen );
-- }
--
-- maSoundName = rSoundName;
--
-- // if sound could not be initialized, but we've gotten _no_
-- // notification ==> create common error notification
-- if( !bRet && !mnErrorCode )
-- ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_GENERAL_ERROR );
--
-- return bRet;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::SetStartTime( ULONG nStartTime )
--{
-- mnStartTime = nStartTime;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::SetPlayTime( ULONG nPlayTime )
--{
-- mnPlayTime = nPlayTime;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::SetLoopMode( BOOL bLoop )
--{
-- mbLoopMode = bLoop;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::ClearError()
--{
-- mnErrorCode = 0;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::Play()
--{
-- BOOL bRet;
--
-- if( mpSound->IsValid() && !mnErrorCode )
-- {
-- mpSound->Play( mnStartTime, mnPlayTime, mbLoopMode );
-- mbPlaying = TRUE;
-- }
-- else
-- bRet = FALSE;
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::Stop()
--{
-- mbPlaying = FALSE;
--
-- if( mpSound->IsValid() )
-- mpSound->Stop();
--}
--
--// -----------------------------------------------------------------------
--
--void Sound::Pause()
--{
-- mbPlaying = FALSE;
--
-- if( mpSound->IsValid() )
-- mpSound->Pause();
--}
--
--// -----------------------------------------------------------------------
-
- void Sound::Beep( SoundType eType, Window* pWindow )
- {
-@@ -271,62 +45,3 @@
- else
- pWindow->ImplGetFrame()->Beep( eType );
- }
--
--// -----------------------------------------------------------------------
--
--void Sound::SetSoundPath( const XubString& rSoundPath )
--{
--}
--
--// -----------------------------------------------------------------------
--
--const XubString& Sound::GetSoundPath()
--{
-- return ImplGetSVEmptyStr();
--}
--
--// -----------------------------------------------------------------------
--
--BOOL Sound::IsSoundFile( const XubString& rSoundPath )
--{
-- BOOL bRet = FALSE;
--
-- if( rSoundPath.Len() )
-- {
-- INetURLObject aSoundURL( rSoundPath );
-- String aSoundName;
--
-- if( aSoundURL.GetProtocol() != INET_PROT_NOT_VALID )
-- aSoundName = aSoundURL.GetMainURL( INetURLObject::NO_DECODE );
-- else if( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( rSoundPath, aSoundName ) )
-- aSoundName.Erase();
--
-- if( aSoundName.Len() )
-- {
-- SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aSoundName, STREAM_READ );
--
-- if( pIStm )
-- {
-- sal_Char aData[ 12 ];
--
-- if( ( pIStm->Read( aData, 12 ) == 12 ) && !pIStm->GetError() )
-- {
-- // check for WAV
-- bRet = ( aData[ 0 ] == 'R' && aData[ 1 ] == 'I' && aData[ 2 ] == 'F' && aData[ 3 ] == 'F' &&
-- aData[ 8 ] == 'W' && aData[ 9 ] == 'A' && aData[ 10 ] == 'V' && aData[ 11 ] == 'E' );
-- }
--
-- delete pIStm;
-- }
--
-- if( !bRet )
-- {
-- // check it the hard way
-- Sound aTestSound;
-- bRet = aTestSound.SetSoundName( rSoundPath );
-- }
-- }
-- }
--
-- return bRet;
--}
-Index: vcl/source/app/svmain.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/app/svmain.cxx,v
-retrieving revision 1.57
-diff -u -r1.57 svmain.cxx
---- vcl/source/app/svmain.cxx 13 Oct 2005 09:36:37 -0000 1.57
-+++ vcl/source/app/svmain.cxx 1 Nov 2005 12:05:38 -0000
-@@ -54,9 +54,6 @@
- #ifndef _SV_SALINST_HXX
- #include <salinst.hxx>
- #endif
--#ifndef _SV_SALSOUND_HXX
--#include <salsound.hxx>
--#endif
- #ifndef _SV_SALOGL_HXX
- #include <salogl.hxx>
- #endif
-
-
-Index: vcl/unx/dummy/dinst.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/dummy/dinst.cxx,v
-retrieving revision 1.6
-diff -u -r1.6 dinst.cxx
---- vcl/unx/dummy/dinst.cxx 9 Sep 2005 12:35:27 -0000 1.6
-+++ vcl/unx/dummy/dinst.cxx 1 Nov 2005 12:06:57 -0000
-@@ -63,7 +63,6 @@
- virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
- virtual String GetDefaultPrinter();
-
-- virtual SalSound* CreateSalSound();
- virtual SalTimer* CreateSalTimer();
- virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics );
- virtual SalI18NImeStatus* CreateI18NImeStatus();
-@@ -165,11 +164,6 @@
- return String();
- }
-
--SalSound* DummyInstance::CreateSalSound()
--{
-- return NULL;
--}
--
- SalTimer* DummyInstance::CreateSalTimer()
- {
- return NULL;
-
-
-Index: vcl/unx/inc/salinst.h
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/inc/salinst.h,v
-retrieving revision 1.11
-diff -u -r1.11 salinst.h
---- vcl/unx/inc/salinst.h 9 Sep 2005 12:45:09 -0000 1.11
-+++ vcl/unx/inc/salinst.h 1 Nov 2005 12:05:59 -0000
-@@ -108,7 +108,6 @@
- virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
- virtual String GetDefaultPrinter();
-
-- virtual SalSound* CreateSalSound();
- virtual SalTimer* CreateSalTimer();
- virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics );
- virtual SalI18NImeStatus* CreateI18NImeStatus();
-
-Index: vcl/unx/source/app/makefile.mk
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/source/app/makefile.mk,v
-retrieving revision 1.22
-diff -u -r1.22 makefile.mk
---- vcl/unx/source/app/makefile.mk 9 Sep 2005 12:57:37 -0000 1.22
-+++ vcl/unx/source/app/makefile.mk 1 Nov 2005 12:07:17 -0000
-@@ -73,31 +73,6 @@
- $(SLO)$/keysymnames.obj \
- $(SLO)$/wmadaptor.obj \
-
--SLOFILES+=\
-- $(SLO)$/salsound2.obj \
-- $(SLO)$/osssound.obj \
-- $(SLO)$/devaudiosound.obj \
-- $(SLO)$/audioconvert.obj \
-- $(SLO)$/rptpsound.obj \
-- $(SLO)$/nassound.obj
--
--
--
--.IF "$(ENABLE_NAS)" != ""
--CDEFS+=-DUSE_NAS
--.ENDIF
--
--.IF "$(ENABLE_PASF)" != ""
--CDEFS+=-DUSE_PASF
--SLOFILES+=$(SLO)$/pasfsound.obj
--.IF "$(SYSTEM_SNDFILE)" == "YES"
--CDEFS+=-DSYSTEM_SNDFILE
--.ENDIF
--.IF "$(SYSTEM_PORTAUDIO)" == "YES"
--CDEFS+=-DSYSTEM_PORTAUDIO
--.ENDIF
--.ENDIF
--
- .IF "$(WITH_LIBSN)"=="YES"
- CDEFS+=-DHAVE_LIBSN
- CFLAGS+=$(LIBSN_CFLAGS)
-
-Index: vcl/unx/source/app/salinst.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/source/app/salinst.cxx,v
-retrieving revision 1.27
-diff -u -r1.27 salinst.cxx
---- vcl/unx/source/app/salinst.cxx 9 Sep 2005 13:01:26 -0000 1.27
-+++ vcl/unx/source/app/salinst.cxx 1 Nov 2005 12:07:28 -0000
-@@ -72,9 +72,6 @@
- #ifndef _SV_SALOGL_H
- #include <salogl.h>
- #endif
--#ifndef _SV_SALSOUND_H
--#include <salsound.h>
--#endif
-
- // -------------------------------------------------------------------------
- //
-@@ -142,9 +139,6 @@
-
- X11SalInstance::~X11SalInstance()
- {
-- // deinitialize global sound resources
-- X11SalSound::Release();
--
- // release (possibly open) OpenGL context
- X11SalOpenGL::Release();
-
-@@ -321,8 +315,3 @@
- return new X11SalOpenGL( pGraphics );
- }
-
--SalSound* X11SalInstance::CreateSalSound()
--{
-- return new X11SalSound();
--}
--
-
-Index: vcl/util/makefile.mk
-===================================================================
-RCS file: /cvs/gsl/vcl/util/makefile.mk,v
-retrieving revision 1.75
-diff -u -r1.75 makefile.mk
---- vcl/util/makefile.mk 13 Oct 2005 09:37:37 -0000 1.75
-+++ vcl/util/makefile.mk 1 Nov 2005 15:14:00 -0000
-@@ -296,21 +296,6 @@
- .ENDIF
-
-
--.IF "$(ENABLE_PASF)" != ""
--.IF "$(OS)"=="MACOSX"
--SHL2STDLIBS += -framework CoreAudio -framework AudioToolbox
--.ENDIF
--SHL2STDLIBS += -lsndfile -lportaudio
--.ENDIF # ENABLE_PASF
--
--.IF "$(ENABLE_NAS)" != ""
--SHL2STDLIBS += -laudio
--.IF "$(OS)"=="SOLARIS"
--# needed by libaudio.a
--SHL2STDLIBS += -ldl -lnsl -lsocket
--.ENDIF # SOLARIS
--.ENDIF
--
- .IF "$(GUIBASE)"=="unx"
-
- .IF "$(WITH_LIBSN)"=="YES"
diff --git a/patches/test/slideshow-primitives.diff b/patches/test/slideshow-primitives.diff
deleted file mode 100644
index 4775e8916..000000000
--- a/patches/test/slideshow-primitives.diff
+++ /dev/null
@@ -1,2234 +0,0 @@
-Move slideshow to drawinglayer primitives
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- slideshow/source/engine/shapes/drawshape.cxx | 15 ++++-
- slideshow/source/engine/shapes/drawshape.hxx | 5 ++
- slideshow/source/engine/shapes/viewshape.cxx | 84 ++++++++++++++++----------
- slideshow/source/engine/shapes/viewshape.hxx | 33 ++++++++++
- slideshow/source/engine/slide/slideimpl.cxx | 9 ++-
- slideshow/source/engine/slideshowcontext.cxx | 8 ++
- slideshow/source/engine/slideshowimpl.cxx | 3 +
- slideshow/source/inc/slideshowcontext.hxx | 14 +++-
- slideshow/util/makefile.mk | 1
- .../drawinglayer/processor2d/canvasprocessor.hxx | 4
- .../source/processor2d/canvasprocessor.cxx | 1480 ++------------------
- offapi/com/sun/star/graphic/XPrimitive2D.idl | 21
- .../com/sun/star/graphic/XPrimitiveFactory2D.idl | 72 +
- 13 files changed, 252 insertions(+), 1325 deletions(-)
-
-
-diff --git drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
-index 8e46feb..55e89e3 100644
---- drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
-+++ drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
-@@ -120,6 +120,10 @@ namespace drawinglayer
- canvasProcessor2D(
- const geometry::ViewInformation2D& rViewInformation,
- OutputDevice& rOutDev);
-+ canvasProcessor2D(
-+ const geometry::ViewInformation2D& rViewInformation,
-+ const com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas >& xCanvas,
-+ const com::sun::star::rendering::ViewState& rViewState );
- virtual ~canvasProcessor2D();
-
- // access to Drawinglayer configuration options
-diff --git drawinglayer/source/processor2d/canvasprocessor.cxx drawinglayer/source/processor2d/canvasprocessor.cxx
-index f99634f..6695cb4 100644
---- drawinglayer/source/processor2d/canvasprocessor.cxx
-+++ drawinglayer/source/processor2d/canvasprocessor.cxx
-@@ -81,1206 +81,6 @@
-
- using namespace com::sun::star;
-
--//////////////////////////////////////////////////////////////////////////////
--// AW: Adding the canvas example from THB here to extract stuff later
--/*
-- // TODO(Q3): share impCreateEmptyBitmapWithPattern() and other
-- // helper methods with vclprocessor.cxx
-- Bitmap impCreateEmptyBitmapWithPattern(Bitmap aSource, const Size& aTargetSizePixel)
-- {
-- Bitmap aRetval;
-- BitmapReadAccess* pReadAccess = aSource.AcquireReadAccess();
--
-- if(pReadAccess)
-- {
-- if(aSource.GetBitCount() <= 8)
-- {
-- BitmapPalette aPalette(pReadAccess->GetPalette());
-- aRetval = Bitmap(aTargetSizePixel, aSource.GetBitCount(), &aPalette);
-- }
-- else
-- {
-- aRetval = Bitmap(aTargetSizePixel, aSource.GetBitCount());
-- }
--
-- delete pReadAccess;
-- }
--
-- return aRetval;
-- }
--
-- Bitmap impModifyBitmap(const basegfx::BColorModifier& rModifier, const Bitmap& rSource)
-- {
-- Bitmap aRetval(rSource);
--
-- switch(rModifier.getMode())
-- {
-- case basegfx::BCOLORMODIFYMODE_REPLACE :
-- {
-- aRetval = impCreateEmptyBitmapWithPattern(aRetval, Size(1L, 1L));
-- aRetval.Erase(Color(rModifier.getBColor()));
-- break;
-- }
--
-- default : // BCOLORMODIFYMODE_INTERPOLATE, BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE
-- {
-- BitmapWriteAccess* pContent = aRetval.AcquireWriteAccess();
--
-- if(pContent)
-- {
-- for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++)
-- {
-- for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++)
-- {
-- const Color aColor = pContent->GetPixel(y, x);
-- const basegfx::BColor aBColor(rModifier.getModifiedColor(aColor.getBColor()));
-- pContent->SetPixel(y, x, BitmapColor(Color(aBColor)));
-- }
-- }
--
-- delete pContent;
-- }
--
-- break;
-- }
-- }
--
-- return aRetval;
-- }
--
-- Bitmap impModifyBitmap(const basegfx::BColorModifierStack& rBColorModifierStack, const Bitmap& rSource)
-- {
-- Bitmap aRetval(rSource);
--
-- for(sal_uInt32 a(rBColorModifierStack.count()); a; )
-- {
-- const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a);
-- aRetval = impModifyBitmap(rModifier, aRetval);
-- }
--
-- return aRetval;
-- }
--
-- sal_uInt32 impCalcGradientSteps(sal_uInt32 nSteps, const basegfx::B2DRange& rRange, sal_uInt32 nMaxDist)
-- {
-- if(nSteps == 0L)
-- nSteps = (sal_uInt32)(rRange.getWidth() + rRange.getHeight()) / 8;
--
-- if(nSteps < 2L)
-- {
-- nSteps = 2L;
-- }
--
-- if(nSteps > nMaxDist)
-- {
-- nSteps = nMaxDist;
-- }
--
-- return nSteps;
-- }
--
-- void canvasProcessor::impDrawGradientSimple(
-- const basegfx::B2DPolyPolygon& rTargetForm,
-- const ::std::vector< basegfx::B2DHomMatrix >& rMatrices,
-- const ::std::vector< basegfx::BColor >& rColors,
-- const basegfx::B2DPolygon& rUnitPolygon)
-- {
-- uno::Reference< rendering::XPolyPolygon2D > xPoly(
-- basegfx::unotools::xPolyPolygonFromB2DPolygon(
-- mxCanvas->getDevice(),
-- rUnitPolygon));
-- uno::Reference< rendering::XPolyPolygon2D > xTargetPoly(
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rTargetForm));
--
-- for(sal_uInt32 a(0L); a < rColors.size(); a++)
-- {
-- // set correct color
-- const basegfx::BColor aFillColor(rColors[a]);
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aFillColor);
--
-- if(a)
-- {
-- if(a - 1L < rMatrices.size())
-- {
-- canvas::tools::setRenderStateTransform( maRenderState,
-- rMatrices[a - 1L] );
-- mxCanvas->fillPolyPolygon(xPoly,maViewState,maRenderState);
-- }
-- }
-- else
-- {
-- canvas::tools::setRenderStateTransform( maRenderState,
-- basegfx::B2DHomMatrix() );
-- mxCanvas->fillPolyPolygon(xTargetPoly,maViewState,maRenderState);
-- }
-- }
-- }
--
-- void canvasProcessor::impDrawGradientComplex(
-- const basegfx::B2DPolyPolygon& rTargetForm,
-- const ::std::vector< basegfx::B2DHomMatrix >& rMatrices,
-- const ::std::vector< basegfx::BColor >& rColors,
-- const basegfx::B2DPolygon& rUnitPolygon)
-- {
-- uno::Reference< rendering::XPolyPolygon2D > xPoly(
-- basegfx::unotools::xPolyPolygonFromB2DPolygon(
-- mxCanvas->getDevice(),
-- rUnitPolygon));
-- uno::Reference< rendering::XPolyPolygon2D > xTargetPoly(
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rTargetForm));
--
-- maRenderState.Clip = xTargetPoly;
--
-- // draw gradient PolyPolygons
-- for(std::size_t a = 0L; a < rMatrices.size(); a++)
-- {
-- // set correct color
-- if(rColors.size() > a)
-- {
-- const basegfx::BColor aFillColor(rColors[a]);
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aFillColor);
-- }
--
-- canvas::tools::setRenderStateTransform( maRenderState,
-- rMatrices[a] );
--
-- if(a)
-- mxCanvas->fillPolyPolygon(xPoly,maViewState,maRenderState);
-- else
-- mxCanvas->fillPolyPolygon(xTargetPoly,maViewState,maRenderState);
-- }
--
-- maRenderState.Clip.clear();
-- }
--
-- void canvasProcessor::impDrawGradient(
-- const basegfx::B2DPolyPolygon& rTargetForm,
-- ::drawinglayer::primitive::GradientStyle eGradientStyle,
-- sal_uInt32 nSteps,
-- const basegfx::BColor& rStart,
-- const basegfx::BColor& rEnd,
-- double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple)
-- {
-- fprintf(stderr,"impDrawGradient\n");
--
-- basegfx::B2DPolyPolygon aTmp(rTargetForm);
-- aTmp.transform( maWorldToView );
-- const basegfx::B2DRange aOutlineRangePixel(basegfx::tools::getRange(aTmp));
-- const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm));
--
-- fprintf(stderr,"impDrawGradient: #%d\n",nSteps);
--
-- if( // step count is infinite, can use native canvas
-- // gradients here
-- nSteps == 0 ||
-- // step count is sufficiently high, such that no
-- // discernible difference should be visible.
-- nSteps > 64 )
-- {
-- uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory(
-- mxCanvas->getDevice()->getParametricPolyPolygonFactory() );
--
-- if( xFactory.is() )
-- {
-- fprintf(stderr,"native gradient #1\n");
--
-- basegfx::B2DHomMatrix aTextureTransformation;
-- rendering::Texture aTexture;
--
-- aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
-- aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
-- aTexture.Alpha = 1.0;
--
--
-- // setup start/end color values
-- // ----------------------------
--
-- const uno::Sequence< double > aStartColor(
-- basegfx::unotools::colorToDoubleSequence( mxCanvas->getDevice(),
-- rStart ));
-- const uno::Sequence< double > aEndColor(
-- basegfx::unotools::colorToDoubleSequence( mxCanvas->getDevice(),
-- rEnd ));
--
-- // Setup texture transformation
-- // ----------------------------
--
-- const basegfx::B2DRange& rBounds(
-- basegfx::tools::getRange( rTargetForm ));
--
-- // setup rotation angle. VCL rotates
-- // counter-clockwise, while canvas transformation
-- // rotates clockwise
-- //fAngle = -fAngle;
--
-- switch(eGradientStyle)
-- {
-- case ::drawinglayer::primitive::GRADIENTSTYLE_LINEAR:
-- // FALLTHROUGH intended
-- case ::drawinglayer::primitive::GRADIENTSTYLE_AXIAL:
-- {
-- // standard orientation for VCL linear
-- // gradient is vertical, thus, rotate 90
-- // degrees
-- fAngle += M_PI/2.0;
--
-- // shrink texture, to account for border
-- // (only in x direction, linear gradient
-- // is constant in y direction, anyway)
-- aTextureTransformation.scale(
-- basegfx::pruneScaleValue(1.0 - fBorder),
-- 1.0 );
--
-- double fBorderX(0.0);
--
-- // determine type of gradient (and necessary
-- // transformation matrix, should it be emulated by a
-- // generic gradient)
-- switch(eGradientStyle)
-- {
-- case ::drawinglayer::primitive::GRADIENTSTYLE_LINEAR:
-- // linear gradients don't respect
-- // offsets (they are implicitely
-- // assumed to be 50%). linear
-- // gradients don't have border on
-- // both sides, only on the
-- // startColor side. Gradient is
-- // invariant in y direction: leave
-- // y offset alone.
-- fBorderX = fBorder;
-- aTexture.Gradient = xFactory->createLinearHorizontalGradient( aStartColor,
-- aEndColor );
-- break;
--
-- case ::drawinglayer::primitive::GRADIENTSTYLE_AXIAL:
-- // axial gradients have border on
-- // both sides. Gradient is
-- // invariant in y direction: leave
-- // y offset alone.
-- fBorderX = fBorder * .5;
-- aTexture.Gradient = xFactory->createAxialHorizontalGradient( aStartColor,
-- aEndColor );
-- break;
-- }
--
-- // apply border offset values
-- aTextureTransformation.translate( fBorderX,
-- 0.0 );
--
-- // rotate texture according to gradient rotation
-- aTextureTransformation.translate( -0.5, -0.5 );
-- aTextureTransformation.rotate( fAngle );
--
-- // to let the first strip of a rotated
-- // gradient start at the _edge_ of the
-- // bound rect (and not, due to rotation,
-- // slightly inside), slightly enlarge the
-- // gradient:
-- //
-- // y/2 sin(alpha) + x/2 cos(alpha)
-- //
-- // (values to change are not actual
-- // gradient scales, but original bound
-- // rect dimensions. Since we still want
-- // the border setting to apply after that,
-- // we multiply with that as above for
-- // nScaleX)
-- const double nScale(
-- basegfx::pruneScaleValue(
-- fabs( rBounds.getHeight()*sin(fAngle) ) +
-- fabs( rBounds.getWidth()*cos(fAngle) )));
--
-- aTextureTransformation.scale( nScale, nScale );
--
-- // translate back origin to center of
-- // primitive
-- aTextureTransformation.translate( 0.5*rBounds.getWidth(),
-- 0.5*rBounds.getHeight() );
-- break;
-- }
--
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RADIAL:
-- // FALLTHROUGH intended
-- case ::drawinglayer::primitive::GRADIENTSTYLE_ELLIPTICAL:
-- // FALLTHROUGH intended
-- case ::drawinglayer::primitive::GRADIENTSTYLE_SQUARE:
-- // FALLTHROUGH intended
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RECT:
-- {
-- fprintf(stderr,"native gradient #2\n");
--
-- // determine scale factors for the gradient (must
-- // be scaled up from [0,1]x[0,1] rect to object
-- // bounds). Will potentially changed in switch
-- // statement below.
-- // Respect border value, while doing so, the VCL
-- // gradient's border will effectively shrink the
-- // resulting gradient.
-- double nScaleX( rBounds.getWidth() * (1.0 - fBorder) );
-- double nScaleY( rBounds.getHeight()* (1.0 - fBorder) );
--
-- // determine offset values. Since the
-- // border is divided half-by-half to both
-- // sides of the gradient, divide
-- // translation offset by an additional
-- // factor of 2. Also respect offset here,
-- // but since VCL gradients have their
-- // center at [0,0] for zero offset, but
-- // canvas gradients have their top, left
-- // edge aligned with the primitive, and
-- // offset of 50% effectively must yield
-- // zero shift. Both values will
-- // potentially be adapted in switch
-- // statement below.
-- double nOffsetX( rBounds.getWidth() *
-- (2.0 * fOffsetX - 1.0 + fBorder)*.5 );
-- double nOffsetY( rBounds.getHeight() *
-- (2.0 * fOffsetY - 1.0 + fBorder)*.5 );
--
-- // determine type of gradient (and necessary
-- // transformation matrix, should it be emulated by a
-- // generic gradient)
-- switch(eGradientStyle)
-- {
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RADIAL:
-- {
-- // create isotrophic scaling
-- if( nScaleX > nScaleY )
-- {
-- nOffsetY -= (nScaleX - nScaleY) * 0.5;
-- nScaleY = nScaleX;
-- }
-- else
-- {
-- nOffsetX -= (nScaleY - nScaleX) * 0.5;
-- nScaleX = nScaleY;
-- }
--
-- // enlarge gradient to match bound rect diagonal
-- aTextureTransformation.translate( -0.5, -0.5 );
-- const double nScale( hypot(rBounds.getWidth(),
-- rBounds.getHeight()) / nScaleX );
-- aTextureTransformation.scale( nScale, nScale );
-- aTextureTransformation.translate( 0.5, 0.5 );
--
-- aTexture.Gradient = xFactory->createEllipticalGradient(
-- aEndColor,
-- aStartColor,
-- cssgeom::RealRectangle2D(0.0,0.0,
-- 1.0,1.0) );
-- }
-- break;
--
-- case ::drawinglayer::primitive::GRADIENTSTYLE_ELLIPTICAL:
-- {
-- // enlarge gradient slightly
-- aTextureTransformation.translate( -0.5, -0.5 );
-- const double nSqrt2( sqrt(2.0) );
-- aTextureTransformation.scale( nSqrt2,nSqrt2 );
-- aTextureTransformation.translate( 0.5, 0.5 );
--
-- aTexture.Gradient = xFactory->createEllipticalGradient(
-- aEndColor,
-- aStartColor,
-- cssgeom::RealRectangle2D( rBounds.getMinX(),
-- rBounds.getMinY(),
-- rBounds.getMaxX(),
-- rBounds.getMaxY() ));
-- }
-- break;
--
-- case ::drawinglayer::primitive::GRADIENTSTYLE_SQUARE:
-- {
-- // create isotrophic scaling
-- if( nScaleX > nScaleY )
-- {
-- nOffsetY -= (nScaleX - nScaleY) * 0.5;
-- nScaleY = nScaleX;
-- }
-- else
-- {
-- nOffsetX -= (nScaleY - nScaleX) * 0.5;
-- nScaleX = nScaleY;
-- }
--
-- aTexture.Gradient = xFactory->createRectangularGradient(
-- aEndColor,
-- aStartColor,
-- cssgeom::RealRectangle2D(0.0,0.0,
-- 1.0,1.0));
-- }
-- break;
--
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RECT:
-- {
-- aTexture.Gradient = xFactory->createRectangularGradient(
-- aEndColor,
-- aStartColor,
-- cssgeom::RealRectangle2D( rBounds.getMinX(),
-- rBounds.getMinY(),
-- rBounds.getMaxX(),
-- rBounds.getMaxY() ));
-- }
-- break;
-- }
--
-- nScaleX = basegfx::pruneScaleValue( nScaleX );
-- nScaleY = basegfx::pruneScaleValue( nScaleY );
--
-- aTextureTransformation.scale( nScaleX, nScaleY );
--
-- // rotate texture according to gradient rotation
-- aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY );
-- aTextureTransformation.rotate( fAngle );
-- aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY );
--
-- aTextureTransformation.translate( nOffsetX, nOffsetY );
-- }
-- break;
--
-- default:
-- OSL_ENSURE( false,
-- "canvasProcessor::impDrawGradient(): Unexpected gradient type" );
-- break;
-- }
--
-- // As the texture coordinate space is relative to
-- // the polygon coordinate space (NOT to the
-- // polygon itself), move gradient to the start of
-- // the actual polygon. If we skip this, the
-- // gradient will always display at the origin, and
-- // not within the polygon bound (which might be
-- // miles away from the origin).
-- aTextureTransformation.translate( rBounds.getMinX(),
-- rBounds.getMinY() );
--
-- basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform,
-- aTextureTransformation );
-- uno::Sequence< rendering::Texture > aSeq(1);
-- aSeq[0] = aTexture;
--
-- mxCanvas->fillTexturedPolyPolygon(
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rTargetForm),
-- maViewState,
-- maRenderState,
-- aSeq );
--
-- // done, using native gradients
-- return;
-- }
-- }
-- else
-- {
-- // make sure steps is not too high/low
-- nSteps = impCalcGradientSteps(nSteps,
-- aOutlineRangePixel,
-- sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5));
--
--
-- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
-- ::std::vector< basegfx::BColor > aColors;
-- basegfx::B2DPolygon aUnitPolygon;
--
-- if( drawinglayer::primitive::GRADIENTSTYLE_RADIAL == eGradientStyle ||
-- drawinglayer::primitive::GRADIENTSTYLE_ELLIPTICAL == eGradientStyle)
-- {
-- const basegfx::B2DPoint aCircleCenter(0.5, 0.5);
-- aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5);
-- aUnitPolygon = basegfx::tools::adaptiveSubdivideByAngle(aUnitPolygon);
-- }
-- else
-- {
-- aUnitPolygon = basegfx::tools::createPolygonFromRect(
-- basegfx::B2DRange(0.0, 0.0, 1.0, 1.0));
-- }
--
-- // create geometries
-- switch(eGradientStyle)
-- {
-- case ::drawinglayer::primitive::GRADIENTSTYLE_LINEAR:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- case ::drawinglayer::primitive::GRADIENTSTYLE_AXIAL:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RADIAL:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- case ::drawinglayer::primitive::GRADIENTSTYLE_ELLIPTICAL:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- case ::drawinglayer::primitive::GRADIENTSTYLE_SQUARE:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- case ::drawinglayer::primitive::GRADIENTSTYLE_RECT:
-- {
-- ::drawinglayer::primitive::geoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-- aGradient.appendTransformations(aMatrices);
-- aGradient.appendColors(aColors);
-- break;
-- }
-- }
--
-- // paint them with mask using the XOR method
-- if(aMatrices.size())
-- {
-- if(bSimple)
-- {
-- impDrawGradientSimple(rTargetForm, aMatrices, aColors, aUnitPolygon);
-- }
-- else
-- {
-- impDrawGradientComplex(rTargetForm, aMatrices, aColors, aUnitPolygon);
-- }
-- }
-- }
-- }
--
--
-- //////////////////////////////////////////////////////////////////////////////
-- // rendering support
--
-- // directdraw of text simple portion
-- void canvasProcessor::impRender_STXP(const textSimplePortionPrimitive& rTextCandidate)
-- {
-- const fontAttributes& rFontAttrs( rTextCandidate.getFontAttributes() );
-- rendering::FontRequest aFontRequest;
--
-- aFontRequest.FontDescription.FamilyName = rFontAttrs.maFamilyName;
-- aFontRequest.FontDescription.StyleName = rFontAttrs.maStyleName;
-- aFontRequest.FontDescription.IsSymbolFont = rFontAttrs.mbSymbol ? util::TriState_YES : util::TriState_NO;
-- aFontRequest.FontDescription.IsVertical = rFontAttrs.mbVertical ? util::TriState_YES : util::TriState_NO;
--
-- // TODO(F2): improve vclenum->panose conversion
-- aFontRequest.FontDescription.FontDescription.Weight =
-- rFontAttrs.mnWeight;
-- aFontRequest.FontDescription.FontDescription.Letterform =
-- rFontAttrs.mbItalic ? 9 : 0;
--
-- // font matrix should only be used for glyph rotations etc.
-- css::geometry::Matrix2D aFontMatrix;
-- canvas::tools::setIdentityMatrix2D( aFontMatrix );
--
-- uno::Reference<rendering::XCanvasFont> xFont(
-- mxCanvas->createFont( aFontRequest,
-- uno::Sequence< beans::PropertyValue >(),
-- aFontMatrix ));
--
-- if( !xFont.is() )
-- return;
--
-- uno::Reference<rendering::XTextLayout> xLayout(
-- xFont->createTextLayout(
-- rendering::StringContext( rTextCandidate.getText(),
-- 0,
-- rTextCandidate.getText().Len() ),
-- // TODO(F3): Is this sufficient?
-- rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
-- 0 ));
-- if( !xLayout.is() )
-- return;
--
-- xLayout->applyLogicalAdvancements(
-- uno::Sequence<double>(&rTextCandidate.getDXArray()[0],
-- rTextCandidate.getDXArray().size() ));
--
-- const basegfx::BColor aRGBColor(
-- maBColorModifierStack.getModifiedColor(
-- rTextCandidate.getFontColor()));
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aRGBColor);
--
-- // get render parameters and paint
-- mxCanvas->drawTextLayout( xLayout,
-- maViewState,
-- maRenderState );
-- }
--
-- // direct draw of hairline
-- void canvasProcessor::impRender_POHL(const polygonHairlinePrimitive& rPolygonCandidate)
-- {
-- const basegfx::BColor aRGBColor(
-- maBColorModifierStack.getModifiedColor(
-- rPolygonCandidate.getBColor()));
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aRGBColor);
--
-- mxCanvas->drawPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolygon(
-- mxCanvas->getDevice(),
-- rPolygonCandidate.getB2DPolygon()),
-- maViewState,
-- maRenderState );
-- }
--
-- // direct draw of transformed BitmapEx primitive
-- void canvasProcessor::impRender_BMPR(const bitmapPrimitive& rBitmapCandidate)
-- {
-- BitmapEx aBitmapEx(rBitmapCandidate.getBitmapEx());
--
-- if(maBColorModifierStack.count())
-- {
-- // TODO(Q3): Share common bmp modification code with
-- // vclprocessor.cxx
-- Bitmap aChangedBitmap(impModifyBitmap(maBColorModifierStack, aBitmapEx.GetBitmap()));
--
-- if(aBitmapEx.IsTransparent())
-- {
-- if(aBitmapEx.IsAlpha())
-- aBitmapEx = BitmapEx(aChangedBitmap, aBitmapEx.GetAlpha());
-- else
-- aBitmapEx = BitmapEx(aChangedBitmap, aBitmapEx.GetMask());
-- }
-- else
-- aBitmapEx = BitmapEx(aChangedBitmap);
-- }
--
-- mxCanvas->drawBitmap(
-- vcl::unotools::xBitmapFromBitmapEx( mxCanvas->getDevice(),
-- aBitmapEx ),
-- maViewState,
-- maRenderState);
-- }
--
-- void canvasProcessor::impRender_PPLB(const polyPolygonBitmapPrimitive& rPolyBitmapCandidate )
-- {
-- const fillBitmapAttribute& rFillBmpAttr( rPolyBitmapCandidate.getFillBitmap() );
-- const basegfx::B2DPolyPolygon& rPoly( rPolyBitmapCandidate.getB2DPolyPolygon() );
--
-- // TODO(Q3): Share common bmp modification code with
-- // vclprocessor.cxx
-- Bitmap aChangedBitmap(
-- impModifyBitmap(maBColorModifierStack,
-- rFillBmpAttr.getBitmap()));
--
-- rendering::Texture aTexture;
-- const basegfx::B2DVector aBmpSize( rFillBmpAttr.getSize() );
--
-- const basegfx::B2DRange& rBounds(
-- basegfx::tools::getRange( rPoly ));
--
-- basegfx::B2DHomMatrix aScale;
-- aScale.scale( aBmpSize.getX() * rBounds.getWidth(),
-- aBmpSize.getY() * rBounds.getHeight() );
--
-- basegfx::unotools::affineMatrixFromHomMatrix(
-- aTexture.AffineTransform,
-- aScale );
--
-- aTexture.Alpha = 1.0;
-- aTexture.Bitmap =
-- ::vcl::unotools::xBitmapFromBitmapEx(
-- mxCanvas->getDevice(),
-- aChangedBitmap );
-- aTexture.RepeatModeX = rendering::TexturingMode::REPEAT;
-- aTexture.RepeatModeY = rendering::TexturingMode::REPEAT;
--
-- uno::Sequence< rendering::Texture > aSeq(1);
-- aSeq[0] = aTexture;
--
-- mxCanvas->fillTexturedPolyPolygon(
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rPoly),
-- maViewState,
-- maRenderState,
-- aSeq );
-- }
--
-- // direct draw of gradient
-- void canvasProcessor::impRender_PPLG(const polyPolygonGradientPrimitive& rPolygonCandidate)
-- {
-- const fillGradientAttribute& rGradient(rPolygonCandidate.getFillGradient());
-- basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor()));
-- basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor()));
-- basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
--
-- if(aStartColor == aEndColor)
-- {
-- // no gradient at all, draw as polygon
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aStartColor);
--
-- mxCanvas->drawPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- aLocalPolyPolygon),
-- maViewState,
-- maRenderState );
-- }
-- else
-- {
-- // TODO(F3): if rGradient.getSteps() > 0, render
-- // gradient manually!
-- impDrawGradient(
-- aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(),
-- aStartColor, aEndColor, rGradient.getBorder(),
-- -rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false);
-- }
-- }
--
-- // direct draw of PolyPolygon with color
-- void canvasProcessor::impRender_PPLC(const polyPolygonColorPrimitive& rPolygonCandidate)
-- {
-- const basegfx::BColor aRGBColor(
-- maBColorModifierStack.getModifiedColor(
-- rPolygonCandidate.getBColor()));
--
-- maRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aRGBColor);
--
-- mxCanvas->fillPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rPolygonCandidate.getB2DPolyPolygon()),
-- maViewState,
-- maRenderState );
-- }
--
-- // direct draw of MetaFile
-- void canvasProcessor::impRender_META(const metafilePrimitive& rMetaCandidate)
-- {
-- // get metafile (copy it)
-- GDIMetaFile aMetaFile;
--
-- // TODO(Q3): Share common metafile modification code with
-- // vclprocessor.cxx
-- if(maBColorModifierStack.count())
-- {
-- const basegfx::BColor aRGBBaseColor(0, 0, 0);
-- const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
-- aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
-- }
-- else
-- {
-- aMetaFile = rMetaCandidate.getMetaFile();
-- }
--
-- cppcanvas::BitmapCanvasSharedPtr pCanvas(
-- cppcanvas::VCLFactory::getInstance().createCanvas(
-- uno::Reference<rendering::XBitmapCanvas>(
-- mxCanvas,
-- uno::UNO_QUERY_THROW) ));
-- cppcanvas::RendererSharedPtr pMtfRenderer(
-- cppcanvas::VCLFactory::getInstance().createRenderer(
-- pCanvas,
-- aMetaFile,
-- cppcanvas::Renderer::Parameters() ));
-- if( pMtfRenderer )
-- {
-- pCanvas->setTransformation(maWorldToView);
-- pMtfRenderer->setTransformation(rMetaCandidate.getTransform());
-- pMtfRenderer->draw();
-- }
-- }
--
-- // mask group. Set mask polygon as clip
-- void canvasProcessor::impRender_MASK(const maskPrimitive& rMaskCandidate)
-- {
-- const primitiveVector& rSubList = rMaskCandidate.getPrimitiveVector();
--
-- if(!rSubList.empty())
-- {
-- // TODO(F3): cannot use state-global renderstate, when recursing!
-- maRenderState.Clip =
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- rMaskCandidate.getMask());
--
-- // paint to it
-- process(rSubList);
--
-- maRenderState.Clip.clear();
-- }
-- }
--
-- // modified color group. Force output to unified color.
-- void canvasProcessor::impRender_MCOL(const modifiedColorPrimitive& rModifiedCandidate)
-- {
-- const primitiveVector& rSubList = rModifiedCandidate.getPrimitiveVector();
--
-- if(!rSubList.empty())
-- {
-- maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
-- process(rModifiedCandidate.getPrimitiveVector());
-- maBColorModifierStack.pop();
-- }
-- }
--
-- // sub-transparence group. Draw to bitmap device first.
-- void canvasProcessor::impRender_TRPR(const transparencePrimitive& rTransCandidate)
-- {
-- const primitiveVector& rSubList = rTransCandidate.getPrimitiveVector();
--
-- if(!rSubList.empty())
-- {
-- basegfx::B2DRange aRange(
-- get2DRangeFromVector(rSubList,
-- getViewInformation()));
-- aRange.transform(maWorldToView);
-- const basegfx::B2I64Tuple& rSize(
-- canvas::tools::spritePixelAreaFromB2DRange(aRange).getRange());
-- uno::Reference< rendering::XCanvas > xBitmap(
-- mxCanvas->getDevice()->createCompatibleAlphaBitmap(
-- css::geometry::IntegerSize2D(rSize.getX(),
-- rSize.getY())),
-- uno::UNO_QUERY_THROW);
--
-- // remember last worldToView and add pixel offset
-- basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
-- basegfx::B2DHomMatrix aPixelOffset;
-- aPixelOffset.translate(aRange.getMinX(),
-- aRange.getMinY());
-- setWorldToView(aPixelOffset * maWorldToView);
--
-- // remember last canvas, set bitmap as target
-- uno::Reference< rendering::XCanvas > xLastCanvas( mxCanvas );
-- mxCanvas = xBitmap;
--
-- // paint content to it
-- process(rSubList);
--
-- // TODO(F3): render transparent list to alpha
-- // channel. Note that the OutDev implementation has a
-- // shortcoming, in that nested transparency groups
-- // don't work - alpha is not combined properly.
--
-- // process(rTransCandidate.getTransparenceList());
--
-- // back to old OutDev and worldToView
-- mxCanvas = xLastCanvas;
-- setWorldToView(aLastWorldToView);
--
-- // DUMMY: add alpha modulation value to DeviceColor
-- // TODO(F3): color management
-- canvas::tools::setDeviceColor( maRenderState,
-- 1.0, 1.0, 1.0, 0.5 );
-- // finally, draw bitmap
-- mxCanvas->drawBitmapModulated(
-- uno::Reference< rendering::XBitmap >(
-- xBitmap,
-- uno::UNO_QUERY_THROW),
-- maViewState,
-- maRenderState );
-- }
-- }
--
-- // transform group.
-- void canvasProcessor::impRender_TRN2(const transformPrimitive& rTransformCandidate)
-- {
-- // remember current transformation
-- basegfx::B2DHomMatrix aLastWorldToView(maWorldToView);
--
-- // create new transformations
-- setWorldToView(maWorldToView * rTransformCandidate.getTransformation());
--
-- // let break down
-- process(rTransformCandidate.getPrimitiveVector());
--
-- // restore transformations
-- setWorldToView(aLastWorldToView);
-- }
--
-- // marker
-- void canvasProcessor::impRender_MARK(const markerPrimitive& rMarkCandidate)
-- {
-- const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rMarkCandidate.getRGBColor()));
--
-- canvas::tools::initRenderState(maMarkerRenderState);
-- maMarkerRenderState.DeviceColor = basegfx::unotools::colorToDoubleSequence(
-- mxCanvas->getDevice(),
-- aRGBColor);
--
-- // Markers are special objects - their position is
-- // determined by the view transformation, but their size
-- // is always the same
-- const basegfx::B2DPoint aViewPos(maWorldToView * rMarkCandidate.getPosition());
--
-- uno::Reference< rendering::XPolyPolygon2D > xMarkerPoly;
-- uno::Reference< rendering::XPolyPolygon2D > xHighlightMarkerPoly;
-- switch(rMarkCandidate.getStyle())
-- {
-- default:
-- case MARKERSTYLE_POINT:
-- mxCanvas->drawPoint( basegfx::unotools::point2DFromB2DPoint(aViewPos),
-- maMarkerViewState,
-- maMarkerRenderState );
-- return;
--
-- case MARKERSTYLE_CROSS:
-- if( !mxCrossMarkerPoly.is() )
-- {
-- basegfx::B2DPolyPolygon aPoly;
-- basegfx::tools::importFromSvgD(
-- aPoly,
-- rtl::OUString::createFromAscii(
-- "m-1 0 h2 m0 -1 v2" ));
-- mxCrossMarkerPoly =
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- aPoly );
-- }
-- xMarkerPoly = mxCrossMarkerPoly;
-- break;
--
-- case MARKERSTYLE_GLUEPOINT :
-- if( !mxGluePointPoly.is() )
-- {
-- basegfx::B2DPolyPolygon aPoly;
-- basegfx::tools::importFromSvgD(
-- aPoly,
-- rtl::OUString::createFromAscii(
-- "m-2 -3 l5 5 m-3 -2 l5 5 m-3 2 l5 -5 m-2 3 l5 -5" ));
-- mxGluePointPoly =
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- aPoly );
-- }
-- if( !mxGluePointHighlightPoly.is() )
-- {
-- basegfx::B2DPolyPolygon aPoly;
-- basegfx::tools::importFromSvgD(
-- aPoly,
-- rtl::OUString::createFromAscii(
-- "m-2 -2 l4 4 m-2 2 l4 -4" ));
-- mxGluePointHighlightPoly =
-- basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
-- mxCanvas->getDevice(),
-- aPoly );
-- }
-- xMarkerPoly = mxGluePointPoly;
-- xHighlightMarkerPoly = mxGluePointHighlightPoly;
-- break;
-- }
--
-- basegfx::B2DRange aRange;
-- rMarkCandidate.getRealtiveViewRange(aRange);
-- const basegfx::B2DPoint aCenter(aRange.getCenter());
--
-- basegfx::B2DHomMatrix aTranslate;
-- aTranslate.translate(aViewPos.getX()+aCenter.getX(),
-- aViewPos.getY()+aCenter.getY());
--
-- canvas::tools::setRenderStateTransform( maMarkerRenderState,
-- aTranslate );
--
--
-- mxCanvas->drawPolyPolygon( xMarkerPoly,
-- maMarkerViewState,
-- maMarkerRenderState );
-- if( xHighlightMarkerPoly.is() )
-- {
-- // TODO(F3): color management
-- canvas::tools::setDeviceColor(maMarkerRenderState,
-- 0.0, 0.0, 1.0, 1.0);
-- mxCanvas->drawPolyPolygon( xMarkerPoly,
-- maMarkerViewState,
-- maMarkerRenderState );
-- }
-- }
--
-- void canvasProcessor::setWorldToView(const basegfx::B2DHomMatrix& rMat)
-- {
-- maWorldToView = rMat;
-- canvas::tools::setViewStateTransform(maViewState,
-- maWorldToView);
-- }
--
-- //////////////////////////////////////////////////////////////////////////////
-- // internal processing support
--
-- void canvasProcessor::process(const primitiveVector& rSource)
-- {
-- primitiveVector::const_iterator aCurr = rSource.begin();
-- const primitiveVector::const_iterator aEnd = rSource.end();
-- while( aCurr != aEnd )
-- {
-- const referencedPrimitive& rCandidate = *aCurr;
--
-- switch(rCandidate.getID())
-- {
-- case CreatePrimitiveID('S', 'T', 'X', 'P'):
-- {
-- // directdraw of text simple portion
-- impRender_STXP(static_cast< const textSimplePortionPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('P', 'O', 'H', 'L'):
-- {
-- // direct draw of hairline
-- impRender_POHL(static_cast< const polygonHairlinePrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('B', 'M', 'P', 'R'):
-- {
-- // direct draw of transformed BitmapEx primitive
-- impRender_BMPR(static_cast< const bitmapPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('F', 'B', 'M', 'P'):
-- {
-- OSL_ENSURE(false,"fillBitmapPrimitive not yet implemented");
-- break;
-- }
--
-- case CreatePrimitiveID('P', 'P', 'L', 'B'):
-- {
-- // direct draw of polygon with bitmap fill
-- impRender_PPLB(static_cast< const polyPolygonBitmapPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('P', 'P', 'L', 'G'):
-- {
-- // direct draw of gradient
-- impRender_PPLG(static_cast< const polyPolygonGradientPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('P', 'P', 'L', 'C'):
-- {
-- // direct draw of PolyPolygon with color
-- impRender_PPLC(static_cast< const polyPolygonColorPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('M', 'E', 'T', 'A'):
-- {
-- // direct draw of MetaFile
-- impRender_META(static_cast< const metafilePrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('M', 'A', 'S', 'K'):
-- {
-- // mask group. Force output to VDev and create mask from given mask
-- impRender_MASK(static_cast< const maskPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('M', 'C', 'O', 'L'):
-- {
-- // modified color group. Force output to unified color.
-- impRender_MCOL(static_cast< const modifiedColorPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('T', 'R', 'P', 'R'):
-- {
-- // sub-transparence group. Draw to VDev first.
-- impRender_TRPR(static_cast< const transparencePrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('T', 'R', 'N', '2'):
-- {
-- // transform group.
-- impRender_TRN2(static_cast< const transformPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('M', 'A', 'R', 'K'):
-- {
-- // marker
-- impRender_MARK(static_cast< const markerPrimitive& >(rCandidate.getBasePrimitive()));
-- break;
-- }
--
-- case CreatePrimitiveID('A', 'N', 'S', 'W'):
-- case CreatePrimitiveID('A', 'N', 'B', 'L'):
-- case CreatePrimitiveID('A', 'N', 'I', 'N'):
-- {
-- // check timing, but do not accept
-- const animatedSwitchPrimitive& rAnimatedCandidate(static_cast< const animatedSwitchPrimitive& >(rCandidate.getBasePrimitive()));
-- const ::drawinglayer::animation::animationEntryList& rAnimationList = rAnimatedCandidate.getAnimationList();
-- const double fNewTime(rAnimationList.getNextEventTime(getViewInformation().getViewTime()));
--
-- // let break down
-- process(rAnimatedCandidate.getDecomposition(getViewInformation()));
--
-- break;
-- }
--
-- default:
-- {
-- // let break down
-- process(rCandidate.getBasePrimitive().getDecomposition(getViewInformation()));
-- }
-- }
--
-- ++aCurr;
-- }
-- }
--
-- canvasProcessor::canvasProcessor( const ::drawinglayer::geometry::viewInformation& rViewInformation,
-- const uno::Reference<rendering::XCanvas>& rCanvas ) :
-- processor(rViewInformation),
-- mxCanvas( rCanvas ),
-- mxCrossMarkerPoly(),
-- mxGluePointPoly(),
-- mxGluePointHighlightPoly(),
-- maBColorModifierStack(),
-- maWorldToView(),
-- maViewState(),
-- maRenderState(),
-- maMarkerViewState(),
-- maMarkerRenderState()
-- {
-- canvas::tools::initViewState(maViewState);
-- canvas::tools::initRenderState(maRenderState);
-- canvas::tools::initViewState(maMarkerViewState);
-- canvas::tools::initRenderState(maMarkerRenderState);
--
-- maWorldToView = maViewInformation.getViewTransformation();
--
-- canvas::tools::setViewStateTransform(maViewState,
-- maWorldToView);
-- }
--
-- canvasProcessor::~canvasProcessor()
-- {}
--*/
--//////////////////////////////////////////////////////////////////////////////
--
- namespace drawinglayer
- {
- namespace processor2d
-@@ -1309,7 +109,7 @@ namespace drawinglayer
- // alpha-using XBitmap for content and draw the mask as alpha. Both have their
- // advantages and disadvantages, so here are both with a bool allowing simple
- // change
-- if(bUseMaskBitmapMethod)
-+ if(bUseMaskBitmapMethod && mpOutputDevice)
- {
- // get logic range of transparent part, clip with ViewRange
- basegfx::B2DRange aLogicRange(aMask.getB2DRange());
-@@ -1415,55 +215,45 @@ namespace drawinglayer
- }
- else
- {
-- // transform new mask polygon to view coordinates for processing. All masks
-- // are processed in view coordinates and clipped against each other evtl. to
-+ // transform new mask polygon to view
-+ // coordinates for processing. All masks are
-+ // processed in view coordinates and clipped
-+ // against each other (if necessary), to
- // create multi-clips
- aMask.transform(getViewInformation2D().getObjectTransformation());
-
-- // remember last current clip polygon
- const basegfx::B2DPolyPolygon aLastClipPolyPolygon(maClipPolyPolygon);
-+ const uno::Reference<rendering::XPolyPolygon2D> xLastClipPoly = maViewState.Clip;
-
-- if(maClipPolyPolygon.count())
-+ if(xLastClipPoly.is())
- {
-- // there is already a clip polygon set; build clipped union of
-- // current mask polygon and new one
-+ // build clipped union of current mask
-+ // polygon and new one - this is to avoid
-+ // costly, repeated clip calculations
-+ // inside the canvas impls for all the
-+ // mask group contents
- maClipPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon(aMask, maClipPolyPolygon, false, false);
- }
- else
- {
-- // use mask directly
- maClipPolyPolygon = aMask;
- }
-
-- // set at ViewState
-- if(maClipPolyPolygon.count())
-- {
-- // set new as clip polygon
-- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-- }
-- else
-- {
-- // empty, reset
-- maViewState.Clip.clear();
-- }
-+ // set new clip polygon at viewstate -
-+ // unconditionally, an empty maClipPolyPolygon
-+ // denotes the empty clip (nothing visible),
-+ // and need not be confused with the empty
-+ // interface (the null clip, i.e. everything
-+ // visible)
-+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(),
-+ maClipPolyPolygon);
-
- // paint content
- process(rChildren);
-
- // restore local current to rescued clip polygon
- maClipPolyPolygon = aLastClipPolyPolygon;
--
-- // set at ViewState
-- if(maClipPolyPolygon.count())
-- {
-- // set new as clip polygon
-- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-- }
-- else
-- {
-- // empty, reset
-- maViewState.Clip.clear();
-- }
-+ maViewState.Clip = xLastClipPoly;
- }
- }
- }
-@@ -1499,6 +289,8 @@ namespace drawinglayer
-
- void canvasProcessor2D::impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate)
- {
-+ static bool bAvoidShearedText(true);
-+
- if(rTextCandidate.getTextLength())
- {
- double fShearX(0.0);
-@@ -1509,10 +301,12 @@ namespace drawinglayer
- aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
- }
-
-- if(!basegfx::fTools::equalZero(fShearX))
-+ if(bAvoidShearedText && !basegfx::fTools::equalZero(fShearX))
- {
-- // text is sheared. As long as the canvas renderers do not support this,
-- // use the decomposed primitive
-+ // text is sheared. As long as the canvas
-+ // renderers do not support this, use the
-+ // decomposed primitive (iirc this is only a
-+ // problem with vclcanvas)
- process(rTextCandidate.get2DDecomposition(getViewInformation2D()));
- }
- else
-@@ -1532,7 +326,9 @@ namespace drawinglayer
- aFontRequest.CellSize = 1.0;
- aFontRequest.Locale = rTextCandidate.getLocale();
-
-- // font matrix should only be used for glyph rotations etc.
-+ // font matrix should only be used for glyph
-+ // rotations etc. - why, then use it for sheared
-+ // text, no?
- com::sun::star::geometry::Matrix2D aFontMatrix;
- canvas::tools::setIdentityMatrix2D(aFontMatrix);
-
-@@ -1640,86 +436,93 @@ namespace drawinglayer
- {
- // get discrete range of transparent part
- basegfx::B2DRange aDiscreteRange(aLogicRange);
-- aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
--
-- // expand to next covering discrete values (pixel bounds)
-+ aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
-+
-+ // expand to next covering discrete values (pixel bounds)
- aDiscreteRange.expand(basegfx::B2DTuple(floor(aDiscreteRange.getMinX()), floor(aDiscreteRange.getMinY())));
- aDiscreteRange.expand(basegfx::B2DTuple(ceil(aDiscreteRange.getMaxX()), ceil(aDiscreteRange.getMaxY())));
-
-- // use VCL-based buffer device
-- impBufferDevice aBufferDevice(*mpOutputDevice, aDiscreteRange, false);
-+ if( mpOutputDevice )
-+ {
-+ // use VCL-based buffer device
-+ impBufferDevice aBufferDevice(*mpOutputDevice, aDiscreteRange, false);
-
-- if(aBufferDevice.isVisible())
-- {
-- // remember current OutDev, Canvas and ViewInformation
-- OutputDevice* pLastOutputDevice = mpOutputDevice;
-- uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas);
-- const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
--
-- // prepare discrete offset for XBitmap, do not forget that the buffer bitmap
-- // may be truncated to discrete visible pixels
-- basegfx::B2DHomMatrix aDiscreteOffset;
-- aDiscreteOffset.translate(
-- aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0,
-- aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0);
--
-- // create new local ViewInformation2D with new transformation
-- const geometry::ViewInformation2D aViewInformation2D(
-- getViewInformation2D().getObjectTransformation(),
-- aDiscreteOffset * getViewInformation2D().getViewTransformation(),
-- getViewInformation2D().getViewport(),
-- getViewInformation2D().getVisualizedPage(),
-- getViewInformation2D().getViewTime(),
-- getViewInformation2D().getExtendedInformationSequence());
-- updateViewInformation(aViewInformation2D);
--
-- // set OutDev and Canvas to content target
-- mpOutputDevice = &aBufferDevice.getContent();
-- mxCanvas = mpOutputDevice->GetCanvas();
-- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
--
-- // if ViewState transform is changed, the clipping polygon needs to be adapted, too
-- const basegfx::B2DPolyPolygon aOldClipPolyPolygon(maClipPolyPolygon);
--
-- if(maClipPolyPolygon.count())
-+ if(aBufferDevice.isVisible())
- {
-- maClipPolyPolygon.transform(aDiscreteOffset);
-- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-- }
-+ // remember current OutDev, Canvas and ViewInformation
-+ OutputDevice* pLastOutputDevice = mpOutputDevice;
-+ uno::Reference< rendering::XCanvas > xLastCanvas(mxCanvas);
-+ const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
-+
-+ // prepare discrete offset for XBitmap, do not forget that the buffer bitmap
-+ // may be truncated to discrete visible pixels
-+ basegfx::B2DHomMatrix aDiscreteOffset;
-+ aDiscreteOffset.translate(
-+ aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0,
-+ aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0);
-+
-+ // create new local ViewInformation2D with new transformation
-+ const geometry::ViewInformation2D aViewInformation2D(
-+ getViewInformation2D().getObjectTransformation(),
-+ aDiscreteOffset * getViewInformation2D().getViewTransformation(),
-+ getViewInformation2D().getViewport(),
-+ getViewInformation2D().getVisualizedPage(),
-+ getViewInformation2D().getViewTime(),
-+ getViewInformation2D().getExtendedInformationSequence());
-+ updateViewInformation(aViewInformation2D);
-+
-+ // set OutDev and Canvas to content target
-+ mpOutputDevice = &aBufferDevice.getContent();
-+ mxCanvas = mpOutputDevice->GetCanvas();
-+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
-+
-+ // if ViewState transform is changed, the clipping polygon needs to be adapted, too
-+ const basegfx::B2DPolyPolygon aOldClipPolyPolygon(maClipPolyPolygon);
-+
-+ if(maClipPolyPolygon.count())
-+ {
-+ maClipPolyPolygon.transform(aDiscreteOffset);
-+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-+ }
-
-- // paint content
-- process(rChildren);
-+ // paint content
-+ process(rChildren);
-
-- // set to mask
-- mpOutputDevice = &aBufferDevice.getAlpha();
-- mxCanvas = mpOutputDevice->GetCanvas();
-- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
-+ // set to mask
-+ mpOutputDevice = &aBufferDevice.getAlpha();
-+ mxCanvas = mpOutputDevice->GetCanvas();
-+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
-
-- // when painting alpha masks, reset the color stack
-- basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack);
-- maBColorModifierStack = basegfx::BColorModifierStack();
-+ // when painting alpha masks, reset the color stack
-+ basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack);
-+ maBColorModifierStack = basegfx::BColorModifierStack();
-
-- // paint mask to it (always with alpha intensities, evtl. with AA)
-- process(rAlpha);
-+ // paint mask to it (always with alpha intensities, evtl. with AA)
-+ process(rAlpha);
-
-- // back to old color stack, OutDev, Canvas and ViewTransform
-- maBColorModifierStack = aLastBColorModifierStack;
-- mpOutputDevice = pLastOutputDevice;
-- mxCanvas = xLastCanvas;
-- updateViewInformation(aLastViewInformation2D);
-- canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
-+ // back to old color stack, OutDev, Canvas and ViewTransform
-+ maBColorModifierStack = aLastBColorModifierStack;
-+ mpOutputDevice = pLastOutputDevice;
-+ mxCanvas = xLastCanvas;
-+ updateViewInformation(aLastViewInformation2D);
-+ canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation());
-
-- // restore clipping polygon
-- maClipPolyPolygon = aOldClipPolyPolygon;
-+ // restore clipping polygon
-+ maClipPolyPolygon = aOldClipPolyPolygon;
-
-- if(maClipPolyPolygon.count())
-- {
-- maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-- }
-+ if(maClipPolyPolygon.count())
-+ {
-+ maViewState.Clip = basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), maClipPolyPolygon);
-+ }
-
-- // dump buffer to outdev
-- aBufferDevice.paint();
-- }
-+ // dump buffer to outdev
-+ aBufferDevice.paint();
-+ }
-+ }
-+ else
-+ {
-+ // do it the canvas way
-+ }
- }
- }
- }
-@@ -2100,19 +903,27 @@ namespace drawinglayer
- }
- case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
- {
-+ const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
-+
- // chart primitive in canvas renderer; restore original DrawMode during call
- // since the evtl. used ChartPrettyPainter will use the MapMode
-- const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
-- mpOutputDevice->Push(PUSH_MAPMODE);
-- mpOutputDevice->SetMapMode(maOriginalMapMode);
-+ bool bDone=false;
-+ if( mpOutputDevice )
-+ {
-+ mpOutputDevice->Push(PUSH_MAPMODE);
-+ mpOutputDevice->SetMapMode(maOriginalMapMode);
-
-- if(!renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
-- {
-- // fallback to decomposition (MetaFile)
-- process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
-- }
-+ if(renderChartPrimitive2D(rChartPrimitive, *mpOutputDevice))
-+ bDone=true;
-+
-+ mpOutputDevice->Pop();
-+ }
-
-- mpOutputDevice->Pop();
-+ if( !bDone )
-+ {
-+ // fallback to decomposition (MetaFile)
-+ process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
-+ }
- break;
- }
- case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
-@@ -2122,7 +933,8 @@ namespace drawinglayer
- // this can be removed anytime and the decomposition may be used
- const primitive2d::WrongSpellPrimitive2D& rWrongSpellPrimitive = static_cast< const primitive2d::WrongSpellPrimitive2D& >(rCandidate);
-
-- if(!renderWrongSpellPrimitive2D(
-+ if(!mpOutputDevice ||
-+ !renderWrongSpellPrimitive2D(
- rWrongSpellPrimitive,
- *mpOutputDevice,
- getViewInformation2D().getObjectToViewTransformation(),
-@@ -2157,6 +969,28 @@ namespace drawinglayer
- // process support
-
- canvasProcessor2D::canvasProcessor2D(
-+ const geometry::ViewInformation2D& rViewInformation,
-+ const uno::Reference< rendering::XCanvas >& xCanvas,
-+ const rendering::ViewState& rViewState )
-+ : BaseProcessor2D(rViewInformation),
-+ maOriginalMapMode(),
-+ mpOutputDevice(NULL),
-+ mxCanvas(xCanvas),
-+ maViewState(rViewState),
-+ maRenderState(),
-+ maBColorModifierStack(),
-+ maDrawinglayerOpt(),
-+ maClipPolyPolygon()
-+ {
-+ canvas::tools::initRenderState(maRenderState);
-+ canvas::tools::appendToViewState(maViewState,
-+ getViewInformation2D().getViewTransformation());
-+ if( maViewState.Clip.is() )
-+ maClipPolyPolygon = basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(
-+ maViewState.Clip);
-+ }
-+
-+ canvasProcessor2D::canvasProcessor2D(
- const geometry::ViewInformation2D& rViewInformation,
- OutputDevice& rOutDev)
- : BaseProcessor2D(rViewInformation),
-@@ -2178,20 +1012,21 @@ namespace drawinglayer
-
- // set digit language, derived from SvtCTLOptions to have the correct
- // number display for arabic/hindi numerals
-+ LanguageType eLang;
- if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals())
- {
-- meLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
-+ eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
- }
- else if(SvtCTLOptions::NUMERALS_ARABIC == aSvtCTLOptions.GetCTLTextNumerals())
- {
-- meLang = LANGUAGE_ENGLISH;
-+ eLang = LANGUAGE_ENGLISH;
- }
- else
- {
-- meLang = (LanguageType)Application::GetSettings().GetLanguage();
-+ eLang = (LanguageType)Application::GetSettings().GetLanguage();
- }
-
-- rOutDev.SetDigitLanguage(meLang);
-+ rOutDev.SetDigitLanguage(eLang);
-
- // prepare output directly to pixels
- mpOutputDevice->Push(PUSH_MAPMODE);
-@@ -2210,11 +1045,14 @@ namespace drawinglayer
-
- canvasProcessor2D::~canvasProcessor2D()
- {
-- // restore MapMode
-- mpOutputDevice->Pop();
--
-- // restore AntiAliasing
-- mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
-+ if( mpOutputDevice )
-+ {
-+ // restore MapMode
-+ mpOutputDevice->Pop();
-+
-+ // restore AntiAliasing
-+ mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW);
-+ }
- }
- } // end of namespace processor2d
- } // end of namespace drawinglayer
-diff --git offapi/com/sun/star/graphic/XPrimitive2D.idl offapi/com/sun/star/graphic/XPrimitive2D.idl
-index ccdc91d..00b41b8 100644
---- offapi/com/sun/star/graphic/XPrimitive2D.idl
-+++ offapi/com/sun/star/graphic/XPrimitive2D.idl
-@@ -57,11 +57,19 @@ interface XPrimitive2D : ::com::sun::star::uno::XInterface
- 2D View-specific parameter set. The defined but not mandatory
- parameters include:
-
-- ::com::sun::star::geometry::AffineMatrix2D Transformation
-+ ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation
-
-- A transformation matrix which maps between world coordinates (which
-- is equal to object's local coordinates) to view coordinates. If not
-- defined, an empty transformation is implied.
-+ A transformation matrix which maps between object coordinates
-+ (which is equal to object's local coordinates) to world
-+ coordinates. If not defined, the identity transformation is
-+ implied.
-+
-+ ::com::sun::star::geometry::AffineMatrix2D ViewTransformation
-+
-+ A transformation matrix which maps between world coordinates
-+ to view coordinates, i.e. usually the actual pixel on
-+ screen. If not defined, the identity transformation is
-+ implied.
-
- ::com::sun::star::geometry::RealRectangle2D Viewport
-
-@@ -76,6 +84,11 @@ interface XPrimitive2D : ::com::sun::star::uno::XInterface
- lead to varied results for animated objects. This value is defined in the
- range [0.0 .. n[, negative values are not allowed. If not given, a value of
- 0.0 is implied.
-+
-+ ::com::sun::star::drawing::XDrawPage VisualizedPage
-+
-+ The page object this is displayed on. Used to e.g. resolve
-+ page number placeholders and the like.
- */
- sequence< XPrimitive2D > getDecomposition( [in] sequence< ::com::sun::star::beans::PropertyValue > aViewParameters );
-
-diff --git offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl
-index 8022207..643e7a4 100644
---- offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl
-+++ offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl
-@@ -69,6 +69,42 @@ interface XPrimitiveFactory2D : ::com::sun::star::uno::XInterface
- Sequence of factory parameters, whose semantics depend on the
- shape to be generated.
-
-+ 2D View-specific parameter set. The defined but not mandatory
-+ parameters include:
-+
-+ ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation
-+
-+ A transformation matrix which maps between object coordinates
-+ (which is equal to object's local coordinates) to world
-+ coordinates. If not defined, the identity transformation is
-+ implied.
-+
-+ ::com::sun::star::geometry::AffineMatrix2D ViewTransformation
-+
-+ A transformation matrix which maps between world coordinates
-+ to view coordinates, i.e. usually the actual pixel on
-+ screen. If not defined, the identity transformation is
-+ implied.
-+
-+ ::com::sun::star::geometry::RealRectangle2D Viewport
-+
-+ Defines the visible part of the view in world coordinates. May be used
-+ to optimize decompositions, e.g. for 3d scenes only the visible part
-+ needs to be created. If not given, an empty Viewport is implied which
-+ means all is visible.
-+
-+ double Time
-+
-+ Defines the point in time for which the geometry is defined. This may
-+ lead to varied results for animated objects. This value is defined in the
-+ range [0.0 .. n[, negative values are not allowed. If not given, a value of
-+ 0.0 is implied.
-+
-+ ::com::sun::star::drawing::XDrawPage VisualizedPage
-+
-+ The page object this is displayed on. Used to e.g. resolve
-+ page number placeholders and the like.
-+
- @return a sequence of primitives, that consists of the
- geometrical representation from the given XShape.
- */
-@@ -87,6 +123,42 @@ interface XPrimitiveFactory2D : ::com::sun::star::uno::XInterface
- Sequence of factory parameters, whose semantics depend on the
- page to be generated.
-
-+ 2D View-specific parameter set. The defined but not mandatory
-+ parameters include:
-+
-+ ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation
-+
-+ A transformation matrix which maps between object coordinates
-+ (which is equal to object's local coordinates) to world
-+ coordinates. If not defined, the identity transformation is
-+ implied.
-+
-+ ::com::sun::star::geometry::AffineMatrix2D ViewTransformation
-+
-+ A transformation matrix which maps between world coordinates
-+ to view coordinates, i.e. usually the actual pixel on
-+ screen. If not defined, the identity transformation is
-+ implied.
-+
-+ ::com::sun::star::geometry::RealRectangle2D Viewport
-+
-+ Defines the visible part of the view in world coordinates. May be used
-+ to optimize decompositions, e.g. for 3d scenes only the visible part
-+ needs to be created. If not given, an empty Viewport is implied which
-+ means all is visible.
-+
-+ double Time
-+
-+ Defines the point in time for which the geometry is defined. This may
-+ lead to varied results for animated objects. This value is defined in the
-+ range [0.0 .. n[, negative values are not allowed. If not given, a value of
-+ 0.0 is implied.
-+
-+ ::com::sun::star::drawing::XDrawPage VisualizedPage
-+
-+ The page object this is displayed on. Used to e.g. resolve
-+ page number placeholders and the like.
-+
- @return a sequence of primitives, that consists of the
- geometrical representation for the given XDrawPage.
- */
-diff --git slideshow/source/engine/shapes/drawshape.cxx slideshow/source/engine/shapes/drawshape.cxx
-index 8894073..6ddf1e8 100644
---- slideshow/source/engine/shapes/drawshape.cxx
-+++ slideshow/source/engine/shapes/drawshape.cxx
-@@ -350,6 +350,9 @@ namespace slideshow
- // it does _not_ for MSVC without
- // the extra mem_fn. WTF.
- _1,
-+ ::boost::cref( mxShape ),
-+ ::boost::cref( mxPage ),
-+ ::boost::cref( mxPrimitives ),
- ::boost::cref( mpCurrMtf ),
- ::boost::cref(
- getViewRenderArgs() ),
-@@ -563,6 +566,9 @@ namespace slideshow
- mnAttributeVisibilityState(0),
- maViewShapes(),
- mxComponentContext( rContext.mxComponentContext ),
-+ mxPrimitives(
-+ rContext.mxPrimitiveFactory->createPrimitivesFromXShape(xShape,
-+ uno::Sequence<beans::PropertyValue>()) ),
- maHyperlinkIndices(),
- maHyperlinkRegions(),
- maSubsetting(),
-@@ -624,6 +630,9 @@ namespace slideshow
- mnAttributeVisibilityState(0),
- maViewShapes(),
- mxComponentContext( rContext.mxComponentContext ),
-+ mxPrimitives(
-+ rContext.mxPrimitiveFactory->createPrimitivesFromXShape(xShape,
-+ uno::Sequence<beans::PropertyValue>()) ),
- maHyperlinkIndices(),
- maHyperlinkRegions(),
- maSubsetting(),
-@@ -676,6 +685,7 @@ namespace slideshow
- mnAttributeVisibilityState(0),
- maViewShapes(),
- mxComponentContext( rSrc.mxComponentContext ),
-+ mxPrimitives( rSrc.mxPrimitives ),
- maHyperlinkIndices(),
- maHyperlinkRegions(),
- maSubsetting( rTreeNode, mpCurrMtf ),
-@@ -837,7 +847,10 @@ namespace slideshow
- // render the Shape on the newly added ViewLayer
- if( bRedrawLayer )
- {
-- pNewShape->update( mpCurrMtf,
-+ pNewShape->update( mxShape,
-+ mxPage,
-+ mxPrimitives,
-+ mpCurrMtf,
- getViewRenderArgs(),
- ViewShape::FORCE,
- isVisible() );
-diff --git slideshow/source/engine/shapes/drawshape.hxx slideshow/source/engine/shapes/drawshape.hxx
-index 4c8fb8d..3d06488 100644
---- slideshow/source/engine/shapes/drawshape.hxx
-+++ slideshow/source/engine/shapes/drawshape.hxx
-@@ -33,6 +33,7 @@
-
- #include <osl/diagnose.hxx>
- #include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
-
- #include "attributableshape.hxx"
- #include "doctreenodesupplier.hxx"
-@@ -347,6 +348,10 @@ namespace slideshow
- ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext> mxComponentContext;
-
-+ ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitive2D > > mxPrimitives;
-+
- /// hyperlink support
- typedef ::std::pair<sal_Int32 /* mtf start */,
- sal_Int32 /* mtf end */> HyperlinkIndexPair;
-diff --git slideshow/source/engine/shapes/viewshape.cxx slideshow/source/engine/shapes/viewshape.cxx
-index 84094db..5eeb0e5 100644
---- slideshow/source/engine/shapes/viewshape.cxx
-+++ slideshow/source/engine/shapes/viewshape.cxx
-@@ -56,6 +56,7 @@
- #include <canvas/canvastools.hxx>
- #include <cppcanvas/vclfactory.hxx>
- #include <cppcanvas/basegfxfactory.hxx>
-+#include <drawinglayer/processor2d/canvasprocessor.hxx>
-
- #include "viewshape.hxx"
- #include "tools.hxx"
-@@ -194,6 +195,9 @@ namespace slideshow
- }
-
- bool ViewShape::draw( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas,
-+ const uno::Reference<drawing::XShape>& xShape,
-+ const uno::Reference<drawing::XDrawPage>& xPage,
-+ const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ShapeAttributeLayerSharedPtr& rAttr,
- const ::basegfx::B2DHomMatrix& rTransform,
-@@ -202,12 +206,6 @@ namespace slideshow
- {
- RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::draw()" );
-
-- ::cppcanvas::RendererSharedPtr pRenderer(
-- getRenderer( rDestinationCanvas, rMtf, rAttr ) );
--
-- ENSURE_OR_RETURN( pRenderer, "ViewShape::draw(): Invalid renderer" );
--
-- pRenderer->setTransformation( rTransform );
- #if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0
- rendering::RenderState aRenderState;
- ::canvas::tools::initRenderState(aRenderState);
-@@ -235,34 +233,30 @@ namespace slideshow
- DBG_UNHANDLED_EXCEPTION();
- }
- #endif
-+
-+ drawinglayer::geometry::ViewInformation2D aViewInfo(
-+ basegfx::B2DHomMatrix(), rTransform,
-+ basegfx::B2DRange(-10000,-10000,10000,10000), // HACK
-+ xPage, 0.0,
-+ uno::Sequence<beans::PropertyValue>());
-+
-+ drawinglayer::processor2d::canvasProcessor2D::canvasProcessor2D aProcessor(
-+ aViewInfo,
-+ rDestinationCanvas->getUNOCanvas(),
-+ rDestinationCanvas->getViewState());
-+
-+ aProcessor.process(xPrimitives);
-+
-+#if 0
-+ pRenderer->setTransformation( rTransform );
- if( pClip )
- pRenderer->setClip( *pClip );
- else
- pRenderer->setClip();
-
-- if( rSubsets.empty() )
-- {
-- return pRenderer->draw();
-- }
-- else
-- {
-- // render subsets of whole metafile
-- // --------------------------------
--
-- bool bRet(true);
-- VectorOfDocTreeNodes::const_iterator aIter( rSubsets.begin() );
-- const VectorOfDocTreeNodes::const_iterator aEnd ( rSubsets.end() );
-- while( aIter != aEnd )
-- {
-- if( !pRenderer->drawSubset( aIter->getStartIndex(),
-- aIter->getEndIndex() ) )
-- bRet = false;
--
-- ++aIter;
-- }
--
-- return bRet;
-- }
-+ return pRenderer->draw();
-+#endif
-+ return true;
- }
-
- namespace
-@@ -307,6 +301,9 @@ namespace slideshow
- }
-
- bool ViewShape::renderSprite( const ViewLayerSharedPtr& rViewLayer,
-+ const uno::Reference<drawing::XShape>& xShape,
-+ const uno::Reference<drawing::XDrawPage>& xPage,
-+ const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ::basegfx::B2DRectangle& rOrigBounds,
- const ::basegfx::B2DRectangle& rBounds,
-@@ -520,6 +517,9 @@ namespace slideshow
- ::cppcanvas::CanvasSharedPtr pContentCanvas( mpSprite->getContentCanvas() );
-
- return draw( pContentCanvas,
-+ xShape,
-+ xPage,
-+ xPrimitives,
- rMtf,
- pAttr,
- aShapeTransformation,
-@@ -528,6 +528,9 @@ namespace slideshow
- }
-
- bool ViewShape::render( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas,
-+ const uno::Reference<drawing::XShape>& xShape,
-+ const uno::Reference<drawing::XDrawPage>& xPage,
-+ const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ::basegfx::B2DRectangle& rBounds,
- const ::basegfx::B2DRectangle& rUpdateBounds,
-@@ -689,6 +692,9 @@ namespace slideshow
-
- // render into this bitmap
- if( !draw( pBitmapCanvas,
-+ xShape,
-+ xPage,
-+ xPrimitives,
- rMtf,
- pAttr,
- aTransform,
-@@ -734,6 +740,9 @@ namespace slideshow
- pAttr ) );
-
- return draw( rDestinationCanvas,
-+ xShape,
-+ xPage,
-+ xPrimitives,
- rMtf,
- pAttr,
- aTransform,
-@@ -866,10 +875,13 @@ namespace slideshow
- mbForceUpdate = true;
- }
-
-- bool ViewShape::update( const GDIMetaFileSharedPtr& rMtf,
-- const RenderArgs& rArgs,
-- int nUpdateFlags,
-- bool bIsVisible ) const
-+ bool ViewShape::update( const uno::Reference<drawing::XShape>& xShape,
-+ const uno::Reference<drawing::XDrawPage>& xPage,
-+ const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives,
-+ const GDIMetaFileSharedPtr& rMtf,
-+ const RenderArgs& rArgs,
-+ int nUpdateFlags,
-+ bool bIsVisible ) const
- {
- RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::update()" );
- ENSURE_OR_RETURN( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
-@@ -877,6 +889,9 @@ namespace slideshow
- // Shall we render to a sprite, or to a plain canvas?
- if( isBackgroundDetached() )
- return renderSprite( mpViewLayer,
-+ xShape,
-+ xPage,
-+ xPrimitives,
- rMtf,
- rArgs.maOrigBounds,
- rArgs.maBounds,
-@@ -888,6 +903,9 @@ namespace slideshow
- bIsVisible );
- else
- return render( mpViewLayer->getCanvas(),
-+ xShape,
-+ xPage,
-+ xPrimitives,
- rMtf,
- rArgs.maBounds,
- rArgs.maUpdateBounds,
-diff --git slideshow/source/engine/shapes/viewshape.hxx slideshow/source/engine/shapes/viewshape.hxx
-index 684a93a..3c95171 100644
---- slideshow/source/engine/shapes/viewshape.hxx
-+++ slideshow/source/engine/shapes/viewshape.hxx
-@@ -48,6 +48,9 @@
-
- #include <vector>
-
-+namespace com{ namespace sun{ namespace star{ namespace graphic {
-+ class XPrimitive2D;
-+}}}}
-
- namespace slideshow
- {
-@@ -200,7 +203,14 @@ namespace slideshow
-
- @return whether the rendering finished successfully.
- */
-- bool update( const GDIMetaFileSharedPtr& rMtf,
-+ bool update( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XDrawPage >& xPage,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives,
-+ const GDIMetaFileSharedPtr& rMtf,
- const RenderArgs& rArgs,
- int nUpdateFlags,
- bool bIsVisible ) const;
-@@ -258,6 +268,13 @@ namespace slideshow
- associated canvas (which happens to be mpLastCanvas).
- */
- bool draw( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XDrawPage >& xPage,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ShapeAttributeLayerSharedPtr& rAttr,
- const ::basegfx::B2DHomMatrix& rTransform,
-@@ -267,6 +284,13 @@ namespace slideshow
- /** Render shape to an active sprite
- */
- bool renderSprite( const ViewLayerSharedPtr& rViewLayer,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XDrawPage >& xPage,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ::basegfx::B2DRectangle& rOrigBounds,
- const ::basegfx::B2DRectangle& rBounds,
-@@ -280,6 +304,13 @@ namespace slideshow
- /** Render shape to given canvas
- */
- bool render( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XDrawPage >& xPage,
-+ const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives,
- const GDIMetaFileSharedPtr& rMtf,
- const ::basegfx::B2DRectangle& rBounds,
- const ::basegfx::B2DRectangle& rUpdateBounds,
-diff --git slideshow/source/engine/slide/slideimpl.cxx slideshow/source/engine/slide/slideimpl.cxx
-index 4cc5b05..aeaecc8 100644
---- slideshow/source/engine/slide/slideimpl.cxx
-+++ slideshow/source/engine/slide/slideimpl.cxx
-@@ -49,6 +49,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/awt/Rectangle.hpp>
-+#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
- #include <com/sun/star/presentation/ParagraphTarget.hpp>
- #include <com/sun/star/presentation/EffectNodeType.hpp>
- #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
-@@ -374,7 +375,13 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage,
- rUserEventQueue,
- *this,
- rViewContainer,
-- xComponentContext ),
-+ xComponentContext,
-+ uno::Reference<com::sun::star::graphic::XPrimitiveFactory2D>(
-+ xComponentContext->getServiceManager()->createInstanceWithContext(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "com.sun.star.graphic.PrimitiveFactory2D") ),
-+ xComponentContext ),
-+ uno::UNO_QUERY_THROW ) ),
- mrCursorManager( rCursorManager ),
- maAnimations( maContext,
- getSlideSizeImpl() ),
-diff --git slideshow/source/engine/slideshowcontext.cxx slideshow/source/engine/slideshowcontext.cxx
-index 2b1b481..90108a7 100644
---- slideshow/source/engine/slideshowcontext.cxx
-+++ slideshow/source/engine/slideshowcontext.cxx
-@@ -31,6 +31,7 @@
-
- #include <com/sun/star/uno/Reference.hxx>
- #include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
-
- #include "slideshowcontext.hxx"
- #include "subsettableshapemanager.hxx"
-@@ -58,7 +59,9 @@ SlideShowContext::SlideShowContext( SubsettableShapeManagerSharedPtr& rSubsettab
- CursorManager& rCursorManager,
- const UnoViewContainer& rViewContainer,
- const uno::Reference<
-- uno::XComponentContext>& rComponentContext ) :
-+ uno::XComponentContext>& rComponentContext,
-+ const uno::Reference<
-+ graphic::XPrimitiveFactory2D>& rPrimitiveFactory ) :
- mpSubsettableShapeManager( rSubsettableShapeManager ),
- mrEventQueue( rEventQueue ),
- mrEventMultiplexer( rEventMultiplexer ),
-@@ -67,7 +70,8 @@ SlideShowContext::SlideShowContext( SubsettableShapeManagerSharedPtr& rSubsettab
- mrUserEventQueue( rUserEventQueue ),
- mrCursorManager( rCursorManager ),
- mrViewContainer( rViewContainer ),
-- mxComponentContext( rComponentContext )
-+ mxComponentContext( rComponentContext ),
-+ mxPrimitiveFactory( rPrimitiveFactory )
- {}
-
- void SlideShowContext::dispose()
-diff --git slideshow/source/engine/slideshowimpl.cxx slideshow/source/engine/slideshowimpl.cxx
-index dce6f79..ede4b86 100644
---- slideshow/source/engine/slideshowimpl.cxx
-+++ slideshow/source/engine/slideshowimpl.cxx
-@@ -1459,7 +1459,8 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
- maUserEventQueue,
- *this,
- maViewContainer,
-- mxComponentContext) );
-+ mxComponentContext,
-+ 0) );
- }
- else if (mpRehearseTimingsActivity)
- {
-diff --git slideshow/source/inc/slideshowcontext.hxx slideshow/source/inc/slideshowcontext.hxx
-index 595829b..4995f18 100644
---- slideshow/source/inc/slideshowcontext.hxx
-+++ slideshow/source/inc/slideshowcontext.hxx
-@@ -34,9 +34,11 @@
- #include <com/sun/star/uno/Reference.hxx>
- #include <boost/shared_ptr.hpp>
-
--namespace com{ namespace sun{ namespace star{ namespace uno
--{
-- class XComponentContext;
-+namespace com{ namespace sun{ namespace star{
-+namespace uno {
-+ class XComponentContext; }
-+namespace graphic {
-+ class XPrimitiveFactory2D;
- }}}}
-
-
-@@ -101,7 +103,9 @@ namespace slideshow
- CursorManager& rCursorManager,
- const UnoViewContainer& rViewContainer,
- const ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext>& rComponentContext );
-+ ::com::sun::star::uno::XComponentContext>& rComponentContext,
-+ const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitiveFactory2D>& rPrimitiveFactory );
- void dispose();
-
- boost::shared_ptr<SubsettableShapeManager>& mpSubsettableShapeManager;
-@@ -114,6 +118,8 @@ namespace slideshow
- const UnoViewContainer& mrViewContainer;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext> mxComponentContext;
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::graphic::XPrimitiveFactory2D> mxPrimitiveFactory;
- };
- }
- }
-diff --git slideshow/util/makefile.mk slideshow/util/makefile.mk
-index f3fe923..5ece86f 100644
---- slideshow/util/makefile.mk
-+++ slideshow/util/makefile.mk
-@@ -64,6 +64,7 @@ SHL1STDLIBS= $(TOOLSLIB) \
- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(BASEGFXLIB) \
-+ $(DRAWINGLAYERLIB) \
- $(CANVASTOOLSLIB) \
- $(CPPCANVASLIB) \
- $(UNOTOOLSLIB) \
diff --git a/patches/test/slideshow-unittests.diff b/patches/test/slideshow-unittests.diff
deleted file mode 100644
index 16b92fe46..000000000
--- a/patches/test/slideshow-unittests.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-Fix slideshow unit tests
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- slideshow/test/demoshow.cxx | 5 +++++
- slideshow/test/testview.cxx | 14 ++++++++++++++
- 2 files changed, 19 insertions(+), 0 deletions(-)
-
-
-diff --git slideshow/test/demoshow.cxx slideshow/test/demoshow.cxx
-index 5cfc82c..c9ee73d 100644
---- slideshow/test/demoshow.cxx
-+++ slideshow/test/demoshow.cxx
-@@ -204,6 +204,11 @@ private:
- {
- }
-
-+ virtual awt::Rectangle SAL_CALL getCanvasArea( ) throw (uno::RuntimeException)
-+ {
-+ return awt::Rectangle(0,0,maSize.Width(),maSize.Height());
-+ }
-+
- uno::Reference< rendering::XSpriteCanvas > mxCanvas;
- ::cppu::OInterfaceContainerHelper maPaintListeners;
- ::cppu::OInterfaceContainerHelper maTransformationListeners;
-diff --git slideshow/test/testview.cxx slideshow/test/testview.cxx
-index 19618ff..e1e137d 100644
---- slideshow/test/testview.cxx
-+++ slideshow/test/testview.cxx
-@@ -136,6 +136,11 @@ public:
- {
- }
-
-+ virtual awt::Rectangle SAL_CALL getCanvasArea( ) throw (uno::RuntimeException)
-+ {
-+ return awt::Rectangle(0,0,100,100);
-+ }
-+
- // TestView
- virtual bool isClearCalled() const
- {
-@@ -278,6 +283,15 @@ public:
- {
- mbDisposed = true;
- }
-+
-+ virtual bool isSoundEnabled (void) const
-+ {
-+ return true;
-+ }
-+
-+ virtual void setIsSoundEnabled (const bool /*bValue*/)
-+ {
-+ }
- };
-
-
diff --git a/patches/test/slidesorter-demo-pngperf.svtools.diff b/patches/test/slidesorter-demo-pngperf.svtools.diff
deleted file mode 100644
index c92ea79ad..000000000
--- a/patches/test/slidesorter-demo-pngperf.svtools.diff
+++ /dev/null
@@ -1,234 +0,0 @@
-Index: svtools/inc/filter.hxx
-===================================================================
-RCS file: /cvs/util/svtools/inc/filter.hxx,v
-retrieving revision 1.23
-retrieving revision 1.23.14.1
-diff -u -p -r1.23 -r1.23.14.1
---- svtools/inc/filter.hxx 8 Sep 2005 09:28:45 -0000 1.23
-+++ svtools/inc/filter.hxx 14 Oct 2005 12:54:49 -0000 1.23.14.1
-@@ -92,6 +92,8 @@ class Window;
-
- #define GRFILTER_I_FLAGS_SET_LOGSIZE_FOR_JPEG 00000001
- #define GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG 00000002
-+#define GRFILTER_I_FLAGS_FOR_PREVIEW 00000004
-+#define GRFILTER_I_FLAGS_ALLOW_PARTIAL_STREAMREAD 00000010
-
- #define IMP_BMP "SVBMP"
- #define IMP_SVMETAFILE "SVMETAFILE"
-Index: svtools/source/filter.vcl/filter/filter.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/filter.vcl/filter/filter.cxx,v
-retrieving revision 1.58
-retrieving revision 1.58.14.1
-diff -u -p -r1.58 -r1.58.14.1
---- svtools/source/filter.vcl/filter/filter.cxx 8 Sep 2005 15:37:30 -0000 1.58
-+++ svtools/source/filter.vcl/filter/filter.cxx 14 Oct 2005 12:54:49 -0000 1.58.14.1
-@@ -1437,27 +1437,45 @@ USHORT GraphicFilter::ImportGraphic( Gra
- if ( rGraphic.GetContext() == (GraphicReader*) 1 )
- rGraphic.SetContext( NULL );
-
-- vcl::PNGReader aPNGReader( rIStream );
-- const std::vector< vcl::PNGReader::ChunkData >& rChunkData = aPNGReader.GetChunks();
-- std::vector< vcl::PNGReader::ChunkData >::const_iterator aIter( rChunkData.begin() );
-- std::vector< vcl::PNGReader::ChunkData >::const_iterator aEnd ( rChunkData.end() );
-- while( aIter != aEnd )
-- {
-- // Microsoft Office is storing Animated GIFs in following chunk
-- if ( aIter->nType == PMGCHUNG_msOG )
-- {
-- sal_uInt32 nChunkSize = aIter->aData.size();
-- if ( nChunkSize > 11 )
-- {
-- const std::vector< sal_uInt8 >& rData = aIter->aData;
-- SvMemoryStream aIStrm( (void*)&rData[ 11 ], nChunkSize - 11, STREAM_READ );
-- ImportGIF( aIStrm, rGraphic, NULL );
-- eLinkType = GFX_LINK_TYPE_NATIVE_PNG;
-- break;
-- }
-- }
-- aIter++;
-- }
-+ vcl::PNGReader aPNGReader( rIStream );
-+
-+ // ignore animation for previews and set preview size
-+ if( nImportFlags & GRFILTER_I_FLAGS_FOR_PREVIEW )
-+ {
-+ Size aPreviewSize( 64, 64 );
-+ vcl::PNGReader::SetPreviewSizeHint( aPreviewSize );
-+
-+ // position the stream at the end of the image if requested
-+ if( 0 == (nImportFlags & GRFILTER_I_FLAGS_ALLOW_PARTIAL_STREAMREAD) )
-+ aPNGReader.GetChunks();
-+ }
-+ else
-+ {
-+ vcl::PNGReader::DisablePreviewMode();
-+
-+ // check if this PNG contains a GIF chunk!
-+ const std::vector< vcl::PNGReader::ChunkData >& rChunkData = aPNGReader.GetChunks();
-+ std::vector< vcl::PNGReader::ChunkData >::const_iterator aIter( rChunkData.begin() );
-+ std::vector< vcl::PNGReader::ChunkData >::const_iterator aEnd ( rChunkData.end() );
-+ while( aIter != aEnd )
-+ {
-+ // Microsoft Office is storing Animated GIFs in following chunk
-+ if ( aIter->nType == PMGCHUNG_msOG )
-+ {
-+ sal_uInt32 nChunkSize = aIter->aData.size();
-+ if ( nChunkSize > 11 )
-+ {
-+ const std::vector< sal_uInt8 >& rData = aIter->aData;
-+ SvMemoryStream aIStrm( (void*)&rData[ 11 ], nChunkSize - 11, STREAM_READ );
-+ ImportGIF( aIStrm, rGraphic, NULL );
-+ eLinkType = GFX_LINK_TYPE_NATIVE_PNG;
-+ break;
-+ }
-+ }
-+ aIter++;
-+ }
-+ }
-+
- if ( eLinkType == GFX_LINK_TYPE_NONE )
- {
- BitmapEx aBmpEx( aPNGReader.Read() );
-Index: svtools/source/filter.vcl/jpeg/jpeg.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/filter.vcl/jpeg/jpeg.cxx,v
-retrieving revision 1.14
-retrieving revision 1.14.14.2
-diff -u -p -r1.14 -r1.14.14.2
---- svtools/source/filter.vcl/jpeg/jpeg.cxx 8 Sep 2005 15:43:56 -0000 1.14
-+++ svtools/source/filter.vcl/jpeg/jpeg.cxx 14 Oct 2005 12:54:50 -0000 1.14.14.2
-@@ -316,7 +316,7 @@ extern "C" void jpeg_svstream_src (j_dec
- // - JPEGReader -
- // --------------
-
--JPEGReader::JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLS ) :
-+JPEGReader::JPEGReader( SvStream& rStm, void* /*pCallData*/, sal_Bool bSetLS ) :
- rIStm ( rStm ),
- pAcc ( NULL ),
- pAcc1 ( NULL ),
-@@ -538,13 +538,13 @@ ReadState JPEGReader::Read( Graphic& rGr
- BOOL bRet = FALSE;
- BYTE cDummy;
-
-- // sehen, ob wir _alles_ lesen koennen
-+#if 1 // TODO: is it possible to get rid of this seek to the end?
-+ // check if the stream's end is already available
- rIStm.Seek( STREAM_SEEK_TO_END );
- rIStm >> cDummy;
- nEndPos = rIStm.Tell();
-
-- // falls wir nicht alles lesen koennen, gucken wir,
-- // ob min. JPEGMINREAD Bytes gelesen werden koennen
-+ // else check if at least JPEGMINREAD bytes can be read
- if( rIStm.GetError() == ERRCODE_IO_PENDING )
- {
- rIStm.ResetError();
-@@ -555,10 +555,14 @@ ReadState JPEGReader::Read( Graphic& rGr
- }
- }
-
-- // an Anfang springen
-+ // seek back to the original position
- rIStm.Seek( nLastPos );
-+#endif
-+
-+ Size aPreviewSize = GetPreviewSize();
-+ SetJpegPreviewSizeHint( aPreviewSize.Width(), aPreviewSize.Height() );
-
-- // (Teil-) Bild einlesen
-+ // read the (partial) image
- ReadJPEG( this, &rIStm, &nLines );
-
- if( pAcc )
-@@ -730,6 +734,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic
-
- if( !pJPEGReader )
- pJPEGReader = new JPEGReader( rStm, pCallerData, ( nImportFlags & GRFILTER_I_FLAGS_SET_LOGSIZE_FOR_JPEG ) != 0 );
-+
-+ if( nImportFlags & GRFILTER_I_FLAGS_FOR_PREVIEW )
-+ pJPEGReader->SetPreviewSize( Size(128,128) );
-+ else
-+ pJPEGReader->DisablePreviewMode();
-
- rGraphic.SetContext( NULL );
- eReadState = pJPEGReader->Read( rGraphic );
-Index: svtools/source/filter.vcl/jpeg/jpeg.h
-===================================================================
-RCS file: /cvs/util/svtools/source/filter.vcl/jpeg/jpeg.h,v
-retrieving revision 1.2
-retrieving revision 1.2.16.1
-diff -u -p -r1.2 -r1.2.16.1
---- svtools/source/filter.vcl/jpeg/jpeg.h 8 Sep 2005 15:44:12 -0000 1.2
-+++ svtools/source/filter.vcl/jpeg/jpeg.h 13 Oct 2005 08:06:19 -0000 1.2.16.1
-@@ -79,5 +79,9 @@ void* GetScanline( void* pJPEGWriter, lo
-
- void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines );
- void* CreateBitmap( void* pJPEGReader, void* pJPEGCreateBitmapParam );
-+
-+/* TODO: when incompatible changes are possible again
-+ the preview size hint should be redone */
-+void SetJpegPreviewSizeHint( int nWidth, int nHeight );
-
- #endif
-Index: svtools/source/filter.vcl/jpeg/jpegc.c
-===================================================================
-RCS file: /cvs/util/svtools/source/filter.vcl/jpeg/jpegc.c,v
-retrieving revision 1.3
-retrieving revision 1.3.16.1
-diff -u -p -r1.3 -r1.3.16.1
---- svtools/source/filter.vcl/jpeg/jpegc.c 8 Sep 2005 15:44:28 -0000 1.3
-+++ svtools/source/filter.vcl/jpeg/jpegc.c 13 Oct 2005 08:06:19 -0000 1.3.16.1
-@@ -66,6 +66,16 @@ my_output_message (j_common_ptr cinfo)
- (*cinfo->err->format_message) (cinfo, buffer);
- }
-
-+/* TODO: when incompatible changes are possible again
-+ the preview size hint should be redone */
-+static int nPreviewWidth = 0;
-+static int nPreviewHeight = 0;
-+void SetJpegPreviewSizeHint( int nWidth, int nHeight )
-+{
-+ nPreviewWidth = nWidth;
-+ nPreviewHeight = nHeight;
-+}
-+
- void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines )
- {
- struct jpeg_decompress_struct cinfo;
-@@ -104,12 +114,32 @@ void ReadJPEG( void* pJPEGReader, void*
- if ( cinfo.jpeg_color_space != JCS_GRAYSCALE )
- cinfo.out_color_space = JCS_RGB;
-
-- jpeg_start_decompress( &cinfo);
-+ /* change scale for preview import */
-+ if( nPreviewWidth && nPreviewHeight )
-+ {
-+ for( cinfo.scale_denom = 1; cinfo.scale_denom < 8; cinfo.scale_denom *= 2 )
-+ {
-+ if( cinfo.image_width < nPreviewWidth * cinfo.scale_denom )
-+ break;
-+ if( cinfo.image_height < nPreviewHeight * cinfo.scale_denom )
-+ break;
-+ }
-+
-+ if( cinfo.scale_denom > 1 )
-+ {
-+ cinfo.dct_method = JDCT_FASTEST;
-+ cinfo.do_fancy_upsampling = FALSE;
-+ cinfo.do_block_smoothing = FALSE;
-+ }
-+ }
-
-- nWidth = cinfo.output_width;
-- nHeight = cinfo.output_height;
-+ jpeg_start_decompress( &cinfo );
-+
-+ nWidth = cinfo.output_width;
-+ nHeight = cinfo.output_height;
- aCreateBitmapParam.nWidth = nWidth;
- aCreateBitmapParam.nHeight = nHeight;
-+
- aCreateBitmapParam.density_unit = cinfo.density_unit;
- aCreateBitmapParam.X_density = cinfo.X_density;
- aCreateBitmapParam.Y_density = cinfo.Y_density;
diff --git a/patches/test/slidesorter-demo-pngperf.vcl.diff b/patches/test/slidesorter-demo-pngperf.vcl.diff
deleted file mode 100644
index 16756ae6f..000000000
--- a/patches/test/slidesorter-demo-pngperf.vcl.diff
+++ /dev/null
@@ -1,3192 +0,0 @@
-Index: vcl/inc/bitmap.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/bitmap.hxx,v
-retrieving revision 1.18
-retrieving revision 1.17.18.2
-diff -u -p -r1.18 -r1.17.18.2
---- vcl/inc/bitmap.hxx 2 Nov 2005 13:26:51 -0000 1.18
-+++ vcl/inc/bitmap.hxx 15 Nov 2005 09:46:35 -0000 1.17.18.2
-@@ -352,6 +352,15 @@ public:
- Size GetSizePixel() const;
- void SetSizePixel( const Size& rNewSize );
-
-+ /**
-+ * The pixel size of a bitmap's source (e.g. an image file)
-+ * and the pixel size of its resulting bitmap can differ,
-+ * e.g. when the image reader has its preview mode enabled.
-+ */
-+ Size GetSourceSizePixel() const;
-+ void SetSourceSizePixel( const Size& );
-+
-+
- USHORT GetBitCount() const;
- inline ULONG GetColorCount() const;
- inline ULONG GetSizeBytes() const;
-@@ -763,7 +772,6 @@ public:
- const Link* pProgress = NULL );
-
- public:
--
- BitmapReadAccess* AcquireReadAccess();
- BitmapWriteAccess* AcquireWriteAccess();
- void ReleaseAccess( BitmapReadAccess* pAccess );
-Index: vcl/inc/bmpacc.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/bmpacc.hxx,v
-retrieving revision 1.10
-retrieving revision 1.10.18.1
-diff -u -p -r1.10 -r1.10.18.1
---- vcl/inc/bmpacc.hxx 9 Sep 2005 10:48:15 -0000 1.10
-+++ vcl/inc/bmpacc.hxx 15 Nov 2005 12:24:22 -0000 1.10.18.1
-@@ -58,7 +58,7 @@
- // --------------------
-
- #define DECL_FORMAT_GETPIXEL( Format ) \
--static BitmapColor GetPixelFor##Format( Scanline pScanline, long nX, const ColorMask& rMask );
-+static BitmapColor GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask );
-
- #define DECL_FORMAT_SETPIXEL( Format ) \
- static void SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask );
-@@ -68,7 +68,7 @@ DECL_FORMAT_GETPIXEL( Format ) \
- DECL_FORMAT_SETPIXEL( Format )
-
- #define IMPL_FORMAT_GETPIXEL( Format ) \
--BitmapColor BitmapReadAccess::GetPixelFor##Format( Scanline pScanline, long nX, const ColorMask& rMask )
-+BitmapColor BitmapReadAccess::GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask )
-
- #define IMPL_FORMAT_SETPIXEL( Format ) \
- void BitmapReadAccess::SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask )
-@@ -87,7 +87,7 @@ break;
- // - Access functions -
- // --------------------
-
--typedef BitmapColor (*FncGetPixel)( Scanline pScanline, long nX, const ColorMask& rMask );
-+typedef BitmapColor (*FncGetPixel)( ConstScanline pScanline, long nX, const ColorMask& rMask );
- typedef void (*FncSetPixel)( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask );
-
- // --------------------
-@@ -198,7 +198,7 @@ public:
- virtual ~BitmapWriteAccess();
-
- void CopyScanline( long nY, const BitmapReadAccess& rReadAcc );
-- void CopyScanline( long nY, const Scanline aSrcScanline,
-+ void CopyScanline( long nY, ConstScanline aSrcScanline,
- ULONG nSrcScanlineFormat, ULONG nSrcScanlineSize );
-
- void CopyBuffer( const BitmapReadAccess& rReadAcc );
-Index: vcl/inc/bmpfast.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/bmpfast.hxx,v
-retrieving revision 1.3
-retrieving revision 1.3.18.1
-diff -u -p -r1.3 -r1.3.18.1
---- vcl/inc/bmpfast.hxx 9 Sep 2005 10:48:29 -0000 1.3
-+++ vcl/inc/bmpfast.hxx 27 Sep 2005 10:14:21 -0000 1.3.18.1
-@@ -35,19 +35,25 @@
-
- #ifndef _SV_BMPFAST_HXX
- #define _SV_BMPFAST_HXX
--
-+
- class BitmapWriteAccess;
- class BitmapReadAccess;
- class BitmapBuffer;
-+class BitmapColor;
- class Size;
- class Point;
- struct SalTwoRect;
--
-+
-+// the bmpfast functions have signatures with good compatibility to
-+// their canonic counterparts, which employ the GetPixel/SetPixel methods
-+
- bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
- const SalTwoRect& rTwoRect );
-
- bool ImplFastBitmapBlending( BitmapWriteAccess& rDst,
- const BitmapReadAccess& rSrc, const BitmapReadAccess& rMask,
- const SalTwoRect& rTwoRect );
-+
-+bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& );
-
- #endif // _SV_BMPFAST_HXX
-Index: vcl/inc/graph.h
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/graph.h,v
-retrieving revision 1.3
-retrieving revision 1.3.18.2
-diff -u -p -r1.3 -r1.3.18.2
---- vcl/inc/graph.h 9 Sep 2005 10:59:00 -0000 1.3
-+++ vcl/inc/graph.h 26 Oct 2005 11:45:28 -0000 1.3.18.2
-@@ -85,6 +85,13 @@ public:
- const String& GetUpperFilterName() const { return maUpperName; }
- ReaderData* GetReaderData() const { return mpReaderData; }
- BOOL IsReading() const { return mbIsReading; }
-+
-+ // TODO: when incompatible changes are possible again
-+ // the preview size hint should be redone
-+ BOOL IsPreviewModeEnabled() const;
-+ void DisablePreviewMode();
-+ void SetPreviewSize( const Size& );
-+ Size GetPreviewSize() const;
- };
-
- #endif // _SV_GRAPH_H
-Index: vcl/inc/impbmp.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/impbmp.hxx,v
-retrieving revision 1.4
-retrieving revision 1.4.18.1
-diff -u -p -r1.4 -r1.4.18.1
---- vcl/inc/impbmp.hxx 9 Sep 2005 11:02:46 -0000 1.4
-+++ vcl/inc/impbmp.hxx 26 Oct 2005 11:43:45 -0000 1.4.18.1
-@@ -67,7 +67,8 @@ private:
- ULONG mnChecksum;
- RMBitmap* mpRMBitmap;
- SalBitmap* mpSalBitmap;
--
-+ Size maSourceSize;
-+
- public:
-
- ImpBitmap();
-@@ -90,13 +91,15 @@ public:
- void ImplDestroy();
-
- Size ImplGetSize() const;
-+ Size ImplGetSourceSize() const;
-+ void ImplSetSourceSize( const Size&);
- USHORT ImplGetBitCount() const;
-
- BitmapBuffer* ImplAcquireBuffer( BOOL bReadOnly );
- void ImplReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly );
-
- public:
--
-+
- ULONG ImplGetRefCount() const { return mnRefCount; }
- void ImplIncRefCount() { mnRefCount++; }
- void ImplDecRefCount() { mnRefCount--; }
-@@ -106,5 +109,15 @@ public:
-
- #endif // PRIVATE
- };
-+
-+inline Size ImpBitmap::ImplGetSourceSize() const
-+{
-+ return maSourceSize;
-+}
-+
-+inline void ImpBitmap::ImplSetSourceSize( const Size& rSize)
-+{
-+ maSourceSize = rSize;
-+}
-
- #endif // _SV_IMPBMP_HXX
-Index: vcl/inc/pngread.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/pngread.hxx,v
-retrieving revision 1.5
-retrieving revision 1.5.18.2
-diff -u -p -r1.5 -r1.5.18.2
---- vcl/inc/pngread.hxx 9 Sep 2005 11:14:10 -0000 1.5
-+++ vcl/inc/pngread.hxx 13 Oct 2005 10:18:52 -0000 1.5.18.2
-@@ -73,6 +73,13 @@ namespace vcl
- std::vector< sal_uInt8 > aData;
- };
- const std::vector< ChunkData >& GetChunks() const;
-+
-+ // TODO: when incompatible changes are possible again
-+ // the preview size hint should be redone
-+ static void SetPreviewSizeHint( const Size& r ) { aPreviewSizeHint = r; }
-+ static void DisablePreviewMode() { aPreviewSizeHint = Size(0,0); }
-+ private:
-+ static Size aPreviewSizeHint;
- };
- }
-
-Index: vcl/inc/salbtype.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/salbtype.hxx,v
-retrieving revision 1.10
-retrieving revision 1.10.18.1
-diff -u -p -r1.10 -r1.10.18.1
---- vcl/inc/salbtype.hxx 9 Sep 2005 11:18:10 -0000 1.10
-+++ vcl/inc/salbtype.hxx 15 Nov 2005 12:24:22 -0000 1.10.18.1
-@@ -64,6 +64,8 @@
-
- typedef BYTE* HPBYTE;
- typedef HPBYTE Scanline;
-+typedef const BYTE* ConstHPBYTE;
-+typedef ConstHPBYTE ConstScanline;
-
- // --------------------
- // - Helper functions -
-@@ -264,18 +266,18 @@ public:
- inline ULONG GetGreenMask() const;
- inline ULONG GetBlueMask() const;
-
-- inline void GetColorFor8Bit( BitmapColor& rColor, HPBYTE pPixel ) const;
-+ inline void GetColorFor8Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
- inline void SetColorFor8Bit( const BitmapColor& rColor, HPBYTE pPixel ) const;
-
-- inline void GetColorFor16BitMSB( BitmapColor& rColor, HPBYTE pPixel ) const;
-+ inline void GetColorFor16BitMSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
- inline void SetColorFor16BitMSB( const BitmapColor& rColor, HPBYTE pPixel ) const;
-- inline void GetColorFor16BitLSB( BitmapColor& rColor, HPBYTE pPixel ) const;
-+ inline void GetColorFor16BitLSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
- inline void SetColorFor16BitLSB( const BitmapColor& rColor, HPBYTE pPixel ) const;
-
-- inline void GetColorFor24Bit( BitmapColor& rColor, HPBYTE pPixel ) const;
-+ inline void GetColorFor24Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
- inline void SetColorFor24Bit( const BitmapColor& rColor, HPBYTE pPixel ) const;
-
-- inline void GetColorFor32Bit( BitmapColor& rColor, HPBYTE pPixel ) const;
-+ inline void GetColorFor32Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const;
- inline void SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const;
- };
-
-@@ -818,7 +820,7 @@ inline ULONG ColorMask::GetBlueMask() co
-
- // ------------------------------------------------------------------
-
--inline void ColorMask::GetColorFor8Bit( BitmapColor& rColor, HPBYTE pPixel ) const
-+inline void ColorMask::GetColorFor8Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const
- {
- const UINT32 nVal = *pPixel;
- MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor );
-@@ -833,7 +835,7 @@ inline void ColorMask::SetColorFor8Bit(
-
- // ------------------------------------------------------------------
-
--inline void ColorMask::GetColorFor16BitMSB( BitmapColor& rColor, HPBYTE pPixel ) const
-+inline void ColorMask::GetColorFor16BitMSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const
- {
- #ifdef OSL_BIGENDIAN
- const UINT32 nVal = *(UINT16*) pPixel;
-@@ -853,7 +855,7 @@ inline void ColorMask::SetColorFor16BitM
-
- // ------------------------------------------------------------------
-
--inline void ColorMask::GetColorFor16BitLSB( BitmapColor& rColor, HPBYTE pPixel ) const
-+inline void ColorMask::GetColorFor16BitLSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const
- {
- #ifdef OSL_BIGENDIAN
- const UINT32 nVal = pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL );
-@@ -879,7 +881,7 @@ inline void ColorMask::SetColorFor16BitL
-
- // ------------------------------------------------------------------
-
--inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, HPBYTE pPixel ) const
-+inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const
- {
- const UINT32 nVal = pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL ) | ( (UINT32) pPixel[ 2 ] << 16UL );
- MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor );
-@@ -895,7 +897,7 @@ inline void ColorMask::SetColorFor24Bit(
-
- // ------------------------------------------------------------------
-
--inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, HPBYTE pPixel ) const
-+inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const
- {
- #ifdef OSL_BIGENDIAN
- const UINT32 nVal = (UINT32) pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL ) |
-Index: vcl/source/gdi/bitmap.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/bitmap.cxx,v
-retrieving revision 1.13
-retrieving revision 1.13.18.1
-diff -u -p -r1.13 -r1.13.18.1
---- vcl/source/gdi/bitmap.cxx 9 Sep 2005 11:52:27 -0000 1.13
-+++ vcl/source/gdi/bitmap.cxx 26 Oct 2005 11:45:57 -0000 1.13.18.1
-@@ -290,12 +290,26 @@ Size Bitmap::GetSizePixel() const
- {
- return( mpImpBmp ? mpImpBmp->ImplGetSize() : Size() );
- }
--
- // ------------------------------------------------------------------
-
- void Bitmap::SetSizePixel( const Size& rNewSize )
- {
- Scale( rNewSize );
-+}
-+
-+// ------------------------------------------------------------------
-+
-+Size Bitmap::GetSourceSizePixel() const
-+{
-+ return( mpImpBmp ? mpImpBmp->ImplGetSourceSize() : Size() );
-+}
-+
-+// ------------------------------------------------------------------
-+
-+void Bitmap::SetSourceSizePixel( const Size& rSize)
-+{
-+ if( mpImpBmp )
-+ mpImpBmp->ImplSetSourceSize( rSize);
- }
-
- // ------------------------------------------------------------------
-Index: vcl/source/gdi/bmpacc.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/bmpacc.cxx,v
-retrieving revision 1.7
-retrieving revision 1.7.18.1
-diff -u -p -r1.7 -r1.7.18.1
---- vcl/source/gdi/bmpacc.cxx 9 Sep 2005 11:54:05 -0000 1.7
-+++ vcl/source/gdi/bmpacc.cxx 15 Nov 2005 12:24:23 -0000 1.7.18.1
-@@ -336,7 +336,7 @@ void BitmapWriteAccess::CopyScanline( lo
-
- // ------------------------------------------------------------------
-
--void BitmapWriteAccess::CopyScanline( long nY, const Scanline aSrcScanline,
-+void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline,
- ULONG nSrcScanlineFormat, ULONG nSrcScanlineSize )
- {
- const ULONG nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat );
-Index: vcl/source/gdi/bmpacc3.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/bmpacc3.cxx,v
-retrieving revision 1.6
-retrieving revision 1.6.18.1
-diff -u -p -r1.6 -r1.6.18.1
---- vcl/source/gdi/bmpacc3.cxx 9 Sep 2005 11:54:48 -0000 1.6
-+++ vcl/source/gdi/bmpacc3.cxx 27 Sep 2005 10:13:57 -0000 1.6.18.1
-@@ -48,6 +48,9 @@
- #ifndef _SV_BMPACC_HXX
- #include <bmpacc.hxx>
- #endif
-+#ifndef _SV_BMPFAST_HXX
-+#include <bmpfast.hxx>
-+#endif
-
- // ---------------------
- // - BitmapWriteAccess -
-@@ -123,6 +126,11 @@ Color BitmapWriteAccess::GetFillColor()
-
- void BitmapWriteAccess::Erase( const Color& rColor )
- {
-+ // try fast bitmap method first
-+ if( ImplFastEraseBitmap( *mpBuffer, rColor ) )
-+ return;
-+
-+ // use the canonical method to clear the bitmap
- BitmapColor* pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL;
- const Point aPoint;
- const Rectangle aRect( aPoint, maBitmap.GetSizePixel() );
-Index: vcl/source/gdi/bmpfast.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/bmpfast.cxx,v
-retrieving revision 1.4
-retrieving revision 1.3.18.2
-diff -u -p -r1.4 -r1.3.18.2
---- vcl/source/gdi/bmpfast.cxx 28 Sep 2005 14:43:04 -0000 1.4
-+++ vcl/source/gdi/bmpfast.cxx 15 Nov 2005 09:58:59 -0000 1.3.18.2
-@@ -41,7 +41,7 @@
- #define _SOLAR__PRIVATE 1
- #include <bmpacc.hxx>
-
--//#define FAST_ARGB_BGRA
-+#define FAST_ARGB_BGRA
-
- #include <stdlib.h>
- static bool bDisableFastBitops = (getenv( "SAL_DISABLE_BITMAPS_OPTS" ) != NULL);
-@@ -56,7 +56,7 @@ public:
- PIXBYTE* GetRawPtr( void ) const { return mpPixel; }
- void AddByteOffset( int nByteOffset ) { mpPixel += nByteOffset; }
- bool operator<( const BasePixelPtr& rCmp ) const { return (mpPixel < rCmp.mpPixel); }
--
-+
- protected:
- PIXBYTE* mpPixel;
- };
-@@ -69,7 +69,7 @@ public:
- PIXBYTE GetGreen() const;
- PIXBYTE GetBlue() const;
- PIXBYTE GetAlpha() const;
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const;
- void SetAlpha( PIXBYTE a ) const;
- void operator++(int);
-@@ -83,13 +83,13 @@ class TrueColorPixelPtr<BMP_FORMAT_24BIT
- {
- public:
- void operator++() { mpPixel += 3; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[0]; }
- PIXBYTE GetGreen() const { return mpPixel[1]; }
- PIXBYTE GetBlue() const { return mpPixel[2]; }
- PIXBYTE GetAlpha() const { return 0; }
- void SetAlpha( PIXBYTE ) const {}
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = r;
-@@ -103,13 +103,13 @@ class TrueColorPixelPtr<BMP_FORMAT_24BIT
- {
- public:
- void operator++() { mpPixel += 3; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[2]; }
- PIXBYTE GetGreen() const { return mpPixel[1]; }
- PIXBYTE GetBlue() const { return mpPixel[0]; }
- PIXBYTE GetAlpha() const { return 0; }
- void SetAlpha( PIXBYTE ) const {}
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = b;
-@@ -123,13 +123,13 @@ class TrueColorPixelPtr<BMP_FORMAT_32BIT
- {
- public:
- void operator++() { mpPixel += 4; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[1]; }
- PIXBYTE GetGreen() const { return mpPixel[2]; }
- PIXBYTE GetBlue() const { return mpPixel[3]; }
- PIXBYTE GetAlpha() const { return mpPixel[0]; }
- void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; }
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[1] = r;
-@@ -143,13 +143,13 @@ class TrueColorPixelPtr<BMP_FORMAT_32BIT
- {
- public:
- void operator++() { mpPixel += 4; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[3]; }
- PIXBYTE GetGreen() const { return mpPixel[2]; }
- PIXBYTE GetBlue() const { return mpPixel[1]; }
- PIXBYTE GetAlpha() const { return mpPixel[0]; }
- void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; }
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[1] = b;
-@@ -163,13 +163,13 @@ class TrueColorPixelPtr<BMP_FORMAT_32BIT
- {
- public:
- void operator++() { mpPixel += 4; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[0]; }
- PIXBYTE GetGreen() const { return mpPixel[1]; }
- PIXBYTE GetBlue() const { return mpPixel[2]; }
- PIXBYTE GetAlpha() const { return mpPixel[3]; }
- void SetAlpha( PIXBYTE a ) const{ mpPixel[3] = a; }
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = r;
-@@ -183,13 +183,13 @@ class TrueColorPixelPtr<BMP_FORMAT_32BIT
- {
- public:
- void operator++() { mpPixel += 4; }
--
-+
- PIXBYTE GetRed() const { return mpPixel[2]; }
- PIXBYTE GetGreen() const { return mpPixel[1]; }
- PIXBYTE GetBlue() const { return mpPixel[0]; }
- PIXBYTE GetAlpha() const { return mpPixel[3]; }
- void SetAlpha( PIXBYTE a ) const{ mpPixel[3] = a; }
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = b;
-@@ -203,14 +203,14 @@ class TrueColorPixelPtr<BMP_FORMAT_16BIT
- {
- public:
- void operator++() { mpPixel += 2; }
--
-+
- // TODO: non565-RGB
- PIXBYTE GetRed() const { return (mpPixel[0] & 0xF8U); }
- PIXBYTE GetGreen() const { return (mpPixel[0]<<5U) | ((mpPixel[1]>>3U)&28U); }
- PIXBYTE GetBlue() const { return (mpPixel[1]<<3U); }
- PIXBYTE GetAlpha() const { return 0; }
- void SetAlpha( PIXBYTE ) const {}
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = ((g >> 5U) & 7U) | (r & 0xF8U);
-@@ -223,14 +223,14 @@ class TrueColorPixelPtr<BMP_FORMAT_16BIT
- {
- public:
- void operator++() { mpPixel += 2; }
--
-+
- // TODO: non565-RGB
- PIXBYTE GetRed() const { return (mpPixel[1] & 0xF8U); }
- PIXBYTE GetGreen() const { return (mpPixel[1]<<5U) | ((mpPixel[0]>>3U)&28U); }
- PIXBYTE GetBlue() const { return (mpPixel[0]<<3U); }
- PIXBYTE GetAlpha() const { return 0; }
- void SetAlpha( PIXBYTE ) const {}
--
-+
- void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
- {
- mpPixel[0] = ((g & 28U)<< 3U) | (b >> 3U);
-@@ -285,7 +285,7 @@ class TrueColorPixelPtr<BMP_FORMAT_32BIT
- {
- public:
- void operator++() { mpPixel += 4; }
--
-+
- unsigned GetAlpha() const
- {
- #ifdef OSL_BIGENDIAN
-@@ -298,7 +298,7 @@ public:
- #endif
- return nAlpha;
- }
--
-+
- void SetAlpha( unsigned nAlpha ) const
- {
- #ifdef OSL_BIGENDIAN
-@@ -433,7 +433,7 @@ static bool ImplCopyImage( BitmapBuffer&
- {
- const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
- int nDstLinestep = rDstBuffer.mnScanlineSize;
--
-+
- const PIXBYTE* pRawSrc = rSrcBuffer.mpBits;
- PIXBYTE* pRawDst = rDstBuffer.mpBits;
-
-@@ -448,18 +448,18 @@ static bool ImplCopyImage( BitmapBuffer&
- memcpy( pRawDst, pRawSrc, rSrcBuffer.mnHeight * nDstLinestep );
- return true;
- }
--
-+
- int nByteWidth = nSrcLinestep;
- if( nByteWidth > rDstBuffer.mnScanlineSize )
- nByteWidth = rDstBuffer.mnScanlineSize;
--
-+
- for( int y = rSrcBuffer.mnHeight; --y >= 0; )
- {
- memcpy( pRawDst, pRawSrc, nByteWidth );
- pRawSrc += nSrcLinestep;
- pRawDst += nDstLinestep;
- }
--
-+
- return true;
- }
-
-@@ -473,26 +473,26 @@ static bool ImplConvertToBitmap( TrueCol
- DBG_ASSERT( SRCFMT != DSTFMT, "ImplConvertToBitmap into same format");
- if( SRCFMT == DSTFMT )
- return false;
--
-+
- const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
- int nDstLinestep = rDstBuffer.mnScanlineSize;
--
-+
- TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits );
--
-+
- // source and destination don't match upside down
- if( BMP_FORMAT_TOP_DOWN & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) )
- {
- aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
- nDstLinestep = -nDstLinestep;
- }
--
-+
- for( int y = rSrcBuffer.mnHeight; --y >= 0; )
- {
- ImplConvertLine( aDstLine, rSrcLine, rSrcBuffer.mnWidth );
- rSrcLine.AddByteOffset( nSrcLinestep );
- aDstLine.AddByteOffset( nDstLinestep );
- }
--
-+
- return true;
- }
-
-@@ -502,7 +502,7 @@ template <ULONG SRCFMT>
- inline bool ImplConvertFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc )
- {
- TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
--
-+
- // select the matching instantiation for the destination's bitmap format
- switch( rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN )
- {
-@@ -512,7 +512,7 @@ inline bool ImplConvertFromBitmap( Bitma
- case BMP_FORMAT_4BIT_LSN_PAL:
- case BMP_FORMAT_8BIT_PAL:
- break;
--
-+
- case BMP_FORMAT_8BIT_TC_MASK:
- // return ImplConvertToBitmap<BMP_FORMAT_8BIT_TC_MASK>( aSrcType, rDst, rSrc );
- case BMP_FORMAT_24BIT_TC_MASK:
-@@ -520,12 +520,12 @@ inline bool ImplConvertFromBitmap( Bitma
- case BMP_FORMAT_32BIT_TC_MASK:
- // return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_MASK>( aSrcType, rDst, rSrc );
- break;
--
-+
- case BMP_FORMAT_16BIT_TC_MSB_MASK:
- return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( aSrcType, rDst, rSrc );
- case BMP_FORMAT_16BIT_TC_LSB_MASK:
- return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( aSrcType, rDst, rSrc );
--
-+
- case BMP_FORMAT_24BIT_TC_BGR:
- return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_BGR>( aSrcType, rDst, rSrc );
- case BMP_FORMAT_24BIT_TC_RGB:
-@@ -538,7 +538,7 @@ inline bool ImplConvertFromBitmap( Bitma
- return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_ARGB>( aSrcType, rDst, rSrc );
- case BMP_FORMAT_32BIT_TC_BGRA:
- return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_BGRA>( aSrcType, rDst, rSrc );
--#endif
-+#endif
- case BMP_FORMAT_32BIT_TC_RGBA:
- return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_RGBA>( aSrcType, rDst, rSrc );
- }
-@@ -553,7 +553,7 @@ inline bool ImplConvertFromBitmap( Bitma
-
- return false;
- }
--
-+
- // =======================================================================
-
- // an universal stretching conversion is overkill in most common situations
-@@ -571,19 +571,19 @@ bool ImplFastBitmapConversion( BitmapBuf
- if( rTR.mnDestHeight < 0 )
- // TODO: rDst.mnFormat ^= BMP_FORMAT_TOP_DOWN;
- return false;
--
-+
- // offseted conversion is not implemented yet
- if( rTR.mnSrcX || rTR.mnSrcY )
- return false;
- if( rTR.mnDestX || rTR.mnDestY )
- return false;
--
-+
- // stretched conversion is not implemented yet
- if( rTR.mnDestWidth != rTR.mnSrcWidth )
- return false;
- if( rTR.mnDestHeight!= rTR.mnSrcHeight )
- return false;
--
-+
- // check source image size
- if( rSrc.mnWidth < rTR.mnSrcX + rTR.mnSrcWidth )
- return false;
-@@ -610,7 +610,7 @@ bool ImplFastBitmapConversion( BitmapBuf
- || rDst.maColorMask.GetGreenMask()!= 0x07E0
- || rDst.maColorMask.GetBlueMask() != 0x001F )
- return false;
--
-+
- // special handling of trivial cases
- if( nSrcFormat == nDstFormat )
- {
-@@ -618,8 +618,8 @@ bool ImplFastBitmapConversion( BitmapBuf
- if( rSrc.maPalette != rDst.maPalette )
- return false;
- return ImplCopyImage( rDst, rSrc );
-- }
--
-+ }
-+
- // select the matching instantiation for the source's bitmap format
- switch( nSrcFormat )
- {
-@@ -629,7 +629,7 @@ bool ImplFastBitmapConversion( BitmapBuf
- case BMP_FORMAT_4BIT_LSN_PAL:
- case BMP_FORMAT_8BIT_PAL:
- break;
--
-+
- case BMP_FORMAT_8BIT_TC_MASK:
- // return ImplConvertFromBitmap<BMP_FORMAT_8BIT_TC_MASK>( rDst, rSrc );
- case BMP_FORMAT_24BIT_TC_MASK:
-@@ -637,17 +637,17 @@ bool ImplFastBitmapConversion( BitmapBuf
- case BMP_FORMAT_32BIT_TC_MASK:
- // return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_MASK>( rDst, rSrc );
- break;
--
-+
- case BMP_FORMAT_16BIT_TC_MSB_MASK:
- return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( rDst, rSrc );
- case BMP_FORMAT_16BIT_TC_LSB_MASK:
- return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( rDst, rSrc );
--
-+
- case BMP_FORMAT_24BIT_TC_BGR:
- return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_BGR>( rDst, rSrc );
- case BMP_FORMAT_24BIT_TC_RGB:
- return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_RGB>( rDst, rSrc );
--
-+
- case BMP_FORMAT_32BIT_TC_ABGR:
- return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_ABGR>( rDst, rSrc );
- #ifdef FAST_ARGB_BGRA
-@@ -684,14 +684,14 @@ static bool ImplBlendToBitmap( TrueColor
- const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
- int nMskLinestep = rMskBuffer.mnScanlineSize;
- int nDstLinestep = rDstBuffer.mnScanlineSize;
--
-+
- TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> aMskLine; aMskLine.SetRawPtr( rMskBuffer.mpBits );
- TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits );
--
-+
- // special case for single line masks
- if( rMskBuffer.mnHeight == 1 )
- nMskLinestep = 0;
--
-+
- // source and mask don't match: upside down
- if( (rSrcBuffer.mnFormat ^ rMskBuffer.mnFormat) & BMP_FORMAT_TOP_DOWN )
- {
-@@ -705,7 +705,7 @@ static bool ImplBlendToBitmap( TrueColor
- aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
- nDstLinestep = -nDstLinestep;
- }
--
-+
- for( int y = rSrcBuffer.mnHeight; --y >= 0; )
- {
- ImplBlendLines<8>( aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth );
-@@ -713,7 +713,7 @@ static bool ImplBlendToBitmap( TrueColor
- rSrcLine.AddByteOffset( nSrcLinestep );
- aMskLine.AddByteOffset( nMskLinestep );
- }
--
-+
- return true;
- }
-
-@@ -754,7 +754,7 @@ template <ULONG SRCFMT>
- static bool ImplBlendFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc, const BitmapBuffer& rMsk )
- {
- TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
--
-+
- // select the matching instantiation for the destination's bitmap format
- switch( rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN )
- {
-@@ -764,7 +764,7 @@ static bool ImplBlendFromBitmap( BitmapB
- case BMP_FORMAT_4BIT_LSN_PAL:
- case BMP_FORMAT_8BIT_PAL:
- break;
--
-+
- case BMP_FORMAT_8BIT_TC_MASK:
- // return ImplBlendToBitmap<BMP_FORMAT_8BIT_TC_MASK>( aSrcType, rDst, rSrc, rMsk );
- case BMP_FORMAT_24BIT_TC_MASK:
-@@ -772,12 +772,12 @@ static bool ImplBlendFromBitmap( BitmapB
- case BMP_FORMAT_32BIT_TC_MASK:
- // return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_MASK>( aSrcType, rDst, rSrc, rMsk );
- break;
--
-+
- case BMP_FORMAT_16BIT_TC_MSB_MASK:
- return ImplBlendToBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( aSrcType, rDst, rSrc, rMsk );
- case BMP_FORMAT_16BIT_TC_LSB_MASK:
- return ImplBlendToBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( aSrcType, rDst, rSrc, rMsk );
--
-+
- case BMP_FORMAT_24BIT_TC_BGR:
- return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_BGR>( aSrcType, rDst, rSrc, rMsk );
- case BMP_FORMAT_24BIT_TC_RGB:
-@@ -829,19 +829,19 @@ bool ImplFastBitmapBlending( BitmapWrite
- if( rTR.mnDestHeight < 0 )
- // TODO: rDst.mnFormat ^= BMP_FORMAT_TOP_DOWN;
- return false;
--
-+
- // offseted blending is not implemented yet
- if( rTR.mnSrcX || rTR.mnSrcY )
- return false;
- if( rTR.mnDestX || rTR.mnDestY )
- return false;
--
-+
- // stretched blending is not implemented yet
- if( rTR.mnDestWidth != rTR.mnSrcWidth )
- return false;
- if( rTR.mnDestHeight!= rTR.mnSrcHeight )
- return false;
--
-+
- // check source image size
- if( rSrcRA.Width() < rTR.mnSrcX + rTR.mnSrcWidth )
- return false;
-@@ -860,14 +860,14 @@ bool ImplFastBitmapBlending( BitmapWrite
- return false;
- if( rDstWA.Height() < rTR.mnDestY + rTR.mnDestHeight )
- return false;
--
-+
- BitmapBuffer& rDst = *rDstWA.ImplGetBitmapBuffer();
- const BitmapBuffer& rSrc = *rSrcRA.ImplGetBitmapBuffer();
- const BitmapBuffer& rMsk = *rMskRA.ImplGetBitmapBuffer();
-
- const ULONG nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN;
- const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN;
--
-+
- // accelerated conversions for 16bit colormasks with non-565 format are not yet implemented
- if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) )
- if( rSrc.maColorMask.GetRedMask() != 0xF800
-@@ -879,7 +879,7 @@ bool ImplFastBitmapBlending( BitmapWrite
- || rDst.maColorMask.GetGreenMask()!= 0x07E0
- || rDst.maColorMask.GetBlueMask() != 0x001F)
- return false;
--
-+
- // select the matching instantiation for the source's bitmap format
- switch( nSrcFormat )
- {
-@@ -889,7 +889,7 @@ bool ImplFastBitmapBlending( BitmapWrite
- case BMP_FORMAT_4BIT_LSN_PAL:
- case BMP_FORMAT_8BIT_PAL:
- break;
--
-+
- case BMP_FORMAT_8BIT_TC_MASK:
- // return ImplBlendFromBitmap<BMP_FORMAT_8BIT_TC_MASK>( rDst, rSrc );
- case BMP_FORMAT_24BIT_TC_MASK:
-@@ -897,17 +897,17 @@ bool ImplFastBitmapBlending( BitmapWrite
- case BMP_FORMAT_32BIT_TC_MASK:
- // return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_MASK>( rDst, rSrc );
- break;
--
-+
- case BMP_FORMAT_16BIT_TC_MSB_MASK:
- return ImplBlendFromBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( rDst, rSrc, rMsk );
- case BMP_FORMAT_16BIT_TC_LSB_MASK:
- return ImplBlendFromBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( rDst, rSrc, rMsk );
--
-+
- case BMP_FORMAT_24BIT_TC_BGR:
- return ImplBlendFromBitmap<BMP_FORMAT_24BIT_TC_BGR>( rDst, rSrc, rMsk );
- case BMP_FORMAT_24BIT_TC_RGB:
- return ImplBlendFromBitmap<BMP_FORMAT_24BIT_TC_RGB>( rDst, rSrc, rMsk );
--
-+
- case BMP_FORMAT_32BIT_TC_ABGR:
- return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_ABGR>( rDst, rSrc, rMsk );
- #ifdef FAST_ARGB_BGRA
-@@ -931,6 +931,80 @@ bool ImplFastBitmapBlending( BitmapWrite
- return false;
- }
-
-+bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor )
-+{
-+ if( bDisableFastBitops )
-+ return false;
-+
-+ const ULONG nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN;
-+
-+ // erasing a bitmap is often just a byte-wise memory fill
-+ bool bByteFill = true;
-+ BYTE nIndex = rColor.GetIndex();
-+ BYTE nFillByte;
-+
-+ switch( nDstFormat )
-+ {
-+ case BMP_FORMAT_1BIT_MSB_PAL:
-+ case BMP_FORMAT_1BIT_LSB_PAL:
-+ nFillByte = -(nIndex & 1);
-+ break;
-+ case BMP_FORMAT_4BIT_MSN_PAL:
-+ case BMP_FORMAT_4BIT_LSN_PAL:
-+ nFillByte = (nIndex & 0x0F);
-+ nFillByte |= (nFillByte << 4);
-+ break;
-+ case BMP_FORMAT_8BIT_PAL:
-+ case BMP_FORMAT_8BIT_TC_MASK:
-+ nFillByte = nIndex;
-+ break;
-+
-+ case BMP_FORMAT_24BIT_TC_MASK:
-+ case BMP_FORMAT_24BIT_TC_BGR:
-+ case BMP_FORMAT_24BIT_TC_RGB:
-+ nFillByte = rColor.GetRed();
-+ if( (nFillByte != rColor.GetGreen())
-+ || (nFillByte != rColor.GetBlue()) )
-+ bByteFill = false;
-+ break;
-+
-+ default:
-+ bByteFill = false;
-+ break;
-+ }
-+
-+ if( bByteFill )
-+ {
-+ long nByteCount = rDst.mnHeight * rDst.mnScanlineSize;
-+ rtl_fillMemory( rDst.mpBits, nByteCount, nFillByte );
-+ return true;
-+ }
-+
-+ // handle other bitmap formats
-+ switch( nDstFormat )
-+ {
-+ case BMP_FORMAT_32BIT_TC_MASK:
-+ case BMP_FORMAT_16BIT_TC_MSB_MASK:
-+ case BMP_FORMAT_16BIT_TC_LSB_MASK:
-+
-+ case BMP_FORMAT_24BIT_TC_BGR:
-+ case BMP_FORMAT_24BIT_TC_RGB:
-+
-+ case BMP_FORMAT_32BIT_TC_ABGR:
-+#ifdef FAST_ARGB_BGRA
-+ case BMP_FORMAT_32BIT_TC_ARGB:
-+ case BMP_FORMAT_32BIT_TC_BGRA:
-+#endif
-+ case BMP_FORMAT_32BIT_TC_RGBA:
-+ break;
-+
-+ default:
-+ break;
-+ }
-+
-+ return false;
-+}
-+
- // =======================================================================
-
- #else // NO_OPTIMIZED_BITMAP_ACCESS
-@@ -943,6 +1017,11 @@ bool ImplFastBitmapConversion( BitmapBuf
- bool ImplFastBitmapBlending( BitmapWriteAccess&,
- const BitmapReadAccess&, const BitmapReadAccess&,
- const Size&, const Point& )
-+{
-+ return false;
-+}
-+
-+bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& )
- {
- return false;
- }
-Index: vcl/source/gdi/impbmp.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/impbmp.cxx,v
-retrieving revision 1.6
-retrieving revision 1.6.18.1
-diff -u -p -r1.6 -r1.6.18.1
---- vcl/source/gdi/impbmp.cxx 9 Sep 2005 12:00:57 -0000 1.6
-+++ vcl/source/gdi/impbmp.cxx 26 Oct 2005 11:47:22 -0000 1.6.18.1
-@@ -55,7 +55,8 @@ ImpBitmap::ImpBitmap() :
- mnRefCount ( 1UL ),
- mnChecksum ( 0UL ),
- mpRMBitmap ( NULL ),
-- mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() )
-+ mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() ),
-+ maSourceSize( 0, 0 )
- {
- }
-
-@@ -76,6 +77,7 @@ void ImpBitmap::ImplSetSalBitmap( SalBit
-
- BOOL ImpBitmap::ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
- {
-+ maSourceSize = rSize;
- return mpSalBitmap->Create( rSize, nBitCount, rPal );
- }
-
-@@ -83,6 +85,7 @@ BOOL ImpBitmap::ImplCreate( const Size&
-
- BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
- {
-+ maSourceSize = rImpBitmap.maSourceSize;
- mnChecksum = rImpBitmap.mnChecksum;
- return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
- }
-Index: vcl/source/gdi/impgraph.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/impgraph.cxx,v
-retrieving revision 1.21
-retrieving revision 1.20.18.2
-diff -u -p -r1.21 -r1.20.18.2
---- vcl/source/gdi/impgraph.cxx 19 Oct 2005 12:38:43 -0000 1.21
-+++ vcl/source/gdi/impgraph.cxx 15 Nov 2005 09:59:07 -0000 1.20.18.2
-@@ -117,8 +118,54 @@ struct ImpSwapFile
- // - Graphicreader -
- // -----------------
-
-+struct ReaderData
-+{
-+ Size maPreviewSize;
-+};
-+
- GraphicReader::~GraphicReader()
- {
-+ delete mpReaderData;
-+}
-+
-+// ------------------------------------------------------------------------
-+
-+BOOL GraphicReader::IsPreviewModeEnabled() const
-+{
-+ if( !mpReaderData )
-+ return FALSE;
-+ if( mpReaderData->maPreviewSize.Width() )
-+ return TRUE;
-+ if( mpReaderData->maPreviewSize.Height() )
-+ return TRUE;
-+ return FALSE;
-+}
-+
-+// ------------------------------------------------------------------------
-+
-+void GraphicReader::DisablePreviewMode()
-+{
-+ if( mpReaderData )
-+ mpReaderData->maPreviewSize = Size( 0, 0 );
-+}
-+
-+// ------------------------------------------------------------------------
-+
-+void GraphicReader::SetPreviewSize( const Size& rSize )
-+{
-+ if( !mpReaderData )
-+ mpReaderData = new ReaderData;
-+ mpReaderData->maPreviewSize = rSize;
-+}
-+
-+// ------------------------------------------------------------------------
-+
-+Size GraphicReader::GetPreviewSize() const
-+{
-+ Size aSize( 0, 0 );
-+ if( mpReaderData )
-+ aSize = mpReaderData->maPreviewSize;
-+ return aSize;
- }
-
- // --------------
-Index: vcl/source/gdi/outmap.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/outmap.cxx,v
-retrieving revision 1.16
-retrieving revision 1.16.18.2
-diff -u -p -r1.16 -r1.16.18.2
---- vcl/source/gdi/outmap.cxx 9 Sep 2005 12:07:42 -0000 1.16
-+++ vcl/source/gdi/outmap.cxx 28 Sep 2005 06:53:47 -0000 1.16.18.2
-@@ -86,6 +86,8 @@
- #include <salgdi.hxx>
- #endif
-
-+#define USE_64BIT_INTS
-+
- // =======================================================================
-
- DBG_NAMEEX( OutputDevice );
-@@ -205,6 +207,13 @@ static void ImplCalcBigIntThreshold( lon
- else
- rThresRes.mnThresPixToLogY = (long)(((ULONG)LONG_MAX + (ULONG)(-nProductY/2)) / nDenomY);
- }
-+
-+#ifdef USE_64BIT_INTS
-+ rThresRes.mnThresLogToPixX /= 2;
-+ rThresRes.mnThresLogToPixY /= 2;
-+ rThresRes.mnThresPixToLogX /= 2;
-+ rThresRes.mnThresPixToLogY /= 2;
-+#endif
- }
-
- // -----------------------------------------------------------------------
-@@ -403,31 +412,41 @@ inline void ImplCalcMapResolution( const
- static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
- long nThres )
- {
--#if 1
-- if ( Abs( n ) < nThres )
-- {
-- sal_Int64 n64 = n;
-- n64 *= nDPI * nMapNum;
-- if( nMapDenom == 1 )
-- n = (long)n64;
-- else
-- {
-- if( n >= 0 )
-- n64 += nMapDenom/2;
-- else
-- n64 -= (nMapDenom-1)/2;
-- n = (long)(n64 / nMapDenom);
-- }
-- return n;
-- }
--#else
-+#ifdef USE_64BIT_INTS
-+#if (SAL_TYPES_SIZEOFLONG < 8)
-+ if( (+n < nThres) && (-n < nThres) )
-+ {
-+ n *= nMapNum * nDPI;
-+ if( nMapDenom != 1 )
-+ {
-+ n = (2 * n) / nMapDenom;
-+ if( n < 0 ) --n; else ++n;
-+ n /= 2;
-+ }
-+ }
-+ else
-+#endif
-+ {
-+ sal_Int64 n64 = n;
-+ n64 *= nMapNum;
-+ n64 *= nDPI;
-+ if( nMapDenom == 1 )
-+ n = (long)n64;
-+ else
-+ {
-+ n = (long)(2 * n64 / nMapDenom);
-+ if( n < 0 ) --n; else ++n;
-+ n /= 2;
-+ }
-+ }
-+ return n;
-+#else // USE_64BIT_INTS
- if ( Abs( n ) < nThres )
- {
- n *= nDPI * nMapNum;
- n += n >= 0 ? nMapDenom/2 : -((nMapDenom-1)/2);
- return (n / nMapDenom);
- }
--#endif
- else
- {
- BigInt aTemp( n );
-@@ -448,6 +467,7 @@ static long ImplLogicToPixel( long n, lo
- aTemp /= BigInt( nMapDenom );
- return (long)aTemp;
- }
-+#endif
- }
-
- // -----------------------------------------------------------------------
-@@ -455,7 +475,21 @@ static long ImplLogicToPixel( long n, lo
- static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
- long nThres )
- {
--#if 1
-+#ifdef USE_64BIT_INTS
-+#if (SAL_TYPES_SIZEOFLONG < 8)
-+ if( (+n < nThres) && (-n < nThres) )
-+ n = (2 * n * nMapDenom) / (nDPI * nMapNum);
-+ else
-+#endif
-+ {
-+ sal_Int64 n64 = n;
-+ n64 *= nMapDenom;
-+ long nDenom = nDPI * nMapNum;
-+ n = (long)(2 * n64 / nDenom);
-+ }
-+ if( n < 0 ) --n; else ++n;
-+ return (n / 2);
-+#else // USE_64BIT_INTS
- if ( Abs( n ) < nThres )
- {
- long nDenom = nDPI * nMapNum;
-@@ -463,31 +497,9 @@ static long ImplPixelToLogic( long n, lo
- if( (nNum ^ nDenom) >= 0 )
- nNum += nDenom/2;
- else
-- nNum -= (nDenom+1)/2;
-+ nNum -= nDenom/2;
- return (nNum / nDenom);
- }
--#else
-- if ( Abs( n ) < nThres )
-- {
-- long nDenom = nDPI * nMapNum;
-- long nNum = n * nMapDenom;
-- if ( nNum >= 0 )
-- {
-- if ( nDenom >= 0 )
-- nNum += nDenom/2;
-- else
-- nNum -= (nDenom+1)/2;
-- }
-- else
-- {
-- if ( nDenom >= 0 )
-- nNum -= (nDenom-1)/2;
-- else
-- nNum += nDenom/2;
-- }
-- return (nNum / nDenom);
-- }
--#endif
- else
- {
- BigInt aDenom( nDPI );
-@@ -529,6 +541,7 @@ static long ImplPixelToLogic( long n, lo
- aNum /= aDenom;
- return (long)aNum;
- }
-+#endif
- }
-
- // -----------------------------------------------------------------------
-Index: vcl/source/gdi/pngread.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/pngread.cxx,v
-retrieving revision 1.12
-retrieving revision 1.10.18.16
-diff -u -p -r1.12 -r1.10.18.16
---- vcl/source/gdi/pngread.cxx 24 Oct 2005 07:48:31 -0000 1.12
-+++ vcl/source/gdi/pngread.cxx 1 Dec 2005 12:17:47 -0000 1.10.18.16
-@@ -74,24 +74,14 @@
- #define VIEWING_GAMMA 2.5
- #define DISPLAY_GAMMA 1.25
-
-+#define MAX_CHUNKLEN 40000000
-+
- namespace vcl
- {
- // -----------
- // - statics -
- // -----------
-
--static const BYTE aBlockHeight[ 8 ] =
--{
-- 0, 8, 8, 4, 4, 2, 2, 1
--};
--
--// ------------------------------------------------------------------------------
--
--static const BYTE aBlockWidth[ 8 ] =
--{
-- 0, 8, 4, 4, 2, 2, 1, 1
--};
--
- // ------------------------------------------------------------------------------
-
- static const BYTE mpDefaultColorTable[ 256 ] =
-@@ -113,70 +103,19 @@ static const BYTE mpDefaultColorTable[ 2
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
- };
-
--/* ------------------------------------------------------------------------
-- SJ: InitChunkSeq reads all PNG chunks. The rStm stream position will be at
-- the end of the file afterwards.
--*/
--const sal_Bool InitChunkSeq( SvStream& rStm, std::vector< vcl::PNGReader::ChunkData >& rChunkSeq )
--{
-- sal_Bool bRet = sal_True;
-- sal_uInt16 nIStmOldMode = rStm.GetNumberFormatInt();
-- rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
--
-- sal_uInt32 nDummy[ 2 ] = {0, 0};
-- rStm >> nDummy[0] >> nDummy[1];
-- if( ! ( nDummy[0] == 0x89504e47 ) && ( nDummy[1] == 0x0d0a1a0a ) )
-- bRet = sal_False;
-- else
-- {
-- sal_uInt32 nChunkLen, nCRC32, nCheck, nType = 0;
-- while( !rStm.IsEof() && ( rStm.GetError() == ERRCODE_NONE ) )
-- {
-- rChunkSeq.resize( rChunkSeq.size() + 1 );
-- vcl::PNGReader::ChunkData& rChunkData = rChunkSeq.back();
-- rStm >> nChunkLen
-- >> nType;
--
-- rChunkData.nType = nType;
-- #if defined(__LITTLEENDIAN) || defined(OSL_LITENDIAN)
-- nType = SWAPLONG( nType );
-- #endif
-- nCRC32 = rtl_crc32( 0, &nType, 4 );
-- if ( nChunkLen && !rStm.IsEof() )
-- {
-- rChunkData.aData.resize( nChunkLen );
-- sal_uInt8* pPtr = &rChunkData.aData[ 0 ];
-- rStm.Read( pPtr, nChunkLen );
-- nCRC32 = rtl_crc32( nCRC32, pPtr, nChunkLen );
-- }
-- rStm >> nCheck;
-- if ( nCRC32 != nCheck )
-- {
-- bRet = sal_False;
-- break;
-- }
-- if ( rChunkData.nType == PNGCHUNK_IEND )
-- break;
-- }
-- if ( !rChunkSeq.size() || ( rChunkSeq[ 0 ].nType != PNGCHUNK_IHDR ) )
-- bRet = sal_False;
-- }
-- rStm.SetNumberFormatInt( nIStmOldMode );
-- return bRet;
--}
--
- // -------------
- // - PNGReaderImpl -
- // -------------
-
- class PNGReaderImpl
- {
-- friend class vcl::PNGReader;
--
-- std::vector< vcl::PNGReader::ChunkData > maChunkSeq;
-- std::vector< sal_uInt8 >::iterator maDataIter;
-- std::vector< sal_uInt8 >::iterator maDataEnd;
-- sal_Int32 mnChunkLen;
-+private:
-+ SvStream& mrPNGStream;
-+ sal_uInt16 mnOrigStreamMode;
-+
-+ std::vector< vcl::PNGReader::ChunkData > maChunkSeq;
-+ std::vector< vcl::PNGReader::ChunkData >::iterator maChunkIter;
-+ std::vector< sal_uInt8 >::iterator maDataIter;
-
- Bitmap* mpBmp;
- BitmapWriteAccess* mpAcc;
-@@ -185,31 +124,36 @@ class PNGReaderImpl
- BitmapWriteAccess* mpMaskAcc;
- ZCodec* mpZCodec;
- BYTE* mpInflateInBuf; // as big as the size of a scanline + alphachannel + 1
-- BYTE* mpScanprior; // pointer to the latest scanline
-- BYTE* mpTransTab; //
-- BYTE* mpScan; // pointer in the current scanline
-+ BYTE* mpScanPrior; // pointer to the latest scanline
-+ BYTE* mpTransTab; // for transparency in images with palette colortype
-+ BYTE* mpScanCurrent; // pointer into the current scanline
- BYTE* mpColorTable; //
-- sal_uInt32 mnChunkType; // Chunk which is currently open
-- sal_uInt32 mnWidth;
-- sal_uInt32 mnHeight;
-- sal_uInt32 mnBBP; // number of bytes per pixel
-- sal_uInt32 mnScansize; // max size of scanline
-- sal_uInt32 mnPrefWidth; // preferred width in meter
-- sal_uInt32 mnPrefHeight; // preferred Height in meter
-- sal_uInt32 mnYpos; // latest y position;
-+ sal_uInt32 mnChunkType; // Type of current PNG chunk
-+ sal_uInt32 mnChunkLen; // Length of current PNG chunk
-+ Size maOrigSize; // pixel size of the full image
-+ Size maTargetSize; // pixel size of the result image
-+ Size maPhysSize; // prefered size in MAP_100TH_MM units
-+ sal_uInt32 mnBPP; // number of bytes per pixel
-+ sal_uInt32 mnScansize; // max size of scanline
-+ sal_uInt32 mnYpos; // latest y position in full image
-+ int mnPass; // if interlaced the latest pass ( 1..7 ) else 7
-+ sal_uInt32 mnXStart; // the starting X for the current pass
-+ sal_uInt32 mnXAdd; // the increment for input images X coords for the current pass
-+ sal_uInt32 mnYAdd; // the increment for input images Y coords for the current pass
-+ int mnPreviewShift; // shift to convert orig image coords into preview image coords
-+ int mnPreviewMask; // == ((1 << mnPreviewShift) - 1)
- USHORT mnIStmOldMode;
-- USHORT mnDepth; // pixel depth
-+ USHORT mnDepth; // pixel depth of target bitmap
- BYTE mnTransRed;
- BYTE mnTransGreen;
- BYTE mnTransBlue;
-- BYTE mnBitDepth; // sample depth
-+ BYTE mnBitDepth; // pixel depth of PNG data
- BYTE mnColorType;
- BYTE mnCompressionType;
- BYTE mnFilterType;
- BYTE mnInterlaceType;
-- BYTE mnPass; // if interlaced the latest pass ( 1..7 ) else 7
-- BYTE cTransIndex1;
-- BYTE cNonTransIndex1;
-+ BitmapColor mcTranspColor; // transparency mask's transparency "color"
-+ BitmapColor mcOpaqueColor; // transparency mask's opaque "color"
- BOOL mbStatus;
- BOOL mbTransparent; // graphic includes an tRNS Chunk or an alpha Channel
- BOOL mbAlphaChannel;
-@@ -217,40 +161,50 @@ class PNGReaderImpl
- BOOL mbPalette; // FALSE if we need a Palette
- BOOL mbGrayScale;
- BOOL mbzCodecInUse;
-- BOOL mbIDAT; // TRUE if finished with the complete IDAT...
-+ BOOL mbIDAT; // TRUE if finished with enough IDAT chunks
- BOOL mbGamma; // TRUE if Gamma Correction available
- BOOL mbpHYs; // TRUE if pysical size of pixel available
-
-- void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor &, BOOL bTrans );
-- void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, BYTE nPalIndex, BOOL bTrans );
-+ bool ReadNextChunk();
-+ void ReadRemainingChunks();
-+ void SkipRemainingChunks();
-+
-+ void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor & );
-+ void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, BYTE nPalIndex );
-+ void ImplSetTranspPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor &, BOOL bTrans );
-+ void ImplSetTranspPixel( sal_uInt32 y, sal_uInt32 x, BYTE nPalIndex, BOOL bTrans );
- void ImplSetAlphaPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor&, BYTE nAlpha );
- void ImplReadIDAT();
-- void ImplResizeScanline();
-- void ImplGetFilter( sal_uInt32 nXStart=0, sal_uInt32 nXAdd=1 );
-- void ImplReadTransparent();
-+ bool ImplPreparePass();
-+ void ImplApplyFilter();
-+ void ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd );
-+ BOOL ImplReadTransparent();
- void ImplGetGamma();
- void ImplGetBackground();
- BYTE ImplScaleColor();
-- BOOL ImplReadHeader();
-+ BOOL ImplReadHeader( const Size& rPreviewSizeHint );
- BOOL ImplReadPalette();
- void ImplGetGrayPalette( sal_uInt32 );
- sal_uInt32 ImplReadsal_uInt32();
-
- public:
-
-- PNGReaderImpl( SvStream& rStm );
-+ PNGReaderImpl( SvStream& );
- ~PNGReaderImpl();
-
-- BitmapEx Read();
-+ BitmapEx GetBitmapEx( const Size& rPreviewSizeHint );
-+ const std::vector< PNGReader::ChunkData >& GetAllChunks();
- };
-
- // ------------------------------------------------------------------------------
-
--PNGReaderImpl::PNGReaderImpl( SvStream& rPNG ) :
-+PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
-+: mrPNGStream( rPNGStream ),
-+ mbIDAT( FALSE ),
- mpAcc ( NULL ),
- mpMaskAcc ( NULL ),
- mpInflateInBuf ( NULL ),
-- mpScanprior ( NULL ),
-+ mpScanPrior ( NULL ),
- mpTransTab ( NULL ),
- mpBmp ( NULL ),
- mpMaskBmp ( NULL ),
-@@ -261,49 +215,156 @@ PNGReaderImpl::PNGReaderImpl( SvStream&
- mpColorTable ( (sal_uInt8*) mpDefaultColorTable ),
- mpZCodec ( new ZCodec( DEFAULT_IN_BUFSIZE, DEFAULT_OUT_BUFSIZE, MAX_MEM_USAGE ) )
- {
-- mbStatus = InitChunkSeq( rPNG, maChunkSeq );
-+ // prepare the PNG data stream
-+ mnOrigStreamMode = mrPNGStream.GetNumberFormatInt();
-+ mrPNGStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
-+
-+ // prepare the chunk reader
-+ maChunkSeq.reserve( 16 );
-+ maChunkIter = maChunkSeq.begin();
-+
-+ sal_uInt32 nDummy;
-+ mrPNGStream >> nDummy;
-+ mbStatus = (nDummy == 0x89504e47);
-+ mrPNGStream >> nDummy;
-+ mbStatus &= (nDummy == 0x0d0a1a0a);
-+
-+ mnPreviewShift = 0;
-+ mnPreviewMask = (1 << mnPreviewShift) - 1;
- }
-
- // ------------------------------------------------------------------------
-
- PNGReaderImpl::~PNGReaderImpl()
- {
-+ mrPNGStream.SetNumberFormatInt( mnOrigStreamMode );
-+
- if ( mbzCodecInUse )
- mpZCodec->EndCompression();
-
- if( mpColorTable != mpDefaultColorTable )
- delete[] mpColorTable;
-
-- rtl_freeMemory( mpScanprior );
-+ delete mpBmp;
-+ delete mpAlphaMask;
-+ delete mpMaskBmp;
-+ delete[] mpTransTab;
-+ delete[] mpInflateInBuf;
-+ delete[] mpScanPrior;
-+ delete mpZCodec;
-+}
-+
-+// ------------------------------------------------------------------------
-
-- delete mpBmp;
-- delete mpAlphaMask;
-- delete mpMaskBmp;
-- delete[] mpTransTab;
-- delete[] mpInflateInBuf;
-- delete mpZCodec;
-+bool PNGReaderImpl::ReadNextChunk()
-+{
-+ if( maChunkIter == maChunkSeq.end() )
-+ {
-+ // get the next chunk from the stream
-+
-+ // unless we are at the end of the PNG stream
-+ if( mrPNGStream.IsEof() || (mrPNGStream.GetError() != ERRCODE_NONE) )
-+ return false;
-+ if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) )
-+ return false;
-+
-+ PNGReader::ChunkData aDummyChunk;
-+ maChunkIter = maChunkSeq.insert( maChunkSeq.end(), aDummyChunk );
-+ PNGReader::ChunkData& rChunkData = *maChunkIter;
-+
-+ // read the chunk header
-+ mrPNGStream >> mnChunkLen >> mnChunkType;
-+ rChunkData.nType = mnChunkType;
-+
-+ // #128377# sanity check for chunk length
-+ if( mnChunkLen > MAX_CHUNKLEN)
-+ return false;
-+
-+ // calculate chunktype CRC (swap it back to original byte order)
-+ sal_uInt32 nChunkType = mnChunkType;;
-+ #if defined(__LITTLEENDIAN) || defined(OSL_LITENDIAN)
-+ nChunkType = SWAPLONG( nChunkType );
-+ #endif
-+ sal_uInt32 nCRC32 = rtl_crc32( 0, &nChunkType, 4 );
-+
-+ // read the chunk data and check the CRC
-+ if( mnChunkLen && !mrPNGStream.IsEof() )
-+ {
-+ rChunkData.aData.resize( mnChunkLen );
-+ sal_uInt8* pPtr = &rChunkData.aData[ 0 ];
-+ mrPNGStream.Read( pPtr, mnChunkLen );
-+ nCRC32 = rtl_crc32( nCRC32, pPtr, mnChunkLen );
-+ maDataIter = rChunkData.aData.begin();
-+ }
-+ sal_uInt32 nCheck;
-+ mrPNGStream >> nCheck;
-+ if( nCRC32 != nCheck )
-+ return false;
-+ }
-+ else
-+ {
-+ // the next chunk was already read
-+ mnChunkType = (*maChunkIter).nType;
-+ mnChunkLen = (*maChunkIter).aData.size();
-+ maDataIter = (*maChunkIter).aData.begin();
-+ }
-+
-+ ++maChunkIter;
-+ if( mnChunkType == PNGCHUNK_IEND )
-+ return false;
-+ return true;
- }
-
- // ------------------------------------------------------------------------
-
--BitmapEx PNGReaderImpl::Read()
-+// read the remaining chunks from mrPNGStream
-+void PNGReaderImpl::ReadRemainingChunks()
- {
-- BitmapEx aRet;
-+ while( ReadNextChunk() );
-+}
-
-- std::vector< vcl::PNGReader::ChunkData >::iterator aIter( maChunkSeq.begin() );
-- std::vector< vcl::PNGReader::ChunkData >::iterator aEnd ( maChunkSeq.end() );
-+// ------------------------------------------------------------------------
-
-- while( mbStatus && ( aIter != aEnd ) && ( aIter->nType != PNGCHUNK_IEND ) )
-- {
-- maDataIter = aIter->aData.begin();
-- maDataEnd = aIter->aData.end();
-- mnChunkLen = aIter->aData.size();
-+// move position of mrPNGStream to the end of the file
-+void PNGReaderImpl::SkipRemainingChunks()
-+{
-+ // nothing to skip if the last chunk was read
-+ if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) )
-+ return;
-+
-+ // read from the stream until the IEND chunk is found
-+ while( !mrPNGStream.IsEof() && (mrPNGStream.GetError() == ERRCODE_NONE) )
-+ {
-+ mrPNGStream >> mnChunkLen >> mnChunkType;
-+ mrPNGStream.SeekRel( mnChunkLen + 4 ); // skip data + CRC
-+ if( mnChunkType == PNGCHUNK_IEND )
-+ break;
-+ }
-+}
-
-- switch ( aIter->nType )
-+// ------------------------------------------------------------------------
-+
-+const std::vector< vcl::PNGReader::ChunkData >& PNGReaderImpl::GetAllChunks()
-+{
-+ ReadRemainingChunks();
-+ return maChunkSeq;
-+}
-+
-+// ------------------------------------------------------------------------
-+
-+BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
-+{
-+ // reset to the first chunk
-+ maChunkIter = maChunkSeq.begin();
-+
-+ // parse the chunks
-+ while( mbStatus && !mbIDAT && ReadNextChunk() )
-+ {
-+ switch( mnChunkType )
- {
- case PNGCHUNK_IHDR :
- {
-- mbStatus = ImplReadHeader();
-+ mbStatus = ImplReadHeader( rPreviewSizeHint );
- }
- break;
-
-@@ -322,7 +383,7 @@ BitmapEx PNGReaderImpl::Read()
- break;
-
- case PNGCHUNK_tRNS :
-- ImplReadTransparent();
-+ mbStatus = ImplReadTransparent();
- break;
-
- case PNGCHUNK_bKGD : // the background chunk must appear
-@@ -343,19 +404,29 @@ BitmapEx PNGReaderImpl::Read()
- {
- if ( !mbIDAT && mnChunkLen == 9 )
- {
-- mnPrefWidth = ImplReadsal_uInt32();
-- mnPrefHeight= ImplReadsal_uInt32();
--
-- sal_uInt8 nUnitSpecifier = *maDataIter++;
-+ sal_uInt32 nXPixelPerMeter = ImplReadsal_uInt32();
-+ sal_uInt32 nYPixelPerMeter = ImplReadsal_uInt32();
-
-- if ( nUnitSpecifier == 1 )
-- mbpHYs = sal_True;
-+ sal_uInt8 nUnitSpecifier = *maDataIter++;
-+ if( (nUnitSpecifier == 1) && nXPixelPerMeter && nXPixelPerMeter )
-+ {
-+ mbpHYs = sal_True;
-+
-+ // convert into MAP_100TH_MM
-+ maPhysSize.Width() = (sal_Int32)( (100000.0 * maOrigSize.Width()) / nXPixelPerMeter );
-+ maPhysSize.Height() = (sal_Int32)( (100000.0 * maOrigSize.Height()) / nYPixelPerMeter );
-+ }
- }
- }
- break;
-+
-+ case PNGCHUNK_IEND:
-+ mbStatus = mbIDAT; // there is a problem if the image is not complete yet
-+ break;
- }
-- aIter++;
- }
-+
-+ // release write access of the bitmaps
- if ( mpAcc )
- mpBmp->ReleaseAccess( mpAcc ), mpAcc = NULL;
-
-@@ -368,8 +439,13 @@ BitmapEx PNGReaderImpl::Read()
-
- mpMaskAcc = NULL;
- }
--
-- if ( mbStatus )
-+
-+ // return the resulting BitmapEx
-+ BitmapEx aRet;
-+
-+ if( !mbStatus || !mbIDAT )
-+ aRet.Clear();
-+ else
- {
- if ( mbAlphaChannel )
- aRet = BitmapEx( *mpBmp, *mpAlphaMask );
-@@ -378,57 +454,61 @@ BitmapEx PNGReaderImpl::Read()
- else
- aRet = *mpBmp;
-
-- if ( mbpHYs && mnPrefWidth && mnPrefHeight )
-+ if ( mbpHYs && maPhysSize.Width() && maPhysSize.Height() )
- {
-- sal_Int32 nPrefSizeX = (sal_Int32)( 100000.0 * ( (double)mnWidth / mnPrefWidth ) );
-- sal_Int32 nPrefSizeY = (sal_Int32)( 100000.0 * ( (double)mnHeight / mnPrefHeight ) );
--
- aRet.SetPrefMapMode( MAP_100TH_MM );
-- aRet.SetPrefSize( Size( nPrefSizeX, nPrefSizeY ) );
-+ aRet.SetPrefSize( maPhysSize );
- }
-+
-+#if 0
-+ // TODO: make sure nobody depends on the stream being after the IEND chunks
-+ // => let them do ReadChunks before
-+ ReadRemainingChunks();
-+#endif
- }
-- if( !mbStatus )
-- aRet.Clear();
-
- return aRet;
- }
-
- // ------------------------------------------------------------------------
-
--BOOL PNGReaderImpl::ImplReadHeader()
-+BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint )
- {
-- mnWidth = ImplReadsal_uInt32();
-- mnHeight = ImplReadsal_uInt32();
--
-- if ( ( mnWidth == 0 ) || ( mnHeight == 0 ) )
-- return FALSE;
--
-- mnBitDepth = *maDataIter++;
-- mnColorType = *maDataIter++;
--
-- if ( mnCompressionType = *maDataIter++ )
-- return FALSE;
--
-- if ( mnFilterType = *maDataIter++ )
-- return FALSE;
--
-- switch ( mnInterlaceType = *maDataIter++ ) // filter type valid ?
-+ maOrigSize.Width() = ImplReadsal_uInt32();
-+ maOrigSize.Height() = ImplReadsal_uInt32();
-+
-+ if ( !maOrigSize.Width() || !maOrigSize.Height() )
-+ return FALSE;
-+
-+ mnBitDepth = *(maDataIter++);
-+ mnColorType = *(maDataIter++);
-+
-+ mnCompressionType = *(maDataIter++);
-+ if( mnCompressionType != 0 ) // unknown compression type
-+ return FALSE;
-+
-+ mnFilterType = *(maDataIter++);
-+ if( mnFilterType != 0 ) // unknown filter type
-+ return FALSE;
-+
-+ mnInterlaceType = *(maDataIter++);
-+ switch ( mnInterlaceType ) // filter type valid ?
- {
-- case 0 :
-+ case 0 : // progressive image
- mnPass = 7;
- break;
-- case 1 :
-+ case 1 : // Adam7-interlaced image
- mnPass = 0;
- break;
- default:
- return FALSE;
- }
-- mnYpos = 0;
-+
- mbPalette = TRUE;
- mbIDAT = mbAlphaChannel = mbTransparent = FALSE;
- mbGrayScale = mbRGBTriple = FALSE;
- mnDepth = mnBitDepth;
-- mnScansize = ( ( mnWidth * mnBitDepth ) + 7 ) >> 3;
-+ mnScansize = ( ( maOrigSize.Width() * mnBitDepth ) + 7 ) >> 3;
-
- // valid color types are 0,2,3,4 & 6
- switch ( mnColorType )
-@@ -455,7 +535,7 @@ BOOL PNGReaderImpl::ImplReadHeader()
- case 2 : // each pixel is an RGB triple
- {
- mbRGBTriple = TRUE;
-- mnScansize*=3;
-+ mnScansize *= 3;
- switch ( mnBitDepth )
- {
- case 16 : // we have to reduce the bitmap
-@@ -487,7 +567,7 @@ BOOL PNGReaderImpl::ImplReadHeader()
-
- case 4 : // each pixel is a grayscale sample followed by an alpha sample
- {
-- mnScansize <<= 1;
-+ mnScansize *= 2;
- mbAlphaChannel = TRUE;
- switch ( mnBitDepth )
- {
-@@ -505,7 +585,7 @@ BOOL PNGReaderImpl::ImplReadHeader()
- case 6 : // each pixel is an RGB triple followed by an alpha sample
- {
- mbRGBTriple = TRUE;
-- mnScansize*=4;
-+ mnScansize *= 4;
- mbAlphaChannel = TRUE;
- switch (mnBitDepth )
- {
-@@ -522,44 +602,57 @@ BOOL PNGReaderImpl::ImplReadHeader()
- default :
- return FALSE;
- }
-- mnBBP = mnScansize / mnWidth;
--
-- if ( !mnBBP )
-- mnBBP = 1;
--
-- mnScansize++; // each scanline includes one filterbyte
-- mpScan = mpInflateInBuf = new BYTE[ mnScansize ];
-- mpScanprior = (sal_uInt8*)rtl_allocateZeroMemory( mnScansize );
--
-- if ( mnInterlaceType )
-- ImplResizeScanline();
--
-- mpBmp = new Bitmap( Size( mnWidth, mnHeight ), mnDepth);
-- mpAcc = mpBmp->AcquireWriteAccess();
--
-- if ( mbAlphaChannel )
-- {
-- mpAlphaMask = new AlphaMask( Size( mnWidth, mnHeight ) );
-- mpAlphaMask->Erase( 128 );
-- mpMaskAcc = mpAlphaMask->AcquireWriteAccess();
-- }
-- else
-- {
-- mpMaskBmp = new Bitmap( Size( mnWidth, mnHeight ), 1 );
-- mpMaskBmp->Erase( Color( COL_WHITE ) );
-- mpMaskAcc = mpMaskBmp->AcquireWriteAccess();
-- }
-
-- if ( ( mpAcc == NULL ) || ( mpMaskAcc == NULL ) )
-- return FALSE;
--
-- const Color aWhite( COL_WHITE );
-- cTransIndex1 = (BYTE)mpMaskAcc->GetBestPaletteIndex( aWhite );
-- cNonTransIndex1 = cTransIndex1 ? 0 : 1;
-+ mnBPP = mnScansize / maOrigSize.Width();
-+ if ( !mnBPP )
-+ mnBPP = 1;
-+
-+ mnScansize++; // each scanline includes one filterbyte
-+
-+ // TODO: switch between both scanlines instead of copying
-+ mpInflateInBuf = new BYTE[ mnScansize ];
-+ mpScanCurrent = mpInflateInBuf;
-+ mpScanPrior = new BYTE[ mnScansize ];
-+
-+ // calculate target size from original size and the preview hint
-+ if( rPreviewSizeHint.Width() && rPreviewSizeHint.Height() )
-+ {
-+ maTargetSize = maOrigSize;
-+ for( int i = 1; i < 5; ++i )
-+ {
-+ if( (maTargetSize.Width() >> i) < rPreviewSizeHint.Width() )
-+ break;
-+ if( (maTargetSize.Height() >> i) < rPreviewSizeHint.Height() )
-+ break;
-+ mnPreviewShift = i;
-+ }
-+ mnPreviewMask = (1 << mnPreviewShift) - 1;
-+ }
-+
-+ maTargetSize.Width() = (maOrigSize.Width() + mnPreviewMask) >> mnPreviewShift;
-+ maTargetSize.Height() = (maOrigSize.Height() + mnPreviewMask) >> mnPreviewShift;
-+
-+ mpBmp = new Bitmap( maTargetSize, mnDepth );
-+ mpAcc = mpBmp->AcquireWriteAccess();
-+ if( !mpAcc )
-+ return FALSE;
-+
-+ mpBmp->SetSourceSizePixel( maOrigSize );
-+
-+ if ( mbAlphaChannel )
-+ {
-+ mpAlphaMask = new AlphaMask( maTargetSize );
-+ mpAlphaMask->Erase( 128 );
-+ mpMaskAcc = mpAlphaMask->AcquireWriteAccess();
-+ if( !mpMaskAcc )
-+ return FALSE;
-+ }
-
- if ( mbGrayScale )
- ImplGetGrayPalette( mnDepth );
-
-+ ImplPreparePass();
-+
- return TRUE;
- }
-
-@@ -594,16 +687,14 @@ BOOL PNGReaderImpl::ImplReadPalette()
-
- if ( ( ( mnChunkLen % 3 ) == 0 ) && ( ( 0 < nCount ) && ( nCount <= 256 ) ) && mpAcc )
- {
-- BYTE nRed, nGreen, nBlue;
--
- mbPalette = TRUE;
- mpAcc->SetPaletteEntryCount( (USHORT) nCount );
-
-- for ( USHORT i = 0; i < nCount; i++ )
-+ for ( sal_uInt32 i = 0; i < nCount; i++ )
- {
-- nRed = mpColorTable[ *maDataIter++ ];
-- nGreen = mpColorTable[ *maDataIter++ ];
-- nBlue = mpColorTable[ *maDataIter++ ];
-+ BYTE nRed = mpColorTable[ *maDataIter++ ];
-+ BYTE nGreen = mpColorTable[ *maDataIter++ ];
-+ BYTE nBlue = mpColorTable[ *maDataIter++ ];
- mpAcc->SetPaletteColor( i, Color( nRed, nGreen, nBlue ) );
- }
- }
-@@ -615,7 +706,7 @@ BOOL PNGReaderImpl::ImplReadPalette()
-
- // ------------------------------------------------------------------------
-
--void PNGReaderImpl::ImplReadTransparent()
-+BOOL PNGReaderImpl::ImplReadTransparent()
- {
- if ( mpTransTab == NULL )
- {
-@@ -662,6 +753,19 @@ void PNGReaderImpl::ImplReadTransparent(
- break;
- }
- }
-+
-+ if( mbTransparent && !mbAlphaChannel && !mpMaskBmp )
-+ {
-+ mpMaskBmp = new Bitmap( maTargetSize, 1 );
-+ mpMaskAcc = mpMaskBmp->AcquireWriteAccess();
-+ if( !mpMaskAcc )
-+ return FALSE;
-+ mcOpaqueColor = BitmapColor( COL_BLACK );
-+ mcTranspColor = BitmapColor( COL_WHITE );
-+ mpMaskAcc->Erase( mcOpaqueColor );
-+ }
-+
-+ return TRUE;
- }
-
- // ------------------------------------------------------------------------
-@@ -691,9 +795,6 @@ void PNGReaderImpl::ImplGetGamma()
-
- void PNGReaderImpl::ImplGetBackground()
- {
-- Point aPoint;
-- Rectangle aRectangle( aPoint, Size( mnWidth, mnHeight ) );
--
- switch ( mnColorType )
- {
- case 3 :
-@@ -703,11 +804,10 @@ void PNGReaderImpl::ImplGetBackground()
- UINT16 nCol = *maDataIter++;
- if ( nCol < mpAcc->GetPaletteEntryCount() )
- {
-- mpAcc->SetFillColor( (const Color&)mpAcc->GetPaletteColor( (BYTE)nCol ) );
-- mpAcc->FillRect( aRectangle );
-+ mpAcc->Erase( mpAcc->GetPaletteColor( (BYTE)nCol ) );
- break;
- }
-- }
-+ }
- }
- break;
-
-@@ -719,8 +819,7 @@ void PNGReaderImpl::ImplGetBackground()
- // the color type 0 and 4 is always greyscale,
- // so the return value can be used as index
- sal_uInt8 nIndex = ImplScaleColor();
-- mpAcc->SetFillColor( (const Color&)mpAcc->GetPaletteColor( nIndex ) );
-- mpAcc->FillRect( aRectangle );
-+ mpAcc->Erase( mpAcc->GetPaletteColor( nIndex ) );
- }
- }
- break;
-@@ -733,8 +832,7 @@ void PNGReaderImpl::ImplGetBackground()
- sal_uInt8 nRed = ImplScaleColor();
- sal_uInt8 nGreen = ImplScaleColor();
- sal_uInt8 nBlue = ImplScaleColor();
-- mpAcc->SetFillColor( Color( nRed, nGreen, nBlue ) );
-- mpAcc->FillRect( aRectangle );
-+ mpAcc->Erase( Color( nRed, nGreen, nBlue ) );
- }
- }
- break;
-@@ -759,11 +857,10 @@ sal_uInt8 PNGReaderImpl::ImplScaleColor(
- }
-
- // ------------------------------------------------------------------------
--// ImplReadIDAT reads as much bitmap data as possible
-+// ImplReadIDAT reads as much image data as needed
-
- void PNGReaderImpl::ImplReadIDAT()
- {
-- sal_uInt32 nToRead, nRead;
- if ( mnChunkLen ) // Chunk empty ?
- {
- if ( mbzCodecInUse == FALSE )
-@@ -776,691 +873,588 @@ void PNGReaderImpl::ImplReadIDAT()
-
- while ( ( mpZCodec->GetBreak() ) )
- {
-- // get bytes needed to fill the current scanline
-- nToRead = mnScansize - ( mpScan - mpInflateInBuf );
--
-- if ( ( nRead = mpZCodec->ReadAsynchron( aIStrm, mpScan, nToRead ) ) < 0 )
-+ // get bytes needed to fill the current scanline
-+ sal_uInt32 nToRead = mnScansize - (mpScanCurrent - mpInflateInBuf);
-+ sal_uInt32 nRead = mpZCodec->ReadAsynchron( aIStrm, mpScanCurrent, nToRead );
-+ if ( nRead < 0 )
- {
- mbStatus = FALSE;
- break;
- }
- if ( nRead < nToRead )
- {
-- mpScan += nRead; // ZStream is Broken
-+ mpScanCurrent += nRead; // more ZStream data in the next IDAT chunk
- break;
- }
-- else
-+ else // this scanline is Finished
- {
-- mpScan = mpInflateInBuf; // this scanline is Finished
--
-- if ( mnInterlaceType == 0 )
-- {
-- ImplGetFilter ( 0, 1 );
-- mnYpos++;
-- }
-- else
-- {
-- // interlace mode
-- switch ( mnPass )
-- {
-- case 1 : // pass 1
-- {
-- ImplGetFilter ( 0, 8 );
-- mnYpos += 8;
-- }
-- break;
--
-- case 2 : // pass 2
-- {
-- ImplGetFilter ( 4, 8 );
-- mnYpos += 8;
-- }
-- break;
--
-- case 3 : // pass 3
-- {
-- if ( mnYpos >= 4 )
-- {
-- ImplGetFilter ( 0, 4 );
-- }
-- mnYpos += 8;
-- }
-- break;
--
-- case 4 : // pass 4
-- {
-- ImplGetFilter ( 2, 4 );
-- mnYpos += 4;
-- }
-- break;
-+ mpScanCurrent = mpInflateInBuf;
-+ ImplApplyFilter();
-
-- case 5 : // pass 5
-- {
-- if ( mnYpos >= 2 )
-- {
-- ImplGetFilter ( 0, 2 );
-- }
-- mnYpos += 4;
-- }
-- break;
--
-- case 6 : // pass 6
-- {
-- ImplGetFilter ( 1, 2 );
-- mnYpos += 2;
-- }
-- break;
--
-- case 7 : // pass 7
-- {
-- if ( mnYpos >= 1 )
-- {
-- ImplGetFilter ( 0, 1 );
-- }
-- mnYpos += 2;
-- }
-- break;
-- }
-- }
-+ ImplDrawScanline( mnXStart, mnXAdd );
-+ mnYpos += mnYAdd;
- }
-
-- if ( mnYpos >= mnHeight )
-+ if ( mnYpos >= maOrigSize.Height() )
- {
-- if ( mnPass == 7 )
-- break;
-- else
-- {
-- ImplResizeScanline();
-- }
-+ if( (mnPass < 7) && mnInterlaceType )
-+ if( ImplPreparePass() )
-+ continue;
-+ mbIDAT = true;
-+ break;
- }
- }
- }
-
-- if ( ( mnPass >= 7 ) && ( mnYpos >= mnHeight ) )
-+ if( mbIDAT )
- {
- mpZCodec->EndCompression();
- mbzCodecInUse = FALSE;
-- mbIDAT = TRUE;
- }
- }
-
- // ---------------------------------------------------------------------------------------------------
-
--void PNGReaderImpl::ImplResizeScanline( void )
-+bool PNGReaderImpl::ImplPreparePass()
- {
-- long nScansize;
--
-- while ( mnPass < 7 )
-- {
-- sal_uInt32 nX = 0;
-+ struct InterlaceParams{ int mnXStart, mnYStart, mnXAdd, mnYAdd; };
-+ static const InterlaceParams aInterlaceParams[8] =
-+ {
-+ // non-interlaced
-+ { 0, 0, 1, 1 },
-+ // Adam7-interlaced
-+ { 0, 0, 8, 8 }, // pass 1
-+ { 4, 0, 8, 8 }, // pass 2
-+ { 0, 4, 4, 8 }, // pass 3
-+ { 2, 0, 4, 4 }, // pass 4
-+ { 0, 2, 2, 4 }, // pass 5
-+ { 1, 0, 2, 2 }, // pass 6
-+ { 0, 1, 1, 2 } // pass 7
-+ };
-+
-+ const InterlaceParams* pParam = &aInterlaceParams[ 0 ];
-+ if( mnInterlaceType )
-+ {
-+ while( ++mnPass <= 7 )
-+ {
-+ pParam = &aInterlaceParams[ mnPass ];
-+
-+ // skip this pass if the original image is too small for it
-+ if( (pParam->mnXStart < maOrigSize.Width())
-+ && (pParam->mnYStart < maOrigSize.Height()) )
-+ break;
-+ }
-+ if( mnPass > 7 )
-+ return false;
-+
-+ // skip the last passes if possible (for scaled down target images)
-+ if( mnPreviewMask & (pParam->mnXStart | pParam->mnYStart) )
-+ return false;
-+ }
-+
-+ mnYpos = pParam->mnYStart;
-+ mnXStart = pParam->mnXStart;
-+ mnXAdd = pParam->mnXAdd;
-+ mnYAdd = pParam->mnYAdd;
-+
-+ long nScansize = (maOrigSize.Width() - mnXStart + mnXAdd - 1) / mnXAdd;
-+
-+ // in Interlace mode the size of scanline is not constant
-+ // so first we calculate the number of entrys
-+ mnScansize = nScansize * mnBitDepth;
-+
-+ if ( mbRGBTriple )
-+ mnScansize *= 3;
-+
-+ // convert bitsize to byte
-+ mnScansize = ( mnScansize + 7 ) >> 3;
-
-- mnYpos = 0;
-- mnPass++;
--
-- switch ( mnPass )
-- {
-- case 1 :
-- nScansize = ( mnWidth + 7 ) >> 3;
-- break;
-+ if ( mbAlphaChannel )
-+ mnScansize += nScansize;
-
-- case 2 :
-- nX += 4;
-- nScansize = ( mnWidth + 3 ) >> 3;
-- break;
-+ ++mnScansize; // scan size also needs room for the filtertype byte
-+ rtl_zeroMemory( mpScanPrior, mnScansize );
-
-- case 3 :
-- mnYpos += 4;
-- nScansize = ( mnWidth + 3 ) >> 2;
-- break;
--
-- case 4 :
-- nX += 2;
-- nScansize = ( mnWidth + 1) >> 2;
-- break;
--
-- case 5 :
-- mnYpos += 2;
-- nScansize = ( mnWidth + 1 ) >> 1;
-- break;
--
-- case 6 :
-- nX++;
-- nScansize = mnWidth >> 1;
-- break;
--
-- case 7 :
-- mnYpos++;
-- nScansize = mnWidth;
-- break;
--
-- default:
-- nScansize = 0;
-- break;
-- }
--
-- if ( ( mnYpos >= mnHeight ) || ( nX >= mnWidth ) ) // is pass to be skipped ?
-- continue;
--
-- // in Interlace mode the size of scanline is not constant
-- // so first we calculate the number of entrys
-- mnScansize = nScansize * mnBitDepth;
-+ return true;
-+}
-
-- if ( mbRGBTriple )
-- mnScansize *= 3;
-+// ---------------------------------------------------------------------------------------------------
-+// ImplApplyFilter writes the complete Scanline (nY) - in interlace mode the parameter nXStart and nXAdd
-+// appends to the currently used pass
-
-- // convert bitsize to byte
-- mnScansize = ( mnScansize + 7 ) >> 3;
-+void PNGReaderImpl::ImplApplyFilter()
-+{
-+ const BYTE* const pScanEnd = mpInflateInBuf + mnScansize;
-
-- if ( mbAlphaChannel )
-- mnScansize += ( ( nScansize * mnBitDepth ) >> 3 );
-+ BYTE nFilterType = *mpInflateInBuf; // the filter type may change each scanline
-+ switch ( nFilterType )
-+ {
-+ default: // unknown Scanline Filter Type
-+ case 0: // Filter Type "None"
-+ // we let the pixels pass and display the data unfiltered
-+ break;
-+
-+ case 1: // Scanline Filter Type "Sub"
-+ {
-+ BYTE* p1 = mpInflateInBuf + 1;;
-+ const BYTE* p2 = p1;
-+ p1 += mnBPP;
-+
-+ // use left pixels
-+ do
-+ *p1 += *(p2++);
-+ while( ++p1 < pScanEnd );
-+ }
-+ break;
-+
-+ case 2: // Scanline Filter Type "Up"
-+ {
-+ BYTE* p1 = mpInflateInBuf + 1;;
-+ const BYTE* p2 = mpScanPrior + 1;
-+
-+ // use pixels from prior line
-+ do
-+ *p1 += *(p2++);
-+ while( ++p1 < pScanEnd );
-+ }
-+ break;
-+
-+ case 3: // Scanline Filter Type "Average"
-+ {
-+ BYTE* p1 = mpInflateInBuf + 1;;
-+ const BYTE* p2 = mpScanPrior + 1;
-+ const BYTE* p3 = p1;
-+
-+ // use one pixel from prior line
-+ for( int n = mnBPP; --n >= 0; )
-+ *(p1++) += *(p2++) >> 1;
-+
-+ // predict by averaging the left and prior line pixels
-+ do
-+ *p1 += (BYTE)( ( (unsigned)*(p2++) + *(p3++) ) >> 1 );
-+ while( ++p1 < pScanEnd );
-+ }
-+ break;
-+
-+ case 4: // Scanline Filter Type "PaethPredictor"
-+ {
-+ BYTE* p1 = mpInflateInBuf + 1;;
-+ const BYTE* p2 = mpScanPrior + 1;
-+ const BYTE* p3 = p1;
-+ const BYTE* p4 = p2;
-+
-+ // use one pixel from prior line
-+ for( int n = mnBPP; --n >= 0; )
-+ *(p1++) += *(p2++);
-+
-+ // predict by using the left and the prior line pixels
-+ do
-+ {
-+ int na = *(p2++);
-+ int nb = *(p3++);
-+ int nc = *(p4++);
-+
-+ int npa = nb - (int)nc;
-+ int npb = na - (int)nc;
-+ int npc = npa + npb;
-+
-+ if( npa < 0 )
-+ npa =-npa;
-+ if( npb < 0 )
-+ npb =-npb;
-+ if( npc < 0 )
-+ npc =-npc;
-+
-+ if( npa > npb )
-+ na = nb, npa = npb;
-+ if( npa > npc )
-+ na = nc;
-+
-+ *p1 += static_cast<BYTE>(na);
-+ }
-+ while( ++p1 < pScanEnd );
-+ }
-+ break;
-+ }
-
-- rtl_zeroMemory( mpScanprior, ++mnScansize );
-- break;
-- }
-+ rtl_copyMemory( mpScanPrior, mpInflateInBuf, mnScansize );
- }
-
- // ---------------------------------------------------------------------------------------------------
--// ImplGetFilter writes the complete Scanline (nY) - in interlace mode the parameter nXStart and nXAdd
--// appends to the currently used pass
--// the complete size of scanline will be returned - in interlace mode zero is possible!
-+// ImplDrawScanlines draws the complete Scanline (nY) into the target bitmap
-+// In interlace mode the parameter nXStart and nXAdd append to the currently used pass
-
--void PNGReaderImpl::ImplGetFilter ( sal_uInt32 nXStart, sal_uInt32 nXAdd )
-+void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
- {
-- BYTE* pTmp = mpInflateInBuf;
-- BYTE* p1;
-- BYTE* p2;
-- BYTE* p3;
-- BYTE* p4;
-- BYTE nFilterType;
-- BYTE nCol = 0;
-- sal_uInt32 nXIndex, nX, nY = mnYpos, n1, n2, na, nb, nc;
-- sal_Int32 np, npa, npb, npc;
-+ // optimization for downscaling
-+ if( mnYpos & mnPreviewMask )
-+ return;
-+ if( nXStart & mnPreviewMask )
-+ return;
-
-- sal_uInt32 nBBP = mnBBP;
-+ // convert nY to pixel units in the target image
-+ // => TODO; also do this for nX here instead of in the ImplSet*Pixel() methods
-+ const sal_uInt32 nY = mnYpos >> mnPreviewShift;
-
-- if ( nXStart < (sal_uInt32)mnWidth )
-+ const BYTE* pTmp = mpInflateInBuf + 1;
-+ if ( mpAcc->HasPalette() ) // alphachannel is not allowed by pictures including palette entries
- {
-- nFilterType = *pTmp++; // the filter type may change each scanline
--
-- switch ( nFilterType )
-+ switch ( mpAcc->GetBitCount() )
- {
- case 1 :
- {
-- p1 = pTmp + nBBP;
-- p2 = pTmp;
--
-- while ( p1 < pTmp + mnScansize - 1 )
-- ( *p1++ ) += ( *p2++ );
-- }
-- break;
--
-- case 2 :
-- {
-- p1 = pTmp;
-- p2 = mpScanprior+1;
--
-- while ( p1 < pTmp + mnScansize - 1 )
-- ( *p1++ ) += ( *p2++ );
-- }
-- break;
--
-- case 3 :
-- {
-- p1 = pTmp;
-- p2 = mpScanprior + 1;
-- p3 = pTmp-nBBP;
--
-- while ( p1 < pTmp + mnScansize - 1 )
-- {
-- n1 = (BYTE)( *p2++ );
-- n2 = ( p3 >= pTmp ) ? (BYTE)*p3 : 0;
-- p3++;
-- ( *p1++ ) += (BYTE)( ( n1 + n2 ) >> 1 );
-- }
-- }
-- break;
--
-- case 4 :
-- {
-- p1 = pTmp;
-- p2 = p1 - nBBP;
-- p3 = mpScanprior + 1;
-- p4 = p3 - nBBP;
--
-- while ( p1 < pTmp + mnScansize - 1 )
-+ if ( mbTransparent )
- {
-- nb = *p3++;
-- if ( p2 >= pTmp )
-+ for ( sal_uInt32 nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
- {
-- na = *p2;
-- nc = *p4;
-- }
-- else
-- na = nc = 0;
--
-- np = na + nb;
-- np -= nc;
-- npa = np - na;
-- npb = np - nb;
-- npc = np - nc;
--
-- if ( npa < 0 )
-- npa =-npa;
-- if ( npb < 0 )
-- npb =-npb;
-- if ( npc < 0 )
-- npc =-npc;
--
-- if ( ( npa <= npb ) && ( npa <= npc ) )
-- *p1++ += (BYTE)na;
-- else if ( npb <= npc )
-- *p1++ += (BYTE)nb;
-- else
-- *p1++ += (BYTE)nc;
-+ BYTE nCol;
-+ nShift = (nShift - 1) & 7;
-+ if ( nShift == 0 )
-+ nCol = ( *pTmp++ );
-+ else
-+ nCol = ( *pTmp >> nShift );
-+ nCol &= 1;
-
-- p2++;
-- p4++;
-- }
-- }
-- break;
-- // undefined FilterType -> we will let them pass and display the data unfiltered
-- }
-- if ( mpAcc->HasPalette() ) // alphachannel is not allowed by pictures including palette entries
-- {
-- switch ( mpAcc->GetBitCount() )
-- {
-- case 1 :
-- {
-- if ( mbTransparent )
-- {
-- for ( nX = nXStart, nXIndex = 0; nX < (sal_uInt32)mnWidth; nX += nXAdd, nXIndex++ )
-- {
-- sal_uInt32 nShift = ( nXIndex & 7 ) ^ 7;
--
-- if ( nShift == 0 )
-- nCol = ( *pTmp++ ) & 1;
-- else
-- nCol = ( *pTmp >> nShift ) & 1;
--
-- ImplSetPixel( nY, nX, nCol, mpTransTab[ nCol ] < PNG_TRANS_VAL );
-- }
-+ ImplSetTranspPixel( nY, nX, nCol, mpTransTab[ nCol ] < PNG_TRANS_VAL );
- }
-- else
-+ }
-+ else
-+ { // BMP_FORMAT_1BIT_MSB_PAL
-+ for ( sal_uInt32 nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
- {
-- for ( nX = nXStart, nXIndex = 0; nX < (sal_uInt32)mnWidth; nX += nXAdd, nXIndex++ )
-- {
-- sal_uInt32 nShift = ( nXIndex & 7 ) ^ 7;
-+ nShift = (nShift - 1) & 7;
-
-- if ( nShift == 0 )
-- ImplSetPixel( nY, nX, ( *pTmp++ & 1 ), FALSE );
-- else
-- ImplSetPixel( nY, nX, ( *pTmp >> nShift ) & 1, FALSE );
-- }
-+ if ( nShift == 0 )
-+ ImplSetPixel( nY, nX, ( *pTmp++ & 1 ) );
-+ else
-+ ImplSetPixel( nY, nX, ( *pTmp >> nShift ) & 1 );
- }
- }
-- break;
-+ }
-+ break;
-
-- case 4 :
-+ case 4 :
-+ {
-+ if ( mbTransparent )
- {
-- if ( mbTransparent )
-+ if ( mnBitDepth == 4 ) // maybe the source is a two bitmap graphic
- {
-- if ( mnBitDepth == 4 ) // maybe the source is a two bitmap graphic
-+ for ( sal_uInt32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, ++nXIndex )
- {
-- for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX += nXAdd, nXIndex++ )
-+ if( nXIndex & 1 )
- {
-- if( nXIndex & 1 )
-- {
-- ImplSetPixel( nY, nX, *pTmp & 0x0f, mpTransTab[ *pTmp & 0x0f ] < PNG_TRANS_VAL );
-- pTmp++;
-- }
-- else
-- {
-- ImplSetPixel( nY, nX, ( *pTmp >> 4 ) & 0x0f, mpTransTab[ *pTmp >> 4 ] < PNG_TRANS_VAL );
-- }
-+ ImplSetTranspPixel( nY, nX, *pTmp & 0x0f, mpTransTab[ *pTmp & 0x0f ] < PNG_TRANS_VAL );
-+ pTmp++;
- }
-- }
-- else
-- {
-- for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX += nXAdd, nXIndex++ )
-+ else
- {
-- switch( nXIndex & 3 )
-- {
-- case 0 :
-- nCol = *pTmp >> 6;
-- break;
--
-- case 1 :
-- nCol = ( *pTmp >> 4 ) & 0x03 ;
-- break;
--
-- case 2 :
-- nCol = ( *pTmp >> 2 ) & 0x03;
-- break;
--
-- case 3 :
-- nCol = ( *pTmp++ ) & 0x03;
-- break;
-- }
--
-- ImplSetPixel( nY, nX, nCol, mpTransTab[ nCol ] < PNG_TRANS_VAL );
-+ ImplSetTranspPixel( nY, nX, ( *pTmp >> 4 ) & 0x0f, mpTransTab[ *pTmp >> 4 ] < PNG_TRANS_VAL );
- }
- }
- }
- else
- {
-- if ( mnBitDepth == 4 ) // maybe the source is a two bitmap graphic
-+ for ( sal_uInt32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
- {
-- for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX += nXAdd, nXIndex++ )
-+ BYTE nCol;
-+ switch( nXIndex & 3 )
- {
-- if( nXIndex & 1 )
-- ImplSetPixel( nY, nX, *pTmp++ & 0x0f, FALSE );
-- else
-- ImplSetPixel( nY, nX, ( *pTmp >> 4 ) & 0x0f, FALSE );
-- }
-- }
-- else
-- {
-- for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX += nXAdd, nXIndex++ )
-- {
-- switch( nXIndex & 3 )
-- {
-- case 0 :
-- ImplSetPixel( nY, nX, *pTmp >> 6, FALSE );
-- break;
--
-- case 1 :
-- ImplSetPixel( nY, nX, ( *pTmp >> 4 ) & 0x03, FALSE );
-- break;
--
-- case 2 :
-- ImplSetPixel( nY, nX, ( *pTmp >> 2 ) & 0x03, FALSE );
-- break;
--
-- case 3 :
-- ImplSetPixel( nY, nX, *pTmp++ & 0x03, FALSE );
-- break;
-- }
-+ case 0 :
-+ nCol = *pTmp >> 6;
-+ break;
-+
-+ case 1 :
-+ nCol = ( *pTmp >> 4 ) & 0x03 ;
-+ break;
-+
-+ case 2 :
-+ nCol = ( *pTmp >> 2 ) & 0x03;
-+ break;
-+
-+ case 3 :
-+ nCol = ( *pTmp++ ) & 0x03;
-+ break;
-+
-+ default: // get rid of nCol uninitialized warning
-+ nCol = 0;
-+ break;
- }
-+
-+ ImplSetTranspPixel( nY, nX, nCol, mpTransTab[ nCol ] < PNG_TRANS_VAL );
- }
- }
- }
-- break;
--
-- case 8 :
-+ else
- {
-- if ( mbAlphaChannel )
-- {
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 2 )
-- ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 1 ] );
-- }
-- else
-+ if ( mnBitDepth == 4 ) // maybe the source is a two bitmap graphic
-+ { // BMP_FORMAT_4BIT_LSN_PAL
-+ for ( sal_uInt32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 4 )
-- ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 2 ] );
-+ if( nXIndex & 1 )
-+ ImplSetPixel( nY, nX, *pTmp++ & 0x0f );
-+ else
-+ ImplSetPixel( nY, nX, ( *pTmp >> 4 ) & 0x0f );
- }
- }
- else
- {
-- if ( mbTransparent )
-- {
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp++ )
-- ImplSetPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] < PNG_TRANS_VAL );
-- }
-- else
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 2 )
-- ImplSetPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] < PNG_TRANS_VAL );
-- }
-- }
-- else
-+ for ( sal_uInt32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
- {
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
-- {
-- if ( mnPass == 7 ) // mnPass == 7 -> no interlace or whole scanline is available
-- mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_8BIT_PAL, mnScansize -1 );
-- else
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd )
-- ImplSetPixel( nY, nX, *pTmp++, FALSE );
-- }
-- }
-- else
-+ switch( nXIndex & 3 )
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 2 )
-- ImplSetPixel( nY, nX, *pTmp, FALSE );
-+ case 0 :
-+ ImplSetPixel( nY, nX, *pTmp >> 6 );
-+ break;
-+
-+ case 1 :
-+ ImplSetPixel( nY, nX, ( *pTmp >> 4 ) & 0x03 );
-+ break;
-+
-+ case 2 :
-+ ImplSetPixel( nY, nX, ( *pTmp >> 2 ) & 0x03 );
-+ break;
-+
-+ case 3 :
-+ ImplSetPixel( nY, nX, *pTmp++ & 0x03 );
-+ break;
- }
- }
- }
- }
-- break;
--
-- default :
-- mbStatus = FALSE;
-- break;
- }
-- }
-- else
-- {
-- if ( mbAlphaChannel || mbTransparent )
-+ break;
-+
-+ case 8 :
- {
- if ( mbAlphaChannel )
- {
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit each sample
-+ if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
- {
-- if ( mpColorTable != mpDefaultColorTable )
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 4 )
-- ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-- mpColorTable[ pTmp[ 1 ] ],
-- mpColorTable[ pTmp[ 2 ] ] ), pTmp[ 3 ] );
-- }
-- else
-- {
--// if ( mnPass == 7 ) // mnPass == 7 -> no interlace or whole scanline is available
--// mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_32BIT_TC_RGBA, mnScansize -1 );
--// else
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 4 )
-- ImplSetAlphaPixel( nY, nX, BitmapColor( pTmp[ 0 ], pTmp[ 1 ], pTmp[ 2 ] ), pTmp[ 3 ] );
-- }
-- }
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 )
-+ ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 1 ] );
- }
- else
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 8 )
-- ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-- mpColorTable[ pTmp[ 2 ] ],
-- mpColorTable[ pTmp[ 4 ] ] ), pTmp[6] );
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
-+ ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 2 ] );
- }
- }
-- else // Transparency chunk
-+ else if ( mbTransparent )
- {
-- sal_Bool bTransparent;
-- sal_uInt8 nRed, nGreen, nBlue;
--
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit each sample
-+ if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 3 )
-- {
-- nRed = pTmp[ 0 ];
-- nGreen = pTmp[ 1 ];
-- nBlue = pTmp[ 2 ];
-- bTransparent = ( ( nRed == mnTransRed )
-- && ( nGreen == mnTransGreen )
-- && ( nBlue == mnTransBlue ) );
--
-- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
-- mpColorTable[ nGreen ],
-- mpColorTable[ nBlue ] ), bTransparent );
-- }
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp++ )
-+ ImplSetTranspPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] < PNG_TRANS_VAL );
- }
- else
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 6 )
-- {
-- nRed = pTmp[ 0 ];
-- nGreen = pTmp[ 2 ];
-- nBlue = pTmp[ 4 ];
-- bTransparent = ( ( nRed == mnTransRed )
-- && ( nGreen == mnTransGreen )
-- && ( nBlue == mnTransBlue ) );
--
-- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
-- mpColorTable[ nGreen ],
-- mpColorTable[ nBlue ] ), bTransparent );
-- }
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 )
-+ ImplSetTranspPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] < PNG_TRANS_VAL );
- }
- }
-- }
-- else
-- {
-- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit each sample
-+ else // neither alpha nor transparency
- {
-- if ( mpColorTable != mpDefaultColorTable )
-+ if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 3 )
-- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-- mpColorTable[ pTmp[ 1 ] ],
-- mpColorTable[ pTmp[ 2 ] ] ), FALSE );
-+ if( nXAdd == 1 ) // copy raw line data if possible
-+ {
-+ pTmp += nXStart;
-+ int nLineBytes = maOrigSize.Width() - nXStart;
-+ mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_8BIT_PAL, nLineBytes );
-+ pTmp += nLineBytes;
-+ }
-+ else
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd )
-+ ImplSetPixel( nY, nX, *pTmp++ );
-+ }
- }
- else
- {
-- if ( mnPass == 7 ) // mnPass == 7 -> no interlace or whole scanline is available
-- mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_24BIT_TC_RGB, mnScansize -1 );
-- else
-- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 3 )
-- ImplSetPixel( nY, nX, BitmapColor( pTmp[ 0 ], pTmp[ 1 ], pTmp[ 2 ] ), FALSE );
-- }
--
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 )
-+ ImplSetPixel( nY, nX, *pTmp );
- }
- }
-- else
-+ }
-+ break;
-+
-+ default :
-+ mbStatus = FALSE;
-+ break;
-+ }
-+ }
-+ else // no palette => truecolor
-+ {
-+ if( mbAlphaChannel ) // has RGB + alpha
-+ { // BMP_FORMAT_32BIT_TC_RGBA
-+ if ( mnBitDepth == 8 ) // maybe the source has 16 bit per sample
-+ {
-+ if ( mpColorTable != mpDefaultColorTable )
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
-+ ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-+ mpColorTable[ pTmp[ 1 ] ],
-+ mpColorTable[ pTmp[ 2 ] ] ), pTmp[ 3 ] );
-+ }
-+ else
-+ {
-+// if ( nXAdd == 1 ) // copy raw line data if possible
-+// {
-+// pTmp += 4 * nXStart;
-+// int nLineBytes = 4 * (maOrigSize.Width() - nXStart);
-+// mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_32BIT_TC_RGBA, nLineBytes );
-+// pTmp += nLineBytes;
-+// }
-+// else
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
-+ ImplSetAlphaPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ), pTmp[3] );
-+ }
-+ }
-+ }
-+ else
-+ { // BMP_FORMAT_64BIT_TC_RGBA
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 )
-+ ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-+ mpColorTable[ pTmp[ 2 ] ],
-+ mpColorTable[ pTmp[ 4 ] ] ), pTmp[6] );
-+ }
-+ }
-+ else if( mbTransparent ) // has RGB + transparency
-+ { // BMP_FORMAT_24BIT_TC_RGB
-+ if ( mnBitDepth == 8 ) // maybe the source has 16 bit per sample
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
-+ {
-+ sal_uInt8 nRed = pTmp[ 0 ];
-+ sal_uInt8 nGreen = pTmp[ 1 ];
-+ sal_uInt8 nBlue = pTmp[ 2 ];
-+ sal_Bool bTransparent = ( ( nRed == mnTransRed )
-+ && ( nGreen == mnTransGreen )
-+ && ( nBlue == mnTransBlue ) );
-+
-+ ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
-+ mpColorTable[ nGreen ],
-+ mpColorTable[ nBlue ] ), bTransparent );
-+ }
-+ }
-+ else
-+ { // BMP_FORMAT_48BIT_TC_RGB
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
- {
-- for ( nX = nXStart; nX < mnWidth; nX += nXAdd, pTmp += 6 )
-- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-- mpColorTable[ pTmp[ 2 ] ],
-- mpColorTable[ pTmp[ 4 ] ] ), FALSE );
-+ sal_uInt8 nRed = pTmp[ 0 ];
-+ sal_uInt8 nGreen = pTmp[ 2 ];
-+ sal_uInt8 nBlue = pTmp[ 4 ];
-+ sal_Bool bTransparent = ( ( nRed == mnTransRed )
-+ && ( nGreen == mnTransGreen )
-+ && ( nBlue == mnTransBlue ) );
-+
-+ ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
-+ mpColorTable[ nGreen ],
-+ mpColorTable[ nBlue ] ), bTransparent );
- }
- }
- }
-+ else // has RGB but neither alpha nor transparency
-+ { // BMP_FORMAT_24BIT_TC_RGB
-+ if ( mnBitDepth == 8 ) // maybe the source has 16 bit per sample
-+ {
-+ if ( mpColorTable != mpDefaultColorTable )
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
-+ ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-+ mpColorTable[ pTmp[ 1 ] ],
-+ mpColorTable[ pTmp[ 2 ] ] ) );
-+ }
-+ else
-+ {
-+ if( nXAdd == 1 ) // copy raw line data if possible
-+ {
-+ pTmp += 3 * nXStart;
-+ int nLineBytes = (maOrigSize.Width() - nXStart) * 3;
-+ mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_24BIT_TC_RGB, nLineBytes );
-+ pTmp += nLineBytes;
-+ }
-+ else
-+ {
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
-+ ImplSetPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ) );
-+ }
-+ }
-+ }
-+ else
-+ { // BMP_FORMAT_48BIT_TC_RGB
-+ for ( sal_uInt32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
-+ ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
-+ mpColorTable[ pTmp[ 2 ] ],
-+ mpColorTable[ pTmp[ 4 ] ] ) );
-+ }
-+ }
- }
--
-- rtl_copyMemory( mpScanprior, mpInflateInBuf, mnScansize );
- }
-
- // ------------------------------------------------------------------------
-
--void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor, BOOL bTrans )
-+void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor )
- {
-- if ( mnPass == 7 )
-- {
-- mpAcc->SetPixel( nY, nX, rBitmapColor );
--
-- if ( bTrans )
-- mpMaskAcc->SetPixel( nY, nX, cTransIndex1 );
-- else
-- mpMaskAcc->SetPixel( nY, nX, cNonTransIndex1 );
-- }
-- else
-- {
-- sal_uInt32 nTX;
--
-- for ( int nBHeight = 0; nBHeight < aBlockHeight[ mnPass ]; nBHeight++ )
-- {
-- nTX = nX;
--
-- for ( int nBWidth = 0; nBWidth < aBlockWidth[ mnPass ]; nBWidth++ )
-- {
-- mpAcc->SetPixel( nY, nTX, rBitmapColor );
--
-- if ( bTrans )
-- mpMaskAcc->SetPixel( nY, nTX, cTransIndex1 );
-- else
-- mpMaskAcc->SetPixel( nY, nTX, cNonTransIndex1 );
--
-- if ( ++nTX == mnWidth )
-- break;
-- }
--
-- if ( ++nY == mnHeight )
-- break;
-- }
-- }
-+ if( nX & mnPreviewMask )
-+ return;
-+ nX >>= mnPreviewShift;
-+ mpAcc->SetPixel( nY, nX, rBitmapColor );
- }
-
- // ------------------------------------------------------------------------
-
--void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, BYTE nPalIndex, BOOL bTrans )
-+void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, BYTE nPalIndex )
- {
-- if ( mnPass == 7 )
-- {
-- mpAcc->SetPixel( nY, nX, (BYTE)nPalIndex );
--
-- if ( bTrans )
-- mpMaskAcc->SetPixel( nY, nX, cTransIndex1 );
-- else
-- mpMaskAcc->SetPixel( nY, nX, cNonTransIndex1 );
-- }
-- else
-- {
-- sal_uInt32 nTX;
-+ if( nX & mnPreviewMask )
-+ return;
-+ nX >>= mnPreviewShift;
-+ mpAcc->SetPixel( nY, nX, nPalIndex );
-+}
-
-- for ( int nBHeight = 0; nBHeight < aBlockHeight[ mnPass ]; nBHeight++ )
-- {
-- nTX = nX;
-+// ------------------------------------------------------------------------
-
-- for ( int nBWidth = 0; nBWidth < aBlockWidth[ mnPass ]; nBWidth++ )
-- {
-- mpAcc->SetPixel( nY, nTX, (BYTE)nPalIndex );
-+void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor, BOOL bTrans )
-+{
-+ if( nX & mnPreviewMask )
-+ return;
-+ nX >>= mnPreviewShift;
-+
-+ mpAcc->SetPixel( nY, nX, rBitmapColor );
-+
-+ if ( bTrans )
-+ mpMaskAcc->SetPixel( nY, nX, mcTranspColor );
-+ else
-+ mpMaskAcc->SetPixel( nY, nX, mcOpaqueColor );
-+}
-
-- if ( bTrans )
-- mpMaskAcc->SetPixel( nY, nTX, cTransIndex1 );
-- else
-- mpMaskAcc->SetPixel( nY, nTX, cNonTransIndex1 );
-+// ------------------------------------------------------------------------
-
-- if ( ++nTX == mnWidth )
-- break;
-- }
-- if ( ++nY == mnHeight )
-- break;
-- }
-- }
-+void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, BYTE nPalIndex, BOOL bTrans )
-+{
-+ if( nX & mnPreviewMask )
-+ return;
-+ nX >>= mnPreviewShift;
-+
-+ mpAcc->SetPixel( nY, nX, nPalIndex );
-+
-+ if ( bTrans )
-+ mpMaskAcc->SetPixel( nY, nX, mcTranspColor );
-+ else
-+ mpMaskAcc->SetPixel( nY, nX, mcOpaqueColor );
- }
-
- // ------------------------------------------------------------------------
-
- void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX, const BitmapColor& rBitmapColor, BYTE nAlpha )
- {
-- if ( mnPass == 7 )
-- {
-- mpAcc->SetPixel( nY, nX, rBitmapColor );
-- mpMaskAcc->SetPixel( nY, nX, 255 - nAlpha );
-- }
-- else
-- {
-- sal_uInt32 nTX;
-+ if( nX & mnPreviewMask )
-+ return;
-+ nX >>= mnPreviewShift;
-
-- for ( int nBHeight = 0; nBHeight < aBlockHeight[ mnPass ]; nBHeight++ )
-- {
-- nTX = nX;
--
-- for ( int nBWidth = 0; nBWidth < aBlockWidth[ mnPass ]; nBWidth++ )
-- {
-- mpAcc->SetPixel( nY, nTX, rBitmapColor );
-- mpMaskAcc->SetPixel( nY, nTX, 255 - nAlpha );
-- if ( ++nTX == mnWidth )
-- break;
-- }
--
-- if ( ++nY == mnHeight )
-- break;
-- }
-- }
-+ mpAcc->SetPixel( nY, nX, rBitmapColor );
-+ mpMaskAcc->SetPixel( nY, nX, 255 - nAlpha );
- }
-
- // ------------------------------------------------------------------------
-@@ -1498,16 +1492,18 @@ PNGReader::~PNGReader()
-
- // ------------------------------------------------------------------------
-
-+Size PNGReader::aPreviewSizeHint;
-+
- BitmapEx PNGReader::Read()
- {
-- return mpImpl->Read();
-+ return mpImpl->GetBitmapEx( aPreviewSizeHint );
- }
-
- // ------------------------------------------------------------------------
-
- const std::vector< vcl::PNGReader::ChunkData >& PNGReader::GetChunks() const
- {
-- return mpImpl->maChunkSeq;
-+ return mpImpl->GetAllChunks();
- }
-
- } // namespace vcl
diff --git a/patches/test/slidesorter-demo-sd.diff b/patches/test/slidesorter-demo-sd.diff
deleted file mode 100644
index 1b9d58dc3..000000000
--- a/patches/test/slidesorter-demo-sd.diff
+++ /dev/null
@@ -1,89 +0,0 @@
-Index: sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx,v
-retrieving revision 1.6
-diff -u -p -r1.6 SlsQueueProcessor.cxx
---- sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx 24 Oct 2005 07:41:45 -0000 1.6
-+++ sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx 1 Dec 2005 14:18:23 -0000
-@@ -42,8 +42,8 @@ namespace sd { namespace slidesorter { n
- //===== QueueProcessorBase ===================================================
-
- QueueProcessorBase::QueueProcessorBase (void)
-- : mnTimeBetweenHighPriorityRequests (10/*ms*/),
-- mnTimeBetweenLowPriorityRequests (100/*ms*/),
-+ : mnTimeBetweenHighPriorityRequests (1/*ms*/),
-+ mnTimeBetweenLowPriorityRequests (10/*ms*/),
- mnTimeBetweenRequestsWhenNotIdle (1000/*ms*/)
- {
- // Look into the configuration if there for overriding values.
-@@ -63,7 +63,11 @@ QueueProcessorBase::QueueProcessorBase (
- if (aTimeBetweenReqeusts.has<sal_Int32>())
- aTimeBetweenReqeusts >>= mnTimeBetweenRequestsWhenNotIdle;
-
-+ mnTimeBetweenHighPriorityRequests = 10;
-+ mnTimeBetweenLowPriorityRequests = 20;
-+
- maTimer.SetTimeoutHdl (LINK(this,QueueProcessorBase,ProcessRequest));
-+ OSL_TRACE("Set slide sorter timeout %dms", mnTimeBetweenHighPriorityRequests);
- maTimer.SetTimeout (mnTimeBetweenHighPriorityRequests);
- }
-
-@@ -74,10 +78,13 @@ void QueueProcessorBase::Start (int nPri
- {
- if ( ! maTimer.IsActive())
- {
-- if (nPriorityClass == 0)
-+ if (nPriorityClass == 0) {
-+ OSL_TRACE("Set slide sorter timeout %dms", mnTimeBetweenHighPriorityRequests);
- maTimer.SetTimeout (mnTimeBetweenHighPriorityRequests);
-- else
-+ } else {
-+ OSL_TRACE("Set slide sorter timeout %dms", mnTimeBetweenLowPriorityRequests);
- maTimer.SetTimeout (mnTimeBetweenLowPriorityRequests);
-+ }
- maTimer.Start();
- }
- }
-Index: sd/source/ui/slidesorter/view/SlideSorterView.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/slidesorter/view/SlideSorterView.cxx,v
-retrieving revision 1.13
-diff -u -p -r1.13 SlideSorterView.cxx
---- sd/source/ui/slidesorter/view/SlideSorterView.cxx 24 Oct 2005 07:44:36 -0000 1.13
-+++ sd/source/ui/slidesorter/view/SlideSorterView.cxx 1 Dec 2005 14:18:23 -0000
-@@ -74,6 +74,8 @@
- #include <algorithm>
- #include <svx/sdr/contact/objectcontact.hxx>
-
-+#include <vcl/pngread.hxx>
-+
- using namespace std;
- using namespace ::sd::slidesorter::model;
-
-Index: sd/source/ui/tools/PreviewRenderer.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/tools/PreviewRenderer.cxx,v
-retrieving revision 1.6
-diff -u -p -r1.6 PreviewRenderer.cxx
---- sd/source/ui/tools/PreviewRenderer.cxx 9 Sep 2005 06:44:56 -0000 1.6
-+++ sd/source/ui/tools/PreviewRenderer.cxx 1 Dec 2005 14:18:23 -0000
-@@ -41,6 +41,7 @@
- #include "sdpage.hxx"
- #include "ViewShell.hxx"
- #include <vcl/virdev.hxx>
-+#include <vcl/pngread.hxx>
- #include <svx/svdpagv.hxx>
- #include <svx/svdoutl.hxx>
- #include <svx/eeitem.hxx>
-@@ -112,7 +113,11 @@ Image PreviewRenderer::RenderPage (
- {
- if (Initialize (pPage, aPixelSize))
- {
-+ OSL_TRACE("set preview to %dx%d", aPixelSize.Width(), aPixelSize.Height());
-+ vcl::PNGReader::SetPreviewSizeHint( Size( aPixelSize.Width(), 0) );
- PaintPage (pPage);
-+ vcl::PNGReader::DisablePreviewMode();
-+
- PaintSubstitutionText (rSubstitutionText);
- PaintFrame();
-
diff --git a/patches/test/slidesorter-demo-svtools.diff b/patches/test/slidesorter-demo-svtools.diff
deleted file mode 100644
index ca8602c9f..000000000
--- a/patches/test/slidesorter-demo-svtools.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-Index: svtools/source/filter.vcl/filter/filter.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/filter.vcl/filter/filter.cxx,v
-retrieving revision 1.58.14.1
-diff -u -p -r1.58.14.1 filter.cxx
---- svtools/source/filter.vcl/filter/filter.cxx 14 Oct 2005 12:54:49 -0000 1.58.14.1
-+++ svtools/source/filter.vcl/filter/filter.cxx 1 Dec 2005 14:54:18 -0000
-@@ -1451,8 +1451,6 @@ USHORT GraphicFilter::ImportGraphic( Gra
- }
- else
- {
-- vcl::PNGReader::DisablePreviewMode();
--
- // check if this PNG contains a GIF chunk!
- const std::vector< vcl::PNGReader::ChunkData >& rChunkData = aPNGReader.GetChunks();
- std::vector< vcl::PNGReader::ChunkData >::const_iterator aIter( rChunkData.begin() );
-@@ -1487,6 +1485,8 @@ USHORT GraphicFilter::ImportGraphic( Gra
- eLinkType = GFX_LINK_TYPE_NATIVE_PNG;
- }
- }
-+ if( nImportFlags & GRFILTER_I_FLAGS_FOR_PREVIEW )
-+ vcl::PNGReader::DisablePreviewMode();
- }
- else if( aFilterName.EqualsIgnoreCaseAscii( IMP_JPEG ) )
- {
diff --git a/patches/test/slidesorter-demo-vcl.diff b/patches/test/slidesorter-demo-vcl.diff
deleted file mode 100644
index 7f59a09d3..000000000
--- a/patches/test/slidesorter-demo-vcl.diff
+++ /dev/null
@@ -1,95 +0,0 @@
-Index: vcl/inc/pngread.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/pngread.hxx,v
-retrieving revision 1.5.18.2
-diff -u -p -r1.5.18.2 pngread.hxx
---- vcl/inc/pngread.hxx 13 Oct 2005 10:18:52 -0000 1.5.18.2
-+++ vcl/inc/pngread.hxx 1 Dec 2005 14:46:25 -0000
-@@ -77,7 +77,7 @@ namespace vcl
- // TODO: when incompatible changes are possible again
- // the preview size hint should be redone
- static void SetPreviewSizeHint( const Size& r ) { aPreviewSizeHint = r; }
-- static void DisablePreviewMode() { aPreviewSizeHint = Size(0,0); }
-+ static void DisablePreviewMode() { OSL_TRACE("preview hint disabled"); aPreviewSizeHint = Size(0,0); }
- private:
- static Size aPreviewSizeHint;
- };
-Index: vcl/source/gdi/pngread.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/pngread.cxx,v
-retrieving revision 1.10.18.14
-diff -u -p -r1.10.18.14 pngread.cxx
---- vcl/source/gdi/pngread.cxx 15 Nov 2005 09:59:48 -0000 1.10.18.14
-+++ vcl/source/gdi/pngread.cxx 1 Dec 2005 14:46:25 -0000
-@@ -615,18 +615,34 @@ BOOL PNGReaderImpl::ImplReadHeader( cons
- mpScanPrior = new BYTE[ mnScansize ];
-
- // calculate target size from original size and the preview hint
-- if( rPreviewSizeHint.Width() && rPreviewSizeHint.Height() )
-+ if( rPreviewSizeHint.Width() || rPreviewSizeHint.Height() )
- {
-+ Size aPreviewSize( rPreviewSizeHint.Width(), rPreviewSizeHint.Height() );
- maTargetSize = maOrigSize;
-- for( int i = 1; i < 5; ++i )
-- {
-- if( (maTargetSize.Width() >> i) < rPreviewSizeHint.Width() )
-- break;
-- if( (maTargetSize.Height() >> i) < rPreviewSizeHint.Height() )
-- break;
-- mnPreviewShift = i;
-- }
-- mnPreviewMask = (1 << mnPreviewShift) - 1;
-+
-+ if( aPreviewSize.Width() == 0 ) {
-+ aPreviewSize.setWidth( ( maOrigSize.Width()*aPreviewSize.Height() )/maOrigSize.Height() );
-+ if( aPreviewSize.Width() <= 0 )
-+ aPreviewSize.setWidth( 1 );
-+ } else if( aPreviewSize.Height() == 0 ) {
-+ aPreviewSize.setHeight( ( maOrigSize.Height()*aPreviewSize.Width() )/maOrigSize.Width() );
-+ if( aPreviewSize.Height() <= 0 )
-+ aPreviewSize.setHeight( 1 );
-+ }
-+
-+ if( aPreviewSize.Width() < maOrigSize.Width() && aPreviewSize.Height() < maOrigSize.Height() ) {
-+ OSL_TRACE("preview size %dx%d", aPreviewSize.Width(), aPreviewSize.Height() );
-+
-+ for( int i = 1; i < 5; ++i )
-+ {
-+ if( (maTargetSize.Width() >> i) < aPreviewSize.Width() )
-+ break;
-+ if( (maTargetSize.Height() >> i) < aPreviewSize.Height() )
-+ break;
-+ mnPreviewShift = i;
-+ }
-+ mnPreviewMask = (1 << mnPreviewShift) - 1;
-+ }
- }
-
- maTargetSize.Width() = (maOrigSize.Width() + mnPreviewMask) >> mnPreviewShift;
-@@ -1256,7 +1272,7 @@ void PNGReaderImpl::ImplDrawScanline( sa
- {
- if ( mnBitDepth == 8 ) // maybe the source is a 16 bit grayscale
- {
-- if( nXAdd == 1 ) // copy raw line data if possible
-+ if( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible
- {
- pTmp += nXStart;
- int nLineBytes = maOrigSize.Width() - nXStart;
-@@ -1298,7 +1314,7 @@ void PNGReaderImpl::ImplDrawScanline( sa
- }
- else
- {
--// if ( nXAdd == 1 ) // copy raw line data if possible
-+// if ( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible
- // {
- // pTmp += 4 * nXStart;
- // int nLineBytes = 4 * (maOrigSize.Width() - nXStart);
-@@ -1368,7 +1384,7 @@ void PNGReaderImpl::ImplDrawScanline( sa
- }
- else
- {
-- if( nXAdd == 1 ) // copy raw line data if possible
-+ if( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible
- {
- pTmp += 3 * nXStart;
- int nLineBytes = (maOrigSize.Width() - nXStart) * 3;
diff --git a/patches/test/speed-except-codemaker.diff b/patches/test/speed-except-codemaker.diff
deleted file mode 100644
index a86a060e5..000000000
--- a/patches/test/speed-except-codemaker.diff
+++ /dev/null
@@ -1,501 +0,0 @@
-Index: codemaker/source/cppumaker/cppumaker.cxx
-===================================================================
-RCS file: /cvs/udk/codemaker/source/cppumaker/cppumaker.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 cppumaker.cxx
---- codemaker/source/cppumaker/cppumaker.cxx 8 Sep 2005 02:11:34 -0000 1.8
-+++ codemaker/source/cppumaker/cppumaker.cxx 28 Mar 2006 08:54:32 -0000
-@@ -180,6 +180,10 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
- exit(99);
- }
-
-+ // iNternal - sucky but -I has a well defined meaning.
-+ if (options.isValid("-N"))
-+ do_internal = true;
-+
- if (options.isValid("-B"))
- {
- typeMgr.setBase(options.getOption("-B"));
-@@ -245,6 +249,36 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
- exit(99);
- }
-
-+ if (!aIncludes.empty() && options.isValid("-O"))
-+ {
-+ OString outPath = options.getOption("-O");
-+ outPath += "/catch.hxx";
-+ FILE *excepts = fopen (outPath, "w+");
-+ fprintf (excepts, "// This file is autogenerated by cppumaker\n");
-+ fprintf (excepts, "// include exception headers\n");
-+
-+ ::std::list<rtl::OString>::const_iterator iter;
-+
-+ for (iter = aIncludes.begin(); iter != aIncludes.end(); iter++)
-+ {
-+ rtl::OString aStr = *iter;
-+ fprintf (excepts, "#include <%s.hpp>\n", (const sal_Char *) aStr);
-+ }
-+
-+ fprintf (excepts, "// dummy method\n");
-+ fprintf (excepts, "extern void force_emit ()\n");
-+ fprintf (excepts, "{\n");
-+ for (iter = aExceptionNames.begin(); iter != aExceptionNames.end(); iter++) {
-+ fprintf (excepts, " try {\n");
-+ fprintf (excepts, " force_emit ();\n");
-+ fprintf (excepts, " }\n");
-+ rtl::OString aStr = *iter;
-+ fprintf (excepts, "catch (const %s &r) {} \n", (const sal_Char *)aStr);
-+ }
-+ fprintf (excepts, "}\n\n");
-+ fclose (excepts);
-+ }
-+
- return 0;
- }
-
-Index: codemaker/source/cppumaker/cppuoptions.cxx
-===================================================================
-RCS file: /cvs/udk/codemaker/source/cppumaker/cppuoptions.cxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 cppuoptions.cxx
---- codemaker/source/cppumaker/cppuoptions.cxx 8 Sep 2005 02:11:54 -0000 1.9
-+++ codemaker/source/cppumaker/cppuoptions.cxx 28 Mar 2006 08:54:32 -0000
-@@ -71,6 +71,9 @@ sal_Bool CppuOptions::initOptions(int ac
- {
- switch (av[i][1])
- {
-+ case 'N':
-+ m_options["-N"] = OString("");
-+ break;
- case 'O':
- if (av[i][2] == '\0')
- {
-Index: codemaker/source/cppumaker/cpputype.cxx
-===================================================================
-RCS file: /cvs/udk/codemaker/source/cppumaker/cpputype.cxx,v
-retrieving revision 1.37
-diff -u -p -u -r1.37 cpputype.cxx
---- codemaker/source/cppumaker/cpputype.cxx 26 Jan 2006 17:42:38 -0000 1.37
-+++ codemaker/source/cppumaker/cpputype.cxx 28 Mar 2006 08:54:34 -0000
-@@ -56,6 +56,12 @@
-
- using namespace rtl;
-
-+::std::list<rtl::OString> aExceptionNames;
-+::std::list<rtl::OString> aIncludes;
-+
-+// This sucks - but ...
-+bool do_internal = false;
-+
- namespace {
-
- rtl::OString translateSimpleUnoType(rtl::OString const & unoType) {
-@@ -322,9 +328,11 @@ void CppuType::addGetCppuTypeIncludes(co
- }
- }
-
--bool CppuType::dumpFiles(CppuOptions * options, rtl::OString const & outPath) {
-+bool CppuType::dumpFiles(CppuOptions * options, rtl::OString const & outPath)
-+{
-+ aIncludes.insert(aIncludes.end(), m_typeName);
- return dumpFile(options, ".hdl", m_typeName, outPath)
-- && dumpFile(options, ".hpp", m_typeName, outPath);
-+ && dumpFile(options, ".hpp", m_typeName, outPath);
- }
-
- void CppuType::addLightGetCppuTypeIncludes(
-@@ -357,7 +365,8 @@ void CppuType::dumpTemplateHead(FileStre
-
- void CppuType::dumpTemplateParameters(FileStream &) const {}
-
--void CppuType::dumpGetCppuTypePreamble(FileStream & out) {
-+void CppuType::dumpGetCppuTypePreamble(FileStream & out)
-+{
- if (isPolymorphic()) {
- out << "namespace cppu {\n\n";
- dumpTemplateHead(out);
-@@ -367,17 +376,30 @@ void CppuType::dumpGetCppuTypePreamble(F
- out << " > {\npublic:\n";
- inc();
- out << indent()
-- << "static inline ::com::sun::star::uno::Type const & get() {\n";
-+ << "static inline ::com::sun::star::uno::Type const & get()\n";
-+ out << "{\n";
-+ // FIXME: ignore 'internal' for now; needs re-work
- } else {
- if (codemaker::cppumaker::dumpNamespaceOpen(out, m_typeName, false)) {
- out << "\n\n";
- }
-- out << ("inline ::com::sun::star::uno::Type const &"
-- " cppu_detail_getUnoType(");
-+ if (!do_internal)
-+ out << "inline";
-+ out << (" ::com::sun::star::uno::Type const & cppu_detail_getUnoType(");
- dumpType(out, m_typeName, false, false, true);
-- out << " const *) {\n";
-+ out << " const *)";
-+
-+ out << "\n";
-+ if (do_internal) {
-+ out << "#ifndef CPPU_INTERNAL_IMPL\n";
-+ out << ";\n";
-+ if (codemaker::cppumaker::dumpNamespaceClose(out, m_typeName, false))
-+ out << "\n";
-+ out << "#else // CPPU_INTERNAL_IMPL\n";
-+ }
-+ out << "{\n";
- }
-- inc();
-+ inc();
- }
-
- void CppuType::dumpGetCppuTypePostamble(FileStream & out) {
-@@ -393,6 +415,8 @@ void CppuType::dumpGetCppuTypePostamble(
- if (codemaker::cppumaker::dumpNamespaceClose(out, m_typeName, false)) {
- out << "\n\n";
- }
-+ if (do_internal)
-+ out << "#endif // CPPU_INTERNAL_IMPL\n";
- }
- dumpTemplateHead(out);
- out << "inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(";
-@@ -443,7 +467,7 @@ sal_Bool CppuType::dumpFile(CppuOptions*
- sal_Bool ret = sal_False;
-
- OString sTmpExt(".tml");
-- sal_Bool bHdl = sal_True; ;
-+ sal_Bool bHdl = sal_True;
- if (sExtension.equals(".hpp")) {
- sTmpExt = ".tmp";
- bHdl = sal_False;
-@@ -2432,8 +2456,8 @@ sal_Bool ConstantsType::dumpDeclaration(
- m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
-
- o << "static const ";
-- dumpType(o, fieldType);
-- o << " " << fieldName << " = ";
-+ dumpType(o, fieldType);
-+ o << " " << translateIdentifier(fieldName, "const", false) << " = ";
- dumpConstantValue(o, i);
- o << ";\n";
- }
-@@ -2489,6 +2513,7 @@ ModuleType::~ModuleType()
- bool ModuleType::dumpFiles(
- CppuOptions * options, rtl::OString const & outPath)
- {
-+ aIncludes.insert(aIncludes.end(), m_typeName);
- rtl::OString tmpName(m_typeName);
- if (tmpName.equals("/")) {
- tmpName = "global";
-@@ -2792,7 +2817,11 @@ sal_Bool StructureType::dumpHxxFile(
- }
-
- o << "\n";
-+ if (do_internal)
-+ o << "// struct no #ifdef CPPU_INTERNAL_IMPL\n";
- dumpGetCppuType(o);
-+ if (do_internal)
-+ o << "// struct no #endif // CPPU_INTERNAL_IMPL\n";
-
- o << "\n#endif // "<< headerDefine << "\n";
-
-@@ -3265,6 +3294,16 @@ sal_Bool ExceptionType::dumpHFile(
- return sal_True;
- }
-
-+bool
-+ExceptionType::dumpFiles(CppuOptions * options, rtl::OString const & outPath)
-+{
-+ OString aTypeName = scopedName (OString(), m_typeName);
-+ aExceptionNames.insert(aExceptionNames.end(), aTypeName);
-+
-+ aIncludes.insert(aIncludes.end(), m_typeName);
-+ return CppuType::dumpFiles (options, outPath);
-+}
-+
- sal_Bool ExceptionType::dumpDeclaration(FileStream& o)
- throw( CannotDumpException )
- {
-@@ -3364,7 +3403,17 @@ sal_Bool ExceptionType::dumpHxxFile(
- addDefaultHxxIncludes(includes);
- includes.dump(o, &m_typeName);
- o << "\n";
--
-+
-+// Exceptions are *extremely* strange, throwing one seems to
-+// require a GOTOFF relocation: no idea why; possibly we need a
-+// 'throwIt' method or something stupid to overcome that (?)
-+#ifdef VERY_ODD
-+ if (do_internal) {
-+ o << "#ifdef CPPU_INTERNAL_IMPL\n";
-+ o << "// ExceptionType::dumpHxxFile impl\n";
-+ }
-+#endif
-+
- if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
- o << "\n";
- }
-@@ -3539,6 +3588,10 @@ sal_Bool ExceptionType::dumpHxxFile(
-
- o << "\n";
- dumpGetCppuType(o);
-+#ifdef VERY_ODD
-+ if (do_internal)
-+ o << "\n#endif // CPPU_INTERNAL_IMPL\n";
-+#endif
-
- o << "\n#endif // "<< headerDefine << "\n";
- return sal_True;
-@@ -3696,7 +3749,11 @@ sal_Bool EnumType::dumpHxxFile(
- includes.dump(o, &m_typeName);
- o << "\n";
-
-+ if (do_internal)
-+ o << "// enum: no #ifdef CPPU_INTERNAL_IMPL\n";
- dumpGetCppuType(o);
-+ if (do_internal)
-+ o << "// enum no #endif // CPPU_INTERNAL_IMPL\n";
-
- o << "\n#endif // "<< headerDefine << "\n";
- return sal_True;
-@@ -3890,6 +3947,7 @@ sal_Bool ConstructiveType::dumpHFile(
- bool ConstructiveType::dumpFiles(
- CppuOptions * options, rtl::OString const & outPath)
- {
-+ aIncludes.insert(aIncludes.end(), m_typeName);
- return dumpFile(options, ".hpp", m_typeName, outPath);
- }
-
-@@ -3921,6 +3979,67 @@ bool ServiceType::isSingleInterfaceBased
- return m_reader.getSuperTypeCount() == 1;
- }
-
-+void ServiceType::dumpCtorSignature(FileStream & o,
-+ const OString & cppName,
-+ bool impl, int i)
-+ throw (CannotDumpException)
-+{
-+ OString aNameSpace;
-+ if (impl)
-+ aNameSpace = cppName + "::";
-+
-+ rtl::OString baseName(
-+ rtl::OUStringToOString(
-+ m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
-+ rtl::OString scopedBaseName(scopedName(rtl::OString(), baseName));
-+
-+ o << indent() << (impl ? "" : "static ");
-+ if (isDefaultConstructor(i)) {
-+ o << "::com::sun::star::uno::Reference< "
-+ << scopedBaseName << " > "
-+ << aNameSpace
-+ << translateIdentifier("create", "method", false, &cppName)
-+ << ("(::com::sun::star::uno::Reference<"
-+ " ::com::sun::star::uno::XComponentContext > const &"
-+ " the_context)");
-+ } else {
-+ o << "::com::sun::star::uno::Reference< "
-+ << scopedBaseName << " > "
-+ << aNameSpace
-+ << translateIdentifier(
-+ rtl::OUStringToOString(
-+ m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8),
-+ "method", false, &cppName)
-+ << ("(::com::sun::star::uno::Reference<"
-+ " ::com::sun::star::uno::XComponentContext > const &"
-+ " the_context");
-+ sal_uInt16 params = m_reader.getMethodParameterCount(i);
-+ for (sal_uInt16 j = 0; j < params; ++j) {
-+ o << ", ";
-+ rtl::OStringBuffer buf;
-+ if ((m_reader.getMethodParameterFlags(i, j) & RT_PARAM_REST)
-+ != 0)
-+ {
-+ buf.append(RTL_CONSTASCII_STRINGPARAM("[]"));
-+ }
-+ buf.append(
-+ rtl::OUStringToOString(
-+ m_reader.getMethodParameterTypeName(i, j),
-+ RTL_TEXTENCODING_UTF8));
-+ rtl::OString type(buf.makeStringAndClear());
-+ bool byRef = passByReference(type);
-+ dumpType(o, type, byRef, byRef);
-+ o << " "
-+ << translateIdentifier(
-+ rtl::OUStringToOString(
-+ m_reader.getMethodParameterName(i, j),
-+ RTL_TEXTENCODING_UTF8),
-+ "param", false);
-+ }
-+ o << ")\n";
-+ }
-+}
-+
- sal_Bool ServiceType::dumpHxxFile(
- FileStream & o, codemaker::cppumaker::Includes & includes)
- throw (CannotDumpException)
-@@ -3983,27 +4102,40 @@ sal_Bool ServiceType::dumpHxxFile(
- o << "\n";
- includes.dump(o, 0);
- o << "\n";
-+
- if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
- o << "\n";
- }
- o << "\nclass " << cppName << " {\n";
- inc();
- if (ctors > 0) {
-+ o << "public:\n";
-+ for (sal_uInt16 i = 0; i < ctors; ++i) {
-+ dumpCtorSignature (o, cppName, false, i);
-+ o << ";\n";
-+ }
-+ }
-+ o << "private:\n";
-+ o << indent() << cppName << "(); // not implemented\n"
-+ << indent() << cppName << "(" << cppName << " &); // not implemented\n"
-+ << indent() << "~" << cppName << "(); // not implemented\n"
-+ << indent() << "void operator =(" << cppName << "); // not implemented\n";
-+ dec();
-+ o << "};\n\n";
-+
-+ if (ctors > 0) {
-+ if (do_internal)
-+ o << "#ifdef CPPU_INTERNAL_IMPL\n";
- rtl::OString fullName(m_typeName.replace('/', '.'));
- rtl::OString baseName(
- rtl::OUStringToOString(
- m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
- rtl::OString fullBaseName(baseName.replace('/', '.'));
- rtl::OString scopedBaseName(scopedName(rtl::OString(), baseName));
-- o << "public:\n";
- for (sal_uInt16 i = 0; i < ctors; ++i) {
-- if (isDefaultConstructor(i)) {
-- o << indent() << "static ::com::sun::star::uno::Reference< "
-- << scopedBaseName << " > "
-- << translateIdentifier("create", "method", false, &cppName)
-- << ("(::com::sun::star::uno::Reference<"
-- " ::com::sun::star::uno::XComponentContext > const &"
-- " the_context) {\n");
-+ dumpCtorSignature (o, cppName, true, i);
-+ if (isDefaultConstructor(i)) {
-+ o << "{\n";
- inc();
- o << indent()
- << ("::com::sun::star::uno::Reference<"
-@@ -4059,40 +4191,10 @@ sal_Bool ServiceType::dumpHxxFile(
- dec();
- o << indent() << "}\n\n";
- } else {
-- o << indent() << "static ::com::sun::star::uno::Reference< "
-- << scopedBaseName << " > "
-- << translateIdentifier(
-- rtl::OUStringToOString(
-- m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8),
-- "method", false, &cppName)
-- << ("(::com::sun::star::uno::Reference<"
-- " ::com::sun::star::uno::XComponentContext > const &"
-- " the_context");
-- sal_uInt16 params = m_reader.getMethodParameterCount(i);
-- bool rest = hasRestParameter(i);
-- for (sal_uInt16 j = 0; j < params; ++j) {
-- o << ", ";
-- rtl::OStringBuffer buf;
-- if ((m_reader.getMethodParameterFlags(i, j) & RT_PARAM_REST)
-- != 0)
-- {
-- buf.append(RTL_CONSTASCII_STRINGPARAM("[]"));
-- }
-- buf.append(
-- rtl::OUStringToOString(
-- m_reader.getMethodParameterTypeName(i, j),
-- RTL_TEXTENCODING_UTF8));
-- rtl::OString type(buf.makeStringAndClear());
-- bool byRef = passByReference(type);
-- dumpType(o, type, byRef, byRef);
-- o << " "
-- << translateIdentifier(
-- rtl::OUStringToOString(
-- m_reader.getMethodParameterName(i, j),
-- RTL_TEXTENCODING_UTF8),
-- "param", false);
-- }
-- o << ") {\n";
-+ bool rest = hasRestParameter(i);
-+ sal_uInt16 params = m_reader.getMethodParameterCount(i);
-+
-+ o << "{\n";
- inc();
- o << indent()
- << ("::com::sun::star::uno::Reference<"
-@@ -4216,14 +4318,10 @@ sal_Bool ServiceType::dumpHxxFile(
- o << indent() << "}\n\n";
- }
- }
-+ if (do_internal)
-+ o << "#endif // CPPU_INTERNAL_IMPL\n";
- }
-- o << "private:\n";
-- o << indent() << cppName << "(); // not implemented\n"
-- << indent() << cppName << "(" << cppName << " &); // not implemented\n"
-- << indent() << "~" << cppName << "(); // not implemented\n"
-- << indent() << "void operator =(" << cppName << "); // not implemented\n";
-- dec();
-- o << "};\n\n";
-+
- if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
- o << "\n";
- }
-@@ -4304,11 +4402,13 @@ sal_Bool SingletonType::dumpHxxFile(
- includes.addRtlUstringHxx();
- includes.dump(o, 0);
- o << "\n";
-+
- if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
- o << "\n";
- }
- o << "\nclass " << cppName << " {\npublic:\n";
- inc();
-+ // FIXME: share this method ?
- o << indent() << "static ::com::sun::star::uno::Reference< "
- << scopedBaseName << " > "
- << translateIdentifier("get", "method", false, &cppName)
-Index: codemaker/source/cppumaker/cpputype.hxx
-===================================================================
-RCS file: /cvs/udk/codemaker/source/cppumaker/cpputype.hxx,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 cpputype.hxx
---- codemaker/source/cppumaker/cpputype.hxx 10 Jan 2006 15:46:47 -0000 1.9
-+++ codemaker/source/cppumaker/cpputype.hxx 28 Mar 2006 08:54:34 -0000
-@@ -61,6 +61,11 @@ enum CppuTypeDecl
- class CppuOptions;
- class FileStream;
-
-+#include <list>
-+extern ::std::list<rtl::OString> aExceptionNames;
-+extern ::std::list<rtl::OString> aIncludes;
-+extern bool do_internal;
-+
- class CppuType
- {
- public:
-@@ -300,6 +305,7 @@ public:
-
- virtual ~ExceptionType();
-
-+ bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
- sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
- sal_Bool dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
- sal_Bool dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
-@@ -367,6 +373,11 @@ public:
- throw (CannotDumpException);
-
- private:
-+
-+ void dumpCtorSignature(FileStream & o,
-+ const rtl::OString & cppName,
-+ bool impl, int i) throw (CannotDumpException);
-+
- virtual void addSpecialDependencies();
-
- bool isDefaultConstructor(sal_uInt16 ctorIndex) const;
diff --git a/patches/test/speed-except.diff b/patches/test/speed-except.diff
deleted file mode 100644
index 17193dd77..000000000
--- a/patches/test/speed-except.diff
+++ /dev/null
@@ -1,553 +0,0 @@
-Index: solenv/inc/libs.mk
-===================================================================
-RCS file: /cvs/tools/solenv/inc/libs.mk,v
-retrieving revision 1.96
-diff -u -p -u -r1.96 libs.mk
---- solenv/inc/libs.mk 20 Jan 2006 14:22:05 -0000 1.96
-+++ solenv/inc/libs.mk 20 Mar 2006 13:41:17 -0000
-@@ -64,12 +64,13 @@ DUNOUTILLIBST=-ldunoutil
- DVCLUTILLIBST=-ldvclutil
- BPICONVLIB=-lbpiconv
- TOOLSLIB=-ltl$(OFFICEUPD)$(DLLPOSTFIX)
-+UNOTYPESLIB=-lexcept$(OFFICEUPD)$(DLLPOSTFIX)
- # make sure some ancient libs are empty
- OSLLIB=
- RTLLIB=
- TECLIB=
- CPPULIB=-luno_cppu
--CPPUHELPERLIB=-luno_cppuhelper$(COMID)
-+CPPUHELPERLIB=-luno_cppuhelper$(COMID) $(UNOTYPESLIB)
- .INCLUDE .IGNORE : ucbhelper$/version.mk
- UCBHELPERLIB=-lucbhelper$(UCBHELPER_MAJOR)$(COMID)
- REGLIB=-lreg
-
-Index: cppuhelper/source/makefile.mk
-===================================================================
-RCS file: /cvs/udk/cppuhelper/source/makefile.mk,v
-retrieving revision 1.41
-diff -u -p -u -r1.41 makefile.mk
---- cppuhelper/source/makefile.mk 27 Oct 2005 17:19:33 -0000 1.41
-+++ cppuhelper/source/makefile.mk 20 Mar 2006 13:11:41 -0000
-@@ -151,8 +151,9 @@ SHL1TARGET=uno_$(TARGET)$(COMID)
- SHL1STDLIBS= \
- $(SALLIB) \
- $(SALHELPERLIB) \
-- $(CPPULIB)
-+ $(CPPULIB) \
-+ $(UNOTYPESLIB)
-
- SHL1DEPN=
- SHL1IMPLIB=i$(TARGET)
---- /dev/null 2006-03-11 13:25:00.000000000 +0000
-+++ offuh/except/except.cxx 2006-03-17 20:34:49.000000000 +0000
-@@ -0,1 +1,25 @@
-+#include <sal/config.h>
-+#include <cppu/macros.hxx>
-+
-+// We don't want to hide all this shared goodness:
-+#undef CPPU_GCC_DLLPUBLIC_EXPORT
-+#define CPPU_GCC_DLLPUBLIC_EXPORT
-+#undef CPPU_GCC_DLLPRIVATE
-+#define CPPU_GCC_DLLPRIVATE
-+
-+#define CPPU_INTERNAL_IMPL 1
-+
-+// Evilness: sal/config.h includes stdlib.h
-+// that has some workarounds for 'major' / 'minor'
-+// issues, at least on Linux. These then cause problems
-+// with chained constructors: FooClass : major(0) tec.
-+
-+// obscure CORBA compat interfaces
-+#undef major
-+#undef minor
-+
-+// com/sun/star/drawing/CaptionEscapeDirection.idl: keyword genius
-+#define auto not_auto
-+
-+#include <catch.hxx>
---- /dev/null 2006-03-11 13:25:00.000000000 +0000
-+++ offuh/except/makefile.mk 2006-03-17 11:44:41.000000000 +0000
-@@ -0,0 +1,23 @@
-+# --- Settings -----------------------------------------------------
-+
-+PRJ=..
-+
-+PRJNAME=offuh
-+TARGET=unotypes
-+ENABLE_EXCEPTIONS=TRUE
-+
-+.INCLUDE : settings.mk
-+
-+LIB1TARGET= $(SLB)$/$(TARGET).lib
-+LIB1OBJFILES= $(SLO)$/except.obj
-+
-+SHL1TARGET=except$(UPD)$(DLLPOSTFIX)
-+SHL1LIBS=$(LIB1TARGET)
-+SHL1STDLIBS= $(SALLIB) $(SALHELPERLIB) $(REGLIB) $(CPPULIB)
-+
-+# --- Targets -------------------------------------------------------
-+
-+.INCLUDE : target.mk
-+
-+$(LIB1OBJFILES) : $(MISC)$/offuh.don
-+
-
-
-Index: bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
-===================================================================
-RCS file: /cvs/udk/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 makefile.mk
---- bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk 7 Sep 2005 22:21:49 -0000 1.7
-+++ bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk 27 Mar 2006 14:05:35 -0000
-@@ -74,7 +74,8 @@ SHL1LIBS = $(SLB)$/cpp_uno_shared.lib
-
- SHL1STDLIBS= \
- $(CPPULIB) \
-- $(SALLIB)
-+ $(SALLIB) \
-+ $(UNOTYPESLIB)
-
- .ENDIF
-
-Index: bridges/source/jni_uno/makefile.mk
-===================================================================
-RCS file: /cvs/udk/bridges/source/jni_uno/makefile.mk,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 makefile.mk
---- bridges/source/jni_uno/makefile.mk 9 Jan 2006 09:47:17 -0000 1.7
-+++ bridges/source/jni_uno/makefile.mk 27 Mar 2006 14:05:36 -0000
-@@ -65,7 +65,8 @@ SHL1STDLIBS= \
- $(JVMACCESSLIB) \
- $(CPPULIB) \
- $(SALLIB) \
-- $(SALHELPERLIB)
-+ $(SALHELPERLIB) \
-+ $(UNOTYPESLIB)
-
- SHL1VERSIONMAP=$(TARGET).map
-
-Index: padmin/source/makefile.mk
-===================================================================
-RCS file: /cvs/gsl/padmin/source/makefile.mk,v
-retrieving revision 1.18
-diff -u -p -u -r1.18 makefile.mk
---- padmin/source/makefile.mk 8 Sep 2005 16:25:28 -0000 1.18
-+++ padmin/source/makefile.mk 27 Mar 2006 19:56:52 -0000
-@@ -44,6 +44,10 @@ LIBTARGET=NO
-
- .INCLUDE: settings.mk
-
-+.IF "$(FONTCONFIG_FONTS)" != ""
-+CFLAGS+=-DFONTCONFIG_FONTS
-+.ENDIF
-+
- # --- Files --------------------------------------------------------
-
- SRS1NAME=$(TARGET)
-@@ -67,11 +71,13 @@ SLOFILES=\
- $(SLO)$/newppdlg.obj \
- $(SLO)$/prtsetup.obj \
- $(SLO)$/prgsbar.obj \
-- $(SLO)$/fontentry.obj \
- $(SLO)$/helper.obj \
- $(SLO)$/adddlg.obj \
- $(SLO)$/titlectrl.obj
-
-+.IF "$(FONTCONFIG_FONTS)" == ""
-+SLOFILES+= $(SLO)$/fontentry.obj
-+.ENDIF
-
- OBJFILES=\
- $(OBJ)/pamain.obj
-@@ -85,7 +91,8 @@ SHL1STDLIBS=\
- $(TOOLSLIB) \
- $(COMPHELPERLIB) \
- $(CPPULIB) \
-- $(SALLIB)
-+ $(SALLIB) \
-+ $(UNOTYPESLIB)
-
- APP1TARGET=spadmin.bin
- APP1DEPN+=$(SHL1TARGETN)
-@@ -103,6 +110,7 @@ APP1STDLIBS= \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
-+ $(UNOTYPESLIB) \
- -lXext -lX11
-
- .ENDIF
-
-Index: goodies/source/filter.vcl/egif/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/egif/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/egif/makefile.mk 9 Sep 2005 02:31:59 -0000 1.8
-+++ goodies/source/filter.vcl/egif/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -66,7 +66,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= egi$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= egif
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/egif.lib
- SHL1LIBS= $(SLB)$/egif.lib
-Index: goodies/source/filter.vcl/eos2met/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/eos2met/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/eos2met/makefile.mk 9 Sep 2005 02:34:15 -0000 1.8
-+++ goodies/source/filter.vcl/eos2met/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -64,7 +64,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= eme$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= eos2met
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/eos2met.lib
- SHL1LIBS= $(SLB)$/eos2met.lib
-
-Index: goodies/source/filter.vcl/epbm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/epbm/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/epbm/makefile.mk 9 Sep 2005 02:36:32 -0000 1.8
-+++ goodies/source/filter.vcl/epbm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -64,7 +64,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= epb$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= epbm
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/epbm.lib
- SHL1LIBS= $(SLB)$/epbm.lib
-
-Index: goodies/source/filter.vcl/epgm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/epgm/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/epgm/makefile.mk 9 Sep 2005 02:38:50 -0000 1.8
-+++ goodies/source/filter.vcl/epgm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -65,7 +65,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= epg$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= epgm
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/epgm.lib
- SHL1LIBS= $(SLB)$/epgm.lib
-Index: goodies/source/filter.vcl/epict/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/epict/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/epict/makefile.mk 9 Sep 2005 02:41:02 -0000 1.8
-+++ goodies/source/filter.vcl/epict/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -65,7 +65,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= ept$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= epict
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/epict.lib
- SHL1LIBS= $(SLB)$/epict.lib
-Index: goodies/source/filter.vcl/eppm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/eppm/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/eppm/makefile.mk 9 Sep 2005 02:43:20 -0000 1.8
-+++ goodies/source/filter.vcl/eppm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -64,7 +64,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= epp$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= eppm
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/eppm.lib
- SHL1LIBS= $(SLB)$/eppm.lib
-Index: goodies/source/filter.vcl/eps/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/eps/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/eps/makefile.mk 9 Sep 2005 02:45:33 -0000 1.9
-+++ goodies/source/filter.vcl/eps/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -65,7 +65,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
-
- SHL1TARGET= eps$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= eps
--SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
-+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/eps.lib
- SHL1LIBS= $(SLB)$/eps.lib
-Index: goodies/source/filter.vcl/eras/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/eras/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/eras/makefile.mk 9 Sep 2005 02:46:14 -0000 1.9
-+++ goodies/source/filter.vcl/eras/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/eras.obj
-
- SHL1TARGET= era$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= eras
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/eras.lib
- SHL1LIBS= $(SLB)$/eras.lib
-
-Index: goodies/source/filter.vcl/etiff/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/etiff/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/etiff/makefile.mk 9 Sep 2005 02:46:42 -0000 1.9
-+++ goodies/source/filter.vcl/etiff/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/etiff.obj
-
- SHL1TARGET= eti$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= etiff
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/etiff.lib
- SHL1LIBS= $(SLB)$/etiff.lib
-
-Index: goodies/source/filter.vcl/expm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/expm/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/expm/makefile.mk 9 Sep 2005 02:47:11 -0000 1.9
-+++ goodies/source/filter.vcl/expm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -56,7 +56,7 @@ SLOFILES = $(SLO)$/expm.obj
-
- SHL1TARGET= exp$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= expm
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/expm.lib
- SHL1LIBS= $(SLB)$/expm.lib
-
-Index: goodies/source/filter.vcl/icgm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/icgm/makefile.mk,v
-retrieving revision 1.7
-diff -u -p -u -r1.7 makefile.mk
---- goodies/source/filter.vcl/icgm/makefile.mk 9 Sep 2005 02:53:03 -0000 1.7
-+++ goodies/source/filter.vcl/icgm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -123,7 +123,8 @@ SHL1STDLIBS = \
- $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(CPPULIB) \
-- $(SALLIB)
-+ $(SALLIB) \
-+ $(UNOTYPESLIB)
-
- # --- Targets --------------------------------------------------------------
-
-Index: goodies/source/filter.vcl/idxf/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/idxf/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/idxf/makefile.mk 9 Sep 2005 02:57:42 -0000 1.9
-+++ goodies/source/filter.vcl/idxf/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -62,7 +62,7 @@ SLOFILES = $(SLO)$/dxfgrprd.obj \
-
- SHL1TARGET= idx$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= idxf
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/idxf.lib
- SHL1LIBS= $(SLB)$/idxf.lib # $(LB)$/rtftoken.lib
-Index: goodies/source/filter.vcl/ieps/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ieps/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/ieps/makefile.mk 9 Sep 2005 02:58:11 -0000 1.9
-+++ goodies/source/filter.vcl/ieps/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ieps.obj
-
- SHL1TARGET= ips$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ieps
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ieps.lib
- SHL1LIBS= $(SLB)$/ieps.lib
-
-Index: goodies/source/filter.vcl/ios2met/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ios2met/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/ios2met/makefile.mk 9 Sep 2005 02:58:41 -0000 1.9
-+++ goodies/source/filter.vcl/ios2met/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ios2met.obj
-
- SHL1TARGET= ime$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ios2met
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
-
- SHL1DEPN= $(LB)$/ios2met.lib
- SHL1LIBS= $(SLB)$/ios2met.lib # $(LB)$/rtftoken.lib
-Index: goodies/source/filter.vcl/ipbm/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ipbm/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/ipbm/makefile.mk 9 Sep 2005 02:59:11 -0000 1.9
-+++ goodies/source/filter.vcl/ipbm/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ipbm.obj
-
- SHL1TARGET= ipb$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ipbm
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ipbm.lib
- SHL1LIBS= $(SLB)$/ipbm.lib
-
-Index: goodies/source/filter.vcl/ipcd/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ipcd/makefile.mk,v
-retrieving revision 1.10
-diff -u -p -u -r1.10 makefile.mk
---- goodies/source/filter.vcl/ipcd/makefile.mk 9 Sep 2005 02:59:40 -0000 1.10
-+++ goodies/source/filter.vcl/ipcd/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ipcd.obj
-
- SHL1TARGET= icd$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ipcd
--SHL1STDLIBS= $(SVTOOLLIB) $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(SVTOOLLIB) $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ipcd.lib
- SHL1LIBS= $(SLB)$/ipcd.lib # $(LB)$/rtftoken.lib
-
-Index: goodies/source/filter.vcl/ipcx/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ipcx/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/ipcx/makefile.mk 9 Sep 2005 03:00:10 -0000 1.9
-+++ goodies/source/filter.vcl/ipcx/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ipcx.obj
-
- SHL1TARGET= ipx$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ipcx
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ipcx.lib
- SHL1LIBS= $(SLB)$/ipcx.lib
-
-Index: goodies/source/filter.vcl/ipict/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ipict/makefile.mk,v
-retrieving revision 1.9
-diff -u -p -u -r1.9 makefile.mk
---- goodies/source/filter.vcl/ipict/makefile.mk 9 Sep 2005 03:00:39 -0000 1.9
-+++ goodies/source/filter.vcl/ipict/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ipict.obj
-
- SHL1TARGET= ipt$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ipict
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ipict.lib
- SHL1LIBS= $(SLB)$/ipict.lib
-
-Index: goodies/source/filter.vcl/ipsd/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/ipsd/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/ipsd/makefile.mk 9 Sep 2005 03:01:08 -0000 1.8
-+++ goodies/source/filter.vcl/ipsd/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/ipsd.obj
-
- SHL1TARGET= ipd$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= ipsd
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/ipsd.lib
- SHL1LIBS= $(SLB)$/ipsd.lib
-
-Index: goodies/source/filter.vcl/iras/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/iras/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/iras/makefile.mk 9 Sep 2005 03:01:37 -0000 1.8
-+++ goodies/source/filter.vcl/iras/makefile.mk 27 Mar 2006 21:04:11 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/iras.obj
-
- SHL1TARGET= ira$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= iras
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/iras.lib
- SHL1LIBS= $(SLB)$/iras.lib
-
-Index: goodies/source/filter.vcl/itga/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/itga/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/itga/makefile.mk 9 Sep 2005 03:02:08 -0000 1.8
-+++ goodies/source/filter.vcl/itga/makefile.mk 27 Mar 2006 21:04:13 -0000
-@@ -55,7 +55,7 @@ SLOFILES = $(SLO)$/itga.obj
-
- SHL1TARGET= itg$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= itga
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/itga.lib
- SHL1LIBS= $(SLB)$/itga.lib
-
-Index: goodies/source/filter.vcl/itiff/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/goodies/source/filter.vcl/itiff/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- goodies/source/filter.vcl/itiff/makefile.mk 9 Sep 2005 03:03:37 -0000 1.8
-+++ goodies/source/filter.vcl/itiff/makefile.mk 27 Mar 2006 21:04:13 -0000
-@@ -57,7 +57,7 @@ SLOFILES = $(SLO)$/itiff.obj \
-
- SHL1TARGET= iti$(UPD)$(DLLPOSTFIX)
- SHL1IMPLIB= itiff
--SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB)
-+SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(SALLIB) $(UNOTYPESLIB)
- SHL1DEPN= $(LB)$/itiff.lib
- SHL1LIBS= $(SLB)$/itiff.lib # $(LB)$/rtftoken.lib
-
-Index: sd/source/filter/eppt/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/sd/source/filter/eppt/makefile.mk,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 makefile.mk
---- sd/source/filter/eppt/makefile.mk 9 Sep 2005 03:20:06 -0000 1.8
-+++ sd/source/filter/eppt/makefile.mk 28 Mar 2006 14:39:31 -0000
-@@ -73,7 +73,8 @@ SHL1STDLIBS = \
- $(TOOLSLIB) \
- $(UCBHELPERLIB) \
- $(CPPULIB) \
-- $(SALLIB)
-+ $(SALLIB) \
-+ $(UNOTYPESLIB)
-
- # --- Targets --------------------------------------------------------------
-
diff --git a/patches/test/speed-image-refactor.diff b/patches/test/speed-image-refactor.diff
deleted file mode 100644
index f2340b26e..000000000
--- a/patches/test/speed-image-refactor.diff
+++ /dev/null
@@ -1,437 +0,0 @@
-Index: vcl/source/control/button.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/control/button.cxx,v
-retrieving revision 1.42
-diff -u -p -u -r1.42 button.cxx
---- vcl/source/control/button.cxx 26 Jan 2006 18:07:58 -0000 1.42
-+++ vcl/source/control/button.cxx 31 May 2006 09:14:52 -0000
-@@ -3107,6 +3109,30 @@ Size RadioButton::ImplGetRadioImageSize(
- return aSize;
- }
-
-+static void LoadThemedImageList (const StyleSettings &rStyleSettings,
-+ ImageList *pList, const ResId &rResId)
-+{
-+ Color pColorAry1[6];
-+ Color pColorAry2[6];
-+ pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
-+ pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
-+ pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
-+ pColorAry1[3] = Color( 0x80, 0x80, 0x80 );
-+ pColorAry1[4] = Color( 0x00, 0x00, 0x00 );
-+ pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );
-+ pColorAry2[0] = rStyleSettings.GetFaceColor();
-+ pColorAry2[1] = rStyleSettings.GetWindowColor();
-+ pColorAry2[2] = rStyleSettings.GetLightColor();
-+ pColorAry2[3] = rStyleSettings.GetShadowColor();
-+ pColorAry2[4] = rStyleSettings.GetDarkShadowColor();
-+ pColorAry2[5] = rStyleSettings.GetWindowTextColor();
-+
-+ Color aMaskColor(0x00, 0x00, 0xFF );
-+ // FIXME: do we want the mask for the checkbox ?
-+ pList->InsertFromHorizontalBitmap (rResId, 4, &aMaskColor,
-+ pColorAry1, pColorAry2, 6);
-+}
-+
- Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags )
- {
- ImplSVData* pSVData = ImplGetSVData();
-@@ -3129,10 +3155,8 @@ Image RadioButton::GetRadioImage( const
- pSVData->maCtrlData.mnLastRadioWColor = rStyleSettings.GetWindowColor().GetColor();
- pSVData->maCtrlData.mnLastRadioLColor = rStyleSettings.GetLightColor().GetColor();
-
-- long aTempAry1[(6*sizeof(Color))/sizeof(long)];
-- long aTempAry2[(6*sizeof(Color))/sizeof(long)];
-- Color* pColorAry1 = (Color*)aTempAry1;
-- Color* pColorAry2 = (Color*)aTempAry2;
-+ Color pColorAry1[6];
-+ Color pColorAry2[6];
- pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
- pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
- pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
-@@ -3147,12 +3171,12 @@ Image RadioButton::GetRadioImage( const
- pColorAry2[5] = rStyleSettings.GetWindowTextColor();
-
- ResMgr* pResMgr = ImplGetResMgr();
-- Bitmap aBmp;
-+ pSVData->maCtrlData.mpRadioImgList = new ImageList();
- if( pResMgr )
-- aBmp = Bitmap( ResId( SV_RESID_BITMAP_RADIO+nStyle, ImplGetResMgr() ) );
-- aBmp.Replace( pColorAry1, pColorAry2, 6, NULL );
-- pSVData->maCtrlData.mpRadioImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 6 );
-- pSVData->maCtrlData.mnRadioStyle = nStyle;
-+ LoadThemedImageList( rStyleSettings,
-+ pSVData->maCtrlData.mpRadioImgList,
-+ ResId( SV_RESID_BITMAP_RADIO+nStyle, ImplGetResMgr() ) );
-+ pSVData->maCtrlData.mnRadioStyle = nStyle;
- }
-
- USHORT nId;
-@@ -3946,29 +3970,12 @@ Image CheckBox::GetCheckImage( const All
- pSVData->maCtrlData.mnLastCheckWColor = rStyleSettings.GetWindowColor().GetColor();
- pSVData->maCtrlData.mnLastCheckLColor = rStyleSettings.GetLightColor().GetColor();
-
-- long aTempAry1[(6*sizeof(Color))/sizeof(long)];
-- long aTempAry2[(6*sizeof(Color))/sizeof(long)];
-- Color* pColorAry1 = (Color*)aTempAry1;
-- Color* pColorAry2 = (Color*)aTempAry2;
-- pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
-- pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
-- pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
-- pColorAry1[3] = Color( 0x80, 0x80, 0x80 );
-- pColorAry1[4] = Color( 0x00, 0x00, 0x00 );
-- pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );
-- pColorAry2[0] = rStyleSettings.GetFaceColor();
-- pColorAry2[1] = rStyleSettings.GetWindowColor();
-- pColorAry2[2] = rStyleSettings.GetLightColor();
-- pColorAry2[3] = rStyleSettings.GetShadowColor();
-- pColorAry2[4] = rStyleSettings.GetDarkShadowColor();
-- pColorAry2[5] = rStyleSettings.GetWindowTextColor();
--
- ResMgr* pResMgr = ImplGetResMgr();
-- Bitmap aBmp;
-+ pSVData->maCtrlData.mpCheckImgList = new ImageList();
- if( pResMgr )
-- aBmp = Bitmap( ResId( SV_RESID_BITMAP_CHECK+nStyle, ImplGetResMgr() ) );
-- aBmp.Replace( pColorAry1, pColorAry2, 6, NULL );
-- pSVData->maCtrlData.mpCheckImgList = new ImageList( aBmp, 9 );
-+ LoadThemedImageList( rStyleSettings,
-+ pSVData->maCtrlData.mpCheckImgList,
-+ ResId( SV_RESID_BITMAP_CHECK+nStyle, ImplGetResMgr() ) );
- pSVData->maCtrlData.mnCheckStyle = nStyle;
- }
-
-Index: vcl/source/window/brdwin.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/brdwin.cxx,v
-retrieving revision 1.23
-diff -u -p -u -r1.23 brdwin.cxx
---- vcl/source/window/brdwin.cxx 28 Sep 2005 14:50:05 -0000 1.23
-+++ vcl/source/window/brdwin.cxx 31 May 2006 09:17:50 -0000
-@@ -95,11 +95,15 @@ static void ImplGetPinImage( USHORT nSty
- ImplSVData* pSVData = ImplGetSVData();
- if ( !pSVData->maCtrlData.mpPinImgList )
- {
-- Bitmap aBmp;
- ResMgr* pResMgr = ImplGetResMgr();
-+ pSVData->maCtrlData.mpPinImgList = new ImageList();
- if( pResMgr )
-- aBmp = Bitmap( ResId( SV_RESID_BITMAP_PIN, ImplGetResMgr() ) );
-- pSVData->maCtrlData.mpPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
-+ {
-+ Color aMaskColor( 0x00, 0x00, 0xFF );
-+ pSVData->maCtrlData.mpPinImgList->InsertFromHorizontalBitmap
-+ ( ResId( SV_RESID_BITMAP_PIN, ImplGetResMgr() ), 4,
-+ &aMaskColor, NULL, NULL, 0);
-+ }
- }
-
- // Image ermitteln und zurueckgeben
-Index: vcl/source/window/msgbox.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/msgbox.cxx,v
-retrieving revision 1.17
-diff -u -p -u -r1.17 msgbox.cxx
---- vcl/source/window/msgbox.cxx 28 Sep 2005 14:51:46 -0000 1.17
-+++ vcl/source/window/msgbox.cxx 31 May 2006 09:25:08 -0000
-@@ -84,15 +84,13 @@ static void ImplInitMsgBoxImageList()
- {
- BitmapEx aBmpEx;
- ResMgr* pResMgr = ImplGetResMgr();
-+ pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
- if( pResMgr )
- {
-- aBmpEx = BitmapEx( ResId( SV_RESID_BITMAP_MSGBOX, ImplGetResMgr() ) );
--
-- if( !aBmpEx.IsTransparent() )
-- aBmpEx = BitmapEx( aBmpEx.GetBitmap(), Color( 0xC0, 0xC0, 0xC0 ) );
-- }
--
-- pSVData->maWinData.mpMsgBoxImgList = new ImageList( aBmpEx, 4 );
-+ Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
-+ pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
-+ ( ResId( SV_RESID_BITMAP_MSGBOX, ImplGetResMgr() ), 4, &aNonAlphaMask );
-+ }
- }
- }
-
-Index: vcl/source/window/scrwnd.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/scrwnd.cxx,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 scrwnd.cxx
---- vcl/source/window/scrwnd.cxx 28 Sep 2005 14:52:29 -0000 1.5
-+++ vcl/source/window/scrwnd.cxx 31 May 2006 09:27:47 -0000
-@@ -144,11 +144,10 @@ void ImplWheelWindow::ImplSetRegion( con
-
- void ImplWheelWindow::ImplCreateImageList()
- {
-- Bitmap aImgBmp;
- ResMgr* pResMgr = ImplGetResMgr();
- if( pResMgr )
-- aImgBmp = Bitmap( ResId( SV_RESID_BITMAP_SCROLLBMP, pResMgr ) );
-- maImgList = ImageList( aImgBmp, 6 );
-+ maImgList.InsertFromHorizontalBitmap
-+ ( ResId( SV_RESID_BITMAP_SCROLLBMP, pResMgr ), 6, NULL );
- }
-
- // ------------------------------------------------------------------------
-Index: vcl/source/window/splitwin.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/window/splitwin.cxx,v
-retrieving revision 1.13
-diff -u -p -u -r1.13 splitwin.cxx
---- vcl/source/window/splitwin.cxx 1 Nov 2005 10:34:10 -0000 1.13
-+++ vcl/source/window/splitwin.cxx 31 May 2006 09:31:53 -0000
-@@ -1966,11 +1966,14 @@ void SplitWindow::ImplDrawAutoHide( BOOL
- {
- if ( !pSVData->maCtrlData.mpSplitHPinImgList )
- {
-- Bitmap aBmp;
- ResMgr* pResMgr = ImplGetResMgr();
- if( pResMgr )
-- aBmp = Bitmap( ResId( SV_RESID_BITMAP_SPLITHPIN, pResMgr ) );
-- pSVData->maCtrlData.mpSplitHPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
-+ {
-+ Color aNonAlphaMask( 0x00, 0x00, 0xFF );
-+ pSVData->maCtrlData.mpSplitHPinImgList = new ImageList(4);
-+ pSVData->maCtrlData.mpSplitHPinImgList->InsertFromHorizontalBitmap
-+ ( ResId( SV_RESID_BITMAP_SPLITHPIN, pResMgr ), 4, &aNonAlphaMask );
-+ }
- }
- pImageList = pSVData->maCtrlData.mpSplitHPinImgList;
- }
-@@ -1978,11 +1981,14 @@ void SplitWindow::ImplDrawAutoHide( BOOL
- {
- if ( !pSVData->maCtrlData.mpSplitVPinImgList )
- {
-- Bitmap aBmp;
- ResMgr* pResMgr = ImplGetResMgr();
-+ pSVData->maCtrlData.mpSplitVPinImgList = new ImageList(4);
- if( pResMgr )
-- aBmp = Bitmap( ResId( SV_RESID_BITMAP_SPLITVPIN, pResMgr ) );
-- pSVData->maCtrlData.mpSplitVPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
-+ {
-+ Color aNonAlphaMask( 0x00, 0x00, 0xFF );
-+ pSVData->maCtrlData.mpSplitVPinImgList->InsertFromHorizontalBitmap
-+ ( ResId( SV_RESID_BITMAP_SPLITVPIN, pResMgr ), 4, &aNonAlphaMask );
-+ }
- }
- pImageList = pSVData->maCtrlData.mpSplitVPinImgList;
- }
-Index: goodies/source/unographic/provider.cxx
-===================================================================
-RCS file: /cvs/graphics/goodies/source/unographic/provider.cxx,v
-retrieving revision 1.4
-diff -u -p -u -r1.4 provider.cxx
---- goodies/source/unographic/provider.cxx 9 Sep 2005 03:11:17 -0000 1.4
-+++ goodies/source/unographic/provider.cxx 31 May 2006 09:35:41 -0000
-@@ -243,7 +243,7 @@ uno::Reference< ::graphic::XGraphic > Gr
- }
- else
- {
-- aBmpEx = aImageList.GetBitmapEx();
-+ aBmpEx = aImageList.GetAsHorizontalStrip();
- }
- }
- }
-Index: framework/source/uiconfiguration/moduleimagemanager.cxx
-===================================================================
-RCS file: /cvs/framework/framework/source/uiconfiguration/moduleimagemanager.cxx,v
-retrieving revision 1.12
-diff -u -p -u -r1.12 moduleimagemanager.cxx
---- framework/source/uiconfiguration/moduleimagemanager.cxx 5 Jan 2006 18:10:52 -0000 1.12
-+++ framework/source/uiconfiguration/moduleimagemanager.cxx 31 May 2006 10:20:26 -0000
-@@ -603,7 +603,9 @@ sal_Bool ModuleImageManager::implts_load
-
- // Delete old image list and create a new one from the read bitmap
- delete m_pUserImageList[nImageType];
-- m_pUserImageList[nImageType] = new ImageList( aUserBitmap, aUserImagesVector );
-+ m_pUserImageList[nImageType] = new ImageList();
-+ m_pUserImageList[nImageType]->InsertFromHorizontalStrip
-+ ( aUserBitmap, aUserImagesVector );
- return sal_True;
- }
- }
-@@ -675,7 +677,7 @@ sal_Bool ModuleImageManager::implts_stor
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
-- vcl::PNGWriter aPngWriter( pImageList->GetBitmapEx() );
-+ vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- delete pSvStream;
-
-Index: framework/source/uiconfiguration/imagemanager.cxx
-===================================================================
-RCS file: /cvs/framework/framework/source/uiconfiguration/imagemanager.cxx,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 imagemanager.cxx
---- framework/source/uiconfiguration/imagemanager.cxx 9 Sep 2005 01:49:53 -0000 1.8
-+++ framework/source/uiconfiguration/imagemanager.cxx 31 May 2006 10:20:38 -0000
-@@ -338,7 +338,9 @@ sal_Bool ImageManager::implts_loadUserIm
-
- // Delete old image list and create a new one from the read bitmap
- delete m_pUserImageList[nImageType];
-- m_pUserImageList[nImageType] = new ImageList( aUserBitmap, aUserImagesVector );
-+ m_pUserImageList[nImageType] = new ImageList();
-+ m_pUserImageList[nImageType]->InsertFromHorizontalStrip
-+ ( aUserBitmap, aUserImagesVector );
- return sal_True;
- }
- }
-@@ -410,7 +412,7 @@ sal_Bool ImageManager::implts_storeUserI
- if ( xBitmapStream.is() )
- {
- SvStream* pSvStream = utl::UcbStreamHelper::CreateStream( xBitmapStream );
-- vcl::PNGWriter aPngWriter( pImageList->GetBitmapEx() );
-+ vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- delete pSvStream;
-
-Index: svx/source/dialog/frmsel.cxx
-===================================================================
-RCS file: /cvs/graphics/svx/source/dialog/frmsel.cxx,v
-retrieving revision 1.18
-diff -u -p -u -r1.18 frmsel.cxx
---- svx/source/dialog/frmsel.cxx 8 Sep 2005 21:08:45 -0000 1.18
-+++ svx/source/dialog/frmsel.cxx 31 May 2006 10:29:20 -0000
-@@ -252,7 +252,7 @@ FrameBorderType FrameBorder::GetKeyboard
- FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
- Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
- mrFrameSel( rFrameSel ),
-- maBmpArrows( ResId( BMP_FRMSEL_ARROWS ) ),
-+ maILArrows( 16 ),
- maLeft( FRAMEBORDER_LEFT ),
- maRight( FRAMEBORDER_RIGHT ),
- maTop( FRAMEBORDER_TOP ),
-@@ -346,14 +346,18 @@ void FrameSelectorImpl::InitColors()
-
- void FrameSelectorImpl::InitArrowImageList()
- {
-- /* Build the arrow images bitmap with current colors. */
-- Bitmap aBmp( maBmpArrows );
-- aBmp.Replace( Color( 0, 0, 0 ), maArrowCol ); // black -> arrow color
-- aBmp.Replace( Color( 0, 255, 0 ), maMarkCol ); // green -> marker color
-- aBmp.Replace( Color( 255, 0, 255 ), maBackCol ); // magenta -> background
-+ /* Build the arrow images bitmap with current colors. */
-+ Color pColorAry1[3];
-+ Color pColorAry2[3];
-+ pColorAry1[0] = Color( 0, 0, 0 );
-+ pColorAry2[0] = maArrowCol; // black -> arrow color
-+ pColorAry1[1] = Color( 0, 255, 0 );
-+ pColorAry2[1] = maMarkCol; // green -> marker color
-+ pColorAry1[2] = Color( 255, 0, 255 );
-+ pColorAry2[2] = maBackCol; // magenta -> background
-
-- /* Create the new image list. */
-- maILArrows = ImageList( aBmp, 16 );
-+ maILArrows.InsertFromHorizontalBitmap(
-+ ResId( BMP_FRMSEL_ARROWS ), 16, NULL, pColorAry1, pColorAry2, 3);
- DBG_ASSERT( maILArrows.GetImageSize().Height() == maILArrows.GetImageSize().Width(),
- "svx::FrameSelectorImpl::InitArrowImageList - images are not squarish" );
- mnArrowSize = maILArrows.GetImageSize().Height();
-Index: svx/source/inc/frmselimpl.hxx
-===================================================================
-RCS file: /cvs/graphics/svx/source/inc/frmselimpl.hxx,v
-retrieving revision 1.3
-diff -u -p -u -r1.3 frmselimpl.hxx
---- svx/source/inc/frmselimpl.hxx 8 Sep 2005 23:23:12 -0000 1.3
-+++ svx/source/inc/frmselimpl.hxx 31 May 2006 10:29:36 -0000
-@@ -123,7 +123,6 @@ struct FrameSelectorImpl : public Resour
-
- FrameSelector& mrFrameSel; /// The control itself.
- VirtualDevice maVirDev; /// For all buffered drawing operations.
-- const Bitmap maBmpArrows; /// Original arrows bitmap from resource.
- ImageList maILArrows; /// Arrows in current system colors.
- Color maBackCol; /// Background color.
- Color maArrowCol; /// Selection arrow color.
-Index: sfx2/source/toolbox/imgmgr.cxx
-===================================================================
-RCS file: /cvs/framework/sfx2/source/toolbox/imgmgr.cxx,v
-retrieving revision 1.26
-diff -u -p -u -r1.26 imgmgr.cxx
---- sfx2/source/toolbox/imgmgr.cxx 5 Jan 2006 18:22:00 -0000 1.26
-+++ sfx2/source/toolbox/imgmgr.cxx 31 May 2006 10:56:10 -0000
-@@ -212,7 +212,7 @@ ImageList* SfxImageManager_Impl::GetImag
- Image SfxImageManager_Impl::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast )
- {
- ImageList* pImageList = GetImageList( bBig, bHiContrast );
-- if ( pImageList && pImageList->GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pImageList )
- return pImageList->GetImage( nId );
- return Image();
- }
-@@ -321,7 +321,7 @@ SfxImageManager* SfxImageManager::GetIma
- Image SfxImageManager::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast ) const
- {
- ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast );
-- if ( pImageList && pImageList->GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pImageList && pImageList->HasImageAtPos( nId ) )
- return pImageList->GetImage( nId );
- return Image();
- }
-@@ -340,12 +340,12 @@ Image SfxImageManager::SeekImage( USHORT
- {
- sal_Bool bGlobal = ( pImp->m_pModule == 0 );
- ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast );
-- if ( pImageList && pImageList->GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pImageList && pImageList->HasImageAtPos( nId ) )
- return pImageList->GetImage( nId );
- else if ( !bGlobal )
- {
- pImageList = ::GetImageManager( 0 )->GetImageList( bBig, bHiContrast );
-- if ( pImageList && pImageList->GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pImageList )
- return pImageList->GetImage( nId );
- }
- return Image();
-@@ -409,7 +409,7 @@ void SfxImageManager::SetImagesForceSize
- {
- case TOOLBOXITEM_BUTTON:
- {
-- if ( pImageList && pImageList->GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pImageList && pImageList->HasImageAtPos( nId ) )
- rToolBox.SetItemImage( nId, pImageList->GetImage( nId ));
- else
- rToolBox.SetItemImage( nId, Image() );
-Index: svtools/source/misc/imagemgr.cxx
-===================================================================
-RCS file: /cvs/util/svtools/source/misc/imagemgr.cxx,v
-retrieving revision 1.39
-diff -u -p -u -r1.39 imagemgr.cxx
---- svtools/source/misc/imagemgr.cxx 8 Sep 2005 16:18:03 -0000 1.39
-+++ svtools/source/misc/imagemgr.cxx 31 May 2006 11:49:36 -0000
-@@ -681,18 +681,20 @@ static Image GetOfficeImageFromList_Impl
- }
- }
-
-+ Image aImage = pList->GetImage( nImageId );
-+
- if ( bBlackAndWhite )
- {
- // First invert the Image, because it's designed for black background, structures are bright
-- pList->Invert();
-+ aImage.Invert();
- // Now make monochrome...
- ImageColorTransform eTrans = IMAGECOLORTRANSFORM_MONOCHROME_WHITE;
- if ( Application::GetSettings().GetStyleSettings().GetFaceColor().GetColor() == COL_WHITE )
- eTrans = IMAGECOLORTRANSFORM_MONOCHROME_BLACK;
-- *pList = pList->GetColorTransformedImageList( eTrans );
-+ aImage = aImage.GetColorTransformedImage( eTrans );
- }
-
-- return pList->GetImage( nImageId );
-+ return aImage;
- }
-
- static Image GetImageFromList_Impl( USHORT nImageId, BOOL bBig, BOOL bHighContrast )
-@@ -739,7 +741,7 @@ static Image GetImageFromList_Impl( USHO
- }
- }
-
-- if ( pList->GetImagePos( nImageId ) != IMAGELIST_IMAGE_NOTFOUND )
-+ if ( pList->HasImageAtPos( nImageId ) )
- return pList->GetImage( nImageId );
- else
- return GetOfficeImageFromList_Impl( nImageId, bBig, bHighContrast );
diff --git a/patches/test/speed-image.diff b/patches/test/speed-image.diff
deleted file mode 100644
index 965f9efbd..000000000
--- a/patches/test/speed-image.diff
+++ /dev/null
@@ -1,1628 +0,0 @@
-Index: vcl/source/gdi/outdev2.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/outdev2.cxx,v
-retrieving revision 1.29
-diff -u -p -u -r1.29 outdev2.cxx
---- vcl/source/gdi/outdev2.cxx 9 Sep 2005 12:06:08 -0000 1.29
-+++ vcl/source/gdi/outdev2.cxx 20 Jun 2006 14:07:23 -0000
-@@ -1183,13 +1183,6 @@ void OutputDevice::DrawImage( const Poin
- }
- break;
-
-- case IMAGETYPE_IMAGEREF:
-- {
-- ImplImageRefData* pData = static_cast< ImplImageRefData* >( rImage.mpImplData->mpData );
-- pData->mpImplData->mpImageBitmap->Draw( pData->mnIndex, this, rPos, nStyle );
-- }
-- break;
--
- default:
- break;
- }
-@@ -1225,14 +1218,7 @@ void OutputDevice::DrawImage( const Poin
- pData->mpImageBitmap->Draw( 0, this, rPos, nStyle, &rSize );
- }
- break;
--
-- case IMAGETYPE_IMAGEREF:
-- {
-- ImplImageRefData* pData = static_cast< ImplImageRefData* >( rImage.mpImplData->mpData );
-- pData->mpImplData->mpImageBitmap->Draw( pData->mnIndex, this, rPos, nStyle, &rSize );
-- }
-- break;
--
-+
- default:
- break;
- }
-Index: vcl/source/gdi/bitmapex.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/bitmapex.cxx,v
-retrieving revision 1.17
-diff -u -p -u -r1.17 bitmapex.cxx
---- vcl/source/gdi/bitmapex.cxx 5 Jan 2006 18:07:16 -0000 1.17
-+++ vcl/source/gdi/bitmapex.cxx 20 Jun 2006 14:07:23 -0000
-@@ -93,6 +93,28 @@ BitmapEx::BitmapEx( const BitmapEx& rBit
- {
- }
-
-+BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) :
-+ eTransparent( TRANSPARENT_NONE ),
-+ bAlpha ( FALSE )
-+{
-+ if( rBitmapEx.IsEmpty() )
-+ return;
-+
-+ aBitmap = Bitmap( aSize, rBitmapEx.aBitmap.GetBitCount() );
-+ aBitmapSize = aSize;
-+ if( rBitmapEx.IsAlpha() )
-+ {
-+ bAlpha = TRUE;
-+ aMask = AlphaMask( aSize ).ImplGetBitmap();
-+ }
-+ else if( rBitmapEx.IsTransparent() )
-+ aMask = Bitmap( aSize, rBitmapEx.aMask.GetBitCount() );
-+
-+ Rectangle aDestRect( Point( 0, 0 ), aSize );
-+ Rectangle aSrcRect( aSrc, aSize );
-+ CopyPixel( aDestRect, aSrcRect, &rBitmapEx );
-+}
-+
- // ------------------------------------------------------------------
-
- BitmapEx::BitmapEx( const ResId& rResId ) :
-Index: vcl/inc/bitmapex.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/bitmapex.hxx,v
-retrieving revision 1.11
-diff -u -p -u -r1.11 bitmapex.hxx
---- vcl/inc/bitmapex.hxx 9 Sep 2005 10:48:00 -0000 1.11
-+++ vcl/inc/bitmapex.hxx 20 Jun 2006 14:07:23 -0000
-@@ -94,6 +94,7 @@ public:
- BitmapEx();
- BitmapEx( const ResId& rResId );
- BitmapEx( const BitmapEx& rBitmapEx );
-+ BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize );
- BitmapEx( const Bitmap& rBmp );
- BitmapEx( const Bitmap& rBmp, const Bitmap& rMask );
- BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask );
-Index: vcl/source/gdi/impimage.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/impimage.cxx,v
-retrieving revision 1.18
-diff -u -p -u -r1.18 impimage.cxx
---- vcl/source/gdi/impimage.cxx 9 Sep 2005 12:01:31 -0000 1.18
-+++ vcl/source/gdi/impimage.cxx 21 Jun 2006 14:50:59 -0000
-@@ -70,8 +70,9 @@
- // ----------------
-
- ImageAryData::ImageAryData() :
-+ maName(),
- mnId( 0 ),
-- mnRefCount( 0 )
-+ maBitmapEx()
- {
- }
-
-@@ -80,7 +81,13 @@ ImageAryData::ImageAryData() :
- ImageAryData::ImageAryData( const ImageAryData& rData ) :
- maName( rData.maName ),
- mnId( rData.mnId ),
-- mnRefCount( rData.mnRefCount )
-+ maBitmapEx( rData.maBitmapEx )
-+{
-+}
-+
-+ImageAryData::ImageAryData( const rtl::OUString &aName,
-+ USHORT nId, const BitmapEx &aBitmap )
-+ : maName( aName ), mnId( nId ), maBitmapEx( aBitmap )
- {
- }
-
-@@ -96,7 +103,7 @@ ImageAryData& ImageAryData::operator=( c
- {
- maName = rData.maName;
- mnId = rData.mnId;
-- mnRefCount = rData.mnRefCount;
-+ maBitmapEx = rData.maBitmapEx;
-
- return *this;
- }
-@@ -109,38 +116,41 @@ ImplImageList::ImplImageList()
- {
- }
-
--// -----------------------------------------------------------------------
-+ImplImageList::ImplImageList( const ImplImageList &aSrc )
-+{
-+ maImageSize = aSrc.maImageSize;
-+ maPrefix = aSrc.maPrefix;
-+ maImages.reserve( aSrc.maImages.size() );
-+ mnRefCount = 1;
-+ for (int i = 0; i < aSrc.maImages.size(); i++)
-+ {
-+ maImages[ i ] = new ImageAryData( *aSrc.maImages[ i ] );
-+ if( maImages[ i ]->maName.getLength() )
-+ maNameHash [ maImages[ i ]->maName ] = maImages[ i ];
-+ }
-+}
-
- ImplImageList::~ImplImageList()
- {
-- delete mpImageBitmap;
-- delete[] mpAry;
-+ for (int i = 0; i < maImages.size(); i++)
-+ delete maImages[i];
- }
-
--// --------------------
--// - ImplImageRefData -
--// --------------------
--
--ImplImageRefData::~ImplImageRefData()
-+void ImplImageList::AddImage( const ::rtl::OUString &aName,
-+ USHORT nId, const BitmapEx &aBitmapEx )
- {
-- --mpImplData->mnIRefCount;
--
-- if( mpImplData->mnRefCount || mpImplData->mnIRefCount )
-- {
-- --mpImplData->mpAry[mnIndex].mnRefCount;
--
-- if( !mpImplData->mpAry[mnIndex].mnRefCount )
-- --mpImplData->mnRealCount;
-- }
-- else
-- delete mpImplData;
-+ ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx );
-+ maImages.push_back( pImg );
-+ if( aName.getLength() )
-+ maNameHash [ aName ] = pImg;
- }
-
--// -----------------------------------------------------------------------
--
--BOOL ImplImageRefData::IsEqual( const ImplImageRefData& rData )
-+void ImplImageList::RemoveImage( USHORT nPos )
- {
-- return( ( mpImplData == rData.mpImplData ) && ( mnIndex == rData.mnIndex ) );
-+ ImageAryData *pImg = maImages[ nPos ];
-+ if( pImg->maName.getLength() )
-+ maNameHash.erase( pImg->maName );
-+ maImages.erase( maImages.begin() + nPos );
- }
-
- // -----------------
-@@ -190,10 +200,6 @@ ImplImage::~ImplImage()
- case IMAGETYPE_IMAGE:
- delete static_cast< ImplImageData* >( mpData );
- break;
--
-- case IMAGETYPE_IMAGEREF:
-- delete static_cast< ImplImageRefData* >( mpData );
-- break;
- }
- }
-
-Index: vcl/inc/image.h
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/image.h,v
-retrieving revision 1.8
-diff -u -p -u -r1.8 image.h
---- vcl/inc/image.h 9 Sep 2005 11:01:36 -0000 1.8
-+++ vcl/inc/image.h 21 Jun 2006 14:50:59 -0000
-@@ -40,6 +40,8 @@
- #include <bitmapex.hxx>
- #endif
-
-+#include <hash_map>
-+
- // ----------------
- // - ImplImageBmp -
- // ----------------
-@@ -94,13 +96,19 @@ enum ImageType { IMAGETYPE_BITMAP, IMAGE
- struct ImageAryData
- {
- ::rtl::OUString maName;
-- USHORT mnId;
-- USHORT mnRefCount;
-+ // Images identified by either name, or by id
-+ USHORT mnId;
-+ BitmapEx maBitmapEx;
-
-- ImageAryData();
-- ImageAryData( const ImageAryData& rData );
-- ~ImageAryData();
-+ ImageAryData();
-+ ImageAryData( const rtl::OUString &aName,
-+ USHORT nId, const BitmapEx &aBitmap );
-+ ImageAryData( const ImageAryData& rData );
-+ ~ImageAryData();
-
-+ bool IsLoadable() { return maBitmapEx.IsEmpty() && maName.getLength(); }
-+ void Load(const rtl::OUString &rPrefix);
-+
- ImageAryData& operator=( const ImageAryData& rData );
- };
-
-@@ -108,17 +116,20 @@ struct ImageAryData
-
- struct ImplImageList
- {
-- ULONG mnRefCount;
-- ULONG mnIRefCount;
-- USHORT mnCount;
-- USHORT mnRealCount;
-- USHORT mnArySize;
-- ImageAryData* mpAry;
-- Size maImageSize;
-- ImplImageBmp* mpImageBitmap;
--
-- ImplImageList();
-- ~ImplImageList();
-+ ULONG mnRefCount;
-+ std::vector<ImageAryData *> maImages;
-+ rtl::OUString maPrefix;
-+ Size maImageSize;
-+ std::hash_map< rtl::OUString, ImageAryData *,
-+ rtl::OUStringHash > maNameHash;
-+
-+ ImplImageList();
-+ ImplImageList( const ImplImageList &aSrc );
-+ ~ImplImageList();
-+
-+ void AddImage( const ::rtl::OUString &aName,
-+ USHORT nId, const BitmapEx &aBitmapEx );
-+ void RemoveImage( USHORT nPos );
- };
-
- // --------------------
-Index: vcl/inc/image.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/image.hxx,v
-retrieving revision 1.13
-diff -u -p -u -r1.13 image.hxx
---- vcl/inc/image.hxx 5 Jan 2006 18:06:22 -0000 1.13
-+++ vcl/inc/image.hxx 21 Jun 2006 14:50:59 -0000
-@@ -137,39 +137,24 @@ public:
- const ::rtl::OUString& rPrefix,
- const Color* pMaskColor = NULL );
- ImageList( const ImageList& rImageList );
-- ImageList( const BitmapEx& rBitmapEx,
-- USHORT nInitSize,
-- USHORT* pIdAry = NULL,
-- USHORT nGrow = 4 );
-- ImageList( const BitmapEx& rBitmapEx,
-- const ::std::vector< ::rtl::OUString >& rNameVector,
-- USHORT nGrow = 4 );
--
-- ImageList( const Bitmap& rBitmap,
-- USHORT nInitSize, USHORT* pIdAry = NULL,
-- USHORT nGrow = 4 );
-- ImageList( const Bitmap& rBitmap, const Bitmap& rMaskBmp,
-- USHORT nInitSize, USHORT* pIdAry = NULL,
-- USHORT nGrow = 4 );
-- ImageList( const Bitmap& rBitmap, const Color& rColor,
-- USHORT nInitSize, USHORT* pIdAry = NULL,
-- USHORT nGrow = 4 );
- ~ImageList();
-
- void Clear();
--
-+ void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
-+ const std::vector< rtl::OUString > &rNameVector );
-+ void InsertFromHorizontalBitmap( const ResId& rResId,
-+ USHORT nCount,
-+ const Color *pNonAlphaMaskColor,
-+ const Color *pSearchColors = NULL,
-+ const Color *pReplaceColors = NULL,
-+ ULONG nColorCount = 0);
-+ BitmapEx GetAsHorizontalStrip() const;
- USHORT GetImageCount() const;
- Size GetImageSize() const;
-- BitmapEx GetBitmapEx() const;
-- ImageList GetColorTransformedImageList( ImageColorTransform eColorTransform ) const;
-- void Invert();
-
- void AddImage( USHORT nNewId, const Image& rImage );
- void AddImage( const ::rtl::OUString& rImageName, const Image& rImage );
--
-- void CopyImage( USHORT nNewId, USHORT nCopyId );
-- void CopyImage( const ::rtl::OUString& rImageName, const ::rtl::OUString& rCopyName );
--
-+
- void ReplaceImage( USHORT nId, const Image& rImage );
- void ReplaceImage( const ::rtl::OUString& rImageName, const Image& rImage );
-
-@@ -183,6 +168,7 @@ public:
- Image GetImage( const ::rtl::OUString& rImageName ) const;
-
- USHORT GetImagePos( USHORT nId ) const;
-+ bool HasImageAtPos( USHORT nId ) const;
- USHORT GetImagePos( const ::rtl::OUString& rImageName ) const;
-
- USHORT GetImageId( USHORT nPos ) const;
-@@ -195,9 +181,6 @@ public:
- BOOL operator==( const ImageList& rImageList ) const;
- BOOL operator!=( const ImageList& rImageList ) const { return !(ImageList::operator==( rImageList )); }
-
-- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, ImageList& rImageList );
-- friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const ImageList& rImageList );
--
- private:
-
- ImplImageList* mpImplData;
-@@ -209,7 +192,7 @@ private:
- const ::rtl::OUString& rSymbolsStyle,
- BitmapEx& rBmpEx,
- const Color* pMaskColor ) const;
-- SAL_DLLPRIVATE void ImplInit( const BitmapEx& rBitmapEx, USHORT nInit, const USHORT* pIdAry, const ::std::vector< ::rtl::OUString >* pNames, USHORT nGrow );
-+ SAL_DLLPRIVATE void ImplInit( USHORT nItems, const Size &rSize );
- SAL_DLLPRIVATE USHORT ImplGetImageId( const ::rtl::OUString& rImageName ) const;
- SAL_DLLPRIVATE void ImplMakeUnique();
- };
-Index: vcl/source/gdi/image.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/gdi/image.cxx,v
-retrieving revision 1.22
-diff -u -p -u -r1.22 image.cxx
---- vcl/source/gdi/image.cxx 5 Jan 2006 18:07:31 -0000 1.22
-+++ vcl/source/gdi/image.cxx 22 Jun 2006 16:47:34 -0000
-@@ -1,3 +1,4 @@
-+#include <stdio.h>
- /*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
-@@ -266,10 +267,6 @@ Size Image::GetSizePixel() const
- case IMAGETYPE_IMAGE:
- aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx.GetSizePixel();
- break;
--
-- case IMAGETYPE_IMAGEREF:
-- aRet = static_cast< ImplImageRefData* >( mpImplData->mpData )->mpImplData->maImageSize;
-- break;
- }
- }
-
-@@ -295,14 +292,6 @@ BitmapEx Image::GetBitmapEx() const
- case IMAGETYPE_IMAGE:
- aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx;
- break;
--
-- case IMAGETYPE_IMAGEREF:
-- {
-- ImplImageRefData* pData = static_cast< ImplImageRefData* >( mpImplData->mpData );
--
-- aRet = pData->mpImplData->mpImageBitmap->GetBitmapEx( 1, &pData->mnIndex );
-- }
-- break;
- }
- }
-
-@@ -446,10 +435,6 @@ BOOL Image::operator==( const Image& rIm
- case IMAGETYPE_IMAGE:
- bRet = static_cast< ImplImageData* >( rImage.mpImplData->mpData )->IsEqual( *static_cast< ImplImageData* >( mpImplData->mpData ) );
- break;
--
-- case IMAGETYPE_IMAGEREF:
-- bRet = static_cast< ImplImageRefData* >( rImage.mpImplData->mpData )->IsEqual( *static_cast< ImplImageRefData* >( mpImplData->mpData ) );
-- break;
-
- default:
- bRet = false;
-@@ -509,42 +494,19 @@ ImageList::ImageList( const ResId& rResI
- pResMgr->ReadLong();
- }
-
-- BitmapEx aBmpEx;
-- sal_Int32 nCount = pResMgr->ReadLong();
-- ::boost::scoped_array< USHORT > aIdArray( new USHORT[ nCount ] );
-- ::std::vector< ::rtl::OUString > aImageNames( nCount );
-- ::rtl::OUString aResMgrName( pResMgr->GetFileName() );
-- ::rtl::OUString aUserImageName;
-- sal_Int32 nPos = aResMgrName.lastIndexOf( '\\' );
--
-- // load file entry list
-- for( sal_Int32 i = 0; i < nCount; ++i )
-- {
-- aImageNames[ i ] = pResMgr->ReadString();
-- aIdArray[ i ] = static_cast< USHORT >( pResMgr->ReadLong() );
-- }
--
-- if( -1 == nPos )
-- nPos = aResMgrName.lastIndexOf( '/' );
-+ sal_Int32 nCount = pResMgr->ReadLong();
-+ ImplInit( nCount, Size() );
-
-- if( -1 != nPos++ )
-+ BitmapEx aEmpty;
-+ for( sal_Int32 i = 0; i < nCount; ++i )
- {
-- const sal_Int32 nSecondPos = aResMgrName.lastIndexOf( '.' );
-- aUserImageName = aResMgrName.copy( nPos, ( ( -1 != nSecondPos ) ? nSecondPos : aResMgrName.getLength() ) - nPos );
-+ rtl::OUString aName = pResMgr->ReadString();
-+ USHORT nId = static_cast< USHORT >( pResMgr->ReadLong() );
-+ mpImplData->AddImage( aName, nId, aEmpty );
- }
-
-- aUserImageName += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rResId.GetId() ) );
-- aUserImageName += ::rtl::OUString::valueOf( nCount );
--
-- ::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
-- aUserImageName += aCurrentSymbolsStyle;
--
-- ImplInitBitmapEx( aUserImageName, aImageNames, aCurrentSymbolsStyle, aBmpEx, spMaskColor.get() );
--
- if( nObjMask & RSC_IMAGELIST_IDCOUNT )
- pResMgr->ReadShort();
--
-- ImplInit( aBmpEx, nCount, aIdArray.get(), NULL, 4 );
- }
- }
-
-@@ -561,22 +523,15 @@ ImageList::ImageList( const ::std::vecto
-
- DBG_CTOR( ImageList, NULL );
-
-- BitmapEx aBmpEx;
-- ::rtl::OUString aUserImageName( rPrefix );
-- ::std::vector< ::rtl::OUString > aImageNames( rNameVector.size() );
-- const lang::Locale& rLocale = Application::GetSettings().GetUILocale();
--
-- for( sal_Int32 i = 0, nCount = rNameVector.size(); i < nCount; ++i )
-- ( aImageNames[ i ] = rPrefix ) += rNameVector[ i ];
--
-- aUserImageName = ( ( aUserImageName += rLocale.Language ) += rLocale.Country ).replace( '/', '_' );
-- aUserImageName += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rNameVector.size() ) );
--
-- ::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
-- aUserImageName += aCurrentSymbolsStyle;
--
-- ImplInitBitmapEx( aUserImageName, aImageNames, aCurrentSymbolsStyle, aBmpEx, pMaskColor );
-- ImplInit( aBmpEx, static_cast< USHORT >( rNameVector.size() ), NULL, &rNameVector, 4 );
-+ ImplInit( rNameVector.size(), Size() );
-+
-+ mpImplData->maPrefix = rPrefix;
-+ for( sal_Int32 i = 0; i < rNameVector.size(); ++i )
-+ {
-+// fprintf (stderr, "List %p [%d]: '%s'\n",
-+// this, i, rtl::OUStringToOString( rNameVector[i], RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mpImplData->AddImage( rNameVector[ i ], i + 1, BitmapEx() );
-+ }
- }
-
- // -----------------------------------------------------------------------
-@@ -594,250 +549,136 @@ ImageList::ImageList( const ImageList& r
-
- // -----------------------------------------------------------------------
-
--ImageList::ImageList( const BitmapEx& rBitmapEx,
-- USHORT nInit, USHORT* pIdAry, USHORT nGrow ) :
-- mpImplData( NULL ),
-- mnInitSize( nInit ),
-- mnGrowSize( nGrow )
-+ImageList::~ImageList()
- {
-- DBG_CTOR( ImageList, NULL );
-+ DBG_DTOR( ImageList, NULL );
-
-- ImplInit( rBitmapEx, nInit, pIdAry, NULL, nGrow );
-+ if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
-+ delete mpImplData;
- }
-
--// -----------------------------------------------------------------------
--
--ImageList::ImageList( const BitmapEx& rBitmapEx,
-- const ::std::vector< ::rtl::OUString >& rNameVector,
-- USHORT nGrow ) :
-- mpImplData( NULL ),
-- mnInitSize( static_cast< USHORT >( rNameVector.size() ) ),
-- mnGrowSize( nGrow )
-+void ImageList::ImplInit( USHORT nItems, const Size &rSize )
- {
-- RTL_LOGFILE_CONTEXT( aLog, "vcl: ImageList::ImageList( const BitmapEx& ..." );
--
-- DBG_CTOR( ImageList, NULL );
--
-- ImplInit( rBitmapEx, static_cast< USHORT >( rNameVector.size() ), NULL, &rNameVector, nGrow );
-+ mpImplData = new ImplImageList;
-+ mpImplData->mnRefCount = 1;
-+ mpImplData->maImages.reserve( nItems );
-+ mpImplData->maImageSize = rSize;
- }
-
- // -----------------------------------------------------------------------
-
--ImageList::ImageList( const Bitmap& rBitmap,
-- USHORT nInit, USHORT* pIdAry, USHORT nGrow ) :
-- mpImplData( NULL ),
-- mnInitSize( nInit ),
-- mnGrowSize( nGrow )
-+void ImageAryData::Load(const rtl::OUString &rPrefix)
- {
-- DBG_CTOR( ImageList, NULL );
-+ static ImplImageTreeSingletonRef aImageTree;
-
-- ImplInit( rBitmap, nInit, pIdAry, NULL, nGrow );
--}
-+ ::rtl::OUString aSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
-
--// -----------------------------------------------------------------------
-+ BitmapEx aBmpEx;
-
--ImageList::ImageList( const Bitmap& rBitmap, const Bitmap& rMaskBmp,
-- USHORT nInit, USHORT* pIdAry, USHORT nGrow ) :
-- mpImplData( NULL ),
-- mnInitSize( nInit ),
-- mnGrowSize( nGrow )
--{
-- DBG_CTOR( ImageList, NULL );
-+// fprintf (stderr, "Attempt load of '%s'\n",
-+// rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-- const BitmapEx aBmpEx( rBitmap, rMaskBmp );
--
-- ImplInit( aBmpEx, nInit, pIdAry, NULL, nGrow );
-+ rtl::OUString aFileName = rPrefix;
-+ aFileName += maName;
-+ bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true );
-+ DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image");
- }
-
- // -----------------------------------------------------------------------
-
--ImageList::ImageList( const Bitmap& rBitmap, const Color& rColor,
-- USHORT nInit, USHORT* pIdAry, USHORT nGrow )
-+void ImageList::ImplMakeUnique()
- {
-- DBG_CTOR( ImageList, NULL );
--
-- const BitmapEx aBmpEx( rBitmap, rColor );
--
-- ImplInit( aBmpEx, nInit, pIdAry, NULL, nGrow );
-+ if( mpImplData && mpImplData->mnRefCount > 1 )
-+ {
-+ --mpImplData->mnRefCount;
-+ mpImplData = new ImplImageList( *mpImplData ) ;
-+ }
- }
-
- // -----------------------------------------------------------------------
--
--ImageList::~ImageList()
-+// Rather a performance hazard:
-+BitmapEx ImageList::GetAsHorizontalStrip() const
- {
-- DBG_DTOR( ImageList, NULL );
-+ Size aSize( mpImplData->maImageSize );
-+ ULONG nCount = GetImageCount();
-+ if( !nCount )
-+ return BitmapEx();
-+ aSize.Width() *= nCount;
-
-- if( mpImplData && ( 0 == --mpImplData->mnRefCount ) && ( 0 == mpImplData->mnIRefCount ) )
-- delete mpImplData;
--}
-+ // Load any stragglers
-+ for (ULONG nIdx = 0; nIdx < nCount; nIdx++)
-+ {
-+ ImageAryData *pData = mpImplData->maImages[ nIdx ];
-+ if( pData->IsLoadable() )
-+ pData->Load( mpImplData->maPrefix );
-+ }
-
--// -----------------------------------------------------------------------
-+ BitmapEx aTempl = mpImplData->maImages[ 0 ]->maBitmapEx;
-+ BitmapEx aResult;
-+ Bitmap aPixels( aSize, aTempl.GetBitmap().GetBitCount() );
-+ if( aTempl.IsAlpha() )
-+ aResult = BitmapEx( aPixels, AlphaMask( aSize ) );
-+ else if( aTempl.IsTransparent() )
-+ aResult = BitmapEx( aPixels, Bitmap( aSize, aTempl.GetMask().GetBitCount() ) );
-+ else
-+ aResult = BitmapEx( aPixels );
-
--void ImageList::ImplInitBitmapEx( const ::rtl::OUString& rUserImageName,
-- const ::std::vector< ::rtl::OUString >& rImageNames,
-- const ::rtl::OUString& rSymbolsStyle,
-- BitmapEx& rBmpEx,
-- const Color* pMaskColor ) const
--{
-- static ImplImageTreeSingletonRef aImageTree;
--
-- if( !aImageTree->loadImage( rUserImageName, rSymbolsStyle, rBmpEx ) )
-- {
-- BitmapEx aCurBmpEx;
-- Size aItemSizePixel;
-- bool bInit = false;
--
-- for( sal_Int32 i = 0, nCount = rImageNames.size(); i < nCount; ++i )
-- {
-- if( aImageTree->loadImage( rImageNames[ i ], rSymbolsStyle, aCurBmpEx, true ) )
-- {
-- const Size aCurSizePixel( aCurBmpEx.GetSizePixel() );
--
-- if( !bInit )
-- {
-- const Size aTotalSize( aCurSizePixel.Width() * nCount, aCurSizePixel.Height() );
-- BYTE cTransparent = 255;
-- const Bitmap aBmp( aTotalSize, 24 );
-- const AlphaMask aAlphaMask( aTotalSize, &cTransparent );
--
-- aItemSizePixel = aCurSizePixel;
-- rBmpEx = BitmapEx( aBmp, aAlphaMask );
--
-- bInit = true;
-- }
--
--#ifdef DBG_UTIL
-- if( ( aItemSizePixel.Width() < aCurSizePixel.Width() ) ||
-- ( aItemSizePixel.Height() < aCurSizePixel.Height() ) )
-- {
-- ByteString aStr( "Differerent dimensions in ItemList images: " );
--
-- aStr += ByteString( String( rImageNames[ i ] ), RTL_TEXTENCODING_ASCII_US );
-- aStr += " is ";
-- aStr += ByteString::CreateFromInt32( aCurSizePixel.Width() );
-- aStr += "x";
-- aStr += ByteString::CreateFromInt32( aCurSizePixel.Height() );
-- aStr += " but needs to be ";
-- aStr += ByteString::CreateFromInt32( aItemSizePixel.Width() );
-- aStr += "x";
-- aStr += ByteString::CreateFromInt32( aItemSizePixel.Height() );
-+ Rectangle aSrcRect( Point( 0, 0 ), mpImplData->maImageSize );
-+ for (ULONG nIdx = 0; nIdx < nCount; nIdx++)
-+ {
-+ Rectangle aDestRect( Point( nIdx * mpImplData->maImageSize.Width(), 0 ),
-+ mpImplData->maImageSize );
-+ ImageAryData *pData = mpImplData->maImages[ nIdx ];
-+ aResult.CopyPixel( aDestRect, aSrcRect, &pData->maBitmapEx);
-+ }
-
-- DBG_ERROR( aStr.GetBuffer() );
-- }
--#endif
--
-- const Rectangle aRectDst( Point( aItemSizePixel.Width() * i, 0 ), aItemSizePixel );
-- const Rectangle aRectSrc( Point( 0, 0 ), aCurSizePixel );
--
-- rBmpEx.CopyPixel( aRectDst, aRectSrc, &aCurBmpEx );
-- }
--#ifdef DBG_UTIL
-- else
-- {
-- ByteString aErrorStr( "ImageList::ImplInitBitmapEx(...): could not load image <" );
-- DBG_ERROR( ( ( aErrorStr += ByteString( String( rImageNames[ i ] ), RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() );
-- }
--#endif
-- }
--
-- if( !rBmpEx.IsEmpty() )
-- {
-- if( !rBmpEx.IsTransparent() && pMaskColor )
-- rBmpEx = BitmapEx( rBmpEx.GetBitmap(), *pMaskColor );
--
-- aImageTree->addUserImage( rUserImageName, rBmpEx );
-- }
-- }
-+ return aResult;
- }
-
- // -----------------------------------------------------------------------
-
--void ImageList::ImplInit( const BitmapEx& rBitmapEx,
-- USHORT nInit, const USHORT* pIdAry,
-- const ::std::vector< ::rtl::OUString >* pNames,
-- USHORT nGrow )
--{
-- RTL_LOGFILE_CONTEXT( aLog, "vcl: ImageList::ImplInit" );
--
-- if( !nInit )
-- {
-- mpImplData = NULL;
-- mnInitSize = 1;
-- mnGrowSize = nGrow;
-- }
-- else
-- {
-- DBG_ASSERT( !nInit || rBitmapEx.GetSizePixel().Width(), "ImageList::ImageList(): nInitSize != 0 and BmpSize.Width() == 0" );
-- DBG_ASSERT( (rBitmapEx.GetSizePixel().Width() % nInit) == 0, "ImageList::ImageList(): BmpSize % nInitSize != 0" );
-+void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
-+ const std::vector< rtl::OUString > &rNameVector )
-+{
-+ sal_uInt32 nItems = rNameVector.size();
-
-- Size aBmpSize( rBitmapEx.GetSizePixel() );
--
-- mpImplData = new ImplImageList;
-- mnInitSize = nInit;
-- mnGrowSize = nGrow;
-+// fprintf (stderr, "InsertFromHorizontalStrip (1) [%d items]\n", nItems);
-
-- mpImplData->mnRefCount = 1;
-- mpImplData->mnIRefCount = 0;
-- mpImplData->mnCount = nInit;
-- mpImplData->mnRealCount = nInit;
-- mpImplData->mnArySize = nInit;
-- mpImplData->mpAry = new ImageAryData[nInit];
-- mpImplData->maImageSize = Size( aBmpSize.Width() / nInit, aBmpSize.Height() );
--
-- for( USHORT i = 0; i < nInit; i++ )
-- {
-- mpImplData->mpAry[ i ].mnId = pIdAry ? pIdAry[ i ] : ( i + 1 );
-- mpImplData->mpAry[ i ].mnRefCount = 1;
--
-- if( pNames && ( i < pNames->size() ) )
-- mpImplData->mpAry[ i ].maName = (*pNames)[ i ];
-- }
--
-- mpImplData->mpImageBitmap = new ImplImageBmp;
-- mpImplData->mpImageBitmap->Create( rBitmapEx,
-- mpImplData->maImageSize.Width(),
-- mpImplData->maImageSize.Height(),
-- nInit );
-+ if (!nItems)
-+ return;
-+
-+ Size aSize( rBitmapEx.GetSizePixel() );
-+ DBG_ASSERT (rBitmapEx.GetSizePixel().Width() % nItems != 0,
-+ "ImageList::InsertFromHorizontalStrip - very odd size");
-+ aSize.Width() /= nItems;
-+ ImplInit( nItems, aSize );
-+
-+ for (ULONG nIdx = 0; nIdx < nItems; nIdx++)
-+ {
-+ BitmapEx aBitmap( rBitmapEx, Point( nIdx * aSize.Width(), 0 ), aSize );
-+ mpImplData->AddImage( rNameVector[ nIdx ], nIdx + 1, aBitmap );
- }
- }
-
- // -----------------------------------------------------------------------
-
--void ImageList::ImplMakeUnique()
-+void ImageList::InsertFromHorizontalBitmap( const ResId& rResId,
-+ USHORT nCount,
-+ const Color *pMaskColor,
-+ const Color *pSearchColors,
-+ const Color *pReplaceColors,
-+ ULONG nColorCount)
- {
-- if( mpImplData && mpImplData->mnRefCount > 1 )
-- {
-- ImplImageList* pNewData = new ImplImageList;
-- USHORT i = 0, n = 0;
--
-- --mpImplData->mnRefCount;
--
-- pNewData->mnRefCount = 1;
-- pNewData->mnIRefCount = 0;
-- pNewData->mnCount = mpImplData->mnCount;
-- pNewData->mnRealCount = mpImplData->mnRealCount;
-- pNewData->mnArySize = mpImplData->mnArySize;
-- pNewData->mpAry = new ImageAryData[ pNewData->mnArySize ];
-- pNewData->maImageSize = mpImplData->maImageSize;
-- pNewData->mpImageBitmap = new ImplImageBmp;
-- pNewData->mpImageBitmap->Create( pNewData->maImageSize.Width(), pNewData->maImageSize.Height(), pNewData->mnArySize );
-+// fprintf (stderr, "InsertFromHorizontalBitmap\n");
-
-- while( i < mpImplData->mnArySize )
-- {
-- if( mpImplData->mpAry[i].mnId )
-- {
-- pNewData->mpAry[n].maName = mpImplData->mpAry[i].maName;
-- pNewData->mpAry[n].mnId = mpImplData->mpAry[i].mnId;
-- pNewData->mpAry[n].mnRefCount = 1;
-- pNewData->mpImageBitmap->Replace( n, *mpImplData->mpImageBitmap, i );
-- ++n;
-- }
--
-- ++i;
-- }
--
-- mpImplData = pNewData;
-- }
-+ BitmapEx aBmpEx( rResId );
-+ if (!aBmpEx.IsTransparent())
-+ aBmpEx = BitmapEx( aBmpEx.GetBitmap(), *pMaskColor );
-+ if (nColorCount)
-+ aBmpEx.Replace( pSearchColors, pReplaceColors, nColorCount );
-+
-+ std::vector< rtl::OUString > aNames( nCount );
-+ InsertFromHorizontalStrip( aBmpEx, aNames );
- }
-
- // -----------------------------------------------------------------------
-@@ -846,23 +687,11 @@ USHORT ImageList::ImplGetImageId( const
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- if( mpImplData && rImageName.getLength() )
-- {
-- USHORT nPos = 0, i = 0;
--
-- while( i < mpImplData->mnArySize )
-- {
-- if( mpImplData->mpAry[i].maName == rImageName )
-- return mpImplData->mpAry[i].mnId;
--
-- if ( mpImplData->mpAry[i].mnId )
-- ++nPos;
--
-- ++i;
-- }
-- }
--
-- return 0;
-+ ImageAryData *pImg = mpImplData->maNameHash[ rImageName ];
-+ if( pImg )
-+ return pImg->mnId;
-+ else
-+ return 0;
- }
-
- // -----------------------------------------------------------------------
-@@ -876,106 +705,10 @@ void ImageList::AddImage( USHORT nId, co
- DBG_ASSERT( rImage.mpImplData, "ImageList::AddImage(): Wrong Size" );
- DBG_ASSERT( !mpImplData || (rImage.GetSizePixel() == mpImplData->maImageSize), "ImageList::AddImage(): Wrong Size" );
-
-- bool bHasImage = ( rImage.mpImplData != 0 );
-- ImageType eImageType = IMAGETYPE_BITMAP;
-- Size aImageSize;
-- USHORT nIndex;
--
-- if( bHasImage )
-- {
-- eImageType = rImage.mpImplData->meType;
-- aImageSize = rImage.GetSizePixel();
-- }
-- else
-- {
-- if( mpImplData )
-- {
-- eImageType = IMAGETYPE_BITMAP;
-- aImageSize = mpImplData->maImageSize;
-- }
-- else
-- return;
-- }
--
- if( !mpImplData )
-- {
-- mpImplData = new ImplImageList;
-- mpImplData->mnRefCount = 1;
-- mpImplData->mnIRefCount = 0;
-- mpImplData->mnCount = 0;
-- mpImplData->mnRealCount = 0;
-- mpImplData->mnArySize = mnInitSize;
-- mpImplData->mpAry = new ImageAryData[mnInitSize];
-- mpImplData->maImageSize = aImageSize;
-- mpImplData->mpImageBitmap = new ImplImageBmp;
-- mpImplData->mpImageBitmap->Create( aImageSize.Width(), aImageSize.Height(), mnInitSize );
-- }
-- else
-- ImplMakeUnique();
--
-- if( mpImplData->mnRealCount == mpImplData->mnArySize )
-- {
-- ImageAryData* pOldAry = mpImplData->mpAry;
-- USHORT nOldSize = mpImplData->mnArySize;
--
-- mpImplData->mnArySize += mnGrowSize;
-- mpImplData->mpAry = new ImageAryData[mpImplData->mnArySize];
--
-- for( USHORT i = 0; i < nOldSize; ++i )
-- mpImplData->mpAry[ i ] = pOldAry[ i ];
--
-- mpImplData->mpImageBitmap->Expand( mnGrowSize );
-- delete[] pOldAry;
-- nIndex = mpImplData->mnRealCount;
-- }
-- else
-- {
-- nIndex = 0;
--
-- while( mpImplData->mpAry[nIndex].mnRefCount )
-- ++nIndex;
-- }
-+ ImplInit( 0, rImage.GetSizePixel() );
-
-- switch( eImageType )
-- {
-- case IMAGETYPE_BITMAP:
-- {
-- if( !bHasImage )
-- {
-- const Bitmap aBmp( aImageSize, 1 );
-- const BitmapEx aBmpEx( aBmp, COL_BLACK );
--
-- mpImplData->mpImageBitmap->Replace( nIndex, aBmpEx );
-- }
-- else
-- mpImplData->mpImageBitmap->Replace( nIndex, *static_cast< Bitmap* >( rImage.mpImplData->mpData ) );
-- }
-- break;
--
-- case IMAGETYPE_IMAGE:
-- {
-- ImplImageData* pData = static_cast< ImplImageData* >( rImage.mpImplData->mpData );
--
-- if( pData->mpImageBitmap )
-- mpImplData->mpImageBitmap->Replace( nIndex, *pData->mpImageBitmap, 0 );
-- else
-- mpImplData->mpImageBitmap->Replace( nIndex, pData->maBmpEx );
-- }
-- break;
--
-- case IMAGETYPE_IMAGEREF:
-- {
-- ImplImageRefData* pData = static_cast< ImplImageRefData* >( rImage.mpImplData->mpData );
--
-- mpImplData->mpImageBitmap->Replace( nIndex, *pData->mpImplData->mpImageBitmap, pData->mnIndex );
-- }
-- break;
-- }
--
-- ++mpImplData->mnCount;
-- ++mpImplData->mnRealCount;
-- mpImplData->mpAry[nIndex].mnId = nId;
-- mpImplData->mpAry[nIndex].mnRefCount = 1;
-+ mpImplData->AddImage( rtl::OUString(), nId, rImage.GetBitmapEx());
- }
-
- // -----------------------------------------------------------------------
-@@ -984,101 +717,11 @@ void ImageList::AddImage( const ::rtl::O
- {
- DBG_ASSERT( GetImagePos( rImageName ) == IMAGELIST_IMAGE_NOTFOUND, "ImageList::AddImage() - ImageName already exists" );
-
-- USHORT i, nMax = 0;
--
-- if( mpImplData )
-- {
-- for( i = 0; i < mpImplData->mnArySize; ++i )
-- {
-- if( mpImplData->mpAry[ i ].mnId > nMax )
-- {
-- nMax = mpImplData->mpAry[ i ].mnId;
-- }
-- }
-- }
--
-- if( nMax < USHRT_MAX )
-- {
-- AddImage( ++nMax, rImage );
--
-- for( i = 0; i < mpImplData->mnArySize; ++i )
-- {
-- if( mpImplData->mpAry[ i ].mnId == nMax )
-- {
-- mpImplData->mpAry[ i ].maName = rImageName;
-- break;
-- }
-- }
-- }
-- else
-- {
-- DBG_ERROR( "No free image id left" );
-- }
--}
--
--// -----------------------------------------------------------------------
--
--void ImageList::CopyImage( USHORT nId, USHORT nCopyId )
--{
-- DBG_CHKTHIS( ImageList, NULL );
-- DBG_ASSERT( nId, "ImageList::CopyImage(): ImageId == 0" );
-- DBG_ASSERT( GetImagePos( nId ) == IMAGELIST_IMAGE_NOTFOUND, "ImageList::CopyImage(): ImageId already exists" );
-- DBG_ASSERT( GetImagePos( nCopyId ) != IMAGELIST_IMAGE_NOTFOUND, "ImageList::CopyImage(): Unknown nCopyId" );
--
-- USHORT nIndex, nCopyIndex = 0;
--
-- while( nCopyIndex < mpImplData->mnArySize )
-- {
-- if ( mpImplData->mpAry[nCopyIndex].mnId == nCopyId )
-- break;
--
-- ++nCopyIndex;
-- }
--
-- if( nCopyIndex < mpImplData->mnArySize )
-- {
-- ImplMakeUnique();
--
-- if( mpImplData->mnRealCount == mpImplData->mnArySize )
-- {
-- ImageAryData* pOldAry = mpImplData->mpAry;
-- USHORT nOldSize = mpImplData->mnArySize;
--
-- mpImplData->mnArySize += mnGrowSize;
-- mpImplData->mpAry = new ImageAryData[mpImplData->mnArySize];
--
-- for( USHORT i = 0; i < nOldSize; ++i )
-- mpImplData->mpAry[ i ] = pOldAry[ i ];
--
-- mpImplData->mpImageBitmap->Expand( mnGrowSize );
-- delete[] pOldAry;
-- nIndex = mpImplData->mnRealCount;
-- }
-- else
-- {
-- nIndex = 0;
--
-- while( mpImplData->mpAry[nIndex].mnRefCount )
-- nIndex++;
-- }
--
-- mpImplData->mpImageBitmap->Replace( nIndex, *mpImplData->mpImageBitmap, nCopyIndex );
--
-- ++mpImplData->mnCount;
-- ++mpImplData->mnRealCount;
-- mpImplData->mpAry[nIndex].mnId = nId;
-- mpImplData->mpAry[nIndex].mnRefCount = 1;
-- }
--}
--
--// -----------------------------------------------------------------------
--
--void ImageList::CopyImage( const ::rtl::OUString& rImageName, const ::rtl::OUString& rCopyName )
--{
-- const USHORT nId1 = ImplGetImageId( rImageName ), nId2 = ImplGetImageId( rCopyName );
-+ if( !mpImplData )
-+ ImplInit( 0, rImage.GetSizePixel() );
-
-- if( nId1 && nId2 )
-- CopyImage( nId1, nId2 );
-+ mpImplData->AddImage( rImageName, mpImplData->maImages.size() + 1,
-+ rImage.GetBitmapEx() );
- }
-
- // -----------------------------------------------------------------------
-@@ -1111,31 +754,13 @@ void ImageList::ReplaceImage( USHORT nId
- DBG_ASSERT( GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND, "ImageList::ReplaceImage(): Unknown nId" );
- DBG_ASSERT( GetImagePos( nReplaceId ) != IMAGELIST_IMAGE_NOTFOUND, "ImageList::ReplaceImage(): Unknown nReplaceId" );
-
-- USHORT nPos1 = 0, nPos2 = 0;
--
-- while( nPos1 < mpImplData->mnArySize )
-- {
-- if ( mpImplData->mpAry[nPos1].mnId == nId )
-- break;
--
-- ++nPos1;
-- }
--
-- if( nPos1 < mpImplData->mnArySize )
-+ ULONG nPosDest = GetImagePos( nId );
-+ ULONG nPosSrc = GetImagePos( nReplaceId );
-+ if( nPosDest != IMAGELIST_IMAGE_NOTFOUND &&
-+ nPosSrc != IMAGELIST_IMAGE_NOTFOUND )
- {
-- while( nPos2 < mpImplData->mnArySize )
-- {
-- if( mpImplData->mpAry[nPos2].mnId == nReplaceId )
-- break;
--
-- ++nPos2;
-- }
--
-- if( nPos2 < mpImplData->mnArySize )
-- {
-- ImplMakeUnique();
-- mpImplData->mpImageBitmap->Replace( nPos1, nPos2 );
-- }
-+ ImplMakeUnique();
-+ mpImplData->maImages[nPosDest] = mpImplData->maImages[nPosSrc];
- }
- }
-
-@@ -1155,29 +780,12 @@ void ImageList::RemoveImage( USHORT nId
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- if( mpImplData )
-+ for( int i = 0; i < mpImplData->maImages.size(); i++ )
- {
-- USHORT i = 0;
--
-- ImplMakeUnique();
--
-- while( i < mpImplData->mnArySize )
-+ if( mpImplData->maImages[ i ]->mnId == nId )
- {
-- if( mpImplData->mpAry[i].mnId == nId )
-- break;
--
-- ++i;
-- }
--
-- if( i < mpImplData->mnArySize )
-- {
-- --mpImplData->mpAry[i].mnRefCount;
-- mpImplData->mpAry[i].mnId = 0;
--
-- if( !mpImplData->mpAry[i].mnRefCount )
-- --mpImplData->mnRealCount;
--
-- --mpImplData->mnCount;
-+ mpImplData->RemoveImage( i );
-+ break;
- }
- }
- }
-@@ -1198,49 +806,50 @@ Image ImageList::GetImage( USHORT nId )
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- Image aImage;
-+// fprintf (stderr, "GetImage %d\n", nId);
-+
-+ Image aRet;
-
- if( mpImplData )
- {
-- USHORT i = 0;
--
-- while( i < mpImplData->mnArySize )
-- {
-- if( mpImplData->mpAry[i].mnId == nId )
-- break;
--
-- ++i;
-- }
--
-- if( i < mpImplData->mnArySize )
-+ std::vector<ImageAryData *>::iterator aIter;
-+ for( aIter = mpImplData->maImages.begin();
-+ aIter != mpImplData->maImages.end(); aIter++)
- {
-- ImplImageRefData* mpData = new ImplImageRefData;
-+ if ((*aIter)->mnId == nId)
-+ {
-+ if( (*aIter)->IsLoadable() )
-+ (*aIter)->Load( mpImplData->maPrefix );
-
-- ++mpImplData->mnIRefCount;
-- ++mpImplData->mpAry[i].mnRefCount;
-- mpData->mpImplData = mpImplData;
-- mpData->mnIndex = i;
--
-- aImage.mpImplData = new ImplImage;
-- aImage.mpImplData->mnRefCount = 1;
-- aImage.mpImplData->meType = IMAGETYPE_IMAGEREF;
-- aImage.mpImplData->mpData = mpData;
-+ aRet = Image( (*aIter)->maBitmapEx );
-+ }
- }
- }
-
-- return aImage;
-+ return aRet;
- }
-
- // -----------------------------------------------------------------------
-
- Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const
- {
-- const USHORT nId = ImplGetImageId( rImageName );
-+// fprintf (stderr, "GetImage '%s'\n",
-+// rtl::OUStringToOString( rImageName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-- if( nId )
-- return GetImage( nId );
-- else
-- return Image();
-+ if( mpImplData )
-+ {
-+ ImageAryData *pImg = mpImplData->maNameHash[ rImageName ];
-+
-+ if( pImg )
-+ {
-+ if( pImg->IsLoadable() )
-+ pImg->Load( mpImplData->maPrefix );
-+ return Image( pImg->maBitmapEx );
-+ }
-+ }
-+// fprintf (stderr, "no such image\n");
-+
-+ return Image();
- }
-
- // -----------------------------------------------------------------------
-@@ -1261,7 +870,7 @@ USHORT ImageList::GetImageCount() const
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- return( mpImplData ? mpImplData->mnCount : 0 );
-+ return mpImplData ? mpImplData->maImages.size() : 0;
- }
-
- // -----------------------------------------------------------------------
-@@ -1272,23 +881,21 @@ USHORT ImageList::GetImagePos( USHORT nI
-
- if( mpImplData && nId )
- {
-- USHORT nPos = 0, i = 0;
--
-- while( i < mpImplData->mnArySize )
-+ for( int i = 0; i < mpImplData->maImages.size(); i++ )
- {
-- if( mpImplData->mpAry[i].mnId == nId )
-- return nPos;
--
-- if ( mpImplData->mpAry[i].mnId )
-- ++nPos;
--
-- ++i;
-+ if (mpImplData->maImages[ i ]->mnId == nId)
-+ return i;
- }
- }
-
- return IMAGELIST_IMAGE_NOTFOUND;
- }
-
-+bool ImageList::HasImageAtPos( USHORT nId ) const
-+{
-+ return GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND;
-+}
-+
- // -----------------------------------------------------------------------
-
- USHORT ImageList::GetImagePos( const ::rtl::OUString& rImageName ) const
-@@ -1297,17 +904,11 @@ USHORT ImageList::GetImagePos( const ::r
-
- if( mpImplData && rImageName.getLength() )
- {
-- USHORT nPos = 0, i = 0;
--
-- while( i < mpImplData->mnArySize )
-+ std::vector<ImageAryData *>::iterator aIter;
-+ for( sal_Int32 i = 0; i < mpImplData->maImages.size(); i++ )
- {
-- if( mpImplData->mpAry[i].maName == rImageName )
-- return nPos;
--
-- if ( mpImplData->mpAry[i].mnId )
-- ++nPos;
--
-- ++i;
-+ if (mpImplData->maImages[i]->maName == rImageName)
-+ return i;
- }
- }
-
-@@ -1320,21 +921,8 @@ USHORT ImageList::GetImageId( USHORT nPo
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- if( mpImplData )
-- {
-- USHORT nRealPos = 0, i = 0;
--
-- while( i < mpImplData->mnArySize )
-- {
-- if( (nPos == nRealPos) && (mpImplData->mpAry[i].mnId) )
-- return mpImplData->mpAry[i].mnId;
--
-- if ( mpImplData->mpAry[i].mnId )
-- ++nRealPos;
--
-- ++i;
-- }
-- }
-+ if( mpImplData && nPos < mpImplData->maImages.size() )
-+ return mpImplData->maImages[ nPos ]->mnId;
-
- return 0;
- }
-@@ -1351,11 +939,8 @@ void ImageList::GetImageIds( ::std::vect
-
- if( mpImplData )
- {
-- for( USHORT i = 0; i < mpImplData->mnArySize; ++i )
-- {
-- if( mpImplData->mpAry[ i ].mnId )
-- rIds.push_back( mpImplData->mpAry[ i ].mnId );
-- }
-+ for( int i = 0; i < mpImplData->maImages.size(); i++ )
-+ rIds.push_back( mpImplData->maImages[i]->mnId );
- }
- }
-
-@@ -1365,21 +950,8 @@ void ImageList::GetImageIds( ::std::vect
- {
- DBG_CHKTHIS( ImageList, NULL );
-
-- if( mpImplData )
-- {
-- USHORT nRealPos = 0, i = 0;
--
-- while( i < mpImplData->mnArySize )
-- {
-- if( (nPos == nRealPos) && (mpImplData->mpAry[i].mnId) )
-- return mpImplData->mpAry[i].maName;
--
-- if ( mpImplData->mpAry[i].mnId )
-- ++nRealPos;
--
-- ++i;
-- }
-- }
-+ if( mpImplData && nPos < mpImplData->maImages.size() )
-+ return mpImplData->maImages[ nPos ]->maName;
-
- return ::rtl::OUString();
- }
-@@ -1396,11 +968,8 @@ void ImageList::GetImageNames( ::std::ve
-
- if( mpImplData )
- {
-- for( USHORT i = 0; i < mpImplData->mnArySize; ++i )
-- {
-- if( mpImplData->mpAry[ i ].mnId )
-- rNames.push_back( mpImplData->mpAry[ i ].maName );
-- }
-+ for( int i = 0; i < mpImplData->maImages.size(); i++ )
-+ rNames.push_back( mpImplData->maImages[ i ]->maName );
- }
- }
-
-@@ -1413,92 +982,25 @@ Size ImageList::GetImageSize() const
- Size aRet;
-
- if( mpImplData )
-+ {
- aRet = mpImplData->maImageSize;
-
-- return aRet;
--}
--
--// -----------------------------------------------------------------------
--
--BitmapEx ImageList::GetBitmapEx() const
--{
-- DBG_CHKTHIS( ImageList, NULL );
--
-- BitmapEx aRet;
--
-- if( mpImplData )
-- {
-- USHORT* pPosAry = new USHORT[ mpImplData->mnCount ];
-- USHORT nPosCount = 0;
--
-- for( USHORT i = 0; i < mpImplData->mnArySize; i++ )
-+ // force load of 1st image to see - uncommon case.
-+ if( aRet.Width() == 0 && aRet.Height() == 0 &&
-+ mpImplData->maImages.size() > 0 )
- {
-- if( mpImplData->mpAry[i].mnId )
-- {
-- pPosAry[ nPosCount ] = i;
-- ++nPosCount;
-- }
-+ Image aTmp = GetImage( mpImplData->maImages[ 0 ]->mnId );
-+ aRet = mpImplData->maImageSize = aTmp.GetSizePixel();
- }
--
-- aRet = mpImplData->mpImageBitmap->GetBitmapEx( nPosCount, pPosAry );
-- delete[] pPosAry;
- }
-+// fprintf (stderr, "GetImageSize returns %d, %d\n",
-+// aRet.Width(), aRet.Height());
-
- return aRet;
- }
-
- // -----------------------------------------------------------------------
-
--ImageList ImageList::GetColorTransformedImageList( ImageColorTransform eColorTransform ) const
--{
-- DBG_CHKTHIS( ImageList, NULL );
--
-- ImageList aRet;
--
-- if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform )
-- {
-- Color* pSrcColors = NULL;
-- Color* pDstColors = NULL;
-- ULONG nColorCount = 0;
--
-- aRet = *this;
-- aRet.ImplMakeUnique();
--
-- Image::GetColorTransformArrays( eColorTransform, pSrcColors, pDstColors, nColorCount );
--
-- if( nColorCount && pSrcColors && pDstColors && mpImplData )
-- aRet.mpImplData->mpImageBitmap->ReplaceColors( pSrcColors, pDstColors, nColorCount );
--
-- delete[] pSrcColors;
-- delete[] pDstColors;
-- }
-- else if( IMAGECOLORTRANSFORM_MONOCHROME_BLACK == eColorTransform ||
-- IMAGECOLORTRANSFORM_MONOCHROME_WHITE == eColorTransform )
-- {
-- aRet = *this;
-- aRet.ImplMakeUnique();
-- aRet.mpImplData->mpImageBitmap->ColorTransform( ( BmpColorMode )( eColorTransform ) );
-- }
--
-- if( !aRet.GetImageCount() )
-- aRet = *this;
--
-- return aRet;
--}
--
--// -----------------------------------------------------------------------
--
--void ImageList::Invert()
--{
-- ImageList aNew( *this );
-- aNew.ImplMakeUnique();
-- aNew.mpImplData->mpImageBitmap->Invert();
--
-- *this = aNew;
--}
--
--// -----------------------------------------------------------------------
--
- ImageList& ImageList::operator=( const ImageList& rImageList )
- {
- DBG_CHKTHIS( ImageList, NULL );
-@@ -1507,12 +1009,10 @@ ImageList& ImageList::operator=( const I
- if( rImageList.mpImplData )
- ++rImageList.mpImplData->mnRefCount;
-
-- if( mpImplData && ( 0 == --mpImplData->mnRefCount ) && ( 0 == mpImplData->mnIRefCount ) )
-+ if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
- delete mpImplData;
-
- mpImplData = rImageList.mpImplData;
-- mnInitSize = rImageList.mnInitSize;
-- mnGrowSize = rImageList.mnGrowSize;
-
- return *this;
- }
-@@ -1530,140 +1030,9 @@ BOOL ImageList::operator==( const ImageL
- bRet = true;
- else if( !rImageList.mpImplData || !mpImplData )
- bRet = false;
-- else if( ( rImageList.mpImplData->mnCount == mpImplData->mnCount ) &&
-- ( rImageList.mpImplData->maImageSize == mpImplData->maImageSize ) )
-- {
-- bRet = true;
-- }
-+ else if( rImageList.GetImageCount() == GetImageCount() &&
-+ rImageList.mpImplData->maImageSize == mpImplData->maImageSize )
-+ bRet = true; // strange semantic
-
- return bRet;
- }
--
--// -----------------------------------------------------------------------
--
--SvStream& operator>>( SvStream& rIStream, ImageList& rImageList )
--{
-- DBG_CHKOBJ( &rImageList, ImageList, NULL );
--
-- if( rImageList.mpImplData )
-- {
-- --rImageList.mpImplData->mnRefCount;
--
-- if( ( 0 == rImageList.mpImplData->mnRefCount ) && ( 0 == rImageList.mpImplData->mnIRefCount ) )
-- delete rImageList.mpImplData;
-- }
--
-- rImageList.mpImplData = NULL;
--
-- USHORT nVersion;
-- Size aImageSize;
-- BOOL bImageList;
--
-- rIStream >> nVersion >> rImageList.mnInitSize >> rImageList.mnGrowSize >> bImageList;
--
-- if( bImageList )
-- {
-- BitmapEx aBmpEx;
-- Bitmap aBmp;
-- BYTE bMaskOrAlpha, bMaskColor;
--
-- rIStream >> aImageSize.Width() >> aImageSize.Height();
--
-- rImageList.mpImplData = new ImplImageList;
-- rImageList.mpImplData->mnRefCount = 1;
-- rImageList.mpImplData->mnIRefCount= 0;
-- rImageList.mpImplData->mnCount = rImageList.mnInitSize;
-- rImageList.mpImplData->mnRealCount = rImageList.mnInitSize;
-- rImageList.mpImplData->mnArySize = rImageList.mnInitSize;
-- rImageList.mpImplData->mpAry = new ImageAryData[ rImageList.mnInitSize ];
-- rImageList.mpImplData->maImageSize = aImageSize;
--
-- for( USHORT i = 0; i < rImageList.mnInitSize; ++i )
-- {
-- rIStream >> rImageList.mpImplData->mpAry[i].mnId;
-- rImageList.mpImplData->mpAry[i].mnRefCount = 1;
-- }
--
-- rIStream >> aBmp >> bMaskOrAlpha;
--
-- if( bMaskOrAlpha )
-- {
-- Bitmap aMaskOrAlpha;
--
-- rIStream >> aMaskOrAlpha;
--
-- if( aMaskOrAlpha.GetBitCount() == 8 && aMaskOrAlpha.HasGreyPalette() )
-- aBmpEx = BitmapEx( aBmp, AlphaMask( aMaskOrAlpha ) );
-- else
-- aBmpEx = BitmapEx( aBmp, aMaskOrAlpha );
-- }
--
-- rIStream >> bMaskColor;
--
-- if( bMaskColor )
-- {
-- Color aMaskColor;
--
-- rIStream >> aMaskColor;
--
-- if( !aBmpEx.IsAlpha() && !aBmpEx.IsTransparent() )
-- aBmpEx = BitmapEx( aBmp, aMaskColor );
-- }
--
-- rImageList.mpImplData->mpImageBitmap = new ImplImageBmp;
-- rImageList.mpImplData->mpImageBitmap->Create( aBmpEx, aImageSize.Width(), aImageSize.Height(), rImageList.mnInitSize );
-- }
--
-- return rIStream;
--}
--
--// -----------------------------------------------------------------------
--
--SvStream& operator<<( SvStream& rOStream, const ImageList& rImageList )
--{
-- DBG_CHKOBJ( &rImageList, ImageList, NULL );
--
-- USHORT nVersion = IMAGE_FILE_VERSION;
-- BOOL bImageList = rImageList.mpImplData ? true : false;
--
-- rOStream << nVersion;
--
-- if ( !bImageList || !rImageList.mpImplData->mnCount )
-- rOStream << rImageList.mnInitSize << rImageList.mnGrowSize << ( bImageList = FALSE );
-- else
-- {
-- rOStream << rImageList.mpImplData->mnCount;
-- rOStream << rImageList.mnGrowSize;
-- rOStream << bImageList;
-- rOStream << rImageList.mpImplData->maImageSize.Width();
-- rOStream << rImageList.mpImplData->maImageSize.Height();
--
-- USHORT* mpPosAry = new USHORT[rImageList.mpImplData->mnCount];
-- USHORT nPosCount = 0;
--
-- for( USHORT i = 0; i < rImageList.mpImplData->mnArySize; ++i )
-- {
-- if( rImageList.mpImplData->mpAry[i].mnId )
-- {
-- rOStream << rImageList.mpImplData->mpAry[i].mnId;
-- mpPosAry[ nPosCount++ ] = i;
-- }
-- }
--
-- BitmapEx aBmpEx( rImageList.mpImplData->mpImageBitmap->GetBitmapEx( nPosCount, mpPosAry ) );
-- const BOOL bMaskOrAlpha = aBmpEx.IsAlpha() || aBmpEx.IsTransparent();
-- const BOOL bMaskColor = false;
--
-- rOStream << aBmpEx.GetBitmap() << bMaskOrAlpha;
--
-- if( bMaskOrAlpha )
-- rOStream << ( aBmpEx.IsAlpha() ? aBmpEx.GetAlpha().ImplGetBitmap() : aBmpEx.GetMask() );
--
-- // BitmapEx doesn't have internal mask colors anymore
-- rOStream << bMaskColor;
--
-- delete[] mpPosAry;
-- }
--
-- return rOStream;
--}
diff --git a/patches/test/speed-ld-flags.diff b/patches/test/speed-ld-flags.diff
deleted file mode 100644
index c3b4b0be2..000000000
--- a/patches/test/speed-ld-flags.diff
+++ /dev/null
@@ -1,89 +0,0 @@
---- configure.in.old 2006-11-01 21:17:44.000000000 +0100
-+++ configure.in 2006-11-03 15:02:44.000000000 +0100
-@@ -1299,6 +1299,24 @@
- fi
- AC_SUBST(HAVE_LD_BDIRECT)
-
-+if test "$GCC" = "yes"; then
-+ AC_MSG_CHECKING( for --dynamic-list-cpp-typeinfo linker support )
-+ dynamic_list_cpp_typeinfo_ldflags_save=$LDFLAGS
-+ LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
-+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
-+ #include <stdio.h>
-+ ],[
-+ printf ("hello world\n");
-+ ])], HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO=TRUE, [])
-+ if test "z$HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO" = "zTRUE"; then
-+ AC_MSG_RESULT( found )
-+ else
-+ AC_MSG_RESULT( not found )
-+ fi
-+ LDFLAGS=$dynamic_list_cpp_typeinfo_ldflags_save
-+fi
-+AC_SUBST(HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO)
-+
- dnl ===================================================================
- dnl Search all the common names for GNU make
- dnl ===================================================================
---- set_soenv.in.old 2006-11-01 21:17:44.000000000 +0100
-+++ set_soenv.in 2006-11-03 14:59:48.000000000 +0100
-@@ -1735,6 +1735,8 @@
- ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
- "@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
- ToFile( "HAVE_LD_BDIRECT", "@HAVE_LD_BDIRECT@","e" );
-+ToFile( "HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO",
-+ "@HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO@","e" );
- ToFile( "CXX", $CXX, "e" );
- ToFile( "MINGWCXX", "@MINGWCXX@", "e" );
- ToFile( "MINGWSTRIP", "@MINGWSTRIP@", "e" );
---- solenv/inc/unxlngi6.mk.old 2006-11-01 21:17:22.000000000 +0100
-+++ solenv/inc/unxlngi6.mk 2006-11-03 15:17:07.000000000 +0100
-@@ -172,10 +172,13 @@
- # default linker flags
- LINKFLAGSDEFS*=-Wl,-z,defs
- LINKFLAGSRUNPATH*=-Wl,-rpath,\''$$ORIGIN'\'
--LINKFLAGS=-Wl,-z,combreloc $(LINKFLAGSDEFS) $(LINKFLAGSRUNPATH)
-+LINKFLAGS=-Wl,-z,combreloc $(LINKFLAGSDEFS) $(LINKFLAGSRUNPATH) -Wl,-Bsymbolic
- .IF "$(HAVE_LD_BDIRECT)" == "TRUE"
- LINKFLAGS += -Wl,-Bdirect
- .ENDIF
-+.IF "$(HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO)" == "TRUE"
-+LINKFLAGS += -Wl,--dynamic-list-cpp-typeinfo
-+.ENDIF
- LINKFLAGS += -Wl,-zdynsort
-
- # linker flags for linking applications
---- icu/makefile.mk.old 2006-11-01 21:17:22.000000000 +0100
-+++ icu/makefile.mk 2006-11-03 15:12:09.000000000 +0100
-@@ -75,10 +75,12 @@
- icu_CFLAGS+=-O $(ARCH_FLAGS)
- icu_CXXFLAGS+=-O $(ARCH_FLAGS)
-
-+LDFLAGSADD=-Wl,-Bsymbolic
- .IF "$(HAVE_LD_BDIRECT)" == "TRUE"
--LDFLAGSADD=-Wl,-Bdirect
--.ELSE
--LDFLAGSADD=
-+LDFLAGSADD+= -Wl,-Bdirect
-+.ENDIF
-+.IF "$(HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO)" == "TRUE"
-+LDFLAGSADD+= -Wl,--dynamic-list-cpp-typeinfo
- .ENDIF
- CONFIGURE_DIR=source
-
---- stlport/makefile.mk.old 2006-11-01 21:17:22.000000000 +0100
-+++ stlport/makefile.mk 2006-11-03 15:15:24.000000000 +0100
-@@ -153,9 +153,13 @@
- BUILD_FLAGS+= -j$(MAXPROCESS)
- .ENDIF
-
-+CXX+= -Wl,-Bsymbolic
- .IF "$(HAVE_LD_BDIRECT)" == "TRUE"
- CXX+= -Wl,-Bdirect
- .ENDIF
-+.IF "$(HAVE_LD_DYNAMIC_LIST_CPP_TYPEINFO)" == "TRUE"
-+CXX+= -Wl,--dynamic-list-cpp-typeinfo
-+.ENDIF
-
- .IF "$(COM)"=="C52"
- BUILD_ACTION=make
diff --git a/patches/test/store-v2-fileformat.diff b/patches/test/store-v2-fileformat.diff
deleted file mode 100644
index 17fa76773..000000000
--- a/patches/test/store-v2-fileformat.diff
+++ /dev/null
@@ -1,3410 +0,0 @@
-The minimal set of changes to read and write store v2 files
-
-(More or less a re-write of the original store-core.diff)
-Hint: the current way of fixing up the wrong/missing magics for
-some pages (look for 'fixup()' method below) falls flat on its
-face in the mmapped read-only case (as one obviously cannot write
-into that mem). Go for the very simplistic store-crash-fix.diff
-approach instead (binning the type check in "isA()")
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- store/inc/store/store.h | 6
- store/inc/store/store.hxx | 6
- store/inc/store/store.inl | 10
- store/inc/store/types.h | 15 +
- store/source/lockbyte.cxx | 4
- store/source/storbase.hxx | 70 +--
- store/source/storbios.cxx | 92 +++-
- store/source/storbios.hxx | 7
- store/source/stordata.cxx | 412 ++++++-------------
- store/source/stordata.hxx | 958 +++++++++++++++++++++++++++++++++++++--------
- store/source/stordir.cxx | 40 +-
- store/source/stordir.hxx | 5
- store/source/store.cxx | 10
- store/source/storlckb.cxx | 82 ++--
- store/source/storlckb.hxx | 9
- store/source/storpage.cxx | 173 ++++----
- store/source/storpage.hxx | 28 +
- store/source/stortree.cxx | 16 +
- store/source/stortree.hxx | 6
- store/workben/t_base.cxx | 3
- store/workben/t_page.cxx | 2
- 21 files changed, 1244 insertions(+), 710 deletions(-)
-
-
-diff --git store/inc/store/store.h store/inc/store/store.h
-index 18d103b..43e8f00 100644
---- store/inc/store/store.h
-+++ store/inc/store/store.h
-@@ -75,7 +75,8 @@ typedef void* storeFileHandle;
- */
- storeError SAL_CALL store_createMemoryFile (
- sal_uInt16 nPageSize,
-- storeFileHandle *phFile
-+ storeFileHandle *phFile,
-+ sal_uInt16 nFormatVersion
- ) SAL_THROW_EXTERN_C();
-
-
-@@ -95,7 +96,8 @@ storeError SAL_CALL store_openFile (
- rtl_uString *pFilename,
- storeAccessMode eAccessMode,
- sal_uInt16 nPageSize,
-- storeFileHandle *phFile
-+ storeFileHandle *phFile,
-+ sal_uInt16 nFormatVersion = STORE_FORMAT_V1
- ) SAL_THROW_EXTERN_C();
-
-
-diff --git store/inc/store/store.hxx store/inc/store/store.hxx
-index 351f6f7..c97d996 100644
---- store/inc/store/store.hxx
-+++ store/inc/store/store.hxx
-@@ -281,14 +281,16 @@ public:
- inline storeError create (
- const rtl::OUString &rFilename,
- storeAccessMode eAccessMode,
-- sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE
-+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE,
-+ sal_uInt16 nFormatVersion = STORE_FORMAT_V1
- ) SAL_THROW(());
-
- /** Open the temporary file in memory.
- @see store_createMemoryFile()
- */
- inline storeError createInMemory (
-- sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE
-+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE,
-+ sal_uInt16 nFormatVersion = STORE_FORMAT_V1
- ) SAL_THROW(());
-
- /** Close the file.
-diff --git store/inc/store/store.inl store/inc/store/store.inl
-index 18a8910..3d1e7a3 100644
---- store/inc/store/store.inl
-+++ store/inc/store/store.inl
-@@ -321,25 +321,27 @@ inline sal_Bool OStoreFile::isValid (void) const SAL_THROW(())
- inline storeError OStoreFile::create (
- const rtl::OUString &rFilename,
- storeAccessMode eAccessMode,
-- sal_uInt16 nPageSize) SAL_THROW(())
-+ sal_uInt16 nPageSize,
-+ sal_uInt16 nFormatVersion) SAL_THROW(())
- {
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
-- return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl);
-+ return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl, nFormatVersion);
- }
-
- inline storeError OStoreFile::createInMemory (
-- sal_uInt16 nPageSize) SAL_THROW(())
-+ sal_uInt16 nPageSize,
-+ sal_uInt16 nFormatVersion) SAL_THROW(())
- {
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
-- return store_createMemoryFile (nPageSize, &m_hImpl);
-+ return store_createMemoryFile (nPageSize, &m_hImpl, nFormatVersion);
- }
-
- inline void OStoreFile::close (void) SAL_THROW(())
-diff --git store/inc/store/types.h store/inc/store/types.h
-index 4810838..067bd64 100644
---- store/inc/store/types.h
-+++ store/inc/store/types.h
-@@ -38,16 +38,27 @@
- extern "C" {
- #endif
-
-+/* format version
-+ V1 original rdb format, used publicly
-+ V2 internal rdb format, which might change during time and
-+ should be only used internally for services.rdb, types.rdb
-+ and other rdb files shipped with OOo
-+*/
-+
-+#define STORE_FORMAT_V1 1
-+#define STORE_FORMAT_V2 2
-+
- /** PageSize (recommended) default.
- @see store_openFile()
- */
--#define STORE_DEFAULT_PAGESIZE ((sal_uInt16)0x0400)
-+#define STORE_DEFAULT_PAGESIZE ((sal_uInt16)0x200)
-
-
- /** PageSize (enforced) limits.
- @see store_openFile()
- */
--#define STORE_MINIMUM_PAGESIZE ((sal_uInt16)0x0200)
-+#define STORE_MINIMUM_PAGESIZE_V1 ((sal_uInt16)0x200)
-+#define STORE_MINIMUM_PAGESIZE_V2 ((sal_uInt16)0x80)
- #define STORE_MAXIMUM_PAGESIZE ((sal_uInt16)0x8000)
-
-
-diff --git store/source/lockbyte.cxx store/source/lockbyte.cxx
-index a03628b..953a229 100644
---- store/source/lockbyte.cxx
-+++ store/source/lockbyte.cxx
-@@ -63,7 +63,9 @@ using namespace store;
-
- storeError ILockBytes::initialize (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize)
- {
-- OSL_PRECOND((STORE_MINIMUM_PAGESIZE <= nPageSize) && (nPageSize <= STORE_MAXIMUM_PAGESIZE), "invalid PageSize");
-+ OSL_PRECOND(((STORE_MINIMUM_PAGESIZE_V1 <= nPageSize)
-+ || (STORE_MINIMUM_PAGESIZE_V2 <= nPageSize))
-+ && (nPageSize <= STORE_MAXIMUM_PAGESIZE), "invalid PageSize");
- return initialize_Impl (rxAllocator, nPageSize);
- }
-
-diff --git store/source/storbase.hxx store/source/storbase.hxx
-index 4a7851f..eb33455 100644
---- store/source/storbase.hxx
-+++ store/source/storbase.hxx
-@@ -455,7 +455,8 @@ struct PageData
- */
- static const size_t theSize = sizeof(G) + sizeof(D) + 2 * sizeof(L);
- static const sal_uInt16 thePageSize = theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V2 >= thePageSize);
-
- /** location.
- */
-@@ -715,6 +716,18 @@ class PageHolderObject
- return isA<U>(p) ? static_cast<U const *>(p) : 0;
- }
-
-+ template< class U >
-+ static U * unsafe_page_cast (PageData * p)
-+ {
-+ return static_cast<U*>(p);
-+ }
-+
-+ template< class U >
-+ static U const * unsafe_page_cast (PageData const * p)
-+ {
-+ return static_cast<U const *>(p);
-+ }
-+
- public:
- bool construct (rtl::Reference< PageData::Allocator > const & rxAllocator)
- {
-@@ -758,10 +771,8 @@ public:
- return (m_xPage.get() != 0);
- }
-
--#if 1 /* EXP */
- PageHolder & get() { return m_xPage; }
- PageHolder const & get() const { return m_xPage; }
--#endif /* EXP */
-
- T * operator->()
- {
-@@ -802,7 +813,7 @@ public:
-
- return store_E_None;
- }
-- static storeError verify (PageHolder const & rxPage, sal_uInt32 nAddr)
-+ static storeError verify (PageHolder const & rxPage, sal_uInt32 nAddr, sal_uInt16 nVersion)
- {
- PageData const * pHead = rxPage.get();
- if (!pHead)
-@@ -812,7 +823,11 @@ public:
- if (eErrCode != store_E_None)
- return eErrCode;
-
-- T const * pImpl = dynamic_page_cast<T>(pHead);
-+ T const * pImpl = 0;
-+ if( nVersion == STORE_FORMAT_V2 )
-+ pImpl = unsafe_page_cast<T>(pHead);
-+ else
-+ pImpl = dynamic_page_cast<T>(pHead);
- if (!pImpl)
- return store_E_WrongVersion;
-
-@@ -820,49 +835,6 @@ public:
- }
- };
-
--/*========================================================================
-- *
-- * PageObject.
-- *
-- *======================================================================*/
--#if 1 /* EXP */
--class PageObject
--{
--public:
-- explicit PageObject (PageHolder const & rxPage = PageHolder())
-- : m_xPage (rxPage), m_bDirty (false)
-- {}
--
-- virtual ~PageObject()
-- {}
--
-- PageHolder & get() { return m_xPage; }
-- PageHolder const & get() const { return m_xPage; }
--
-- void clean() { m_bDirty = false; }
-- void touch() { m_bDirty = true; }
--
-- sal_uInt32 location() const
-- {
-- PageData const * pagedata = m_xPage.get();
-- return (pagedata != 0) ? pagedata->location() : STORE_PAGE_NULL;
-- }
-- void location (sal_uInt32 nAddr)
-- {
-- PageData * pagedata = m_xPage.get();
-- if (pagedata != 0)
-- pagedata->location (nAddr);
-- }
--
--protected:
-- PageHolder m_xPage;
-- bool m_bDirty;
--
-- virtual storeError guard (sal_uInt32 nAddr) = 0;
-- virtual storeError verify (sal_uInt32 nAddr) const = 0;
--};
--#endif /* EXP */
--
- class OStorePageBIOS;
-
- class OStorePageObject
-@@ -934,7 +906,7 @@ public:
- PageHolder const & get() const { return m_xPage; }
-
- virtual storeError guard (sal_uInt32 nAddr) = 0;
-- virtual storeError verify (sal_uInt32 nAddr) const = 0;
-+ virtual storeError verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const = 0;
- };
-
- inline bool OStorePageObject::dirty (void) const
-diff --git store/source/storbios.cxx store/source/storbios.cxx
-index d1f15dc..368d34d 100644
---- store/source/storbios.cxx
-+++ store/source/storbios.cxx
-@@ -59,7 +59,8 @@ using namespace store;
- * OStoreSuperBlock.
- *
- *======================================================================*/
--#define STORE_MAGIC_SUPERBLOCK sal_uInt32(0x484D5343)
-+#define STORE_MAGIC_SUPERBLOCK_V1 sal_uInt32(0x484D5343)
-+#define STORE_MAGIC_SUPERBLOCK_V2 sal_uInt32(0x484D5344)
-
- struct OStoreSuperBlock
- {
-@@ -82,9 +83,13 @@ struct OStoreSuperBlock
-
- /** Construction.
- */
-- explicit OStoreSuperBlock (sal_uInt16 nPageSize)
-- : m_aGuard (STORE_MAGIC_SUPERBLOCK),
-- m_aDescr (nPageSize, nPageSize, STORE_MINIMUM_PAGESIZE),
-+ explicit OStoreSuperBlock (sal_uInt16 nPageSize, sal_uInt16 nFormatVersion)
-+ : m_aGuard (nFormatVersion == STORE_FORMAT_V1 ?
-+ STORE_MAGIC_SUPERBLOCK_V1 : STORE_MAGIC_SUPERBLOCK_V2),
-+ m_aDescr (nPageSize,
-+ nPageSize,
-+ nFormatVersion == STORE_FORMAT_V1 ?
-+ STORE_MINIMUM_PAGESIZE_V1 : STORE_MINIMUM_PAGESIZE_V2),
- m_nMarked (store::htonl(0)),
- m_aMarked (0),
- m_nUnused (store::htonl(0)),
-@@ -163,10 +168,11 @@ struct OStoreSuperBlock
-
- /** verify (external representation).
- */
-- storeError verify() const
-+ storeError verify(sal_uInt16 nVersion) const
- {
- sal_uInt32 nMagic = store::ntohl(m_aGuard.m_nMagic);
-- if (nMagic != STORE_MAGIC_SUPERBLOCK)
-+ if ((nVersion == STORE_FORMAT_V1 && nMagic != STORE_MAGIC_SUPERBLOCK_V1) ||
-+ (nVersion == STORE_FORMAT_V2 && nMagic != STORE_MAGIC_SUPERBLOCK_V2))
- return store_E_WrongFormat;
-
- sal_uInt32 nCRC32 = 0;
-@@ -177,6 +183,26 @@ struct OStoreSuperBlock
- else
- return store_E_None;
- }
-+
-+ /** return version of superblock, determined by magic number in guard
-+ */
-+ sal_uInt16 version () const
-+ {
-+ sal_uInt16 nVersion;
-+
-+ switch (m_aGuard.m_nMagic) {
-+ case STORE_MAGIC_SUPERBLOCK_V1:
-+ nVersion = STORE_FORMAT_V1;
-+ break;
-+ case STORE_MAGIC_SUPERBLOCK_V2:
-+ nVersion = STORE_FORMAT_V2;
-+ break;
-+ default:
-+ nVersion = 0;
-+ }
-+
-+ return nVersion;
-+ }
- };
-
- /*========================================================================
-@@ -266,11 +292,16 @@ struct OStoreSuperBlockPage
- SuperBlock m_aSuperTwo;
- StateBlock m_aState;
-
-+ /** version
-+ */
-+ sal_uInt32 m_nVersion;
-+
- /** theSize.
- */
- static const size_t theSize = 2 * SuperBlock::theSize + StateBlock::theSize;
- static const sal_uInt16 thePageSize = theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V2 >= thePageSize);
-
- /** Allocation.
- */
-@@ -294,10 +325,11 @@ struct OStoreSuperBlockPage
-
- /** Construction.
- */
-- explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize)
-- : m_aSuperOne(nPageSize),
-- m_aSuperTwo(nPageSize),
-- m_aState()
-+ explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize, sal_uInt16 nFormatVersion = STORE_FORMAT_V1)
-+ : m_aSuperOne(nPageSize,nFormatVersion),
-+ m_aSuperTwo(nPageSize,nFormatVersion),
-+ m_aState(),
-+ m_nVersion(nFormatVersion)
- {}
-
- /** guard (external representation).
-@@ -437,11 +469,11 @@ storeError OStoreSuperBlockPage::modified (OStorePageBIOS &rBIOS)
- storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS)
- {
- // Verify 1st copy.
-- storeError eErrCode = m_aSuperOne.verify();
-+ storeError eErrCode = m_aSuperOne.verify(m_nVersion);
- if (eErrCode == store_E_None)
- {
- // Ok. Verify 2nd copy.
-- eErrCode = m_aSuperTwo.verify();
-+ eErrCode = m_aSuperTwo.verify(m_nVersion);
- if (eErrCode == store_E_None)
- {
- // Ok. Ensure identical copies (1st copy wins).
-@@ -472,7 +504,7 @@ storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS)
- else
- {
- // Failure. Verify 2nd copy.
-- eErrCode = m_aSuperTwo.verify();
-+ eErrCode = m_aSuperTwo.verify(m_nVersion);
- if (eErrCode == store_E_None)
- {
- // Ok. Replace 1st copy with 2nd copy.
-@@ -685,6 +717,11 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper)
-
- if (rpSuper->m_aState.flushPending())
- OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n");
-+
-+ // glean file format version from super block magic
-+ rpSuper->m_nVersion = rpSuper->m_aSuperOne.version() == 0
-+ ? rpSuper->m_aSuperTwo.version()
-+ : rpSuper->m_aSuperOne.version();
- }
-
- // Verify SuperBlock page (with repair).
-@@ -719,15 +756,18 @@ storeError OStorePageBIOS::repair (SuperPage *&rpSuper)
- * create (SuperBlock).
- * Internal: Precond: initialized, exclusive access.
- */
--storeError OStorePageBIOS::create (sal_uInt16 nPageSize)
-+storeError OStorePageBIOS::create (sal_uInt16 nPageSize, sal_uInt16 nFormatVersion)
- {
- // Check (internal) precond.
- OSL_PRECOND(m_xLockBytes.is(), "store::PageBIOS::create(): contract violation");
-
-+ const sal_uInt16 nMinPageSize=nFormatVersion == STORE_FORMAT_V1 ?
-+ STORE_MINIMUM_PAGESIZE_V1 : STORE_MINIMUM_PAGESIZE_V2;
-+
- // Check PageSize.
-- if ((STORE_MINIMUM_PAGESIZE > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE))
-+ if ((nMinPageSize > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE))
- return store_E_InvalidParameter;
-- nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1));
-+ nPageSize = ((nPageSize + nMinPageSize - 1) & ~(nMinPageSize - 1));
-
- // Acquire Lock.
- storeError eErrCode = acquireLock (0, nPageSize);
-@@ -775,7 +815,8 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize)
- storeError OStorePageBIOS::initialize (
- ILockBytes * pLockBytes,
- storeAccessMode eAccessMode,
-- sal_uInt16 & rnPageSize)
-+ sal_uInt16 & rnPageSize,
-+ sal_uInt16 & rnFormatVersion )
- {
- // Acquire exclusive access.
- osl::MutexGuard aGuard (m_aMutex);
-@@ -838,13 +879,16 @@ storeError OStorePageBIOS::initialize (
- return store_E_NotExists;
-
- // Create SuperBlock page.
-- eErrCode = create (rnPageSize);
-+ eErrCode = create (rnPageSize,rnFormatVersion);
- }
- if (eErrCode == store_E_None)
- {
- // Obtain modified state.
- m_bModified = m_pSuper->m_aState.flushPending();
-
-+ // Obtain format version.
-+ rnFormatVersion = m_pSuper->m_nVersion;
-+
- // Obtain page size.
- rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize);
-
-@@ -1284,7 +1328,7 @@ storeError OStorePageBIOS::loadObjectAt_Impl (OStorePageObject & rPage, sal_uInt
- return eErrCode;
-
- // Verify page.
-- eErrCode = rPage.verify (nAddr);
-+ eErrCode = rPage.verify (nAddr, version());
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -1568,3 +1612,11 @@ storeError OStorePageBIOS::poke (OStorePageData &rData)
- // Write PageHead.
- return write (rData.location(), &rData, OStorePageData::theSize);
- }
-+
-+sal_uInt32 OStorePageBIOS::version () const
-+{
-+ if (!m_pSuper)
-+ return 0;
-+
-+ return m_pSuper->m_nVersion;
-+}
-diff --git store/source/storbios.hxx store/source/storbios.hxx
-index d9a0f98..bc62c65 100644
---- store/source/storbios.hxx
-+++ store/source/storbios.hxx
-@@ -76,7 +76,8 @@ public:
- virtual storeError initialize (
- ILockBytes * pLockBytes,
- storeAccessMode eAccessMode,
-- sal_uInt16 & rnPageSize);
-+ sal_uInt16 & rnPageSize,
-+ sal_uInt16 & rnFormatVersion);
-
- rtl::Reference< PageData::Allocator > & allocator()
- {
-@@ -162,6 +163,8 @@ public:
- */
- storeError size (sal_uInt32 &rnSize);
-
-+ sal_uInt32 version () const;
-+
- /** ScanContext.
- */
- struct ScanContext
-@@ -240,7 +243,7 @@ private:
-
- /** create (SuperBlock).
- */
-- storeError create (sal_uInt16 nPageSize);
-+ storeError create (sal_uInt16 nPageSize, sal_uInt16 nFormatVersion);
-
- /** SuperBlock verification and repair.
- */
-diff --git store/source/stordata.cxx store/source/stordata.cxx
-index 8f37616..07eed5f 100644
---- store/source/stordata.cxx
-+++ store/source/stordata.cxx
-@@ -58,9 +58,31 @@ storeError OStoreDataPageObject::guard (sal_uInt32 nAddr)
- /*
- * verify.
- */
--storeError OStoreDataPageObject::verify (sal_uInt32 nAddr) const
-+storeError OStoreDataPageObject::verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const
- {
-- return PageHolderObject< page >::verify (m_xPage, nAddr);
-+ return PageHolderObject< page >::verify (m_xPage, nAddr, nVersion);
-+}
-+
-+
-+/*========================================================================
-+ *
-+ * OStorePageLongNameDataPageObject implementation.
-+ *
-+ *======================================================================*/
-+/*
-+ * guard.
-+ */
-+storeError OStorePageLongNameDataPageObject::guard (sal_uInt32 nAddr)
-+{
-+ return PageHolderObject< page >::guard (m_xPage, nAddr);
-+}
-+
-+/*
-+ * verify.
-+ */
-+storeError OStorePageLongNameDataPageObject::verify (sal_uInt32 nAddr,sal_uInt16 nVersion) const
-+{
-+ return PageHolderObject< page >::verify (m_xPage, nAddr, nVersion);
- }
-
- /*========================================================================
-@@ -68,9 +90,10 @@ storeError OStoreDataPageObject::verify (sal_uInt32 nAddr) const
- * OStoreIndirectionPageObject implementation.
- *
- *======================================================================*/
-+
- /*
-- * store_truncate_Impl (single indirect page).
-- */
-+ * store_truncate_Impl (single indirect page).
-+ */
- static storeError store_truncate_Impl (
- sal_uInt32 nAddr,
- sal_uInt16 nSingle,
-@@ -217,9 +240,9 @@ storeError OStoreIndirectionPageObject::guard (sal_uInt32 nAddr)
- /*
- * verify.
- */
--storeError OStoreIndirectionPageObject::verify (sal_uInt32 nAddr) const
-+storeError OStoreIndirectionPageObject::verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const
- {
-- return PageHolderObject< page >::verify (m_xPage, nAddr);
-+ return PageHolderObject< page >::verify (m_xPage, nAddr, nVersion);
- }
-
- /*
-@@ -650,179 +673,33 @@ storeError OStoreIndirectionPageObject::truncate (
- * OStoreDirectoryPageObject implementation.
- *
- *======================================================================*/
--/*
-- * guard.
-- */
--storeError OStoreDirectoryPageObject::guard (sal_uInt32 nAddr)
--{
-- return PageHolderObject< page >::guard (m_xPage, nAddr);
--}
-
--/*
-- * verify.
-- */
--storeError OStoreDirectoryPageObject::verify (sal_uInt32 nAddr) const
-+storeError OStoreDirectoryPageObject::store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS)
- {
-- return PageHolderObject< page >::verify (m_xPage, nAddr);
-- // OLD: m_rPage.verifyVersion (STORE_MAGIC_DIRECTORYPAGE);
-+ return store_truncate_Impl(nAddr,nSingle,rBIOS);
- }
-
--/*
-- * scope (external data page; private).
-- */
--OStoreDirectoryPageData::ChunkScope
--OStoreDirectoryPageObject::scope (
-- sal_uInt32 nPage,
-- page::DataBlock::LinkDescriptor &rDescr) const
-+storeError OStoreDirectoryPageObject::store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nDouble,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS)
- {
-- page const & rPage = PAGE();
-- OStoreDirectoryDataBlock const & rDataBlock = rPage.m_aDataBlock;
--
-- sal_uInt32 index0, index1, index2, index3;
--
-- // direct.
-- sal_uInt32 nCount = rDataBlock.directCount();
-- sal_uInt32 nLimit = nCount;
-- if (nPage < nLimit)
-- {
-- // Page to index reduction.
-- index0 = nPage;
--
-- // Setup LinkDescriptor indices.
-- rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
--
-- // Done.
-- return page::SCOPE_DIRECT;
-- }
-- nPage -= nLimit;
--
-- // single indirect.
-- sal_uInt32 const nCapacity = indirect::capacityCount(rPage.m_aDescr);
-- nCount = rDataBlock.singleCount();
-- nLimit = nCount * nCapacity;
-- if (nPage < nLimit)
-- {
-- // Page to index reduction.
-- sal_uInt32 n = nPage;
--
-- // Reduce to single indirect i(1), direct n = i(0).
-- index1 = n / nCapacity;
-- index0 = n % nCapacity;
--
-- // Verify reduction.
-- n = index1 * nCapacity + index0;
-- OSL_POSTCOND(n == nPage, "wrong math on indirect indices");
-- if (n != nPage)
-- return page::SCOPE_UNKNOWN;
--
-- // Setup LinkDescriptor indices.
-- rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-- rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
--
-- // Done.
-- return page::SCOPE_SINGLE;
-- }
-- nPage -= nLimit;
--
-- // double indirect.
-- nCount = rDataBlock.doubleCount();
-- nLimit = nCount * nCapacity * nCapacity;
-- if (nPage < nLimit)
-- {
-- // Page to index reduction.
-- sal_uInt32 n = nPage;
--
-- // Reduce to double indirect i(2), single indirect n = i(0).
-- index2 = n / (nCapacity * nCapacity);
-- n = n % (nCapacity * nCapacity);
--
-- // Reduce to single indirect i(1), direct n = i(0).
-- index1 = n / nCapacity;
-- index0 = n % nCapacity;
--
-- // Verify reduction.
-- n = index2 * nCapacity * nCapacity +
-- index1 * nCapacity + index0;
-- OSL_POSTCOND(n == nPage, "wrong math on double indirect indices");
-- if (n != nPage)
-- return page::SCOPE_UNKNOWN;
--
-- // Setup LinkDescriptor indices.
-- rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-- rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
-- rDescr.m_nIndex2 = (sal_uInt16)(index2 & 0xffff);
--
-- // Done.
-- return page::SCOPE_DOUBLE;
-- }
-- nPage -= nLimit;
--
-- // triple indirect.
-- nCount = rDataBlock.tripleCount();
-- nLimit = nCount * nCapacity * nCapacity * nCapacity;
-- if (nPage < nLimit)
-- {
-- // Page to index reduction.
-- sal_uInt32 n = nPage;
--
-- // Reduce to triple indirect i(3), double indirect n.
-- index3 = n / (nCapacity * nCapacity * nCapacity);
-- n = n % (nCapacity * nCapacity * nCapacity);
--
-- // Reduce to double indirect i(2), single indirect n.
-- index2 = n / (nCapacity * nCapacity);
-- n = n % (nCapacity * nCapacity);
--
-- // Reduce to single indirect i(1), direct n = i(0).
-- index1 = n / nCapacity;
-- index0 = n % nCapacity;
--
-- // Verify reduction.
-- n = index3 * nCapacity * nCapacity * nCapacity +
-- index2 * nCapacity * nCapacity +
-- index1 * nCapacity + index0;
-- OSL_POSTCOND(n == nPage, "wrong math on triple indirect indices");
-- if (n != nPage)
-- return page::SCOPE_UNKNOWN;
--
-- // Setup LinkDescriptor indices.
-- rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-- rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
-- rDescr.m_nIndex2 = (sal_uInt16)(index2 & 0xffff);
-- rDescr.m_nIndex3 = (sal_uInt16)(index3 & 0xffff);
--
-- // Done.
-- return page::SCOPE_TRIPLE;
-- }
--
-- // Unreachable (more than triple indirect).
-- return page::SCOPE_UNREACHABLE;
-+ return store_truncate_Impl(nAddr,nDouble,nSingle,rBIOS);
- }
-
--#if 0 /* NYI */
--/*
-- * chunk (external data page).
-- */
--inode::ChunkDescriptor OStoreDirectoryPageObject::chunk (sal_uInt32 nOffset)
-+storeError OStoreDirectoryPageObject::store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nTriple,
-+ sal_uInt16 nDouble,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS)
- {
-- // @@@ INSUFFICIENT: NEED SCOPE AS WELL @@@
-- sal_uInt32 nCapacity = m_rPage.capacity();
-- if (nOffset < nCapacity)
-- // Internal scope (inode page).
-- return inode::ChunkDescriptor (nOffset, nCapacity);
-- else
-- // External scope (data page).
-- return inode::ChunkDescriptor (nOffset - nCapacity, data::capacity(m_rPage.m_aDescr));
--
-- inode::ChunkScope eScope = m_rPage.scope(nOffset);
-- if (eScope == inode::SCOPE_INTERNAL)
-- // Inode page (internal scope).
-- return inode::ChunkDescriptor (nOffset, m_rPage.capacity());
-- else
-- // Data page (external scope).
-- return inode::ChunkDescriptor (nOffset - m_rPage.capacity(), data::capacity(m_rPage.m_aDescr));
-+ return store_truncate_Impl(nAddr,nTriple,nDouble,nSingle,rBIOS);
- }
--#endif /* NYI */
-
- /*
- * read (external data page).
-@@ -833,11 +710,11 @@ storeError OStoreDirectoryPageObject::read (
- OStorePageBIOS &rBIOS)
- {
- // Determine scope and link indices.
-- page::DataBlock::LinkDescriptor aLink;
-- page::ChunkScope eScope = scope (nPage, aLink);
-+ LinkDescriptor aLink;
-+ ChunkScope eScope = scope (nPage, aLink);
-
- storeError eErrCode = store_E_None;
-- if (eScope == page::SCOPE_DIRECT)
-+ if (eScope == SCOPE_DIRECT)
- {
- sal_uInt32 const nAddr = directLink (aLink.m_nIndex0);
- if (nAddr == STORE_PAGE_NULL)
-@@ -845,7 +722,7 @@ storeError OStoreDirectoryPageObject::read (
-
- eErrCode = rBIOS.loadObjectAt (rData, nAddr);
- }
-- else if (eScope == page::SCOPE_SINGLE)
-+ else if (eScope == SCOPE_SINGLE)
- {
- sal_uInt32 const nAddr = singleLink (aLink.m_nIndex1);
- if (nAddr == STORE_PAGE_NULL)
-@@ -858,7 +735,7 @@ storeError OStoreDirectoryPageObject::read (
-
- eErrCode = aSingle.read (aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_DOUBLE)
-+ else if (eScope == SCOPE_DOUBLE)
- {
- sal_uInt32 const nAddr = doubleLink (aLink.m_nIndex2);
- if (nAddr == STORE_PAGE_NULL)
-@@ -871,7 +748,7 @@ storeError OStoreDirectoryPageObject::read (
-
- eErrCode = aDouble.read (aLink.m_nIndex1, aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_TRIPLE)
-+ else if (eScope == SCOPE_TRIPLE)
- {
- sal_uInt32 const nAddr = tripleLink (aLink.m_nIndex3);
- if (nAddr == STORE_PAGE_NULL)
-@@ -884,7 +761,7 @@ storeError OStoreDirectoryPageObject::read (
-
- eErrCode = aTriple.read (aLink.m_nIndex2, aLink.m_nIndex1, aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_UNREACHABLE)
-+ else if (eScope == SCOPE_UNREACHABLE)
- {
- // Out of scope.
- eErrCode = store_E_CantSeek;
-@@ -909,11 +786,11 @@ storeError OStoreDirectoryPageObject::write (
- OStorePageBIOS &rBIOS)
- {
- // Determine scope and link indices.
-- page::DataBlock::LinkDescriptor aLink;
-- page::ChunkScope eScope = scope (nPage, aLink);
-+ LinkDescriptor aLink;
-+ ChunkScope eScope = scope (nPage, aLink);
-
- storeError eErrCode = store_E_None;
-- if (eScope == page::SCOPE_DIRECT)
-+ if (eScope == SCOPE_DIRECT)
- {
- sal_uInt32 const nAddr = directLink (aLink.m_nIndex0);
- if (nAddr == STORE_PAGE_NULL)
-@@ -932,7 +809,7 @@ storeError OStoreDirectoryPageObject::write (
- eErrCode = rBIOS.saveObjectAt (rData, nAddr);
- }
- }
-- else if (eScope == page::SCOPE_SINGLE)
-+ else if (eScope == SCOPE_SINGLE)
- {
- OStoreIndirectionPageObject aSingle;
- eErrCode = aSingle.loadOrCreate (singleLink (aLink.m_nIndex1), rBIOS);
-@@ -945,7 +822,7 @@ storeError OStoreDirectoryPageObject::write (
-
- eErrCode = aSingle.write (aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_DOUBLE)
-+ else if (eScope == SCOPE_DOUBLE)
- {
- OStoreIndirectionPageObject aDouble;
- eErrCode = aDouble.loadOrCreate (doubleLink (aLink.m_nIndex2), rBIOS);
-@@ -958,7 +835,7 @@ storeError OStoreDirectoryPageObject::write (
-
- eErrCode = aDouble.write (aLink.m_nIndex1, aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_TRIPLE)
-+ else if (eScope == SCOPE_TRIPLE)
- {
- OStoreIndirectionPageObject aTriple;
- eErrCode = aTriple.loadOrCreate (tripleLink (aLink.m_nIndex3), rBIOS);
-@@ -971,7 +848,7 @@ storeError OStoreDirectoryPageObject::write (
-
- eErrCode = aTriple.write (aLink.m_nIndex2, aLink.m_nIndex1, aLink.m_nIndex0, rData, rBIOS);
- }
-- else if (eScope == page::SCOPE_UNREACHABLE)
-+ else if (eScope == SCOPE_UNREACHABLE)
- {
- // Out of scope.
- eErrCode = store_E_CantSeek;
-@@ -995,39 +872,39 @@ storeError OStoreDirectoryPageObject::truncate (
- OStorePageBIOS &rBIOS)
- {
- // Determine scope and link indices.
-- page::DataBlock::LinkDescriptor aLink;
-- page::ChunkScope eScope = scope (nPage, aLink);
-+ LinkDescriptor aLink;
-+ ChunkScope eScope = scope (nPage, aLink);
-
- storeError eErrCode = store_E_None;
-- if (eScope == page::SCOPE_DIRECT)
-+ if (eScope == SCOPE_DIRECT)
- {
- // Truncate all triple indirect pages.
-- eErrCode = truncate (page::SCOPE_TRIPLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_TRIPLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Truncate all double indirect pages.
-- eErrCode = truncate (page::SCOPE_DOUBLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_DOUBLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Truncate all single indirect pages.
-- eErrCode = truncate (page::SCOPE_SINGLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_SINGLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Truncate direct pages, including 'aLink.m_nIndex0'.
- eErrCode = truncate (eScope, aLink.m_nIndex0, rBIOS);
- }
-- else if (eScope == page::SCOPE_SINGLE)
-+ else if (eScope == SCOPE_SINGLE)
- {
- // Truncate all triple indirect pages.
-- eErrCode = truncate (page::SCOPE_TRIPLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_TRIPLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Truncate all double indirect pages.
-- eErrCode = truncate (page::SCOPE_DOUBLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_DOUBLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -1048,10 +925,10 @@ storeError OStoreDirectoryPageObject::truncate (
- singleLink (aLink.m_nIndex1, STORE_PAGE_NULL);
- }
- }
-- else if (eScope == page::SCOPE_DOUBLE)
-+ else if (eScope == SCOPE_DOUBLE)
- {
- // Truncate all triple indirect pages.
-- eErrCode = truncate (page::SCOPE_TRIPLE, 0, rBIOS);
-+ eErrCode = truncate (SCOPE_TRIPLE, 0, rBIOS);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -1073,7 +950,7 @@ storeError OStoreDirectoryPageObject::truncate (
- doubleLink (aLink.m_nIndex2, STORE_PAGE_NULL);
- }
- }
-- else if (eScope == page::SCOPE_TRIPLE)
-+ else if (eScope == SCOPE_TRIPLE)
- {
- // Truncate triple indirect pages, downto 'aLink.m_nIndex3'.
- eErrCode = truncate (eScope, aLink.m_nIndex3 + 1, rBIOS);
-@@ -1093,7 +970,7 @@ storeError OStoreDirectoryPageObject::truncate (
- tripleLink (aLink.m_nIndex3, STORE_PAGE_NULL);
- }
- }
-- else if (eScope == page::SCOPE_UNREACHABLE)
-+ else if (eScope == SCOPE_UNREACHABLE)
- {
- // Out of scope.
- eErrCode = store_E_CantSeek;
-@@ -1109,99 +986,80 @@ storeError OStoreDirectoryPageObject::truncate (
- return eErrCode;
- }
-
--/*
-- * truncate (external data page scope; private).
-- */
--storeError OStoreDirectoryPageObject::truncate (
-- page::ChunkScope eScope,
-- sal_uInt16 nRemain,
-- OStorePageBIOS &rBIOS)
-+sal_uInt32 OStoreDirectoryPageObjectV1::path (void) const
- {
-- OStoreDirectoryDataBlock const & rDataBlock = PAGE().m_aDataBlock;
-+ const sal_Char * pszName = PAGE().m_aNameBlock.m_pData;
-+ sal_uInt32 nPath = store::ntohl(PAGE().m_aNameBlock.m_aKey.m_nHigh);
-+ return rtl_crc32 (nPath, pszName, rtl_str_getLength(pszName));
-+}
-
-- // Enter.
-- storeError eErrCode = store_E_None;
-- if (eScope == page::SCOPE_DIRECT)
-- {
-- // Truncate direct data pages.
-- sal_uInt16 i, n = rDataBlock.directCount();
-- for (i = n; i > nRemain; i--)
-- {
-- // Obtain data page location.
-- sal_uInt32 nAddr = directLink (i - 1);
-- if (nAddr == STORE_PAGE_NULL) continue;
-+sal_Size OStoreDirectoryPageObjectV1::getName (sal_Char * pBuffer, sal_Size nBufsiz, OStorePageBIOS &) const
-+{
-+ sal_Char const * pszName = PAGE().m_aNameBlock.m_pData;
-+ sal_Size nLength = rtl_str_getLength(pszName);
-+ memcpy (pBuffer, pszName, SAL_MIN(nLength, nBufsiz));
-+ return nLength;
-+}
-
-- // Free data page.
-- OStoreDataPageData aData;
-- eErrCode = rBIOS.free (aData, nAddr);
-- if (eErrCode != store_E_None)
-- break;
-+void OStoreDirectoryPageObjectV1::setName (sal_Char const * pBuffer, sal_Size nBufsiz)
-+{
-+ memcpy (PAGE().m_aNameBlock.m_pData, pBuffer, SAL_MIN(STORE_MAXIMUM_NAMESIZE-1, nBufsiz));
-+}
-
-- // Clear pointer to data page.
-- directLink (i - 1, STORE_PAGE_NULL);
-- }
-+sal_uInt32 OStoreDirectoryPageObjectV2::path (void) const
-+{
-+ const sal_Char * pszName = PAGE().m_aNameBlock.m_pNameData;
-+ sal_uInt32 nPath = store::ntohl(PAGE().m_aNameBlock.m_aKey.m_nHigh);
-+ return rtl_crc32 (nPath, pszName, rtl_str_getLength(pszName));
-+}
-
-- // Done.
-- return eErrCode;
-- }
-+static void
-+copyAndTerminate( sal_Char *pDest, const sal_Char *pSrc, sal_Int32 nBytes)
-+{
-+ memcpy (pDest, pSrc, nBytes);
-+ pDest[nBytes] = '\0';
-+}
-
-- if (eScope == page::SCOPE_SINGLE)
-+#define USE_OTHER_BLOCK STORE_MAX_NAMESIZE_V2
-+sal_Size OStoreDirectoryPageObjectV2::getName (sal_Char * pBuffer, sal_Size nBufsiz, OStorePageBIOS &rBIOS) const
-+{
-+ if (PAGE().m_aNameBlock.m_nNameLength >= USE_OTHER_BLOCK)
- {
-- // Truncate single indirect pages.
-- sal_uInt16 i, n = rDataBlock.singleCount();
-- for (i = n; i > nRemain; i--)
-- {
-- // Truncate single indirect page to zero data pages.
-- eErrCode = store_truncate_Impl (singleLink (i - 1), 0, rBIOS);
-- if (eErrCode != store_E_None)
-- break;
--
-- // Clear pointer to single indirect page.
-- singleLink (i - 1, STORE_PAGE_NULL);
-- }
--
-- // Done.
-- return eErrCode;
-- }
-+ OStorePageLongNameDataPageObject aLongNamePage;
-+ storeError eErrCode = rBIOS.loadObjectAt (aLongNamePage, PAGE().m_aNameBlock.m_nNameBlock);
-
-- if (eScope == page::SCOPE_DOUBLE)
-- {
-- // Truncate double indirect pages.
-- sal_uInt16 i, n = rDataBlock.doubleCount();
-- for (i = n; i > nRemain; i--)
-+ if (eErrCode != store_E_None)
- {
-- // Truncate double indirect page to zero single indirect pages.
-- eErrCode = store_truncate_Impl (doubleLink (i - 1), 0, 0, rBIOS);
-- if (eErrCode != store_E_None)
-- break;
--
-- // Clear pointer to double indirect page.
-- doubleLink (i - 1, STORE_PAGE_NULL);
-+ OSL_TRACE("failed to load name page %d\n", eErrCode);
-+ return 0;
- }
-
-- // Done.
-- return eErrCode;
-+ PageHolderObject<OStorePageLongNameData> xPage (aLongNamePage.get());
-+ copyAndTerminate (pBuffer, PAGE().m_aNameBlock.m_pNameData,
-+ SAL_MIN(USE_OTHER_BLOCK - 1, nBufsiz));
-+ nBufsiz -= USE_OTHER_BLOCK - 1;
-+ const sal_Size nLength = SAL_MIN(
-+ PAGE().m_aNameBlock.m_nNameLength - (USE_OTHER_BLOCK - 1),
-+ nBufsiz);
-+ copyAndTerminate (pBuffer + USE_OTHER_BLOCK - 1,
-+ xPage->m_nData,
-+ nLength);
-+ return nLength;
- }
--
-- if (eScope == page::SCOPE_TRIPLE)
-+ else
- {
-- // Truncate triple indirect pages.
-- sal_uInt16 i, n = rDataBlock.tripleCount();
-- for (i = n; i > nRemain; i--)
-- {
-- // Truncate to zero double indirect pages.
-- eErrCode = store_truncate_Impl (tripleLink (i - 1), 0, 0, 0, rBIOS);
-- if (eErrCode != store_E_None)
-- break;
--
-- // Clear pointer to triple indirect page.
-- tripleLink (i - 1, STORE_PAGE_NULL);
-- }
--
-- // Done.
-- return eErrCode;
-+ sal_Char const * pszName = PAGE().m_aNameBlock.m_pNameData;
-+ const sal_Size nLength = SAL_MIN(PAGE().m_aNameBlock.m_nNameLength, nBufsiz);
-+ memcpy (pBuffer, pszName, nLength);
-+ return nLength;
- }
-+}
-
-- // Invalid scope.
-- return store_E_InvalidAccess;
-+void OStoreDirectoryPageObjectV2::setName (sal_Char const * pBuffer, sal_Size nLen)
-+{
-+ // TODO TODO TODO - long names not yet written correctly
-+ //if (nLen >= USE_OTHER_BLOCK)
-+ memcpy (PAGE().m_aNameBlock.m_pNameData, pBuffer, SAL_MIN(STORE_MAX_NAMESIZE_V2-1, nLen));
- }
-+
-+
-diff --git store/source/stordata.hxx store/source/stordata.hxx
-index b86287b..c21c4b9 100644
---- store/source/stordata.hxx
-+++ store/source/stordata.hxx
-@@ -33,9 +33,11 @@
-
- #include "sal/types.h"
- #include "sal/macros.h"
-+#include "osl/diagnose.h"
-
- #include "store/types.h"
- #include "storbase.hxx"
-+#include "storbios.hxx"
-
- namespace store
- {
-@@ -66,7 +68,8 @@ struct OStoreDataPageData : public store::OStorePageData
- */
- static const size_t theSize = 0;
- static const sal_uInt16 thePageSize = base::theSize + self::theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V2 >= self::thePageSize);
-
- /** capacity.
- */
-@@ -125,7 +128,7 @@ public:
- /** External representation.
- */
- virtual storeError guard (sal_uInt32 nAddr);
-- virtual storeError verify (sal_uInt32 nAddr) const;
-+ virtual storeError verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const;
- };
-
- /*========================================================================
-@@ -156,7 +159,8 @@ struct OStoreIndirectionPageData : public store::OStorePageData
- */
- static const size_t theSize = sizeof(G);
- static const sal_uInt16 thePageSize = base::theSize + self::theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V2 >= self::thePageSize);
-
- /** capacity.
- */
-@@ -239,7 +243,7 @@ public:
- OStorePageBIOS & rBIOS);
-
- virtual storeError guard (sal_uInt32 nAddr);
-- virtual storeError verify (sal_uInt32 nAddr) const;
-+ virtual storeError verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const;
-
- /** read (indirect data page).
- */
-@@ -304,7 +308,7 @@ public:
- * OStorePageNameBlock.
- *
- *======================================================================*/
--struct OStorePageNameBlock
-+struct OStorePageNameBlockV1
- {
- typedef OStorePageGuard G;
- typedef OStorePageKey K;
-@@ -332,7 +336,7 @@ struct OStorePageNameBlock
-
- /** Construction.
- */
-- OStorePageNameBlock (void)
-+ OStorePageNameBlockV1 (void)
- : m_aGuard(), m_aKey(), m_nAttrib (0)
- {
- memset (m_pData, 0, sizeof(m_pData));
-@@ -362,51 +366,283 @@ struct OStorePageNameBlock
- }
- };
-
-+#define STORE_MAX_NAMESIZE_V2 32
-+
-+struct OStorePageNameBlockV2
-+{
-+ typedef OStorePageGuard G;
-+ typedef OStorePageKey K;
-+
-+ /** Representation.
-+ */
-+ G m_aGuard;
-+ K m_aKey;
-+ sal_uInt32 m_nAttrib;
-+ sal_Char m_pNameData[STORE_MAX_NAMESIZE_V2];
-+ sal_uInt32 m_nNameLength;
-+ sal_uInt32 m_nNameBlock;
-+
-+ /** size.
-+ */
-+ static const size_t theSize = sizeof(G) + sizeof(K) + 3*sizeof(sal_uInt32) + sizeof(sal_Char[STORE_MAX_NAMESIZE_V2]);
-+
-+ /** initialize.
-+ */
-+ void initialize (void)
-+ {
-+ m_aGuard = G();
-+ m_aKey = K();
-+ m_nAttrib = 0;
-+ memset (m_pNameData, 0, sizeof(m_pNameData));
-+ m_nNameLength = 0;
-+ m_nNameBlock = 0;
-+ }
-+
-+ /** Construction.
-+ */
-+ OStorePageNameBlockV2 (void)
-+ : m_aGuard(), m_aKey(), m_nAttrib (0), m_nNameLength (0), m_nNameBlock (0)
-+ {
-+ memset (m_pNameData, 0, sizeof(m_pNameData));
-+ }
-+
-+ /** guard (external representation).
-+ */
-+ void guard()
-+ {
-+ sal_uInt32 nCRC32 = 0;
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aKey, theSize - sizeof(G));
-+ m_aGuard.m_nCRC32 = store::htonl(nCRC32);
-+ }
-+
-+ /** verify (external representation).
-+ */
-+ storeError verify() const
-+ {
-+ // apparently v2 file format does _not_ correctly setup
-+ // checksums
-+#if 0
-+ sal_uInt32 nCRC32 = 0;
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aKey, theSize - sizeof(G));
-+ if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
-+ return store_E_InvalidChecksum;
-+ else
-+#endif
-+ return store_E_None;
-+ }
-+};
-+
- /*========================================================================
- *
- * OStoreDirectoryDataBlock.
- *
- *======================================================================*/
--#define STORE_LIMIT_DATAPAGE_DIRECT 16
--#define STORE_LIMIT_DATAPAGE_SINGLE 8
--#define STORE_LIMIT_DATAPAGE_DOUBLE 1
--#define STORE_LIMIT_DATAPAGE_TRIPLE 1
-
--struct OStoreDirectoryDataBlock
-+/** LinkDescriptor.
-+*/
-+struct LinkDescriptor
-+{
-+ /** Representation.
-+ */
-+ sal_uInt16 m_nIndex0;
-+ sal_uInt16 m_nIndex1;
-+ sal_uInt16 m_nIndex2;
-+ sal_uInt16 m_nIndex3;
-+
-+ /** Construction.
-+ */
-+ LinkDescriptor (void)
-+ : m_nIndex0 ((sal_uInt16)(~0)),
-+ m_nIndex1 ((sal_uInt16)(~0)),
-+ m_nIndex2 ((sal_uInt16)(~0)),
-+ m_nIndex3 ((sal_uInt16)(~0))
-+ {}
-+};
-+
-+#define STORE_LIMIT_DATAPAGE_DIRECT_V1 16
-+#define STORE_LIMIT_DATAPAGE_SINGLE_V1 8
-+#define STORE_LIMIT_DATAPAGE_DOUBLE_V1 1
-+#define STORE_LIMIT_DATAPAGE_TRIPLE_V1 1
-+
-+struct OStoreDirectoryDataBlockV1
- {
- typedef OStorePageGuard G;
-
-- /** LinkDescriptor.
-+ /** LinkTable.
- */
-- struct LinkDescriptor
-+ struct LinkTable
- {
- /** Representation.
- */
-- sal_uInt16 m_nIndex0;
-- sal_uInt16 m_nIndex1;
-- sal_uInt16 m_nIndex2;
-- sal_uInt16 m_nIndex3;
-+ sal_uInt32 m_pDirect[STORE_LIMIT_DATAPAGE_DIRECT_V1];
-+ sal_uInt32 m_pSingle[STORE_LIMIT_DATAPAGE_SINGLE_V1];
-+ sal_uInt32 m_pDouble[STORE_LIMIT_DATAPAGE_DOUBLE_V1];
-+ sal_uInt32 m_pTriple[STORE_LIMIT_DATAPAGE_TRIPLE_V1];
-+
-+ /** initialize.
-+ */
-+ void initialize (void)
-+ {
-+ memset(m_pDirect, STORE_PAGE_NULL, sizeof(m_pDirect));
-+ memset(m_pSingle, STORE_PAGE_NULL, sizeof(m_pSingle));
-+ memset(m_pDouble, STORE_PAGE_NULL, sizeof(m_pDouble));
-+ memset(m_pTriple, STORE_PAGE_NULL, sizeof(m_pTriple));
-+ }
-
- /** Construction.
- */
-- LinkDescriptor (void)
-- : m_nIndex0 ((sal_uInt16)(~0)),
-- m_nIndex1 ((sal_uInt16)(~0)),
-- m_nIndex2 ((sal_uInt16)(~0)),
-- m_nIndex3 ((sal_uInt16)(~0))
-- {}
-+ LinkTable (void)
-+ {
-+ initialize();
-+ }
- };
-
-+ /** Representation.
-+ */
-+ G m_aGuard;
-+ LinkTable m_aTable;
-+ sal_uInt32 m_nDataLen;
-+
-+ /** size.
-+ */
-+ static const size_t theSize = sizeof(G) + sizeof(LinkTable) + sizeof(sal_uInt32);
-+
-+ /** initialize.
-+ */
-+ void initialize (void)
-+ {
-+ m_aGuard = G();
-+ m_aTable.initialize();
-+ m_nDataLen = 0;
-+ }
-+
-+ /** Construction.
-+ */
-+ OStoreDirectoryDataBlockV1 (void)
-+ : m_aGuard(), m_aTable(), m_nDataLen (0)
-+ {}
-+
-+ /** guard (external representation).
-+ */
-+ void guard()
-+ {
-+ sal_uInt32 nCRC32 = 0;
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aTable, theSize - sizeof(G));
-+ m_aGuard.m_nCRC32 = store::htonl(nCRC32);
-+ }
-+
-+ /** verify (external representation).
-+ */
-+ storeError verify() const
-+ {
-+ sal_uInt32 nCRC32 = 0;
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
-+ nCRC32 = rtl_crc32 (nCRC32, &m_aTable, theSize - sizeof(G));
-+ if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
-+ return store_E_InvalidChecksum;
-+ else
-+ return store_E_None;
-+ }
-+
-+ /** direct.
-+ */
-+ static sal_uInt16 directCount (void)
-+ {
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DIRECT_V1));
-+ }
-+ sal_uInt32 directLink (sal_uInt16 nIndex) const
-+ {
-+ if (nIndex < directCount())
-+ return store::ntohl(m_aTable.m_pDirect[nIndex]);
-+ else
-+ return STORE_PAGE_NULL;
-+ }
-+ void directLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ {
-+ if (nIndex < directCount())
-+ m_aTable.m_pDirect[nIndex] = store::htonl(nAddr);
-+ }
-+
-+ /** single.
-+ */
-+ static sal_uInt16 singleCount (void)
-+ {
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_SINGLE_V1));
-+ }
-+ sal_uInt32 singleLink (sal_uInt16 nIndex) const
-+ {
-+ if (nIndex < singleCount())
-+ return store::ntohl(m_aTable.m_pSingle[nIndex]);
-+ else
-+ return STORE_PAGE_NULL;
-+ }
-+ void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ {
-+ if (nIndex < singleCount())
-+ m_aTable.m_pSingle[nIndex] = store::htonl(nAddr);
-+ }
-+
-+ /** double.
-+ */
-+ static sal_uInt16 doubleCount (void)
-+ {
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DOUBLE_V1));
-+ }
-+ sal_uInt32 doubleLink (sal_uInt16 nIndex) const
-+ {
-+ if (nIndex < doubleCount())
-+ return store::ntohl(m_aTable.m_pDouble[nIndex]);
-+ else
-+ return STORE_PAGE_NULL;
-+ }
-+ void doubleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ {
-+ if (nIndex < doubleCount())
-+ m_aTable.m_pDouble[nIndex] = store::htonl(nAddr);
-+ }
-+
-+ /** triple.
-+ */
-+ static sal_uInt16 tripleCount (void)
-+ {
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_TRIPLE_V1));
-+ }
-+ sal_uInt32 tripleLink (sal_uInt16 nIndex) const
-+ {
-+ if (nIndex < tripleCount())
-+ return store::ntohl(m_aTable.m_pTriple[nIndex]);
-+ else
-+ return STORE_PAGE_NULL;
-+ }
-+ void tripleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ {
-+ if (nIndex < tripleCount())
-+ m_aTable.m_pTriple[nIndex] = store::htonl(nAddr);
-+ }
-+};
-+
-+#define STORE_LIMIT_DATAPAGE_DIRECT_V2 4
-+#define STORE_LIMIT_DATAPAGE_SINGLE_V2 2
-+#define STORE_LIMIT_DATAPAGE_DOUBLE_V2 1
-+#define STORE_LIMIT_DATAPAGE_TRIPLE_V2 1
-+
-+struct OStoreDirectoryDataBlockV2
-+{
-+ typedef OStorePageGuard G;
-+
- /** LinkTable.
- */
- struct LinkTable
- {
- /** Representation.
- */
-- sal_uInt32 m_pDirect[STORE_LIMIT_DATAPAGE_DIRECT];
-- sal_uInt32 m_pSingle[STORE_LIMIT_DATAPAGE_SINGLE];
-- sal_uInt32 m_pDouble[STORE_LIMIT_DATAPAGE_DOUBLE];
-- sal_uInt32 m_pTriple[STORE_LIMIT_DATAPAGE_TRIPLE];
-+ sal_uInt32 m_pDirect[STORE_LIMIT_DATAPAGE_DIRECT_V2];
-+ sal_uInt32 m_pSingle[STORE_LIMIT_DATAPAGE_SINGLE_V2];
-+ sal_uInt32 m_pDouble[STORE_LIMIT_DATAPAGE_DOUBLE_V2];
-+ sal_uInt32 m_pTriple[STORE_LIMIT_DATAPAGE_TRIPLE_V2];
-
- /** initialize.
- */
-@@ -447,7 +683,7 @@ struct OStoreDirectoryDataBlock
-
- /** Construction.
- */
-- OStoreDirectoryDataBlock (void)
-+ OStoreDirectoryDataBlockV2 (void)
- : m_aGuard(), m_aTable(), m_nDataLen (0)
- {}
-
-@@ -465,12 +701,16 @@ struct OStoreDirectoryDataBlock
- */
- storeError verify() const
- {
-+ // apparently v2 file format does _not_ correctly setup
-+ // checksums
-+#if 0
- sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aTable, theSize - sizeof(G));
- if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
- return store_E_InvalidChecksum;
- else
-+#endif
- return store_E_None;
- }
-
-@@ -478,7 +718,7 @@ struct OStoreDirectoryDataBlock
- */
- static sal_uInt16 directCount (void)
- {
-- return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DIRECT));
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DIRECT_V2));
- }
- sal_uInt32 directLink (sal_uInt16 nIndex) const
- {
-@@ -497,7 +737,7 @@ struct OStoreDirectoryDataBlock
- */
- static sal_uInt16 singleCount (void)
- {
-- return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_SINGLE));
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_SINGLE_V2));
- }
- sal_uInt32 singleLink (sal_uInt16 nIndex) const
- {
-@@ -516,7 +756,7 @@ struct OStoreDirectoryDataBlock
- */
- static sal_uInt16 doubleCount (void)
- {
-- return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DOUBLE));
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_DOUBLE_V2));
- }
- sal_uInt32 doubleLink (sal_uInt16 nIndex) const
- {
-@@ -535,7 +775,7 @@ struct OStoreDirectoryDataBlock
- */
- static sal_uInt16 tripleCount (void)
- {
-- return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_TRIPLE));
-+ return ((sal_uInt16)(STORE_LIMIT_DATAPAGE_TRIPLE_V2));
- }
- sal_uInt32 tripleLink (sal_uInt16 nIndex) const
- {
-@@ -551,6 +791,7 @@ struct OStoreDirectoryDataBlock
- }
- };
-
-+
- /*========================================================================
- *
- * OStoreDirectoryPageData.
-@@ -558,14 +799,14 @@ struct OStoreDirectoryDataBlock
- *======================================================================*/
- #define STORE_MAGIC_DIRECTORYPAGE sal_uInt32(0x62190120)
-
--struct OStoreDirectoryPageData : public store::OStorePageData
-+struct OStoreDirectoryPageDataV1 : public store::OStorePageData
- {
-- typedef OStorePageData base;
-- typedef OStoreDirectoryPageData self;
-+ typedef store::OStorePageData base;
-+ typedef OStoreDirectoryPageDataV1 self;
-
-- typedef OStorePageDescriptor D;
-- typedef OStorePageNameBlock NameBlock;
-- typedef OStoreDirectoryDataBlock DataBlock;
-+ typedef OStorePageDescriptor D;
-+ typedef OStorePageNameBlockV1 NameBlock;
-+ typedef OStoreDirectoryDataBlockV1 DataBlock;
-
- /** Representation.
- */
-@@ -581,7 +822,7 @@ struct OStoreDirectoryPageData : public store::OStorePageData
- */
- static const size_t theSize = NameBlock::theSize + DataBlock::theSize;
- static const sal_uInt16 thePageSize = base::theSize + self::theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= self::thePageSize);
-
- /** capacity.
- */
-@@ -612,7 +853,7 @@ struct OStoreDirectoryPageData : public store::OStorePageData
-
- /** Construction.
- */
-- explicit OStoreDirectoryPageData (sal_uInt16 nPageSize)
-+ explicit OStoreDirectoryPageDataV1 (sal_uInt16 nPageSize)
- : base (nPageSize), m_aNameBlock(), m_aDataBlock()
- {
- base::m_aGuard.m_nMagic = store::htonl(self::theTypeId);
-@@ -637,201 +878,553 @@ struct OStoreDirectoryPageData : public store::OStorePageData
- eErrCode = m_aDataBlock.verify();
- return eErrCode;
- }
-+};
-+
-+struct OStoreDirectoryPageDataV2 : public store::OStorePageData
-+{
-+ typedef store::OStorePageData base;
-+ typedef OStoreDirectoryPageDataV2 self;
-
-- /** ChunkDescriptor.
-+ typedef OStorePageDescriptor D;
-+ typedef OStorePageNameBlockV2 NameBlock;
-+ typedef OStoreDirectoryDataBlockV2 DataBlock;
-+
-+ /** Representation.
-+ */
-+ NameBlock m_aNameBlock;
-+ DataBlock m_aDataBlock;
-+ sal_uInt8 m_pData[1];
-+
-+ /** type.
-+ */
-+ static const sal_uInt32 theTypeId = STORE_MAGIC_DIRECTORYPAGE;
-+
-+ /** size.
-+ */
-+ static const size_t theSize = NameBlock::theSize + DataBlock::theSize;
-+ static const sal_uInt16 thePageSize = base::theSize + self::theSize;
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V2 >= self::thePageSize);
-+
-+ /** capacity.
- */
-- struct ChunkDescriptor
-+ sal_uInt16 capacity() const
- {
-- /** Representation.
-- */
-- sal_uInt32 m_nPage;
-- sal_uInt16 m_nOffset;
-- sal_uInt16 m_nLength;
-+ return (store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
-+ }
-
-- /** Construction.
-- */
-- ChunkDescriptor (sal_uInt32 nPosition, sal_uInt16 nCapacity)
-- {
-- m_nPage = nPosition / nCapacity;
-- m_nOffset = (sal_uInt16)((nPosition % nCapacity) & 0xffff);
-- m_nLength = nCapacity - m_nOffset;
-- }
-- };
-+ /** usage.
-+ */
-+ sal_uInt16 usage() const
-+ {
-+ return (store::ntohs(base::m_aDescr.m_nUsed) - self::thePageSize);
-+ }
-
-- /** ChunkScope.
-+ /** initialize.
- */
-- enum ChunkScope
-+ void initialize (void)
- {
-- SCOPE_INTERNAL,
-- SCOPE_EXTERNAL,
-- SCOPE_DIRECT,
-- SCOPE_SINGLE,
-- SCOPE_DOUBLE,
-- SCOPE_TRIPLE,
-- SCOPE_UNREACHABLE,
-- SCOPE_UNKNOWN
-- };
-+ base::m_aGuard.m_nMagic = store::htonl(self::theTypeId);
-+ base::m_aDescr.m_nUsed = store::htons(self::thePageSize);
-
-- /** scope (internal).
-+ m_aNameBlock.initialize();
-+ m_aDataBlock.initialize();
-+
-+ memset (m_pData, 0, capacity());
-+ }
-+
-+ /** Construction.
- */
-- ChunkScope scope (sal_uInt32 nPosition) const
-+ explicit OStoreDirectoryPageDataV2 (sal_uInt16 nPageSize)
-+ : base (nPageSize), m_aNameBlock(), m_aDataBlock()
- {
-- sal_uInt32 nCapacity = capacity();
-- if (nPosition < nCapacity)
-- return SCOPE_INTERNAL;
-- else
-- return SCOPE_EXTERNAL;
-+ base::m_aGuard.m_nMagic = store::htonl(self::theTypeId);
-+ base::m_aDescr.m_nUsed = store::htons(self::thePageSize);
-+ memset (m_pData, 0, capacity());
-+ }
-+
-+ /** guard (external representation).
-+ */
-+ void guard()
-+ {
-+ m_aNameBlock.guard();
-+ m_aDataBlock.guard();
-+ }
-+
-+ /** verify (external representation).
-+ */
-+ storeError verify() const
-+ {
-+ storeError eErrCode = m_aNameBlock.verify();
-+ if (eErrCode == store_E_None)
-+ eErrCode = m_aDataBlock.verify();
-+ return eErrCode;
-+ }
-+};
-+
-+/** ChunkDescriptor.
-+ */
-+struct ChunkDescriptor
-+{
-+ /** Representation.
-+ */
-+ sal_uInt32 m_nPage;
-+ sal_uInt16 m_nOffset;
-+ sal_uInt16 m_nLength;
-+
-+ /** Construction.
-+ */
-+ ChunkDescriptor (sal_uInt32 nPosition, sal_uInt16 nCapacity)
-+ {
-+ m_nPage = nPosition / nCapacity;
-+ m_nOffset = (sal_uInt16)((nPosition % nCapacity) & 0xffff);
-+ m_nLength = nCapacity - m_nOffset;
- }
- };
-
- /*========================================================================
- *
-- * OStoreDirectoryPageObject.
-+ * OStorePageLongNameData.
- *
- *======================================================================*/
--class OStoreDirectoryPageObject : public store::OStorePageObject
-+
-+#define STORE_MAGIC_LONGNAME sal_uInt32 (0x12345678)
-+
-+struct OStorePageLongNameData : public OStorePageData
- {
-- typedef OStorePageObject base;
-- typedef OStoreDirectoryPageData page;
-- typedef OStoreIndirectionPageData indirect;
-+ typedef OStorePageData base;
-
-- typedef OStorePageDescriptor D;
-+ /** Representation
-+ */
-+ sal_Char m_nData[1];
-+
-+ /** type.
-+ */
-+ static const sal_uInt32 theTypeId = STORE_MAGIC_LONGNAME;
-+
-+ explicit OStorePageLongNameData(sal_uInt16 nPageSize) :
-+ OStorePageData (nPageSize)
-+ {
-+ m_aGuard.m_nMagic = STORE_MAGIC_LONGNAME;
-+ m_aDescr.m_nUsed = sal::static_int_cast< sal_uInt16 >(
-+ m_aDescr.m_nUsed);
-+ memset (&m_nData, 0, capacity());
-+ }
-+
-+ /** capacity.
-+ */
-+ sal_uInt16 capacity (void)
-+ {
-+ return (m_aDescr.m_nSize - (base::size()));
-+ }
-+};
-+
-+/*========================================================================
-+ *
-+ * OStorePageLongNameDataPageObject.
-+ *
-+ *======================================================================*/
-+class OStorePageLongNameDataPageObject : public store::OStorePageObject
-+{
-+ typedef OStorePageObject base;
-+ typedef OStorePageLongNameData page;
-
- public:
- /** Construction.
- */
-- explicit OStoreDirectoryPageObject (PageHolder const & rxPage = PageHolder())
-+ explicit OStorePageLongNameDataPageObject (PageHolder const & rxPage = PageHolder())
- : OStorePageObject (rxPage)
- {}
-
- /** External representation.
-- */
-+ */
- virtual storeError guard (sal_uInt32 nAddr);
-- virtual storeError verify (sal_uInt32 nAddr) const;
-+ virtual storeError verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const;
-+};
-
-- /** attrib.
-- */
-- sal_uInt32 attrib (void) const
-- {
-- return store::ntohl(PAGE().m_aNameBlock.m_nAttrib);
-- }
-- void attrib (sal_uInt32 nAttrib)
-+/*========================================================================
-+ *
-+ * OStoreDirectoryPageObject.
-+ *
-+ *======================================================================*/
-+struct OStoreDirectoryPageObject : public store::OStorePageObject
-+{
-+ /** ChunkScope.
-+ */
-+ enum ChunkScope
- {
-- PAGE().m_aNameBlock.m_nAttrib = store::htonl(nAttrib);
-- touch();
-- }
-+ SCOPE_INTERNAL,
-+ SCOPE_EXTERNAL,
-+ SCOPE_DIRECT,
-+ SCOPE_SINGLE,
-+ SCOPE_DOUBLE,
-+ SCOPE_TRIPLE,
-+ SCOPE_UNREACHABLE,
-+ SCOPE_UNKNOWN
-+ };
-
-- /** key.
-- */
-- OStorePageKey key (void) const
-- {
-- return PAGE().m_aNameBlock.m_aKey;
-- }
-- void key (OStorePageKey const & rKey)
-- {
-- PAGE().m_aNameBlock.m_aKey = rKey;
-- touch();
-- }
-+ virtual OStorePageDescriptor const& getDescriptor (void) const = 0;
-+ virtual sal_uInt32 capacity (void) const = 0;
-+ virtual sal_uInt32 attrib (void) const = 0;
-+ virtual void attrib (sal_uInt32 nAttrib) = 0;
-+ virtual OStorePageKey key (void) const = 0;
-+ virtual void key (OStorePageKey const & rKey) = 0;
-+ virtual sal_uInt32 path (void) const = 0;
-+ virtual sal_Size getName (sal_Char * pBuffer, sal_Size nBufsiz, OStorePageBIOS &rBIOS) const = 0;
-+ virtual void setName (sal_Char const * pBuffer, sal_Size nBufsiz) = 0;
-+ virtual sal_uInt32 dataLength (void) const = 0;
-+ virtual void dataLength (sal_uInt32 nLength) = 0;
-+ virtual sal_uInt8* getDataBuffer (void) = 0;
-+ virtual ChunkScope scope (sal_uInt32 nPage,
-+ LinkDescriptor &rDescr) const = 0;
-+ virtual storeError truncate (
-+ ChunkScope eScope,
-+ sal_uInt16 nRemain,
-+ OStorePageBIOS &rBIOS) = 0;
-+
-+ storeError read (
-+ sal_uInt32 nPage,
-+ OStoreDataPageObject &rData,
-+ OStorePageBIOS &rBIOS);
-+ storeError write (
-+ sal_uInt32 nPage,
-+ OStoreDataPageObject &rData,
-+ OStorePageBIOS &rBIOS);
-+ storeError truncate (
-+ sal_uInt32 nPage,
-+ OStorePageBIOS &rBIOS);
-
-- /** path.
-+ /** scope (internal).
- */
-- sal_uInt32 path (void) const
-+ ChunkScope scope (sal_uInt32 nPosition) const
- {
-- page const & rPage = PAGE();
-- const sal_Char * pszName = rPage.m_aNameBlock.m_pData;
-- sal_uInt32 nPath = store::ntohl(rPage.m_aNameBlock.m_aKey.m_nHigh);
-- return rtl_crc32 (nPath, pszName, rtl_str_getLength(pszName));
-+ sal_uInt32 nCapacity = capacity();
-+ if (nPosition < nCapacity)
-+ return SCOPE_INTERNAL;
-+ else
-+ return SCOPE_EXTERNAL;
- }
-
-- sal_Size getName (sal_Char * pBuffer, sal_Size nBufsiz) const
-- {
-- sal_Char const * pszName = PAGE().m_aNameBlock.m_pData;
-- sal_Size nLength = rtl_str_getLength(pszName);
-- memcpy (pBuffer, pszName, SAL_MIN(nLength, nBufsiz));
-- return nLength;
-- }
-+private:
-+ virtual sal_uInt32 directLink (sal_uInt16 nIndex) const = 0;
-+ virtual void directLink (sal_uInt16 nIndex, sal_uInt32 nAddr) = 0;
-+ virtual sal_uInt32 singleLink (sal_uInt16 nIndex) const = 0;
-+ virtual void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) = 0;
-+ virtual sal_uInt32 doubleLink (sal_uInt16 nIndex) const = 0;
-+ virtual void doubleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) = 0;
-+ virtual sal_uInt32 tripleLink (sal_uInt16 nIndex) const = 0;
-+ virtual void tripleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) = 0;
-+
-+protected:
-+ storeError store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS);
-+ storeError store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nDouble,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS);
-+ storeError store_truncate (
-+ sal_uInt32 nAddr,
-+ sal_uInt16 nTriple,
-+ sal_uInt16 nDouble,
-+ sal_uInt16 nSingle,
-+ OStorePageBIOS &rBIOS);
-+};
-
-- /** dataLength.
-- */
-- sal_uInt32 dataLength (void) const
-- {
-- return store::ntohl(PAGE().m_aDataBlock.m_nDataLen);
-- }
-- void dataLength (sal_uInt32 nLength)
-- {
-- PAGE().m_aDataBlock.m_nDataLen = store::htonl(nLength);
-- touch();
-- }
-+template<class T> class OStoreDirectoryPageObjectTemplate : public OStoreDirectoryPageObject
-+{
-+ typedef OStorePageObject base;
-+ typedef T page;
-+ typedef OStoreIndirectionPageData indirect;
-
-- /** direct.
-- */
-- sal_uInt32 directLink (sal_uInt16 nIndex) const
-+ typedef OStorePageDescriptor D;
-+
-+ virtual sal_uInt32 directLink (sal_uInt16 nIndex) const
- {
- return PAGE().m_aDataBlock.directLink (nIndex);
- }
-- void directLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ virtual void directLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
- {
- PAGE().m_aDataBlock.directLink (nIndex, nAddr);
-- touch();
- }
--
-- /** single indirect.
-- */
-- sal_uInt32 singleLink (sal_uInt16 nIndex) const
-+ virtual sal_uInt32 singleLink (sal_uInt16 nIndex) const
- {
- return PAGE().m_aDataBlock.singleLink (nIndex);
- }
-- void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ virtual void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
- {
- PAGE().m_aDataBlock.singleLink (nIndex, nAddr);
-- touch();
- }
--
-- /** double indirect.
-- */
-- sal_uInt32 doubleLink (sal_uInt16 nIndex) const
-+ virtual sal_uInt32 doubleLink (sal_uInt16 nIndex) const
- {
- return PAGE().m_aDataBlock.doubleLink (nIndex);
- }
-- void doubleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ virtual void doubleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
- {
- PAGE().m_aDataBlock.doubleLink (nIndex, nAddr);
-- touch();
- }
--
-- /** triple indirect.
-- */
-- sal_uInt32 tripleLink (sal_uInt16 nIndex) const
-+ virtual sal_uInt32 tripleLink (sal_uInt16 nIndex) const
- {
- return PAGE().m_aDataBlock.tripleLink (nIndex);
- }
-- void tripleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
-+ virtual void tripleLink (sal_uInt16 nIndex, sal_uInt32 nAddr)
- {
- PAGE().m_aDataBlock.tripleLink (nIndex, nAddr);
-- touch();
- }
-+ virtual ChunkScope scope (sal_uInt32 nPage,
-+ LinkDescriptor &rDescr) const
-+ {
-+ page const & rPage = PAGE();
-+ sal_uInt32 index0, index1, index2, index3;
-
-- /** read (external data page).
-- */
-- storeError read (
-- sal_uInt32 nPage,
-- OStoreDataPageObject &rData,
-- OStorePageBIOS &rBIOS);
-+ // direct.
-+ sal_uInt32 nCount = rPage.m_aDataBlock.directCount();
-+ sal_uInt32 nLimit = nCount;
-+ if (nPage < nLimit)
-+ {
-+ // Page to index reduction.
-+ index0 = nPage;
-
-- /** write (external data page).
-- */
-- storeError write (
-- sal_uInt32 nPage,
-- OStoreDataPageObject &rData,
-- OStorePageBIOS &rBIOS);
-+ // Setup LinkDescriptor indices.
-+ rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-+
-+ // Done.
-+ return SCOPE_DIRECT;
-+ }
-+ nPage -= nLimit;
-+
-+ // single indirect.
-+ sal_uInt32 const nCapacity = indirect::capacityCount(rPage.m_aDescr);
-+ nCount = rPage.m_aDataBlock.singleCount();
-+ nLimit = nCount * nCapacity;
-+ if (nPage < nLimit)
-+ {
-+ // Page to index reduction.
-+ sal_uInt32 n = nPage;
-+
-+ // Reduce to single indirect i(1), direct n = i(0).
-+ index1 = n / nCapacity;
-+ index0 = n % nCapacity;
-+
-+ // Verify reduction.
-+ n = index1 * nCapacity + index0;
-+ OSL_POSTCOND(n == nPage, "wrong math on indirect indices");
-+ if (n != nPage)
-+ return SCOPE_UNKNOWN;
-+
-+ // Setup LinkDescriptor indices.
-+ rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-+ rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
-+
-+ // Done.
-+ return SCOPE_SINGLE;
-+ }
-+ nPage -= nLimit;
-+
-+ // double indirect.
-+ nCount = rPage.m_aDataBlock.doubleCount();
-+ nLimit = nCount * nCapacity * nCapacity;
-+ if (nPage < nLimit)
-+ {
-+ // Page to index reduction.
-+ sal_uInt32 n = nPage;
-+
-+ // Reduce to double indirect i(2), single indirect n = i(0).
-+ index2 = n / (nCapacity * nCapacity);
-+ n = n % (nCapacity * nCapacity);
-+
-+ // Reduce to single indirect i(1), direct n = i(0).
-+ index1 = n / nCapacity;
-+ index0 = n % nCapacity;
-+
-+ // Verify reduction.
-+ n = index2 * nCapacity * nCapacity +
-+ index1 * nCapacity + index0;
-+ OSL_POSTCOND(n == nPage, "wrong math on double indirect indices");
-+ if (n != nPage)
-+ return SCOPE_UNKNOWN;
-+
-+ // Setup LinkDescriptor indices.
-+ rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-+ rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
-+ rDescr.m_nIndex2 = (sal_uInt16)(index2 & 0xffff);
-+
-+ // Done.
-+ return SCOPE_DOUBLE;
-+ }
-+ nPage -= nLimit;
-+
-+ // triple indirect.
-+ nCount = rPage.m_aDataBlock.tripleCount();
-+ nLimit = nCount * nCapacity * nCapacity * nCapacity;
-+ if (nPage < nLimit)
-+ {
-+ // Page to index reduction.
-+ sal_uInt32 n = nPage;
-+
-+ // Reduce to triple indirect i(3), double indirect n.
-+ index3 = n / (nCapacity * nCapacity * nCapacity);
-+ n = n % (nCapacity * nCapacity * nCapacity);
-+
-+ // Reduce to double indirect i(2), single indirect n.
-+ index2 = n / (nCapacity * nCapacity);
-+ n = n % (nCapacity * nCapacity);
-+
-+ // Reduce to single indirect i(1), direct n = i(0).
-+ index1 = n / nCapacity;
-+ index0 = n % nCapacity;
-+
-+ // Verify reduction.
-+ n = index3 * nCapacity * nCapacity * nCapacity +
-+ index2 * nCapacity * nCapacity +
-+ index1 * nCapacity + index0;
-+ OSL_POSTCOND(n == nPage, "wrong math on triple indirect indices");
-+ if (n != nPage)
-+ return SCOPE_UNKNOWN;
-+
-+ // Setup LinkDescriptor indices.
-+ rDescr.m_nIndex0 = (sal_uInt16)(index0 & 0xffff);
-+ rDescr.m_nIndex1 = (sal_uInt16)(index1 & 0xffff);
-+ rDescr.m_nIndex2 = (sal_uInt16)(index2 & 0xffff);
-+ rDescr.m_nIndex3 = (sal_uInt16)(index3 & 0xffff);
-+
-+ // Done.
-+ return SCOPE_TRIPLE;
-+ }
-+
-+ // Unreachable (more than triple indirect).
-+ return SCOPE_UNREACHABLE;
-+ }
-+
-+ /*
-+ * truncate (external data page scope; private).
-+ */
-+ virtual storeError truncate (
-+ ChunkScope eScope,
-+ sal_uInt16 nRemain,
-+ OStorePageBIOS &rBIOS)
-+ {
-+ page const & rPage = PAGE();
-+
-+ // Enter.
-+ storeError eErrCode = store_E_None;
-+ if (eScope == SCOPE_DIRECT)
-+ {
-+ // Truncate direct data pages.
-+ sal_uInt16 i, n = rPage.m_aDataBlock.directCount();
-+ for (i = n; i > nRemain; i--)
-+ {
-+ // Obtain data page location.
-+ sal_uInt32 nAddr = directLink (i - 1);
-+ if (nAddr == STORE_PAGE_NULL) continue;
-+
-+ // Free data page.
-+ OStoreDataPageData aData;
-+ eErrCode = rBIOS.free (aData, nAddr);
-+ if (eErrCode != store_E_None)
-+ break;
-+
-+ // Clear pointer to data page.
-+ directLink (i - 1, STORE_PAGE_NULL);
-+ }
-+
-+ // Done.
-+ return eErrCode;
-+ }
-+
-+ if (eScope == SCOPE_SINGLE)
-+ {
-+ // Truncate single indirect pages.
-+ sal_uInt16 i, n = rPage.m_aDataBlock.singleCount();
-+ for (i = n; i > nRemain; i--)
-+ {
-+ // Truncate single indirect page to zero data pages.
-+ eErrCode = store_truncate (singleLink (i - 1), 0, rBIOS);
-+ if (eErrCode != store_E_None)
-+ break;
-+
-+ // Clear pointer to single indirect page.
-+ singleLink (i - 1, STORE_PAGE_NULL);
-+ }
-+
-+ // Done.
-+ return eErrCode;
-+ }
-+
-+ if (eScope == SCOPE_DOUBLE)
-+ {
-+ // Truncate double indirect pages.
-+ sal_uInt16 i, n = rPage.m_aDataBlock.doubleCount();
-+ for (i = n; i > nRemain; i--)
-+ {
-+ // Truncate double indirect page to zero single indirect pages.
-+ eErrCode = store_truncate (doubleLink (i - 1), 0, 0, rBIOS);
-+ if (eErrCode != store_E_None)
-+ break;
-+
-+ // Clear pointer to double indirect page.
-+ doubleLink (i - 1, STORE_PAGE_NULL);
-+ }
-+
-+ // Done.
-+ return eErrCode;
-+ }
-+
-+ if (eScope == SCOPE_TRIPLE)
-+ {
-+ // Truncate triple indirect pages.
-+ sal_uInt16 i, n = rPage.m_aDataBlock.tripleCount();
-+ for (i = n; i > nRemain; i--)
-+ {
-+ // Truncate to zero double indirect pages.
-+ eErrCode = store_truncate (tripleLink (i - 1), 0, 0, 0, rBIOS);
-+ if (eErrCode != store_E_None)
-+ break;
-+
-+ // Clear pointer to triple indirect page.
-+ tripleLink (i - 1, STORE_PAGE_NULL);
-+ }
-+
-+ // Done.
-+ return eErrCode;
-+ }
-
-- /** truncate (external data page).
-+ // Invalid scope.
-+ return store_E_InvalidAccess;
-+ }
-+
-+public:
-+ /** Construction.
- */
-- storeError truncate (
-- sal_uInt32 nPage,
-- OStorePageBIOS &rBIOS);
-+ OStoreDirectoryPageObjectTemplate ()
-+ : OStoreDirectoryPageObject ()
-+ {}
-
--private:
-+ virtual storeError guard(sal_uInt32 nAddr)
-+ { return PageHolderObject< page >::guard (m_xPage, nAddr); }
-+ virtual storeError verify(sal_uInt32 nAddr, sal_uInt16 nVersion) const
-+ { return PageHolderObject< page >::verify (m_xPage, nAddr, nVersion); }
-+ virtual OStorePageDescriptor const& getDescriptor (void) const
-+ { return PAGE().m_aDescr; }
-+ virtual sal_uInt32 capacity (void) const
-+ { return PAGE().capacity(); }
-+ virtual sal_uInt32 attrib (void) const
-+ { return store::ntohl(PAGE().m_aNameBlock.m_nAttrib); }
-+ virtual void attrib (sal_uInt32 nAttrib)
-+ { PAGE().m_aNameBlock.m_nAttrib = store::htonl(nAttrib); }
-+ virtual OStorePageKey key (void) const
-+ { return PAGE().m_aNameBlock.m_aKey; }
-+ virtual void key (OStorePageKey const & rKey)
-+ { PAGE().m_aNameBlock.m_aKey = rKey; }
-+ virtual sal_uInt32 dataLength (void) const
-+ { return store::ntohl(PAGE().m_aDataBlock.m_nDataLen); }
-+ virtual void dataLength (sal_uInt32 nLength)
-+ { PAGE().m_aDataBlock.m_nDataLen = store::htonl(nLength); }
-+ virtual sal_uInt8* getDataBuffer (void)
-+ { return PAGE().m_pData; }
-+
-+protected:
- /** Representation.
- */
- page & PAGE()
-@@ -846,19 +1439,30 @@ private:
- OSL_PRECOND(pImpl != 0, "OStoreDirectoryPageObject::PAGE(): Null pointer");
- return (*pImpl);
- }
-+};
-
-- /** scope (external data page; private).
-+struct OStoreDirectoryPageObjectV1 : public OStoreDirectoryPageObjectTemplate<OStoreDirectoryPageDataV1>
-+{
-+ /** Construction.
- */
-- page::ChunkScope scope (
-- sal_uInt32 nPage,
-- page::DataBlock::LinkDescriptor &rDescr) const;
-+ OStoreDirectoryPageObjectV1 ()
-+ {}
-+
-+ virtual sal_uInt32 path (void) const;
-+ virtual sal_Size getName (sal_Char * pBuffer, sal_Size nBufsiz, OStorePageBIOS &rBIOS) const;
-+ virtual void setName (sal_Char const * pBuffer, sal_Size nBufsiz);
-+};
-
-- /** truncate (external data page scope; private).
-+struct OStoreDirectoryPageObjectV2 : public OStoreDirectoryPageObjectTemplate<OStoreDirectoryPageDataV2>
-+{
-+ /** Construction.
- */
-- storeError truncate (
-- page::ChunkScope eScope,
-- sal_uInt16 nRemain,
-- OStorePageBIOS &rBIOS);
-+ OStoreDirectoryPageObjectV2 ()
-+ {}
-+
-+ virtual sal_uInt32 path (void) const;
-+ virtual sal_Size getName (sal_Char * pBuffer, sal_Size nBufsiz, OStorePageBIOS &rBIOS) const;
-+ virtual void setName (sal_Char const * pBuffer, sal_Size nBufsiz);
- };
-
- /*========================================================================
-diff --git store/source/stordir.cxx store/source/stordir.cxx
-index 0269e9c..cd2d610 100644
---- store/source/stordir.cxx
-+++ store/source/stordir.cxx
-@@ -82,14 +82,14 @@ using namespace store;
- */
- inline sal_Size __store_convertTextToUnicode (
- rtl_TextToUnicodeConverter hConverter,
-- const sal_Char *pSrcBuffer, sal_Size nSrcLength,
-+ rtl_String *pSrc,
- sal_Unicode *pDstBuffer, sal_Size nDstLength)
- {
- sal_uInt32 nCvtInfo = 0;
- sal_Size nCvtBytes = 0;
- return rtl_convertTextToUnicode (
- hConverter, 0,
-- pSrcBuffer, nSrcLength,
-+ pSrc->buffer, pSrc->length,
- pDstBuffer, nDstLength,
- OSTRING_TO_OUSTRING_CVTFLAGS,
- &nCvtInfo, &nCvtBytes);
-@@ -149,28 +149,28 @@ storeError OStoreDirectory_Impl::create (
- if (!(pPath && pName))
- return store_E_InvalidParameter;
-
-- OStoreDirectoryPageObject aPage;
-+ boost::scoped_ptr<inode> pPage;
-+ xManager->createDirectoryPageObject(pPage);
- storeError eErrCode = xManager->iget (
-- aPage, STORE_ATTRIB_ISDIR,
-+ *pPage, STORE_ATTRIB_ISDIR,
- pPath, pName, eMode);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-- if (!(aPage.attrib() & STORE_ATTRIB_ISDIR))
-+ if (!(pPage->attrib() & STORE_ATTRIB_ISDIR))
- return store_E_NotDirectory;
-
-- inode_holder_type xNode (aPage.get());
-- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadOnly);
-+ eErrCode = xManager->acquirePage (pPage->getDescriptor(), store_AccessReadOnly);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Evaluate iteration path.
-- m_nPath = aPage.path();
-+ m_nPath = pPage->path();
- m_nPath = rtl_crc32 (m_nPath, "/", 1);
-
- // Save page manager, and descriptor.
- m_xManager = xManager;
-- m_aDescr = xNode->m_aDescr;
-+ m_aDescr = pPage->getDescriptor();
-
- return store_E_None;
- }
-@@ -208,19 +208,19 @@ storeError OStoreDirectory_Impl::iterate (storeFindData &rFindData)
- if (!(rFindData.m_nAttrib & STORE_ATTRIB_ISLINK))
- {
- // Load page.
-- OStoreDirectoryPageObject aPage;
-- eErrCode = m_xManager->loadObjectAt (aPage, aLink.location());
-+ boost::scoped_ptr<inode> pPage;
-+ m_xManager->createDirectoryPageObject(pPage);
-+ eErrCode = m_xManager->loadObjectAt (*pPage, aLink.location());
- if (eErrCode == store_E_None)
- {
-- inode_holder_type xNode (aPage.get());
--
- // Setup FindData.
-- sal_Char *p = xNode->m_aNameBlock.m_pData;
-- sal_Size n = rtl_str_getLength (p);
-- sal_Size k = rFindData.m_nLength;
-+ rtl_String *pName=0;
-+ rtl_string_new_WithLength (&pName, STORE_MAXIMUM_NAMESIZE - 1);
-+ sal_Size n = pPage->getName(pName->buffer, pName->length, *m_xManager);
-+ sal_Size k = rFindData.m_nLength;
-
- n = __store_convertTextToUnicode (
-- m_hTextCvt, p, n,
-+ m_hTextCvt, pName,
- rFindData.m_pszName, STORE_MAXIMUM_NAMESIZE - 1);
- if (k > n)
- {
-@@ -229,8 +229,10 @@ storeError OStoreDirectory_Impl::iterate (storeFindData &rFindData)
- }
-
- rFindData.m_nLength = n;
-- rFindData.m_nAttrib |= aPage.attrib();
-- rFindData.m_nSize = aPage.dataLength();
-+ rFindData.m_nAttrib |= pPage->attrib();
-+ rFindData.m_nSize = pPage->dataLength();
-+
-+ rtl_string_release (pName);
-
- // Leave.
- rFindData.m_nReserved = store::ntohl(aKey.m_nLow);
-diff --git store/source/stordir.hxx store/source/stordir.hxx
-index acfbf36..48f79b0 100644
---- store/source/stordir.hxx
-+++ store/source/stordir.hxx
-@@ -63,7 +63,7 @@
- namespace store
- {
-
--struct OStoreDirectoryPageData;
-+struct OStoreDirectoryPageObject;
-
- /*========================================================================
- *
-@@ -119,8 +119,7 @@ private:
-
- /** Representation.
- */
-- typedef OStoreDirectoryPageData inode;
-- typedef PageHolderObject< inode > inode_holder_type;
-+ typedef OStoreDirectoryPageObject inode;
-
- rtl::Reference<OStorePageManager> m_xManager;
-
-diff --git store/source/store.cxx store/source/store.cxx
-index 87e85fc..923ce29 100644
---- store/source/store.cxx
-+++ store/source/store.cxx
-@@ -118,7 +118,8 @@ storeError SAL_CALL store_releaseHandle (
- */
- storeError SAL_CALL store_createMemoryFile (
- sal_uInt16 nPageSize,
-- storeFileHandle *phFile
-+ storeFileHandle *phFile,
-+ sal_uInt16 nFormatVersion
- ) SAL_THROW_EXTERN_C()
- {
- if (!phFile)
-@@ -137,7 +138,7 @@ storeError SAL_CALL store_createMemoryFile (
- return store_E_OutOfMemory;
-
- eErrCode = xManager->initialize (
-- &*xLockBytes, store_AccessCreate, nPageSize);
-+ &*xLockBytes, store_AccessCreate, nPageSize, nFormatVersion);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -154,7 +155,8 @@ storeError SAL_CALL store_openFile (
- rtl_uString *pFilename,
- storeAccessMode eAccessMode,
- sal_uInt16 nPageSize,
-- storeFileHandle *phFile
-+ storeFileHandle *phFile,
-+ sal_uInt16 nFormatVersion
- ) SAL_THROW_EXTERN_C()
- {
- if (phFile)
-@@ -175,7 +177,7 @@ storeError SAL_CALL store_openFile (
- return store_E_OutOfMemory;
-
- eErrCode = xManager->initialize (
-- &*xLockBytes, eAccessMode, nPageSize);
-+ &*xLockBytes, eAccessMode, nPageSize, nFormatVersion);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-diff --git store/source/storlckb.cxx store/source/storlckb.cxx
-index 6175064..4e4adbb 100644
---- store/source/storlckb.cxx
-+++ store/source/storlckb.cxx
-@@ -72,9 +72,9 @@ OStoreLockBytes::~OStoreLockBytes (void)
- {
- if (m_xManager.is())
- {
-- if (m_xNode.is())
-+ if (m_xNode.get())
- {
-- OStorePageDescriptor aDescr (m_xNode->m_aDescr);
-+ OStorePageDescriptor aDescr (m_xNode->getDescriptor());
- if (m_bWriteable)
- m_xManager->releasePage (aDescr, store_AccessReadWrite);
- else
-@@ -107,32 +107,30 @@ storeError OStoreLockBytes::create (
- if (!(pPath && pName))
- return store_E_InvalidParameter;
-
-- OStoreDirectoryPageObject aPage;
-+ xManager->createDirectoryPageObject(m_xNode);
- storeError eErrCode = xManager->iget (
-- aPage, STORE_ATTRIB_ISFILE,
-+ *m_xNode, STORE_ATTRIB_ISFILE,
- pPath, pName, eMode);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-- if (!(aPage.attrib() & STORE_ATTRIB_ISFILE))
-+ if (!(m_xNode->attrib() & STORE_ATTRIB_ISFILE))
- {
- // No ISFILE in older versions (backward compatibility).
-- if (aPage.attrib() & STORE_ATTRIB_ISLINK)
-+ if (m_xNode->attrib() & STORE_ATTRIB_ISLINK)
- return store_E_NotFile;
- }
-
- // ...
-- inode_holder_type xNode (aPage.get());
- if (eMode != store_AccessReadOnly)
-- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadWrite);
-+ eErrCode = xManager->acquirePage (m_xNode->getDescriptor(), store_AccessReadWrite);
- else
-- eErrCode = xManager->acquirePage (xNode->m_aDescr, store_AccessReadOnly);
-+ eErrCode = xManager->acquirePage (m_xNode->getDescriptor(), store_AccessReadOnly);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // ...
- m_xManager = xManager;
-- m_xNode = xNode;
- m_bWriteable = (eMode != store_AccessReadOnly);
-
- // Check for truncation.
-@@ -167,9 +165,7 @@ storeError OStoreLockBytes::readAt (
- osl::MutexGuard aGuard (*m_xManager);
-
- // Determine data length.
-- OStoreDirectoryPageObject aPage (m_xNode.get());
--
-- sal_uInt32 nDataLen = aPage.dataLength();
-+ sal_uInt32 nDataLen = m_xNode->dataLength();
- if ((nOffset + nBytes) > nDataLen)
- nBytes = nDataLen - nOffset;
-
-@@ -183,7 +179,7 @@ storeError OStoreLockBytes::readAt (
- if (eScope == inode::SCOPE_INTERNAL)
- {
- // Read from inode page (internal scope).
-- inode::ChunkDescriptor aDescr (
-+ ChunkDescriptor aDescr (
- nOffset, m_xNode->capacity());
-
- sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
-@@ -191,7 +187,7 @@ storeError OStoreLockBytes::readAt (
-
- memcpy (
- &pData[rnDone],
-- &m_xNode->m_pData[aDescr.m_nOffset],
-+ &m_xNode->getDataBuffer()[aDescr.m_nOffset],
- nLength);
-
- // Adjust counters.
-@@ -202,13 +198,13 @@ storeError OStoreLockBytes::readAt (
- else
- {
- // Read from data page (external scope).
-- inode::ChunkDescriptor aDescr (
-- nOffset - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->m_aDescr)); // @@@
-+ ChunkDescriptor aDescr (
-+ nOffset - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->getDescriptor())); // @@@
-
- sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- nLength = SAL_MIN(nLength, nBytes);
-
-- storeError eErrCode = aPage.read (aDescr.m_nPage, aData, *m_xManager);
-+ storeError eErrCode = m_xNode->read (aDescr.m_nPage, aData, *m_xManager);
- if (eErrCode != store_E_None)
- {
- if (eErrCode != store_E_NotExists)
-@@ -264,8 +260,8 @@ storeError OStoreLockBytes::writeAt (
- osl::MutexGuard aGuard (*m_xManager);
-
- // Write data.
-- OStoreDirectoryPageObject aPage (m_xNode.get());
- const sal_uInt8 *pData = (const sal_uInt8*)pBuffer;
-+ bool bDirty=false;
-
- storeError eErrCode = store_E_None;
- while (nBytes > 0)
-@@ -275,18 +271,18 @@ storeError OStoreLockBytes::writeAt (
- if (eScope == inode::SCOPE_INTERNAL)
- {
- // Write to inode page (internal scope).
-- inode::ChunkDescriptor aDescr (
-+ ChunkDescriptor aDescr (
- nOffset, m_xNode->capacity());
-
- sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- nLength = SAL_MIN(nLength, nBytes);
-
- memcpy (
-- &m_xNode->m_pData[aDescr.m_nOffset],
-+ &m_xNode->getDataBuffer()[aDescr.m_nOffset],
- &pData[rnDone], nLength);
-
- // Mark inode dirty.
-- aPage.touch();
-+ bDirty = true;
-
- // Adjust counters.
- rnDone += nLength;
-@@ -294,23 +290,23 @@ storeError OStoreLockBytes::writeAt (
- nBytes -= nLength;
-
- // Adjust data length.
-- if (aPage.dataLength() < nOffset)
-- aPage.dataLength (nOffset);
-+ if (m_xNode->dataLength() < nOffset)
-+ m_xNode->dataLength (nOffset);
- }
- else
- {
- // Write to data page (external scope).
- OStoreDataPageObject aData;
-
-- inode::ChunkDescriptor aDescr (
-- nOffset - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->m_aDescr)); // @@@
-+ ChunkDescriptor aDescr (
-+ nOffset - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->getDescriptor())); // @@@
-
- sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- if ((aDescr.m_nOffset > 0) || (nBytes < nLength))
- {
- // Unaligned. Need to load/create data page.
- // @@@ loadOrCreate()
-- eErrCode = aPage.read (aDescr.m_nPage, aData, *m_xManager);
-+ eErrCode = m_xNode->read (aDescr.m_nPage, aData, *m_xManager);
- if (eErrCode != store_E_None)
- {
- if (eErrCode != store_E_NotExists)
-@@ -338,7 +334,7 @@ storeError OStoreLockBytes::writeAt (
- &pData[rnDone], nLength);
-
- // Save data page.
-- eErrCode = aPage.write (aDescr.m_nPage, aData, *m_xManager);
-+ eErrCode = m_xNode->write (aDescr.m_nPage, aData, *m_xManager);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -348,14 +344,14 @@ storeError OStoreLockBytes::writeAt (
- nBytes -= nLength;
-
- // Adjust data length.
-- if (aPage.dataLength() < nOffset)
-- aPage.dataLength (nOffset);
-+ if (m_xNode->dataLength() < nOffset)
-+ m_xNode->dataLength (nOffset);
- }
- }
-
- // Check for modified inode.
-- if (aPage.dirty())
-- return m_xManager->saveObjectAt (aPage, aPage.location());
-+ if (bDirty)
-+ return m_xManager->saveObjectAt (*m_xNode, m_xNode->location());
- else
- return store_E_None;
- }
-@@ -385,8 +381,7 @@ storeError OStoreLockBytes::setSize (sal_uInt32 nSize)
- osl::MutexGuard aGuard (*m_xManager);
-
- // Determine current length.
-- OStoreDirectoryPageObject aPage (m_xNode.get());
-- sal_uInt32 nDataLen = aPage.dataLength();
-+ sal_uInt32 nDataLen = m_xNode->dataLength();
-
- if (nSize == nDataLen)
- return store_E_None;
-@@ -405,37 +400,37 @@ storeError OStoreLockBytes::setSize (sal_uInt32 nSize)
- if (eDataScope == inode::SCOPE_EXTERNAL)
- {
- // External 'Data' scope. Truncate all external data pages.
-- eErrCode = aPage.truncate (0, *m_xManager);
-+ eErrCode = m_xNode->truncate (0, *m_xManager);
- if (eErrCode != store_E_None)
- return eErrCode;
- }
-
- // Truncate internal data page.
-- inode::ChunkDescriptor aDescr (nSize, m_xNode->capacity());
-+ ChunkDescriptor aDescr (nSize, m_xNode->capacity());
- memset (
-- &(m_xNode->m_pData[aDescr.m_nOffset]),
-+ &(m_xNode->getDataBuffer()[aDescr.m_nOffset]),
- 0, aDescr.m_nLength);
- }
- else
- {
- // External 'Size' scope. Truncate external data pages.
-- inode::ChunkDescriptor aDescr (
-- nSize - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->m_aDescr)); // @@@
-+ ChunkDescriptor aDescr (
-+ nSize - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->getDescriptor())); // @@@
-
- sal_uInt32 nPage = aDescr.m_nPage;
- if (aDescr.m_nOffset) nPage += 1;
-
-- eErrCode = aPage.truncate (nPage, *m_xManager);
-+ eErrCode = m_xNode->truncate (nPage, *m_xManager);
- if (eErrCode != store_E_None)
- return eErrCode;
- }
- }
-
- // Set (extended or truncated) size.
-- aPage.dataLength (nSize);
-+ m_xNode->dataLength (nSize);
-
- // Save modified inode.
-- return m_xManager->saveObjectAt (aPage, aPage.location());
-+ return m_xManager->saveObjectAt (*m_xNode, m_xNode->location());
- }
-
- /*
-@@ -448,7 +443,6 @@ storeError OStoreLockBytes::stat (sal_uInt32 &rnSize)
- if (!m_xManager.is())
- return store_E_InvalidAccess;
-
-- OStoreDirectoryPageObject aPage (m_xNode.get());
-- rnSize = aPage.dataLength();
-+ rnSize = m_xNode->dataLength();
- return store_E_None;
- }
-diff --git store/source/storlckb.hxx store/source/storlckb.hxx
-index 217e8d1..7a0a7b7 100644
---- store/source/storlckb.hxx
-+++ store/source/storlckb.hxx
-@@ -44,7 +44,7 @@ namespace store
- {
-
- struct OStoreDataPageData;
--struct OStoreDirectoryPageData;
-+struct OStoreDirectoryPageObject;
-
- /*========================================================================
- *
-@@ -137,11 +137,10 @@ private:
- */
- rtl::Reference<OStorePageManager> m_xManager;
-
-- typedef OStoreDataPageData data;
-- typedef OStoreDirectoryPageData inode;
-+ typedef OStoreDataPageData data;
-+ typedef OStoreDirectoryPageObject inode;
-
-- typedef PageHolderObject< inode > inode_holder_type;
-- inode_holder_type m_xNode;
-+ boost::scoped_ptr<inode> m_xNode;
-
- bool m_bWriteable;
-
-diff --git store/source/storpage.cxx store/source/storpage.cxx
-index a7c59be..87d9bae 100644
---- store/source/storpage.cxx
-+++ store/source/storpage.cxx
-@@ -86,7 +86,8 @@ sal_Bool SAL_CALL OStorePageManager::isKindOf (sal_uInt32 nTypeId)
- storeError OStorePageManager::initialize (
- ILockBytes * pLockBytes,
- storeAccessMode eAccessMode,
-- sal_uInt16 & rnPageSize)
-+ sal_uInt16 & rnPageSize,
-+ sal_uInt16 & rnFormatVersion)
- {
- // Acquire exclusive access.
- osl::MutexGuard aGuard(*this);
-@@ -96,7 +97,7 @@ storeError OStorePageManager::initialize (
- return store_E_InvalidParameter;
-
- // Initialize base.
-- storeError eErrCode = base::initialize (pLockBytes, eAccessMode, rnPageSize);
-+ storeError eErrCode = base::initialize (pLockBytes, eAccessMode, rnPageSize, rnFormatVersion);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -104,7 +105,9 @@ storeError OStorePageManager::initialize (
- if (!base::isWriteable())
- {
- // Readonly. Load RootNode.
-- return base::loadObjectAt (m_aRoot, rnPageSize);
-+ eErrCode = base::loadObjectAt (m_aRoot, rnPageSize);
-+ m_aRoot.fixup();
-+ return eErrCode;
- }
-
- // Writeable. Load or Create RootNode.
-@@ -207,6 +210,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
-
- // Load next node page.
- eErrCode = loadObjectAt (aNode, nAddr);
-+ aNode.fixup();
-
- PageHolderObject< page > xNext (aNode.get());
- xNext.swap (xPage);
-@@ -219,6 +223,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
- {
- // Load next node page.
- eErrCode = loadObjectAt (aNode, nAddr);
-+ aNode.fixup();
-
- page const & rPage = (*xPage);
-
-@@ -266,6 +271,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
-
- // Load link page.
- storeError eErrCode = loadObjectAt (aNode, nAddr);
-+ aNode.fixup();
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -299,6 +305,23 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
- return aNode.remove (i, rEntry, *this);
- }
-
-+void OStorePageManager::createDirectoryPageObject(boost::scoped_ptr<inode_type>& rPage)
-+{
-+ switch(version ())
-+ {
-+ case STORE_FORMAT_V1:
-+ rPage.reset(new OStoreDirectoryPageObjectV1());
-+ rPage->construct<OStoreDirectoryPageDataV1>(base::allocator());
-+ break;
-+ case STORE_FORMAT_V2:
-+ rPage.reset(new OStoreDirectoryPageObjectV2());
-+ rPage->construct<OStoreDirectoryPageDataV2>(base::allocator());
-+ break;
-+ default:
-+ break;
-+ }
-+}
-+
- /*
- * namei.
- * Precond: none (static).
-@@ -370,19 +393,10 @@ storeError OStorePageManager::iget (
- return store_E_AccessViolation;
-
- // Create inode page.
-- eErrCode = rPage.construct< inode >(base::allocator());
-- if (eErrCode != store_E_None)
-- return eErrCode;
--
-- // Setup inode nameblock.
-- PageHolderObject< inode > xPage (rPage.get());
--
- rPage.key (aKey);
- rPage.attrib (nAttrib);
-
-- memcpy (
-- &(xPage->m_aNameBlock.m_pData[0]),
-- pName->buffer, pName->length);
-+ rPage.setName(pName->buffer, pName->length);
-
- // Save inode page.
- eErrCode = save_dirpage_Impl (aKey, rPage);
-@@ -394,9 +408,8 @@ storeError OStorePageManager::iget (
- if (rPage.attrib() & STORE_ATTRIB_ISLINK)
- {
- // Obtain 'Destination' page key.
-- PageHolderObject< inode > xPage (rPage.get());
- OStorePageKey aDstKey;
-- memcpy (&aDstKey, &(xPage->m_pData[0]), sizeof(aDstKey));
-+ memcpy (&aDstKey, rPage.getDataBuffer(), sizeof(aDstKey));
-
- // Load 'Destination' inode.
- eErrCode = load_dirpage_Impl (aDstKey, rPage);
-@@ -658,34 +671,29 @@ storeError OStorePageManager::symlink (
- return eErrCode;
-
- // Initialize directory page.
-- OStoreDirectoryPageObject aPage;
-- eErrCode = aPage.construct< inode >(base::allocator());
-- if (eErrCode != store_E_None)
-- return eErrCode;
-+ boost::scoped_ptr<inode_type> pPage;
-+ createDirectoryPageObject(pPage);
-
- // Setup as 'Source' directory page.
-- inode_holder_type xNode (aPage.get());
-- aPage.key (aSrcKey);
-- memcpy (
-- &(xNode->m_aNameBlock.m_pData[0]),
-- pSrcName->buffer, pSrcName->length);
-+ pPage->key (aSrcKey);
-+ pPage->setName(pSrcName->buffer, pSrcName->length);
-
- // Store 'Destination' page key.
- OStorePageKey aDstKey (rDstKey);
-- memcpy (&(xNode->m_pData[0]), &aDstKey, sizeof(aDstKey));
-+ memcpy (pPage->getDataBuffer(), &aDstKey, sizeof(aDstKey));
-
- // Mark 'Source' as symbolic link to 'Destination'.
-- aPage.attrib (STORE_ATTRIB_ISLINK);
-- aPage.dataLength (sal_uInt32(sizeof(aDstKey)));
-+ pPage->attrib (STORE_ATTRIB_ISLINK);
-+ pPage->dataLength (sal_uInt32(sizeof(aDstKey)));
-
- // Allocate and save 'Source' directory page.
-- eErrCode = base::allocate (aPage);
-+ eErrCode = base::allocate (*pPage);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Insert 'Source' entry.
- PageHolderObject< page > xSrcNode (aSrcNode.get());
-- OStorePageLink aSrcLink (aPage.location());
-+ OStorePageLink aSrcLink (pPage->location());
- xSrcNode->insert (i + 1, entry(aSrcKey, aSrcLink));
-
- // Save modified NodePage.
-@@ -734,16 +742,17 @@ storeError OStorePageManager::rename (
- entry e (xSrcNode->m_pData[i]);
-
- // Check for (not a) hardlink.
-- OStoreDirectoryPageObject aPage;
-+ boost::scoped_ptr<inode_type> pPage;
-+ createDirectoryPageObject(pPage);
- if (!(store::ntohl(e.m_nAttrib) & STORE_ATTRIB_ISLINK))
- {
- // Load directory page.
-- eErrCode = base::loadObjectAt (aPage, e.m_aLink.location());
-+ eErrCode = base::loadObjectAt (*pPage, e.m_aLink.location());
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Check for directory.
-- if (aPage.attrib() & STORE_ATTRIB_ISDIR)
-+ if (pPage->attrib() & STORE_ATTRIB_ISDIR)
- {
- // Ugly, but necessary (backward compatibility).
- aDstKey.m_nLow = store::htonl(rtl_crc32 (store::ntohl(aDstKey.m_nLow), "/", 1));
-@@ -771,20 +780,12 @@ storeError OStorePageManager::rename (
- if (!(store::ntohl(e.m_nAttrib) & STORE_ATTRIB_ISLINK))
- {
- // Modify 'Source' directory page.
-- inode_holder_type xNode (aPage.get());
--
- // Setup 'Destination' NameBlock.
-- sal_Int32 nDstLen = pDstName->length;
-- memcpy (
-- &(xNode->m_aNameBlock.m_pData[0]),
-- pDstName->buffer, pDstName->length);
-- memset (
-- &(xNode->m_aNameBlock.m_pData[nDstLen]),
-- 0, STORE_MAXIMUM_NAMESIZE - nDstLen);
-- aPage.key (e.m_aKey);
-+ pPage->setName(pDstName->buffer, pDstName->length);
-+ pPage->key (e.m_aKey);
-
- // Save directory page.
-- eErrCode = base::saveObjectAt (aPage, e.m_aLink.location());
-+ eErrCode = base::saveObjectAt (*pPage, e.m_aLink.location());
- if (eErrCode != store_E_None)
- return eErrCode;
- }
-@@ -825,35 +826,34 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
- if (!(store::ntohl(e.m_nAttrib) & STORE_ATTRIB_ISLINK))
- {
- // Load directory page.
-- OStoreDirectoryPageObject aPage;
-- eErrCode = base::loadObjectAt (aPage, e.m_aLink.location());
-+ boost::scoped_ptr<inode_type> pPage;
-+ createDirectoryPageObject(pPage);
-+ eErrCode = base::loadObjectAt (*pPage, e.m_aLink.location());
- if (eErrCode != store_E_None)
- return eErrCode;
-
-- inode_holder_type xNode (aPage.get());
--
- // Acquire page write access.
-- OStorePageDescriptor aDescr (xNode->m_aDescr);
-+ OStorePageDescriptor aDescr (pPage->getDescriptor());
- eErrCode = base::acquirePage (aDescr, store_AccessReadWrite);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Check for symbolic link.
-- if (!(aPage.attrib() & STORE_ATTRIB_ISLINK))
-+ if (!(pPage->attrib() & STORE_ATTRIB_ISLINK))
- {
- // Ordinary inode. Determine 'Data' scope.
-- inode::ChunkScope eScope = xNode->scope (aPage.dataLength());
-- if (eScope == inode::SCOPE_EXTERNAL)
-+ inode_type::ChunkScope eScope = pPage->scope (pPage->dataLength());
-+ if (eScope == inode_type::SCOPE_EXTERNAL)
- {
- // External 'Data' scope. Truncate all external data pages.
-- eErrCode = aPage.truncate (0, *this);
-+ eErrCode = pPage->truncate (0, *this);
- if (eErrCode != store_E_None)
- return eErrCode;
- }
-
- // Truncate internal data page.
-- memset (&(xNode->m_pData[0]), 0, xNode->capacity());
-- aPage.dataLength (0);
-+ memset (pPage->getDataBuffer(), 0, pPage->capacity());
-+ pPage->dataLength (0);
- }
-
- // Release page write access.
-@@ -861,7 +861,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
-
- // Release and free directory page.
- OStorePageData aPageHead;
-- eErrCode = base::free (aPageHead, aPage.location());
-+ eErrCode = base::free (aPageHead, pPage->location());
- }
-
- // Remove entry.
-@@ -878,12 +878,14 @@ struct RebuildContext
- rtl::Reference<OStorePageBIOS> m_xBIOS;
- OStorePageBIOS::ScanContext m_aCtx;
- sal_uInt16 m_nPageSize;
-+ sal_uInt16 m_nFormatVersion;
-
- /** Construction.
- */
- RebuildContext (void)
-- : m_xBIOS (new OStorePageBIOS()),
-- m_nPageSize (0)
-+ : m_xBIOS (new OStorePageBIOS()),
-+ m_nPageSize (0),
-+ m_nFormatVersion(STORE_FORMAT_V1)
- {}
-
- /** initialize (PageBIOS and ScanContext).
-@@ -893,7 +895,7 @@ struct RebuildContext
- storeError eErrCode = store_E_InvalidParameter;
- if (pLockBytes)
- {
-- m_xBIOS->initialize (pLockBytes, store_AccessReadOnly, m_nPageSize);
-+ m_xBIOS->initialize (pLockBytes, store_AccessReadOnly, m_nPageSize, m_nFormatVersion);
- eErrCode = m_xBIOS->scanBegin (m_aCtx, nMagic);
- }
- return eErrCode;
-@@ -940,52 +942,57 @@ storeError OStorePageManager::rebuild (
- rtl::Reference<OStorePageBIOS> xSrcBIOS (aCtx.m_xBIOS);
-
- // Initialize as 'Destination' with 'Source' page size.
-- eErrCode = self::initialize (pDstLB, store_AccessCreate, aCtx.m_nPageSize);
-+ // Force V1 format, we migrate away from the V2 version
-+ sal_uInt16 nFormat=STORE_FORMAT_V1;
-+ eErrCode = self::initialize (pDstLB, store_AccessCreate, aCtx.m_nPageSize, nFormat);
- if (eErrCode != store_E_None)
- return eErrCode;
-
-+ rtl_String* pStr=0;
-+ rtl_string_new_WithLength(&pStr, STORE_MAXIMUM_NAMESIZE);
-+
- // Pass One: Scan 'Source' directory pages.
- {
- // Scan 'Source' directory pages.
-- OStoreDirectoryPageObject aSrcPage;
-- while ((eErrCode = aCtx.load(aSrcPage)) == store_E_None)
-+ boost::scoped_ptr<inode_type> pSrcPage;
-+ createDirectoryPageObject(pSrcPage);
-+ while ((eErrCode = aCtx.load(*pSrcPage)) == store_E_None)
- {
-- OStoreDirectoryPageObject aDstPage;
-- eErrCode = aDstPage.construct< inode >(base::allocator());
-- if (eErrCode != store_E_None)
-- break;
--
-- inode_holder_type xSrcDir (aSrcPage.get());
-- inode_holder_type xDstDir (aDstPage.get());
-+ boost::scoped_ptr<inode_type> pDstPage;
-+ createDirectoryPageObject(pDstPage);
-
- // Copy NameBlock @@@ OLD @@@
-- memcpy (&(xDstDir->m_aNameBlock), &(xSrcDir->m_aNameBlock), sizeof(xSrcDir->m_aNameBlock));
-+ pSrcPage->getName(pStr->buffer, pStr->length, *xSrcBIOS);
-+ pDstPage->setName(pStr->buffer, pStr->length);
-
- // Obtain 'Source' data length.
-- sal_uInt32 nDataLen = aSrcPage.dataLength();
-+ sal_uInt32 nDataLen = pSrcPage->dataLength();
- if (nDataLen > 0)
- {
- // Copy internal data area @@@ OLD @@@
-- memcpy (&(xDstDir->m_pData[0]), &(xSrcDir->m_pData[0]), xSrcDir->capacity());
-+ memcpy (pDstPage->getDataBuffer(), pSrcPage->getDataBuffer(), pSrcPage->capacity());
- }
-
- // Insert 'Destination' directory page.
-- eErrCode = save_dirpage_Impl (aDstPage.key(), aDstPage);
-+ eErrCode = save_dirpage_Impl (pDstPage->key(), *pDstPage);
- if (eErrCode != store_E_None)
- break;
-
- // Check for external data page scope.
-- if (xSrcDir->scope(nDataLen) != inode::SCOPE_INTERNAL)
-+ if (pSrcPage->scope(nDataLen) != inode_type::SCOPE_INTERNAL)
- {
- // Initialize 'Destination' data page.
- typedef OStoreDataPageData data;
- PageHolderObject< data > xData;
- if (!xData.construct(base::allocator()))
-+ {
-+ rtl_string_release(pStr);
- return store_E_OutOfMemory;
-+ }
-
- // Determine data page count.
-- inode::ChunkDescriptor aDescr (
-- nDataLen - xDstDir->capacity(), xData->capacity());
-+ ChunkDescriptor aDescr (
-+ nDataLen - pDstPage->capacity(), xData->capacity());
-
- sal_uInt32 i, n = aDescr.m_nPage;
- if (aDescr.m_nOffset) n += 1;
-@@ -997,23 +1004,24 @@ storeError OStorePageManager::rebuild (
- // Read 'Source' data page.
- osl::MutexGuard aSrcGuard (*xSrcBIOS);
-
-- eErrCode = aSrcPage.read (i, aData, *xSrcBIOS);
-+ eErrCode = pSrcPage->read (i, aData, *xSrcBIOS);
- if (eErrCode != store_E_None)
- continue;
-
- // Write 'Destination' data page. @@@ READONLY @@@
-- eErrCode = aDstPage.write (i, aData, *this);
-+ eErrCode = pDstPage->write (i, aData, *this);
- }
- }
-
- // Update 'Destination' directory page.
-- aDstPage.dataLength (nDataLen);
-- eErrCode = base::saveObjectAt (aDstPage, aDstPage.location());
-+ pDstPage->dataLength (nDataLen);
-+ eErrCode = base::saveObjectAt (*pDstPage, pDstPage->location());
- }
-
- // Save directory scan results.
- flush();
- }
-+ rtl_string_release(pStr);
-
- // Pass Two: Scan 'Source' BTree nodes.
- {
-@@ -1037,11 +1045,12 @@ storeError OStorePageManager::rebuild (
- if (e.m_nAttrib & STORE_ATTRIB_ISLINK)
- {
- // Load the hard link destination.
-- OStoreDirectoryPageObject aSrcPage;
-- eErrCode = xSrcBIOS->loadObjectAt (aSrcPage, e.m_aLink.location());
-+ boost::scoped_ptr<inode_type> pSrcPage;
-+ createDirectoryPageObject(pSrcPage);
-+ eErrCode = xSrcBIOS->loadObjectAt (*pSrcPage, e.m_aLink.location());
- if (eErrCode == store_E_None)
- {
-- OStorePageKey aDstKey (aSrcPage.key());
-+ OStorePageKey aDstKey (pSrcPage->key());
- eErrCode = link (e.m_aKey, aDstKey);
- }
- e.m_nAttrib &= ~STORE_ATTRIB_ISLINK;
-diff --git store/source/storpage.hxx store/source/storpage.hxx
-index 4ebf05b..f5adae2 100644
---- store/source/storpage.hxx
-+++ store/source/storpage.hxx
-@@ -40,11 +40,12 @@
- #include "storbios.hxx"
- #include "stortree.hxx"
-
-+#include <boost/scoped_ptr.hpp>
-+
- namespace store
- {
-
--struct OStoreDirectoryPageData;
--class OStoreDirectoryPageObject;
-+class OStoreDirectoryPageObject;
-
- /*========================================================================
- *
-@@ -54,6 +55,8 @@ class OStoreDirectoryPageObject;
- class OStorePageManager : public store::OStorePageBIOS
- {
- public:
-+ typedef OStoreDirectoryPageObject inode_type;
-+
- /** Construction.
- */
- OStorePageManager (void);
-@@ -63,7 +66,8 @@ public:
- virtual storeError initialize (
- ILockBytes * pLockBytes,
- storeAccessMode eAccessMode,
-- sal_uInt16 & rnPageSize);
-+ sal_uInt16 & rnPageSize,
-+ sal_uInt16 & rnFormatVersion);
-
- /** isValid.
- * @return sal_True upon successful initialization,
-@@ -71,6 +75,11 @@ public:
- */
- inline sal_Bool isValid (void) const;
-
-+ /** createDirectoryPageObject.
-+ * creates impl object of dir page, differs for v1 and v2
-+ */
-+ void createDirectoryPageObject(boost::scoped_ptr<inode_type>& rPage);
-+
- /** DirectoryPage I/O (managed).
- */
- static storeError namei (
-@@ -79,11 +88,11 @@ public:
- OStorePageKey &rKey);
-
- storeError iget (
-- OStoreDirectoryPageObject & rPage, // [out]
-- sal_uInt32 nAttrib,
-- const rtl_String * pPath,
-- const rtl_String * pName,
-- storeAccessMode eMode);
-+ inode_type & rPage, // [in/out]
-+ sal_uInt32 nAttrib,
-+ const rtl_String * pPath,
-+ const rtl_String * pName,
-+ storeAccessMode eMode);
-
- storeError iterate (
- OStorePageKey & rKey,
-@@ -158,9 +167,6 @@ private:
- typedef OStoreBTreeNodeData page;
- typedef OStoreBTreeNodeObject node;
-
-- typedef OStoreDirectoryPageData inode;
-- typedef PageHolderObject< inode > inode_holder_type;
--
- /** IStoreHandle TypeId.
- */
- static const sal_uInt32 m_nTypeId;
-diff --git store/source/stortree.cxx store/source/stortree.cxx
-index 71cdb47..413bc1a 100644
---- store/source/stortree.cxx
-+++ store/source/stortree.cxx
-@@ -182,9 +182,9 @@ storeError OStoreBTreeNodeObject::guard (sal_uInt32 nAddr)
- /*
- * verify.
- */
--storeError OStoreBTreeNodeObject::verify (sal_uInt32 nAddr) const
-+storeError OStoreBTreeNodeObject::verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const
- {
-- return PageHolderObject< page >::verify (m_xPage, nAddr);
-+ return PageHolderObject< page >::verify (m_xPage, nAddr, nVersion);
- }
-
- /*
-@@ -311,6 +311,7 @@ storeError OStoreBTreeNodeObject::remove (
- // Load link node.
- self aNodeL;
- eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location());
-+ aNodeL.fixup();
- if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
-@@ -352,6 +353,7 @@ storeError OStoreBTreeNodeObject::remove (
- // Load right link node.
- self aNodeR;
- eErrCode = rBIOS.loadObjectAt (aNodeR, rPage.m_pData[nIndexR].m_aLink.location());
-+ aNodeR.fixup();
- if (eErrCode == store_E_None)
- {
- if (rPageL.queryMerge (rPageR))
-@@ -406,6 +408,11 @@ storeError OStoreBTreeNodeObject::remove (
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- }
-
-+void OStoreBTreeNodeObject::fixup (void)
-+{
-+ m_xPage->m_aGuard.m_nMagic = STORE_MAGIC_BTREENODE;
-+}
-+
- /*========================================================================
- *
- * OStoreBTreeRootObject implementation.
-@@ -431,6 +438,7 @@ storeError OStoreBTreeRootObject::loadOrCreate (
- OStorePageBIOS & rBIOS)
- {
- storeError eErrCode = rBIOS.loadObjectAt (*this, nAddr);
-+ fixup();
- if (eErrCode != store_E_NotExists)
- return eErrCode;
-
-@@ -562,6 +570,7 @@ storeError OStoreBTreeRootObject::find_lookup (
-
- // Load next page.
- storeError eErrCode = rBIOS.loadObjectAt (rNode, nAddr);
-+ rNode.fixup();
- if (eErrCode != store_E_None)
- return eErrCode;
- }
-@@ -646,6 +655,7 @@ storeError OStoreBTreeRootObject::find_insert (
- // Load next page.
- OStoreBTreeNodeObject aNext;
- storeError eErrCode = rBIOS.loadObjectAt (aNext, nAddr);
-+ aNext.fixup();
- if (eErrCode != store_E_None)
- return eErrCode;
-
-@@ -686,3 +696,5 @@ storeError OStoreBTreeRootObject::find_insert (
- (void) testInvariant("OStoreBTreeRootObject::find_insert(): leave");
- return store_E_None;
- }
-+
-+
-diff --git store/source/stortree.hxx store/source/stortree.hxx
-index 34c49aa..4e6304c 100644
---- store/source/stortree.hxx
-+++ store/source/stortree.hxx
-@@ -131,7 +131,7 @@ struct OStoreBTreeNodeData : public store::OStorePageData
- */
- static const size_t theSize = sizeof(G);
- static const sal_uInt16 thePageSize = base::theSize + self::theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= self::thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= self::thePageSize);
-
- /** capacity.
- */
-@@ -262,7 +262,7 @@ public:
- /** External representation.
- */
- virtual storeError guard (sal_uInt32 nAddr);
-- virtual storeError verify (sal_uInt32 nAddr) const;
-+ virtual storeError verify (sal_uInt32 nAddr, sal_uInt16 nVersion) const;
-
- /** split.
- *
-@@ -279,6 +279,8 @@ public:
- sal_uInt16 nIndexL,
- OStoreBTreeEntry & rEntryL,
- OStorePageBIOS & rBIOS);
-+
-+ void fixup (void);
- };
-
- /*========================================================================
-diff --git store/workben/t_base.cxx store/workben/t_base.cxx
-index 548ee86..1282da7 100644
---- store/workben/t_base.cxx
-+++ store/workben/t_base.cxx
-@@ -132,7 +132,8 @@ sal_Bool SAL_CALL OTestBIOS::isKindOf (sal_uInt32 nTypeId)
- storeError OTestBIOS::initialize (
- ILockBytes *pLockBytes, storeAccessMode eAccessMode, sal_uInt16 & rnPageSize)
- {
-- return base::initialize (pLockBytes, eAccessMode, rnPageSize);
-+ sal_uInt16 nVersion=STORE_FORMAT_V1;
-+ return base::initialize (pLockBytes, eAccessMode, rnPageSize, nVersion);
- }
-
- namespace store
-diff --git store/workben/t_page.cxx store/workben/t_page.cxx
-index a0645f0..2dcdeec 100644
---- store/workben/t_page.cxx
-+++ store/workben/t_page.cxx
-@@ -155,7 +155,7 @@ struct PageData
- */
- static const size_t theSize = sizeof(G) + sizeof(D) + 2 * sizeof(L);
- static const sal_uInt16 thePageSize = theSize;
-- STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize);
-+ STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE_V1 >= thePageSize);
-
- /** type.
- */
diff --git a/patches/test/suse-vtrelocs-binutils.diff b/patches/test/suse-vtrelocs-binutils.diff
deleted file mode 100644
index 71c551478..000000000
--- a/patches/test/suse-vtrelocs-binutils.diff
+++ /dev/null
@@ -1,82 +0,0 @@
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elf.c binutils-2.17.50/bfd/elf.c
---- pristine-binutils-2.17.50/bfd/elf.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elf.c 2008-01-23 16:48:45.000000000 +0000
-@@ -1240,6 +1240,7 @@
- case DT_USED: name = "USED"; break;
- case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
- case DT_GNU_HASH: name = "GNU_HASH"; break;
-+ case DT_SUSE_VTRELOC: name = "SUSE_VTRELOC"; break;
- }
-
- fprintf (f, " %-11s ", name);
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/bfd/elflink.c binutils-2.17.50/bfd/elflink.c
---- pristine-binutils-2.17.50/bfd/elflink.c 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/bfd/elflink.c 2008-01-23 16:50:07.000000000 +0000
-@@ -5652,6 +5652,13 @@
- return FALSE;
- }
-
-+ s = bfd_get_section_by_name (output_bfd, ".suse.vtrelocs");
-+ if (s != NULL)
-+ {
-+ if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_VTRELOC, 0))
-+ return FALSE;
-+ }
-+
- dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
- /* If .dynstr is excluded from the link, we don't want any of
- these tags. Strictly, we should be checking each section
-@@ -10869,6 +10876,9 @@
- case DT_VERNEED:
- name = ".gnu.version_r";
- goto get_vma;
-+ case DT_SUSE_VTRELOC:
-+ name = ".suse.vtrelocs";
-+ goto get_vma;
- case DT_VERSYM:
- name = ".gnu.version";
- get_vma:
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/include/elf/common.h binutils-2.17.50/include/elf/common.h
---- pristine-binutils-2.17.50/include/elf/common.h 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/include/elf/common.h 2008-01-23 16:40:38.000000000 +0000
-@@ -624,6 +624,13 @@
- #define DT_USED 0x7ffffffe
- #define DT_FILTER 0x7fffffff
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-
- /* Values used in DT_FEATURE .dynamic entry. */
- #define DTF_1_PARINIT 0x00000001
-
-diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-binutils-2.17.50/ld/scripttempl/elf.sc binutils-2.17.50/ld/scripttempl/elf.sc
---- pristine-binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-09 16:45:22.000000000 +0000
-+++ binutils-2.17.50/ld/scripttempl/elf.sc 2008-01-23 16:48:46.000000000 +0000
-@@ -285,6 +285,7 @@
- eval $COMBRELOCCAT <<EOF
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
-+ .rel.suse.vtrelocs ${RELOCATING-0} : { *(.rel.suse.vtrelocs) }
- .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
- .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
-@@ -410,6 +411,13 @@
- ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
- .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
-
-+ /* Virtual table copy relocation tables */
-+ .suse.vtrelocs :
-+ {
-+ KEEP (*(SORT(.vtrelocs.*)))
-+ QUAD(0)
-+ }
-+
- ${RELOCATING+${DATARELRO}}
- ${OTHER_RELRO_SECTIONS}
- ${TEXT_DYNAMIC-${DYNAMIC}}
diff --git a/patches/test/suse-vtrelocs-gcc.diff b/patches/test/suse-vtrelocs-gcc.diff
deleted file mode 100644
index 039f1f9b6..000000000
--- a/patches/test/suse-vtrelocs-gcc.diff
+++ /dev/null
@@ -1,874 +0,0 @@
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/collect2.c gcc-4.2.1-simple/gcc/collect2.c
---- pristine-gcc-4.2.1-simple/gcc/collect2.c 2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c 2008-01-21 19:50:44.000000000 +0000
-@@ -175,7 +175,7 @@
- static int aixrtl_flag; /* true if -brtl */
- #endif
-
--int debug; /* true if -debug */
-+int debug = 1; /* true if -debug */
-
- static int shared_obj; /* true if -shared */
-
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/class.c gcc-4.2.1-simple/gcc/cp/class.c
---- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-31 12:09:33.000000000 +0000
-@@ -181,8 +181,7 @@
- static tree end_of_class (tree, int);
- static bool layout_empty_base (tree, tree, splay_tree);
- static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
--static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
-- tree);
-+static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree);
- static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
- static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
- static void clone_constructors_and_destructors (tree);
-@@ -6355,6 +6354,58 @@
- return decl;
- }
-
-+/* Returns the VAR_DECL for the vtable copy relocation entries associated
-+ with BINFO. */
-+
-+static tree
-+get_vtreloc_decl (tree binfo, tree t, tree inits)
-+{
-+ tree name, d;
-+
-+ name = mangle_vtreloc_for_type (binfo, t);
-+ d = IDENTIFIER_GLOBAL_VALUE (name);
-+
-+ if (!d)
-+ {
-+ int nslots = list_length (inits);
-+ tree atype = build_cplus_array_type (vtbl_slot_copy_type_node,
-+ build_index_type (size_int (nslots - 1)));
-+ layout_type (atype);
-+ TYPE_ALIGN (atype) = BITS_PER_UNIT * 4;
-+
-+ d = build_lang_decl (VAR_DECL, name, atype);
-+ DECL_ALIGN(d) = 1;
-+ DECL_USER_ALIGN(d) = 1;
-+ DECL_SECTION_NAME(d) = mangle_vtreloc_section_for_type (binfo, t);
-+ SET_DECL_ASSEMBLER_NAME (d, name);
-+ /* Remember the type it is for. */
-+ TREE_TYPE (name) = t;
-+ DECL_ARTIFICIAL (d) = 1;
-+ DECL_IGNORED_P (d) = 1;
-+ TREE_READONLY (d) = 1;
-+ TREE_STATIC (d) = 1;
-+ TREE_PUBLIC (d) = 0;
-+ DECL_COMDAT (d) = 1;
-+ /* Mark the variable as undefined -- but remember that we can
-+ define it later if we need to do so. */
-+ DECL_EXTERNAL (d) = 0;
-+ DECL_NOT_REALLY_EXTERN (d) = 1;
-+ set_linkage_according_to_type (t, d);
-+ pushdecl_top_level_and_finish (d, NULL_TREE);
-+
-+ /* TESTME: imported from decl2.c ... */
-+ {
-+ tree ctor;
-+ import_export_decl (d);
-+ comdat_linkage (d);
-+ DECL_COMDAT (d) = 1;
-+ ctor = build_constructor_from_list (TREE_TYPE (d), inits);
-+ initialize_artificial_var (d, ctor);
-+ }
-+ }
-+
-+ return d;
-+}
-
- /* Returns the binfo for the primary base of BINFO. If the resulting
- BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6438,7 +6489,7 @@
- if (indented)
- fprintf (stream, "\n");
-
-- if (!(flags & TDF_SLIM))
-+ if (1) /* !(flags & TDF_SLIM)) */
- {
- int indented = 0;
-
-@@ -6637,12 +6688,74 @@
- dump_thunk (stderr, 0, fn);
- }
-
-+static tree
-+build_addr_offset (tree decl, int offset)
-+{
-+ tree index, addr;
-+
-+ index = build_int_cst (NULL_TREE, offset);
-+ addr = build1 (ADDR_EXPR, ptr_type_node, build_array_ref (decl, index));
-+
-+ return addr;
-+}
-+
-+static tree
-+get_vtbl_decl_for (tree binfo, tree t)
-+{
-+ tree decl, name;
-+ if (t && BINFO_TYPE (binfo) != t) /* test: construction vtable */
-+ {
-+ name = mangle_ctor_vtbl_for_type (t, binfo);
-+ decl = IDENTIFIER_GLOBAL_VALUE (name);
-+ }
-+ else
-+ decl = get_vtbl_decl_for_binfo (binfo);
-+
-+ return decl;
-+}
-+
-+/* Ideal .rodata output format: */
-+/* dest_symbol, |dest_offset|src_bitmap_blocks, src_symbol, <bitmap> */
-+/* Pragmatic 1st cut output format: */
-+/* dest_addr, src_addr, <bitmap> */
-+static tree
-+build_vtable_copy_slot (tree dest_binfo, tree t, int dest_offset,
-+ tree src_binfo, int src_offset,
-+ int bitmap, tree chain)
-+{
-+ tree src_decl, dest_decl;
-+ tree elem = NULL_TREE, init;
-+
-+ /* Either a padding entry or nothing to do */
-+ if (!dest_binfo || !bitmap)
-+ return chain;
-+
-+ /* fprintf (stderr, "Copy %s + %d => ",
-+ type_as_string (src_binfo, TFF_PLAIN_IDENTIFIER),
-+ src_offset);
-+ fprintf (stderr, " %s + %d mask 0x%x\n",
-+ type_as_string (dest_binfo, TFF_PLAIN_IDENTIFIER),
-+ dest_offset, bitmap); */
-+
-+ elem = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, bitmap), elem);
-+
-+ dest_decl = get_vtbl_decl_for (dest_binfo, t);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (dest_decl, dest_offset), elem);
-+
-+ src_decl = get_vtable_decl (BINFO_TYPE (src_binfo), 1);
-+ elem = tree_cons (NULL_TREE, build_addr_offset (src_decl, src_offset), elem);
-+
-+ init = build_constructor_from_list (vtbl_slot_copy_type_node, elem);
-+
-+ return tree_cons (NULL_TREE, init, chain);
-+}
-+
- /* Virtual function table initialization. */
-
- /* Create all the necessary vtables for T and its base classes. */
-
--static void
--finish_vtbls (tree t)
-+static tree
-+vtbl_get_inits (tree t)
- {
- tree list;
- tree vbase;
-@@ -6662,8 +6775,442 @@
- accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
- }
-
-+ return TREE_VALUE (list);
-+}
-+
-+/* List of un-altered vtable inits */
-+/*
-+ * list of: purpose - type
-+ * value - [constructor]
-+ */
-+tree vtable_copy_types;
-+
-+/* FIXME: rather a lame search */
-+static VEC(constructor_elt,gc) *
-+get_vtinit_for_binfo (tree binfo, tree t, int list_only)
-+{
-+ tree k;
-+ for (k = vtable_copy_types; k; k = TREE_CHAIN(k))
-+ {
-+ if (TREE_PURPOSE(k) == binfo)
-+ return CONSTRUCTOR_ELTS (TREE_VALUE(k));
-+ }
-+ if (list_only)
-+ return NULL;
-+
-+ /* Index ... in the constructor ! ;-) */
-+
-+ k = get_vtbl_decl_for (binfo, t);
-+ if (k)
-+ return CONSTRUCTOR_ELTS (DECL_INITIAL (k));
-+ else
-+ return NULL;
-+}
-+
-+static void
-+set_vtinit_for_binfo (tree binfo, tree t, VEC(constructor_elt,gc) *vtinits)
-+{
-+ tree constr = build_constructor (/* binfo */NULL_TREE, vtinits);
-+ vtable_copy_types = tree_cons (binfo, constr, vtable_copy_types);
-+}
-+
-+static void
-+debug_vtable (tree binfo, tree t)
-+{
-+ tree value;
-+ unsigned HOST_WIDE_INT ix;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ if (t != NULL && BINFO_TYPE(t) != binfo)
-+ {
-+ fprintf (stderr, "Constr VTable for %s-in-",
-+ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
-+ fprintf (stderr, "%s\n",
-+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ }
-+ else
-+ {
-+ fprintf (stderr, "VTable for %s\n",
-+ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
-+ }
-+
-+ vtable = get_vtinit_for_binfo (binfo, t, 0);
-+ if (!vtable)
-+ {
-+ fprintf (stderr, "<none>\n");
-+ return;
-+ }
-+
-+ FOR_EACH_CONSTRUCTOR_VALUE (vtable, ix, value)
-+ {
-+ fprintf (stderr, "\t%-4ld %s\n", (long)ix,
-+ expr_as_string (value, TFF_PLAIN_IDENTIFIER));
-+ }
-+}
-+
-+/* to track a segment of vtable initializer */
-+typedef struct vt_fragment_d GTY(()) {
-+ tree binfo;
-+
-+ /* ptr into the vec decl */
-+ unsigned int offset;
-+ unsigned int size;
-+ VEC(constructor_elt,gc) *vec;
-+} vt_fragment;
-+
-+typedef struct vt_copy_record_d GTY(()) {
-+ vt_fragment *src;
-+ vt_fragment *dest;
-+ unsigned int bitmap;
-+ unsigned int offset;
-+} vt_copy_record;
-+
-+DEF_VEC_O(vt_fragment);
-+DEF_VEC_O(vt_copy_record);
-+DEF_VEC_ALLOC_O(vt_fragment, heap);
-+DEF_VEC_ALLOC_O(vt_copy_record, heap);
-+
-+static void
-+vtdecompose_frags (tree binfo, tree t, VEC(vt_fragment,heap) **frags)
-+{
-+ unsigned int seek_fn = 1, i;
-+ vt_fragment *frag = NULL;
-+ VEC(constructor_elt,gc) *vtable;
-+
-+ vtable = get_vtinit_for_binfo (binfo, t, 0);
-+ if (!vtable)
-+ return;
-+
-+ for (i = 0; i < VEC_length(constructor_elt,vtable); i++)
-+ {
-+ tree fn = VEC_index (constructor_elt, vtable, i)->value;
-+ int is_fn = TREE_CODE (fn) == ADDR_EXPR
-+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL;
-+
-+ if (is_fn && seek_fn)
-+ {
-+ frag = VEC_safe_push (vt_fragment, heap, *frags, NULL);
-+ frag->binfo = binfo;
-+ frag->offset = i;
-+ frag->size = VEC_length (constructor_elt, vtable) - i;
-+ frag->vec = vtable;
-+ seek_fn = 0;
-+ }
-+ if (!is_fn && !seek_fn)
-+ {
-+ frag->size = i - frag->offset;
-+ seek_fn = 1;
-+ }
-+ }
-+}
-+
-+static void
-+debug_fragments (VEC(vt_fragment,heap) *frags)
-+{
-+ unsigned int i;
-+ for (i = 0; i < VEC_length(vt_fragment,frags); i++)
-+ {
-+ vt_fragment *frag = VEC_index (vt_fragment, frags, i);
-+ fprintf (stderr, "fragment %d: '%s' offset %d, size %d\n",
-+ i, type_as_string (BINFO_TYPE (frag->binfo), TFF_PLAIN_IDENTIFIER),
-+ frag->offset, frag->size);
-+ }
-+}
-+
-+static void
-+push_vtfrag (VEC(vt_copy_record,heap) **vt_copies,
-+ vt_fragment *src, vt_fragment *dest,
-+ unsigned int bitmap, unsigned int offset)
-+{
-+ vt_copy_record *rec;
-+
-+ /* FIXME: we need to be able to compare these */
-+ /* that is not easy, sadly - so punt for now (?), and hope we don't get too
-+ * many duplicate / overlapping hits */
-+ rec = VEC_safe_push (vt_copy_record, heap, *vt_copies, NULL);
-+ rec->src = src;
-+ rec->dest = dest;
-+ rec->bitmap = bitmap;
-+ rec->offset = offset;
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "Push frag 0x%x %d\n", bitmap, offset);
-+}
-+
-+static void
-+debug_vt_copies (VEC(vt_copy_record,heap) *vt_copies)
-+{
-+ unsigned int i;
-+
-+ if (!getenv ("MOREDEBUG"))
-+ return;
-+
-+ fprintf (stderr, "vtcopies: %d records\n", VEC_length(vt_copy_record, vt_copies));
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ vt_copy_record *cpy = VEC_index (vt_copy_record, vt_copies, i);
-+ fprintf (stderr, "\tcopy from %s+%d to ",
-+ type_as_string (BINFO_TYPE (cpy->src->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->src->offset + cpy->offset);
-+ fprintf (stderr, "%s+%d mask 0x%x\n",
-+ type_as_string (BINFO_TYPE (cpy->dest->binfo), TFF_PLAIN_IDENTIFIER),
-+ cpy->dest->offset + cpy->offset,
-+ cpy->bitmap);
-+ }
-+}
-+
-+/*
-+ * Compare all src & dest fragments for the best match ...
-+ */
-+static tree
-+compare_build_vtrelocs (tree binfo, tree t, VEC(constructor_elt,gc) *vinits,
-+ VEC(vt_fragment,heap) *dest_frags,
-+ VEC(vt_fragment,heap) *src_frags)
-+{
-+ unsigned int i;
-+ tree cgraph_clobber = NULL_TREE;
-+ VEC(vt_copy_record,heap) *vt_copies;
-+ int verbose_debug = getenv ("MOREDEBUG") != NULL;
-+
-+ vt_copies = VEC_alloc(vt_copy_record, heap, VEC_length(vt_fragment, dest_frags));
-+
-+ for (i = 0; i < VEC_length(vt_fragment, dest_frags); i++)
-+ {
-+ unsigned int j;
-+ vt_fragment *dest = VEC_index (vt_fragment, dest_frags, i);
-+
-+ for (j = 0; j < VEC_length(vt_fragment, src_frags); j++)
-+ {
-+ unsigned int cmp;
-+ unsigned int k, bits_set;
-+ unsigned int bitmap;
-+ int elide_leading_zeros = 1;
-+ vt_fragment *src = VEC_index (vt_fragment, src_frags, j);
-+
-+ /* new virtual methods arrive only in the 1st dest fragment */
-+ if (i > 0 && dest->size != src->size)
-+ continue;
-+
-+ cmp = src->size;
-+ if (cmp > dest->size)
-+ cmp = dest->size;
-+
-+ /* FIXME: bin elide_leading_zeros until we have better
-+ * comparison logic ? */
-+ for (bitmap = bits_set = k = 0; k < cmp; k++)
-+ {
-+ tree src_fn = VEC_index (constructor_elt, src->vec, src->offset + k)->value;
-+ tree dest_fn = VEC_index (constructor_elt, dest->vec, dest->offset + k)->value;
-+ src_fn = TREE_OPERAND (src_fn, 0);
-+ dest_fn = TREE_OPERAND (dest_fn, 0);
-+
-+ if (src_fn == dest_fn && src_fn != abort_fndecl)
-+ {
-+ bitmap |= (1 << bits_set);
-+ elide_leading_zeros = 0;
-+ }
-+
-+ if (verbose_debug)
-+ {
-+ fprintf (stderr, "compare: %s %s ",
-+ expr_as_string (src_fn, TFF_PLAIN_IDENTIFIER),
-+ src_fn == dest_fn ? "==" : "!=");
-+ fprintf (stderr, "%s (0x%x) [%s]\n",
-+ expr_as_string (dest_fn, TFF_PLAIN_IDENTIFIER),
-+ bitmap,
-+ src_fn == abort_fndecl ? "pure-virt" : "non-pure virt");
-+ }
-+
-+ if (!elide_leading_zeros)
-+ bits_set++;
-+
-+ if (bits_set == (sizeof (long) * 8)) /* FIXME: arch size etc. urgh ... */
-+ {
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set + 1);
-+ bits_set = bitmap = 0;
-+ elide_leading_zeros = 1;
-+ }
-+ }
-+ if (bitmap != 0)
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
-+ }
-+ }
-+
-+ if (VEC_length(vt_copy_record, vt_copies) > 0)
-+ {
-+ VEC(constructor_elt,gc) *vtable;
-+ unsigned int i;
-+ tree vtreloc_inits = NULL_TREE;
-+
-+ debug_vt_copies (vt_copies);
-+
-+ /*
-+ * Re-write the intializers to remove references in the vtable...
-+ */
-+ vtable = VEC_copy(constructor_elt,gc,vinits);
-+
-+ if (verbose_debug)
-+ fprintf (stderr, "re-writing vtable:\n");
-+ for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
-+ {
-+ unsigned int j, bitmap;
-+ vt_copy_record *vtc = VEC_index(vt_copy_record, vt_copies, i);
-+
-+ /* re-write the existing vtable intializer */
-+ bitmap = vtc->bitmap;
-+ if (verbose_debug)
-+ fprintf (stderr, "\tclobber from off %d + %d, bitmap 0x%x\n",
-+ vtc->dest->offset, vtc->offset, bitmap);
-+ for (j = vtc->dest->offset + vtc->offset; bitmap; j++, (bitmap>>=1))
-+ {
-+ if (bitmap & 1)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, j);
-+ if (verbose_debug)
-+ fprintf (stderr, "\tclobber '%s' (0x%x)\n",
-+ expr_as_string (elt->value, TFF_PLAIN_IDENTIFIER),
-+ bitmap);
-+
-+ { /* Lengthy Assertion */
-+ constructor_elt *src_elt = VEC_index (constructor_elt, vtc->src->vec,
-+ vtc->src->offset + j - vtc->dest->offset);
-+ gcc_assert (TREE_CODE (elt->value) == INTEGER_CST /* FIXME: strange, but sometimes we overlap */
-+ || TREE_OPERAND (elt->value, 0) == TREE_OPERAND (src_elt->value, 0));
-+ }
-+ elt->value = fold_build1 (NOP_EXPR,
-+ vtable_entry_type,
-+ build_int_cst (build_pointer_type (void_type_node),
-+ 0xdeadbeef));
-+ }
-+ }
-+
-+ /* build vtreloc decls */
-+ vtreloc_inits = build_vtable_copy_slot (vtc->dest->binfo, t, vtc->dest->offset + vtc->offset,
-+ vtc->src->binfo, vtc->src->offset + vtc->offset,
-+ vtc->bitmap, vtreloc_inits);
-+ }
-+
-+ /* re-build as chain for constructor ... hmm */
-+ for (i = 0; i < VEC_length(constructor_elt, vtable); i++)
-+ {
-+ constructor_elt *elt = VEC_index (constructor_elt, vtable, i);
-+ cgraph_clobber = tree_cons (elt->index, elt->value, cgraph_clobber);
-+ }
-+
-+ /* Append a reference to the parent vtable
-+ * to encourage cgraph not to clobber the vt-reloc decl */
-+ cgraph_clobber = tree_cons (NULL_TREE,
-+ build_nop (vfunc_ptr_type_node,
-+ build_address (get_vtreloc_decl (binfo, t, vtreloc_inits))),
-+ cgraph_clobber);
-+ cgraph_clobber = nreverse (cgraph_clobber);
-+ }
-+
-+ vec_heap_free (vt_copies);
-+ return cgraph_clobber;
-+}
-+
-+static VEC(constructor_elt,gc) *
-+build_init_vec (tree inits)
-+{
-+ tree t;
-+ VEC(constructor_elt,gc) *v = NULL;
-+
-+ if (inits)
-+ {
-+ v = VEC_alloc (constructor_elt, gc, list_length (inits));
-+ for (t = inits; t; t = TREE_CHAIN (t))
-+ {
-+ constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
-+ elt->index = TREE_PURPOSE (t);
-+ elt->value = TREE_VALUE (t);
-+ }
-+ }
-+
-+ return v;
-+}
-+
-+/*
-+ * Create vtreloc data for type t, or type cstr_binfo in hierarchy
-+ * t if a construction vtable.
-+ */
-+static tree
-+create_vtrelocs (tree binfo, tree t, tree inits)
-+{
-+ /* Fixme - cstr_binfo ! */
-+
-+ int i;
-+ tree base_binfo;
-+ VEC(vt_fragment,heap) *dest_frags;
-+ VEC(vt_fragment,heap) *src_frags;
-+ VEC(constructor_elt,gc) *vinits = NULL;
-+
-+ if (!inits)
-+ return NULL_TREE;
-+ if (!getenv ("VT_SHRINK"))
-+ return inits;
-+
-+ vinits = build_init_vec (inits);
-+ if (!get_vtinit_for_binfo (binfo, t, 1))
-+ set_vtinit_for_binfo (binfo, t, vinits);
-+ else
-+ fprintf (stderr, "Error: already set!\n");
-+
-+ if (getenv ("MOREDEBUG"))
-+ {
-+ debug_vtable (binfo, t);
-+
-+ fprintf (stderr, "Inherited from:\n");
-+ if (TYPE_BINFO (t) != binfo)
-+ {
-+ debug_vtable (binfo, NULL_TREE);
-+ }
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
-+ {
-+ tree btype = BINFO_TYPE (base_binfo);
-+ debug_vtable (TYPE_BINFO (btype), NULL_TREE);
-+ }
-+ }
-+
-+ src_frags = VEC_alloc(vt_fragment,heap,4);
-+ dest_frags = VEC_alloc(vt_fragment,heap,4);
-+ vtdecompose_frags (binfo, t, &dest_frags);
-+ if (TYPE_BINFO (t) != binfo)
-+ vtdecompose_frags (binfo, NULL_TREE, &src_frags);
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
-+ vtdecompose_frags (TYPE_BINFO (BINFO_TYPE (base_binfo)), NULL_TREE, &src_frags);
-+ /* FIXME: do we want virtual bases here too ? */
-+
-+ if (getenv ("MOREDEBUG"))
-+ {
-+ fprintf (stderr, "dest:\n");
-+ debug_fragments (dest_frags);
-+ fprintf (stderr, "src:\n");
-+ debug_fragments (src_frags);
-+ }
-+
-+ if (inits) {
-+ tree new_inits = compare_build_vtrelocs (binfo, t, vinits, dest_frags,
-+ src_frags);
-+ if (new_inits)
-+ inits = new_inits;
-+ }
-+
-+ vec_heap_free (dest_frags);
-+ vec_heap_free (src_frags);
-+
-+ return inits;
-+}
-+
-+static void
-+finish_vtbls (tree t)
-+{
-+ tree inits;
-+
-+ inits = vtbl_get_inits (t);
-+ inits = create_vtrelocs (TYPE_BINFO (t), t, inits);
-+
- if (BINFO_VTABLE (TYPE_BINFO (t)))
-- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
-+ initialize_vtable (TYPE_BINFO (t), inits);
- }
-
- /* Initialize the vtable for BINFO with the INITS. */
-@@ -6984,6 +7531,17 @@
-
- /* Initialize the construction vtable. */
- CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
-+
-+ SET_IDENTIFIER_GLOBAL_VALUE (id, vtbl); /* we need this later */
-+ inits = create_vtrelocs (binfo, t, inits);
-+ /* potentially correct the array size type - URGH cut/paste ... */
-+ {
-+ /* Figure out the type of the construction vtable. */
-+ type = build_index_type (size_int (list_length (inits) - 1));
-+ type = build_cplus_array_type (vtable_entry_type, type);
-+ TREE_TYPE (vtbl) = type;
-+ }
-+
- initialize_artificial_var (vtbl, inits);
- dump_vtable (t, binfo, vtbl);
- }
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
---- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-30 16:58:08.000000000 +0000
-@@ -498,6 +498,7 @@
- CPTI_UNKNOWN_TYPE,
- CPTI_VTBL_TYPE,
- CPTI_VTBL_PTR_TYPE,
-+ CPTI_VTBL_SLOT_COPY_TYPE,
- CPTI_STD,
- CPTI_ABI,
- CPTI_CONST_TYPE_INFO_TYPE,
-@@ -562,6 +563,7 @@
- #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
- #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
- #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
-+#define vtbl_slot_copy_type_node cp_global_trees[CPTI_VTBL_SLOT_COPY_TYPE]
- #define std_node cp_global_trees[CPTI_STD]
- #define abi_node cp_global_trees[CPTI_ABI]
- #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,9 @@
- TREE_PURPOSE slot. */
- extern GTY(()) tree static_aggregates;
-
-+/* A type mapping of types to un-altered type tables */
-+extern GTY(()) tree vtable_copy_types;
-+
- /* Functions called along with real static constructors and destructors. */
-
- extern GTY(()) tree static_ctors;
-@@ -3847,6 +3852,7 @@
- extern void maybe_note_name_used_in_class (tree, tree);
- extern void note_name_declared_in_class (tree, tree);
- extern tree get_vtbl_decl_for_binfo (tree);
-+/* extern tree get_vtreloc_decl (tree, tree); */
- extern void debug_class (tree);
- extern void debug_thunks (tree);
- extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4539,9 @@
- extern tree mangle_typeinfo_for_type (tree);
- extern tree mangle_typeinfo_string_for_type (tree);
- extern tree mangle_vtbl_for_type (tree);
-+extern tree mangle_vtbl_for_type_local (tree);
-+extern tree mangle_vtreloc_for_type (tree, tree);
-+extern tree mangle_vtreloc_section_for_type (tree, tree);
- extern tree mangle_vtt_for_type (tree);
- extern tree mangle_ctor_vtbl_for_type (tree, tree);
- extern tree mangle_thunk (tree, int, tree, tree);
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
---- pristine-gcc-4.2.1-simple/gcc/cp/decl.c 2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c 2008-01-21 19:50:44.000000000 +0000
-@@ -124,6 +124,10 @@
- tree vtbl_type_node;
- tree vtbl_ptr_type_node;
-
-+ Array slot copy type info:
-+
-+ tree vtbl_slot_copy_type_node;
-+
- Namespaces,
-
- tree std_node;
-@@ -3117,6 +3121,13 @@
- }
- }
-
-+static tree
-+append_struct_field (const char *name, tree type, tree chain)
-+{
-+ return chainon (chain, build_decl (FIELD_DECL,
-+ get_identifier (name), type));
-+}
-+
- /* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
-@@ -3243,6 +3254,19 @@
- layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
-
-+ {
-+ tree elem_fields = NULL;
-+
-+ vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
-+ elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+ elem_fields = append_struct_field ("vt_copy_bitmap", size_type_node, elem_fields);
-+ finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
-+ elem_fields, NULL_TREE);
-+ layout_type (vtbl_slot_copy_type_node);
-+ record_builtin_type (RID_MAX, NULL, vtbl_slot_copy_type_node);
-+ }
-+
- push_namespace (get_identifier ("__cxxabiv1"));
- abi_node = current_namespace;
- pop_namespace ();
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
---- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-31 12:05:37.000000000 +0000
-@@ -2670,6 +2670,112 @@
- return mangle_special_for_type (type, "TV");
- }
-
-+tree
-+mangle_vtbl_for_type_local (const tree type)
-+{
-+ const char *result;
-+
-+ /* We don't have an actual decl here for the special component, so
-+ we can't just process the <encoded-name>. Instead, fake it. */
-+ start_mangling (type, /*ident_p=*/true);
-+
-+ /* Start the mangling. */
-+ write_string ("_Z");
-+ write_string ("VT");
-+
-+ /* Add the type. */
-+ write_type (type);
-+ write_string ("_local");
-+ result = finish_mangling (/*warn=*/false);
-+
-+ return get_identifier_nocopy (result);
-+}
-+
-+/* FIXME: as should be obvious I have no idea what I'm doing here */
-+static int calc_max_depth (const tree binfo)
-+{
-+ int i, max = 0;
-+ tree base;
-+
-+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base); ++i) {
-+ int depth = calc_max_depth (base);
-+ if (depth > max)
-+ max = depth;
-+ }
-+ return max + 1;
-+}
-+
-+static void write_order_complexity_for_type (const tree type)
-+{
-+ int max_depth = 0;
-+ int virts;
-+ tree binfo;
-+ char buffer[128]; /* hack */
-+
-+ binfo = TYPE_BINFO (type);
-+
-+ max_depth = calc_max_depth (binfo);
-+
-+ /* FIXME: virtual bases ?
-+ {
-+ tree vbase;
-+ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
-+ virts++;
-+ }
-+ */
-+ virts = 0;
-+
-+ sprintf (buffer, "_%.8i_", max_depth + virts);
-+ write_string (buffer);
-+}
-+
-+/*
-+ * In order to get initialization order right, use a metric of
-+ * the maximum 'inheritedness' of a class, ie. a vtable that
-+ * inherits from 5 others, should be initialized after those
-+ * that inherit from 4
-+ */
-+static const char *mangle_vtreloc (const tree binfo,
-+ const tree t,
-+ const char *prefix)
-+{
-+ int constr = TYPE_BINFO (t) != binfo; /* test: one */
-+ const char *name;
-+
-+ start_mangling (t, /*ident_p=*/true);
-+ write_string (prefix);
-+ write_string ("_ZVTR");
-+ write_order_complexity_for_type (t);
-+ if (constr)
-+ write_string ("C");
-+ write_type (t);
-+ if (constr)
-+ {
-+ write_integer_cst (BINFO_OFFSET (binfo));
-+ write_char ('_');
-+ write_type (BINFO_TYPE (binfo));
-+ }
-+
-+ name = finish_mangling (/*warn=*/false);
-+
-+ return name;
-+}
-+
-+/* Create an identifier for the mangled name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_for_type (const tree binfo, const tree t)
-+{
-+ return get_identifier_nocopy (mangle_vtreloc (binfo, t, ""));
-+}
-+
-+/* Create an identifier for the section name of the vt relocs for TYPE. */
-+
-+tree mangle_vtreloc_section_for_type (const tree binfo, const tree t)
-+{
-+ const char *name = mangle_vtreloc (binfo, t, ".vtrelocs.");
-+ return build_string (strlen (name), name);
-+}
-+
- /* Returns an identifier for the mangled name of the VTT for TYPE. */
-
- tree
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/method.c gcc-4.2.1-simple/gcc/cp/method.c
---- pristine-gcc-4.2.1-simple/gcc/cp/method.c 2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/method.c 2008-01-28 21:55:50.000000000 +0000
-@@ -165,6 +165,12 @@
- DECL_USE_TEMPLATE (thunk) = 0;
- DECL_TEMPLATE_INFO (thunk) = NULL;
-
-+ if (getenv ("VT_SHRINK"))
-+ {
-+ DECL_VISIBILITY (thunk) = VISIBILITY_HIDDEN;
-+ DECL_VISIBILITY_SPECIFIED (thunk) = 1;
-+ }
-+
- /* Add it to the list of thunks associated with FUNCTION. */
- TREE_CHAIN (thunk) = DECL_THUNKS (function);
- DECL_THUNKS (function) = thunk;
-@@ -384,6 +390,14 @@
- = DECL_VISIBILITY_SPECIFIED (function);
- if (DECL_ONE_ONLY (function))
- make_decl_one_only (thunk_fndecl);
-+ if (getenv ("VT_SHRINK"))
-+ {
-+ if (getenv ("MOREDEBUG"))
-+ fprintf (stderr, "make thunk '%s' hidden\n",
-+ decl_as_string (thunk_fndecl, TFF_PLAIN_IDENTIFIER));
-+ DECL_VISIBILITY (thunk_fndecl) = VISIBILITY_HIDDEN;
-+ DECL_VISIBILITY_SPECIFIED (thunk_fndecl) = 1;
-+ }
-
- if (flag_syntax_only)
- {
diff --git a/patches/test/suse-vtrelocs-glibc.diff b/patches/test/suse-vtrelocs-glibc.diff
deleted file mode 100644
index e9a7f2a03..000000000
--- a/patches/test/suse-vtrelocs-glibc.diff
+++ /dev/null
@@ -1,239 +0,0 @@
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-init.c glibc-2.6.1/elf/dl-init.c
---- pristine-glibc-2.6.1/elf/dl-init.c 2005-01-06 22:40:26.000000000 +0000
-+++ glibc-2.6.1/elf/dl-init.c 2008-01-22 16:09:03.000000000 +0000
-@@ -30,6 +30,79 @@
- extern int _dl_starting_up_internal attribute_hidden;
- #endif
-
-+#define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+
-+/* process vtable / block copy relocations */
-+
-+static void
-+_dl_perform_vtrelocs (struct link_map *map)
-+{
-+ ElfW(VtReloc) *rel;
-+ int debug_output = GLRO(dl_debug_mask) & DL_DEBUG_RELOC;
-+ int i;
-+
-+ if (debug_output)
-+ _dl_debug_printf ("new vtcopy-reloc processing on '%s' offset 0x%x map 0x%x\n",
-+ map->l_name[0] ? map->l_name : rtld_progname,
-+ map->l_addr, map->l_map_start);
-+
-+ /* any vtrelocs ? */
-+ if (map->l_info[SUSEIDX(DT_SUSE_VTRELOC)] == NULL)
-+ {
-+ if (debug_output)
-+ _dl_debug_printf ("no vtreloc section in '%s'\n", map->l_name);
-+ return;
-+ }
-+ rel = (ElfW(VtReloc) *)(D_PTR (map, l_info[SUSEIDX(DT_SUSE_VTRELOC)]));
-+ if (debug_output)
-+ _dl_debug_printf ("vtreloc section found in '%s' at 0x%x (0x%x) mapped at 0x%x\n",
-+ map->l_name, rel, ((ElfW(Addr))rel - map->l_addr),
-+ map->l_addr);
-+ while (rel->r_src != 0)
-+ {
-+ ElfW(Addr) **src, **dest;
-+ ElfW(Word) mask;
-+
-+ src = (void *)rel->r_src;
-+ dest = (void *)rel->r_dest;
-+ if (debug_output)
-+ _dl_debug_printf ("copy from 0x%x to 0x%x mask 0x%x\n", src, dest, rel->r_mask);
-+#ifdef DONT_TOUCH_EXTERNAL
-+ if (dest < map->l_map_start || dest >= map->l_map_end)
-+ { /* weak symbol defined in another dso - thus already fixed up, and readonly */
-+ if (debug_output)
-+ _dl_debug_printf (" skip, defined elsewhere\n");
-+ }
-+ else
-+#endif
-+ {
-+ for (mask = rel->r_mask; mask; mask >>= 1)
-+ {
-+ /* _dl_debug_printf ("%s copy [&0x%x -> &0x%x]\n",
-+ mask & 1 ? "do" : "no", src, dest); */
-+ if (mask & 1)
-+ {
-+ if (debug_output || !(*src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef))
-+ {
-+ _dl_debug_printf ("do copy 0x%x to 0x%x %s [&0x%x -> &0x%x]\n",
-+ *src, *dest,
-+ *src == *dest || *dest == (ElfW(Addr) *)0xdeadbeef ? "match" : "Bug",
-+ src, dest);
-+ }
-+ *dest = *src;
-+ }
-+ else if (debug_output)
-+ _dl_debug_printf ("no copy 0x%x to 0x%x %s\n",
-+ *src, *dest, *src == *dest && (int)*src > 0x100 ? "Bug" : "skip");
-+ dest++; src++;
-+ }
-+ }
-+ if (debug_output)
-+ _dl_debug_printf ("move to next vtrel entry\n");
-+ rel++;
-+ }
-+}
-
- static void
- call_init (struct link_map *l, int argc, char **argv, char **env)
-@@ -42,6 +115,8 @@
- dependency. */
- l->l_init_called = 1;
-
-+ _dl_perform_vtrelocs (l);
-+
- /* Check for object which constructors we do not run here. */
- if (__builtin_expect (l->l_name[0], 'a') == '\0'
- && l->l_type == lt_executable)
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-load.c glibc-2.6.1/elf/dl-load.c
---- pristine-glibc-2.6.1/elf/dl-load.c 2008-01-08 20:45:11.000000000 +0000
-+++ glibc-2.6.1/elf/dl-load.c 2008-01-11 15:23:16.000000000 +0000
-@@ -1200,9 +1200,13 @@
-
- /* Remember which part of the address space this object uses. */
- l->l_map_start = (ElfW(Addr)) __mmap ((void *) mappref, maplength,
-- c->prot,
-+ c->prot | PROT_WRITE,
- MAP_COPY|MAP_FILE,
- fd, c->mapoff);
-+ if (GLRO(dl_debug_mask) & DL_DEBUG_RELOC)
-+ _dl_debug_printf ("map '%s' at 0x%x prot 0x%x\n", l->l_name,
-+ l->l_map_start, c->prot);
-+
- if (__builtin_expect ((void *) l->l_map_start == MAP_FAILED, 0))
- {
- map_error:
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dl-reloc.c glibc-2.6.1/elf/dl-reloc.c
---- pristine-glibc-2.6.1/elf/dl-reloc.c 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/dl-reloc.c 2008-01-22 15:54:46.000000000 +0000
-@@ -133,7 +133,6 @@
- '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
- }
-
--
- void
- _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
- int lazy, int consider_profiling)
-@@ -174,11 +173,15 @@
- /* DT_TEXTREL is now in level 2 and might phase out at some time.
- But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
- testing easier and therefore it will be available at all time. */
-- if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
-+ if (1) //__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
- {
- /* Bletch. We must make read-only segments writable
- long enough to relocate them. */
- const ElfW(Phdr) *ph;
-+
-+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
-+ _dl_debug_printf ("un-protecting foo\n");
-+
- for (ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
- if (ph->p_type == PT_LOAD && (ph->p_flags & PF_W) == 0)
- {
-@@ -296,6 +299,7 @@
- /* Mark the object so we know this work has been done. */
- l->l_relocated = 1;
-
-+#if 0
- /* Undo the segment protection changes. */
- while (__builtin_expect (textrels != NULL, 0))
- {
-@@ -312,6 +316,7 @@
- done, do it. */
- if (l->l_relro_size != 0)
- _dl_protect_relro (l);
-+#endif
- }
-
-
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/dynamic-link.h glibc-2.6.1/elf/dynamic-link.h
---- pristine-glibc-2.6.1/elf/dynamic-link.h 2006-07-10 22:52:18.000000000 +0100
-+++ glibc-2.6.1/elf/dynamic-link.h 2008-01-10 18:08:21.000000000 +0000
-@@ -65,6 +65,10 @@
- #ifndef VERSYMIDX
- # define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
- #endif
-+#ifndef SUSEIDX
-+# define SUSEIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + \
-+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSE_TAGIDX (sym))
-+#endif
-
-
- /* Read the dynamic section at DYN and fill in INFO with indices DT_*. */
-@@ -88,6 +92,9 @@
-
- while (dyn->d_tag != DT_NULL)
- {
-+ if (dyn->d_tag >= DT_SUSE_LO &&
-+ dyn->d_tag < DT_SUSE_LO + DT_SUSENUM)
-+ info[SUSEIDX(dyn->d_tag)] = dyn;
- if (dyn->d_tag < DT_NUM)
- info[dyn->d_tag] = dyn;
- else if (dyn->d_tag >= DT_LOPROC &&
-@@ -143,6 +150,7 @@
- # endif
- ADJUST_DYN_INFO (DT_JMPREL);
- ADJUST_DYN_INFO (VERSYMIDX (DT_VERSYM));
-+ ADJUST_DYN_INFO (SUSEIDX(DT_SUSE_VTRELOC));
- ADJUST_DYN_INFO (DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM
- + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM);
- # undef ADJUST_DYN_INFO
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/elf/elf.h glibc-2.6.1/elf/elf.h
---- pristine-glibc-2.6.1/elf/elf.h 2007-05-18 09:37:39.000000000 +0100
-+++ glibc-2.6.1/elf/elf.h 2008-01-09 16:43:02.000000000 +0000
-@@ -518,6 +518,22 @@
- Elf64_Sxword r_addend; /* Addend */
- } Elf64_Rela;
-
-+/* VTable relocation entry */
-+
-+typedef struct
-+{
-+ Elf32_Addr r_src; /* source address */
-+ Elf32_Addr r_dest; /* destination address */
-+ Elf32_Word r_mask; /* copy bit-mask */
-+} Elf32_VtReloc;
-+
-+typedef struct
-+{
-+ Elf64_Addr r_src; /* source address */
-+ Elf64_Addr r_dest; /* destination address */
-+ Elf64_Word r_mask; /* copy bit-mask */
-+} Elf64_VtReloc;
-+
- /* How to extract and insert information held in the r_info field. */
-
- #define ELF32_R_SYM(val) ((val) >> 8)
-@@ -734,6 +750,14 @@
- #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
- #define DT_VERSIONTAGNUM 16
-
-+/* SUSE specific pieces - at a random OS specific address, after
-+ previous 2 (direct/hashvals) development sections */
-+#define DT_SUSE_LO (0x6cbdd030 + 2)
-+#define DT_SUSE_VTRELOC DT_SUSE_LO
-+#define DT_SUSE_HI 0x6cbdd040
-+#define DT_SUSE_TAGIDX(tag) (tag - DT_SUSE_LO)
-+#define DT_SUSENUM 1
-+
- /* Sun added these machine-independent extensions in the "processor-specific"
- range. Be compatible. */
- #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
-diff -u -r -x '*~' -x '*.rej' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-glibc-2.6.1/include/link.h glibc-2.6.1/include/link.h
---- pristine-glibc-2.6.1/include/link.h 2007-08-03 14:57:06.000000000 +0100
-+++ glibc-2.6.1/include/link.h 2008-01-09 16:43:02.000000000 +0000
-@@ -121,7 +121,7 @@
- are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
-
- ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
-- + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
-+ + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM + DT_SUSENUM];
- const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
- ElfW(Addr) l_entry; /* Entry point location. */
- ElfW(Half) l_phnum; /* Number of program header entries. */
diff --git a/patches/test/svg-import-rsvg.diff b/patches/test/svg-import-rsvg.diff
deleted file mode 100644
index 1a01419c8..000000000
--- a/patches/test/svg-import-rsvg.diff
+++ /dev/null
@@ -1,180 +0,0 @@
-moving vcl stuff to pluggable render patch
-
-From: <>
-
-
----
-
- .../internalgraphicfilters/svg_Export.xcu | 10 +++
- filter/source/svg/exports.map | 1
- filter/source/svg/svgfilter.cxx | 9 ++
- filter/source/svg/svgfilter.hxx | 7 ++
- filter/source/svg/svgreader.cxx | 81 ++++++++++++++++++++
- 5 files changed, 108 insertions(+), 0 deletions(-)
-
-diff --git a/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
-index 8b73f15..f0cd69d 100644
---- filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
-+++ filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu
-@@ -8,3 +8,13 @@
- </prop>
- <prop oor:name="Flags"><value>EXPORT</value></prop>
- </node>
-+ <node oor:name="svg_Import" oor:op="replace" >
-+ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
-+ <prop oor:name="FormatName"><value>svgfilter</value></prop>
-+ <prop oor:name="RealFilterName"/>
-+ <prop oor:name="UIComponent"/>
-+ <prop oor:name="UIName">
-+ <value xml:lang="en-US">SVG - Scalable Vector Graphics</value>
-+ </prop>
-+ <prop oor:name="Flags"><value>IMPORT</value></prop>
-+ </node>
-diff --git a/filter/source/svg/exports.map b/filter/source/svg/exports.map
-index acb4748..d56c225 100644
---- filter/source/svg/exports.map
-+++ filter/source/svg/exports.map
-@@ -3,6 +3,7 @@ SVGFILTER_1_0 {
- component_getImplementationEnvironment;
- component_getFactory;
- component_writeInfo;
-+ GraphicImport;
-
- local:
- *;
-diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
-index 9efbed7..de1e638 100644
---- filter/source/svg/svgfilter.cxx
-+++ filter/source/svg/svgfilter.cxx
-@@ -208,6 +208,14 @@ rtl::OUString SAL_CALL SVGFilter::detect( Sequence< PropertyValue >& io_rDescrip
-
- // -----------------------------------------------------------------------------
-
-+class FilterConfigItem;
-+extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
-+{
-+ return importSvg( rStream, rGraphic );
-+}
-+
-+// -----------------------------------------------------------------------------
-+
- namespace sdecl = comphelper::service_decl;
- sdecl::class_<SVGFilter> serviceImpl;
- const sdecl::ServiceDecl svgFilter(
-@@ -219,3 +227,4 @@ namespace sdecl = comphelper::service_decl;
-
- // The C shared lib entry points
- COMPHELPER_SERVICEDECL_EXPORTS1(svgFilter)
-+
-diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
-index dcb8065..b057a5e 100644
---- filter/source/svg/svgfilter.hxx
-+++ filter/source/svg/svgfilter.hxx
-@@ -271,4 +271,11 @@ sal_Bool SAL_CALL SVGFilter_supportsService( const ::rtl::OUString& ServiceName
- SAL_CALL SVGFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( ::com::sun::star::uno::Exception );
-
-+// -----------------------------------------------------------------------------
-+
-+class SvStream;
-+class Graphic;
-+
-+bool importSvg(SvStream & rStream, Graphic & rGraphic );
-+
- #endif // SVGFILTER_HXX
-diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
-index 2525999..56c5269 100644
---- filter/source/svg/svgreader.cxx
-+++ filter/source/svg/svgreader.cxx
-@@ -41,6 +41,18 @@
- #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
- #include <com/sun/star/xml/dom/NodeType.hpp>
-
-+#include <comphelper/processfactory.hxx>
-+#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
-+#include <unotools/streamwrap.hxx>
-+#include <xmloff/xmluconv.hxx>
-+#include <vcl/graph.hxx>
-+#include <vcl/virdev.hxx>
-+#include <vcl/metaact.hxx>
-+#include <vcl/gradient.hxx>
-+#include <svx/impgrf.hxx>
-+#include <tools/zcodec.hxx>
-+
- #include <boost/bind.hpp>
- #include <hash_set>
- #include <map>
-@@ -1874,3 +1886,72 @@ sal_Bool SVGReader::parseAndConvert()
- }
-
- } // namespace svgi
-+
-+/////////////////////////////////////////////////////////////////////
-+
-+bool importSvg(SvStream & rStream, Graphic & rGraphic )
-+{
-+ // TODO(P2): need to peek into svg to determine dimensions. but no
-+ // need to load the _whole_ document! Better use librsvg to
-+ // generate a preview bitmap and grab size from there
-+ const uno::Reference<lang::XMultiServiceFactory> xServiceFactory(
-+ ::comphelper::getProcessServiceFactory());
-+
-+ uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(
-+ xServiceFactory->createInstance(
-+ rtl::OUString::createFromAscii("com.sun.star.xml.dom.DocumentBuilder")),
-+ uno::UNO_QUERY );
-+
-+ uno::Reference<io::XInputStream> xStream(
-+ new utl::OInputStreamWrapper(rStream) );
-+
-+ uno::Reference<xml::dom::XDocument> xDom(
-+ xDomBuilder->parse(xStream),
-+ uno::UNO_QUERY_THROW );
-+
-+ uno::Reference<xml::dom::XElement> xDocElem( xDom->getDocumentElement(),
-+ uno::UNO_QUERY_THROW );
-+
-+ // get the document dimensions
-+
-+ // if the "width" and "height" attributes are missing, inkscape fakes
-+ // A4 portrait for. Let's do the same.
-+ double nWidth(21000.0);
-+ double nHeight(29700.0);
-+ svgi::State aInitialState;
-+ if (xDocElem->hasAttribute(USTR("width")))
-+ nWidth = svgi::pt100thmm(svgi::convLength(xDocElem->getAttribute(USTR("width")),
-+ aInitialState,'h'));
-+ if (xDocElem->hasAttribute(USTR("height")))
-+ nHeight = svgi::pt100thmm(svgi::convLength(xDocElem->getAttribute(USTR("height")),
-+ aInitialState,'v'));
-+ GDIMetaFile aMtf;
-+
-+ // rewind stream & extract binary blob
-+ const sal_Size nBytes(rStream.Tell());
-+ rStream.Seek(STREAM_SEEK_TO_BEGIN);
-+ void* const pBuf=rtl_allocateMemory(nBytes);
-+ if( rStream.Read(pBuf,nBytes) != nBytes )
-+ {
-+ rtl_freeMemory(pBuf);
-+ return sal_False;
-+ }
-+ aMtf.AddAction(
-+ makePluggableRendererAction(
-+ USTR("com.sun.star.comp.SVGRenderer"),
-+ USTR("com.sun.star.comp.SVGGraphic"),
-+ pBuf,nBytes));
-+ rtl_freeMemory(pBuf);
-+
-+ aMtf.SetPrefMapMode( MAP_100TH_MM );
-+
-+ aMtf.SetPrefSize(
-+ Size( basegfx::fround(nWidth),
-+ basegfx::fround(nHeight)));
-+
-+ rGraphic = aMtf;
-+
-+ return sal_True;
-+}
-+
-+
diff --git a/patches/test/sw-dump-layout-tree.diff b/patches/test/sw-dump-layout-tree.diff
deleted file mode 100644
index 681330ccf..000000000
--- a/patches/test/sw-dump-layout-tree.diff
+++ /dev/null
@@ -1,232 +0,0 @@
-diff --git a/sw/source/core/inc/bodyfrm.hxx b/sw/source/core/inc/bodyfrm.hxx
-index e4492dc..db991fe 100644
---- sw/source/core/inc/bodyfrm.hxx
-+++ sw/source/core/inc/bodyfrm.hxx
-@@ -46,6 +46,8 @@ protected:
- public:
- SwBodyFrm( SwFrmFmt* );
-
-+ virtual void Paint( const SwRect& ) const;
-+
- DECL_FIXEDMEMPOOL_NEWDEL(SwBodyFrm)
- };
-
-diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
-index 1316abd..66a88a2 100644
---- sw/source/core/inc/frame.hxx
-+++ sw/source/core/inc/frame.hxx
-@@ -33,6 +33,8 @@
- #include "swtypes.hxx" // fuer SwTwips
- #include "swrect.hxx"
- #include "calbck.hxx" // fuer SwClient
-+#include <libxml/encoding.h>
-+#include <libxml/xmlwriter.h>
-
- class SwLayoutFrm;
- class SwRootFrm;
-@@ -916,6 +918,10 @@ public:
-
- // FME 2007-08-30 #i81146# new loop control
- void ValidateThisAndAllLowers( const USHORT nStage );
-+
-+public:
-+ virtual void dumpAsXml(xmlTextWriterPtr writer);
-+ void dumpChildrenAsXml(xmlTextWriterPtr writer);
- };
-
- inline BOOL SwFrm::IsInDocBody() const
-diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk
-index c70b264..a81d484 100644
---- sw/source/core/layout/makefile.mk
-+++ sw/source/core/layout/makefile.mk
-@@ -103,7 +103,8 @@ SLOFILES = \
- $(SLO)$/trvlfrm.obj \
- $(SLO)$/unusedf.obj \
- $(SLO)$/virtoutp.obj \
-- $(SLO)$/wsfrm.obj
-+ $(SLO)$/wsfrm.obj \
-+ $(SLO)$/xmldump.obj
-
- .IF "$(product)"==""
- .IF "$(cap)"==""
-diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
-index e31c6ca..a6c807a 100644
---- sw/source/core/layout/pagechg.cxx
-+++ sw/source/core/layout/pagechg.cxx
-@@ -2489,3 +2499,17 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const
- return *pRet;
- }
-
-+
-+void SwBodyFrm::Paint( const SwRect& rRect) const
-+{
-+ ViewShell *pSh = GetShell();
-+ OutputDevice* pOut = pSh->GetOut();
-+ pOut->Push();
-+ pOut->SetLineColor(Color(255, 0, 0));
-+ pOut->SetFillColor(COL_TRANSPARENT);
-+// SwRect aRect(Frm().Left()+5, Frm().Top()+5, Frm().Width()-5, Frm().Height()-5);
-+ SwRect aRect=Frm();
-+ pOut->DrawRect(aRect.SVRect());
-+ pOut->Pop();
-+ SwLayoutFrm::Paint(rRect);
-+}
-diff --git a/sw/source/core/layout/xmldump.cxx b/sw/source/core/layout/xmldump.cxx
-index e69de29..0417726 100644
---- sw/source/core/layout/xmldump.cxx
-+++ sw/source/core/layout/xmldump.cxx
-@@ -0,0 +1,85 @@
-+#include "precompiled_sw.hxx"
-+
-+#include "frame.hxx"
-+#include "txtfrm.hxx"
-+
-+void SwFrm::dumpAsXml(xmlTextWriterPtr writer)
-+{
-+ const char *name=NULL;
-+
-+ switch(GetType()) {
-+ case FRM_ROOT:
-+ name="root";
-+ break;
-+ case FRM_PAGE:
-+ name="page";
-+ break;
-+ case FRM_COLUMN:
-+ name="column";
-+ break;
-+ case FRM_HEADER:
-+ name="header";
-+ break;
-+ case FRM_FOOTER:
-+ name="footer";
-+ break;
-+ case FRM_FTNCONT:
-+ name="ftncont";
-+ break;
-+ case FRM_FTN:
-+ name="ftn";
-+ break;
-+ case FRM_BODY:
-+ name="body";
-+ break;
-+ case FRM_FLY:
-+ name="fly";
-+ break;
-+ case FRM_SECTION:
-+ name="section";
-+ break;
-+ case FRM_UNUSED:
-+ name="unused";
-+ break;
-+ case FRM_TAB:
-+ name="tab";
-+ break;
-+ case FRM_ROW:
-+ name="row";
-+ break;
-+ case FRM_CELL:
-+ name="cell";
-+ break;
-+ case FRM_TXT:
-+ name="txt";
-+ break;
-+ case FRM_NOTXT:
-+ name="txt";
-+ break;
-+ };
-+
-+ if (name!=NULL) {
-+ xmlTextWriterStartElement(writer, (const xmlChar*)name);
-+ if (IsTxtFrm()) {
-+ SwTxtFrm *pTxtFrm=(SwTxtFrm *)this;
-+ rtl::OUString aTxt=pTxtFrm->GetTxt();
-+ for(int i=0;i<32;i++) {
-+ aTxt=aTxt.replace(i, '*');
-+ }
-+ rtl::OString aTxt8 = ::rtl::OUStringToOString (aTxt, RTL_TEXTENCODING_UTF8);
-+ xmlTextWriterWriteString(writer, (const xmlChar*)aTxt8.getStr());
-+
-+ } else {
-+ dumpChildrenAsXml(writer);
-+ }
-+ xmlTextWriterEndElement(writer);
-+ }
-+}
-+
-+void SwFrm::dumpChildrenAsXml(xmlTextWriterPtr writer)
-+{
-+ SwFrm *pFrm=GetLower();
-+ for(;pFrm!=NULL;pFrm=pFrm->GetNext()) {
-+ pFrm->dumpAsXml(writer);
-+ }
-+}
-diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
-index 9b920d1..bb5ca93 100644
---- sw/source/ui/docvw/edtwin.cxx
-+++ sw/source/ui/docvw/edtwin.cxx
-@@ -127,6 +127,7 @@
- #include <crsskip.hxx>
- #include <breakit.hxx>
- #include <checkit.hxx>
-+#include "../../core/inc/rootfrm.hxx"
-
- #ifndef _HELPID_H
- #include <helpid.h>
-@@ -1315,7 +1316,21 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
- BOOL bChkInsBlank = pQuickHlpData->bChkInsBlank;
- pQuickHlpData->bChkInsBlank = FALSE;
-
-+ if (rKEvt.GetKeyCode().GetCode()==KEY_F12) {
-+ SwRootFrm* pLayout = GetView().GetDocShell()->GetWrtShell()->GetLayout();
-+ xmlTextWriterPtr writer = xmlNewTextWriterFilename("layout.xml", 0);
-+ if (writer!=NULL) {
-+ printf("dumping layout in \"layout.xml\"\n");
-+ xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
-+ pLayout->dumpAsXml(writer);
-+ xmlTextWriterEndDocument(writer);
-+ xmlFreeTextWriter(writer);
-+ }
-+ return;
-+ }
-+
- KeyEvent aKeyEvent( rKEvt );
-+
- // look for vertical mappings
- if( !bIsDocReadOnly && !rSh.IsSelFrmMode() && !rSh.IsObjSelected() )
- {
-diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
-index 097824b..2713fdf 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -125,7 +125,8 @@ SHL1STDLIBS+= \
- $(SALHELPERLIB) \
- $(ICUUCLIB) \
- $(I18NUTILLIB) \
-- $(AVMEDIALIB)
-+ $(AVMEDIALIB) \
-+ $(LIBXML2LIB)
-
- .IF "$(GUI)"=="WNT"
- SHL1STDLIBS+= $(ADVAPI32LIB)
-@@ -155,7 +156,8 @@ SHL2STDLIBS= \
- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
-- $(SALLIB)
-+ $(SALLIB) \
-+ $(LIBXML2LIB)
-
- SHL2OBJS= $(SLO)$/swdetect.obj \
- $(SLO)$/swdet2.obj \
-@@ -193,7 +195,9 @@ SHL3STDLIBS= \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
-- $(SOTLIB)
-+ $(SOTLIB) \
-+ $(LIBXML2LIB)
-+
-
- SHL3LIBS= $(SLB)$/swui.lib
- LIB3TARGET = $(SLB)$/swui.lib
diff --git a/patches/test/template-management-ui.diff b/patches/test/template-management-ui.diff
deleted file mode 100644
index 7f85699a7..000000000
--- a/patches/test/template-management-ui.diff
+++ /dev/null
@@ -1,208 +0,0 @@
---- sfx2/source/doc/docvor.hrc.OLD Wed Sep 7 21:41:58 2005
-+++ sfx2/source/doc/docvor.hrc Tue Feb 7 15:34:11 2006
-@@ -66,6 +66,7 @@
- #define BTN_EDIT 105
- #define BTN_FILES 3
- #define BTN_ADDRESSTEMPLATE 4
-+#define BTN_IMPORT 5
- #define LB_LEFT 1
- #define FT_DEFAULT_TEMPLATE_LABEL 20
- #define FT_DEFAULT_TEMPLATE 21
---- sfx2/source/doc/docvor.src.OLD Fri Sep 23 18:28:14 2005
-+++ sfx2/source/doc/docvor.src Tue Feb 7 15:34:08 2006
-@@ -70,6 +70,15 @@
- DefButton = TRUE ;
- Text [ x-comment ] = " ";
- };
-+ PushButton BTN_IMPORT
-+ {
-+ Pos = MAP_APPFONT ( 205 , 63 ) ;
-+ Size = MAP_APPFONT ( 60 , 14 ) ;
-+ Text [ de ] = "Vorlage ~importieren..." ;
-+ Text [ en-US ] = "Import Template..." ;
-+ TabStop = TRUE ;
-+ Text [ x-comment ] = " ";
-+ };
- PushButton BTN_FILES
- {
- Pos = MAP_APPFONT ( 205 , 143 ) ;
---- sfx2/source/doc/docvor.cxx.OLD Fri Nov 11 16:24:31 2005
-+++ sfx2/source/doc/docvor.cxx Mon Feb 13 15:36:07 2006
-@@ -193,6 +193,7 @@
- MenuButton aEditBtn;
- HelpButton aHelpBtn;
- PushButton aAddressTemplateBtn;
-+ PushButton aImportBtn;
- PushButton aFilesBtn;
-
- Accelerator aEditAcc;
-@@ -202,6 +203,7 @@
-
- SvStringsDtor* GetAllFactoryURLs_Impl() const;
- sal_Bool GetServiceName_Impl( String& rFactoryURL, String& rFileURL ) const;
-+ void do_import( SvLBoxEntry *pEntry );
- long Dispatch_Impl( USHORT nId, Menu* _pMenu );
- String GetPath_Impl( BOOL bOpen, const String& rFileName );
- ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPaths_Impl( const String& rFileName );
-@@ -213,6 +215,7 @@
- DECL_LINK( AccelSelect_Impl, Accelerator * );
- DECL_LINK( MenuSelect_Impl, Menu * );
- DECL_LINK( MenuActivate_Impl, Menu * );
-+ DECL_LINK( Import_Impl, Button * );
- DECL_LINK( AddFiles_Impl, Button * );
- DECL_LINK( OnAddressTemplateClicked, Button * );
- BOOL DontDelete_Impl( SvLBoxEntry *pEntry);
-@@ -248,6 +251,7 @@
- aEditBtn ( pParent, ResId( BTN_EDIT ) ),
- aHelpBtn ( pParent, ResId( BTN_HELP ) ),
- aAddressTemplateBtn ( pParent, ResId( BTN_ADDRESSTEMPLATE ) ),
-+ aImportBtn ( pParent, ResId( BTN_IMPORT ) ),
- aFilesBtn ( pParent, ResId( BTN_FILES ) ),
-
- aEditAcc ( ResId( ACC_EDIT ) ),
-@@ -298,6 +302,9 @@
- aEditAcc.SetSelectHdl( LINK( this, SfxOrganizeDlg_Impl, AccelSelect_Impl ) );
- GetpApp()->InsertAccel( &aEditAcc );
-
-+ aImportBtn.SetClickHdl(
-+ LINK(this,SfxOrganizeDlg_Impl, Import_Impl));
-+ aImportBtn.Enable( FALSE );
- aFilesBtn.SetClickHdl(
- LINK(this,SfxOrganizeDlg_Impl, AddFiles_Impl));
- aAddressTemplateBtn.SetClickHdl(
-@@ -1828,6 +1835,52 @@
- return bRet;
- }
-
-+void SfxOrganizeDlg_Impl::do_import( SvLBoxEntry *pEntry )
-+{
-+ USHORT nRegion = 0, nIndex = 0;
-+ GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex );
-+
-+ ::com::sun::star::uno::Sequence < ::rtl::OUString > Paths = GetPaths_Impl( String() );
-+ sal_Int32 nCount = Paths.getLength();
-+ if( nCount == 1 )
-+ {
-+ String aPath = String( Paths.getArray()[0] );
-+ if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-+ {
-+ String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-+ aText.SearchAndReplaceAscii( "$1", aPath );
-+ ErrorBox( pDialog, WB_OK, aText ).Execute();
-+ }
-+ }
-+ else if( nCount > 1)
-+ {
-+ INetURLObject aPathObj( Paths[0] );
-+ aPathObj.setFinalSlash();
-+ for ( USHORT i = 1; i<nCount; ++i )
-+ {
-+ if ( i == 1 )
-+ aPathObj.Append( Paths[i] );
-+ else
-+ aPathObj.setName( Paths[i] );
-+ String aPath = aPathObj.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-+ {
-+ String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-+ aText.SearchAndReplaceAscii( "$1", aPath );
-+ ErrorBox( pDialog, WB_OK, aText ).Execute();
-+ }
-+ }
-+ }
-+
-+ /*String aPath = GetPath_Impl( TRUE, String() );
-+ if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-+ {
-+ String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-+ aText.SearchAndReplaceAscii( "$1", aPath );
-+ ErrorBox( pDialog, WB_OK, aText ).Execute();
-+ }*/
-+}
-+
- long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu )
-
- /* [Beschreibung]
-@@ -1960,48 +2013,7 @@
- {
- if ( !pEntry )
- return 1;
-- USHORT nRegion = 0, nIndex = 0;
-- GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex );
--
-- ::com::sun::star::uno::Sequence < ::rtl::OUString > Paths = GetPaths_Impl( String() );
-- sal_Int32 nCount = Paths.getLength();
-- if( nCount == 1 )
-- {
-- String aPath = String( Paths.getArray()[0] );
-- if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-- {
-- String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-- aText.SearchAndReplaceAscii( "$1", aPath );
-- ErrorBox( pDialog, WB_OK, aText ).Execute();
-- }
-- }
-- else if( nCount > 1)
-- {
-- INetURLObject aPathObj( Paths[0] );
-- aPathObj.setFinalSlash();
-- for ( USHORT i = 1; i<nCount; ++i )
-- {
-- if ( i == 1 )
-- aPathObj.Append( Paths[i] );
-- else
-- aPathObj.setName( Paths[i] );
-- String aPath = aPathObj.GetMainURL( INetURLObject::NO_DECODE );
-- if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-- {
-- String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-- aText.SearchAndReplaceAscii( "$1", aPath );
-- ErrorBox( pDialog, WB_OK, aText ).Execute();
-- }
-- }
-- }
--
-- /*String aPath = GetPath_Impl( TRUE, String() );
-- if ( aPath.Len() && !aMgr.CopyFrom( pFocusBox, nRegion, nIndex, aPath ) )
-- {
-- String aText( SfxResId( STR_ERROR_COPY_TEMPLATE ) );
-- aText.SearchAndReplaceAscii( "$1", aPath );
-- ErrorBox( pDialog, WB_OK, aText ).Execute();
-- }*/
-+ do_import( pEntry );
- break;
- }
-
-@@ -2263,6 +2275,13 @@
- if(pFocusBox && pFocusBox != pBox)
- pFocusBox->SelectAll(FALSE);
- pFocusBox = pBox;
-+ BOOL bEnable = ( pFocusBox && pFocusBox->GetSelectionCount() );
-+ SvLBoxEntry* pEntry = bEnable ? pFocusBox->FirstSelected() : NULL;
-+ const USHORT nDepth =
-+ ( bEnable && pFocusBox->GetSelectionCount() ) ? pFocusBox->GetModel()->GetDepth( pEntry ) : 0;
-+ const USHORT nDocLevel = bEnable ? pFocusBox->GetDocLevel() : 0;
-+ aImportBtn.Enable( SfxOrganizeListBox_Impl::VIEW_TEMPLATES == pFocusBox->GetViewType() &&
-+ ( nDepth == nDocLevel || nDepth == nDocLevel - 1 ));
- aFilesBtn.Enable( SfxOrganizeListBox_Impl::VIEW_FILES ==
- pFocusBox->GetViewType() );
- return 0;
-@@ -2346,6 +2365,18 @@
- svt::AddressBookSourceDialog aDialog(pDialog, ::comphelper::getProcessServiceFactory());
- aDialog.Execute();
- return 0L;
-+}
-+
-+//-------------------------------------------------------------------------
-+
-+IMPL_LINK( SfxOrganizeDlg_Impl, Import_Impl, Button *, pButton )
-+{
-+ BOOL bEnable = ( pFocusBox && pFocusBox->GetSelectionCount() );
-+ SvLBoxEntry* pEntry = bEnable ? pFocusBox->FirstSelected() : NULL;
-+ if (!pEntry)
-+ return 1;
-+ do_import( pEntry );
-+ return 0;
- }
-
- //-------------------------------------------------------------------------
diff --git a/patches/test/vba-basic-macrochoose-dialog.diff b/patches/test/vba-basic-macrochoose-dialog.diff
deleted file mode 100644
index d453ad4f6..000000000
--- a/patches/test/vba-basic-macrochoose-dialog.diff
+++ /dev/null
@@ -1,309 +0,0 @@
---- basctl/source/basicide/bastype2.hxx.orig 2008-09-23 15:42:34.000000000 +0800
-+++ basctl/source/basicide/bastype2.hxx 2008-09-23 15:47:02.000000000 +0800
-@@ -42,7 +42,7 @@
- #include <sbxitem.hxx>
- #include "basobj.hxx"
-
--enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD };
-+enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_FORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
-
- #define BROWSEMODE_MODULES 0x01
- #define BROWSEMODE_SUBS 0x02
-@@ -164,6 +164,8 @@ protected:
-
- void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
- void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
---- basctl/source/basicide/bastype2.cxx.orig 2008-09-23 15:42:50.000000000 +0800
-+++ basctl/source/basicide/bastype2.cxx 2008-09-23 15:54:35.000000000 +0800
-@@ -53,10 +53,25 @@
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <comphelper/processfactory.hxx>
- #include <comphelper/componentcontext.hxx>
-+#include <map>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
-
-+static const rtl::OUString sDocumentObjects( rtl::OUString::createFromAscii("Document Objects") );
-+static const rtl::OUString sForms( rtl::OUString::createFromAscii("Forms") );
-+static const rtl::OUString sModules( rtl::OUString::createFromAscii("Modules") );
-+static const rtl::OUString sClassModules( rtl::OUString::createFromAscii("Class Modules") );
-+
-+sal_Int32 lcl_getModuleType( StarBASIC* pBasic, const String& rName )
-+{
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-+ SbModule* pModule = (SbModule*)pBasic->FindModule( rName );
-+ if( pModule )
-+ nType = pModule->GetModuleType();
-+ return nType;
-+}
-
- BasicEntry::~BasicEntry()
- {
-@@ -285,18 +300,25 @@ void BasicTreeListBox::ImpCreateLibSubEn
-
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
-- try
-- {
-+ BasicManager* pBasMgr = rDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( rLibName ) : 0;
-+ sal_Bool bVBAEnabled = pBasic ? pBasic->isVBAEnabled(): sal_False;
-+ if( bVBAEnabled )
-+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
-+ else
-+ {
-+ try
-+ {
- // get a sorted list of module names
-- Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-- sal_Int32 nModCount = aModNames.getLength();
-- const ::rtl::OUString* pModNames = aModNames.getConstArray();
--
-- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-- {
-- String aModName = pModNames[ i ];
-- SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-- if ( !pModuleEntry )
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
- pModuleEntry = AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
-@@ -304,17 +326,17 @@ void BasicTreeListBox::ImpCreateLibSubEn
- pLibRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-
-- // methods
-- if ( nMode & BROWSEMODE_SUBS )
-- {
-- Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-- sal_Int32 nCount = aNames.getLength();
-- const ::rtl::OUString* pNames = aNames.getConstArray();
--
-- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-- {
-- String aName = pNames[ j ];
-- SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
- if ( !pEntry )
- pEntry = AddEntry(
- aName,
-@@ -322,14 +344,15 @@ void BasicTreeListBox::ImpCreateLibSubEn
- Image( IDEResId( RID_IMG_MACRO_HC ) ),
- pModuleEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-- }
-- }
-- }
-- }
-- catch ( const container::NoSuchElementException& )
-- {
-+ }
-+ }
-+ }
-+ }
-+ catch ( const container::NoSuchElementException& )
-+ {
- DBG_UNHANDLED_EXCEPTION();
-- }
-+ }
-+ }
- }
- }
-
-@@ -368,6 +391,115 @@ void BasicTreeListBox::ImpCreateLibSubEn
- }
- }
-
-+void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ ::std::map< BasicEntryType, ::rtl::OUString > aEntryMap;
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, sDocumentObjects ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_FORMS, sForms ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, sModules ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, sClassModules ) );
-+
-+ ::std::map< BasicEntryType, ::rtl::OUString >::iterator iter;
-+ for( iter = aEntryMap.begin(); iter != aEntryMap.end(); ++iter )
-+ {
-+ BasicEntryType eType = iter->first;
-+ ::rtl::OUString aEntryName = iter->second;
-+ SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
-+ if( pLibSubRootEntry )
-+ {
-+ SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) );
-+ if ( IsExpanded( pLibSubRootEntry ) )
-+ ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
-+ }
-+ else
-+ {
-+ pLibSubRootEntry = AddEntry(
-+ aEntryName,
-+ Image( IDEResId( RID_IMG_MODLIB ) ),
-+ Image( IDEResId( RID_IMG_MODLIB_HC ) ),
-+ pLibRootEntry, true,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
-+ }
-+ }
-+}
-+
-+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ BasicManager* pBasMgr = rDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( rLibName ) : 0;
-+ OSL_ENSURE( pBasic, "BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode: StartBASIC is NULL!" );
-+ if( !pBasic )
-+ return;
-+
-+ try
-+ {
-+ // get a sorted list of module names
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
-+ BasicEntryType eCurrentType( aDesc.GetType() );
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-+ switch( lcl_getModuleType( pBasic, aModName ) )
-+ {
-+ case script::ModuleType::Document:
-+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
-+ break;
-+ case script::ModuleType::Form:
-+ eType = OBJ_TYPE_FORMS;
-+ break;
-+ case script::ModuleType::Normal:
-+ eType = OBJ_TYPE_NORMAL_MODULES;
-+ break;
-+ case script::ModuleType::Class:
-+ eType = OBJ_TYPE_CLASS_MODULES;
-+ break;
-+ }
-+ if( eType != eCurrentType )
-+ continue;
-+
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aModName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
-+ pModuleEntry = AddEntry(
-+ aModName,
-+ Image( IDEResId( RID_IMG_MODULE ) ),
-+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
-+ pLibSubRootEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-+
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ if ( !pEntry )
-+ pEntry = AddEntry(
-+ aName,
-+ Image( IDEResId( RID_IMG_MACRO ) ),
-+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
-+ pModuleEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-+ }
-+ }
-+ }
-+ }
-+ catch ( const container::NoSuchElementException& )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+}
-+
- void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
- {
- UpdateEntries();
---- basctl/source/basicide/bastype3.cxx.orig 2008-09-23 15:43:07.000000000 +0800
-+++ basctl/source/basicide/bastype3.cxx 2008-09-23 15:10:49.000000000 +0800
-@@ -134,6 +134,22 @@ void __EXPORT BasicTreeListBox::Requesti
- }
- }
- }
-+ else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
-+ || eType == OBJ_TYPE_FORMS
-+ || eType == OBJ_TYPE_NORMAL_MODULES
-+ || eType == OBJ_TYPE_CLASS_MODULES )
-+ {
-+ SvLBoxEntry* pLibRootEntry = GetParent( pEntry );
-+ if( pLibRootEntry )
-+ {
-+ BasicEntryDescriptor aLibDesc( GetEntryDescriptor( pLibRootEntry ) );
-+ if( aLibDesc.GetType() == OBJ_TYPE_LIBRARY )
-+ {
-+ String aLibName( aLibDesc.GetLibName() );
-+ ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
-+ }
-+ }
-+ }
- else {
- DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
- }
-@@ -240,6 +256,14 @@ SbxVariable* BasicTreeListBox::FindVaria
- // sbx dialogs removed
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_FORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ // skip, to find the child entry.
-+ continue;
-+ }
- default:
- {
- DBG_ERROR( "FindVariable: Unbekannter Typ!" );
-@@ -330,6 +354,15 @@ BasicEntryDescriptor BasicTreeListBox::G
- {
- aName = GetEntryText( pLE );
- eType = pBE->GetType();
-+ }
-+ break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_FORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ aName = GetEntryText( pLE );
-+ eType = pBE->GetType();
- }
- break;
- default:
diff --git a/patches/test/vba-directlocalvaraccess.diff b/patches/test/vba-directlocalvaraccess.diff
deleted file mode 100644
index e00c52cdf..000000000
--- a/patches/test/vba-directlocalvaraccess.diff
+++ /dev/null
@@ -1,598 +0,0 @@
-diff -r 869606102f87 basic/source/classes/image.cxx
---- a/basic/source/classes/image.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/classes/image.cxx Fri May 07 15:08:07 2010 +0100
-@@ -37,6 +37,47 @@
- #include <string.h> // memset() etc
- #include "image.hxx"
- #include <codegen.hxx>
-+
-+ProcRefHandler::ProcRefHandler( const String& procName ) : m_sName( procName ), m_nOffsetGen( 0 )
-+{
-+}
-+
-+UINT32
-+ProcRefHandler::getProcRefOffset( UINT32 nOp )
-+{
-+ INT32ToINT32::iterator it = mOpToOffsetMap.find( nOp );
-+ if ( it == mOpToOffsetMap.end() )
-+ {
-+ // generate Offset
-+ INT32 nOff = m_nOffsetGen++;
-+ mOpToOffsetMap[ nOp ] = nOff;
-+ mOffsetToOp[ nOff ] = nOp;
-+ return nOff;
-+ }
-+ return it->second;
-+}
-+
-+UINT32
-+ProcRefHandler::getIdForProcRefOffset( UINT32 nOffset )
-+{
-+ return mOffsetToOp[ nOffset ];
-+}
-+
-+ProcRefHandler* SbiImage::GetProcRef( const String& rProcName )
-+{
-+ ProcRefHandler* pHandler = NULL;
-+ vProcRefHandlers::iterator it_end = m_vPropRefHandlers.end();
-+ for ( vProcRefHandlers::iterator it = m_vPropRefHandlers.begin(); it != it_end; ++it )
-+ {
-+ if ( it->getName() == rProcName )
-+ {
-+ pHandler = &(*it);
-+ break;
-+ }
-+ }
-+ return pHandler;
-+}
-+
- SbiImage::SbiImage()
- {
- pStringOff = NULL;
-@@ -486,6 +527,19 @@
- * Accessing the image
- *
- **************************************************************************/
-+short SbiImage::GetIDForString( const String& rName )
-+{
-+ short nRes = 0;
-+ for ( short nId = 0; nId < nStrings; ++nId )
-+ {
-+ if ( rName == GetString( nId + 1 ) )
-+ {
-+ nRes = nId + 1;
-+ break;
-+ }
-+ }
-+ return nRes;
-+}
-
- // Note: IDs start with 1
- String SbiImage::GetString( short nId ) const
-diff -r 869606102f87 basic/source/comp/codegen.cxx
---- a/basic/source/comp/codegen.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/comp/codegen.cxx Fri May 07 15:08:07 2010 +0100
-@@ -333,7 +333,8 @@
- nCount = pParser->rEnumArray->Count();
- for (i = 0; i < nCount; i++)
- p->AddEnum((SbxObject *)pParser->rEnumArray->Get(i));
--
-+ // Set up local ref offsets for string ids
-+ p->SetProcRefs( pParser->GetProcRefs() );
- if( !p->IsError() )
- rMod.pImage = p;
- else
-diff -r 869606102f87 basic/source/comp/dim.cxx
---- a/basic/source/comp/dim.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/comp/dim.cxx Fri May 07 15:08:07 2010 +0100
-@@ -352,10 +352,14 @@
- nGblChain = 0;
- bGblDefs = bNewGblDefs = TRUE;
- break;
-- default: eOp2 = _LOCAL;
-+ default:
-+ eOp2 = _LOCAL;
- }
-+ INT32 nId = pDef->GetId();
-+ if ( eOp2 == _LOCAL && bVBASupportOn )
-+ nId = GetProcRefOffset( pProc, pDef->GetId() );
- aGen.Gen(
-- eOp2, pDef->GetId(),
-+ eOp2, nId,
- sal::static_int_cast< UINT16 >( pDef->GetType() ) );
- }
-
-diff -r 869606102f87 basic/source/comp/exprgen.cxx
---- a/basic/source/comp/exprgen.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/comp/exprgen.cxx Fri May 07 15:08:07 2010 +0100
-@@ -108,7 +108,9 @@
- bTreatFunctionAsParam = false;
- }
- if( !bTreatFunctionAsParam )
-+ {
- eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND;
-+ }
- }
- }
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
-@@ -126,10 +128,9 @@
- eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL :
- (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
- }
--
- if( eOp == _FIND )
- {
--
-+
- SbiProcDef* pProc = aVar.pDef->GetProcDef();
- if ( pGen->GetParser()->bClassModule )
- eOp = _FIND_CM;
-@@ -137,6 +138,10 @@
- {
- eOp = _FIND_STATIC;
- }
-+ if ( pGen->GetParser()->IsVBASupportOn() && ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND ) )
-+ {
-+ aVar.pDef->nLocalIndex = pGen->GetParser()->GetProcRefOffset( pGen->GetParser()->GetProc(), aVar.pDef->GetId() );
-+ }
- }
- for( SbiExprNode* p = this; p; p = p->aVar.pNext )
- {
-@@ -179,6 +184,9 @@
- // Falls das Bit 0x8000 gesetzt ist, hat die Variable
- // eine Parameterliste.
- USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
-+ if ( pGen->GetParser()->IsVBASupportOn() && ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND ) )
-+ nId = aVar.pDef->nLocalIndex ;
-+
- // Parameterliste aufbauen
- if( aVar.pPar && aVar.pPar->GetSize() )
- {
-@@ -197,7 +205,7 @@
- if( pProc->GetAlias().Len() )
- nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() );
- }
-- pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) );
-+ pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) );
-
- if( aVar.pvMorePar )
- {
-diff -r 869606102f87 basic/source/comp/parser.cxx
---- a/basic/source/comp/parser.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/comp/parser.cxx Fri May 07 15:08:07 2010 +0100
-@@ -123,6 +123,27 @@
- // 'this' : used in base member initializer list
- #pragma warning( disable: 4355 )
- #endif
-+
-+UINT32 SbiParser::GetProcRefOffset( SbiProcDef* pProcedure, INT32 nOp )
-+{
-+ INT32 nOffset = 0;
-+ // find the ProcRefHandler for Procedure
-+ // no procedure means initialization code, just give then a empty procedure name
-+ String pName;
-+ if ( pProcedure )
-+ pName = pProcedure->GetName();
-+ vProcRefHandlers::iterator it_end = m_vPropRefHandlers.end();
-+ for ( vProcRefHandlers::iterator it = m_vPropRefHandlers.begin(); it != it_end; ++it )
-+ {
-+ if ( it->getName() == pName )
-+ return it->getProcRefOffset( nOp );
-+ }
-+ // not found create new ProcRefHandler for pProc
-+ ProcRefHandler procOffsets( pName );
-+ nOffset = procOffsets.getProcRefOffset( nOp );
-+ m_vPropRefHandlers.push_back( procOffsets );
-+ return nOffset;
-+}
-
- SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
- : SbiTokenizer( pm->GetSource32(), pb ),
-diff -r 869606102f87 basic/source/comp/symtbl.cxx
---- a/basic/source/comp/symtbl.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/comp/symtbl.cxx Fri May 07 15:08:07 2010 +0100
-@@ -309,6 +309,7 @@
- pIn =
- pPool = NULL;
- nDefaultId = 0;
-+ nLocalIndex = 0;
- }
-
- SbiSymDef::~SbiSymDef()
-@@ -413,7 +414,7 @@
- : SbiSymDef( rName )
- , aParams( pParser->aGblStrings, SbPARAM ) // wird gedumpt
- , aLabels( pParser->aLclStrings, SbLOCAL ) // wird nicht gedumpt
-- , mbProcDecl( bProcDecl )
-+ , mbProcDecl( bProcDecl )
- {
- aParams.SetParent( &pParser->aPublics );
- pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); // Locals
-diff -r 869606102f87 basic/source/inc/image.hxx
---- a/basic/source/inc/image.hxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/inc/image.hxx Fri May 07 15:08:07 2010 +0100
-@@ -36,11 +36,32 @@
- #include <rtl/ustring.hxx>
- #endif
- #include <filefmt.hxx>
-+#include <vector>
-+#include <map>
-
- // Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet
- // den Zugriff auf die einzelnen Elemente.
-
- struct SbPublicEntry;
-+
-+typedef std::map< UINT32, UINT32 > INT32ToINT32;
-+
-+class ProcRefHandler
-+{
-+ INT32ToINT32 mOpToOffsetMap;
-+ INT32ToINT32 mOffsetToOp;
-+ String m_sName;
-+ INT32 m_nOffsetGen;
-+public:
-+ ProcRefHandler( const String& procName );
-+ UINT32 getProcRefOffset( UINT32 nOp );
-+ UINT32 getIdForProcRefOffset( UINT32 nOffset );
-+ bool hasProcRefOffset( UINT32 nOp ) { return mOpToOffsetMap.find( nOp ) != mOpToOffsetMap.end(); }
-+ String getName(){ return m_sName; }
-+ INT32 getMaxOffset() { return m_nOffsetGen; }
-+};
-+
-+typedef std::vector< ProcRefHandler > vProcRefHandlers;
-
- class SbiImage {
- friend class SbiCodeGen; // Compiler-Klassen, die die private-
-@@ -69,7 +90,11 @@
- void AddType(SbxObject *); // User-Type mit aufnehmen
- void AddEnum(SbxObject *); // Register enum type
-
-+ vProcRefHandlers m_vPropRefHandlers;
- public:
-+ short GetIDForString( const String& rName );
-+ void SetProcRefs( const vProcRefHandlers& rHandlers ) { m_vPropRefHandlers = rHandlers; }
-+ ProcRefHandler* GetProcRef( const String& rProcName );
- String aName; // Makroname
- ::rtl::OUString aOUSource; // Quellcode
- String aComment; // Kommentar
-diff -r 869606102f87 basic/source/inc/parser.hxx
---- a/basic/source/inc/parser.hxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/inc/parser.hxx Fri May 07 15:08:07 2010 +0100
-@@ -37,14 +37,15 @@
-
-
- #include <vector>
-+#include "image.hxx"
- typedef ::std::vector< String > IfaceVector;
-
- struct SbiParseStack;
--
- class SbiParser : public SbiTokenizer
- {
- friend class SbiExpression;
--
-+ vProcRefHandlers m_vPropRefHandlers;
-+
- SbiParseStack* pStack; // Block-Stack
- SbiProcDef* pProc; // aktuelle Prozedur
- SbiExprNode* pWithVar; // aktuelle With-Variable
-@@ -69,6 +70,9 @@
- void DefDeclare( BOOL bPrivate );
- void EnableCompatibility();
- public:
-+ vProcRefHandlers& GetProcRefs() { return m_vPropRefHandlers; }
-+ UINT32 GetProcRefOffset( SbiProcDef*, INT32 nOp );
-+ SbiProcDef* GetProc() { return pProc;}
- SbxArrayRef rTypeArray; // das Type-Array
- SbxArrayRef rEnumArray; // Enum types
- SbiStringPool aGblStrings; // der String-Pool
-diff -r 869606102f87 basic/source/inc/runtime.hxx
---- a/basic/source/inc/runtime.hxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/inc/runtime.hxx Fri May 07 15:08:07 2010 +0100
-@@ -312,6 +312,7 @@
- String aLibName; // Lib-Name fuer Declare-Call
- SbxArrayRef refParams; // aktuelle Prozedur-Parameter
- SbxArrayRef refLocals; // lokale Variable
-+ std::vector< SbxVariableRef* >* refLocalDefines;
- SbxArrayRef refArgv; // aktueller Argv
- // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
- //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern
-diff -r 869606102f87 basic/source/inc/symtbl.hxx
---- a/basic/source/inc/symtbl.hxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/inc/symtbl.hxx Fri May 07 15:08:07 2010 +0100
-@@ -137,6 +137,7 @@
- BOOL bParamArray : 1; // TRUE: ParamArray parameter
- USHORT nDefaultId; // Symbol number of default value
- public:
-+ sal_Int32 nLocalIndex;
- SbiSymDef( const String& );
- virtual ~SbiSymDef();
- virtual SbiProcDef* GetProcDef();
-diff -r 869606102f87 basic/source/runtime/runtime.cxx
---- a/basic/source/runtime/runtime.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/runtime/runtime.cxx Fri May 07 15:08:07 2010 +0100
-@@ -584,6 +584,7 @@
- #endif
- pRefSaveList = NULL;
- pItemStoreList = NULL;
-+ refLocalDefines = NULL;
- }
-
- SbiRuntime::~SbiRuntime()
-@@ -599,6 +600,18 @@
- RefSaveItem* pToDeleteItem = pItemStoreList;
- pItemStoreList = pToDeleteItem->pNext;
- delete pToDeleteItem;
-+ }
-+ if ( refLocalDefines )
-+ {
-+ std::vector< SbxVariableRef* >::iterator it_end = refLocalDefines->end();
-+ for ( std::vector< SbxVariableRef* >::iterator it = refLocalDefines->begin(); it!=it_end; ++it )
-+ {
-+ if ( (*it) )
-+ delete (*it);
-+ }
-+ refLocalDefines->clear();
-+ delete refLocalDefines;
-+ refLocalDefines = NULL;
- }
- }
-
-diff -r 869606102f87 basic/source/runtime/stdobj.cxx
---- a/basic/source/runtime/stdobj.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/runtime/stdobj.cxx Fri May 07 15:08:07 2010 +0100
-@@ -36,6 +36,7 @@
- #include <basic/sbstdobj.hxx>
- #include "rtlproto.hxx"
- #include "sbintern.hxx"
-+#include <hash_map>
-
- // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
- // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
-diff -r 869606102f87 basic/source/runtime/step2.cxx
---- a/basic/source/runtime/step2.cxx Fri May 07 11:11:46 2010 +0100
-+++ b/basic/source/runtime/step2.cxx Fri May 07 15:08:07 2010 +0100
-@@ -55,6 +55,17 @@
- using com::sun::star::uno::Reference;
-
- SbxVariable* getVBAConstant( const String& rName );
-+void initRefDefines( SbiImage* pImage, SbMethod* pMeth, std::vector< SbxVariableRef* >*& refLocalDefines )
-+{
-+ // pMeth == NULL ( means this is an initialisation routine running )
-+ ProcRefHandler* pHandler = pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
-+ if ( pHandler )
-+ {
-+ refLocalDefines = new std::vector< SbxVariableRef* >( pHandler->getMaxOffset() );
-+ }
-+ else
-+ StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
-+}
-
- // Suchen eines Elements
- // Die Bits im String-ID:
-@@ -63,14 +74,8 @@
- SbxVariable* SbiRuntime::FindElement
- ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
- {
-- bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
-- if( bIsVBAInterOp )
-- {
-- StarBASIC* pMSOMacroRuntimeLib = GetSbData()->pMSOMacroRuntimLib;
-- if( pMSOMacroRuntimeLib != NULL )
-- pMSOMacroRuntimeLib->ResetFlag( SBX_EXTSEARCH );
-- }
--
-+ UINT32 nOffSet = nOp1;
-+ ProcRefHandler* pHandler = NULL;
- SbxVariable* pElem = NULL;
- if( !pObj )
- {
-@@ -81,36 +86,68 @@
- {
- BOOL bFatalError = FALSE;
- SbxDataType t = (SbxDataType) nOp2;
-- String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
-- // Hacky capture of Evaluate [] syntax
-- // this should be tackled I feel at the pcode level
-- if ( bIsVBAInterOp && aName.Search('[') == 0 )
-- {
-- // emulate pcode here
-- StepARGC();
-- // psuedo StepLOADSC
-- String sArg = aName.Copy( 1, aName.Len() - 2 );
-- SbxVariable* p = new SbxVariable;
-- p->PutString( sArg );
-- PushVar( p );
-- //
-- StepARGV();
-- nOp1 = nOp1 | 0x8000; // indicate params are present
-- aName = String::CreateFromAscii("Evaluate");
-- }
-+ String aName;
-+
- if( bLocal )
- {
-- if ( bStatic )
-- {
-- if ( pMeth )
-+
-+ SbxVariableRef* pRef = NULL;
-+ if ( bVBAEnabled )
-+ {
-+ pRef = (*refLocalDefines)[ nOp1 & 0x7FFF ];
-+ if ( pRef )
-+ pElem = *pRef;
-+ }
-+ if ( !pElem ) // not locally defined
-+ {
-+ if ( bVBAEnabled )
-+ {
-+ pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
-+ if ( pHandler )
-+ {
-+ bool bHasParams = false;
-+ if ( nOp1 & 0x8000 )
-+ bHasParams = true;
-+ nOp1 = pHandler->getIdForProcRefOffset( nOp1 & 0x7FFF );
-+ if ( bHasParams )
-+ nOp1 = nOp1 | 0x8000;
-+ }
-+ }
-+ aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
-+ if ( bStatic && pMeth )
- pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
-+ if ( pElem && bVBAEnabled )
-+ ( *refLocalDefines )[ nOffSet & 0x7FFF ] = new SbxVariableRef( pElem );
- }
-+ }
-
-- if ( !pElem )
-- pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
-+ if( bVBAEnabled )
-+ {
-+ StarBASIC* pMSOMacroRuntimeLib = GetSbData()->pMSOMacroRuntimLib;
-+ if( pMSOMacroRuntimeLib != NULL )
-+ pMSOMacroRuntimeLib->ResetFlag( SBX_EXTSEARCH );
- }
-+
- if( !pElem )
- {
-+ if ( aName.Len() == 0 )
-+ aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
-+ // Hacky capture of Evaluate [] syntax
-+ // this should be tackled I feel at the pcode level
-+ if ( bVBAEnabled && aName.Len() && aName.GetBuffer()[0] == '[')
-+ {
-+ // emulate pcode here
-+ StepARGC();
-+ // psuedo StepLOADSC
-+ String sArg = aName.Copy( 1, aName.Len() - 2 );
-+ SbxVariable* p = new SbxVariable;
-+ p->PutString( sArg );
-+ PushVar( p );
-+ //
-+ StepARGV();
-+ nOp1 = nOp1 | 0x8000; // indicate params are present
-+ aName = String::CreateFromAscii("Evaluate");
-+ }
- // Die RTL brauchen wir nicht mehr zu durchsuchen!
- BOOL bSave = rBasic.bNoRtl;
- rBasic.bNoRtl = TRUE;
-@@ -171,7 +208,10 @@
- // deklarierten Vars automatisch global !
- if ( bSetName )
- pElem->SetName( aName );
-- refLocals->Put( pElem, refLocals->Count() );
-+ if ( bVBAEnabled )
-+ ( *refLocalDefines )[ nOffSet & 0x7FFF ] = new SbxVariableRef( pElem );
-+ else
-+ refLocals->Put( pElem, refLocals->Count() );
- }
- }
-
-@@ -217,7 +257,10 @@
- if( t != SbxVARIANT )
- pElem->SetFlag( SBX_FIXED );
- pElem->SetName( aName );
-- refLocals->Put( pElem, refLocals->Count() );
-+ if ( bVBAEnabled )
-+ ( *refLocalDefines )[ nOffSet & 0x7FFF ] = new SbxVariableRef( pElem );
-+ else
-+ refLocals->Put( pElem, refLocals->Count() );
- }
- }
- }
-@@ -294,7 +337,21 @@
- return NULL;
-
- // Lokal suchen
-- if( refLocals )
-+ if ( bVBAEnabled && refLocalDefines )
-+ {
-+ INT32 nOp1 = pMod->pImage->GetIDForString( rName );
-+ ProcRefHandler* pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
-+ if ( pHandler )
-+ {
-+ if ( pHandler->hasProcRefOffset( nOp1 ) )
-+ {
-+ SbxVariableRef* pRef = (*refLocalDefines)[ pHandler->getProcRefOffset( nOp1 ) ];
-+ if ( pRef )
-+ pElem = *pRef;
-+ }
-+ }
-+ }
-+ else if( refLocals )
- pElem = refLocals->Find( rName, SbxCLASS_DONTCARE );
-
- // In Statics suchen
-@@ -304,7 +361,10 @@
- String aMethName = pMeth->GetName();
- aMethName += ':';
- aMethName += rName;
-- pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
-+ if ( !pElem )
-+ pElem = pMeth->GetStatics()->Find( aMethName, SbxCLASS_DONTCARE );
-+ if ( !pElem )
-+ pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
- }
-
- // In Parameter-Liste suchen
-@@ -608,8 +668,11 @@
- void
- SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
- {
-+
- if( !refLocals )
- refLocals = new SbxArray;
-+ if( bVBAEnabled && !refLocalDefines )
-+ initRefDefines( pMod->pImage, pMeth, refLocalDefines );
- PushVar( FindElement( pObj, nOp1, nOp2, nNotFound, bLocal, bStatic ) );
- }
- // Laden einer lokalen/globalen Variablen (+StringID+Typ)
-@@ -1083,15 +1146,38 @@
-
- void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
- {
-- if( !refLocals.Is() )
-- refLocals = new SbxArray;
-- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-- if( refLocals->Find( aName, SbxCLASS_DONTCARE ) == NULL )
-+ if ( bVBAEnabled )
- {
-+ if ( !refLocalDefines )
-+ {
-+ initRefDefines( pMod->pImage, pMeth, refLocalDefines );
-+ }
- SbxDataType t = (SbxDataType) nOp2;
-- SbxVariable* p = new SbxVariable( t );
-- p->SetName( aName );
-- refLocals->Put( p, refLocals->Count() );
-+ (*refLocalDefines)[ nOp1 ] = new SbxVariableRef( new SbxVariable( t ) );
-+ ProcRefHandler* pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
-+#if 0 // do we need to set the name ?
-+ if ( pHandler )
-+ {
-+ UINT32 nTmpOp1 = pHandler->getIdForProcRefOffset( nOp1 & 0x7FFF );
-+ String aName = pImg->GetString( static_cast<short>( nTmpOp1 ) );
-+ SbxVariable* pElem = *(*refLocalDefines)[ nOp1 ];
-+ pElem->SetName( aName );
-+ }
-+#endif
-+ //p->SetName( aName );
-+ }
-+ else
-+ {
-+ if( !refLocals.Is() )
-+ refLocals = new SbxArray;
-+ String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-+ if( refLocals->Find( aName, SbxCLASS_DONTCARE ) == NULL )
-+ {
-+ SbxDataType t = (SbxDataType) nOp2;
-+ SbxVariable* p = new SbxVariable( t );
-+ p->SetName( aName );
-+ refLocals->Put( p, refLocals->Count() );
-+ }
- }
- }
-
diff --git a/patches/test/vba-export-dir.diff b/patches/test/vba-export-dir.diff
deleted file mode 100644
index 36e1c7d29..000000000
--- a/patches/test/vba-export-dir.diff
+++ /dev/null
@@ -1,1622 +0,0 @@
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ svx/source/msfilter/msvbasicdir.hxx 2007-06-29 16:21:42.000000000 +0100
-@@ -0,0 +1,95 @@
-+#ifndef _MSVBASICDIR_HXX
-+#define _MSVBASICDIR_HXX
-+
-+#ifdef _SOLAR_H
-+#include <tools/solar.h>
-+#endif
-+#ifndef _TOOLS_DEBUG_HXX
-+#include <tools/debug.hxx>
-+#endif
-+#ifndef _SVSTOR_HXX //autogen
-+#include <sot/storage.hxx>
-+#endif
-+#ifndef _DYNARY_HXX
-+#include <tools/dynary.hxx>
-+#endif
-+#ifndef __SGI_STL_VECTOR
-+#include <vector>
-+#endif
-+#include <map>
-+#include "svxmsbas.hxx"
-+namespace MSLZSS {
-+ void compressString( SvStream *pStream, const rtl::OString &rString );
-+ void compressStream( SvStream *pStream, SvStream *pInStream );
-+ SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL );
-+ rtl::OString decompressAsString( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL );
-+};
-+
-+// An unset strings is 0 length & looks like a flag ...
-+
-+#define VBA_DIR_LONG_START 0x01 // seemingly always 1
-+#define VBA_DIR_LONG_ENCODING_1 0x02 // normally 0x409
-+#define VBA_DIR_SHORT_VERSION_1 0x03 // seemingly always 0x4e4
-+#define VBA_DIR_STR_PROJECT_NAME 0x04
-+#define VBA_DIR_STR_DESCRIPTION 0x05
-+#define VBA_DIR_STR_HELP_FILENAME 0x06
-+#define VBA_DIR_LONG_HELP_CTXT_ID 0x07
-+#define VBA_DIR_LONG_UNKNOWN_0x08 0x08
-+#define VBA_DIR_OP_PAPER_SIZE 0x09
-+#define VBA_DIR_STR_COND_COMP_ARGS 0x0c
-+#define VBA_DIR_EXTERNAL_LINKAGE 0x0d
-+#define VBA_DIR_SHORT_OBJECT_COUNT 0x0f
-+#define VBA_DIR_FLAG_END 0x10 // ?
-+#define VBA_DIR_SHORT_UNKNOWN_0x13 0x13
-+#define VBA_DIR_LONG_ENCODING_2 0x14 // normally 0x409
-+#define VBA_DIR_STR_STREAM_TYPE 0x16
-+#define VBA_DIR_STR_USER_NAME 0x19
-+#define VBA_DIR_STR_STREAM_NAME 0x1a
-+#define VBA_DIR_STR_UNKNOWN_0x1c 0x1c
-+#define VBA_DIR_LONG_UNKNOWN_0x1e 0x1e
-+#define VBA_DIR_FLAG_MACRO 0x21
-+#define VBA_DIR_FLAG_DOCUMENT 0x22
-+#define VBA_DIR_CLASS_MODULE 0x28
-+#define VBA_DIR_SHORT_UNKNOWN_0x2c 0x2c
-+#define VBA_DIR_OBJECT_END 0x2b
-+#define VBA_DIR_LONG_VBA_OFFSET 0x31
-+#define VBA_DIR_USTR_STREAM_NAME 0x32
-+#define VBA_DIR_USTR_COND_COMP_ARGS 0x3c
-+#define VBA_DIR_USTR_HELP_FILENAME 0x3d
-+#define VBA_DIR_USTR_STREAM_TYPE 0x3e
-+#define VBA_DIR_USTR_DESCRIPTION 0x40
-+#define VBA_DIR_USTR_USER_NAME 0x47
-+#define VBA_DIR_USTR_UNKNOWN_0x48 0x48
-+typedef ::std::map< UniString, sal_Int16 > ModuleTypeHash;
-+class VBADir
-+{
-+private:
-+ SvStorageRef mxStorage;
-+ SvStorageRef mxProjectStorage;
-+ // #117718# member map of module names to types of module
-+ ModuleTypeHash mhModHash;
-+ bool mbMac;
-+ bool mbInited;
-+ rtl_TextEncoding meCharSet;
-+ void deleteSRPs();
-+ void clobberProject();
-+ rtl::OUString stripOptions( const rtl::OUString &rSource, sal_Int16 rType );
-+ void writeModule( const rtl::OUString &rName, const rtl::OUString &rSource, sal_Int16 rType );
-+ void init();
-+ //0 for failure, anything else for success, determines encoding,
-+ //product, if this is a mac doc etc.
-+ int Read_VBA_PROJECT();
-+ //reads the PROJECT stream to determine Module types
-+ void Read_VBAPROJECT();
-+public:
-+ VBADir( SvStorageRef &xProjectStorage, SvStorageRef &xStorage );
-+ ~VBADir();
-+
-+ bool readBasic( SfxObjectShell &rDocSh, bool bComment, bool bStripped );
-+ bool writeBasic( SfxObjectShell &rDocSh );
-+ // #117718# member map of module names to types of module
-+ sal_Int16 GetModuleType( const UniString& rModuleName ) const;
-+};
-+
-+
-+#endif // _MSVBASICDIR_HXX
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ svx/source/msfilter/msvbasicdir.cxx 2007-06-29 16:23:34.000000000 +0100
-@@ -0,0 +1,1521 @@
-+#include <string.h> // memset(), ...
-+#ifndef UNX
-+#include <io.h> // access()
-+#endif
-+#ifndef _SFX_OBJSH_HXX
-+#include <sfx2/objsh.hxx>
-+#endif
-+#ifndef _SFXAPP_HXX
-+#include <sfx2/app.hxx>
-+#endif
-+#ifndef _BASMGR_HXX
-+#include <basic/basmgr.hxx>
-+#endif
-+#ifndef _SB_SBMOD_HXX
-+#include <basic/sbmod.hxx>
-+#endif
-+#ifndef _SVXERR_HXX
-+#include <svxerr.hxx>
-+#endif
-+#ifndef _SOT_STORINFO_HXX
-+#include <sot/storinfo.hxx>
-+#endif
-+#ifndef _MSVBASIC_HXX
-+#include "msvbasicdir.hxx"
-+#endif
-+#ifndef _RTL_TENCINFO_H
-+#include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
-+#endif
-+
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/i18n/TransliterationModules.hpp>
-+#include <com/sun/star/embed/XStorage.hpp>
-+
-+#include <vcl/svapp.hxx>
-+#include <unotools/textsearch.hxx>
-+#include <fstream>
-+using namespace com::sun::star::container;
-+using namespace com::sun::star::script;
-+using namespace com::sun::star::script::ModuleType;
-+using namespace com::sun::star::uno;
-+using namespace com::sun::star::lang;
-+using namespace com::sun::star::embed;
-+using namespace rtl;
-+
-+#define nWINDOWLEN 4096
-+#define STANDARD RTL_CONSTASCII_USTRINGPARAM("Standard")
-+
-+static unsigned int
-+getShift( sal_uInt32 nPos )
-+{
-+ if (nPos <= 0x80) {
-+ if (nPos <= 0x20)
-+ return (nPos <= 0x10) ? 12 : 11;
-+ else
-+ return (nPos <= 0x40) ? 10 : 9;
-+ } else {
-+ if (nPos <= 0x200)
-+ return (nPos <= 0x100) ? 8 : 7;
-+ else if (nPos <= 0x800)
-+ return (nPos <= 0x400) ? 6 : 5;
-+ else
-+ return 4;
-+ }
-+}
-+
-+struct CompressBuffer {
-+ // buffer for match making
-+ UINT8 mpBuffer[ nWINDOWLEN ];
-+ sal_Int32 mnLength;
-+
-+ // output buffering
-+ SvStream *mpOutput;
-+ UINT8 mnMask;
-+ UINT8 maBlock[16];
-+ UINT8 mnBlockLength;
-+ UINT8 mnShift;
-+
-+ CompressBuffer( SvStream *pOutput )
-+ {
-+ memset( mpBuffer, 0, sizeof( mpBuffer ) );
-+ mnLength = 0;
-+ mnBlockLength = 0;
-+ mpOutput = pOutput;
-+ mnShift = 0;
-+ mnMask = 0;
-+ }
-+
-+ void
-+ flush()
-+ {
-+ if( mnBlockLength ) {
-+ *mpOutput << mnMask;
-+ mpOutput->Write( maBlock, mnBlockLength );
-+ mnBlockLength = 0;
-+ mnMask = mnShift = 0;
-+ }
-+ }
-+
-+ void outputData( UINT8 *pData, bool bCompressed )
-+ {
-+ if (bCompressed)
-+ {
-+ mnMask |= 1 << mnShift;
-+ maBlock[ mnBlockLength++ ] = pData[0];
-+ maBlock[ mnBlockLength++ ] = pData[1];
-+ }
-+ else
-+ maBlock[ mnBlockLength++ ] = pData[0];
-+
-+ if( ++mnShift == 8)
-+ flush();
-+ }
-+
-+ void
-+ outputMatch( sal_uInt32 nCurPos, sal_uInt32 nMatchPos, sal_uInt32 nLength )
-+ {
-+ sal_uInt32 nShift, nToken, nDistance;
-+ UINT8 aData[2];
-+
-+ nShift = getShift( nCurPos );
-+
-+ nDistance = nCurPos - nMatchPos - 1;
-+ nToken = (nDistance << nShift) + ((nLength - 3) & ((1<<nShift)-1));
-+
-+ aData[0] = nToken & 0xff;
-+ aData[1] = nToken >> 8;
-+
-+ outputData( aData, TRUE );
-+ }
-+
-+ sal_Int32 /* Unbelievably slow, but ... */
-+ findMatch (sal_Int32 nPos, sal_Int32 &rnLen)
-+ {
-+ sal_Int32 i;
-+ sal_Int32 max_match = (1 << getShift( nPos ) ) - 1;
-+
-+ /* FIXME: the MS impl. does different to a linear search here
-+ and is not very good at this either; is happy to get much
-+ worse matches; perhaps some single-entry match lookup table ?
-+ it seems to ~regularly truncate strings, and get earlier
-+ / later matches of equivalent length with no predictability
-+ ( hashing ? ).
-+ */
-+ for (i = nPos - 1; i >= 0; i--)
-+ {
-+ sal_Int32 j;
-+
-+ for (j = 0; j < mnLength - nPos && j < nPos; j++)
-+ if (mpBuffer[nPos + j] != mpBuffer[i + j])
-+ break;
-+
-+ if (j >= 3)
-+ {
-+ if( j > max_match )
-+ j = max_match;
-+ rnLen = j;
-+ return i;
-+ }
-+ }
-+ return -1;
-+ }
-+
-+ bool
-+ readBlock( SvStream *pInStream )
-+ {
-+ mnLength = pInStream->Read( mpBuffer, nWINDOWLEN );
-+ return mnLength > 0;
-+ }
-+};
-+
-+static void
-+compressBlock( CompressBuffer &rBuffer )
-+{
-+ sal_Int32 nPos, nMatchLen;
-+ int nMatchPos;
-+
-+ for (nPos = 0; nPos < rBuffer.mnLength;)
-+ {
-+ if ((nMatchPos = rBuffer.findMatch( nPos, /* ref */ nMatchLen )) >= 0)
-+ {
-+ rBuffer.outputMatch( nPos, nMatchPos, nMatchLen );
-+ nPos += nMatchLen;
-+ }
-+ else
-+ rBuffer.outputData( &(rBuffer.mpBuffer[ nPos++ ]), FALSE );
-+ }
-+}
-+namespace MSLZSS {
-+
-+void compressStream( SvStream *pStream, SvStream *pInStream )
-+{
-+ sal_uInt32 nStartPos = pStream->Tell();
-+ pStream->Seek( nStartPos + 3 );
-+ CompressBuffer aBuffer( pStream );
-+
-+ while( aBuffer.readBlock( pInStream ) )
-+ compressBlock( aBuffer );
-+ aBuffer.flush();
-+
-+ sal_uInt32 nSize = pStream->Tell() - nStartPos;
-+ sal_uInt32 nLength = nSize - 3 - 1;
-+
-+ if( nLength > 0x0c0c ) /* TESTME: really right ? */
-+ nLength = 0x0c0c; /* follow-on chunk sizes ? */
-+
-+ pStream->Seek( nStartPos );
-+ *pStream << UINT8(0x01);
-+ *pStream << UINT8( nLength & 0xff);
-+ *pStream << UINT8( nLength >> 8 | 0xb0 );
-+}
-+
-+void
-+compressString( SvStream *pStream, const OString &rString )
-+{
-+ SvMemoryStream aStream( (void *) rString.getStr(), rString.getLength(), STREAM_READ );
-+ compressStream( pStream, &aStream );
-+}
-+
-+SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength, sal_uInt32 *pLength )
-+{
-+ SvMemoryStream *pResult;
-+
-+ pResult = new SvMemoryStream();
-+
-+ sal_uInt8 nLeadbyte;
-+ unsigned int nPos = 0;
-+ int nLen, nDistance, nShift, nClean=1;
-+ sal_uInt8 aHistory[ nWINDOWLEN ];
-+
-+ pStream->Seek( nOffset + 3 );
-+
-+ while( pStream->Read( &nLeadbyte, 1 ) )
-+ {
-+ for(int nMask=0x01; nMask < 0x100; nMask = nMask<<1)
-+ {
-+ // we see if the leadbyte has flagged this location as a dataunit
-+ // which is actually a token which must be looked up in the history
-+ if( nLeadbyte & nMask )
-+ {
-+ sal_uInt16 nToken;
-+
-+ *pStream >> nToken;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+
-+ //For some reason the division of the token into the length
-+ //field of the data to be inserted, and the distance back into
-+ //the history differs depending on how full the history is
-+ nShift = getShift( nPos % nWINDOWLEN );
-+
-+ nLen = (nToken & ((1<<nShift) - 1)) + 3;
-+ nDistance = nToken >> nShift;
-+
-+ //read the len of data from the history, wrapping around the
-+ //nWINDOWLEN boundary if necessary data read from the history
-+ //is also copied into the recent part of the history as well.
-+ for (int i = 0; i < nLen; i++)
-+ {
-+ unsigned char c;
-+ c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
-+ aHistory[nPos % nWINDOWLEN] = c;
-+ nPos++;
-+ }
-+ }
-+ else
-+ {
-+ // special boundary case code, not guarantueed to be correct
-+ // seems to work though, there is something wrong with the
-+ // compression scheme (or maybe a feature) where when the data
-+ // ends on a nWINDOWLEN boundary and the excess bytes in the 8
-+ // dataunit list are discarded, and not interpreted as tokens
-+ // or normal data.
-+ if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
-+ {
-+ pStream->SeekRel(2);
-+ nClean=0;
-+ pResult->Write( aHistory, nWINDOWLEN );
-+ break;
-+ }
-+ //This is the normal case for when the data unit is not a
-+ //token to be looked up, but instead some normal data which
-+ //can be output, and placed in the history.
-+ if (pStream->Read(&aHistory[nPos % nWINDOWLEN],1))
-+ nPos++;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+ }
-+ }
-+ }
-+ if (nPos % nWINDOWLEN)
-+ pResult->Write( aHistory, nPos % nWINDOWLEN );
-+ pResult->Flush();
-+
-+ if( pCompressedLength )
-+ *pCompressedLength = nPos;
-+
-+ if( pLength )
-+ *pLength = pResult->Tell();
-+
-+#if 0
-+ {
-+ fprintf( stderr, "Decompressed stream: %d bytes, size: %d\n",
-+ pResult->Tell(), pResult->GetSize() );
-+ pResult->Seek( 0 );
-+ UINT8 aData[8];
-+ sal_uInt32 nUrk = 0;
-+ UINT8 nCnt;
-+ while( ( nCnt = pResult->Read( aData, 8 ) ) > 0 )
-+ {
-+ int i;
-+ fprintf( stderr, "%.8x : ", nUrk);
-+ nUrk += nCnt;
-+ for( i = 0; i < nCnt; i++ )
-+ fprintf( stderr, "%.2x ", aData[i] );
-+
-+ fprintf( stderr," | " );
-+ for( i = 0; i < nCnt; i++ )
-+ fprintf( stderr, "%c", aData[i] >= 0x20 ? aData[i] : '.' );
-+ fprintf( stderr, "\n" );
-+ }
-+ }
-+#endif
-+
-+ pResult->Seek( 0 );
-+
-+ return pResult;
-+}
-+
-+OString decompressAsString( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength, sal_uInt32 *pLength )
-+{
-+ sal_uInt32 nResultLength;
-+ SvMemoryStream *pResultStream = decompressAsStream( pStream, nOffset, pCompressedLength, &nResultLength );
-+
-+ // Isn't it just marvelous that SvMemoryStream has no sensible 'size'
-+ // method that returns nEndOfData [!]
-+ if( pLength )
-+ *pLength = nResultLength;
-+
-+ OString aResult( (const sal_Char *)pResultStream->GetData(), nResultLength );
-+ delete pResultStream;
-+ return aResult;
-+}
-+
-+}; /* End MSLZSS */
-+
-+static void
-+stripAttributes( OUString &rVBA, bool bIsMac )
-+{
-+ OSL_TRACE("Strip Attributes - bIsMac = %d", bIsMac );
-+ const sal_Unicode cLineEnd = bIsMac ? '\x0D' : '\x0A';
-+ const rtl::OUString sAttribute( OUString::createFromAscii( "Attribute" ) );
-+ //OSL_TRACE("** Before strip %s", rtl::OUStringToOString( rVBA, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ while( rVBA.indexOf( sAttribute ) == 0 )
-+ {
-+ sal_Int32 nEnd = rVBA.indexOf( cLineEnd );
-+ if( nEnd == -1 )
-+ break;
-+ rVBA = rVBA.copy( nEnd + 1 );
-+ }
-+ //OSL_TRACE("** After strip %s", rtl::OUStringToOString( rVBA, RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+static void
-+commentSource( OUString &rVBA, const OUString &rName, bool bIsMac )
-+{
-+ OUString sTempStringa(OUString::createFromAscii(
-+ bIsMac ? "\x0D": "\x0D\x0A"));
-+ OUString sTempStringb( sTempStringa );
-+ OUString sTempRem = OUString::createFromAscii( "Rem " );
-+ sTempStringb += sTempRem;
-+ sal_Int32 nFromIndex = 0;
-+ sal_Int32 nToIndex = -1;
-+ while( (nToIndex = rVBA.indexOf( sTempStringa, nFromIndex ) ) != -1 )
-+ {
-+ rVBA = rVBA.replaceAt( nToIndex, sTempStringa.getLength(), sTempStringb);
-+ nFromIndex = nToIndex += sTempStringb.getLength();
-+ }
-+ rVBA = sTempRem + rVBA;
-+
-+ // Streams can have spaces in them, but modulenames
-+ // cannot !
-+ rtl::OUString sTemp( rtl::OUString::createFromAscii( "Sub " ) );
-+ sTemp += rName.replace( sal_Unicode(' '), sal_Unicode('_') );
-+ sTemp += OUString::createFromAscii("\n");
-+ rVBA = sTemp + rVBA;
-+ rVBA += OUString::createFromAscii("\nEnd Sub");
-+}
-+
-+struct DirTokenizer {
-+ SvStream *mpStream;
-+ sal_uInt16 mnToken;
-+ sal_Int32 mnLength;
-+ sal_uInt32 mnConsumed;
-+ bool mnbEof;
-+
-+ DirTokenizer( SvStream *pStream ) :
-+ mpStream(pStream), mnToken(0),
-+ mnLength(0), mnConsumed(0),
-+ mnbEof(false) {}
-+ ~DirTokenizer() {}
-+
-+ bool
-+ nextToken()
-+ {
-+ mpStream->SeekRel( mnLength - mnConsumed );
-+
-+ mnToken = mnLength = mnConsumed = 0;
-+
-+ // Seeking clears the eof marker - so read first ...
-+ *mpStream >> mnToken;
-+ if( mpStream->IsEof() )
-+ return !(mnbEof = true);
-+
-+ *mpStream >> mnLength;
-+ if( mpStream->IsEof() )
-+ return !(mnbEof = true);
-+
-+ if( mnToken == VBA_DIR_OP_PAPER_SIZE ) /* Quirk */
-+ mnLength += 2;
-+
-+ OSL_TRACE("Next token 0x%x (%d long)", mnToken, mnLength );
-+
-+ return true;
-+ }
-+
-+ bool
-+ isEof()
-+ {
-+ return mnbEof;
-+ }
-+
-+ sal_uInt32
-+ getLong()
-+ {
-+ sal_uInt32 nResult;
-+ mnConsumed += 4;
-+ *mpStream >> nResult;
-+ return nResult;
-+ }
-+
-+ sal_uInt16
-+ getShort()
-+ {
-+ sal_uInt16 nResult;
-+ mnConsumed += 2;
-+ *mpStream >> nResult;
-+ return nResult;
-+ }
-+
-+ OUString
-+ getUString()
-+ {
-+ sal_Unicode aData[ ( mnLength + 1 ) / 2 ];
-+ mpStream->Read( aData, mnLength );
-+ mnConsumed += mnLength;
-+ return OUString( aData, mnLength/2 );
-+ }
-+
-+ OUString
-+ getString()
-+ {
-+ sal_Char aData[ mnLength ];
-+ mpStream->Read( aData, mnLength );
-+ mnConsumed += mnLength;
-+ return OUString( aData, mnLength, RTL_TEXTENCODING_MS_1252 );
-+ }
-+
-+ Reference< XNameContainer >
-+ parseHeader( const Reference< XLibraryContainer > &xLibContainer )
-+ {
-+ Reference< XNameContainer > xLib;
-+
-+ if( !xLibContainer.is() )
-+ return xLib;
-+
-+ // Parse the header
-+ while( nextToken() && mnToken != VBA_DIR_SHORT_OBJECT_COUNT )
-+ {
-+ switch( mnToken )
-+ {
-+ case VBA_DIR_STR_PROJECT_NAME:
-+// aProjectName = getString(); - this causes export grief.
-+ break;
-+ }
-+ }
-+
-+ if( !mnToken )
-+ return xLib;
-+
-+ OUString aProjectName = OUString::createFromAscii( "Standard" );
-+ OSL_TRACE( "CreateLibrary: '%s'",
-+ (const sal_Char *) rtl::OUStringToOString(
-+ aProjectName, RTL_TEXTENCODING_UTF8 ) );
-+
-+ if( !xLibContainer->hasByName( aProjectName ) )
-+ xLibContainer->createLibrary( aProjectName );
-+
-+ Any aLibAny = xLibContainer->getByName( aProjectName );
-+ aLibAny >>= xLib;
-+
-+ return xLib;
-+ }
-+
-+ bool
-+ readObject( const SvStorageRef &xStorage,
-+ Reference< XNameContainer > &xLib,
-+ const VBADir& rVBA,
-+ bool bStripped, bool bAsComment, bool bIsMac )
-+ {
-+ OUString aName;
-+ sal_uInt32 nOffset = 0;
-+ OUString aStreamName;
-+
-+ while( nextToken() && mnToken != VBA_DIR_OBJECT_END )
-+ {
-+ switch( mnToken )
-+ {
-+ case VBA_DIR_STR_USER_NAME:
-+ aName = getString();
-+ break;
-+ case VBA_DIR_USTR_USER_NAME:
-+ aName = getUString();
-+ break;
-+ case VBA_DIR_STR_STREAM_NAME:
-+ aStreamName = getString();
-+ break;
-+ case VBA_DIR_USTR_STREAM_NAME:
-+ aStreamName = getUString();
-+ break;
-+ case VBA_DIR_LONG_VBA_OFFSET:
-+ nOffset = getLong();
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+ if( aStreamName.getLength() )
-+ {
-+ OSL_TRACE("Open stream: '%s' (0x%x)",
-+ (const sal_Char *) rtl::OUStringToOString(
-+ aStreamName, RTL_TEXTENCODING_UTF8 ),
-+ nOffset );
-+
-+ SotStorageStreamRef xVBA;
-+
-+ xVBA = xStorage->OpenSotStream( aStreamName, STREAM_STD_READ );
-+ if( !xVBA.Is() )
-+ {
-+ OSL_TRACE("Failed to open stream" );
-+ return false;
-+ }
-+ xVBA->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); // #TODO CHECKME ( but I think module streams are always littleendian )
-+
-+ OUString sSource = OStringToOUString(
-+ MSLZSS::decompressAsString( xVBA, nOffset ),
-+ RTL_TEXTENCODING_MS_1252 );
-+
-+ if( bStripped )
-+ stripAttributes( sSource, bIsMac );
-+
-+ if( sSource.getLength() <= 0 )
-+ return true;
-+
-+ sal_Int16 mType = rVBA.GetModuleType( aName );
-+
-+ rtl::OUString modeTypeComment;
-+ prependHelperAPIInfo( modeTypeComment, mType );
-+
-+ if( bAsComment )
-+ commentSource( sSource, aName, bIsMac );
-+ else
-+ {
-+ static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
-+ static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
-+ modeTypeComment = modeTypeComment + sVBAOption;
-+ if ( mType == Class )
-+ modeTypeComment = modeTypeComment + sClassOption;
-+ }
-+
-+ sSource = modeTypeComment + sSource;
-+
-+ rtl::OUString aModName( aName );
-+ Any aSourceAny;
-+ aSourceAny <<= sSource;
-+ if (xLib->hasByName(aModName))
-+ xLib->replaceByName(aModName, aSourceAny);
-+ else
-+ xLib->insertByName(aModName, aSourceAny);
-+
-+ return true;
-+ }
-+ else
-+ {
-+ OSL_TRACE( "Duff stream name" );
-+ }
-+ return false;
-+ }
-+
-+ bool prependHelperAPIInfo( OUString& sSource, sal_Int16 mType )
-+ {
-+ rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-+
-+ rtl::OUString modeTypeComment;
-+ switch( mType )
-+ {
-+ case ModuleType::Class:
-+ modeTypeComment = sClassRem +
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
-+ break;
-+ case ModuleType::Form:
-+ modeTypeComment = sClassRem +
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
-+ break;
-+ case ModuleType::Document:
-+ modeTypeComment = sClassRem +
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
-+ break;
-+ case ModuleType::Normal:
-+ modeTypeComment = sClassRem +
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
-+ break;
-+ case ModuleType::Unknown:
-+ modeTypeComment = sClassRem +
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
-+
-+ default:
-+ DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
-+ return false;
-+ }
-+ sSource = modeTypeComment + sSource;
-+ return true;
-+ }
-+};
-+
-+VBADir::VBADir( SvStorageRef &xProjectStorage, SvStorageRef &xStorage ) :
-+ mxStorage( xStorage ), mxProjectStorage( xProjectStorage ), mbMac( false ), meCharSet( RTL_TEXTENCODING_MS_1252)
-+{
-+ init();
-+}
-+
-+VBADir::~VBADir()
-+{
-+}
-+
-+void
-+VBADir::init()
-+{
-+ Read_VBA_PROJECT();
-+ Read_VBAPROJECT();
-+}
-+int
-+VBADir::Read_VBA_PROJECT()
-+{
-+ SvStorageStreamRef xVBAProject;
-+ xVBAProject = mxStorage->OpenSotStream(
-+ String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
-+ STREAM_STD_READ | STREAM_NOCREATE );
-+
-+ if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
-+ {
-+ DBG_WARNING("Not able to find vba project, cannot find macros");
-+ return 0;
-+ }
-+
-+ static const sal_uInt8 aKnownId[] = {0xCC, 0x61};
-+ sal_uInt8 aId[2];
-+ xVBAProject->Read( aId, sizeof(aId) );
-+ if (memcmp( aId, aKnownId, sizeof(aId)))
-+ {
-+ DBG_WARNING("unrecognized VBA macro project type");
-+ return 0;
-+ }
-+
-+ static const sal_uInt8 aOffice2003LE_2[] =
-+ {
-+ 0x79, 0x00, 0x00, 0x01, 0x00, 0xFF
-+ };
-+
-+ static const sal_uInt8 aOffice2003LE[] =
-+ {
-+ 0x76, 0x00, 0x00, 0x01, 0x00, 0xFF
-+ };
-+
-+ static const sal_uInt8 aOfficeXPLE[] =
-+ {
-+ 0x73, 0x00, 0x00, 0x01, 0x00, 0xFF
-+ };
-+
-+ static const sal_uInt8 aOfficeXPBE[] =
-+ {
-+ 0x63, 0x00, 0x00, 0x0E, 0x00, 0xFF
-+ };
-+
-+ static const sal_uInt8 aOffice2000LE[] =
-+ {
-+ 0x6D, 0x00, 0x00, 0x01, 0x00, 0xFF
-+ };
-+ static const sal_uInt8 aOffice98BE[] =
-+ {
-+ 0x60, 0x00, 0x00, 0x0E, 0x00, 0xFF
-+ };
-+ static const sal_uInt8 aOffice97LE[] =
-+ {
-+ 0x5E, 0x00, 0x00, 0x01, 0x00, 0xFF
-+ };
-+ sal_uInt8 aProduct[6];
-+ xVBAProject->Read( aProduct, sizeof(aProduct) );
-+
-+ bool bIsUnicode = false;
-+ if (!(memcmp(aProduct, aOffice2003LE, sizeof(aProduct))) ||
-+ !(memcmp(aProduct, aOffice2003LE_2, sizeof(aProduct))) )
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-+ bIsUnicode = true;
-+ }
-+ else if (!(memcmp(aProduct, aOfficeXPLE, sizeof(aProduct))))
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-+ bIsUnicode = true;
-+ }
-+ else if (!(memcmp(aProduct, aOfficeXPBE, sizeof(aProduct))))
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
-+ mbMac = true;
-+ bIsUnicode = false;
-+ }
-+ else if (!(memcmp(aProduct, aOffice2000LE, sizeof(aProduct))))
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-+ bIsUnicode = true;
-+ }
-+ else if (!(memcmp(aProduct, aOffice98BE, sizeof(aProduct))))
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
-+ mbMac = true;
-+ bIsUnicode = false;
-+ }
-+ else if (!(memcmp(aProduct, aOffice97LE, sizeof(aProduct))))
-+ {
-+ xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-+ bIsUnicode = true;
-+ }
-+ else
-+ {
-+ switch (aProduct[3])
-+ {
-+ case 0x1:
-+ xVBAProject->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ bIsUnicode = true;
-+ DBG_ASSERT(!this, "unrecognized VBA macro version, report to cmc. Guessing at unicode little endian");
-+ break;
-+ case 0xe:
-+ xVBAProject->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
-+ mbMac = true;
-+ bIsUnicode = false;
-+ DBG_ASSERT(!this, "unrecognized VBA macro version, report to cmc. Guessing at 8bit big endian");
-+ break;
-+ default:
-+ DBG_ASSERT(!this, "totally unrecognized VBA macro version, report to cmc");
-+ return 0;
-+ }
-+ }
-+
-+ sal_uInt32 nLidA; //Language identifiers
-+ sal_uInt32 nLidB;
-+ sal_uInt16 nCharSet;
-+ sal_uInt16 nLenA;
-+ sal_uInt32 nUnknownB;
-+ sal_uInt32 nUnknownC;
-+ sal_uInt16 nLenB;
-+ sal_uInt16 nLenC;
-+ sal_uInt16 nLenD;
-+
-+ *xVBAProject >> nLidA >> nLidB >> nCharSet >> nLenA >> nUnknownB;
-+ *xVBAProject >> nUnknownC >> nLenB >> nLenC >> nLenD;
-+
-+ meCharSet = rtl_getTextEncodingFromWindowsCodePage(nCharSet);
-+
-+ DBG_ASSERT(meCharSet != RTL_TEXTENCODING_DONTKNOW,
-+ "don't know what vba charset to use");
-+ if (meCharSet == RTL_TEXTENCODING_DONTKNOW)
-+ meCharSet = RTL_TEXTENCODING_MS_1252;
-+
-+ if (nLenD != 0x02)
-+ {
-+ DBG_WARNING("Warning VBA number is different, please report");
-+ return 0;
-+ }
-+ OSL_TRACE( "mbMac = %d", mbMac );
-+ return 1;
-+}
-+
-+void
-+VBADir::Read_VBAPROJECT()
-+{
-+ // #TODO revisit
-+
-+ // Probably its possible to do this in the DirTokeniser also ( but
-+ // I didn't *easily* see something to distinguish between the different
-+ // 'Object' Modules ( Document & Form for instance )
-+ // But also .... *easily* meaning I didn't look that hard either.
-+
-+ /* #117718#
-+ * Information regarding the type of module is contained in the
-+ * "PROJECT" stream, this stream consists of a number of ascii lines
-+ * entries are of the form Key=Value, the ones that we are interested
-+ * in have the keys; Class, BaseClass & Module indicating the module
-+ * ( value ) is either a Class Module, Form Module or a plain VB Module. */
-+ SvStorageStreamRef xProject = mxProjectStorage->OpenSotStream(
-+ String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
-+ SvStorageStream* pStp = xProject;
-+ UniString tmp;
-+ static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
-+ static const String sModule( RTL_CONSTASCII_USTRINGPARAM( "Module" ) );
-+ static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
-+ static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
-+ static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-+ mhModHash[ sThisDoc ] = Class;
-+ while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
-+ {
-+ xub_StrLen index = tmp.Search( '=' );
-+ if ( index != STRING_NOTFOUND )
-+ {
-+ String key = tmp.Copy( 0, index );
-+ String value = tmp.Copy( index + 1 );
-+ if ( key == sClass )
-+ {
-+ mhModHash[ value ] = Class;
-+ OSL_TRACE("Module %s is of type Class",
-+ ::rtl::OUStringToOString( value ,
-+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+ }
-+ else if ( key == sBaseClass )
-+ {
-+ mhModHash[ value ] = Form;
-+ OSL_TRACE("Module %s is of type Form",
-+ ::rtl::OUStringToOString( value ,
-+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+ }
-+ else if ( key == sDocument )
-+ {
-+ /* #i37965# DR 2004-12-03: add "Document", used i.e.
-+ in Excel for macros attached to sheet or document. */
-+
-+ // value is of form <name>/&H<identifier>, strip the identifier
-+ value.Erase( value.Search( '/' ) );
-+
-+ mhModHash[ value ] = Document;
-+ OSL_TRACE("Module %s is of type Document VBA",
-+ ::rtl::OUStringToOString( value ,
-+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+ }
-+ else if ( key == sModule )
-+ {
-+ mhModHash[ value ] = Normal;
-+ OSL_TRACE("Module %s is of type Normal VBA",
-+ ::rtl::OUStringToOString( value ,
-+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+ }
-+ }
-+ }
-+}
-+
-+sal_Int16
-+VBADir::GetModuleType( const UniString& rModuleName ) const
-+{
-+ ModuleTypeHash::const_iterator iter = mhModHash.find( rModuleName );
-+ ModuleTypeHash::const_iterator iterEnd = mhModHash.end();
-+ if ( iter != iterEnd )
-+ {
-+ return iter->second;
-+ }
-+ return Unknown;
-+}
-+
-+bool
-+VBADir::readBasic( SfxObjectShell &rDocSh, bool bAsComment, bool bStripped )
-+{
-+ bool bRet = false;
-+ SotStorageStreamRef xDir;
-+
-+ xDir = mxStorage->OpenSotStream( OUString::createFromAscii( "dir"),
-+ STREAM_STD_READ );
-+ if( !xDir.Is() )
-+ {
-+ DBG_WARNING( "No 'dir' stream" );
-+ return FALSE;
-+ }
-+ xDir->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); // #TODO - CHECKME ( is dir's endian-ness determined mbMac ( e.g. creating platfrom ) or is it always littleendian )
-+
-+ SvMemoryStream *pPlain = MSLZSS::decompressAsStream( xDir, 0 );
-+#if 0
-+ // hacky dump
-+ std::ofstream aOut("/home/npower/dir.out", std::ios::out );
-+ sal_uInt8 aChar;
-+ while ( !pPlain->IsEof() )
-+ {
-+ *pPlain >> aChar;
-+ aOut << aChar;
-+ }
-+ pPlain->Seek(0);
-+#endif
-+ if( !pPlain )
-+ {
-+ DBG_WARNING( "Failed to decompress 'dir' stream" );
-+ return FALSE;
-+ }
-+
-+ SFX_APP()->EnterBasicCall();
-+
-+ Reference< XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+
-+ DirTokenizer aTok( pPlain );
-+ Reference< XNameContainer > xLib;
-+
-+ xLib = aTok.parseHeader( xLibContainer );
-+ if( !xLib.is() )
-+ {
-+ DBG_WARNING( "Broken header /library" );
-+ return FALSE;
-+ }
-+
-+ // Parse the objects
-+ USHORT nItems = aTok.getShort();
-+ for( USHORT nItem = 0; nItem < nItems && !aTok.isEof(); nItem++)
-+ aTok.readObject( mxStorage, xLib, *this, bStripped, bAsComment, mbMac );
-+
-+ bRet = true;
-+ delete pPlain;
-+
-+ SFX_APP()->LeaveBasicCall();
-+
-+ return bRet;
-+}
-+
-+void
-+VBADir::deleteSRPs()
-+{
-+ SvStorageInfoList aInfoList;
-+
-+ mxStorage->FillInfoList( &aInfoList );
-+
-+ // Remove highly version specific compiled VBA streams
-+ for( sal_uInt32 i = 0; i < aInfoList.Count(); i++ )
-+ {
-+ SvStorageInfo& rInfo = aInfoList[i];
-+
-+ if( rInfo.IsStream() &&
-+ rInfo.GetName().EqualsAscii( "__SRP_", 0, 6 ) )
-+ mxStorage->Remove( rInfo.GetName() );
-+ }
-+}
-+
-+void
-+VBADir::clobberProject()
-+{
-+ SotStorageStreamRef xProject;
-+
-+ xProject = mxStorage->OpenSotStream( OUString::createFromAscii( "_VBA_PROJECT" ),
-+ STREAM_STD_WRITE );
-+ if( !xProject.Is() )
-+ {
-+ DBG_WARNING( "Failed to clobber VBA project" );
-+ return;
-+ }
-+
-+ UINT8 nMagicVersion = 0xa0;
-+ UINT8 nData[8] = { 0xcc, 0x61, 0x00, 0, 0,1,0,0 };
-+ UINT8 nZeros[8] = { 0,0,0,0, 0,0,0,0 };
-+ nData[2] = nMagicVersion;
-+
-+ xProject->Seek( 0 );
-+ xProject->Write( nData, 8 );
-+ xProject->Write( nZeros, 8 );
-+ xProject->Write( nZeros, 8 );
-+ for (int i = 0; i < 100; i++)
-+ xProject->Write( nZeros, 8 );
-+ xProject->Flush();
-+}
-+
-+struct DirOutput {
-+ SvStream *mpStream;
-+
-+ DirOutput( SvStream *pDirStream ) :
-+ mpStream( pDirStream ) {}
-+ ~DirOutput() {}
-+
-+ void
-+ writeLong( sal_uInt16 nToken, sal_uInt32 nLong )
-+ {
-+ *mpStream << nToken;
-+ *mpStream << sal_uInt32(4);
-+ *mpStream << nLong;
-+ }
-+
-+ void
-+ writeShort( sal_uInt16 nToken, sal_uInt16 nShort )
-+ {
-+ *mpStream << nToken;
-+ *mpStream << sal_uInt32(2);
-+ *mpStream << nShort;
-+ }
-+
-+ void
-+ writeUString( sal_uInt16 nToken, const OUString &rString )
-+ {
-+ *mpStream << nToken;
-+ *mpStream << sal_uInt32( rString.getLength() * 2 );
-+ mpStream->Write( (const sal_Unicode *)rString,
-+ rString.getLength() * 2 );
-+ }
-+
-+ void
-+ writeString( sal_uInt16 nToken, const OString &rString )
-+ {
-+ *mpStream << nToken;
-+ *mpStream << sal_uInt32( rString.getLength() );
-+ mpStream->Write( (const sal_Char *)rString,
-+ rString.getLength() );
-+ }
-+
-+ void
-+ writeUStringPair( sal_uInt16 nPlainToken, sal_uInt16 nUniToken, const OUString &rString )
-+ {
-+ writeString( nPlainToken, OUStringToOString( rString, RTL_TEXTENCODING_MS_1252 ) );
-+ writeUString( nUniToken, rString );
-+ }
-+
-+ void
-+ writeHeader()
-+ {
-+ writeLong( VBA_DIR_LONG_START, 1 );
-+ writeLong( VBA_DIR_LONG_ENCODING_1, 0x409 );
-+ writeLong( VBA_DIR_LONG_ENCODING_2, 0x409 );
-+ writeShort( VBA_DIR_SHORT_VERSION_1, 0x4e4 );
-+ writeString( VBA_DIR_STR_PROJECT_NAME, OString( "ProjectFoo" ) );
-+ writeUStringPair( VBA_DIR_STR_DESCRIPTION,
-+ VBA_DIR_USTR_DESCRIPTION, OUString() );
-+ writeUStringPair( VBA_DIR_STR_HELP_FILENAME,
-+ VBA_DIR_USTR_HELP_FILENAME, OUString() );
-+ writeLong( VBA_DIR_LONG_HELP_CTXT_ID, 0 );
-+ writeLong( VBA_DIR_LONG_UNKNOWN_0x08, 0 );
-+
-+ // Whacked out 0x09 token:
-+ *mpStream << sal_uInt16( VBA_DIR_OP_PAPER_SIZE );
-+ *mpStream << sal_uInt32( 6 - 2 ); // totally magic: A4
-+ *mpStream << sal_uInt16( 0x4b0 ) << sal_uInt16( 0x419a ) << sal_uInt16( 0x34 );
-+
-+ writeUStringPair( VBA_DIR_STR_COND_COMP_ARGS,
-+ VBA_DIR_USTR_COND_COMP_ARGS, OUString() );
-+
-+/* // Magic libraries we use
-+ writeString( VBA_DIR_STR_STREAM_TYPE, OString( "stdole" ) );
-+ writeUString( VBA_DIR_USTR_STREAM_TYPE,
-+ OUString::createFromAscii( "stdole" ) ); */
-+ }
-+
-+ void
-+ writeModuleCount( sal_uInt32 nModules )
-+ {
-+ writeShort( VBA_DIR_SHORT_OBJECT_COUNT, nModules );
-+ writeShort( VBA_DIR_SHORT_UNKNOWN_0x13, 0x7384 ); // Concerning ...
-+ }
-+
-+ void
-+ writeFlag( sal_uInt16 nToken )
-+ {
-+ *mpStream << sal_uInt16( nToken );
-+ *mpStream << sal_uInt32( 0 );
-+ }
-+
-+ void
-+ writeEnd()
-+ {
-+ writeFlag( VBA_DIR_FLAG_END );
-+ mpStream->Flush();
-+ }
-+
-+ void
-+ writeModule( const OUString &rName, sal_Int16 rType = Normal )
-+ {
-+ writeUStringPair( VBA_DIR_STR_USER_NAME,
-+ VBA_DIR_USTR_USER_NAME, rName );
-+ writeUStringPair( VBA_DIR_STR_STREAM_NAME,
-+ VBA_DIR_USTR_STREAM_NAME, rName );
-+ writeUStringPair( VBA_DIR_STR_UNKNOWN_0x1c,
-+ VBA_DIR_USTR_UNKNOWN_0x48, OUString() );
-+ // Our streams start after 16 bytes of padded 0s ( to please Office97 )
-+ writeLong( VBA_DIR_LONG_VBA_OFFSET, 0x10 );
-+ writeLong( VBA_DIR_LONG_UNKNOWN_0x1e, 0x0 );
-+ writeShort( VBA_DIR_SHORT_UNKNOWN_0x2c, 0x3672 ); // Concerning ...
-+ switch ( rType )
-+ {
-+ case Document:
-+ case Form:
-+ writeFlag( VBA_DIR_FLAG_DOCUMENT );
-+ break;
-+ case Class:
-+ writeFlag( VBA_DIR_CLASS_MODULE );
-+ break;
-+ case Normal:
-+ writeFlag( VBA_DIR_FLAG_MACRO );
-+ break;
-+ case Unknown:
-+ DBG_WARNING( "Unknown module type" );
-+ }
-+ writeFlag( VBA_DIR_OBJECT_END );
-+ }
-+
-+ void
-+ writeModules( const vecModuleTypes& rModTypes )
-+ {
-+ // a hack - these are the hard-coded names from the 'CODENAME'
-+ // records in the Excel stream.
-+ vecModuleTypes::const_iterator it = rModTypes.begin();
-+ vecModuleTypes::const_iterator it_end = rModTypes.end();
-+ for ( ; it != it_end; ++it )
-+ writeModule( it->first, it->second );
-+ }
-+};
-+
-+struct ProjectOutput {
-+ SotStorageStreamRef mxProject;
-+ SotStorageStreamRef mxProjectWm;
-+
-+ ProjectOutput() {}
-+ ~ProjectOutput() {}
-+
-+ bool initialize( const SvStorageRef &xStorage )
-+ {
-+ mxProject = xStorage->OpenSotStream(
-+ rtl::OUString::createFromAscii( "PROJECT" ),
-+ STREAM_STD_WRITE );
-+ mxProjectWm = xStorage->OpenSotStream(
-+ rtl::OUString::createFromAscii( "PROJECTwm" ),
-+ STREAM_STD_WRITE );
-+
-+ return mxProject.Is() && mxProjectWm.Is();
-+ }
-+
-+ void writeString( const OString &rString )
-+ {
-+ OString sTempStringa( "\n" );
-+ OString sTempStringb( "\x0D\x0A" );
-+ OString sOutput = rString;
-+
-+ sal_Int32 nFromIndex = 0;
-+ sal_Int32 nToIndex = -1;
-+ while( (nToIndex = sOutput.indexOf( sTempStringa, nFromIndex ) ) != -1 )
-+ {
-+ sOutput = sOutput.replaceAt( nToIndex, sTempStringa.getLength(), sTempStringb);
-+ nFromIndex = nToIndex += sTempStringb.getLength();
-+ }
-+ mxProject->Write( (const sal_Char *) sOutput, sOutput.getLength() );
-+ }
-+
-+ void writeModule( const OUString &rName, sal_Int16 rType = Normal )
-+ {
-+ OString sName = OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 );
-+ OSL_TRACE("writeModeule %s, type %d", sName.getStr(), rType );
-+ switch( rType )
-+ {
-+ case Document:
-+ writeString( "Document=" );
-+ break;
-+ case Normal:
-+ writeString( "Module=" );
-+ break;
-+ case Class:
-+ writeString( "Class=" );
-+ break;
-+ case Form:
-+ writeString( "BaseClass=" );
-+ break;
-+ case Unknown:
-+ writeString( "Module=" );
-+ break;
-+ }
-+ writeString( sName );
-+ if( rType == Document )
-+ writeString( "/&H00000000" );
-+ writeString( "\n" );
-+ mxProjectWm->Write( (const sal_Char *) sName, sName.getLength() );
-+ *mxProjectWm << UINT8( 0 );
-+ mxProjectWm->Write( (const sal_Unicode *) rName, rName.getLength() * 2);
-+ *mxProjectWm << sal_uInt16( 0 );
-+ }
-+
-+ void writeHeader()
-+ {
-+ writeString("ID=\"{33C90A8B-9E30-406E-BC0F-D2863F9025D7}\"\n");
-+ }
-+
-+ void writeModules( const vecModuleTypes& rModTypes )
-+ {
-+ vecModuleTypes::const_iterator it = rModTypes.begin();
-+ vecModuleTypes::const_iterator it_end = rModTypes.end();
-+ for ( ; it != it_end; ++it )
-+ writeModule( it->first, it->second );
-+ }
-+
-+ void writeEnd()
-+ {
-+ *mxProjectWm << sal_uInt16( 0 );
-+
-+ mxProject->Flush();
-+ mxProjectWm->Flush();
-+ }
-+};
-+
-+OUString
-+VBADir::stripOptions( const OUString& rSource, sal_Int16 rType )
-+{
-+ OUString newSource( rSource );
-+ sal_Int32 nFromIndex = 0;
-+ sal_Int32 nToIndex = -1;
-+ OUString sNewLine( '\n' );
-+
-+ com::sun::star::util::SearchOptions aVBAOpt;
-+ ::com::sun::star::util::SearchResult aVBARes;
-+ ::com::sun::star::util::SearchResult aClassRes;
-+ aVBAOpt.algorithmType = com::sun::star::util::SearchAlgorithms_REGEXP;
-+
-+ aVBAOpt.Locale = Application::GetSettings().GetLocale();
-+
-+ //aVBAOptSearch.searchString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("^\\s*Option\\s+VBASupport\\s+1") );;
-+ aVBAOpt.searchString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("^\\s*Option VBASupport 1") );;
-+
-+ aVBAOpt.transliterateFlags |= com::sun::star::i18n::TransliterationModules_IGNORE_CASE;
-+ com::sun::star::util::SearchOptions aClassOpt( aVBAOpt);
-+
-+ //aClassOpt.searchString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("^\\s*Option\\s+ClassModule\\s*$") );;
-+ aClassOpt.searchString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Option ClassModule") );;
-+ utl::TextSearch aVBASearch(aVBAOpt);
-+ utl::TextSearch aClassSearch(aClassOpt);
-+ bool bFoundVBA = false;
-+ bool bFoundClass = false;
-+ xub_StrLen nStart=0, nEnd=rSource.getLength();
-+ while( (nToIndex = rSource.indexOf( sNewLine, nFromIndex ) ) != -1 )
-+ {
-+ OUString nLine = rSource.copy( nFromIndex, ( nToIndex - nFromIndex ) + 1 );
-+ if ( !bFoundVBA ) // always search until found
-+ {
-+ if ( aVBASearch.SearchFrwrd(nLine, &nStart, &nEnd, &aVBARes ) )
-+ {
-+ // add index to the line we are processing
-+ aVBARes.startOffset[0] += nFromIndex;
-+ aVBARes.endOffset[0] += nFromIndex;
-+ bFoundVBA = true;
-+ }
-+ }
-+ if ( ( rType == Class ) && !bFoundClass ) // always search until found
-+ {
-+ if ( aClassSearch.SearchFrwrd(nLine, &nStart, &nEnd, &aClassRes ) )
-+ {
-+ // add index to the line we are processing
-+ aClassRes.startOffset[0] += nFromIndex;
-+ aClassRes.endOffset[0] += nFromIndex;
-+ bFoundClass = true;
-+ }
-+ }
-+ // determine if we are finished
-+ if ( ( bFoundVBA && rType != Class ) ||
-+ ( ( rType == Class ) && bFoundClass ) && bFoundVBA )
-+ {
-+ break;
-+ }
-+ nFromIndex = nToIndex + sNewLine.getLength();
-+ }
-+ if ( bFoundClass || bFoundVBA )
-+ {
-+ sal_Int32 nStartFirstOption = -1;
-+ sal_Int32 nEndFirstOption = -1;
-+ sal_Int32 nStartSecondOption = -1;
-+ sal_Int32 nEndSecondOption = -1;
-+
-+ if ( bFoundClass )
-+ {
-+ if ( aClassRes.startOffset[0] > aVBARes.startOffset[0] )
-+ {
-+ nStartFirstOption = aVBARes.startOffset[0];
-+ nEndFirstOption = aVBARes.endOffset[0];
-+ nStartSecondOption = aClassRes.startOffset[0];
-+ nEndSecondOption = aClassRes.endOffset[0];
-+ }
-+ else
-+ {
-+ nStartFirstOption = aClassRes.startOffset[0];
-+ nEndFirstOption = aClassRes.endOffset[0];
-+ nStartSecondOption = aVBARes.startOffset[0];
-+ nEndSecondOption = aVBARes.endOffset[0];
-+ }
-+
-+ }
-+ else
-+ {
-+ nStartFirstOption = aVBARes.startOffset[0];
-+ nEndFirstOption = aVBARes.endOffset[0];
-+ }
-+ // Copy up to First Option
-+ newSource = rSource.copy( 0, nStartFirstOption ); //
-+ if ( bFoundClass )
-+ {
-+ newSource += rSource.copy( nEndFirstOption, nStartSecondOption - nEndFirstOption );
-+ newSource += rSource.copy( nEndSecondOption, rSource.getLength() - nEndSecondOption );
-+ }
-+ else
-+ newSource += rSource.copy( nEndFirstOption, rSource.getLength() - nEndFirstOption );
-+ }
-+ return newSource;
-+}
-+
-+void
-+VBADir::writeModule( const OUString &rName, const OUString &rSource, sal_Int16 rType = Normal)
-+{
-+ SvStorageStreamRef xStream;
-+ xStream = mxStorage->OpenSotStream( rName, STREAM_STD_WRITE );
-+ xStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); // #TODO - CHECKME are module stream always little endian
-+
-+ UINT8 aData[16] = { 0, };
-+ xStream->Write( aData, 16 );
-+
-+ OString sAttribute;
-+ if ( rType == Normal )
-+ sAttribute = sAttribute + "Attribute VB_Name = \"" + OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) + "\"";
-+ else if ( rType == Document )
-+ {
-+ // #FIXME wacky hack, this will become an issue also for
-+ // word :-( possibly we need another constant to handle this
-+ // special document module type
-+ // Better still would be a distinct module object type in basic
-+ if ( rName.equals( OUString::createFromAscii( "ThisWorkbook" ) ) )
-+ {
-+ sAttribute = "Attribute VB_Base = \"0{00020819-0000-0000-C000-000000000046}\"";
-+ }
-+ else
-+ {
-+ sAttribute = "Attribute VB_Base = \"0{00020820-0000-0000-C000-000000000046}\"";
-+ }
-+
-+ }
-+ else if ( rType == Class )
-+ {
-+ sAttribute = "Attribute VB_Base = \"0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}\"";
-+/*
-+ sAttribute = sAttribute + "\r\nAttribute VB_GlobalNameSpace = False";
-+ sAttribute = sAttribute + "\r\nAttribute VB_Creatable = False";
-+ sAttribute = sAttribute + "\r\nAttribute VB_PredeclaredId = False";
-+ sAttribute = sAttribute + "\r\nAttribute VB_Exposed = False";
-+ sAttribute = sAttribute + "\r\nAttribute VB_TemplateDerived = False";
-+ sAttribute = sAttribute + "\r\nAttribute VB_Customizable = False";
-+*/
-+ }
-+ else if ( rType == Form )
-+ {
-+ sAttribute = "Attribute VB_Base = \"0{6FE35EE2-F5D3-4FD9-BBB2-A3253B2C0650}{D22BB890-287D-42D9-85E8-F98E3EB8559C}\"";
-+ }
-+
-+ // Remove any instances of Option VBASupport and/or Option ClassModule
-+
-+ OString sSource = OUStringToOString( stripOptions( rSource, rType ), RTL_TEXTENCODING_MS_1252 );
-+
-+ sSource = sAttribute + "\r\n" + sSource;
-+ //OSL_TRACE("***************************");
-+ //OSL_TRACE("source for %s", OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ //OSL_TRACE("->START\n%s<-END", sSource.getStr() );
-+
-+
-+ MSLZSS::compressString( xStream, sSource );
-+}
-+
-+bool
-+VBADir::writeBasic( SfxObjectShell &rDocSh )
-+{
-+ bool bRet = true;
-+
-+ OSL_TRACE("writeBasic");
-+ deleteSRPs();
-+ clobberProject();
-+
-+ SvMemoryStream aMemStream;
-+ ProjectOutput aProject;
-+
-+ if( !aProject.initialize( mxProjectStorage ) )
-+ {
-+ OSL_TRACE( "Error opening project streams");
-+ return false;
-+ }
-+ aProject.writeHeader();
-+
-+ DirOutput aDir( &aMemStream );
-+ aDir.writeHeader();
-+
-+ SFX_APP()->EnterBasicCall();
-+
-+ Reference< XNameAccess> xVBAObjects;
-+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
-+
-+ if ( xSF.is() )
-+ xVBAObjects.set ( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectsToExport"))), UNO_QUERY);
-+
-+ Reference< XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ Reference< XNameContainer > xLib;
-+ OSL_TRACE("about to test xLibContainer");
-+ if ( xLibContainer.is() )
-+ {
-+ try
-+ {
-+ xLib.set( xLibContainer->getByName( rtl::OUString( STANDARD ) ), UNO_QUERY );
-+ }
-+ catch( Exception& ){}
-+ }
-+ if( xVBAObjects.is() && xLib.is() )
-+ {
-+ OSL_TRACE("Got document specific vbaobject service");
-+ Sequence< OUString > aProjects;
-+ aProjects = xVBAObjects->getElementNames();
-+ sal_Int32 nLen = aProjects.getLength();
-+ Reference < XStorage > xSrcRoot( rDocSh.GetStorage() );
-+ SvStorageRef xMSProject = SotStorage::OpenOLEStorage( xSrcRoot, SvxImportMSVBasic::GetMSBasicStorageName(), STREAM_STD_READ );
-+
-+ OSL_TRACE("******* aProjects has %d entries", nLen );
-+
-+ SvxMSUserFormHelper userformHelper( xMSProject, String( RTL_CONSTASCII_USTRINGPARAM("VBA"))) ;
-+ vecModuleTypes vbaModuleTypes;
-+ for ( sal_Int32 nIndex = 0; nIndex < nLen; ++nIndex )
-+ {
-+ sal_Int16 nType = Unknown;
-+ xVBAObjects->getByName( aProjects[ nIndex ] ) >>= nType;
-+ // Check to see if this is an imported Userform,
-+ // If this module doesn't match a previously imported
-+ // userform then we can't export a 'real' Userform
-+ // ( Object and code ). We can only export the code
-+ // in this case ( so it can't be exported as a Userform
-+ // code/object combination )
-+
-+ if ( userformHelper.isUserFormModuleName( aProjects[ nIndex ] ) )
-+ nType = Form;
-+
-+ vbaModuleTypes.push_back( ModuleDesc( aProjects[ nIndex ], nType ) );
-+ OSL_TRACE("about to export %s type %d", rtl::OUStringToOString( aProjects[ nIndex ], RTL_TEXTENCODING_UTF8 ).getStr(), nType );
-+
-+ }
-+ aProject.writeModules( vbaModuleTypes );
-+
-+ aDir.writeModuleCount( vbaModuleTypes.size() );
-+
-+ // really this is write modules
-+ aDir.writeModules( vbaModuleTypes );
-+
-+ vecModuleTypes::iterator it = vbaModuleTypes.begin();
-+ vecModuleTypes::iterator it_end = vbaModuleTypes.end();
-+ for ( ; it != it_end; ++it )
-+ {
-+ Any aSourceAny;
-+ OUString sSource;
-+ // its possible that e.g. sheet1..3 have no code therefore they don't exist in openoffice, ditto for ThisWorkbook
-+ try
-+ {
-+ aSourceAny = xLib->getByName( it->first );
-+ aSourceAny >>= sSource;
-+ }
-+ catch( com::sun::star::uno::Exception& )
-+ {
-+ }
-+ if( sSource.getLength() >= 0 )
-+ writeModule( it->first, sSource, it->second );
-+
-+ // copy userform streams
-+ if ( it->second == Form )
-+ {
-+ OSL_TRACE("Copying userform %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SvStorageRef xFormSrc = xMSProject->OpenOLEStorage( it->first, STREAM_STD_READ );
-+ SvStorageRef xDst = mxProjectStorage->OpenSotStorage( it->first, STREAM_READWRITE | STREAM_TRUNC );
-+
-+ xFormSrc->CopyTo( xDst );
-+ xDst->Commit();
-+ ErrCode nError = xDst->GetError();
-+ if ( nError == ERRCODE_NONE )
-+ nError = xFormSrc->GetError();
-+ if ( nError != ERRCODE_NONE )
-+ {
-+ OSL_TRACE("Error writing %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ //return false;
-+ }
-+ }
-+ }
-+
-+ }
-+ else
-+ aDir.writeModuleCount( 0 );
-+
-+ aDir.writeEnd();
-+ aProject.writeEnd();
-+
-+ aMemStream.Seek( 0 );
-+
-+ // Compress dir to the real stream
-+ SvStorageStreamRef xDir;
-+ xDir = mxStorage->OpenSotStream( OUString::createFromAscii( "dir" ),
-+ STREAM_STD_WRITE );
-+ if( !xDir.Is() )
-+ {
-+ OSL_TRACE("Failed to open dir" );
-+ bRet = false;
-+ }
-+ else
-+ {
-+ xDir->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); // #TODO - CHECKME for endianess ( e.g. should Dir always be littleendian or not )
-+ MSLZSS::compressStream( xDir, &aMemStream );
-+ xDir->Flush();
-+ }
-+
-+ SFX_APP()->LeaveBasicCall();
-+
-+ return bRet;
-+}
diff --git a/patches/test/vba-export.diff b/patches/test/vba-export.diff
deleted file mode 100644
index a3b473bf6..000000000
--- a/patches/test/vba-export.diff
+++ /dev/null
@@ -1,1092 +0,0 @@
-diff -rup /data4/scratch/oog680-m5/sc/inc/servuno.hxx sc/inc/servuno.hxx
---- /data4/scratch/oog680-m5/sc/inc/servuno.hxx 2007-09-24 15:00:30.000000000 +0100
-+++ sc/inc/servuno.hxx 2007-09-16 22:04:01.000000000 +0100
-@@ -102,8 +102,9 @@ class ScDocShell;
-
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
-+#define SC_SERVICE_VBAOBJECTSTOEXPORT 40
-
--#define SC_SERVICE_COUNT 40
-+#define SC_SERVICE_COUNT 41
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
-diff -rup /data4/scratch/oog680-m5/sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
---- /data4/scratch/oog680-m5/sc/source/core/tool/compiler.cxx 2007-09-24 15:00:30.000000000 +0100
-+++ sc/source/core/tool/compiler.cxx 2007-09-19 01:05:47.000000000 +0100
-@@ -1543,6 +1546,8 @@ ScCompiler::ScCompiler( ScDocument* pDoc
- nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
- pStack = NULL;
- nNumFmt = NUMBERFORMAT_UNDEFINED;
-+ SetCompileEnglish( TRUE );
-+
- }
-
- ScCompiler::ScCompiler(ScDocument* pDocument, const ScAddress& rPos )
-diff -rup /data4/scratch/oog680-m5/sc/source/filter/excel/excdoc.cxx sc/source/filter/excel/excdoc.cxx
---- /data4/scratch/oog680-m5/sc/source/filter/excel/excdoc.cxx 2007-09-24 15:00:14.000000000 +0100
-+++ sc/source/filter/excel/excdoc.cxx 2007-09-17 12:29:36.000000000 +0100
-@@ -181,12 +181,14 @@ void ExcTable::FillAsHeader( ExcBoundshe
- Add( rR.pTabId );
- if( HasVbaStorage() )
- {
-+ OSL_TRACE("*** hmm exporting doc codename");
- Add( new XclObproj );
-- const String& rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
-- if( rCodeName.Len() )
-- Add( new XclCodename( rCodeName ) );
-+ String rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
-+ if( rCodeName.Len() == 0 )
-+ // should 'ThisWorkbook' be localized?
-+ rCodeName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ Add( new XclCodename( rCodeName ) );
- }
-- Add( new ExcDummy8_00b );
- }
-
- // erst Namen- und Tabellen-Eintraege aufbauen
-@@ -403,8 +405,17 @@ void ExcTable::FillAsTable( size_t nCode
- Add( new XclExpCondFormatBuffer( GetRoot() ) );
-
- if( HasVbaStorage() )
-+ {
-+ String cName;
- if( nCodeNameIdx < GetExtDocOptions().GetCodeNameCount() )
-- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
-+ cName = GetExtDocOptions().GetCodeName( nCodeNameIdx );
-+ else
-+ // CodeName = SheetName
-+ GetDoc().GetName( nCodeNameIdx, cName );
-+
-+ if ( cName.Len() > 0 )
-+ Add( new XclCodename( cName ) );
-+ }
- }
-
- // list of HLINK records, generated by the cell table
-diff -rup /data4/scratch/oog680-m5/sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
---- /data4/scratch/oog680-m5/sc/source/filter/excel/excimp8.cxx 2007-09-24 15:00:14.000000000 +0100
-+++ sc/source/filter/excel/excimp8.cxx 2007-09-20 09:18:20.000000000 +0100
-@@ -221,7 +221,8 @@ void ImportExcel8::Boundsheet( void )
-
- String aName( aIn.ReadUniString( nLen ) );
- GetTabInfo().AppendXclTabName( aName, nBdshtTab );
--
-+ if ( ( nGrbit & 0x600 ) )
-+ return;
- ScfTools::ConvertToScSheetName( aName );
- *pExcRoot->pTabNameBuff << aName;
-
-diff -rup /data4/scratch/oog680-m5/sc/source/filter/excel/expop2.cxx sc/source/filter/excel/expop2.cxx
---- /data4/scratch/oog680-m5/sc/source/filter/excel/expop2.cxx 2007-07-17 14:33:35.000000000 +0100
-+++ sc/source/filter/excel/expop2.cxx 2007-09-16 22:04:01.000000000 +0100
-@@ -65,7 +65,7 @@
- #ifndef SC_XELINK_HXX
- #include "xelink.hxx"
- #endif
--
-+#include <hash_map>
-
- ExportBiff5::ExportBiff5( XclExpRootData& rExpData, SvStream& rStrm ):
- ExportTyp( rStrm, &rExpData.mrDoc, rExpData.meTextEnc ),
-@@ -107,11 +107,11 @@ FltError ExportBiff5::Write()
- if( pDocShell && xRootStrg.Is() && bWriteBasicStrg )
- {
- SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg );
-- ULONG nErr = aBasicImport.SaveOrDelMSVBAStorage( TRUE, EXC_STORAGE_VBA_PROJECT );
-+
-+ ULONG nErr = aBasicImport.SaveOrCopyOrDeleteMSVBAStorage( bWriteBasicStrg ? SvxImportMSVBasic::Save : SvxImportMSVBasic::Copy , EXC_STORAGE_VBA_PROJECT );
- if( nErr != ERRCODE_NONE )
- pDocShell->SetError( nErr );
- }
--
- pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
- pExcDoc->Write( aOut ); // wechstreamen
-
-diff -rup /data4/scratch/oog680-m5/sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
---- /data4/scratch/oog680-m5/sc/source/filter/excel/read.cxx 2007-09-24 15:00:14.000000000 +0100
-+++ sc/source/filter/excel/read.cxx 2007-09-20 09:46:05.000000000 +0100
-@@ -1047,6 +1047,7 @@ FltError ImportExcel8::Read( void )
- default:
- // TODO: do not create a sheet in the Calc document
- pD->SetVisible( GetCurrScTab(), FALSE );
-+ pD->DeleteTab( GetCurrScTab(), 0 );
- XclTools::SkipSubStream( maStrm );
- IncCurrScTab();
- }
-diff -rup /data4/scratch/oog680-m5/sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
---- /data4/scratch/oog680-m5/sc/source/ui/unoobj/servuno.cxx 2007-09-24 15:00:30.000000000 +0100
-+++ sc/source/ui/unoobj/servuno.cxx 2007-09-20 08:55:34.000000000 +0100
-@@ -77,6 +77,121 @@
- #include <svx/xmlgrhlp.hxx>
- #endif
-
-+
-+//#include <cppuhelper/implbase1.hxx>
-+//#include <map>
-+#include "scextopt.hxx"
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/XModuleTypeAccess.hpp>
-+#include <comphelper/processfactory.hxx>
-+//#include <com/sun/star/container/XNameAccess.hxx>
-+#include <sfx2/docfilt.hxx>
-+#include <sfx2/docfile.hxx>
-+typedef std::hash_map< rtl::OUString, sal_Int16, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTypeMap;
-+
-+class ScVbaObjectsToExport : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess >
-+{
-+ ModuleTypeMap mModules;
-+public:
-+ ScVbaObjectsToExport( ScDocShell* pDocShell )
-+ {
-+ // The purpose of this service is to inform the vba export code what
-+ // target application ( e.g. excel ) Object modules ( and other ) to
-+ // export. In the case of excel ( or a calc document to be exported as
-+ // excel ) there are a number of modules that need to be exported
-+ // Sheet modules ( and if this is an imported excel document we MUST use the codenames )
-+ // ThisWorkbook
-+ // Ordinary modules.
-+ //
-+
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aArgs(1);
-+ aArgs[0] <<= pDocShell->GetModel();
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xSF(comphelper::getProcessServiceFactory());
-+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XModuleTypeAccess> xModuleTypeAccess ( xSF->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.ExportableVBAModuleTypeAccess")), aArgs ), ::com::sun::star::uno::UNO_QUERY);
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > xLibContainer = pDocShell->GetBasicContainer();
-+ if ( xLibContainer.is() && xModuleTypeAccess.is() )
-+ {
-+ // Populate Calc VBA Objects with Sheet Names, ThisWorkbook
-+ String sStandard( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLibrary( xLibContainer->getByName( sStandard ), com::sun::star::uno::UNO_QUERY );
-+ ScDocument* pDoc = pDocShell->GetDocument();
-+ if ( xLibrary.is() && pDoc )
-+ {
-+ rtl::OUString sThisWorkbook( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ // Always a ThisWorkbook
-+ mModules[ sThisWorkbook ] = ::com::sun::star::script::ModuleType::Document;
-+ // Get the codenames for the sheets ( if they exist )
-+ ScExtDocOptions* pOpts = pDoc->GetExtDocOptions();
-+ for ( SCTAB n=0; n< pDoc->GetTableCount(); ++n )
-+ {
-+ String sCodeName;
-+ if ( pOpts )
-+ sCodeName = pOpts->GetCodeName( n );
-+ if ( !sCodeName.Len() )
-+ {
-+ pDoc->GetName( n, sCodeName );
-+ //some times there is a bogus sheet name from the import where ( sheetname = modulename )
-+ bool bIsMSDoc = ( pOpts != 0 );
-+ OSL_TRACE("bIsMSDoc = %d", bIsMSDoc );
-+ //if ( bIsMSDoc && xLibrary->hasByName( sCodeName ) )
-+ if ( false && xLibrary->hasByName( sCodeName ) )
-+ {
-+ OSL_TRACE("Detected bogus module %s", rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ sCodeName = String();
-+ }
-+ }
-+ if ( sCodeName.Len() > 0 )
-+ mModules[ sCodeName ] = ::com::sun::star::script::ModuleType::Document;
-+ }
-+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = xLibrary->getElementNames();
-+ sal_Int32 nElems = aNames.getLength();
-+ for ( sal_Int32 index = 0; index < nElems; ++index )
-+ {
-+ rtl::OUString sModName = aNames[ index ];
-+ ModuleTypeMap::iterator it = mModules.find( sModName );
-+ OSL_TRACE("->>>>> checking module %s, exists? %d", rtl::OUStringToOString( aNames[ index ], RTL_TEXTENCODING_UTF8 ).getStr(), it != mModules.end() );
-+ if ( it == mModules.end() ) // doesn't exist
-+ mModules[ sModName ] = xModuleTypeAccess->getModuleType( sModName );
-+
-+ }
-+
-+ }
-+ }
-+ }
-+// XNameAccess
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw ::com::sun::star::container::NoSuchElementException();
-+ ModuleTypeMap::iterator it = mModules.find( aName );
-+ return ::com::sun::star::uno::makeAny( sal_Int16( it->second ) );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( mModules.size() );
-+ ModuleTypeMap::iterator it = mModules.begin();
-+ ModuleTypeMap::iterator it_end = mModules.end();
-+ ::rtl::OUString* pDest = aNames.getArray();
-+ for ( ; it != it_end ; ++it, ++pDest )
-+ *pDest = it->first;
-+ return aNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ ModuleTypeMap::iterator it = mModules.find( aName );
-+ return ( ( it != mModules.end() ) ? sal_True : sal_False );
-+ }
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) { return getCppuType((sal_Int16*)0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) { return ( ( mModules.size() > 0 ) ? sal_True : sal_False); }
-+
-+
-+// XElementAccess
-+
-+};
-+
-+
- using namespace ::com::sun::star;
-
-
-@@ -128,7 +243,8 @@ static const sal_Char* __FAR_DATA aProvN
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
-- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
-+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+ "org.openoffice.vba.VBAObjectsToExport", // SC_SERVICE_VBAOBJECTSTOEXPORT
- };
-
- //
-@@ -180,7 +296,8 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_SHEETDOCSET
- "", // SC_SERVICE_CHDATAPROV
- "", // SC_SERVICE_FORMULAPARS
-- "" // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_OPCODEMAPPER
-+ "" // SC_SERVICE_VBAOBJECTSTOEXPORT
- };
-
-
-@@ -373,7 +490,13 @@ uno::Reference<uno::XInterface> ScServic
- case SC_SERVICE_OPCODEMAPPER:
- xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
- break;
-+ case SC_SERVICE_VBAOBJECTSTOEXPORT:
-+ {
-+ xRet = *new ScVbaObjectsToExport( pDocShell );
-+ break;
-+ }
- }
-+
- return xRet;
- }
-
-diff -rup /data4/scratch/oog680-m5/basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
---- /data4/scratch/oog680-m5/basic/inc/basic/sbmod.hxx 2007-09-24 15:00:27.000000000 +0100
-+++ basic/inc/basic/sbmod.hxx 2007-09-16 22:04:01.000000000 +0100
-@@ -46,6 +46,7 @@
- #ifndef _RTL_USTRING_HXX
- #include <rtl/ustring.hxx>
- #endif
-+#include <com/sun/star/script/ModuleType.hpp>
-
- class SbMethod;
- class SbProperty;
-@@ -77,6 +78,7 @@ protected:
- SbClassData* pClassData;
- bool bThisWorkBook; // Should really subclass the module
- bool mbVBACompat;
-+ sal_Int16 mnModuleType;
-
- void StartDefinitions();
- SbMethod* GetMethod( const String&, SbxDataType );
-@@ -129,6 +131,8 @@ public:
-
- // Zeilenbereiche von Subs
- virtual SbMethod* GetFunctionForLine( USHORT );
-+ virtual sal_Int16 GetModuleTypeHint() { return mnModuleType; }
-+ virtual void SetModuleTypeHint( sal_Int16 nType ) { mnModuleType = nType; };
-
- // Store only image, no source (needed for new password protection)
- BOOL StoreBinaryData( SvStream& );
-diff -rup /data4/scratch/oog680-m5/basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
---- /data4/scratch/oog680-m5/basic/source/classes/sbxmod.cxx 2007-09-24 15:00:27.000000000 +0100
-+++ basic/source/classes/sbxmod.cxx 2007-09-16 22:04:01.000000000 +0100
-@@ -239,7 +239,7 @@ extern "C" int CDECL compare_strings( co
-
- SbModule::SbModule( const String& rName )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
-- pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), bThisWorkBook( false ), mbVBACompat( false )
-+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), bThisWorkBook( false ), mbVBACompat( false ), mnModuleType( ::com::sun::star::script::ModuleType::Normal )
- {
- SetName( rName );
- SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
-@@ -523,6 +523,7 @@ void SbModule::SetSource( const String&
-
- void SbModule::SetSource32( const ::rtl::OUString& r )
- {
-+ mnModuleType = ::com::sun::star::script::ModuleType::Normal;
- aOUSource = r;
- StartDefinitions();
- SbiTokenizer aTok( r );
-@@ -554,6 +556,8 @@ void SbModule::SetSource32( const ::rtl:
- {
- eCurTok = aTok.Next();
- mbVBACompat = ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 );
-+ if ( eCurTok == CLASSMODULE )
-+ mnModuleType = ::com::sun::star::script::ModuleType::Class;
- if( eCurTok == COMPATIBLE
- || mbVBACompat )
- aTok.SetCompatible( true );
-diff -rup /data4/scratch/oog680-m5/basic/source/comp/codegen.cxx basic/source/comp/codegen.cxx
---- /data4/scratch/oog680-m5/basic/source/comp/codegen.cxx 2007-09-24 15:00:08.000000000 +0100
-+++ basic/source/comp/codegen.cxx 2007-09-16 22:04:01.000000000 +0100
-@@ -40,7 +40,7 @@
- #include "sbcomp.hxx"
- #include "image.hxx"
- #include <limits>
--
-+#include <com/sun/star/script/ModuleType.hpp>
- // nInc ist die Inkrementgroesse der Puffer
-
- SbiCodeGen::SbiCodeGen( SbModule& r, SbiParser* p, short nInc )
-@@ -141,6 +141,7 @@ void SbiCodeGen::Save()
- int nIfaceCount = 0;
- if( pParser->bClassModule )
- {
-+ rMod.SetModuleTypeHint( ::com::sun::star::script::ModuleType::Class );
- p->SetFlag( SBIMG_CLASSMODULE );
- pCLASSFAC->AddClassModule( &rMod );
-
-@@ -162,6 +163,7 @@ void SbiCodeGen::Save()
- }
- else
- {
-+ rMod.SetModuleTypeHint( ::com::sun::star::script::ModuleType::Normal );
- pCLASSFAC->RemoveClassModule( &rMod );
- }
- if( pParser->bText )
-diff -rup /data4/scratch/oog680-m5/basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
---- /data4/scratch/oog680-m5/basic/source/inc/scriptcont.hxx 2007-06-27 15:23:39.000000000 +0100
-+++ basic/source/inc/scriptcont.hxx 2007-09-16 22:04:01.000000000 +0100
-@@ -44,6 +44,8 @@
- #include <basic/basmgr.hxx>
- #endif
-
-+#include <com/sun/star/script/XModuleTypeAccess.hpp>
-+
- class BasicManager;
-
- //============================================================================
-@@ -182,6 +184,31 @@ public:
- );
- };
-
-+
-+class ExportableVBAModuleTypeAccess : public ::cppu::WeakImplHelper2< ::com::sun::star::script::XModuleTypeAccess, ::com::sun::star::lang::XInitialization >
-+{
-+ bool m_bInit;
-+ BasicManager* m_pBasicMgr;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xDialogs;
-+public:
-+ ExportableVBAModuleTypeAccess() : m_bInit(false), m_pBasicMgr(NULL){}
-+ ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
-+ static ::rtl::OUString getImplementationName_static();
-+
-+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
-+
-+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ) throw ( ::com::sun::star::uno::Exception );
-+
-+// Methods XInitialization
-+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Any >& aArguments )
-+ throw (::com::sun::star::uno::Exception,
-+ ::com::sun::star::uno::RuntimeException);
-+// Methods XModuleTypeAccess
-+ virtual ::sal_Int16 SAL_CALL getModuleType( const ::rtl::OUString& sModule )
-+ throw (::com::sun::star::uno::RuntimeException);
-+};
- } // namespace base
-
- #endif
-diff -rup /data4/scratch/oog680-m5/basic/source/uno/sbservices.cxx basic/source/uno/sbservices.cxx
---- /data4/scratch/oog680-m5/basic/source/uno/sbservices.cxx 2006-12-05 12:04:54.000000000 +0000
-+++ basic/source/uno/sbservices.cxx 2007-09-16 22:04:01.000000000 +0100
-@@ -51,6 +51,7 @@ namespace basic
- //--------------------------------------------------------------------
- extern void createRegistryInfo_SfxDialogLibraryContainer();
- extern void createRegistryInfo_SfxScriptLibraryContainer();
-+ extern void createRegistryInfo_ExportableVBAModuleTypeAccess();
-
- static void initializeModule()
- {
-@@ -62,6 +63,7 @@ namespace basic
- {
- createRegistryInfo_SfxDialogLibraryContainer();
- createRegistryInfo_SfxScriptLibraryContainer();
-+ createRegistryInfo_ExportableVBAModuleTypeAccess();
- }
- }
- }
-diff -rup /data4/scratch/oog680-m5/basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
---- /data4/scratch/oog680-m5/basic/source/uno/scriptcont.cxx 2007-06-27 15:34:11.000000000 +0100
-+++ basic/source/uno/scriptcont.cxx 2007-09-16 22:12:22.000000000 +0100
-@@ -117,6 +117,10 @@
- #include <cppuhelper/factory.hxx>
- #include <com/sun/star/util/VetoException.hpp>
-
-+// start includes for BasicModuleTypeAccess
-+#include <basic/basicmanagerrepository.hxx>
-+#include <com/sun/star/script/ModuleType.hpp>
-+// end includes for BasicModuleTypeAccess
- namespace basic
- {
-
-@@ -1192,6 +1196,104 @@ void SfxScriptLibrary::storeResourcesToS
- (void)xStorage;
- }
-
-+
-+// hacky service for determining the Module type, class, normal ( eventually other
-+// 'object' module types as support is added )
-+
-+#define STANDARD String( RTL_CONSTASCII_USTRINGPARAM("Standard") )
-+
-+void createRegistryInfo_ExportableVBAModuleTypeAccess()
-+{
-+ static OAutoRegistration< ExportableVBAModuleTypeAccess > aAutoRegistration;
-+}
-+
-+::rtl::OUString SAL_CALL ExportableVBAModuleTypeAccess::getImplementationName( ) throw (RuntimeException)
-+{
-+ return getImplementationName_static();
-+}
-+
-+Sequence< ::rtl::OUString > SAL_CALL ExportableVBAModuleTypeAccess::getSupportedServiceNames( ) throw (RuntimeException)
-+{
-+ return getSupportedServiceNames_static();
-+}
-+
-+Sequence< OUString > ExportableVBAModuleTypeAccess::getSupportedServiceNames_static()
-+{
-+ Sequence< OUString > aServiceNames( 1 );
-+ aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.ExportableVBAModuleTypeAccess" );
-+ return aServiceNames;
-+}
-+
-+rtl::OUString ExportableVBAModuleTypeAccess::getImplementationName_static()
-+{
-+ static OUString aImplName;
-+ static sal_Bool bNeedsInit = sal_True;
-+
-+ MutexGuard aGuard( Mutex::getGlobalMutex() );
-+ if( bNeedsInit )
-+ {
-+ aImplName = OUString::createFromAscii( "ExportableVBAModuleTypeAccess" );
-+ bNeedsInit = sal_False;
-+ }
-+ return aImplName;
-+}
-+
-+Reference< XInterface > SAL_CALL ExportableVBAModuleTypeAccess::Create
-+ ( const Reference< XComponentContext >& )
-+ throw( Exception )
-+{
-+ Reference< XInterface > xRet =
-+ static_cast< XInterface* >( static_cast< OWeakObject* >(new ExportableVBAModuleTypeAccess()) );
-+ return xRet;
-+}
-+
-+void
-+ExportableVBAModuleTypeAccess::initialize( const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Any >& aArguments )
-+ throw (::com::sun::star::uno::Exception,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ if ( m_bInit )
-+ throw ::com::sun::star::uno::RuntimeException(); // already initialiazed
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xDocument;
-+ if ( aArguments.getLength() == 0 )
-+ throw ::com::sun::star::uno::RuntimeException(); // args expected
-+ xDocument.set( aArguments[ 0 ], ::com::sun::star::uno::UNO_QUERY_THROW ); // we only care about first argument ( should only be one anyway )
-+ m_pBasicMgr = BasicManagerRepository::getDocumentBasicManager( xDocument );
-+ if ( m_pBasicMgr )
-+ {
-+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > xLibContainer( m_pBasicMgr->GetDialogLibraryContainer(), ::com::sun::star::uno::UNO_QUERY );
-+ if ( xLibContainer.is() )
-+ {
-+ m_xDialogs.set( xLibContainer->getByName( rtl::OUString( STANDARD ) ), ::com::sun::star::uno::UNO_QUERY );
-+ }
-+
-+ }
-+}
-+
-+::sal_Int16 SAL_CALL
-+ExportableVBAModuleTypeAccess::getModuleType( const ::rtl::OUString& sModule )
-+ throw (::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int16 nType = ::com::sun::star::script::ModuleType::Unknown;
-+ StarBASIC* pLib = NULL;
-+ if ( m_pBasicMgr )
-+ pLib = m_pBasicMgr->GetLib( String( STANDARD ) );
-+ if ( pLib )
-+ {
-+ SbModule* pMod = dynamic_cast< SbModule* >( pLib->Find( sModule, SbxCLASS_DONTCARE ) );
-+ if ( pMod )
-+ {
-+ // Check if it's a Dialog first
-+ if ( m_xDialogs.is() && m_xDialogs->hasByName( sModule ) )
-+ nType = ::com::sun::star::script::ModuleType::Form;
-+ else
-+ nType = pMod->GetModuleTypeHint();
-+ }
-+ }
-+ return nType;
-+}
-+
- //============================================================================
-
- } // namespace basic
-diff -rup /data4/scratch/oog680-m5/svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
---- /data4/scratch/oog680-m5/svx/inc/svxmsbas.hxx 2005-09-08 20:02:27.000000000 +0100
-+++ svx/inc/svxmsbas.hxx 2007-09-16 22:04:01.000000000 +0100
-@@ -45,8 +45,23 @@
- #endif
-
- #include <sot/storage.hxx>
-+#include <vector>
-+
-+typedef ::std::pair< rtl::OUString, sal_Int16 > ModuleDesc; // type and group combination
-+typedef ::std::vector< ModuleDesc > vecModuleTypes;
-+typedef ::std::vector< String > vecStrings;
-
- class SfxObjectShell;
-+class SVX_DLLPUBLIC SvxMSUserFormHelper
-+{
-+ vecStrings mvUserFormNames;
-+
-+public:
-+ SvxMSUserFormHelper( SvStorageRef& xVBAStg, const String& rSubStorage );
-+
-+ vecStrings getUserFormNames();
-+ bool isUserFormModuleName( const String& sName );
-+};
-
- /* Construct with the root storage of the MS document, with bImportCode
- * set the visual basic code will be imported into the stardocument when Import
-@@ -65,12 +80,15 @@ class SfxObjectShell;
-
- class SVX_DLLPUBLIC SvxImportMSVBasic
- {
-+
- public:
-+ enum MacroExportOption { Copy, Delete, Save };
-+
- SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot,
- BOOL bImportCode = TRUE, BOOL bCopyStorage = TRUE )
- : xRoot(&rRoot), rDocSh(rDocS),
- bImport(bImportCode), bCopy(bCopyStorage)
-- {}
-+ { }
- // returns the status of import:
- // 0 - nothing has done
- // bit 0 = 1 -> any code is imported to the SO-Basic
-@@ -83,6 +101,8 @@ public:
- // - returns a warning code if a modified basic exist, in all other
- // cases return ERRCODE_NONE.
- ULONG SaveOrDelMSVBAStorage( BOOL bSaveInto, const String& rStorageName );
-+ ULONG SaveOrCopyOrDeleteMSVBAStorage( const MacroExportOption& nOption, const String& rStorageName );
-+
-
- // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
- // If it exist, then return the WarningId for loosing the information.
-@@ -95,6 +115,11 @@ private:
- BOOL bImport;
- BOOL bCopy;
-
-+ SVX_DLLPRIVATE BOOL GetVBAStorage(const String& rStorageName,
-+ const String &rSubStorageName,
-+ SvStorageRef &rProject,
-+ SvStorageRef &rVBA,
-+ bool bCreate);
- SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped);
---- /data4/latestBuild/ooo-build/build/oog680-m5/udkapi/com/sun/star/script/makefile.mk 2006-11-02 16:35:10.000000000 +0000
-+++ udkapi/com/sun/star/script/makefile.mk 2007-09-16 22:04:01.000000000 +0100
-@@ -89,6 +89,7 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ XModuleType.idl\
-
- # ------------------------------------------------------------------
-
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ udkapi/com/sun/star/script/XModuleType.idl 2007-09-16 22:04:01.000000000 +0100
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XInvocation.idl,v $
-+ *
-+ * $Revision$
-+ *
-+ * last change: $Author$ $Date$
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XInvocation_idl__
-+#define __com_sun_star_script_XInvocation_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+constants ModuleType
-+{
-+ const short Unknown = 0;
-+ const short Normal = 1;
-+ const short Class = 2;
-+ const short Form = 3;
-+ const short Document = 4;
-+};
-+interface XModuleTypeAccess: com::sun::star::uno::XInterface
-+{
-+ short getModuleType( [in] string sModule );
-+};
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff -rup ../../build/oog680-m5/svx/source/msfilter/makefile.mk svx/source/msfilter/makefile.mk
---- ../../build/oog680-m5/svx/source/msfilter/makefile.mk 2006-06-19 17:18:37.000000000 +0100
-+++ svx/source/msfilter/makefile.mk 2007-09-16 22:18:33.000000000 +0100
-@@ -53,6 +53,7 @@ SLOFILES=\
- $(SLO)$/msdffimp.obj \
- $(SLO)$/msoleexp.obj \
- $(SLO)$/msvbasic.obj \
-+ $(SLO)$/msvbasicdir.obj \
- $(SLO)$/msashape.obj \
- $(SLO)$/svxmsbas.obj \
- $(SLO)$/msocximex.obj \
-@@ -65,6 +66,7 @@ EXCEPTIONSFILES= \
- $(SLO)$/escherex.obj \
- $(SLO)$/msdffimp.obj \
- $(SLO)$/msashape3d.obj \
-+ $(SLO)$/msvbasicdir.obj \
- $(SLO)$/msvbasic.obj \
- $(SLO)$/msocximex.obj \
- $(SLO)$/msoleexp.obj \
-diff -rup ../../build/oog680-m5/svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
---- ../../build/oog680-m5/svx/source/msfilter/svxmsbas.cxx 2007-09-24 15:44:27.000000000 +0100
-+++ svx/source/msfilter/svxmsbas.cxx 2007-09-17 12:01:57.000000000 +0100
-@@ -61,7 +61,7 @@
- #include <svxmsbas.hxx>
- #endif
- #ifndef _MSVBASIC_HXX
--#include <msvbasic.hxx>
-+#include <msvbasicdir.hxx>
- #endif
- #ifndef _MSOCXIMEX_HXX
- #include <svx/msocximex.hxx>
-@@ -110,6 +110,48 @@ bool lcl_hasVBAEnabled()
- return false;
- }
-
-+
-+
-+SvxMSUserFormHelper::SvxMSUserFormHelper( SvStorageRef& rxVBAStg, const String& sIgnore )
-+{
-+ if (rxVBAStg.Is() && !rxVBAStg->GetError())
-+ {
-+ SvStorageInfoList aContents;
-+ rxVBAStg->FillInfoList(&aContents);
-+ OSL_TRACE("lcl_getUserFormNames info list gives %d entries", aContents.Count() );
-+ for (USHORT nI = 0; nI < aContents.Count(); ++nI)
-+ {
-+ SvStorageInfo& rInfo = aContents.GetObject(nI);
-+ OSL_TRACE("substorage item %d is %s ", nI, rtl::OUStringToOString( rInfo.GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if (!rInfo.IsStream() && rInfo.GetName() != sIgnore )
-+ mvUserFormNames.push_back(rInfo.GetName());
-+ }
-+ }
-+}
-+
-+vecStrings
-+SvxMSUserFormHelper::getUserFormNames()
-+{
-+ return mvUserFormNames;
-+}
-+
-+bool
-+SvxMSUserFormHelper::isUserFormModuleName( const String& sFormName )
-+{
-+ bool bFound = false;
-+ vecStrings::const_iterator it = mvUserFormNames.begin();
-+ vecStrings::const_iterator it_end = mvUserFormNames.end();
-+ for ( ; it != it_end; ++it )
-+ {
-+ if ( sFormName == *it )
-+ {
-+ bFound = true;
-+ break;
-+ }
-+ }
-+ return bFound;
-+}
-+
- int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
-@@ -138,15 +180,8 @@ bool SvxImportMSVBasic::ImportForms_Impl
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-
-- std::vector<String> aUserForms;
-- SvStorageInfoList aContents;
-- xVBAStg->FillInfoList(&aContents);
-- for (USHORT nI = 0; nI < aContents.Count(); ++nI)
-- {
-- SvStorageInfo& rInfo = aContents.GetObject(nI);
-- if (!rInfo.IsStream() && rInfo.GetName() != rSubStorageName)
-- aUserForms.push_back(rInfo.GetName());
-- }
-+ SvxMSUserFormHelper userFormsHelper( xVBAStg, rSubStorageName );
-+ vecStrings aUserForms = userFormsHelper.getUserFormNames();
-
- if (aUserForms.empty())
- return false;
-@@ -215,7 +250,7 @@ bool SvxImportMSVBasic::ImportForms_Impl
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
--
-+ OSL_TRACE("About to try and create userform %s", rtl::OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ).getStr() );
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
-@@ -277,180 +312,43 @@ BOOL SvxImportMSVBasic::CopyStorage_Impl
- return bValidStg;
- }
-
-+BOOL
-+SvxImportMSVBasic::GetVBAStorage(const String &rStorageName,
-+ const String &rSubStorageName,
-+ SvStorageRef &rProject,
-+ SvStorageRef &rVBA,
-+ bool bCreate)
-+{
-+ ULONG nFlags = STREAM_READWRITE | STREAM_SHARE_DENYALL;
-+
-+
-+ if( !bCreate )
-+ nFlags |= STREAM_NOCREATE;
-+ OSL_TRACE("VBA Storage is extracted from %s in %s", rtl::OUStringToOString( rSubStorageName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( rStorageName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ rProject = xRoot->OpenSotStorage( rStorageName, nFlags );
-+ if( rProject.Is() && SVSTREAM_OK == rProject->GetError() )
-+ {
-+ rVBA = rProject->OpenSotStorage( rSubStorageName, nFlags );
-+ if( rVBA.Is() && SVSTREAM_OK == rVBA->GetError() )
-+ return true;
-+ else
-+ DBG_WARNING("No Visual Basic in Storage");
-+ }
-+ else
-+ DBG_WARNING("No Macros Storage");
-+
-+ return false;
-+}
- BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
- {
-- BOOL bRet = FALSE;
-- bAsComment = FALSE;
-- VBA_Impl aVBA( *xRoot, bAsComment );
-- if( aVBA.Open(rStorageName,rSubStorageName) )
-+ bool bRet = false;
-+ SvStorageRef xProject, xVBA;
-+ if( GetVBAStorage( rStorageName, rSubStorageName, xProject, xVBA, false ) )
- {
-- SFX_APP()->EnterBasicCall();
-- Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
-- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
--
-- UINT16 nStreamCount = aVBA.GetNoStreams();
-- Reference<XNameContainer> xLib;
-- if( xLibContainer.is() && nStreamCount )
-- {
-- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-- if( !xLibContainer->hasByName( aLibName ) )
-- xLibContainer->createLibrary( aLibName );
--
-- Any aLibAny = xLibContainer->getByName( aLibName );
-- aLibAny >>= xLib;
-- }
-- if( xLib.is() )
-- {
-- for( UINT16 i=0; i<nStreamCount;i++)
-- {
-- StringArray aDecompressed = aVBA.Decompress(i);
--#if 0
--/* DR 2005-08-11 #124850# Do not filter special characters from module name.
-- Just put the original module name and let the Basic interpreter deal with
-- it. Needed for roundtrip...
-- */
-- ByteString sByteBasic(aVBA.GetStreamName(i),
-- RTL_TEXTENCODING_ASCII_US,
-- (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE|
-- RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
-- RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |
-- RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE)
-- );
--
-- const String sBasicModule(sByteBasic,
-- RTL_TEXTENCODING_ASCII_US);
--#else
-- const String &sBasicModule = aVBA.GetStreamName( i);
--#endif
-- /* #117718# expose information regarding type of Module
-- * Class, Form or plain 'ould VBA module with a REM statment
-- * at the top of the module. Mapping of Module Name
-- * to type is performed in VBA_Impl::Open() method,
-- * ( msvbasic.cxx ) by examining the PROJECT stream.
-- */
--
-- // using name from aVBA.GetStreamName
-- // because the encoding of the same returned
-- // is the same as the encoding for the names
-- // that are keys in the map used by GetModuleType method
-- const String &sOrigVBAModName = aVBA.GetStreamName( i );
-- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
--
-- rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
--
-- rtl::OUString modeTypeComment;
--
-- switch( mType )
-- {
-- case Class:
-- modeTypeComment = sClassRem +
-- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
-- break;
-- case Form:
-- modeTypeComment = sClassRem +
-- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
-- break;
-- case Document:
-- modeTypeComment = sClassRem +
-- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
-- break;
-- case Normal:
-- modeTypeComment = sClassRem +
-- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
-- break;
-- case Unknown:
-- modeTypeComment = sClassRem +
-- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
-- break;
-- default:
-- DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
-- break;
-- }
-- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
-- static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
-- if ( !bAsComment )
-- {
-- modeTypeComment = modeTypeComment + sVBAOption;
-- if ( mType == Class )
-- modeTypeComment = modeTypeComment + sClassOption;
--
-- }
--
-- String sModule(sBasicModule); //#i52606# no need to split Macros in 64KB blocks any more!
-- String sTemp;
-- if (bAsComment)
-- {
-- sTemp+=String(RTL_CONSTASCII_USTRINGPARAM( "Sub " ));
-- String sMunge(sModule);
-- //Streams can have spaces in them, but modulenames
-- //cannot !
-- sMunge.SearchAndReplaceAll(' ','_');
--
-- sTemp += sMunge;
-- sTemp.AppendAscii("\n");
-- };
-- ::rtl::OUString aSource(sTemp);
--
-- for(ULONG j=0;j<aDecompressed.GetSize();j++)
-- {
-- if (bStripped)
-- {
-- String *pStr = aDecompressed.Get(j);
-- bool bMac = true;
-- xub_StrLen nBegin = pStr->Search('\x0D');
-- if ((STRING_NOTFOUND != nBegin) && (pStr->Len() > 1) && (pStr->GetChar(nBegin+1) == '\x0A'))
-- bMac = false;
--
-- const char cLineEnd = bMac ? '\x0D' : '\x0A';
-- const String sAttribute(String::CreateFromAscii(
-- bAsComment ? "Rem Attribute" : "Attribute"));
-- nBegin = 0;
-- while (STRING_NOTFOUND != (nBegin = pStr->Search(sAttribute, nBegin)))
-- {
-- if ((nBegin) && pStr->GetChar(nBegin-1) != cLineEnd)
-- {
-- // npower #i63766# Need to skip instances of Attribute
-- // that are NOT Attribute statements
-- nBegin = nBegin + sAttribute.Len();
-- continue;
-- }
-- xub_StrLen nEnd = pStr->Search(cLineEnd ,nBegin);
-- // DR #i26521# catch STRING_NOTFOUND, will loop endless otherwise
-- if( nEnd == STRING_NOTFOUND )
-- pStr->Erase();
-- else
-- pStr->Erase(nBegin, (nEnd-nBegin)+1);
-- }
-- }
-- if( aDecompressed.Get(j)->Len() )
-- {
-- aSource+=::rtl::OUString( *aDecompressed.Get(j) );
-- }
--
-- }
-- if (bAsComment)
-- {
-- aSource += rtl::OUString::createFromAscii("\nEnd Sub");
-- }
-- ::rtl::OUString aModName( sModule );
-- if ( aSource.getLength() )
-- {
-- aSource = modeTypeComment + aSource;
--
-- Any aSourceAny;
-- aSourceAny <<= aSource;
-- if( xLib->hasByName( aModName ) )
-- xLib->replaceByName( aModName, aSourceAny );
-- else
-- xLib->insertByName( aModName, aSourceAny );
-- }
--
-- bRet = true;
-- }
-- }
-- SFX_APP()->LeaveBasicCall();
-+ VBADir aVBA( xProject, xVBA );
-+ bRet = aVBA.readBasic( rDocSh, bAsComment, bStripped );
- }
- return bRet;
- }
-@@ -458,30 +356,73 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- ULONG SvxImportMSVBasic::SaveOrDelMSVBAStorage( BOOL bSaveInto,
- const String& rStorageName )
- {
-+ MacroExportOption aOption = Delete;
-+ if ( bSaveInto )
-+ aOption = Copy;
-+ return SaveOrCopyOrDeleteMSVBAStorage( aOption, rStorageName );
-+}
-+
-+ULONG SvxImportMSVBasic::SaveOrCopyOrDeleteMSVBAStorage( const MacroExportOption& nOption,
-+ const String& rStorageName )
-+{
-+ OSL_TRACE("**** SvxImportMSVBasic::SaveOrCopyOrDeleteMSVBAStorage");
- ULONG nRet = ERRCODE_NONE;
- uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
- String aDstStgName( GetMSBasicStorageName() );
- SotStorageRef xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName,
-- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL ) );
-+// STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL ) );
-+ STREAM_READWRITE | STREAM_SHARE_DENYALL ) );
- if( xVBAStg.Is() && !xVBAStg->GetError() )
- {
-- xVBAStg = 0;
-- if( bSaveInto )
-+ xVBAStg = 0;
-+ // Copying from previous, why enterbasic call? ( mmm seems like re-entrency
-+ // detection foo )
-+ SFX_APP()->EnterBasicCall();
-+
-+ BasicManager *pBasicMan = rDocSh.GetBasicManager();
-+ bool bIsModified = ( pBasicMan && pBasicMan->IsBasicModified() );
-+ bIsModified = true;
-+ SFX_APP()->LeaveBasicCall();
-+ if( false /*bIsModified*/ ) // doesn't work, bIsModified is not reliable
-+ {
-+ OSL_TRACE("BASIC has being MODIFIED correct? ..." );
-+ nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE;
-+ }
-+ if( nOption == Save /*&& bIsModified*/ )
-+ {
-+
-+ OSL_TRACE("Crazy VBA writing hack !" );
-+ SvStorageRef xProject, xVBA;
-+ OUString sProject = OUString::createFromAscii( "_VBA_PROJECT_CUR" );
-+ OUString sVBA = OUString::createFromAscii( "VBA" );
-+ if( GetVBAStorage( // HACK:
-+ sProject,sVBA,
-+ xProject, xVBA, true ) )
-+ {
-+ SvStorageRef xMSProject = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, STREAM_STD_READ );
-+ VBADir aDir( xProject, xVBA );
-+ // Todo test for error ( and set error on
-+ // xRoot storage
-+ aDir.writeBasic( rDocSh ); // probably should return Error
-+ }
-+ else
-+ {
-+ OSL_TRACE( "Failed to create VBA storage" );
-+ }
-+ }
-+ else if ( nOption == Copy )// Copy basic streams
- {
-- BasicManager *pBasicMan = rDocSh.GetBasicManager();
-- if( pBasicMan && pBasicMan->IsBasicModified() )
-- nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE;
--
-- SotStorageRef xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, STREAM_STD_READ );
-- SotStorageRef xDst = xRoot->OpenSotStorage( rStorageName, STREAM_READWRITE | STREAM_TRUNC );
-- xSrc->CopyTo( xDst );
-- xDst->Commit();
-- ErrCode nError = xDst->GetError();
-- if ( nError == ERRCODE_NONE )
-- nError = xSrc->GetError();
-- if ( nError != ERRCODE_NONE )
-- xRoot->SetError( nError );
-+ SotStorageRef xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, STREAM_STD_READ );
-+ SotStorageRef xDst = xRoot->OpenSotStorage( rStorageName, STREAM_READWRITE | STREAM_TRUNC );
-+ xSrc->CopyTo( xDst );
-+ xDst->Commit();
-+ ErrCode nError = xDst->GetError();
-+ if ( nError == ERRCODE_NONE )
-+ nError = xSrc->GetError();
-+ if ( nError != ERRCODE_NONE )
-+ xRoot->SetError( nError );
- }
-+
- }
-
- return nRet;
diff --git a/patches/test/vba-workbook-worksheet-events.diff b/patches/test/vba-workbook-worksheet-events.diff
deleted file mode 100644
index ad09ffb77..000000000
--- a/patches/test/vba-workbook-worksheet-events.diff
+++ /dev/null
@@ -1,626 +0,0 @@
-diff -uNrp backup/sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
---- backup/sc/source/ui/docshell/docsh.cxx 2008-03-25 22:04:43.000000000 +0800
-+++ sc/source/ui/docshell/docsh.cxx 2008-03-25 20:53:51.000000000 +0800
-@@ -150,6 +150,8 @@
-
- using namespace com::sun::star;
-
-+bool processDocOpenMacro( ScDocShell* pShell );
-+bool processDocBeforeCloseMacro( ScDocShell* pShell );
- // STATIC DATA -----------------------------------------------------------
-
- // Stream-Namen im Storage
-@@ -688,7 +690,6 @@ BOOL ScDocShell::SaveXML( SfxMedium* pSa
- BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
- {
- RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
--
- ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
-
- // only the latin script language is loaded
-@@ -731,6 +732,10 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
- aDocument.InvalidateTableArea();
-
- bIsEmpty = FALSE;
-+
-+ // Handler for open workbook event
-+ processDocOpenMacro( this );
-+
- FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
- return bRet;
- }
-@@ -812,7 +817,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
- ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
-
- GetUndoManager()->Clear();
--
-+
- // ob nach dem Import optimale Spaltenbreiten gesetzt werden sollen
- BOOL bSetColWidths = FALSE;
- BOOL bSetSimpleTextColWidths = FALSE;
-@@ -833,6 +838,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
- nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : com::sun::star::document::UpdateDocMode::NO_UPDATE;
-
- const SfxFilter* pFilter = rMedium.GetFilter();
-+
- if (pFilter)
- {
- String aFltName = pFilter->GetFilterName();
-@@ -1257,6 +1263,10 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
- if ( bSetRowHeights )
- UpdateAllRowHeights(); // with vdev or printer, depending on configuration
- }
-+
-+ // Handler for open workbook event
-+ processDocOpenMacro( this );
-+
- FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
-
- // #73762# invalidate eventually temporary table areas
-@@ -2033,7 +2043,6 @@ BOOL __EXPORT ScDocShell::SaveCompleted(
- return SfxObjectShell::SaveCompleted( xStor );
- }
-
--
- BOOL __EXPORT ScDocShell::DoSaveCompleted( SfxMedium * pNewStor )
- {
- BOOL bRet = SfxObjectShell::DoSaveCompleted( pNewStor );
-@@ -2070,6 +2079,11 @@ USHORT __EXPORT ScDocShell::PrepareClose
-
- DoEnterHandler();
-
-+ // start handler for possible veto from DocBefore_Close
-+ if ( !IsInPrepareClose() && processDocBeforeCloseMacro( this ) )
-+ return sal_False;
-+ // end handler code
-+
- USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
- if (nRet == TRUE) // TRUE = schliessen
- aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
-diff -uNrp backup/sc/source/ui/docshell/makefile.mk sc/source/ui/docshell/makefile.mk
---- backup/sc/source/ui/docshell/makefile.mk 2008-03-25 10:12:40.000000000 +0800
-+++ sc/source/ui/docshell/makefile.mk 2008-03-25 20:58:46.000000000 +0800
-@@ -101,10 +101,12 @@ SLOFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-+ $(SLO)$/vbaevents.obj \
- $(SLO)$/editable.obj
-
-
- EXCEPTIONSFILES= \
-+ $(SLO)$/vbaevents.obj \
- $(SLO)$/docsh8.obj \
- $(SLO)$/dbdocimp.obj
-
-@@ -135,6 +137,7 @@ LIB1OBJFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-+ $(SLO)$/vbaevents.obj \
- $(SLO)$/editable.obj
-
- # --- Tagets -------------------------------------------------------
-diff -uNrp backup/sc/source/ui/docshell/vbaevents.cxx sc/source/ui/docshell/vbaevents.cxx
---- backup/sc/source/ui/docshell/vbaevents.cxx 1970-01-01 08:00:00.000000000 +0800
-+++ sc/source/ui/docshell/vbaevents.cxx 2008-03-25 20:51:55.000000000 +0800
-@@ -0,0 +1,419 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaevents.cxx,v $
-+ *
-+ * $Revision$
-+ *
-+ * last change: $Author$ $Date$
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#include "docsh.hxx"
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbx.hxx>
-+#include "scextopt.hxx"
-+#include <comphelper/processfactory.hxx>
-+#ifndef _COM_SUN_STAR_SHEET_XSHEETCELLRANGECONTAINER_HPP_
-+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#endif
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#ifndef _COM_SUN_STAR_SHEET_XCELLRANGEREFERRER_HPP_
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#endif
-+using namespace com::sun::star;
-+
-+const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-+const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook"));
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+ rtl::OUString getWorkbookModuleName( ScDocShell* pShell )
-+{
-+ rtl::OUString sCodeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ if ( pShell )
-+ {
-+ if ( ScExtDocOptions* pExtDocOpts = pShell->GetDocument()->GetExtDocOptions() )
-+ {
-+ if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
-+ sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
-+ }
-+ }
-+ return sCodeName;
-+}
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+bool executeWorkBookMacro( ScDocShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
-+{
-+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-+ // document saved from XL then we won't be able to determine the codename for the Workbook
-+ // Module, so... we have no choice but to search all modules for the moment, thus the macro
-+ // passed in should be the fully specified name.
-+ //rtl::OUString sCodeName = getWorkbookModuleName( pShell );
-+ //rtl::OUString sUrl = sUrlPart1.concat( sCodeName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sMacroName ).concat( sUrlPart2 );
-+ rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ;
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-+ aOutArgsIndex, aOutArgs, false );
-+
-+ // Script Executed?
-+ if ( nErr != ERRCODE_NONE )
-+ return false;
-+
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ nOutIndex ];
-+ }
-+
-+ }
-+ return true;
-+}
-+String docMacroExists( ScDocShell* pShell,
-+const String& sMod, const String& sMacro )
-+{
-+ String sFullName;
-+ // would use the script provider to see if the macro exists but
-+ // called at this stage tdoc content handler stuff is not set up
-+ // so it fails
-+
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+
-+ }
-+ }
-+ return sFullName;
-+}
-+
-+bool processDocBeforeCloseMacro( ScDocShell* pShell )
-+{
-+
-+ uno::Any aRet;
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ bool bCancel = sal_False;
-+ aArgs[ 0 ] <<= bCancel;
-+ const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforeClose") );
-+ String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
-+ if ( sFullClose.Len() > 0 )
-+ {
-+ if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
-+ return false;
-+ }
-+ aArgs[ 0 ] >>= bCancel;
-+ return bCancel;
-+}
-+
-+bool addOpenDocEvent( const uno::Reference< container::XNameReplace >& xEvts, const rtl::OUString& sOpenMacro )
-+{
-+ bool result = false;
-+ const rtl::OUString sUrl = sUrlPart0.concat( sOpenMacro ).concat( sUrlPart2 );
-+ const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
-+ const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
-+ const static rtl::OUString sEvt( RTL_CONSTASCII_USTRINGPARAM("OnLoad") );
-+ if ( xEvts.is() )
-+ {
-+ uno::Sequence< beans::PropertyValue > aEvents;
-+ xEvts->getByName( sEvt ) >>= aEvents;
-+ uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
-+ aOpenEvt[ 0 ].Name = sEvtType;
-+ aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
-+ aOpenEvt[ 1 ].Name = sScript;
-+ aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
-+ sal_Int32 nPos = aEvents.getLength();
-+
-+ sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
-+ if ( nNewSize > aEvents.getLength() )
-+ aEvents.realloc( nNewSize );
-+
-+ for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
-+ aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
-+
-+ uno::Any aParam = uno::makeAny( aEvents );
-+
-+ xEvts->replaceByName( sEvt, aParam );
-+ result = true;
-+ }
-+ return result;
-+}
-+
-+bool processDocOpenMacro( ScDocShell* pShell )
-+{
-+ bool result = false;
-+ // no point adding a handler for unless it exists
-+ // probably worth just doing this on import of xl document
-+
-+
-+ // Urk due to async nature, re-enterency and other horrors of the load
-+ // process, its seems the most sensible thing is to hook into the
-+ // document event broadcaster
-+ const static rtl::OUString sOpenMacro( RTL_CONSTASCII_USTRINGPARAM("Workbook_Open") );
-+ const static rtl::OUString sAuto_OpenMacro( RTL_CONSTASCII_USTRINGPARAM("auto_open") );
-+
-+ uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
-+ String sNull;
-+
-+ if ( xEvtSupplier.is() )
-+ {
-+ uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
-+ // until ObjectModules ( and persisting of codename ) are supported if this is a
-+ // document saved from XL then we won't be able to determine the codename for the Workbook
-+ // Module, so... we have no choice but to search all modules for the moment
-+ //rtl::OUString workbookModule = getWorkbookModuleName( pShell );
-+ rtl::OUString workbookModule; // no name means all modules will be searched
-+ String sFullOpen = docMacroExists( pShell, workbookModule, sOpenMacro );
-+ if ( sFullOpen.Len() > 0 )
-+ {
-+ if ( !addOpenDocEvent( xEvts, sFullOpen ) )
-+ return false;
-+ }
-+ // deep sigh, you can only specify one event binding not multiple ones, thats crap
-+/*
-+ String sFullAuto = docMacroExists( pShell, workbookModule, sAuto_OpenMacro );
-+ if ( sFullAuto.Len() > 0 )
-+ {
-+ if ( !addOpenDocEvent( xEvts, sFullAuto ) )
-+ return false;
-+ }
-+*/
-+ result = true;
-+
-+ }
-+ return result;
-+}
-+
-+uno::Any createWorkSheet( ScDocShell* pShell, SCTAB nTab )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ // Eventually we will be able to pull the Workbook/Worksheet objects
-+ // directly from basic and register them as listeners
-+
-+ // create Workbook
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( pShell->GetModel() );
-+ uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
-+
-+ // create WorkSheet
-+ String sSheetName;
-+ pShell->GetDocument()->GetName( nTab, sSheetName );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[ 0 ] <<= xWorkbook;
-+ aArgs[ 1 ] <<= pShell->GetModel();
-+ aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet") ), aArgs, xCtx );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any createRange( const uno::Any& aRange )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aRange, uno::UNO_QUERY );
-+ uno::Reference< table::XCellRange > xRange( aRange, uno::UNO_QUERY );
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ if ( xRanges.is() || xRange.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ if ( xRanges.is() )
-+ {
-+ aArgs[1] <<= xRanges;
-+ }
-+ else if ( xRange.is() )
-+ {
-+ aArgs[1] <<= xRange;
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Range") ), aArgs, xCtx );
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+String getSheetModuleName( ScDocShell* pShell, SCTAB nTab )
-+{
-+ ScExtDocOptions* pExtOptions = pShell->GetDocument()->GetExtDocOptions();
-+ String aCodeName;
-+ pShell->GetDocument()->GetName( nTab, aCodeName);
-+ // Use code name if that exists
-+ if ( pExtOptions )
-+ aCodeName = pExtOptions->GetCodeName( nTab );
-+ return aCodeName;
-+}
-+
-+sal_Bool executeSheetMacro( ScDocShell* pShell, SCTAB nTab, String& rMacroName, uno::Sequence< uno::Any >& rArgs )
-+{
-+ String aModuleName = getSheetModuleName( pShell, nTab );
-+ String aMacro = docMacroExists( pShell, aModuleName, rMacroName );
-+ if( aMacro.Len() == 0 )
-+ return sal_False;
-+
-+ uno::Any aRet;
-+ return executeWorkBookMacro( pShell, aMacro, rArgs, aRet );
-+}
-+
-+sal_Bool processSheetActivateMacro( ScDocShell* pShell, SCTAB nTab )
-+{
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Activate") );
-+ uno::Sequence< uno::Any > aArgs;
-+ return executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+}
-+
-+sal_Bool processSheetDeactivateMacro( ScDocShell* pShell, SCTAB nTab )
-+{
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Deactivate") );
-+ uno::Sequence< uno::Any > aArgs;
-+ return executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+}
-+
-+sal_Bool processSheetCalculateMacro( ScDocShell* pShell, SCTAB nTab )
-+{
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Calculate") );
-+ uno::Sequence< uno::Any > aArgs;
-+ return executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+}
-+
-+sal_Bool processSheetChangeMacro( ScDocShell* pShell, SCTAB nTab, const uno::Any& rRange )
-+{
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Change") );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ uno::Any aRange = createRange( rRange );
-+ aArgs[0] = aRange;
-+ return executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+}
-+
-+sal_Bool processSheetBeforeDoubleClickMacro( ScDocShell* pShell, SCTAB nTab, const uno::Any& rRange )
-+{
-+ sal_Bool result = sal_False;
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_BeforeDoubleClick") );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ uno::Any aRange = createRange( rRange );
-+ aArgs[0] = aRange;
-+ aArgs[1] <<= sal_False;
-+ executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+ aArgs[1] >>= result;
-+ return result;
-+}
-+
-+sal_Bool processSheetBeforeRightClickMacro( ScDocShell* pShell, SCTAB nTab, const uno::Any& rRange )
-+{
-+ sal_Bool result = sal_False;
-+ static String aMacroName( RTL_CONSTASCII_USTRINGPARAM("Worksheet_BeforeRightClick") );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ uno::Any aRange = createRange( rRange );
-+ aArgs[0] = aRange;
-+ aArgs[1] <<= sal_False;
-+ executeSheetMacro( pShell, nTab, aMacroName, aArgs );
-+ aArgs[1] >>= result;
-+ return result;
-+}
-+
-+sal_Bool processSelectionChangeMacro( ScDocShell* pShell, SCTAB nTab, const uno::Any& rRange )
-+{
-+ sal_Bool result = sal_False;
-+ String aSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_SelectionChange") );
-+ String aWorkBookSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Workbook_SheetSelectionChange") );
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ uno::Any aRange = createRange( rRange );
-+ aArgs[0] = aRange;
-+ //Worksheet_SelectionChanged
-+ result = executeSheetMacro( pShell, nTab, aSheetSelectionScript, aArgs );
-+
-+ //Workbook_SheetSelectionChange
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aRange;
-+ String aMacro = docMacroExists( pShell, String(), aWorkBookSheetSelectionScript );
-+ if( aMacro.Len() > 0 )
-+ {
-+ uno::Any aRet;
-+ result = executeWorkBookMacro( pShell, aMacro, aArgs, aRet );
-+ }
-+
-+ return result;
-+}
-diff -uNrp backup/sc/source/ui/unoobj/viewuno.cxx sc/source/ui/unoobj/viewuno.cxx
---- backup/sc/source/ui/unoobj/viewuno.cxx 2008-03-25 22:06:25.000000000 +0800
-+++ sc/source/ui/unoobj/viewuno.cxx 2008-03-25 15:42:34.000000000 +0800
-@@ -85,9 +85,10 @@
- #ifndef SC_ACCESSIBILITYHINTS_HXX
- #include "AccessibilityHints.hxx"
- #endif
--
- using namespace com::sun::star;
-
-+sal_Bool processSelectionChangeMacro( ScDocShell* pShell, SCTAB nTab, const uno::Any& rRange );
-+
- //------------------------------------------------------------------------
-
- //! Clipping-Markierungen
-@@ -1694,6 +1695,16 @@ void SAL_CALL ScTabViewObj::removeSelect
-
- void ScTabViewObj::SelectionChanged()
- {
-+ ScTabViewShell* pViewSh = GetViewShell();
-+ if ( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if ( pViewData )
-+ {
-+ processSelectionChangeMacro( pViewData->GetDocShell(), pViewData->GetTabNo(), getSelection() );
-+ }
-+ }
-+
- lang::EventObject aEvent;
- aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
- for ( USHORT n=0; n<aSelectionListeners.Count(); n++ )
-diff -uNrp backup/sc/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
---- backup/sc/source/ui/view/tabview3.cxx 2008-03-25 10:12:54.000000000 +0800
-+++ sc/source/ui/view/tabview3.cxx 2008-03-25 22:13:13.000000000 +0800
-@@ -88,6 +88,9 @@
-
- #include <com/sun/star/chart2/data/HighlightedRange.hpp>
-
-+sal_Bool processSheetDeactivateMacro( ScDocShell* pShell, SCTAB nTab );
-+sal_Bool processSheetActivateMacro( ScDocShell* pShell, SCTAB nTab );
-+
- namespace
- {
-
-@@ -1676,6 +1679,8 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- }
- }
-
-+ if( !bNew )
-+ processSheetDeactivateMacro( aViewData.GetDocShell(), aViewData.GetTabNo() );
- // nicht InputEnterHandler wegen Referenzeingabe !
-
- ScDocument* pDoc = aViewData.GetDocument();
-@@ -1777,7 +1782,10 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- if ( pGridWin[i]->IsVisible() )
- pGridWin[i]->UpdateEditViewPos();
- }
--
-+
-+ if( !bNew )
-+ processSheetActivateMacro( aViewData.GetDocShell(), aViewData.GetTabNo() );
-+
- TabChanged(); // DrawView
- aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
- if ( !bUnoRefDialog )
---- /data4/sles/ooo-mLnew/ooo-build/build/ooc680-m2/sfx2/source/doc/objmisc.cxx 2006-05-22 08:25:06.000000000 +0100
-+++ sfx2/source/doc/objmisc.cxx 2006-06-02 13:29:02.000000000 +0100
-@@ -1396,7 +1396,7 @@ ErrCode SfxObjectShell::CallXScript( con
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-- aOutParam)
-+ aOutParam, bool bRaiseError )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1470,7 +1470,7 @@ ErrCode SfxObjectShell::CallXScript( con
- nErr = ERRCODE_BASIC_INTERNAL_ERROR;
- }
-
-- if ( bCaughtException )
-+ if ( bCaughtException && bRaiseError )
- {
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
-
-
---- /data4/sles/ooo-mLnew/ooo-build/build/ooc680-m2/sfx2/inc/objsh.hxx 2006-05-02 17:01:46.000000000 +0100
-+++ sfx2/inc/sfx2/objsh.hxx 2006-06-02 13:29:01.000000000 +0100
-@@ -427,7 +427,8 @@ public:
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
-- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-+ bool bRaiseError = true
- );
-
- BOOL DoMacroQuery( const String& rScriptType );
-
diff --git a/patches/test/vba/HackyImageControlWithNonLinkedImages.diff b/patches/test/vba/HackyImageControlWithNonLinkedImages.diff
deleted file mode 100644
index fdae2f0ab..000000000
--- a/patches/test/vba/HackyImageControlWithNonLinkedImages.diff
+++ /dev/null
@@ -1,1158 +0,0 @@
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/forms/source/component/ImageControl.cxx forms/source/component/ImageControl.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/forms/source/component/ImageControl.cxx 2008-04-11 09:16:50.000000000 +0100
-+++ forms/source/component/ImageControl.cxx 2008-07-08 00:04:54.000000000 +0100
-@@ -57,6 +57,9 @@
- #include <com/sun/star/io/NotConnectedException.hpp>
- #include <com/sun/star/beans/PropertyValue.hpp>
- #include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
-+#include <com/sun/star/embed/ElementModes.hpp>
-+
- #include <tools/urlobj.hxx>
- #include <tools/stream.hxx>
- #include <tools/debug.hxx>
-@@ -353,13 +356,23 @@ sal_Bool OImageControlModel::handleNewIm
- ::std::auto_ptr< SvStream > pImageStream;
- Reference< XInputStream > xImageStream;
-
-- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
-+ Reference< graphic::XGraphicLinkProvider > xProv;
-+ m_xAggregateSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ) ) >>= xProv;
-+ if ( xProv.is() && utl::SvPictureStreamHelper::IsPackagePictureURL( _rURL ) )
- {
-- xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
-+ pImageStream.reset( utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( _rURL, xProv->getStorage() ) );
- }
-- else
-+ if ( !pImageStream.get() )
- {
-- pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
-+ if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
-+ {
-+ xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
-+ }
-+ else
-+ {
-+ pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
-+ }
-+ }
- sal_Bool bSetNull = ( pImageStream.get() == NULL ) || ( ERRCODE_NONE != pImageStream->GetErrorCode() );
-
- if (!bSetNull)
-@@ -373,7 +386,6 @@ sal_Bool OImageControlModel::handleNewIm
-
- xImageStream = new ::utl::OInputStreamHelper( new SvLockBytes( pImageStream.get(), sal_False ), nSize );
- }
-- }
-
- if ( xImageStream.is() )
- {
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/forms/source/component/imgprod.cxx forms/source/component/imgprod.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/forms/source/component/imgprod.cxx 2008-05-05 16:21:55.000000000 +0100
-+++ forms/source/component/imgprod.cxx 2008-07-07 22:49:39.000000000 +0100
-@@ -49,6 +49,8 @@
- // - ImgProdLockBytes -
- // --------------------
-
-+using namespace com::sun::star;
-+
- class ImgProdLockBytes : public SvLockBytes
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStmRef;
-@@ -644,6 +646,21 @@ void ImageProducer::initialize( const ::
- SetImage( aURL );
- }
- }
-+ else if ( aArguments.getLength() == 2 )
-+ {
-+ rtl::OUString aURL;
-+ uno::Reference< embed::XStorage > xStor;
-+ if ( ( aArguments[ 0 ] >>= aURL ) && ( aArguments[ 1 ] >>= xStor ) )
-+ {
-+ if ( utl::SvPictureStreamHelper::IsPackagePictureURL( aURL ) )
-+ {
-+ std::auto_ptr< SvStream > pIs( utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( aURL, xStor ) );
-+ SetImage( *pIs );
-+ }
-+ else
-+ SetImage( aURL );
-+ }
-+ }
- }
-
- namespace frm
-Only in forms/source/resource: localize.sdf
-Only in goodies/source/filter.vcl/egif: localize.sdf
-Only in goodies/source/filter.vcl/eos2met: localize.sdf
-Only in goodies/source/filter.vcl/epbm: localize.sdf
-Only in goodies/source/filter.vcl/epgm: localize.sdf
-Only in goodies/source/filter.vcl/epict: localize.sdf
-Only in goodies/source/filter.vcl/eppm: localize.sdf
-Only in goodies/source/filter.vcl/eps: localize.sdf
-Only in goodies/source/inv: localize.sdf
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/goodies/source/unographic/provider.cxx goodies/source/unographic/provider.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/goodies/source/unographic/provider.cxx 2008-04-11 01:08:51.000000000 +0100
-+++ goodies/source/unographic/provider.cxx 2008-07-07 23:05:02.000000000 +0100
-@@ -52,6 +52,8 @@
- #include <com/sun/star/io/XStream.hpp>
- #include <com/sun/star/text/GraphicCrop.hpp>
-
-+#include <comphelper/storagehelper.hxx>
-+
- #include "descriptor.hxx"
- #include "graphic.hxx"
- #include "provider.hxx"
-@@ -319,7 +321,7 @@ uno::Reference< beans::XPropertySet > SA
-
- ::rtl::OUString aURL;
- uno::Reference< io::XInputStream > xIStm;
--
-+ uno::Reference< embed::XStorage > xStor;
- for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i )
- {
- const ::rtl::OUString aName( rMediaProperties[ i ].Name );
-@@ -333,9 +335,34 @@ uno::Reference< beans::XPropertySet > SA
- {
- aValue >>= xIStm;
- }
-+ else if( COMPARE_EQUAL == aName.compareToAscii( "Storage" ) )
-+ {
-+ aValue >>= xStor;
-+ }
- }
--
-- if( xIStm.is() )
-+
-+ if ( xStor.is() && ::utl::SvPictureStreamHelper::IsPackagePictureURL( aURL ) )
-+ {
-+ // #TODO some asserts or something if xStream or xIStm are null
-+ // #TODO - this is duplicated in queryGraphic below ( move to common func )
-+ std::auto_ptr< SvStream > pIStm;
-+ ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter();
-+
-+ if( pFilter )
-+ {
-+ ::Graphic aVCLGraphic;
-+
-+ if( ( pFilter->ImportGraphic( aVCLGraphic, aURL, *pIStm ) == GRFILTER_OK ) &&
-+ ( aVCLGraphic.GetType() != GRAPHIC_NONE ) )
-+ {
-+ ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
-+
-+ pUnoGraphic->init( aVCLGraphic );
-+ xRet = pUnoGraphic;
-+ }
-+ }
-+ }
-+ else if( xIStm.is() )
- {
- GraphicDescriptor* pDescriptor = new GraphicDescriptor;
- pDescriptor->init( xIStm, aURL );
-@@ -379,6 +406,7 @@ uno::Reference< ::graphic::XGraphic > SA
- SvStream* pIStm = NULL;
-
- uno::Reference< io::XInputStream > xIStm;
-+ uno::Reference< embed::XStorage > xStor;
-
- for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !pIStm && !xRet.is(); ++i )
- {
-@@ -395,12 +423,22 @@ uno::Reference< ::graphic::XGraphic > SA
- {
- aValue >>= xIStm;
- }
-+ else if( COMPARE_EQUAL == aName.compareToAscii( "Storage" ) )
-+ {
-+ aValue >>= xStor;
-+ }
- }
-
-+
- if( xIStm.is() )
- {
- pIStm = ::utl::UcbStreamHelper::CreateStream( xIStm );
- }
-+
-+ else if ( xStor.is() && utl::SvPictureStreamHelper::IsPackagePictureURL( aPath ) )
-+ {
-+ pIStm = ::utl::SvPictureStreamHelper::GetStreamFromPackagePictureURL( aPath, xStor );
-+ }
- else if( aPath.Len() )
- {
- xRet = implLoadMemory( aPath );
-@@ -434,6 +472,8 @@ uno::Reference< ::graphic::XGraphic > SA
- pUnoGraphic->init( aVCLGraphic );
- xRet = pUnoGraphic;
- }
-+ if ( xStor.is() )
-+ OSL_TRACE("**** xRet is %d", xRet.is() );
- }
-
- delete pIStm;
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/offapi/com/sun/star/document/makefile.mk offapi/com/sun/star/document/makefile.mk
---- /data4/M21/ooo-build/build-src/dev300-m21/offapi/com/sun/star/document/makefile.mk 2008-07-09 13:18:21.000000000 +0100
-+++ offapi/com/sun/star/document/makefile.mk 2008-07-09 09:32:56.000000000 +0100
-@@ -92,6 +92,7 @@ IDLFILES=\
- XFilter.idl\
- XFilterAdapter.idl\
- XGraphicObjectResolver.idl\
-+ XGraphicResolver.idl\
- XImporter.idl\
- XInteractionFilterOptions.idl\
- XInteractionFilterSelect.idl\
-Only in offapi/com/sun/star/document: XGraphicResolver.idl
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/offapi/com/sun/star/graphic/makefile.mk offapi/com/sun/star/graphic/makefile.mk
---- /data4/M21/ooo-build/build-src/dev300-m21/offapi/com/sun/star/graphic/makefile.mk 2008-04-11 01:03:27.000000000 +0100
-+++ offapi/com/sun/star/graphic/makefile.mk 2008-07-07 16:22:04.000000000 +0100
-@@ -53,7 +53,8 @@ IDLFILES= \
- XGraphic.idl \
- XGraphicProvider.idl \
- XGraphicRenderer.idl \
-- XGraphicTransformer.idl
-+ XGraphicTransformer.idl \
-+ XGraphicLinkProvider.idl \
-
- # --- Targets ------------------------------------------------------
-
-Only in offapi/com/sun/star/graphic: XGraphicLinkProvider.idl
-Only in svx/inc/: localize.sdf
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/svx/inc/xmlgrhlp.hxx svx/inc/xmlgrhlp.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/svx/inc/xmlgrhlp.hxx 2008-04-10 20:13:29.000000000 +0100
-+++ svx/inc/xmlgrhlp.hxx 2008-07-09 10:35:12.000000000 +0100
-@@ -37,8 +37,9 @@
- #include <vector>
- #include <set>
- #include <utility>
--#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <com/sun/star/document/XGraphicResolver.hpp>
- #include <com/sun/star/document/XBinaryStreamResolver.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/embed/XStorage.hpp>
- #include "svx/svxdllapi.h"
-
-@@ -61,8 +62,9 @@ struct SvxGraphicHelperStream_Impl
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream > xStream;
- };
-
--class SVX_DLLPUBLIC SvXMLGraphicHelper : public ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
-- ::com::sun::star::document::XBinaryStreamResolver >
-+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicResolver, ::com::sun::star::document::XBinaryStreamResolver > SvXMLGraphicHelper_BASE;
-+
-+class SVX_DLLPUBLIC SvXMLGraphicHelper : public SvXMLGraphicHelper_BASE
- {
- private:
-
-@@ -118,6 +120,7 @@ public:
-
- public:
-
-+ virtual ::rtl::OUString SAL_CALL resolveGraphicObject( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) throw(::com::sun::star::uno::RuntimeException);
- // XGraphicObjectResolver
- virtual ::rtl::OUString SAL_CALL resolveGraphicObjectURL( const ::rtl::OUString& aURL ) throw(::com::sun::star::uno::RuntimeException);
-
-Only in svx/source/accessibility: localize.sdf
-Only in svx/source/dialog: localize.sdf
-Only in svx/source/editeng: localize.sdf
-Only in svx/source/engine3d: localize.sdf
-Only in svx/source/fmcomp: localize.sdf
-Only in svx/source/form: localize.sdf
-Only in svx/source/gallery2: localize.sdf
-Only in svx/source/intro: localize.sdf
-Only in svx/source/items: localize.sdf
-Only in svx/source/mnuctrls: localize.sdf
-Only in svx/source/options: localize.sdf
-Only in svx/source/outliner: localize.sdf
-Only in svx/source/src: localize.sdf
-Only in svx/source/stbctrls: localize.sdf
-Only in svx/source/svdraw: localize.sdf
-Only in svx/source/svxlink: localize.sdf
-Only in svx/source/table: localize.sdf
-Only in svx/source/tbxctrls: localize.sdf
-Only in svx/source/toolbars: localize.sdf
-Only in svx/source/unodialogs/textconversiondlgs: localize.sdf
-Only in svx/source/unodraw: localize.sdf
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/svx/source/xml/xmlgrhlp.cxx svx/source/xml/xmlgrhlp.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/svx/source/xml/xmlgrhlp.cxx 2008-04-11 05:11:07.000000000 +0100
-+++ svx/source/xml/xmlgrhlp.cxx 2008-07-09 10:54:27.000000000 +0100
-@@ -38,7 +38,9 @@
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XInitialization.hpp>
-+#include <com/sun/star/graphic/XGraphicProvider.hpp>
- #include <cppuhelper/compbase4.hxx>
-+#include <comphelper/processfactory.hxx>
-
- #include <unotools/ucbstreamhelper.hxx>
- #include <unotools/streamwrap.hxx>
-@@ -401,16 +403,12 @@ const GraphicObject& SvXMLGraphicOutputS
- // - SvXMLGraphicHelper -
- // ----------------------
-
--SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) :
-- ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
-- ::com::sun::star::document::XBinaryStreamResolver >( maMutex )
-+SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) : SvXMLGraphicHelper_BASE( maMutex )
- {
- Init( NULL, eCreateMode, sal_False );
- }
-
--SvXMLGraphicHelper::SvXMLGraphicHelper() :
-- ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
-- ::com::sun::star::document::XBinaryStreamResolver >( maMutex )
-+SvXMLGraphicHelper::SvXMLGraphicHelper() : SvXMLGraphicHelper_BASE( maMutex )
- {
- }
-
-@@ -820,6 +818,22 @@ void SvXMLGraphicHelper::Destroy( SvXMLG
-
- // -----------------------------------------------------------------------------
-
-+OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObject( const uno::Reference< graphic::XGraphic > & rxGraphic ) throw(uno::RuntimeException)
-+{
-+ rtl::OUString sRet;
-+ // Create tmp GraphicObject
-+ GraphicObject tmpGraphic( rxGraphic );
-+ const OUString aId( OUString::createFromAscii( tmpGraphic.GetUniqueID().GetBuffer() ) );
-+
-+ if( aId.getLength() )
-+ {
-+ sRet = OUString::createFromAscii( XML_GRAPHICOBJECT_URL_BASE );
-+ sRet += aId;
-+ sRet = resolveGraphicObjectURL( sRet );
-+ }
-+ return sRet;
-+}
-+
- // XGraphicObjectResolver
- OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const OUString& aURL )
- throw(uno::RuntimeException)
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/controls/unocontrols.hxx 2008-04-11 10:00:24.000000000 +0100
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx 2008-07-07 18:02:37.000000000 +0100
-@@ -54,6 +54,8 @@
- #include <com/sun/star/awt/XCurrencyField.hpp>
- #include <com/sun/star/awt/XPatternField.hpp>
- #include <com/sun/star/awt/XProgressBar.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
-+#include <com/sun/star/lang/XInitialization.hpp>
- #include <toolkit/controls/unocontrolmodel.hxx>
- #include <toolkit/controls/unocontrolbase.hxx>
- #include <toolkit/helper/macros.hxx>
-@@ -67,6 +69,23 @@
-
- #include <list>
-
-+namespace css = ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< css::graphic::XGraphicLinkProvider, css::lang::XInitialization > GRAPHIC_LINKPROVIDER_BASE;
-+
-+class GraphLinkProviderImpl : public GRAPHIC_LINKPROVIDER_BASE
-+{
-+ css::uno::Reference< css::embed::XStorage > mxStorage;
-+ rtl::OUString msURL;
-+public:
-+ GraphLinkProviderImpl();
-+ // XGraphicLinkProvider
-+ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getStorage() throw (css::uno::RuntimeException);
-+
-+ virtual ::rtl::OUString SAL_CALL getSourceURL() throw (css::uno::RuntimeException);
-+ // XInitialization
-+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
-+};
-
- // ----------------------------------------------------
- // class UnoControlEditModel
-@@ -219,10 +238,10 @@ private:
- std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners;
- bool mbAdjustingImagePosition;
- bool mbAdjustingGraphic;
--
-+ bool mbAdjustingLinkProvider;
- protected:
-- ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-- ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-+ ImageProducerControlModel();
-+ ImageProducerControlModel( const ImageProducerControlModel& _rSource );
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/helper/property.hxx 2008-07-09 13:18:03.000000000 +0100
-+++ toolkit/inc/toolkit/helper/property.hxx 2008-07-07 17:01:58.000000000 +0100
-@@ -190,6 +190,7 @@ namespace rtl {
- #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
- #define BASEPROPERTY_ENABLEVISIBLE 137 // sal_Bool
- #define BASEPROPERTY_GROUPNAME 138 // ::rtl::OUString
-+#define BASEPROPERTY_GRAPHICLINKPROVIDER 139 // css::graphic::XGraphicLinkProvider
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
- #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/inc/toolkit/helper/servicenames.hxx 2008-04-11 10:05:43.000000000 +0100
-+++ toolkit/inc/toolkit/helper/servicenames.hxx 2008-07-07 18:10:57.000000000 +0100
-@@ -98,6 +98,7 @@ extern const sal_Char __FAR_DATA szServi
- extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
-+extern const sal_Char __FAR_DATA szServiceName_GraphLinkProvider[];
-
- // ExtUnoWrapper:
- extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
-Only in toolkit/source/awt: localize.sdf
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/dialogcontrol.cxx 2008-07-09 13:18:03.000000000 +0100
-+++ toolkit/source/controls/dialogcontrol.cxx 2008-07-07 23:08:03.000000000 +0100
-@@ -2118,7 +2118,8 @@ throw (RuntimeException)
- rbase >>= baseLocation;
- rUrl >>= url;
-
-- if ( url.getLength() > 0 )
-+ // Don't adjust a package url
-+ if ( !utl::SvPictureStreamHelper::IsPackagePictureURL( url ) && url.getLength() > 0 )
- {
- INetURLObject urlObj(baseLocation);
- urlObj.removeSegment();
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/unocontrolmodel.cxx toolkit/source/controls/unocontrolmodel.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/unocontrolmodel.cxx 2008-07-09 13:18:03.000000000 +0100
-+++ toolkit/source/controls/unocontrolmodel.cxx 2008-07-07 17:31:51.000000000 +0100
-@@ -37,6 +37,7 @@
- #include <com/sun/star/awt/FontWeight.hpp>
- #include <com/sun/star/awt/FontSlant.hpp>
- #include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
- #include <com/sun/star/io/XMarkableStream.hpp>
- #include <toolkit/controls/unocontrolmodel.hxx>
- #include <toolkit/helper/macros.hxx>
-@@ -256,6 +257,8 @@ void UnoControlModel::ImplPropertyChange
- {
- case BASEPROPERTY_GRAPHIC: aDefault <<= ::com::sun::star::uno::makeAny(
- ::com::sun::star::uno::Reference< graphic::XGraphic >() ); break;
-+ case BASEPROPERTY_GRAPHICLINKPROVIDER: aDefault <<= ::com::sun::star::uno::makeAny(
-+ ::com::sun::star::uno::Reference< graphic::XGraphicLinkProvider >() ); break;
- case BASEPROPERTY_VERTICALALIGN:
- case BASEPROPERTY_BORDERCOLOR:
- case BASEPROPERTY_SYMBOL_COLOR:
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/controls/unocontrols.cxx 2008-04-11 10:33:44.000000000 +0100
-+++ toolkit/source/controls/unocontrols.cxx 2008-07-09 12:40:45.000000000 +0100
-@@ -37,6 +37,8 @@
- #include <com/sun/star/awt/VisualEffect.hpp>
- #include <com/sun/star/awt/LineEndFormat.hpp>
- #include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/util/Date.hpp>
-
-
-@@ -51,6 +53,7 @@
- #include <toolkit/helper/servicenames.hxx>
- #include <toolkit/helper/macros.hxx>
- #include <toolkit/helper/imagealign.hxx>
-+#include <unotools/ucbstreamhelper.hxx>
-
- // for introspection
- #include <toolkit/awt/vclxwindows.hxx>
-@@ -58,6 +61,7 @@
- #include <comphelper/componentcontext.hxx>
- #include <comphelper/processfactory.hxx>
- #include <comphelper/extract.hxx>
-+
- #include <vcl/wrkwin.hxx>
- #include <vcl/svapp.hxx>
- #include <vcl/edit.hxx>
-@@ -104,6 +108,34 @@ static void lcl_knitImageComponents( con
- }
- }
-
-+
-+GraphLinkProviderImpl::GraphLinkProviderImpl()
-+{
-+}
-+
-+Reference< embed::XStorage > SAL_CALL GraphLinkProviderImpl::getStorage() throw (RuntimeException)
-+{
-+ return mxStorage;
-+}
-+
-+::rtl::OUString SAL_CALL GraphLinkProviderImpl::getSourceURL() throw (RuntimeException)
-+{
-+ return msURL;
-+}
-+
-+void SAL_CALL GraphLinkProviderImpl::initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
-+{
-+ if ( aArguments.getLength() != 2 )
-+ throw uno::RuntimeException();
-+
-+ aArguments[ 0 ] >>= msURL;
-+ Reference< frame::XModel > xModel( aArguments[ 1 ], UNO_QUERY_THROW );
-+
-+ Reference< document::XStorageBasedDocument > xDocStorage( xModel, UNO_QUERY_THROW );
-+ mxStorage.set( xDocStorage->getDocumentStorage(), UNO_QUERY_THROW );
-+ // #TODO sprinkle with some asserts
-+}
-+
- // ----------------------------------------------------
- // class UnoControlEditModel
- // ----------------------------------------------------
-@@ -548,6 +580,17 @@ UnoFileControl::UnoFileControl()
- // ----------------------------------------------------
- // class ImageProducerControlModel
- // ----------------------------------------------------
-+
-+ImageProducerControlModel::ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ), mbAdjustingLinkProvider( false )
-+{
-+ ImplRegisterProperty( BASEPROPERTY_GRAPHICLINKPROVIDER );
-+}
-+
-+ImageProducerControlModel::ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ), mbAdjustingLinkProvider( false )
-+{
-+ ImplRegisterProperty( BASEPROPERTY_GRAPHICLINKPROVIDER );
-+}
-+
- uno::Any SAL_CALL ImageProducerControlModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
- {
- return UnoControlModel::queryInterface( rType );
-@@ -578,7 +621,7 @@ uno::Any ImageProducerControlModel::Impl
- }
- namespace
- {
-- uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL, const uno::Reference< embed::XStorage >& rxStorage )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
- if ( !_rURL.getLength() )
-@@ -593,18 +636,34 @@ namespace
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
-+ if ( rxStorage.is() && ::utl::SvPictureStreamHelper::IsPackagePictureURL( _rURL ) )
-+ {
-+ sal_Int32 nOldLen = aMediaProperties.getLength();
-+ aMediaProperties.realloc( nOldLen + 1 );
-+ aMediaProperties[ nOldLen ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Storage" ) );
-+ aMediaProperties[ nOldLen ].Value <<= rxStorage;
-+ }
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch( const Exception& )
- {
-+ OSL_TRACE("unhandled details URL %s Storage is ( %d )", rtl::OUStringToOString( _rURL, RTL_TEXTENCODING_UTF8 ).getStr(), xStorage.is() );
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
- }
-+
-+ uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ {
-+ uno::Reference< embed::XStorage > xStorage;
-+ return lcl_getGraphicFromURL_nothrow( _rURL, xStorage );
-+ }
-+
- }
-
-+
- void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
- {
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-@@ -615,17 +674,45 @@ void SAL_CALL ImageProducerControlModel:
- {
- switch ( nHandle )
- {
-+ // someone wants to set an image that is carried in the
-+ // associated storage ( e.g the document )
-+ case BASEPROPERTY_GRAPHICLINKPROVIDER:
-+ {
-+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
-+ OSL_VERIFY( rValue >>= xProv );
-+ rtl::OUString sURL;
-+ if ( xProv.is() )
-+ {
-+ sURL = xProv->getSourceURL();
-+ if ( sURL.getLength() )
-+ {
-+ mbAdjustingLinkProvider = true;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( sURL ) );
-+ mbAdjustingLinkProvider = false;
-+ }
-+ }
-+ break;
-+ }
-+
- case BASEPROPERTY_IMAGEURL:
-+ {
-+ if ( !mbAdjustingLinkProvider && ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
-+ // reset the GraphicLinkProvider ( null ) if someone is setting
-+ // the external ImageURL property directly.
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ), uno::makeAny( uno::Reference< graphic::XGraphicLinkProvider >() ) );
- if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
- {
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
-+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
-+ if ( ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
-+ getPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ) ) >>= xProv;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL, xProv.is() ? xProv->getStorage() : NULL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
--
-+ }
- case BASEPROPERTY_GRAPHIC:
- if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
- {
-@@ -676,8 +763,18 @@ void ImageProducerControlModel::removeCo
-
- void ImageProducerControlModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException)
- {
-- uno::Sequence<uno::Any> aArgs(1);
-+ uno::Sequence<uno::Any> aArgs(2);
- aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) );
-+
-+ uno::Reference< graphic::XGraphicLinkProvider > xProv;
-+ if ( ImplHasProperty( BASEPROPERTY_GRAPHICLINKPROVIDER ) )
-+ getPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHICLINKPROVIDER ) ) >>= xProv;
-+
-+ if ( xProv.is() )
-+ aArgs[1] <<= xProv->getStorage();
-+ else
-+ aArgs.realloc( 1 );
-+
- uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- uno::Reference< awt::XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), uno::UNO_QUERY );
- if ( xImageProducer.is() )
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/property.cxx 2008-07-09 13:18:03.000000000 +0100
-+++ toolkit/source/helper/property.cxx 2008-07-07 17:34:34.000000000 +0100
-@@ -53,6 +53,7 @@
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
- #include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <comphelper/types.hxx>
- #include <functional>
-@@ -180,6 +181,7 @@ ImplPropertyInfo* ImplGetPropertyInfos(
-
- DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
- DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
-+ DECL_PROP_2 ( "GraphicLinkProvider", GRAPHICLINKPROVIDER, Reference< ::com::sun::star::graphic::XGraphicLinkProvider >, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/registerservices.cxx 2008-07-09 13:18:24.000000000 +0100
-+++ toolkit/source/helper/registerservices.cxx 2008-07-07 18:09:17.000000000 +0100
-@@ -198,6 +198,7 @@ IMPL_CREATEINSTANCE( UnoSimpleAnimationC
- IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
- IMPL_CREATEINSTANCE( UnoThrobberControl )
- IMPL_CREATEINSTANCE( UnoThrobberControlModel )
-+IMPL_CREATEINSTANCE( GraphLinkProviderImpl )
-
- extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
- extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
-@@ -287,6 +288,7 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL comp
- registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
- registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
- registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
-+ registerServices( xRegistryKey, "GraphLinkProviderImpl", szServiceName_GraphLinkProvider );
-
- comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey );
- comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey );
-@@ -369,6 +371,7 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL compone
- CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL )
- CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
- CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
-+ CHECKANDCREATEFACTORY( GraphLinkProviderImpl, szServiceName_GraphLinkProvider, NULL )
-
- if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
- return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/toolkit/source/helper/servicenames.cxx 2008-04-11 10:37:36.000000000 +0100
-+++ toolkit/source/helper/servicenames.cxx 2008-07-07 17:37:51.000000000 +0100
-@@ -101,4 +101,4 @@ const sal_Char __FAR_DATA szServiceName_
- const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
- const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
- const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
--
-+const sal_Char __FAR_DATA szServiceName_GraphLinkProvider[] = "com.sun.star.awt.GraphicLinkProvider";
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/inc/xmloff/xmlexp.hxx xmloff/inc/xmloff/xmlexp.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/inc/xmloff/xmlexp.hxx 2008-04-15 15:17:24.000000000 +0100
-+++ xmloff/inc/xmloff/xmlexp.hxx 2008-07-09 10:00:11.000000000 +0100
-@@ -42,6 +42,7 @@
- #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
- #include <com/sun/star/xml/sax/XAttributeList.hpp>
- #include <com/sun/star/xml/sax/XLocator.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
- #include <rtl/ustring.hxx>
-@@ -57,6 +58,7 @@
- #include <com/sun/star/document/XFilter.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/document/XExporter.hpp>
-+#include <com/sun/star/document/XGraphicResolver.hpp>
- #ifndef _COM_SUN_STAR_DRAWING_XGRAPHICOBJECTRESOLVER_HPP_
- #include <com/sun/star/document/XGraphicObjectResolver.hpp>
- #endif
-@@ -461,6 +463,8 @@ public:
-
- ::rtl::OUString AddEmbeddedGraphicObject(
- const ::rtl::OUString& rGraphicObjectURL );
-+ ::rtl::OUString AddEmbeddedGraphicObject(
-+ const com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic >& rxGraphic );
- sal_Bool AddEmbeddedGraphicObjectAsBase64(
- const ::rtl::OUString& rGraphicObjectURL );
-
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/core/xmlexp.cxx 2008-05-28 11:08:31.000000000 +0100
-+++ xmloff/source/core/xmlexp.cxx 2008-07-09 10:02:45.000000000 +0100
-@@ -1774,6 +1774,15 @@ sal_Int32 SvXMLExport::dataStyleForceSys
- }
-
-
-+OUString SvXMLExport::AddEmbeddedGraphicObject( const Reference< graphic::XGraphic >& rxGraphic )
-+{
-+ rtl::OUString sRes;
-+ Reference< document::XGraphicResolver > xResolv( mxGraphicResolver, UNO_QUERY );
-+ if ( xResolv.is() )
-+ sRes = xResolv->resolveGraphicObject( rxGraphic );
-+ return sRes;
-+}
-+
- OUString SvXMLExport::AddEmbeddedGraphicObject( const OUString& rGraphicObjectURL )
- {
- OUString sRet( rGraphicObjectURL );
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/elementimport.cxx xmloff/source/forms/elementimport.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/elementimport.cxx 2008-07-09 13:18:29.000000000 +0100
-+++ xmloff/source/forms/elementimport.cxx 2008-07-07 23:10:54.000000000 +0100
-@@ -47,6 +47,7 @@
- #include "gridcolumnproptranslator.hxx"
- #include <comphelper/extract.hxx>
- #include <comphelper/types.hxx>
-+#include <unotools/ucbstreamhelper.hxx>
-
- /** === begin UNO includes === **/
- #include <com/sun/star/text/XText.hpp>
-@@ -59,7 +60,7 @@
- /** === end UNO includes === **/
- #include <tools/urlobj.hxx>
- #include <tools/time.hxx>
--
-+#include <comphelper/storagehelper.hxx>
- #include <algorithm>
- #include <functional>
-
-@@ -979,6 +980,13 @@ namespace xmloff
- _rValue, OEnumMapper::getEnumMap( OEnumMapper::epImageAlign )
- ) >>= m_nImageAlign );
- }
-+ else if ( _rLocalName == GetXMLToken( XML_IMAGE_DATA ) && ::utl::SvPictureStreamHelper::IsPackagePictureURL( _rValue ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[ 0 ] = uno::makeAny( _rValue );
-+ aArgs[ 1 ] = uno::makeAny( m_rContext.getGlobalContext().GetModel() );
-+ m_xProv.set( m_rContext.getGlobalContext().getServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.GraphicLinkProvider" ) ), aArgs ), uno::UNO_QUERY );
-+ }
- else
- OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue );
- }
-@@ -1004,6 +1012,25 @@ namespace xmloff
- implPushBackPropertyValue( aImagePosition );
- }
- }
-+ void OImagePositionImport::EndElement()
-+ {
-+ OSL_TRACE("** Image::EndElement");
-+ if ( m_xElement.is () )
-+ {
-+ OSL_TRACE("**** About to set the attribute xProv is %d", m_xProv.is() );
-+ try
-+ {
-+ m_xElement->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ), uno::makeAny( m_xProv ) );
-+ }
-+ catch(uno::Exception& e)
-+ {
-+ OSL_TRACE("Caught exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+ else
-+ OSL_TRACE("Phreaking null");
-+ OControlImport::EndElement();
-+ }
-
- //=====================================================================
- //= OReferredControlImport
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/elementimport.hxx xmloff/source/forms/elementimport.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/elementimport.hxx 2008-04-10 23:01:44.000000000 +0100
-+++ xmloff/source/forms/elementimport.hxx 2008-07-07 20:23:21.000000000 +0100
-@@ -41,6 +41,7 @@
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/form/XGridColumnFactory.hpp>
- #include <com/sun/star/script/XEventAttacherManager.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
- /** === end UNO includes === **/
- #include <comphelper/stl_types.hxx>
- #include "eventimport.hxx"
-@@ -282,7 +283,7 @@ namespace xmloff
- sal_Int16 m_nImagePosition;
- sal_Int16 m_nImageAlign;
- sal_Bool m_bHaveImagePosition;
--
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicLinkProvider > m_xProv;
- public:
- OImagePositionImport(
- IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
-@@ -294,7 +295,7 @@ namespace xmloff
- // SvXMLImportContext overridables
- virtual void StartElement(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
--
-+ virtual void EndElement();
- // OPropertyImport overridables
- virtual void handleAttribute( sal_uInt16 _nNamespaceKey,
- const ::rtl::OUString& _rLocalName,
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/propertyexport.cxx xmloff/source/forms/propertyexport.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/propertyexport.cxx 2008-04-10 23:10:41.000000000 +0100
-+++ xmloff/source/forms/propertyexport.cxx 2008-07-09 12:10:11.000000000 +0100
-@@ -44,6 +44,10 @@
- #include <com/sun/star/util/Date.hpp>
- #include <com/sun/star/util/Time.hpp>
- #include <com/sun/star/util/DateTime.hpp>
-+#include <com/sun/star/graphic/XGraphicLinkProvider.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <unotools/ucbstreamhelper.hxx>
-+
- #include <osl/diagnose.h>
- #include <comphelper/extract.hxx>
- #include <comphelper/sequence.hxx>
-@@ -62,6 +66,7 @@ namespace xmloff
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::beans;
-+ using namespace ::com::sun::star::graphic;
-
- // NO using namespace ...util !!!
- // need a tools Date/Time/DateTime below, which would conflict with the uno types then
-@@ -437,6 +442,35 @@ namespace xmloff
- exportedProperty(_sPropertyName);
- }
- //---------------------------------------------------------------------
-+
-+ void OPropertyExport::exportImageDataAttribute()
-+ {
-+ rtl::OUString sURL;
-+ m_xProps->getPropertyValue( PROPERTY_IMAGEURL ) >>= sURL;
-+ Reference< XGraphicLinkProvider > xProv;
-+ Reference< XGraphic> xGraphic;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicLinkProvider" ) ) ) >>= xProv;
-+ if ( xProv.is() )
-+ {
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ) ) ) >>= xGraphic;
-+ rtl::OUString newURL = m_rContext.getGlobalContext().AddEmbeddedGraphicObject( xGraphic );
-+ // stick on the Package scheme if we got a URL back
-+ if ( newURL.getLength() )
-+ {
-+ newURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ) + newURL;
-+ // reset things
-+ Sequence< Any > aArgs( 2 );
-+ aArgs[ 0 ] = makeAny( newURL );
-+ aArgs[ 1 ] = makeAny( m_rContext.getGlobalContext().GetModel() );
-+ // set up new GraphicProvider because we have a new
-+ // intra document URL
-+ xProv.set( m_rContext.getGlobalContext().getServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.GraphicLinkProvider" ) ), aArgs ), UNO_QUERY );
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GraphicLinkProvider" ) ), makeAny( xProv ) );
-+ }
-+ }
-+ exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA);
-+ }
-+
- void OPropertyExport::flagStyleProperties()
- {
- // flag all the properties which are part of the style as "handled"
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/propertyexport.hxx xmloff/source/forms/propertyexport.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/xmloff/source/forms/propertyexport.hxx 2008-04-10 23:11:00.000000000 +0100
-+++ xmloff/source/forms/propertyexport.hxx 2008-07-08 13:11:03.000000000 +0100
-@@ -242,7 +242,7 @@ namespace xmloff
-
- <p>The property needs a special handling because the URL's need to be made relative</p>
- */
-- inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA); }
-+ void exportImageDataAttribute();
-
- /** flag the style properties as 'already exported'
-
-Only in basctl/source/basicide: localize.sdf
-Only in basctl/source/dlged: localize.sdf
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/basctl/source/dlged/propbrw.cxx basctl/source/dlged/propbrw.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/basctl/source/dlged/propbrw.cxx 2008-04-11 12:05:43.000000000 +0100
-+++ basctl/source/dlged/propbrw.cxx 2008-07-08 09:32:28.000000000 +0100
-@@ -209,7 +209,8 @@ void PropBrw::ImplReCreateController()
- ::cppu::ContextEntry_Init aHandlerContextInfo[] =
- {
- ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) ) ),
-- ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) )
-+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) ),
-+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportNonLinkedImage" ) ), makeAny( sal_False ) )
- };
- Reference< XComponentContext > xInspectorContext(
- ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/extensions/source/propctrlr/formcomponenthandler.cxx extensions/source/propctrlr/formcomponenthandler.cxx
---- /data4/M21/ooo-build/build-src/dev300-m21/extensions/source/propctrlr/formcomponenthandler.cxx 2008-06-16 13:42:41.000000000 +0100
-+++ extensions/source/propctrlr/formcomponenthandler.cxx 2008-07-08 12:09:44.000000000 +0100
-@@ -1360,10 +1360,20 @@ namespace pcr
- break;
-
- case PROPERTY_ID_IMAGE_URL:
-- if ( impl_browseForImage_nothrow( _rData, aGuard ) )
-- eResult = InteractiveSelectionResult_ObtainedValue;
-+ {
-+ bool bIsLink = false;
-+ if ( impl_browseForImage_nothrow( _rData, bIsLink, aGuard ) )
-+ {
-+ if ( bIsLink )
-+ eResult = InteractiveSelectionResult_ObtainedValue;
-+ else
-+ {
-+ if ( impl_handleNonImageLink_nothrow( _rData ) )
-+ eResult = InteractiveSelectionResult_Success;
-+ }
-+ }
- break;
--
-+ }
- case PROPERTY_ID_TARGET_URL:
- if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) )
- eResult = InteractiveSelectionResult_ObtainedValue;
-@@ -2656,14 +2666,31 @@ namespace pcr
- }
-
- //------------------------------------------------------------------------
-- bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
-+ bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, bool& bIsLink, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
- {
-+ bIsLink = false; // default
- ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
-
- ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
-
- aFileDlg.SetTitle(aStrTrans);
--
-+ sal_Bool bHandleNonLink = sal_False;
-+ Reference< XModel > xDocument( impl_getContextDocument_nothrow() );
-+ if ( xDocument.is() )
-+ {
-+ bHandleNonLink = sal_True; // in the ideal world this should be enough
-+ // Bit of a hack to allow basic dialog to override support for
-+ // non-linked images ( e.g. those located in the document
-+ // stream ) However, the toolkit control CAN handle this but
-+ // the dialog code. Well, can't ( right now ) hopefully it
-+ // will soon
-+ try
-+ { m_aContext.getContextValueByAsciiName( "SupportNonLinkedImage" ) >>= bHandleNonLink;
-+ }
-+ catch( Exception& e ) // #TODO add that debug utils thing for uncaught exceptions
-+ {
-+ }
-+ }
- Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
- DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
- if (xController.is())
-@@ -2672,8 +2699,8 @@ namespace pcr
- xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
-
- // "as link" is checked, but disabled
-- xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(sal_True));
-- xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
-+ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(!bHandleNonLink));
-+ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
- }
-
- ::rtl::OUString sCurValue;
-@@ -2687,7 +2714,13 @@ namespace pcr
- _rClearBeforeDialog.clear();
- bool bSuccess = ( 0 == aFileDlg.Execute() );
- if ( bSuccess )
-+ {
-+ if ( bHandleNonLink && xController.is() )
-+ {
-+ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
-+ }
- _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
-+ }
- return bSuccess;
- }
-
-@@ -3174,6 +3207,31 @@ namespace pcr
- }
- return sURL;
- }
-+
-+ bool FormComponentPropertyHandler::impl_handleNonImageLink_nothrow( const Any& aURL )
-+ {
-+ Reference< XMultiComponentFactory > xMcf = m_aContext.getUNOContext()->getServiceManager();
-+
-+ Sequence< Any > aArgs(2);
-+ aArgs[ 0 ] = aURL;
-+ aArgs[ 1 ] <<= impl_getContextDocument_nothrow();
-+
-+ Reference< XInterface > xLinkProvider = xMcf->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.GraphicLinkProvider" ) ), aArgs, m_aContext.getUNOContext() );
-+ bool bRes = false;
-+ if ( xLinkProvider.is() )
-+ {
-+ try
-+ {
-+ m_xComponent->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicLinkProvider" ) ), makeAny( xLinkProvider ) );
-+ bRes = true;
-+ }
-+ catch( const Exception& )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+ }
-+ return bRes;
-+ }
- // -------------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper* FormComponentPropertyHandler::createArrayHelper( ) const
- {
-diff -rup /data4/M21/ooo-build/build-src/dev300-m21/extensions/source/propctrlr/formcomponenthandler.hxx extensions/source/propctrlr/formcomponenthandler.hxx
---- /data4/M21/ooo-build/build-src/dev300-m21/extensions/source/propctrlr/formcomponenthandler.hxx 2008-05-20 20:11:31.000000000 +0100
-+++ extensions/source/propctrlr/formcomponenthandler.hxx 2008-07-08 12:06:01.000000000 +0100
-@@ -309,7 +309,7 @@ namespace pcr
- <TRUE/> if and only if a new image URL has been chosen by the user.
- In this case, ->_out_rNewValue is filled with the new property value
- */
-- bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
-+ bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, bool& bIsLink, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
-
- /** executes a dialog which allows the user to change the TargetURL property of
- our component
-@@ -438,6 +438,8 @@ namespace pcr
- */
- ::rtl::OUString impl_getDocumentURL_nothrow() const;
-
-+ bool impl_handleNonImageLink_nothrow( const ::com::sun::star::uno::Any& aURL );
-+
- private:
- DECL_LINK( OnDesignerClosed, void* );
-
-Only in extensions/source/propctrlr/: localize.sdf
---- /dev/null 2008-04-22 00:28:44.000000000 +0100
-+++ offapi/com/sun/star/document/XGraphicResolver.idl 2008-07-09 09:33:53.000000000 +0100
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XGraphicObjectResolver.idl,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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 __com_sun_star_document_XGraphicResolver_idl__
-+#define __com_sun_star_document_XGraphicResolver_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_document_XGraphicObjectResolver_idl__
-+#include <com/sun/star/document/XGraphicObjectResolver.idl>
-+#endif
-+#ifndef __com_sun_star_graphic_XGraphic_idl__
-+#include <com/sun/star/graphic/XGraphic.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+
-+/** this interface converts graphic object from one URL space to another.
-+ */
-+published interface XGraphicResolver
-+{
-+ interface com::sun::star::document::XGraphicObjectResolver;
-+ /** converts the given XGraphic from the source URL namespace to the destination
-+ URL space of this instance.
-+ */
-+ string resolveGraphicObject( [in] ::com::sun::star::graphic::XGraphic gObj );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2008-04-22 00:28:44.000000000 +0100
-+++ offapi/com/sun/star/graphic/XGraphicLinkProvider.idl 2008-07-07 17:45:45.000000000 +0100
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XGraphicProvider.idl,v $
-+ * $Revision: 1.5 $
-+ *
-+ * 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 com_sun_star_graphic_XGraphicLinkProvider_idl
-+#define com_sun_star_graphic_XGraphicLinkProvider_idl
-+
-+#include <com/sun/star/uno/XInterface.idl>
-+#include <com/sun/star/embed/XStorage.idl>
-+
-+module com { module sun { module star { module graphic
-+{
-+interface XGraphicLinkProvider : ::com::sun::star::uno::XInterface
-+{
-+ [readonly, attribute] com::sun::star::embed::XStorage Storage;
-+ [readonly, attribute] string SourceURL;
-+} ; } ; } ; } ;
-+};
-+
-+#endif
diff --git a/patches/test/vba/ModuleInfo.diff b/patches/test/vba/ModuleInfo.diff
deleted file mode 100644
index 2fb8d111e..000000000
--- a/patches/test/vba/ModuleInfo.diff
+++ /dev/null
@@ -1,2066 +0,0 @@
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ udkapi/com/sun/star/script/ModuleInfo.idl 2008-03-19 15:12:14.000000000 +0800
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleInfo.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_script_ModuleInfo_idl__
-+#define __com_sun_star_script_ModuleInfo_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+interface XObjectProvider;
-+struct ModuleInfo
-+{
-+ string ModuleName;
-+ string ModuleSource;
-+ XObjectProvider ModuleObjectProvider;
-+ short ModuleType; // string?
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ udkapi/com/sun/star/script/ModuleType.idl 2008-03-19 15:12:14.000000000 +0800
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleType.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_script_ModuleType_idl__
-+#define __com_sun_star_script_ModuleType_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+published constants ModuleType
-+{
-+ const long Unknown = 0;
-+ const long Normal = 1;
-+ const long Class = 2;
-+ const long Form = 3;
-+ const long Document = 4;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ udkapi/com/sun/star/script/XObjectProvider.idl 2008-03-19 15:12:14.000000000 +0800
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XDefaultMethod.idl,v $
-+ *
-+ * $Revision: 1.3 $
-+ *
-+ * last change: $Author: vg $ $Date: 2006/11/02 16:34:45 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_script_XObjectProvider_idl__
-+#define __com_sun_star_script_XObjectProvider_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+//==============================================================================
-+interface XObjectProvider : ::com::sun::star::uno::XInterface
-+{
-+ any getObject();
-+
-+};
-+
-+}; }; }; };
-+#endif
---- udkapi/com/sun/star/script/makefile.mk.orig 2008-03-19 15:03:09.000000000 +0800
-+++ udkapi/com/sun/star/script/makefile.mk 2008-03-19 15:12:14.000000000 +0800
-@@ -89,6 +89,9 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ ModuleInfo.idl\
-+ ModuleType.idl\
-+ XObjectProvider.idl\
- DateType.idl\
-
- # ------------------------------------------------------------------
---- svx/source/msfilter/msvbasic.hxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ svx/source/msfilter/msvbasic.hxx 2008-03-19 15:43:24.000000000 +0800
-@@ -50,11 +50,13 @@
- #ifndef _DYNARY_HXX
- #include <tools/dynary.hxx>
- #endif
-+#include <com/sun/star/script/ModuleType.hpp>
- #ifndef __SGI_STL_VECTOR
- #include <vector>
- #endif
- #include<map>
-
-+using namespace ::com::sun::star::script::ModuleType;
- /* class VBA:
- * The VBA class provides a set of methods to handle Visual Basic For
- * Applications streams, the constructor is given the root ole2 stream
-@@ -77,13 +79,13 @@ DECLARE_DYNARRAY(StringArray,String *)
- // #117718# define internal types to distinguish between
- // module types, form, class & normal
- // #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
--enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-+//enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-
- // #117718# define map to hold types of module
- //
--
-+typedef sal_Int32 ModType;
- typedef ::std::map< UniString,
-- ModuleType > ModuleTypeHash;
-+ ModType > ModuleTypeHash;
-
- class VBA_Impl
- {
-@@ -104,7 +106,7 @@ public:
- void Output(int len, const sal_uInt8 *data);
- //
- // #117718# member map of module names to types of module
-- ModuleType GetModuleType( const UniString& rModuleName );
-+ ModType GetModuleType( const UniString& rModuleName );
-
- std::vector<String> maReferences;
- private:
---- svx/source/msfilter/svxmsbas.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ svx/source/msfilter/svxmsbas.cxx 2008-03-19 15:46:59.000000000 +0800
-@@ -88,6 +88,7 @@ using namespace com::sun::star::awt;
-
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- using namespace com::sun::star::container;
- using namespace com::sun::star::script;
- using namespace com::sun::star::uno;
-@@ -319,7 +320,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- // is the same as the encoding for the names
- // that are keys in the map used by GetModuleType method
- const String &sOrigVBAModName = aVBA.GetStreamName( i );
-- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
-+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
-
- rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-
-@@ -327,23 +328,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
-
- switch( mType )
- {
-- case Class:
-+ case ::com::sun::star::script::ModuleType::Class:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
- break;
-- case Form:
-+ case ::com::sun::star::script::ModuleType::Form:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
- break;
-- case Document:
-+ case ::com::sun::star::script::ModuleType::Document:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
- break;
-- case Normal:
-+ case ::com::sun::star::script::ModuleType::Normal:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
- break;
-- case Unknown:
-+ case ::com::sun::star::script::ModuleType::Unknown:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
- break;
-@@ -356,7 +357,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- if ( !bAsComment )
- {
- modeTypeComment = modeTypeComment + sVBAOption;
-- if ( mType == Class )
-+ if ( mType == ::com::sun::star::script::ModuleType::Class )
- modeTypeComment = modeTypeComment + sClassOption;
-
- }
-@@ -418,12 +419,36 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- aSource += rtl::OUString::createFromAscii("\nEnd Sub");
- }
- ::rtl::OUString aModName( sModule );
-- if ( aSource.getLength() )
- {
-+ Reference< script::XObjectProvider > xVBAObjectProvider;
-+ if( mType == ::com::sun::star::script::ModuleType::Document )
-+ {
-+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
-+ if ( xSF.is() )
-+ {
-+ try
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( aModName );
-+ xVBAObjectProvider.set( xSF->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider")), aArgs), UNO_QUERY );
-+ }
-+ catch( Exception& ) { }
-+ }
-+ }
- aSource = modeTypeComment + aSource;
-
- Any aSourceAny;
-- aSourceAny <<= aSource;
-+ if ( xVBAObjectProvider.is() && mType == ::com::sun::star::script::ModuleType::Document )
-+ {
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = aSource;
-+ sModuleInfo.ModuleType == ::com::sun::star::script::ModuleType::Document;
-+ sModuleInfo.ModuleObjectProvider.set( xVBAObjectProvider, UNO_QUERY );
-+ aSourceAny <<= sModuleInfo;
-+ }
-+ else
-+ aSourceAny <<= aSource;
- if( xLib->hasByName( aModName ) )
- xLib->replaceByName( aModName, aSourceAny );
- else
-@@ -433,6 +458,8 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- bRet = true;
- }
- }
-+ if( bRet )
-+ rDocSh.GetBasic()->SetVBAEnabled( true );
- SFX_APP()->LeaveBasicCall();
- }
- return bRet;
---- svx/source/msfilter/msvbasic.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ svx/source/msfilter/msvbasic.cxx 2008-03-19 15:44:51.000000000 +0800
-@@ -445,7 +445,7 @@ int VBA_Impl::ReadVBAProject(const SvSto
- *
- */
-
--ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
-+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
- {
- ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
- ModuleTypeHash::iterator iterEnd = mhModHash.end();
-@@ -453,7 +453,7 @@ ModuleType VBA_Impl::GetModuleType( cons
- {
- return iter->second;
- }
-- return Unknown;
-+ return ::com::sun::star::script::ModuleType::Unknown;
- }
-
- bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
-@@ -496,7 +496,7 @@ bool VBA_Impl::Open( const String &rTopl
- static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
- static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
- static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-- mhModHash[ sThisDoc ] = Class;
-+ mhModHash[ sThisDoc ] = ::com::sun::star::script::ModuleType::Class;
- while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
- {
- xub_StrLen index = tmp.Search( '=' );
-@@ -506,14 +506,14 @@ bool VBA_Impl::Open( const String &rTopl
- String value = tmp.Copy( index + 1 );
- if ( key == sClass )
- {
-- mhModHash[ value ] = Class;
-+ mhModHash[ value ] = ::com::sun::star::script::ModuleType::Class;
- OSL_TRACE("Module %s is of type Class",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sBaseClass )
- {
-- mhModHash[ value ] = Form;
-+ mhModHash[ value ] = ::com::sun::star::script::ModuleType::Form;
- OSL_TRACE("Module %s is of type Form",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-@@ -526,14 +526,14 @@ bool VBA_Impl::Open( const String &rTopl
- // value is of form <name>/&H<identifier>, strip the identifier
- value.Erase( value.Search( '/' ) );
-
-- mhModHash[ value ] = Document;
-+ mhModHash[ value ] = ::com::sun::star::script::ModuleType::Document;
- OSL_TRACE("Module %s is of type Document VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sModule )
- {
-- mhModHash[ value ] = Normal;
-+ mhModHash[ value ] = ::com::sun::star::script::ModuleType::Normal;
- OSL_TRACE("Module %s is of type Normal VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
---- sc/inc/servuno.hxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ sc/inc/servuno.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -103,7 +103,8 @@ class ScDocShell;
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
-
--#define SC_SERVICE_COUNT 40
-+#define SC_SERVICE_VBAOBJECTPROVIDER 40
-+#define SC_SERVICE_COUNT 41
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
---- sc/source/ui/unoobj/servuno.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ sc/source/ui/unoobj/servuno.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -77,8 +77,94 @@
- #include <svx/xmlgrhlp.hxx>
- #endif
-
-+#include "scextopt.hxx"
-+#include <com/sun/star/script/XObjectProvider.hpp>
-+#include <comphelper/processfactory.hxx>
-+
- using namespace ::com::sun::star;
-
-+class ScVbaObjectProvider : public ::cppu::WeakImplHelper2< script::XObjectProvider, lang::XInitialization >
-+{
-+ ScDocShell* mpDocShell;
-+ uno::Any aObj;
-+ String msName;
-+public:
-+ ScVbaObjectProvider( const rtl::OUString& sName, ScDocShell* pDocShell ) : mpDocShell( pDocShell ), msName(sName) {}
-+ ScVbaObjectProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+ virtual void SAL_CALL initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
-+ {
-+ OSL_TRACE("ScVbaObjectProvider::initialize ");
-+ if(aArguments.getLength() != 1)
-+ {
-+ throw lang::IllegalArgumentException(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ), static_cast< script::XObjectProvider * >(this), 0 );
-+ }
-+ rtl::OUString sName;
-+ aArguments[0] >>= sName;
-+ msName = sName;
-+ }
-+ virtual uno::Any SAL_CALL getObject() throw (uno::RuntimeException)
-+ {
-+ if ( !aObj.hasValue() )
-+ {
-+ BOOL bWorkbook = FALSE;
-+ uno::Type aType;
-+ uno::Reference<lang::XMultiServiceFactory> xSF(comphelper::getProcessServiceFactory());
-+ uno::Reference<beans::XPropertySet> xProps(xSF, uno::UNO_QUERY);
-+ if( xProps.is() )
-+ {
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
-+ String sGlobCodeName = pDoc->GetCodeName();
-+ uno::Reference< uno::XInterface > xIf;
-+
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ uno::Reference< uno::XInterface > xWorkbook( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook") ), aArgs ), uno::UNO_QUERY );
-+ if( sGlobCodeName == msName )
-+ {
-+ xIf.set( xWorkbook, uno::UNO_QUERY );
-+ bWorkbook = TRUE;
-+ }
-+ else
-+ {
-+ String sCodeName;
-+ SCTAB nCount = pDoc->GetTableCount();
-+ for( SCTAB i = 0; i < nCount; i++ )
-+ {
-+ pDoc->GetCodeName( i, sCodeName );
-+ if( sCodeName == msName )
-+ {
-+ String sSheetName;
-+ if( pDoc->GetName( i, sSheetName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xSheets, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(3);
-+ aArgs[0] = uno::Any( xWorkbook );
-+ aArgs[1] = uno::Any( xModel );
-+ aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
-+ uno::Reference< uno::XInterface > xWorksheet( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet") ), aArgs ), uno::UNO_QUERY );
-+ xIf.set( xWorksheet, uno::UNO_QUERY );
-+ bWorkbook = FALSE;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ if( xIf.is() )
-+ {
-+ aObj <<= xIf;
-+ }
-+ }
-+ }
-+ return aObj;
-+ }
-+};
-
- //------------------------------------------------------------------------
-
-@@ -128,7 +214,8 @@ static const sal_Char* __FAR_DATA aProvN
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
-- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
-+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+ "org.openoffice.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
- };
-
- //
-@@ -180,6 +267,7 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_SHEETDOCSET
- "", // SC_SERVICE_CHDATAPROV
- "", // SC_SERVICE_FORMULAPARS
-+ "", // SC_SERVICE_VBAOBJECTPROVIDER
- "" // SC_SERVICE_OPCODEMAPPER
- };
-
-@@ -373,6 +461,8 @@ uno::Reference<uno::XInterface> ScServic
- case SC_SERVICE_OPCODEMAPPER:
- xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
- break;
-+ case SC_SERVICE_VBAOBJECTPROVIDER:
-+ xRet.set(static_cast<script::XObjectProvider*>(new ScVbaObjectProvider( pDocShell )));
- }
- return xRet;
- }
---- sc/source/ui/unoobj/makefile.mk.orig 2008-03-19 15:03:09.000000000 +0800
-+++ sc/source/ui/unoobj/makefile.mk 2008-03-19 15:12:14.000000000 +0800
-@@ -54,6 +54,7 @@ AUTOSEG=true
- .INCLUDE : sc.mk
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-+INCPRE=$(INCCOM)$/vbaobj
- # --- Files --------------------------------------------------------
- SLO1FILES = \
- $(SLO)$/docuno.obj \
---- basctl/source/basicide/scriptdocument.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basctl/source/basicide/scriptdocument.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -61,6 +61,7 @@
- #include <com/sun/star/frame/XModel2.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- /** === end UNO includes === **/
-
- #include <sfx2/objsh.hxx>
-@@ -146,6 +147,7 @@ namespace basctl
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEmbeddedScripts;
-+ using ::com::sun::star::script::ModuleInfo;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-@@ -678,6 +680,15 @@ namespace basctl
- }
-
- // insert element by new name in container
-+ if ( _eType == E_SCRIPTS )
-+ {
-+ ModuleInfo sModuleInfo;
-+ if ( aElement >>= sModuleInfo )
-+ {
-+ sModuleInfo.ModuleName = _rNewName;
-+ aElement <<= sModuleInfo;
-+ }
-+ }
- xLib->insertByName( _rNewName, aElement );
- return true;
- }
-@@ -1433,7 +1444,18 @@ namespace basctl
- Any aCode;
- if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
- return false;
-- OSL_VERIFY( aCode >>= _out_rModuleSource );
-+ ModuleInfo sModuleInfo;
-+ rtl::OUString sMod;
-+ if ( aCode >>= sModuleInfo )
-+ {
-+ sMod = sModuleInfo.ModuleSource;
-+ }
-+ else
-+ {
-+ aCode >>= sMod;
-+ }
-+ Any aMod(sMod);
-+ OSL_VERIFY( aMod >>= _out_rModuleSource );
- return true;
- }
-
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ basic/inc/basic/sbobjmod.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: sbobjmod.hxx,v $
-+ *
-+ * $Revision: 1.4 $
-+ *
-+ * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef _SB_OBJMOD_HXX
-+#define _SB_OBJMOD_HXX
-+
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+
-+// Basic-Module for excel object.
-+
-+class SbObjModule : public SbModule
-+{
-+ com::sun::star::script::ModuleInfo m_mInfo;
-+ SbxObjectRef pDocObject; // a excel object.
-+protected:
-+ //virtual ~SbObjModule();
-+ void InitObject( const XubString& rName );
-+public:
-+ TYPEINFO();
-+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DOCUMENTMOD,2);
-+ SbObjModule( const rtl::OUString& rName, const com::sun::star::script::ModuleInfo& mInfo );
-+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-+ virtual SbxVariable* GetObject();
-+ virtual BOOL IsClass( const String& );
-+};
-+#ifndef __SB_SBOBJMODULEREF_HXX
-+#define __SB_SBOBJMODULEREF_HXX
-+
-+SV_DECL_IMPL_REF(SbObjModule);
-+
-+#endif
-+#endif
-+
---- basic/prj/d.lst.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/prj/d.lst 2008-03-19 15:12:14.000000000 +0800
-@@ -27,6 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\basic
-
- ..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx
- ..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx
-+..\inc\basic\sbobjmod.hxx %_DEST%\inc%_EXT%\basic\sbobjmod.hxx
- ..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx
- ..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx
- ..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx
---- basic/source/classes/sbxmod.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/classes/sbxmod.cxx 2008-03-20 16:42:14.000000000 +0800
-@@ -62,6 +62,9 @@
- #include "sbunoobj.hxx"
- #include <basic/hilight.hxx>
- #include <basic/basrdll.hxx>
-+#include <basic/sbobjmod.hxx>
-+#include <com/sun/star/script/XObjectProvider.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
- #ifndef _VOS_MUTEX_HXX_
- #include <vos/mutex.hxx>
-@@ -88,6 +91,7 @@ TYPEINIT1(SbProperty,SbxProperty)
- TYPEINIT1(SbProcedureProperty,SbxProperty)
- TYPEINIT1(SbJScriptModule,SbModule)
- TYPEINIT1(SbJScriptMethod,SbMethod)
-+TYPEINIT1(SbObjModule,SbModule)
-
- SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
- SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -1903,6 +1907,79 @@ void SyntaxHighlighter::getHighlightPort
- m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions );
- }
-
-+/////////////////////////////////////////////////////////////////////////
-+SbObjModule::SbObjModule( const rtl::OUString& rName, const com::sun::star::script::ModuleInfo& mInfo )
-+ :SbModule( rName ), pDocObject( NULL )
-+{
-+ m_mInfo = mInfo;
-+ SetSource32( mInfo.ModuleSource );
-+}
-+
-+BOOL
-+SbObjModule::IsClass( const XubString& rName )
-+{
-+ GetObject();
-+ return SbxObject::IsClass( rName );
-+}
-+
-+SbxVariable*
-+SbObjModule::GetObject()
-+{
-+ if( !pDocObject )
-+ InitObject( GetName() );
-+ return pDocObject;
-+}
-+SbxVariable*
-+SbObjModule::Find( const XubString& rName, SbxClassType t )
-+{
-+ OSL_TRACE("SbObjectModule find for %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( !pDocObject )
-+ InitObject( GetName() );
-+ OSL_TRACE("!!!!try to find in derived module " );
-+ SbxVariable* pVar = NULL;
-+ if ( !pVar && pDocObject)
-+ {
-+ pVar = pDocObject->Find( rName, t );
-+ if ( pVar )
-+ {
-+ OSL_TRACE("found in uno (psuedo-base) object" );
-+ }
-+ else
-+ OSL_TRACE("NOT found in uno (psuedo-base) object" );
-+ }
-+ if ( !pVar )
-+ {
-+ pVar = SbModule::Find( rName, t );
-+ if ( pVar )
-+ OSL_TRACE("! found in (normal) module " );
-+ }
-+
-+ return pVar;
-+}
-+
-+void
-+SbObjModule::InitObject( const XubString& rName )
-+{
-+ OSL_TRACE("Initialize pDocObject");
-+ try
-+ {
-+ com::sun::star::uno::Reference< com::sun::star::script::XObjectProvider > xObjectProvider( m_mInfo.ModuleObjectProvider, com::sun::star::uno::UNO_QUERY_THROW );
-+ com::sun::star::uno::Any aObject = xObjectProvider->getObject();
-+ pDocObject = new SbUnoObject( rName, aObject );
-+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObject, com::sun::star::uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
-+ }
-+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
-+ }
-+ }catch( com::sun::star::uno::RuntimeException e )
-+ {
-+ OSL_TRACE("Object is not exist." );
-+ }
-+}
-
- /////////////////////////////////////////////////////////////////////////
- // Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen)
---- basic/source/classes/sb.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/classes/sb.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -70,6 +70,7 @@
- #include "disas.hxx"
- #include "runtime.hxx"
- #include <basic/sbuno.hxx>
-+#include <basic/sbobjmod.hxx>
- #include "stdobj.hxx"
- #include "filefmt.hxx"
- #include "sb.hrc"
-@@ -667,6 +668,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
- SetParent( p );
- pLibInfo = NULL;
- bNoRtl = bBreak = FALSE;
-+ bVBAEnabled = FALSE;
- pModules = new SbxArray;
-
- if( !GetSbData()->nInst++ )
-@@ -769,13 +771,21 @@ SbModule* StarBASIC::MakeModule( const S
-
- SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
- {
-- SbModule* p = new SbModule( rName );
-+ SbModule* p = new SbModule( rName );
- p->SetSource32( rSrc );
- p->SetParent( this );
- pModules->Insert( p, pModules->Count() );
- SetModified( TRUE );
- return p;
- }
-+SbModule* StarBASIC::MakeObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo )
-+{
-+ SbObjModule* p = new SbObjModule( rName, mInfo );
-+ p->SetParent( this );
-+ pModules->Insert( p, pModules->Count() );
-+ SetModified( TRUE );
-+ return p;
-+}
-
- void StarBASIC::Insert( SbxVariable* pVar )
- {
-@@ -948,6 +958,8 @@ SbxVariable* StarBASIC::Find( const Stri
- }
- pNamed = p;
- }
-+ if ( p->GetSbxId() == SBXID_DOCUMENTMOD )
-+ continue;
- // Sonst testen, ob das Element vorhanden ist
- // GBLSEARCH-Flag rausnehmen (wg. Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
---- basic/source/runtime/methods1.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/runtime/methods1.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -60,6 +60,9 @@
- #ifndef _SBX_HXX
- #include <basic/sbx.hxx>
- #endif
-+#ifndef _SBSTAR_HXX
-+#include <basic/sbstar.hxx>
-+#endif
- #ifndef _ZFORLIST_HXX //autogen
- #include <svtools/zforlist.hxx>
- #endif
-@@ -86,6 +89,7 @@
- #endif
-
- #include <vcl/jobset.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include "sbintern.hxx"
- #include "runtime.hxx"
-@@ -2613,7 +2617,14 @@ RTLFUNC(Me)
- SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule);
- if( pClassModuleObject == NULL )
- {
-- StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
-+ SbObjModule* pMod = PTR_CAST(SbObjModule,pActiveModule);
-+ if ( pMod == NULL )
-+ StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
-+ else
-+ {
-+ SbxVariableRef refVar = rPar.Get(0);
-+ refVar->PutObject( pMod );
-+ }
- }
- else
- {
---- basic/source/basmgr/basmgr.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/basmgr/basmgr.cxx 2008-03-19 15:28:47.000000000 +0800
-@@ -102,6 +102,8 @@
- #include <com/sun/star/script/XStarBasicDialogInfo.hpp>
- #include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- #include <cppuhelper/implbase1.hxx>
-
-@@ -145,6 +147,7 @@ static const char* szScriptLanguage = "S
- static const String BasicStreamName( String::CreateFromAscii(szBasicStorage) );
- static const String ManagerStreamName( String::CreateFromAscii(szManagerStream) );
-
-+//enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-
- #define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
-
-@@ -280,9 +283,22 @@ void BasMgrContainerListenerImpl::addLib
- {
- OUString aModuleName = pNames[ j ];
- Any aElement = xLibNameAccess->getByName( aModuleName );
-+ ModuleInfo mInfo;
- OUString aMod;
-- aElement >>= aMod;
-- pLib->MakeModule32( aModuleName, aMod );
-+ sal_Int16 mType;
-+ if ( aElement >>= mInfo )
-+ {
-+ aMod = mInfo.ModuleSource;
-+ mType = mInfo.ModuleType;
-+ OSL_TRACE("#1 - aMod");
-+ //pLib->MakeModule32( aModuleName, aMod, SBXID_DOCUMENTMOD );
-+ pLib->MakeObjModule( aModuleName, mInfo );
-+ }
-+ else
-+ {
-+ aElement >>= aMod;
-+ pLib->MakeModule32( aModuleName, aMod );
-+ }
- }
- }
-
-@@ -319,8 +335,16 @@ void SAL_CALL BasMgrContainerListenerImp
- }
- else
- {
-+ ModuleInfo mInfo;
- OUString aMod;
-- Event.Element >>= aMod;
-+ sal_Int16 mType;
-+ if( Event.Element >>= mInfo )
-+ {
-+ aMod = mInfo.ModuleSource;
-+ mType = mInfo.ModuleType;
-+ }
-+ else
-+ Event.Element >>= aMod;
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
- DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
-@@ -329,7 +353,15 @@ void SAL_CALL BasMgrContainerListenerImp
- SbModule* pMod = pLib->FindModule( aName );
- if( !pMod )
- {
-- pLib->MakeModule32( aName, aMod );
-+ if ( mType == ::com::sun::star::script::ModuleType::Document )
-+ {
-+ //pLib->MakeModule32( aName, aMod, SBXID_DOCUMENTMOD );
-+ pLib->MakeObjModule( aName, mInfo );
-+ }
-+ else
-+ {
-+ pLib->MakeModule32( aName, aMod );
-+ }
- pLib->SetModified( FALSE );
- }
- }
-@@ -356,12 +388,27 @@ void SAL_CALL BasMgrContainerListenerImp
- if( pLib )
- {
- SbModule* pMod = pLib->FindModule( aName );
-+ ModuleInfo mInfo;
- OUString aMod;
-+ sal_Int16 mType;
- Event.Element >>= aMod;
- if( pMod )
- pMod->SetSource32( aMod );
- else
-- pLib->MakeModule32( aName, aMod );
-+ {
-+ if( Event.Element >>= mInfo )
-+ {
-+ aMod = mInfo.ModuleSource;
-+ mType = mInfo.ModuleType;
-+ //pLib->MakeModule32( aName, aMod, SBXID_DOCUMENTMOD );
-+ pLib->MakeObjModule( aName, mInfo );
-+ }
-+ else
-+ {
-+ Event.Element >>= aMod;
-+ pLib->MakeModule32( aName, aMod );
-+ }
-+ }
-
- pLib->SetModified( FALSE );
- }
---- basic/inc/basic/sbstar.hxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/inc/basic/sbstar.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -51,6 +51,7 @@
-
- #include <basic/sbdef.hxx>
- #include <basic/sberrors.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- class SbModule; // fertiges Modul
- class SbiInstance; // Laufzeit-Instanz
-@@ -82,6 +83,7 @@ class StarBASIC : public SbxObject
- BOOL bNoRtl; // TRUE: RTL nicht durchsuchen
- BOOL bBreak; // TRUE: Break, sonst Step
- BOOL bDocBasic;
-+ BOOL bVBAEnabled;
- BasicLibInfo* pLibInfo; // Infoblock fuer Basic-Manager
- SbLanguageMode eLanguageMode; // LanguageMode des Basic-Objekts
- protected:
-@@ -124,7 +126,8 @@ public:
-
- // Compiler-Interface
- SbModule* MakeModule( const String& rName, const String& rSrc );
-- SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo );
- BOOL Compile( SbModule* );
- BOOL Disassemble( SbModule*, String& rText );
- static void Stop();
-@@ -196,6 +199,8 @@ public:
- ( const String& rName, USHORT& rStatus );
- static SbMethod* GetActiveMethod( USHORT nLevel = 0 );
- static SbModule* GetActiveModule();
-+ void SetVBAEnabled( BOOL bEnabled );
-+ BOOL isVBAEnabled();
-
- // #60175 TRUE: SFX-Resource wird bei Basic-Fehlern nicht angezogen
- static void StaticSuppressSfxResource( BOOL bSuppress );
---- basic/inc/basic/sbdef.hxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/inc/basic/sbdef.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -100,6 +100,7 @@ void setBasicWatchMode( bool bOn );
-
- #define SBXID_BASIC 0x6273 // sb: StarBASIC
- #define SBXID_BASICMOD 0x6d62 // bm: StarBASIC-Modul
-+#define SBXID_DOCUMENTMOD 0x6d63 // Special document Module
- #define SBXID_BASICPROP 0x7262 // pr: StarBASIC-Property
- #define SBXID_BASICMETHOD 0x6d65 // me: StarBASIC-Methode
- #define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript-Modul
---- basic/source/uno/namecont.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/uno/namecont.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -139,6 +139,9 @@
- #endif
- #include <basic/sbmod.hxx>
-
-+#ifndef _COM_SUN_STAR_SCRIPT_MODULEINFO_HPP_
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#endif
-
- namespace basic
- {
-@@ -217,7 +220,7 @@ void NameContainer::replaceByName( const
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType )
-+ if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -259,7 +262,7 @@ void NameContainer::insertByName( const
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType )
-+ if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
---- sfx2/source/doc/docmacromode.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ sfx2/source/doc/docmacromode.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -45,6 +45,7 @@
- #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
- #include <com/sun/star/task/InteractionClassification.hpp>
- #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- /** === end UNO includes === **/
-
- #include <comphelper/componentcontext.hxx>
-@@ -80,8 +81,11 @@ namespace sfx2
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::script::XLibraryContainer;
-+ using ::com::sun::star::script::ModuleInfo;
- using ::com::sun::star::container::XNameAccess;
-+ using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
-+ using ::com::sun::star::uno::Sequence;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
-
-@@ -427,7 +431,7 @@ namespace sfx2
- bHasMacroLib = sal_False;
- else
- {
-- ::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ ::rtl::OUString aStdLibName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ) );
- Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
- if ( aElements.getLength() )
- {
-@@ -447,8 +451,43 @@ namespace sfx2
- Any aAny = xContainer->getByName( aStdLibName );
- aAny >>= xLib;
- if ( xLib.is() )
-+ {
- bHasMacroLib = xLib->hasElements();
-- }
-+ if( !bHasMacroLib )
-+ return bHasMacroLib;
-+ // VBA will introduce some empty Object Module
-+ // If all module only include
-+ // "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport"
-+ // it should be set bHasMacros as false
-+ Sequence< ::rtl::OUString > sNames = xLib->getElementNames();
-+ Reference < XNameContainer > xNameContainer( xContainer->getByName( aStdLibName ), UNO_QUERY_THROW );
-+ sal_Int32 nCount = sNames.getLength();
-+ ::rtl::OUString sName;
-+ Any aCode;
-+ ModuleInfo sModuleInfo;
-+ ::rtl::OUString sMod;
-+ ::rtl::OUString sVbaOptiona( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" )));
-+ ::rtl::OUString sVbaOptionb( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "\r\n" )));
-+ sVbaOptionb = sVbaOptiona + sVbaOptionb;
-+ for ( sal_Int32 nMod = 0; nMod < nCount; nMod++ )
-+ {
-+ sName = sNames[nMod];
-+ if ( xNameContainer->hasByName( sName ) )
-+ aCode = xNameContainer->getByName( sName );
-+ if ( aCode >>= sModuleInfo )
-+ {
-+ sMod = sModuleInfo.ModuleSource;
-+ if ( sMod.getLength() && !( sMod.equals( sVbaOptiona ) || sMod.equals( sVbaOptionb ) ) )
-+ return bHasMacroLib;
-+ }
-+ else
-+ {
-+ return bHasMacroLib;
-+ }
-+ }
-+ bHasMacroLib = sal_False;
-+ }
-+ }
- }
- }
- }
---- basic/inc/basic/sbxobj.hxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/inc/basic/sbxobj.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -80,7 +80,7 @@ public:
- virtual SbxClassType GetClass() const;
- virtual void Clear();
-
-- virtual BOOL IsClass( const String& ) const;
-+ virtual BOOL IsClass( const String& );
- const String& GetClassName() const { return aClassName; }
- void SetClassName( const String &rNew ) { aClassName = rNew; }
- // Default-Property
---- basic/source/sbx/sbxobj.cxx.orig 2008-03-19 15:03:09.000000000 +0800
-+++ basic/source/sbx/sbxobj.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -187,7 +187,7 @@ void SbxObject::SFX_NOTIFY( SfxBroadcast
- }
- }
-
--BOOL SbxObject::IsClass( const XubString& rName ) const
-+BOOL SbxObject::IsClass( const XubString& rName )
- {
- return BOOL( aClassName.EqualsIgnoreCaseAscii( rName ) );
- }
---- sc/inc/document.hxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/inc/document.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -308,6 +308,7 @@ private:
-
- com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
- String aDocName; // opt: Dokumentname
-+ String aDocCodeName; // opt: Dokumentname
- ScRangePairListRef xColNameRanges;
- ScRangePairListRef xRowNameRanges;
-
-@@ -451,6 +452,8 @@ public:
-
- const String& GetName() const { return aDocName; }
- void SetName( const String& r ) { aDocName = r; }
-+ const String& GetCodeName() const { return aDocCodeName; }
-+ void SetCodeName( const String& r ) { aDocCodeName = r; }
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -538,6 +541,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollec
-
- BOOL HasTable( SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
- BOOL GetTable( const String& rName, SCTAB& rTab ) const;
- inline SCTAB GetTableCount() const { return nMaxTableNumber; }
- SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
---- sc/inc/table.hxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/inc/table.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -104,6 +104,7 @@ private:
- ScColumn aCol[MAXCOLCOUNT];
-
- String aName;
-+ String aCodeName;
- String aComment;
- BOOL bScenario;
- BOOL bLayoutRTL;
-@@ -237,6 +238,9 @@ public:
- void GetName( String& rName ) const;
- void SetName( const String& rNewName );
-
-+ void GetCodeName( String& rName ) const { rName = aCodeName; }
-+ void SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
-+
- const String& GetUpperName() const;
-
- const String& GetPageStyle() const { return aPageStyle; }
---- sc/source/core/data/document.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/core/data/document.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -101,6 +101,7 @@
- #include "scextopt.hxx"
- #include "postit.hxx"
-
-+
- struct ScDefaultAttr
- {
- const ScPatternAttr* pAttr;
-@@ -155,6 +156,32 @@ BOOL ScDocument::GetName( SCTAB nTab, St
- return FALSE;
- }
-
-+BOOL ScDocument::SetCodeName( SCTAB nTab, String& rName )
-+{
-+ if (VALIDTAB(nTab))
-+ {
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->SetCodeName( rName );
-+ return TRUE;
-+ }
-+ }
-+ OSL_TRACE( "**** can't set code name %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return FALSE;
-+}
-+
-+BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
-+{
-+ if (VALIDTAB(nTab))
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->GetCodeName( rName );
-+ return TRUE;
-+ }
-+ rName.Erase();
-+ return FALSE;
-+}
-+
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-@@ -280,7 +307,6 @@ void ScDocument::CreateValidTabName(Stri
- }
- }
-
--
- BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName,
- BOOL bExternalDocument )
- {
-@@ -294,12 +320,7 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- if (nPos == SC_TAB_APPEND || nPos == nTabCount)
- {
- pTab[nTabCount] = new ScTable(this, nTabCount, rName);
-- // if we are mapping codenames then a new tab always has has
-- // codename = sheetname
-- if ( pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- pExtOptions->SetCodeName( rName, nTabCount );
-- }
-+ pTab[nTabCount]->SetCodeName( rName );
- ++nMaxTableNumber;
- if ( bExternalDocument )
- pTab[nTabCount]->SetVisible( FALSE );
-@@ -334,24 +355,10 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- for (i = nTabCount; i > nPos; i--)
- {
- pTab[i] = pTab[i - 1];
-- if ( pTab[i] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- String sCodeName = pExtOptions->GetCodeName( i - 1 );
-- if ( sCodeName.Len() )
-- {
-- OSL_TRACE("Associating codeName %s with tab %d", rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), i );
-- pExtOptions->SetCodeName( sCodeName, i );
-- }
-- }
-- }
--
-- if ( pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- OSL_TRACE("Inserting codeName %s with tab %d", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(),nPos );
-- pExtOptions->SetCodeName( rName, nPos );
- }
-
- pTab[nPos] = new ScTable(this, nPos, rName);
-+ pTab[nPos]->SetCodeName( rName );
- ++nMaxTableNumber;
-
- for (i = 0; i <= MAXTAB; i++)
-@@ -441,22 +448,7 @@ BOOL ScDocument::DeleteTab( SCTAB nTab,
- delete pTab[nTab];
- for (i=nTab + 1; i < nTabCount; i++)
- {
-- if ( pTab[i - 1 ] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- String sCodeName = pExtOptions->GetCodeName( i );
-- if ( sCodeName.Len() )
-- {
-- OSL_TRACE("Associating codeName %s with tab %d", rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), i - 1 );
-- pExtOptions->SetCodeName( sCodeName, i - 1 );
-- }
-- }
- pTab[i - 1] = pTab[i];
--
-- }
-- if ( pTab[i - 1 ] && pExtOptions && ( pExtOptions->GetCodeNameCount() > 0 ) )
-- {
-- OSL_TRACE("Deleting codename %s as %d", rtl::OUStringToOString( pExtOptions->GetCodeName( nTabCount-1 ), RTL_TEXTENCODING_UTF8 ).getStr(), nTabCount - 1 ) ;
-- pExtOptions->DeleteCodeName( nTabCount - 1 );
- }
-
- pTab[nTabCount - 1] = NULL;
---- sc/source/core/data/table1.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/core/data/table1.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -130,6 +130,7 @@ extern BOOL bIsOlk, bOderSo;
- ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
- BOOL bColInfo, BOOL bRowInfo ) :
- aName( rNewName ),
-+ aCodeName( rNewName ),
- bScenario( FALSE ),
- bLayoutRTL( FALSE ),
- bLoadingRTL( FALSE ),
---- sc/source/filter/excel/excdoc.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/filter/excel/excdoc.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -168,7 +168,7 @@ void ExcTable::FillAsHeader( ExcBoundshe
- String aTmpString;
- SCTAB nScTabCount = rTabInfo.GetScTabCount();
- UINT16 nExcTabCount = rTabInfo.GetXclTabCount();
-- UINT16 nCodenames = static_cast< UINT16 >( GetExtDocOptions().GetCodeNameCount() );
-+ UINT16 nCodenames = nScTabCount;
-
- rR.pObjRecs = NULL; // per sheet
-
-@@ -182,7 +182,7 @@ void ExcTable::FillAsHeader( ExcBoundshe
- if( HasVbaStorage() )
- {
- Add( new XclObproj );
-- const String& rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
-+ const String rCodeName = GetDoc().GetCodeName();
- if( rCodeName.Len() )
- Add( new XclCodename( rCodeName ) );
- }
-@@ -403,8 +403,12 @@ void ExcTable::FillAsTable( size_t nCode
- Add( new XclExpCondFormatBuffer( GetRoot() ) );
-
- if( HasVbaStorage() )
-- if( nCodeNameIdx < GetExtDocOptions().GetCodeNameCount() )
-- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
-+ if( nCodeNameIdx < GetTabInfo().GetScTabCount() )
-+ {
-+ String sCodeName;
-+ rDoc.GetCodeName( nCodeNameIdx, sCodeName );
-+ Add( new XclCodename( sCodeName ) );
-+ }
- }
-
- // list of HLINK records, generated by the cell table
-@@ -429,7 +433,7 @@ void ExcTable::FillAsEmptyTable( size_t
- {
- InitializeTable( mnScTab );
-
-- if( HasVbaStorage() && (nCodeNameIdx < GetExtDocOptions().GetCodeNameCount()) )
-+ if( HasVbaStorage() && (nCodeNameIdx < GetTabInfo().GetScTabCount()) )
- {
- if( GetBiff() <= EXC_BIFF5 )
- {
-@@ -438,7 +442,9 @@ void ExcTable::FillAsEmptyTable( size_t
- else
- {
- Add( new ExcBof8 );
-- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
-+ String sCodeName;
-+ GetDoc().GetCodeName( nCodeNameIdx, sCodeName );
-+ Add( new XclCodename( sCodeName ) );
- }
- // sheet view settings: WINDOW2, SCL, PANE, SELECTION
- aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
-@@ -480,7 +486,7 @@ void ExcDocument::ReadDoc( void )
- aHeader.FillAsHeader( maBoundsheetList );
-
- SCTAB nScTab = 0, nScTabCount = GetTabInfo().GetScTabCount();
-- size_t nCodeNameIdx = 0, nCodeNameCount = GetExtDocOptions().GetCodeNameCount();
-+ size_t nCodeNameIdx = 0, nCodeNameCount = nScTabCount;
-
- for( ; nScTab < nScTabCount; ++nScTab )
- {
---- sc/source/filter/excel/xelink.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/filter/excel/xelink.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -1296,7 +1296,6 @@ XclExpSupbookBuffer::XclExpSupbookBuffer
- {
- XclExpTabInfo& rTabInfo = GetTabInfo();
- sal_uInt16 nXclCnt = rTabInfo.GetXclTabCount();
-- sal_uInt16 nCodeCnt = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() );
- size_t nCount = nXclCnt + rTabInfo.GetXclExtTabCount();
-
- DBG_ASSERT( nCount > 0, "XclExpSupbookBuffer::XclExpSupbookBuffer - no sheets to export" );
-@@ -1305,7 +1304,7 @@ XclExpSupbookBuffer::XclExpSupbookBuffer
- maSBIndexVec.resize( nCount );
-
- // self-ref SUPBOOK first of list
-- XclExpSupbookRef xSupbook( new XclExpSupbook( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ) );
-+ XclExpSupbookRef xSupbook( new XclExpSupbook( GetRoot(), nXclCnt ) );
- mnOwnDocSB = Append( xSupbook );
- for( sal_uInt16 nXclTab = 0; nXclTab < nXclCnt; ++nXclTab )
- maSBIndexVec[ nXclTab ].Set( mnOwnDocSB, nXclTab );
---- sc/source/filter/excel/xlocx.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/filter/excel/xlocx.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -88,7 +88,7 @@
- #include <cppuhelper/bootstrap.hxx>
- #endif
- #include <sfx2/objsh.hxx>
--
-+#include "document.hxx"
- using org::openoffice::vba::XVBAToOOEventDescGen;
- using com::sun::star::uno::XComponentContext;
- using com::sun::star::awt::XControl;
-@@ -372,7 +372,9 @@ void XclImpOcxConverter::RegisterOleMacr
- if( StarBASIC* pBasic = pDocShell->GetBasic() )
- {
- // Seach in the CodeName ( Module ) associated with this sheet
-- if( SbModule* pModule = dynamic_cast< SbModule* >( pBasic->Find( GetExtDocOptions().GetCodeName(rOcxCtrlObj.GetScTab() ), SbxCLASS_OBJECT ) ) )
-+ String sCodeName;
-+ GetDoc().GetCodeName( rOcxCtrlObj.GetScTab(), sCodeName );
-+ if( SbModule* pModule = dynamic_cast< SbModule* >( pBasic->Find( sCodeName , SbxCLASS_OBJECT ) ) )
- {
- Reference<XComponentContext > xContext( ::cppu::defaultBootstrap_InitialComponentContext(), UNO_QUERY_THROW ); // Fatal error anyway
- if ( SbxArray* pMethods = pModule->GetMethods() )
---- sc/source/filter/inc/excimp8.hxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/filter/inc/excimp8.hxx 2008-03-19 15:12:14.000000000 +0800
-@@ -69,6 +69,7 @@ class XclImpStream;
-
- class ImportExcel8 : public ImportExcel
- {
-+ SCTAB mnTab;
- protected:
- ExcScenarioList aScenList;
-
---- sc/source/ui/docshell/docsh.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/ui/docshell/docsh.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -207,11 +207,8 @@ const static rtl::OUString sUrlPart2 = r
- rtl::OUString sCodeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- if ( pShell )
- {
-- if ( ScExtDocOptions* pExtDocOpts = pShell->GetDocument()->GetExtDocOptions() )
-- {
-- if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
-- sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
-- }
-+ if ( ScDocument* pDoc = pShell->GetDocument() )
-+ sCodeName = pDoc->GetCodeName();
- }
- return sCodeName;
- }
---- sc/source/ui/view/tabview5.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/ui/view/tabview5.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -347,10 +347,10 @@ void ScTabView::TabChanged()
- aViewData.GetDocument()->BroadcastUno( SfxSimpleHint( SC_HINT_TABLECHANGED ) );
- ScExtDocOptions* pExtOptions = aViewData.GetDocument()->GetExtDocOptions();
- String sSheetModuleName;
-- aViewData.GetDocument()->GetName( aViewData.GetTabNo(), sSheetModuleName);
-- // Use code name if that exists
-- if ( pExtOptions )
-- sSheetModuleName = pExtOptions->GetCodeName( aViewData. GetTabNo() );
-+ aViewData.GetDocument()->GetCodeName( aViewData.GetTabNo(), sSheetModuleName);
-+ if ( !sSheetModuleName.Len() > 0 )
-+ aViewData.GetDocument()->GetName( aViewData.GetTabNo(), sSheetModuleName);
-+
- static String sUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:Standard") );
- static String sUrl2( RTL_CONSTASCII_USTRINGPARAM("?language=Basic&location=document") );
- static String sSheetActivateScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Activate") );
---- sc/source/filter/excel/excimp8.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/filter/excel/excimp8.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -148,7 +148,7 @@ using namespace com::sun::star;
-
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
-- ImportExcel( rImpData, rStrm )
-+ ImportExcel( rImpData, rStrm ), mnTab(0)
- {
- delete pFormConv;
-
-@@ -290,9 +290,15 @@ void ImportExcel8::Codename( BOOL bWorkb
- if( aName.Len() )
- {
- if( bWorkbookGlobals )
-- GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ {
-+ //GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ GetDoc().SetCodeName( aName );
-+ }
- else
-- GetExtDocOptions().AppendCodeName( aName );
-+ {
-+ //GetExtDocOptions().AppendCodeName( aName );
-+ GetDoc().SetCodeName( mnTab++, aName );
-+ }
- }
- }
- }
---- sc/source/ui/unoobj/viewuno.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/ui/unoobj/viewuno.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -1778,10 +1778,8 @@ void ScTabViewObj::SelectionChanged()
- {
- ScExtDocOptions* pExtOptions = pViewData->GetDocument()->GetExtDocOptions();
- String sSheetModuleName;
-- pViewData->GetDocument()->GetName( pViewData->GetTabNo(), sSheetModuleName);
- // Use code name if that exists
-- if ( pExtOptions )
-- sSheetModuleName = pExtOptions->GetCodeName( pViewData->GetTabNo() );
-+ pViewData->GetDocument()->GetName( pViewData->GetTabNo(), sSheetModuleName);
-
- String sSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_SelectionChange") );
- String sWorkBookSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Workbook_SheetSelectionChange") );
---- sc/source/ui/vba/vbaworksheet.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.cxx 2008-03-20 17:15:45.000000000 +0800
-@@ -421,6 +421,7 @@ ScVbaWorksheet::Delete() throw (uno::Run
- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
- xNameContainer->removeByName(aSheetName);
-+ mxSheet.clear();
- }
- }
-
-@@ -815,8 +816,10 @@ ScVbaWorksheet::getCodeName() throw (css
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-- rtl::OUString sCodeName = pExtOptions->GetCodeName( nTab );
-+ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ rtl::OUString sCodeName = pExtOptions->GetCodeName( nTab );*/
-+ String sCodeName;
-+ pDoc->GetCodeName( nTab, sCodeName );
- return sCodeName;
- }
- else
-@@ -839,8 +842,10 @@ ScVbaWorksheet::setCodeName( const rtl::
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-- pExtOptions->SetCodeName( sCodeName, nTab );
-+ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ pExtOptions->SetCodeName( sCodeName, nTab );*/
-+ String sNewCodeName( sCodeName );
-+ pDoc->SetCodeName( nTab, sNewCodeName );
- }
- else
- throw uno::RuntimeException(::rtl::OUString(
---- sc/source/ui/vba/vbaworkbook.cxx.orig 2008-03-19 15:03:23.000000000 +0800
-+++ sc/source/ui/vba/vbaworkbook.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -471,9 +471,10 @@ ScVbaWorkbook::getCodeName() throw (css:
- #ifdef VBA_OOBUILD_HACK
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
-- ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName;
-+ ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName; */
-+ ::rtl::OUString sGlobCodeName = pDoc->GetCodeName();
- return sGlobCodeName;
- #else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -485,9 +486,10 @@ ScVbaWorkbook::setCodeName( const ::rtl:
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
-- pExtSettings.maGlobCodeName = sGlobCodeName;
-+ pExtSettings.maGlobCodeName = sGlobCodeName;*/
-+ pDoc->SetCodeName( sGlobCodeName );
- #else
- void SAL_CALL
- ScVbaWorkbook::setCodeName( const ::rtl::OUString& ) throw (css::uno::RuntimeException)
---- basic/source/runtime/runtime.cxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ basic/source/runtime/runtime.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -82,6 +82,17 @@ void StarBASIC::StaticEnableReschedule(
- {
- bStaticGlobalEnableReschedule = bReschedule;
- }
-+void StarBASIC::SetVBAEnabled( BOOL bEnabled )
-+{
-+ bVBAEnabled = bEnabled;
-+}
-+
-+BOOL StarBASIC::isVBAEnabled()
-+{
-+ if( SbiRuntime::isVBAEnabled() )
-+ return TRUE;
-+ return bVBAEnabled;
-+}
-
-
- struct SbiArgvStack { // Argv stack:
---- sc/source/ui/docshell/docfunc.cxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ sc/source/ui/docshell/docfunc.cxx 2008-03-19 16:15:15.000000000 +0800
-@@ -58,6 +58,12 @@
- #include <svtools/PasswordHelper.hxx>
- #endif
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+
- #include <list>
-
- #include "docfunc.hxx"
-@@ -101,6 +107,7 @@
- #include "scui_def.hxx" //CHINA001
- using namespace com::sun::star;
-
-+
- // STATIC DATA -----------------------------------------------------------
-
- //========================================================================
-@@ -2022,6 +2029,86 @@ BOOL ScDocFunc::MoveBlock( const ScRange
- }
-
- //------------------------------------------------------------------------
-+script::ModuleInfo lcl_InitModuleInfo( ScDocShell& rDocSh, String& sModule )
-+{
-+ ::rtl::OUString aModName( sModule );
-+ uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< script::XObjectProvider > xVBAObjectProvider;
-+ if ( xSF.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( aModName );
-+ xVBAObjectProvider.set( xSF->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider")), aArgs), uno::UNO_QUERY );
-+ }
-+ script::ModuleInfo sModuleInfo;
-+ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = sVbaOption;
-+ sModuleInfo.ModuleType = script::ModuleType::Document;
-+ sModuleInfo.ModuleObjectProvider.set( xVBAObjectProvider, uno::UNO_QUERY );
-+ return sModuleInfo;
-+}
-+
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, sModuleName );
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ // test Module has exist
-+ // if the Module is exist. changed to another name
-+ // and at this time the string like "SheetX"
-+ rtl::OUString sModuleName( sModuleInfo.ModuleName );
-+ sal_Int32 nNum = 1;
-+ while( xLib->hasByName( sModuleName ) )
-+ {
-+ sModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
-+ nNum += 1;
-+ }
-+ sModuleInfo.ModuleName = sModuleName;
-+ uno::Any aSourceAny;
-+ aSourceAny <<= sModuleInfo;
-+ xLib->insertByName( sModuleName, aSourceAny );
-+ ScDocument* pDoc = rDocSh.GetDocument();
-+ String sCodeName( sModuleName );
-+ pDoc->SetCodeName( nTab, sCodeName );
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-+void lcl_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-
- BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
- {
-@@ -2031,8 +2118,12 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
- if (bRecord)
- pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
-
-@@ -2047,6 +2138,11 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
- // Views updaten:
-+ if( bVbaEnabled )
-+ {
-+ String sCodeName( rName );
-+ lcl_InsertModule( rDocShell, nTab, sCodeName );
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
-
- rDocShell.PostPaintExtras();
-@@ -2068,8 +2164,12 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
-
- BOOL bSuccess = FALSE;
- ScDocument* pDoc = rDocShell.GetDocument();
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
- BOOL bWasLinked = pDoc->IsLinked(nTab);
- ScDocument* pUndoDoc = NULL;
- ScRefUndoData* pUndoData = NULL;
-@@ -2110,6 +2210,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- pUndoData = new ScRefUndoData( pDoc );
- }
-
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( nTab, sCodeName );
- if (pDoc->DeleteTab( nTab, pUndoDoc ))
- {
- if (bRecord)
-@@ -2120,6 +2222,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
- }
- // Views updaten:
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( rDocShell, sCodeName );
-+ }
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_DELETED, nTab ) );
-
- if (bWasLinked)
---- basctl/source/basicide/basidesh.cxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ basctl/source/basicide/basidesh.cxx 2008-03-20 13:34:01.000000000 +0800
-@@ -97,6 +97,8 @@
- #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
- #include <com/sun/star/container/XNameContainer.hpp>
- #endif
-+#include <com/sun/star/container/XContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-
- #include <svx/xmlsecctrl.hxx>
-
-@@ -104,7 +106,6 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
- using ::rtl::OUString;
-
--
- TYPEINIT1( BasicIDEShell, SfxViewShell );
-
- SFX_IMPL_VIEWFACTORY( BasicIDEShell, IDEResId( SVX_INTERFACE_BASIDE_VIEWSH ) )
-@@ -258,6 +259,10 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
- delete pTabBar;
- delete pObjectCatalog;
- DestroyModulWindowLayout();
-+
-+ // Destroy all ContainerListeners for Basic Container.
-+ removeContainerListener( m_aCurDocument );
-+
- // MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
- // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
- // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
-@@ -275,6 +280,7 @@ sal_Bool BasicIDEShell::HasBasic() const
-
- void BasicIDEShell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
- {
-+ // _rDocument is not a valid ScriptDocument.
- UpdateWindows();
- }
-
-@@ -302,6 +308,64 @@ void BasicIDEShell::onDocumentSaveAsDone
- {
- // not interested in
- }
-+// XEventListener
-+//----------------------------------------------------------------------------
-+void SAL_CALL BasicIDEShell::disposing( const lang::EventObject& /*Source*/ )
-+ throw( uno::RuntimeException )
-+{
-+}
-+
-+// XContainerListener
-+//----------------------------------------------------------------------------
-+static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") );
-+void SAL_CALL BasicIDEShell::elementInserted( const container::ContainerEvent& Event )
-+ throw( uno::RuntimeException )
-+{
-+ rtl::OUString sModuleName;
-+ if( Event.Accessor >>= sModuleName )
-+ {
-+ IDEBaseWindow* pWin = 0;
-+ pWin = FindWindow( m_aCurDocument, sStandardLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
-+ }
-+}
-+
-+void SAL_CALL BasicIDEShell::elementReplaced( const container::ContainerEvent& Event )
-+ throw( uno::RuntimeException )
-+{
-+ /* we don't interest here, because of the container
-+ make rename a module as delete old one and create a new one. */
-+ (void)Event;
-+}
-+
-+void SAL_CALL BasicIDEShell::elementRemoved( const container::ContainerEvent& Event )
-+ throw( uno::RuntimeException )
-+{
-+ rtl::OUString sModuleName;
-+ if( Event.Accessor >>= sModuleName )
-+ {
-+ IDEBaseWindow* pWin = FindWindow( m_aCurDocument, sStandardLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
-+ if( pWin )
-+ RemoveWindow( pWin, FALSE, TRUE );
-+ }
-+}
-+void SAL_CALL BasicIDEShell::addContainerListener( const ScriptDocument& rScriptDocument )
-+{
-+ rtl::OUString sLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Reference< container::XNameContainer > xNameContainer( rScriptDocument.getLibrary( E_SCRIPTS, sLibName, FALSE ) );
-+ uno::Reference< container::XContainer > xContainer( xNameContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ xContainer->addContainerListener( xContainerListener );
-+}
-+void SAL_CALL BasicIDEShell::removeContainerListener( const ScriptDocument& rScriptDocument )
-+{
-+ rtl::OUString sLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Reference< container::XNameContainer > xNameContainer( rScriptDocument.getLibrary( E_SCRIPTS, sLibName, FALSE ) );
-+ uno::Reference< container::XContainer > xContainer( xNameContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ xContainer->removeContainerListener( xContainerListener );
-+}
-+
-+//============================================================================
-
- void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument )
- {
-@@ -402,7 +466,6 @@ void BasicIDEShell::StoreAllWindowData(
- }
- }
-
--
- USHORT __EXPORT BasicIDEShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
- {
- (void)bForBrowsing;
-@@ -600,7 +663,6 @@ void BasicIDEShell::ShowObjectDialog( BO
- }
-
-
--
- void __EXPORT BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
- const SfxHint& rHint, const TypeId& )
- {
-@@ -680,8 +742,6 @@ void __EXPORT BasicIDEShell::SFX_NOTIFY(
- }
- }
-
--
--
- void BasicIDEShell::CheckWindows()
- {
- BOOL bSetCurWindow = FALSE;
-@@ -983,7 +1043,9 @@ void BasicIDEShell::SetCurLib( const Scr
- {
- if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
- {
-+ removeContainerListener( m_aCurDocument );
- m_aCurDocument = rDocument;
-+ addContainerListener( m_aCurDocument );
- m_aCurLibName = aLibName;
- if ( bUpdateWindows )
- UpdateWindows();
---- sc/source/ui/view/viewfun2.cxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ sc/source/ui/view/viewfun2.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -62,6 +62,11 @@
- #include <vcl/sound.hxx>
- #include <vcl/waitobj.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+using namespace com::sun::star;
-+
- #include "viewfunc.hxx"
-
- #include "sc.hrc"
-@@ -2091,15 +2096,42 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab
- return bSuccess;
- }
-
-+void lcl_DeleteModule( ScDocShell* rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh->GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
- BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- {
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
-+ StarBASIC* pStarBASIC = pDocSh->GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- SCTAB nNewTab = TheTabs[0];
- int i;
- WaitObject aWait( GetFrameWin() );
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
-
- while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
- --nNewTab;
-@@ -2166,9 +2198,18 @@ BOOL ScViewFunc::DeleteTables(const SvSh
-
- for(i=TheTabs.Count()-1;i>=0;i--)
- {
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
- if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
- {
- bDelDone = TRUE;
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( pDocSh, sCodeName );
-+ }
-+ }
- pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
- }
- }
-@@ -2196,6 +2237,7 @@ BOOL ScViewFunc::DeleteTables(const SvSh
- pDocSh->PostPaintExtras();
- pDocSh->SetDocumentModified();
-
-+
- SfxApplication* pSfxApp = SFX_APP(); // Navigator
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
---- basctl/source/inc/basidesh.hxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ basctl/source/inc/basidesh.hxx 2008-03-20 13:29:57.000000000 +0800
-@@ -62,7 +62,8 @@
- #ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
- #include <com/sun/star/io/XInputStreamProvider.hpp>
- #endif
--
-+#include <com/sun/star/container/XContainerListener.hpp>
-+#include <cppuhelper/implbase1.hxx>
-
- //----------------------------------------------------------------------------
-
-@@ -89,9 +90,11 @@ DECLARE_TABLE( IDEWindowTable, IDEBaseWi
- #else
- typedef Table IDEWindowTable;
- #endif
-+typedef ::cppu::ImplHelper1<com::sun::star::container::XContainerListener> ContainerListenerHelper;
-
- class BasicIDEShell :public SfxViewShell
- ,public ::basctl::DocumentEventListener
-+ ,public ContainerListenerHelper
- {
- friend class JavaDebuggingListenerImpl;
- friend class LocalizationMgr;
-@@ -185,7 +188,25 @@ protected:
- virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
- virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
-
-+ void SAL_CALL addContainerListener( const ScriptDocument& pScriptDocument );
-+ void SAL_CALL removeContainerListener( const ScriptDocument& pScriptDocument );
-+
- public:
-+ // XInterface
-+ virtual void SAL_CALL acquire() throw () {}
-+ virtual void SAL_CALL release() throw () {}
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source )
-+ throw( com::sun::star::uno::RuntimeException );
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const com::sun::star::container::ContainerEvent& Event )
-+ throw( com::sun::star::uno::RuntimeException );
-+ virtual void SAL_CALL elementReplaced( const com::sun::star::container::ContainerEvent& Event )
-+ throw( com::sun::star::uno::RuntimeException );
-+ virtual void SAL_CALL elementRemoved( const com::sun::star::container::ContainerEvent& Event )
-+ throw( com::sun::star::uno::RuntimeException );
-+
- TYPEINFO();
- SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH )
- SFX_DECL_VIEWFACTORY(BasicIDEShell);
---- basctl/source/basicide/basides2.cxx.orig 2008-03-19 15:03:15.000000000 +0800
-+++ basctl/source/basicide/basides2.cxx 2008-03-19 15:12:14.000000000 +0800
-@@ -252,9 +252,12 @@ ModulWindow* BasicIDEShell::CreateBasWin
-
- if ( bSuccess )
- {
-- // new module window
-- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-- nKey = InsertWindowInTable( pWin );
-+ pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE );
-+ if( !pWin )
-+ { // new module window
-+ pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-+ nKey = InsertWindowInTable( pWin );
-+ }
- }
- }
- else
-@@ -269,7 +272,8 @@ ModulWindow* BasicIDEShell::CreateBasWin
- }
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
-- pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ if( nKey )
-+ pTabBar->InsertPage( (USHORT)nKey, aModName );
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
diff --git a/patches/test/vba/ObjectModule.diff b/patches/test/vba/ObjectModule.diff
deleted file mode 100644
index bedbff63d..000000000
--- a/patches/test/vba/ObjectModule.diff
+++ /dev/null
@@ -1,2954 +0,0 @@
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index 1865b94..12c8e0c 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -112,7 +112,7 @@ DialogWindow::DialogWindow( Window* pPar
- {
- InitSettings( TRUE, TRUE, TRUE );
-
-- pEditor = new DlgEditor();
-+ pEditor = new DlgEditor( rDocument.getDocument() );
- pEditor->SetWindow( this );
- pEditor->SetDialog( xDialogModel );
-
-@@ -724,7 +724,7 @@ BOOL DialogWindow::SaveDialog()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
- Reference< XInputStream > xInput( xISP->createInputStream() );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
-@@ -942,7 +942,7 @@ void DialogWindow::StoreData()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
- xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
- }
- }
-diff --git basctl/source/basicide/basides3.cxx basctl/source/basicide/basides3.cxx
-index b211eb3..e562ecb 100644
---- basctl/source/basicide/basides3.cxx
-+++ basctl/source/basicide/basides3.cxx
-@@ -98,7 +98,7 @@ DialogWindow* BasicIDEShell::CreateDlgWi
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.getDocument() );
- LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
-
- // new dialog window
-diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index a5b41e7..cd2c032 100644
---- basctl/source/basicide/moduldlg.cxx
-+++ basctl/source/basicide/moduldlg.cxx
-@@ -315,7 +315,7 @@ void BasicIDEShell::CopyDialogResources(
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.getDocument() );
-
- if( xDialogModel.is() )
- {
-@@ -332,7 +332,7 @@ void BasicIDEShell::CopyDialogResources(
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
- }
-- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.getDocument() );
- }
- }
-
-diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index a12fb46..e984052 100644
---- basctl/source/basicide/scriptdocument.cxx
-+++ basctl/source/basicide/scriptdocument.cxx
-@@ -663,7 +663,7 @@ namespace basctl
- if ( !_rxExistingDialogModel.is() )
- {
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), getDocument() );
- }
-
- // set new name as property
-@@ -671,7 +671,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
- aElement <<= xISP;
- }
-
-@@ -749,8 +749,16 @@ namespace basctl
- Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
- if ( !xLib->hasByName( _rModName ) )
- return false;
--
-- xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
-+ ModuleInfo mInfo;
-+ Any aMod;
-+ if ( xLib->getByName( _rModName ) >>= mInfo )
-+ {
-+ mInfo.ModuleSource = _rModuleCode;
-+ aMod <<= mInfo;
-+ }
-+ else
-+ aMod <<= _rModuleCode;
-+ xLib->replaceByName( _rModName, aMod );
- return true;
- }
- catch( const Exception& )
-@@ -783,7 +791,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
-
- // export dialog model
-- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
-
- // insert dialog into library
- xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
-diff --git basctl/source/dlged/dlged.cxx basctl/source/dlged/dlged.cxx
-index b7588ee..09ebe9c 100644
---- basctl/source/dlged/dlged.cxx
-+++ basctl/source/dlged/dlged.cxx
-@@ -208,7 +208,7 @@ BOOL DlgEditor::RemarkDialog()
-
- //----------------------------------------------------------------------------
-
--DlgEditor::DlgEditor()
-+DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
- :pHScroll(NULL)
- ,pVScroll(NULL)
- ,pDlgEdModel(NULL)
-@@ -230,6 +230,7 @@ DlgEditor::DlgEditor()
- ,bCreateOK(TRUE)
- ,bDialogModelChanged(FALSE)
- ,mnPaintGuard(0)
-+ ,m_xDocument( xModel )
- {
- pDlgEdModel = new DlgEdModel();
- pDlgEdModel->GetItemPool().FreezeIdRanges();
-@@ -838,7 +839,7 @@ void DlgEditor::Copy()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream( xISP->createInputStream() );
- Sequence< sal_Int8 > DialogModelBytes;
- implCopyStreamToByteSequence( xStream, DialogModelBytes );
-@@ -871,7 +872,7 @@ void DlgEditor::Copy()
- uno::Reference< resource::XStringResourceManager >
- xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
-- Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream2( xISP2->createInputStream() );
- Sequence< sal_Int8 > NoResourceDialogModelBytes;
- implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
-@@ -1017,7 +1018,7 @@ void DlgEditor::Paste()
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
-+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
- }
-
- // get control models from clipboard dialog model
-diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
-index 02a1b08..3db132a 100644
---- basctl/source/inc/dlged.hxx
-+++ basctl/source/inc/dlged.hxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/datatransfer/DataFlavor.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
- #include <tools/link.hxx>
- #include <tools/gen.hxx>
- #include <vcl/timer.hxx>
-@@ -129,9 +130,11 @@ protected:
- BOOL bDialogModelChanged;
- Timer aMarkTimer;
- long mnPaintGuard;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
-
-+ DlgEditor(); // not implemented
- public:
-- DlgEditor();
-+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
- ~DlgEditor();
-
- void SetWindow( Window* pWindow );
-diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
-index 2674c59..3c4f364 100644
---- basic/inc/basic/basmgr.hxx
-+++ basic/inc/basic/basmgr.hxx
-@@ -113,9 +113,10 @@ struct LibraryContainerInfo
- ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxScriptCont;
- ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxDialogCont;
- OldBasicPassword* mpOldBasicPassword;
-+ bool mbVBACompatOn;
-
- LibraryContainerInfo()
-- :mpOldBasicPassword( NULL )
-+ :mpOldBasicPassword( NULL ), mbVBACompatOn( false )
- {
- }
-
-@@ -127,7 +128,7 @@ struct LibraryContainerInfo
- )
- : mxScriptCont( xScriptCont )
- , mxDialogCont( xDialogCont )
-- , mpOldBasicPassword( pOldBasicPassword )
-+ , mpOldBasicPassword( pOldBasicPassword ), mbVBACompatOn( false )
- {}
- };
-
-diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
-index bdc23d9..ecc1a8c 100644
---- basic/inc/basic/sbobjmod.hxx
-+++ basic/inc/basic/sbobjmod.hxx
-@@ -56,6 +56,7 @@ public:
- SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
- virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
- SbxVariable* GetObject();
-+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
- };
-
- class SbUserFormModule : public SbObjModule
-@@ -66,7 +67,7 @@ class SbUserFormModule : public SbObjMod
- String sFormName;
- SbUserFormModule( const SbUserFormModule& );
- SbUserFormModule();
--
-+ bool mbInit;
- protected:
- virtual void InitObject();
- public:
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index b5394ae..f12312e 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -44,6 +44,7 @@
- #include <tools/debug.hxx>
- #include <tools/diagnose_ex.h>
- #include <basic/sbmod.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include <basic/sbuno.hxx>
- #include <basic/basmgr.hxx>
-@@ -60,6 +61,7 @@
-
- // Library API, implemented for XML import/export
-
-+#include <com/sun/star/script/XVBACompat.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/script/XStarBasicAccess.hpp>
-@@ -208,10 +210,11 @@ void BasMgrContainerListenerImpl::insert
- if( !pMgr->GetLib( aLibName ) )
- {
- BasicManager* pBasMgr = static_cast< BasicManager* >( pMgr );
--#ifdef DBG_UTIL
- StarBASIC* pLib =
--#endif
- pBasMgr->CreateLibForLibContainer( aLibName, xScriptCont );
-+ if ( pLib )
-+ pLib->SetVBAEnabled( pMgr->mpImpl->maContainerInfo.mbVBACompatOn );
-+
- DBG_ASSERT( pLib, "XML Import: Basic library could not be created");
- }
-
-@@ -292,6 +295,12 @@ void SAL_CALL BasMgrContainerListenerImp
- {
- Reference< XLibraryContainer > xScriptCont( Event.Source, UNO_QUERY );
- insertLibraryImpl( xScriptCont, mpMgr, Event.Element, aName );
-+ Reference< XVBACompat > xCompat( xScriptCont, UNO_QUERY );
-+ if ( xCompat.is() )
-+ {
-+ StarBASIC* pLib = mpMgr->GetLib( aName );
-+ pLib->SetVBAEnabled( xCompat->getVBACompatModeOn() );
-+ }
- }
- else
- {
-@@ -337,25 +346,35 @@ void SAL_CALL BasMgrContainerListenerImp
- DBG_ASSERT( !bLibContainer, "library container fired elementReplaced()");
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
-+
- if( pLib )
- {
-- ModuleInfo mInfo;
-+ SbModule* pMod = pLib->FindModule( aName );
-+ OUString aMod;
-+ ModuleInfo mInfo;
- if( Event.Element >>= mInfo )
-- {
-- OSL_TRACE("#elementReplaced Mod");
-- pLib->MakeModule32( mInfo );
-- }
-- else
-- {
-- SbModule* pMod = pLib->FindModule( aName );
--
-- OUString aMod;
-+ aMod = mInfo.ModuleSource;
-+ else
- Event.Element >>= aMod;
-- if( pMod )
-- pMod->SetSource32( aMod );
-- else
-- pLib->MakeModule32( aName, aMod );
-- }
-+ if( pMod )
-+ {
-+ pMod->SetSource32( aMod );
-+ if ( mInfo.ModuleType == ModuleType::Document )
-+ {
-+ SbObjModule* pObjModule = dynamic_cast< SbObjModule* >( pMod );
-+ if ( pObjModule )
-+ pObjModule->SetUnoObject( makeAny( mInfo.ModuleObject ) );
-+ }
-+ }
-+ else
-+ // Probably we should have an assert for
-+ // unknow module type, e.g. either we are using
-+ // the ModuleInfo structure ( vba ) for *all* modules
-+ // or not ( normal )
-+ if ( mInfo.ModuleType == ModuleType::Unknown )
-+ pLib->MakeModule32( aName, aMod );
-+ else
-+ pLib->MakeModule32( mInfo );
-
- pLib->SetModified( FALSE );
- }
-@@ -822,6 +841,12 @@ void BasicManager::SetLibraryContainerIn
-
- Reference< XLibraryContainer > xScriptCont( mpImpl->maContainerInfo.mxScriptCont.get() );
- StarBASIC* pStdLib = GetStdLib();
-+ Reference< XVBACompat > xCompat( GetScriptLibraryContainer(), UNO_QUERY );
-+ if ( xCompat.is() )
-+ mpImpl->maContainerInfo.mbVBACompatOn = xCompat->getVBACompatModeOn();
-+ // Std is created regardless of any persisted Libraries, so.. we need
-+ // to make sure we set its compat mode here
-+ pStdLib->SetVBAEnabled( mpImpl->maContainerInfo.mbVBACompatOn );
- String aLibName = pStdLib->GetName();
- if( xScriptCont.is() )
- {
-diff --git basic/source/classes/eventatt.cxx basic/source/classes/eventatt.cxx
-index a91863b..b91b9d2 100644
---- basic/source/classes/eventatt.cxx
-+++ basic/source/classes/eventatt.cxx
-@@ -557,20 +557,33 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
- }
-
- Any aDlgLibAny;
-+ bool bDocDialog = false;
- if( pSearchBasic1 )
- {
-+ StarBASIC* pSearch = (StarBASIC*)pSearchBasic1;
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
-+ {
-+ pSearch = (StarBASIC*)pSearchBasic2;
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
-+ }
-+ // If we found the dialog then it belongs to the Search basic
-+ if ( aDlgLibAny.hasValue() )
-+ bDocDialog = pSearch->IsDocBasic();
-+ // otherwise it belongs to the opposite,
-+ // and yes, this algorithm doesn't scale does it
-+ else
-+ bDocDialog = !( pSearch->IsDocBasic() );
-+
- }
-
-
-- OSL_TRACE("About to try get a hold of ThisComponent");
-+ OSL_TRACE("About to try get a hold of ThisComponent, dlg located in document %s", bDocDialog ? "TRUE" : "FALSE" );
- Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pBasic, xModel );
-
- Sequence< Any > aArgs( 4 );
-- aArgs[ 0 ] <<= xModel;
-+ aArgs[ 0 ] <<= bDocDialog ? xModel : uno::Reference< uno::XInterface >();
- aArgs[ 1 ] <<= xInput;
- aArgs[ 2 ] = aDlgLibAny;
- aArgs[ 3 ] <<= xScriptListener;
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 3f9e76c..af126c2 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -2250,25 +2250,26 @@ SbObjModule::SbObjModule( const com::sun
- if ( mInfo.ModuleType == script::ModuleType::Form )
- {
- SetClassName( rtl::OUString::createFromAscii( "Form" ) );
-- return;
- }
-- try
-+ else if ( mInfo.ModuleObject.is() )
-+ SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
-+}
-+void
-+SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject);
-+ if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
-+ return;
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
-+
-+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
- {
-- com::sun::star::uno::Any aObject( mInfo.ModuleObject );
-- pDocObject = new SbUnoObject( GetName(), aObject );
-- com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObject, com::sun::star::uno::UNO_QUERY_THROW );
-- if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-- {
-- SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
-- }
-- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
-- {
-- SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
-- }
-+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
- }
-- catch( com::sun::star::uno::RuntimeException e )
-+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
- {
-- OSL_TRACE("***** Failed to initialise API Object." );
-+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
- }
- }
-
-@@ -2303,7 +2304,7 @@ class FormObjEventListenerImpl : public
- public:
- FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false )
- {
-- if ( mxComponent.is() );
-+ if ( mxComponent.is() )
- {
- uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
- //uno::Reference< awt::XWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-@@ -2379,7 +2380,7 @@ public:
- };
-
- SbUserFormModule::SbUserFormModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
-- :SbObjModule( mInfo, bIsCompat )
-+ :SbObjModule( mInfo, bIsCompat ), mbInit( false )
- {
- m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
- }
-@@ -2420,12 +2421,13 @@ void SbUserFormModule::triggerDeActivate
- }
-
- void SbUserFormModule::triggerInitializeEvent( void )
--
- {
-+ if ( mbInit )
-+ return;
- OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
- static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
-+ mbInit = true;
- triggerMethod( aInitMethodName );
--
- }
-
- void SbUserFormModule::triggerTerminateEvent( void )
-@@ -2433,6 +2435,7 @@ void SbUserFormModule::triggerTerminateE
- OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
- static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
- triggerMethod( aTermMethodName );
-+ mbInit=false;
- }
-
- void SbUserFormModule::load()
-@@ -2490,7 +2493,7 @@ void SbUserFormModule::InitObject()
- m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
-
- // trigger initialise event
-- triggerInitializeEvent();
-+ //triggerInitializeEvent();
- }
- }
- catch( uno::Exception& e )
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index d281396..9776e64 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -62,20 +62,23 @@
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/compbase6.hxx>
- #include <cppuhelper/compbase7.hxx>
-+#include <cppuhelper/compbase8.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- class BasicManager;
-
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper7<
-+typedef ::cppu::WeakComponentImplHelper8<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::container::XContainer,
- ::com::sun::star::script::XLibraryQueryExecutable,
-+ ::com::sun::star::script::XVBACompat,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
- typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
-@@ -109,6 +112,11 @@ NameContainerNameMap;
-
-
- //============================================================================
-+class ItemConvertor
-+{
-+public:
-+ virtual bool convert(com::sun::star::uno::Any& item ) = 0;
-+};
-
- class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
- {
-@@ -132,7 +140,7 @@ public:
-
- void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
- { mpxEventSource = pxEventSource; }
--
-+ virtual bool convertContainer( const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor );
- // Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
- throw(::com::sun::star::uno::RuntimeException);
-@@ -174,7 +182,6 @@ public:
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
--
- };
-
- //============================================================================
-@@ -248,7 +255,7 @@ protected:
- sal_Bool mbOwnBasMgr;
-
- InitMode meInitMode;
--
-+ bool mbVBACompatModeOn;
- void implStoreLibrary( SfxLibrary* pLib,
- const ::rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
-@@ -331,7 +338,7 @@ protected:
- virtual const sal_Char* SAL_CALL getOldInfoFileName() const = 0;
- virtual const sal_Char* SAL_CALL getLibElementFileExtension() const = 0;
- virtual const sal_Char* SAL_CALL getLibrariesDir() const = 0;
--
-+ virtual void convertLibraryEntries() { /*default bogus implementation*/}
- // Handle maLibInfoFileURL and maStorageURL correctly
- void checkStorageURL
- (
-@@ -497,6 +504,9 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException) = 0;
-+ // Methods XVBACompat
-+ virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
- };
-
- class LibraryContainerMethodGuard
-@@ -556,7 +566,7 @@ private:
- ::rtl::OUString maPassword;
-
- sal_Bool mbSharedIndexFile;
--
-+ ::xmlscript::ObjectModuleDescHash mhCodeNameToObjDesc;
- // Additional functionality for localisation
- // Provide modify state including resources
- virtual sal_Bool isModified( void ) = 0;
-@@ -650,6 +660,7 @@ public:
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
-+ virtual bool convertContainer( const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor );
-
- protected:
- virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 1679b30..b9d3415 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -97,6 +97,7 @@ class SfxScriptLibraryContainer : public
- virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
- virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
- virtual const sal_Char* SAL_CALL getLibrariesDir() const;
-+ virtual void convertLibraryEntries();
-
- public:
- SfxScriptLibraryContainer( void );
-@@ -161,7 +162,7 @@ public:
- (
- ModifiableHelper& _rModifiable,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI, bool bVBACompat
- );
-
- SfxScriptLibrary
-@@ -169,7 +170,7 @@ public:
- ModifiableHelper& _rModifiable,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
-- const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
-+ const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly, bool bVBACOmpat
- );
-
- static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 0e7e68d..af41ee1 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -39,6 +39,7 @@
- #include "sbintern.hxx"
- #include "sbunoobj.hxx"
- #include "opcodes.hxx"
-+#include "basic/sbobjmod.hxx"
-
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/script/XDefaultMethod.hpp>
-@@ -707,8 +708,12 @@ void SbiRuntime::StepELEM( UINT32 nOp1,
- // zu fueh die Referenz verlieren
- // #74254 Jetzt per Liste
- if( pObj )
-+ {
-+ SbUserFormModule* pUserForm = PTR_CAST(SbUserFormModule,(SbxVariable*) pObjVar);
-+ if ( pUserForm )
-+ pUserForm->triggerInitializeEvent();
- SaveRef( (SbxVariable*)pObj );
--
-+ }
- PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, FALSE ) );
- }
-
-diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
-index e010d24..31f6757 100644
---- basic/source/uno/dlgcont.cxx
-+++ basic/source/uno/dlgcont.cxx
-@@ -322,7 +322,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
-
- try {
- // start parsing
-- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
- xParser->parseStream( source );
- }
- catch( Exception& )
-@@ -336,7 +336,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
-
- // Create InputStream, TODO: Implement own InputStreamProvider
- // to avoid creating the DialogModel here!
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
- aRetAny <<= xISP;
- return aRetAny;
- }
-diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index b433b0f..db64f07 100644
---- basic/source/uno/namecont.cxx
-+++ basic/source/uno/namecont.cxx
-@@ -107,6 +107,27 @@ static bool GbMigrationSuppressErrors =
- //============================================================================
- // Implementation class NameContainer
-
-+bool
-+NameContainer::convertContainer(const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor )
-+{
-+ bool bRes = true;
-+ uno::Sequence< uno::Any > mCopyValues( mValues );
-+ for ( sal_Int32 i = 0; bRes && i < mCopyValues.getLength(); ++i )
-+ {
-+ if ( !aConvertor.convert( mCopyValues[ i ] ) )
-+ {
-+ bRes = false;
-+ break;
-+ }
-+ }
-+ if ( bRes )
-+ {
-+ mValues = mCopyValues;
-+ mType = rNewType;
-+ }
-+ return bRes;
-+}
-+
- // Methods XElementAccess
- Type NameContainer::getElementType()
- throw(RuntimeException)
-@@ -155,7 +176,7 @@ void NameContainer::replaceByName( const
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
-+ if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -197,7 +218,7 @@ void NameContainer::insertByName( const
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
-+ if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -327,6 +348,30 @@ void ModifiableHelper::setModified( sal_
- // Implementation class SfxLibraryContainer
- DBG_NAME( SfxLibraryContainer )
-
-+::sal_Bool SAL_CALL
-+SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
-+{
-+ return mbVBACompatModeOn;
-+}
-+void SAL_CALL
-+SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
-+{
-+ // will need to trigger event so that basicmanager can get it
-+ bool bNeedsConversion = ( mbVBACompatModeOn != _vbacompatmodeon );
-+ mbVBACompatModeOn = ( _vbacompatmodeon == sal_True );
-+ // for Dialogs 'convertLibraryEntries' does nothing ( for now )
-+ // for Scripts the Library's NameContainer needs to be converted as follows
-+ // When vba mode is turned off
-+ // Userform and Document modules need to be deleted
-+ // String -> Any( ModuleInfo ) to
-+ // String -> Any( String )
-+ // When vba mode is turned on
-+ // String -> Any( String ) to
-+ // String -> Any( ModuleInfo )
-+ // Userform and Document modules need to be created
-+ if ( bNeedsConversion )
-+ convertLibraryEntries(); // for Dialogs this does nothing ( for now )
-+}
- // Ctor
- SfxLibraryContainer::SfxLibraryContainer( void )
- : LibraryContainerHelper( maMutex )
-@@ -336,6 +381,7 @@ SfxLibraryContainer::SfxLibraryContainer
- , mbOasis2OOoFormat( sal_False )
- , mpBasMgr( NULL )
- , mbOwnBasMgr( sal_False )
-+ , mbVBACompatModeOn( sal_False )
- {
- DBG_CTOR( SfxLibraryContainer, NULL );
-
-@@ -795,7 +841,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
- OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return sal_False;
- }
--
-+ mbVBACompatModeOn = pLibArray->mbVBAMode;
- sal_Int32 nLibCount = pLibArray->mnLibCount;
- for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
-@@ -1649,17 +1695,39 @@ void SfxLibraryContainer::implImportLibD
- {
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
-- Any aDummyElement = createEmptyLibraryElement();
-+ Any aDummyElement;
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = rLib.hModuleTypeDesc.end();
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
-+ if ( getVBACompatModeOn() )
-+ {
-+ ::xmlscript::ObjectModuleDescHash::iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
-+
-+ com::sun::star::script::ModuleInfo mInfo;
-+ mInfo.ModuleType = ModuleType::Normal;
-+ mInfo.ModuleName = pElementNames[i];
-+ if ( it != it_end )
-+ {
-+ mInfo.ModuleType = it->second.mnModuleType;
-+ // hack for userform, needs to know about the document
-+ // well really it needs the dialog library
-+ if ( mInfo.ModuleType == ModuleType::Form )
-+ mInfo.ModuleObject = mxOwnerDocument;
-+ }
-+ aDummyElement <<= mInfo;
-+ }
-+ else
-+ aDummyElement = createEmptyLibraryElement();
- pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
-- }
-+ }
- pLib->mbPasswordProtected = rLib.bPasswordProtected;
- pLib->mbReadOnly = rLib.bReadOnly;
- pLib->mbPreload = rLib.bPreload;
- pLib->implSetModified( sal_False );
-
- pLib->mbInitialised = sal_True;
-+ pLib->mhCodeNameToObjDesc = rLib.hModuleTypeDesc;
-+
- }
- }
-
-@@ -2227,13 +2295,29 @@ void SAL_CALL SfxLibraryContainer::loadL
- }
-
- Any aAny = importLibraryElement( aFile, xInStream );
-+
-+ com::sun::star::script::ModuleInfo mInfo;
- if( pImplLib->hasByName( aElementName ) )
- {
-+ if ( getVBACompatModeOn() )
-+ {
-+ pImplLib->maNameContainer.getByName( aElementName ) >>= mInfo;
-+ aAny >>= mInfo.ModuleSource;
-+ aAny <<= mInfo;
-+ }
- if( aAny.hasValue() )
-+ {
- pImplLib->maNameContainer.replaceByName( aElementName, aAny );
-+ }
- }
- else
- {
-+ if ( getVBACompatModeOn() )
-+ {
-+ mInfo.ModuleType = ModuleType::Normal;
-+ aAny >>= mInfo.ModuleSource;
-+ aAny <<= mInfo;
-+ }
- pImplLib->maNameContainer.insertByName( aElementName, aAny );
- }
- }
-@@ -2904,6 +2988,12 @@ void SAL_CALL SfxLibrary::removeContaine
- maNameContainer.removeContainerListener( xListener );
- }
-
-+bool SfxLibrary::convertContainer(const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor )
-+{
-+ return maNameContainer.convertContainer( rNewType, aConvertor );
-+}
-+
-+
- //============================================================================
-
- } // namespace basic
-diff --git basic/source/uno/sbservices.cxx basic/source/uno/sbservices.cxx
-index a2a4ded..aa076ea 100644
---- basic/source/uno/sbservices.cxx
-+++ basic/source/uno/sbservices.cxx
-@@ -43,6 +43,7 @@ namespace basic
- //--------------------------------------------------------------------
- extern void createRegistryInfo_SfxDialogLibraryContainer();
- extern void createRegistryInfo_SfxScriptLibraryContainer();
-+ extern void createRegistryInfo_PersistedReadOnlyCodeNames();
-
- static void initializeModule()
- {
-@@ -54,6 +55,7 @@ namespace basic
- {
- createRegistryInfo_SfxDialogLibraryContainer();
- createRegistryInfo_SfxScriptLibraryContainer();
-+ createRegistryInfo_PersistedReadOnlyCodeNames();
- }
- }
- }
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index 4a46e98..0683981 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -157,7 +157,7 @@ SfxScriptLibraryContainer::SfxScriptLibr
- SfxLibrary* SfxScriptLibraryContainer::implCreateLibrary( const OUString& aName )
- {
- (void)aName; // Only needed for SfxDialogLibrary
-- SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxMSF, mxSFI );
-+ SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxMSF, mxSFI, getVBACompatModeOn() );
- return pRet;
- }
-
-@@ -168,7 +168,7 @@ SfxLibrary* SfxScriptLibraryContainer::i
- (void)aName; // Only needed for SfxDialogLibrary
- SfxLibrary* pRet =
- new SfxScriptLibrary
-- ( maModifiable, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly );
-+ ( maModifiable, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly, getVBACompatModeOn() );
- return pRet;
- }
-
-@@ -1068,6 +1068,11 @@ SfxScriptLibraryContainer:: HasExecutabl
-
- //============================================================================
- // Service
-+class PersistedReadOnlyCodeNames;
-+void createRegistryInfo_PersistedReadOnlyCodeNames()
-+{
-+ static OAutoRegistration< PersistedReadOnlyCodeNames > aAutoRegistration;
-+}
- void createRegistryInfo_SfxScriptLibraryContainer()
- {
- static OAutoRegistration< SfxScriptLibraryContainer > aAutoRegistration;
-@@ -1121,8 +1126,8 @@ Reference< XInterface > SAL_CALL SfxScri
- // Ctor
- SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
- const Reference< XMultiServiceFactory >& xMSF,
-- const Reference< XSimpleFileAccess >& xSFI )
-- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
-+ const Reference< XSimpleFileAccess >& xSFI, bool bVBA )
-+ : SfxLibrary( _rModifiable, bVBA ? getCppuType( ( const script::ModuleInfo*)0 ) : getCppuType( (const OUString *)0 ), xMSF, xSFI )
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
- {
-@@ -1133,8 +1138,8 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- const Reference< XSimpleFileAccess >& xSFI,
- const OUString& aLibInfoFileURL,
- const OUString& aStorageURL,
-- sal_Bool ReadOnly )
-- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI,
-+ sal_Bool ReadOnly, bool bVBA )
-+ : SfxLibrary( _rModifiable, bVBA ? getCppuType( ( const script::ModuleInfo*)0 ) : getCppuType( (const OUString *)0 ), xMSF, xSFI,
- aLibInfoFileURL, aStorageURL, ReadOnly)
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
-@@ -1188,7 +1193,183 @@ bool SAL_CALL SfxScriptLibrary::isLibrar
- {
- return SfxScriptLibrary::containsValidModule( aElement );
- }
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, lang::XInitialization, lang::XServiceInfo > ReadOnlyCodeNames_BASE;
-+
-+// XNameAccess, codename to/from objectnames
-+class PersistedReadOnlyCodeNames : ReadOnlyCodeNames_BASE
-+{
-+ ::xmlscript::CodeNameHash mCodeNameToObjectNames;
-+public:
-+ PersistedReadOnlyCodeNames()
-+ {
-+ }
-+ // Methods - XInitialise
-+ virtual void SAL_CALL initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
-+ {
-+ if ( !aArguments.getLength() )
-+ throw RuntimeException();
-+ Reference< document::XStorageBasedDocument > xDocument( aArguments[ 0 ], uno::UNO_QUERY_THROW );
-+ Reference< embed::XStorage > xDocStorage;
-+ try
-+ {
-+ Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
-+ Reference< XServiceInfo > xSI( xDocument, UNO_QUERY_THROW );
-+ if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OfficeDocument" ) ) ) )
-+ xDocStorage.set( xDocument->getDocumentStorage(), UNO_QUERY_THROW );
-+ if ( xDocStorage.is() ) // not a 'real' document
-+ {
-+ rtl::OUString codeNameDir( RTL_CONSTASCII_USTRINGPARAM("Basic") );
-+ rtl::OUString codeNameFile( RTL_CONSTASCII_USTRINGPARAM("script-lc.xml") );
-+
-+ uno::Reference< embed::XStorage > xLibrariesStor( xDocStorage->openStorageElement( codeNameDir, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XStream > xStream( xLibrariesStor->openStreamElement( codeNameFile, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XInputStream > xInput( xStream->getInputStream(), UNO_QUERY_THROW );
-+ ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray();
-+ InputSource source;
-+ source.aInputStream = xInput;
-+
-+ Reference< XParser > xParser( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY_THROW );
-+ xParser->setDocumentHandler( ::xmlscript::importLibraryCodeNames( pLibArray ) );
-+ xParser->parseStream( source );
-+ mCodeNameToObjectNames = pLibArray->mCodeNames;
-+ }
-+ }
-+ catch ( Exception& e )
-+ {
-+ OSL_TRACE("Urk, should never get here, help!!");
-+ }
-+ }
-+ // Methods - XNameAccess
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.find( aName );
-+ if ( it == mCodeNameToObjectNames.end() )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( it->second );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< ::rtl::OUString > sNames( mCodeNameToObjectNames.size() );
-+ ::rtl::OUString* pStr = sNames.getArray();
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.begin();
-+ ::xmlscript::CodeNameHash::iterator it_end = mCodeNameToObjectNames.end();
-+ for ( ; it != it_end ; ++it, ++pStr )
-+ *pStr = it->first;
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.find( aName ) != mCodeNameToObjectNames.end() );
-+ }
-+ // Methods - XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (const rtl::OUString *)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.size() > 0 );
-+ }
-+ // Methods XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getImplementationName_static();
-+ }
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( getSupportedServiceNames() );
-+ rtl::OUString* pStr = sNames.getArray();
-+ rtl::OUString* pEnd = ( sNames.getArray() + sNames.getLength() );
-+ for ( ; pStr != pEnd ; ++pStr )
-+ {
-+ if ( (*pStr).equals( ServiceName ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getSupportedServiceNames_static();
-+ }
-+ // Service
-+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static()
-+ {
-+ uno::Sequence< rtl::OUString > sServiceNames(1);
-+ sServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames"));
-+ return sServiceNames;
-+ }
-+ static ::rtl::OUString getImplementationName_static()
-+ {
-+ static OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("PersistedReadOnlyCodeNames") );
-+ return sImplName;
-+ }
-+
-+ static Reference< XInterface > SAL_CALL Create ( const Reference< XComponentContext >& xServiceManager ) throw( Exception )
-+ {
-+ Reference< XInterface > xRet =
-+ static_cast< XInterface* >( static_cast< OWeakObject* >( new PersistedReadOnlyCodeNames() ));
-+ return xRet;
-+ }
-+};
-+class ConvertEntryToVbaEntry : public ItemConvertor
-+{
-+ virtual bool convert( Any& item )
-+ {
-+ // All entries are converted to 'Normal' modules
-+ // Document Modules need to be created externall ( e.g. these are under the control
-+ // of the document itself )
-+ rtl::OUString sSource;
-+ bool bRes = false;
-+
-+ if ( item >>= sSource )
-+ {
-+ script::ModuleInfo mInfo;
-+ mInfo.ModuleSource = sSource;
-+ mInfo.ModuleType = script::ModuleType::Normal;
-+ item <<= mInfo;
-+ bRes = true;
-+ }
-+ return bRes;
-+ }
-+};
-+
-+class ConvertEntryFromVbaEntry : public ItemConvertor
-+{
-+ bool convert( Any& item )
-+ {
-+ bool bRes = false;
-+ script::ModuleInfo mInfo;
-+ if ( item >>= mInfo )
-+ {
-+ item <<= mInfo.ModuleSource;
-+ bRes = true;
-+ }
-+ return bRes;
-+ }
-+};
-
-+void SfxScriptLibraryContainer::convertLibraryEntries()
-+{
-+ if ( getVBACompatModeOn() )
-+ {
-+ // going from non-vba to vba
-+ SfxLibrary* pImplLib = getImplLib( String( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+
-+ ConvertEntryToVbaEntry converter;
-+ bool bRes = pImplLib ? pImplLib->convertContainer( getCppuType( ( const script::ModuleInfo* ) NULL ), converter ) : false;
-+ }
-+ else
-+ {
-+ // going from vba to non-vba
-+ // we must delete all Document modules
-+ // what we also must do is warn the user that this is going to happen ( see. Excel )
-+ // needs interaction handler love ( perhaps that needs to be passed into the setVBACompat )
-+ // or perhaps we can access the documents InteractionHandler ?
-+ SfxLibrary* pImplLib = getImplLib( String( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+ ConvertEntryFromVbaEntry convertor;
-+ bool bRes = pImplLib ? pImplLib->convertContainer( getCppuType( ( const rtl::OUString*) NULL ), convertor ) : false;
-+ }
-+}
- //============================================================================
-
- } // namespace basic
-diff --git extensions/source/propctrlr/defaultforminspection.cxx extensions/source/propctrlr/defaultforminspection.cxx
-index 9dcd644..3073295 100644
---- extensions/source/propctrlr/defaultforminspection.cxx
-+++ extensions/source/propctrlr/defaultforminspection.cxx
-@@ -154,7 +154,7 @@ namespace pcr
- { "com.sun.star.form.inspection.EventHandler", false },
-
- // a handler which introduces virtual properties for binding controls to spreadsheet cells
-- { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
-+ { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
-
- // properties related to binding to an XForms DOM node
- { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
-diff --git offapi/com/sun/star/document/XVbaEventsHelper.idl offapi/com/sun/star/document/XVbaEventsHelper.idl
-index 88a93e8..c02ed79 100644
-diff --git offapi/com/sun/star/script/XVBACompat.idl offapi/com/sun/star/script/XVBACompat.idl
-new file mode 100644
-index 0000000..e1b2d28
---- /dev/null
-+++ offapi/com/sun/star/script/XVBACompat.idl
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XLibraryContainer.idl,v $
-+ * $Revision: 1.4 $
-+ *
-+ * 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 __com_sun_star_script_XVBACompat_idl__
-+#define __com_sun_star_script_XVBACompat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+
-+interface XVBACompat: com::sun::star::uno::XInterface
-+{
-+
-+//=============================================================================
-+ [attribute ] boolean VBACompatModeOn;
-+
-+}; }; }; };
-+};
-+#endif
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index ea9bbd1..9837104 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -52,6 +52,7 @@ IDLFILES=\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
- XLibraryQueryExecutable.idl \
-+ XVBACompat.idl\
- ModuleSizeExceededRequest.idl\
-
- # ------------------------------------------------------------------
-diff --git sc/inc/addruno.hxx sc/inc/addruno.hxx
-index bc9391a..fad1f03 100644
---- sc/inc/addruno.hxx
-+++ sc/inc/addruno.hxx
-@@ -50,7 +50,7 @@ private:
- sal_Int32 nRefSheet;
- sal_Bool bIsRange;
-
-- sal_Bool ParseUIString( const String& rUIString );
-+ sal_Bool ParseUIString( const String& rUIString, ScAddress::Convention eConv = ScAddress::CONV_OOO );
-
- public:
-
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 8a648d3..c15f3ec 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -34,6 +34,7 @@
-
- #include <vcl/prntypes.hxx>
- #include <vcl/timer.hxx>
-+#include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/uno/Reference.hxx>
- #include <vos/ref.hxx>
- #include "tabprotection.hxx"
-@@ -313,7 +314,7 @@ private:
- Timer aTrackTimer;
-
- com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
--
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxCodeNames;
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -431,6 +432,7 @@ public:
- SfxObjectShell* pDocShell = NULL );
- ~ScDocument();
-
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > GetPersistedCodeNames() throw( com::sun::star::uno::RuntimeException );
- inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- GetServiceManager() const { return xServiceManager; }
-
-diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index 4193574..a1350aa 100644
---- sc/inc/unonames.hxx
-+++ sc/inc/unonames.hxx
-@@ -590,6 +590,7 @@
- #define SC_UNONAME_ADDRESS "Address"
- #define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
- #define SC_UNONAME_PERSREPR "PersistentRepresentation"
-+#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
- #define SC_UNONAME_REFSHEET "ReferenceSheet"
-
- // --> PB 2004-08-23 #i33095# Security Options
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 6dd6697..2f32352 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -247,6 +247,7 @@ ScDocument::ScDocument( ScDocumentMode e
-
- aTrackTimer.SetTimeoutHdl( LINK( this, ScDocument, TrackTimeHdl ) );
- aTrackTimer.SetTimeout( 100 );
-+ aDocCodeName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- }
-
-
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index b123ad7..7ee3b4a 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -91,6 +91,9 @@
- #include "bcaslot.hxx"
- #include "postit.hxx"
- #include "tabprotection.hxx"
-+#include <comphelper/processfactory.hxx>
-+
-+using namespace ::com::sun::star;
-
- struct ScDefaultAttr
- {
-@@ -4830,5 +4833,30 @@ BOOL ScDocument::NeedPageResetAfterTab(
- return FALSE; // sonst nicht
- }
-
-+uno::Reference< container::XNameAccess >
-+ScDocument::GetPersistedCodeNames() throw( uno::RuntimeException )
-+{
-+ SfxObjectShell* pObjShell = GetDocumentShell();
-+ if ( pShell && !mxCodeNames.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = uno::makeAny( pObjShell->GetModel() );
-+ mxCodeNames.set( ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames")), aArgs), uno::UNO_QUERY );
-+ if ( mxCodeNames.is() )
-+ {
-+ rtl::OUString sWorkbook( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ if ( mxCodeNames->hasByName( sWorkbook ) )
-+ {
-+
-+ rtl::OUString sCodeName;
-+ mxCodeNames->getByName( sWorkbook ) >>= sCodeName;
-+ SetCodeName( sCodeName );
-+ }
-+ }
-+ }
-+ return mxCodeNames;
-+}
-+
-+
-
-
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 9c34585..cebd7dc 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -105,6 +105,7 @@
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
-
- using namespace com::sun::star;
-@@ -112,8 +113,8 @@ using namespace com::sun::star;
-
- #define INVALID_POS 0xFFFFFFFF
-
--
--
-+// defined in docfunc.cxx ( really this needs a new name )
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
- ImportExcel( rImpData, rStrm ), mnTab(0)
-@@ -292,6 +293,44 @@ void ImportExcel8::ReadBasic( void )
- bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-+ // for each document module get the associated object for the codename and do a replacebyname
-+ ScDocument& aDoc = GetDoc();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = GetDocShell()->GetBasicContainer();
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if ( xLib.is() )
-+ {
-+ rtl::OUString sOUCodeName( aDoc.GetCodeName() );
-+ if ( xLib->hasByName( sOUCodeName ) )
-+ {
-+ script::ModuleInfo mInfo;
-+ xLib->getByName( sOUCodeName ) >>= mInfo;
-+ String sTmp = sOUCodeName;
-+ mInfo.ModuleObject = lcl_InitModuleInfo( *GetDocShell(), sTmp ).ModuleObject;
-+ xLib->replaceByName( sOUCodeName, uno::makeAny( mInfo ) );
-+
-+ }
-+ SCTAB nCount = aDoc.GetTableCount();
-+
-+ for( SCTAB i = 0; i < nCount; ++i )
-+ {
-+ String sName;
-+ aDoc.GetCodeName( i, sName );
-+ sOUCodeName = sName;
-+ if ( xLib->hasByName( sOUCodeName ) )
-+ {
-+ script::ModuleInfo mInfo;
-+ xLib->getByName( sOUCodeName ) >>= mInfo;
-+ mInfo.ModuleObject = lcl_InitModuleInfo( *GetDocShell(), sName ).ModuleObject;
-+ xLib->replaceByName( sOUCodeName, uno::makeAny( mInfo ) );
-+ }
-+ }
-+ }
- }
- }
- }
-diff --git sc/source/filter/xml/xmlsubti.cxx sc/source/filter/xml/xmlsubti.cxx
-index ab00932..f8674ae 100644
---- sc/source/filter/xml/xmlsubti.cxx
-+++ sc/source/filter/xml/xmlsubti.cxx
-@@ -228,6 +228,7 @@ void ScMyTables::NewSheet(const rtl::OUS
- uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
- if ( xIndex.is() )
- {
-+
- xCurrentSheet.set(xIndex->getByIndex(nCurrentSheet), uno::UNO_QUERY);
- if ( xCurrentSheet.is() )
- {
-@@ -254,6 +255,25 @@ void ScMyTables::NewSheet(const rtl::OUS
- }
- }
- }
-+
-+ ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-+ // Codenames need to be set as sheets are created and read
-+ if ( pDoc )
-+ {
-+ String sName;
-+ pDoc->GetName( nCurrentSheet, sName );
-+ rtl::OUString sOUName( sName );
-+ uno::Reference< container::XNameAccess > xCodeNames( pDoc->GetPersistedCodeNames() );
-+ if( xCodeNames.is() && xCodeNames->hasByName( sName ) )
-+ {
-+ rtl::OUString sOUSCodeName;
-+ xCodeNames->getByName( sName ) >>= sOUSCodeName;
-+ rImport.LockSolarMutex();
-+ String sCodeName( sOUSCodeName );
-+ pDoc->SetCodeName( nCurrentSheet, sCodeName );
-+ rImport.UnlockSolarMutex();
-+ }
-+ }
- rImport.SetTableStyle(sStyleName);
-
- if ( sStyleName.getLength() )
-diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
-index 105f743..91ff9f7 100644
---- sc/source/ui/docshell/docfunc.cxx
-+++ sc/source/ui/docshell/docfunc.cxx
-@@ -2028,23 +2028,29 @@ BOOL ScDocFunc::MoveBlock( const ScRange
- }
-
- //------------------------------------------------------------------------
--script::ModuleInfo lcl_InitModuleInfo( ScDocShell& rDocSh, String& sModule )
-+uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName )
- {
-- ::rtl::OUString aModName( sModule );
- uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ uno::Reference< uno::XInterface > xDocModuleApiObject;
-+ if ( xSF.is() )
-+ {
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( sCodeName ), uno::UNO_QUERY );
-+ }
-+ return xDocModuleApiObject;
-+
-+}
-+
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule )
-+{
-+ ::rtl::OUString aModName( sModule );
- ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleName = aModName;
- sModuleInfo.ModuleSource = sVbaOption;
- sModuleInfo.ModuleType = script::ModuleType::Document;
-- uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-- if ( xSF.is() )
-- {
-- uno::Sequence< uno::Any > aArgs(1);
-- aArgs[0] = uno::Any( aModName );
-- xVBACodeNamedObjectAccess.set( xSF->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider")), aArgs), uno::UNO_QUERY );
-- sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( aModName ), uno::UNO_QUERY );
-- }
-+ sModuleInfo.ModuleObject = GetDocModuleObject( rDocSh, sModule );
- return sModuleInfo;
- }
-
-@@ -2064,21 +2070,19 @@ void lcl_InsertModule( ScDocShell& rDocS
- }
- if( xLib.is() )
- {
-- // test Module has exist
-- // if the Module is exist. changed to another name
-- // and at this time the string like "SheetX"
-+ // if the Module with codename exists then find a new name
- sal_Int32 nNum = 1;
-+ sModuleInfo.ModuleName = sModuleName;
- while( xLib->hasByName( sModuleInfo.ModuleName ) )
- {
-- sModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
-+ sModuleInfo.ModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
- nNum += 1;
- }
-- sModuleInfo.ModuleName = sModuleName;
- uno::Any aSourceAny;
- aSourceAny <<= sModuleInfo;
-- xLib->insertByName( sModuleName, aSourceAny );
-+ xLib->insertByName( sModuleInfo.ModuleName, aSourceAny );
- ScDocument* pDoc = rDocSh.GetDocument();
-- String sCodeName( sModuleName );
-+ String sCodeName( sModuleInfo.ModuleName );
- pDoc->SetCodeName( nTab, sCodeName );
- }
- SFX_APP()->LeaveBasicCall();
-@@ -2116,8 +2120,10 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-- StarBASIC* pStarBASIC = rDocShell.GetBasic();
-- BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
-+ // Strange loop, also basic is loaded too early ( InsertTable )
-+ // is called via the xml import for sheets in described in odf
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC ? pStarBASIC->isVBAEnabled() : false;
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
- if ( bVbaEnabled )
-@@ -2132,13 +2138,16 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
-
- if (pDoc->InsertTab( nTab, rName ))
- {
-+ String sCodeName;
- if (bRecord)
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
- // Views updaten:
-- if( bVbaEnabled )
-+ // Only insert vba modules if vba mode ( and not currently importing XML )
-+ if( bVbaEnabled && !rDocShell.GetDocument()->IsImportingXML() )
- {
-- String sCodeName( rName );
-+ if ( sCodeName.Len() == 0 )
-+ sCodeName = rName;
- lcl_InsertModule( rDocShell, nTab, sCodeName );
- }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index b904d50..28c6140 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -130,6 +130,7 @@
- #include "cellsuno.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
-@@ -534,6 +539,45 @@ void ScDocShell::BeforeXMLLoading()
- ScColumn::bDoubleAlloc = sal_True;
- }
-
-+// defined in docfunc.cxx ( really this needs a new name )
-+uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName );
-+
-+rtl::OUString GetCodeName( ScDocument& aDocument, String& sObjectName )
-+{
-+ uno::Reference< container::XNameAccess > xCodeNames( aDocument.GetPersistedCodeNames() );
-+ rtl::OUString sOUSCodeName;
-+ xCodeNames->getByName( sObjectName ) >>= sOUSCodeName;
-+ return sOUSCodeName;
-+}
-+
-+void SetDocModuleForCodeName( ScDocument& aDocument, String& sCodeName )
-+{
-+ uno::Reference< script::XLibraryContainer > xLibContainer = aDocument.GetDocumentShell()->GetBasicContainer();
-+ uno::Reference< container::XNameContainer > xLib;
-+
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+
-+ if ( xLib.is() )
-+ {
-+ rtl::OUString sOUCodeName( sCodeName );
-+ script::ModuleInfo mInfo;
-+ if ( xLib->getByName( sOUCodeName ) >>= mInfo )
-+ {
-+ mInfo.ModuleObject = GetDocModuleObject( *aDocument.GetDocumentShell(), sCodeName );
-+ xLib->replaceByName( sOUCodeName, uno::makeAny( mInfo ) );
-+ }
-+ else
-+ {
-+ // Insert a big fat assertion etc
-+ }
-+ }
-+}
-+
- void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- {
- if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
-@@ -608,8 +652,31 @@ void ScDocShell::AfterXMLLoading(sal_Boo
- // suppress VBA events when loading the xml
- uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
- if ( xEvt.is() )
- xEvt->setIgnoreEvents( sal_False );
-+ // SetCodenames for each tab ( and set up the vba DOC Modules )
-+ SCTAB nTabCount = aDocument.GetTableCount();
-+ for (SCTAB i = 0; i < nTabCount; ++i)
-+ {
-+ String sObjectName;
-+ String sCodeName;
-+ try
-+ {
-+ if ( i == 0 )
-+ {
-+ sObjectName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ sCodeName = GetCodeName( aDocument, sObjectName );
-+ SetDocModuleForCodeName( aDocument, sCodeName );
-+ }
-+ aDocument.GetName( i, sObjectName );
-+ sCodeName = GetCodeName( aDocument, sObjectName );
-+ SetDocModuleForCodeName( aDocument, sCodeName );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableUndo( TRUE );
- bIsEmpty = FALSE;
-
-
-diff --git sc/source/ui/unoobj/addruno.cxx sc/source/ui/unoobj/addruno.cxx
-index b417b7e..4f313f2 100644
---- sc/source/ui/unoobj/addruno.cxx
-+++ sc/source/ui/unoobj/addruno.cxx
-@@ -72,7 +72,7 @@ void ScAddressConversionObj::Notify( Sfx
- }
- }
-
--sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
-+sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ScAddress::Convention eConv )
- {
- if (!pDocShell)
- return sal_False;
-@@ -81,7 +81,7 @@ sal_Bool ScAddressConversionObj::ParseUI
- sal_Bool bSuccess = sal_False;
- if ( bIsRange )
- {
-- USHORT nResult = aRange.ParseAny( rUIString, pDoc );
-+ USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -95,7 +95,7 @@ sal_Bool ScAddressConversionObj::ParseUI
- }
- else
- {
-- USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
-+ USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -119,6 +119,7 @@ uno::Reference<beans::XPropertySetInfo>
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -132,6 +133,7 @@ uno::Reference<beans::XPropertySetInfo>
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -193,8 +195,11 @@ void SAL_CALL ScAddressConversionObj::se
- bSuccess = ParseUIString( aUIString );
- }
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ScAddress::Convention aConv = ScAddress::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ScAddress::CONV_XL_A1;
- // parse the file format string
- rtl::OUString sRepresentation;
- if (aValue >>= sRepresentation)
-@@ -215,7 +220,7 @@ void SAL_CALL ScAddressConversionObj::se
- }
-
- // parse the rest like a UI string
-- bSuccess = ParseUIString( aUIString );
-+ bSuccess = ParseUIString( aUIString, aConv );
- }
- }
- else
-@@ -268,17 +273,21 @@ uno::Any SAL_CALL ScAddressConversionObj
- aRange.aStart.Format( aFormatStr, nFlags, pDoc );
- aRet <<= rtl::OUString( aFormatStr );
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ScAddress::Convention aConv = ScAddress::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ScAddress::CONV_XL_A1;
-+
- // generate file format string - always include sheet
- String aFormatStr;
-- aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
-+ aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- if ( bIsRange )
- {
- // manually concatenate range so both parts always have the sheet name
- aFormatStr.Append( (sal_Unicode) ':' );
- String aSecond;
-- aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
-+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- aFormatStr.Append( aSecond );
- }
- aRet <<= rtl::OUString( aFormatStr );
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index cb8560a..a259a95 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -1691,6 +1691,7 @@ uno::Sequence<rtl::OUString> SAL_CALL Sc
-
- return concatServiceNames( aMyServices, aDrawServices );
- }
-+
- // XCodeNameQuery
- rtl::OUString SAL_CALL
- ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-@@ -1698,7 +1699,6 @@ ScModelObj::getCodeNameForObject( const
- rtl::OUString sCodeName;
- if ( pDocShell )
- {
-- OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
- // need to find the page ( and index ) for this control
- uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
-index b1a8a85..270c61a 100644
---- sc/source/ui/unoobj/servuno.cxx
-+++ sc/source/ui/unoobj/servuno.cxx
-@@ -63,7 +63,6 @@
- #include <svx/xmlgrhlp.hxx>
-
- #include <comphelper/processfactory.hxx>
--
- using namespace ::com::sun::star;
-
- class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index d28308f..7de8cbb 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -522,7 +522,7 @@ String ScVbaEventsHelper::getSheetModule
- {
- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- String aCodeName;
-- pDoc->GetName( nTab, aCodeName);
-+ pDoc->GetCodeName( nTab, aCodeName);
- // Use code name if that exists
- if ( pExtOptions )
- aCodeName = pExtOptions->GetCodeName( nTab );
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 31620f8..b5595ef 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -215,24 +215,27 @@ uno::Reference< excel::XRange > lcl_make
- uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses();
- ScRangeList aCellRanges;
- sal_Int32 nLen = sAddresses.getLength();
-- for ( sal_Int32 index = 0; index < nLen; ++index )
-- {
-- ScRange refRange;
-- ScUnoConversion::FillScRange( refRange, sAddresses[ index ] );
-- aCellRanges.Append( refRange );
-- }
-- // Single range
-- if ( aCellRanges.First() == aCellRanges.Last() )
-- {
-- uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
-- // #FIXME need proper (WorkSheet) parent
-- xRange = new ScVbaRange( xParent, xContext, xTmpRange );
-- }
-- else
-- {
-- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
-- // #FIXME need proper (WorkSheet) parent
-- xRange = new ScVbaRange( xParent, xContext, xRanges );
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, sAddresses[ index ] );
-+ aCellRanges.Append( refRange );
-+ }
-+ // Single range
-+ if ( aCellRanges.First() == aCellRanges.Last() )
-+ {
-+ uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
-+ // #FIXME need proper (WorkSheet) parent
-+ xRange = new ScVbaRange( xParent, xContext, xTmpRange );
-+ }
-+ else
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
-+ // #FIXME need proper (WorkSheet) parent
-+ xRange = new ScVbaRange( xParent, xContext, xRanges );
-+ }
- }
- return xRange;
- }
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index ed8f91e..970b945 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -415,7 +415,7 @@ namespace dlgprov
-
- void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( Event, NULL );
- }
-@@ -425,7 +425,7 @@ namespace dlgprov
- Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( Event, &aReturn );
-@@ -669,7 +669,7 @@ namespace dlgprov
-
- void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( aScriptEvent, NULL );
- }
-@@ -679,7 +679,7 @@ namespace dlgprov
- Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( aScriptEvent, &aReturn );
-diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx
-index b6912c6..7e6ad46 100644
---- scripting/source/dlgprov/dlgprov.cxx
-+++ scripting/source/dlgprov/dlgprov.cxx
-@@ -188,7 +188,15 @@ static ::rtl::OUString aResourceResolver
- Reference< container::XNameContainer > DialogProviderImpl::createDialogModel( const Reference< io::XInputStream >& xInput, const Reference< resource::XStringResourceManager >& xStringResourceManager ) throw ( Exception )
- {
- Reference< container::XNameContainer > xDialogModel( createControlModel() );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
-+ // #TODO we really need to detect the source of the Dialog, is it
-+ // located in the document or not. m_xModel need not be the location of
-+ // the dialog. E.g. if the dialog was created from basic ( then we just
-+ // can't tell where its from )
-+ // If we are happy to always substitute the form model for the awt
-+ // one then maybe the presence of a document model is enough to trigger
-+ // swapping out the models ( or perhaps we only want to do this
-+ // for vba mode ) there are a number of feasible and valid possibilities
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
- // Set resource property
- if( xStringResourceManager.is() )
- {
-@@ -649,7 +657,10 @@ static ::rtl::OUString aResourceResolver
- aArguments[0] >>= m_xModel;
- m_BasicInfo.reset( new BasicRTLParams() );
- m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
-- m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
-+ // allow null mxDlgLib, a document dialog instantiated from
-+ // from application basic is unable to provide ( or find ) it's
-+ // Library
-+ aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
- // leave the possibility to optionally allow the old dialog creation
- // to use the new XScriptListener ( which converts the old style macro
- // to a SF url )
-diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
-index a6368b9..752587c 100644
---- svx/inc/svx/msocximex.hxx
-+++ svx/inc/svx/msocximex.hxx
-@@ -405,6 +405,8 @@ public:
- sal_uInt32 nGroupNameLen;
- sal_uInt32 nUnknown10;
-
-+ rtl::OUString msCtrlSource;
-+ rtl::OUString msRowSource;
- char *pValue;
- char *pCaption;
- char *pGroupName;
-@@ -488,6 +490,8 @@ struct ContainerRecord
-
- ::rtl::OUString cName;
- ::rtl::OUString controlTip;
-+ ::rtl::OUString sCtrlSource;
-+ ::rtl::OUString sRowSource;
-
- sal_uInt32 nTop;
- sal_uInt32 nLeft;
-@@ -914,7 +918,8 @@ public:
- OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(TRUE);
-@@ -1015,7 +1020,7 @@ class OCX_ComboBox : public OCX_ModernCo
- public:
- OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1040,7 +1045,8 @@ class OCX_ListBox : public OCX_ModernCon
- public:
- OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index a771c8e..8535aa5 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -49,6 +49,10 @@
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <com/sun/star/form/XForm.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/awt/FontWeight.hpp>
- #include <com/sun/star/awt/FontSlant.hpp>
-@@ -80,6 +84,13 @@
- #include <algorithm>
- #include <memory>
-
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+
- #ifndef C2S
- #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
- #endif
-@@ -707,14 +718,22 @@ class ContainerRecReader
- if( nCtrlSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nCtrlSrcBufSize );
-+ std::auto_ptr< sal_Char > pCtrlSrcName;
-+ pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
-+ pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
-+ rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
-+ OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- // row source name
- sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
- if( nRowSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nRowSrcBufSize );
-+ std::auto_ptr< sal_Char > pRowSrcName;
-+ pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
-+ pS->Read( pRowSrcName.get(), nRowSrcBufSize );
-+ rec.sRowSource = lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
-+ OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- // seek to end of data
-@@ -1489,7 +1508,69 @@ sal_Bool OCX_ImageButton::Export(SvStora
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
- return WriteContents(xContents,rPropSet,rSize);
- }
-+void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+}
-
- sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
-@@ -1561,7 +1642,8 @@ sal_Bool OCX_OptionButton::Import(com::s
- aTmp <<= sGroupName;
- rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
- }
--
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -2452,6 +2534,9 @@ sal_Bool OCX_ComboBox::Import(com::sun::
- aTmp <<= nTmp;
- rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -2672,7 +2757,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
-
- aTmp <<= ImportColor( nBorderColor );
- rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
--
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -3447,15 +3533,29 @@ void OCX_ContainerControl::ProcessContro
- {
- // A container control needs to read the f stream in
- // the folder ( substorage ) associated with this control
-- if ( rec.nTypeIdent == FRAME ||
-- rec.nTypeIdent == MULTIPAGE||
-- rec.nTypeIdent == PAGE )
-+ switch ( rec.nTypeIdent )
- {
-- OCX_ContainerControl* pContainer =
-- static_cast< OCX_ContainerControl* >( pControl );
-- oStream = pContainer->getContainerStream();
-+ case FRAME:
-+ case MULTIPAGE:
-+ case PAGE:
-+ {
-+ OCX_ContainerControl* pContainer =
-+ static_cast< OCX_ContainerControl* >( pControl );
-+ oStream = pContainer->getContainerStream();
-+ break;
-+ }
-+ case LISTBOX:
-+ case OPTIONBUTTON:
-+ case COMBOBOX:
-+ {
-+ OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
-+ if ( pList )
-+ {
-+ pList->msCtrlSource = rec.sCtrlSource;
-+ pList->msRowSource = rec.sRowSource;
-+ }
-+ }
- }
--
- pControl->sName = rec.cName;
- pControl->msToolTip = rec.controlTip;
- // Position of controls is relative to the container
-@@ -4084,7 +4184,7 @@ sal_Bool OCX_UserForm::Import(
- OCX_ContainerControl::Import( xPropSet );
-
- uno::Reference<io::XInputStreamProvider> xSource =
-- xmlscript::exportDialogModel(mxParent, mxCtx);
-+ xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
- uno::Any aSourceAny(uno::makeAny(xSource));
- if (rLib->hasByName(sName))
- rLib->replaceByName(sName, aSourceAny);
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index 7acf7db..14ed343 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -54,6 +54,7 @@ using namespace com::sun::star::awt;
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
- using namespace com::sun::star::container;
- using namespace com::sun::star::script;
- using namespace com::sun::star::uno;
-@@ -267,12 +268,13 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
-- if( xLib.is() )
-+ Reference< XVBACompat > xCompat( xLibContainer, UNO_QUERY );
-+ if( xLib.is() && xCompat.is() )
- {
- Reference< container::XNameAccess > xVBAObjectForCodeName;
- if ( !bAsComment )
- {
-- rDocSh.GetBasic()->SetVBAEnabled( true );
-+ xCompat->setVBACompatModeOn( sal_True );
- Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
- if ( xSF.is() )
- {
-@@ -425,20 +427,24 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
-
- Any aSourceAny;
- OSL_TRACE("erm %d", mType );
-- if ( xVBAObjectForCodeName.is() && ( mType == ModuleType::Document || mType == ModuleType::Class || mType == ModuleType::Form ) )
-+ //if ( /*xVBAObjectForCodeName.is() && */ ( mType == ModuleType::Document || mType == ModuleType::Class || mType == ModuleType::Form ) )
-+ if ( true )
- {
- OSL_TRACE("vba processing %d", mType );
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleName = aModName;
- sModuleInfo.ModuleSource = aSource;
- sModuleInfo.ModuleType = mType;
-+// ok, try always passing the model to basic, should fit
- if ( mType == ModuleType::Form )
- // hack, the module ( in document basic should...
- // know the XModel... ) needs fixing in basic
- // somewhere
- sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-+/*
- else if ( mType != ModuleType::Class )
- sModuleInfo.ModuleObject.set( xVBAObjectForCodeName->getByName( aModName ), UNO_QUERY );
-+*/
- aSourceAny <<= sModuleInfo;
- }
- else
-diff --git xmlscript/inc/xmlscript/xmldlg_imexp.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-index ea5b591..4549fa9 100644
---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-@@ -30,6 +30,8 @@
- #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
- #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
-
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
- #include <com/sun/star/container/XNameContainer.hpp>
- #endif
-@@ -54,7 +56,9 @@ void SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::container::XNameContainer > const & xDialogModel )
-+ ::com::sun::star::container::XNameContainer > const & xDialogModel,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -63,7 +67,9 @@ SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- // additional functions for convenience
-@@ -74,7 +80,9 @@ SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -84,7 +92,9 @@ void SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- }
-diff --git xmlscript/inc/xmlscript/xmllib_imexp.hxx xmlscript/inc/xmlscript/xmllib_imexp.hxx
-index 9a3048f..f92b154 100644
---- xmlscript/inc/xmlscript/xmllib_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmllib_imexp.hxx
-@@ -34,11 +34,21 @@
- #include <com/sun/star/uno/Sequence.hxx>
-
- #include "xmlscript/xmlns.h"
--
-+#include <hash_map>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- namespace xmlscript
- {
-+struct ObjectModuleDesc
-+{
-+ rtl::OUString msObjectName;
-+ sal_Int32 mnModuleType;
-+ObjectModuleDesc() : mnModuleType( ::com::sun::star::script::ModuleType::Normal ) {}
-+};
-
-+typedef std::hash_map< rtl::OUString,
-+ObjectModuleDesc, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > ObjectModuleDescHash;
- //==============================================================================
- // Library container export
- // HACK C++ struct to transport info. Later the container
-@@ -53,14 +63,19 @@ struct LibDescriptor
- sal_Bool bPasswordProtected;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aElementNames;
- sal_Bool bPreload;
-+ ObjectModuleDescHash hModuleTypeDesc;
- };
-
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-+
- struct LibDescriptorArray
- {
- LibDescriptor* mpLibs;
- sal_Int32 mnLibCount;
-
-- LibDescriptorArray( void ) { mpLibs = NULL; mnLibCount = 0; }
-+ CodeNameHash mCodeNames;
-+ bool mbVBAMode;
-+ LibDescriptorArray( void ) { mpLibs = NULL; mnLibCount = 0; mbVBAMode = false; }
- LibDescriptorArray( sal_Int32 nLibCount );
-
- ~LibDescriptorArray();
-@@ -79,6 +94,11 @@ SAL_CALL exportLibraryContainer(
- SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
-+::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptorArray* pLibArray )
-+ SAL_THROW( (::com::sun::star::uno::Exception) );
-+
-
- void
- SAL_CALL exportLibrary(
-diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
-index c87538f..c5cdcaa 100644
---- xmlscript/source/xmldlg_imexp/exp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx
-@@ -180,9 +180,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readCheckBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readRadioButtonModel( StyleBag * all_styles )
-+ void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readComboBoxModel( StyleBag * all_styles )
-+ void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readCurrencyFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -198,7 +198,7 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readImageControlModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readListBoxModel( StyleBag * all_styles )
-+ void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readNumericFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index c53e325..e5263ad 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -131,6 +131,7 @@ struct DialogImport
-
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
-+ css::uno::Reference< css::frame::XModel > _xDoc;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -164,16 +165,18 @@ public:
- inline DialogImport(
- css::uno::Reference<css::uno::XComponentContext> const & xContext,
- css::uno::Reference<css::container::XNameContainer>
-- const & xDialogModel )
-+ const & xDialogModel,
-+ css::uno::Reference<css::frame::XModel> const & xDoc )
- SAL_THROW( () )
- : _xContext( xContext )
- , _xDialogModel( xDialogModel )
-- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
-+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
- _xContext.is() ); }
- virtual ~DialogImport()
- SAL_THROW( () );
-
-+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-index be29402..1d7e398 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-@@ -44,6 +44,7 @@
- using namespace ::rtl;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
-
- namespace xmlscript
- {
-@@ -73,7 +74,8 @@ Reference< io::XInputStream > InputStrea
- //==================================================================================================
- Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -98,7 +100,7 @@ Reference< io::XInputStreamProvider > SA
-
- Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( createOutputStream( &aBytes ) );
-- exportDialogModel( xHandler, xDialogModel );
-+ exportDialogModel( xHandler, xDialogModel, xDocument );
-
- return new InputStreamProvider( aBytes );
- }
-@@ -107,7 +109,8 @@ Reference< io::XInputStreamProvider > SA
- void SAL_CALL importDialogModel(
- Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -129,7 +132,7 @@ void SAL_CALL importDialogModel(
- }
-
- // error handler, entity resolver omitted for this helper function
-- xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
-
- xml::sax::InputSource source;
- source.aInputStream = xInput;
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-index 3d744be..3cf76d0 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -33,7 +33,11 @@
- #include "exp_share.hxx"
-
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
--
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -42,6 +46,60 @@ using ::rtl::OUString;
- namespace xmlscript
- {
-
-+void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xDocument.is() )
-+ xFac.set( xDocument, uno::UNO_QUERY );
-+
-+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-+
-+ if ( xFac.is() && xBinding.is() )
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-+ if ( xBindable.is() )
-+ {
-+ table::CellAddress aAddress;
-+ try
-+ {
-+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ rtl::OUString sAddress;
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ if ( sAddress.getLength() > 0 )
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-+
-+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+ catch( Exception& e )
-+ {
-+ }
-+ }
-+ }
-+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-+ if ( xEntrySink.is() )
-+ {
-+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-+ if ( xListSource.is() )
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+
-+ table::CellRangeAddress aAddress;
-+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-+
-+ rtl::OUString sAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ OSL_TRACE("**** cell range source list %s",
-+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( sAddress.getLength() > 0 );
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
-+ }
-+ }
-+
-+}
- static inline bool readBorderProps(
- ElementDescriptor * element, Style & style )
- {
-@@ -209,7 +267,7 @@ void ElementDescriptor::readCheckBoxMode
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -250,7 +308,8 @@ void ElementDescriptor::readComboBoxMode
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
--
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -276,7 +335,7 @@ void ElementDescriptor::readComboBoxMode
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -311,7 +370,7 @@ void ElementDescriptor::readListBoxModel
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
- readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
--
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -351,7 +410,7 @@ void ElementDescriptor::readListBoxModel
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
-+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -409,6 +468,7 @@ void ElementDescriptor::readRadioButtonM
- break;
- }
- }
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-index 999f899..de2d659 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-@@ -1309,7 +1309,8 @@ void StyleBag::dump( Reference< xml::sax
- //==================================================================================================
- void SAL_CALL exportDialogModel(
- Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
-- Reference< container::XNameContainer > const & xDialogModel )
-+ Reference< container::XNameContainer > const & xDialogModel,
-+ Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- StyleBag all_styles;
-@@ -1357,7 +1358,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readRadioButtonModel( &all_styles );
-+ pElem->readRadioButtonModel( &all_styles, xDocument );
- pRadioGroup->addSubElement( xElem );
- }
- else // no radio
-@@ -1386,7 +1387,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readComboBoxModel( &all_styles );
-+ pElem->readComboBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- {
-@@ -1394,7 +1395,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readListBoxModel( &all_styles );
-+ pElem->readListBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index ee1d824..d57bb95 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -34,6 +34,12 @@
-
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-
-
- using namespace ::com::sun::star;
-@@ -42,7 +48,57 @@ using ::rtl::OUString;
-
- namespace xmlscript
- {
--
-+void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
-+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-+ {
-+ // Set up Celllink
-+ if ( sLinkedCell.getLength() )
-+ {
-+ Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ if ( xBindable.is() && xConvertor.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+
-+ }
-+ }
-+ // Set up CelllRange
-+ if ( sCellRange.getLength() )
-+ {
-+ Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ if ( xListEntrySink.is() && xConvertor.is() )
-+ {
-+ table::CellRangeAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+
-+ }
-+ }
-+ }
-+}
- // progessmeter
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > ProgressBarElement::startChildElement(
-@@ -1338,10 +1394,24 @@ void TitledBoxElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1393,7 +1463,7 @@ void TitledBoxElement::endElement()
- }
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
--
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1469,10 +1539,23 @@ void RadioGroupElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1524,6 +1607,7 @@ void RadioGroupElement::endElement()
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1644,9 +1728,26 @@ Reference< xml::input::XElement > MenuLi
- void MenuListElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-+
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ sListBoxService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1679,13 +1780,16 @@ void MenuListElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
--
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- if (_popup.is())
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-+ if ( !sCellRange.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
- makeAny( p->getItemValues() ) );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
-+ if ( !sLinkedCell.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
- makeAny( p->getSelectedItems() ) );
- }
- ctx.importEvents( _events );
-@@ -1731,9 +1835,26 @@ Reference< xml::input::XElement > ComboB
- void ComboBoxElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.ComboBox");
-+
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1775,8 +1896,10 @@ void ComboBoxElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-
-- if (_popup.is())
-+ if (_popup.is() && !sCellRange.getLength() )
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 74c09e6..092dcc0 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -62,6 +62,7 @@
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
- using ::rtl::OUString;
-
- namespace xmlscript
-@@ -1879,12 +1880,13 @@ Reference< xml::input::XElement > Dialog
- //==================================================================================================
- Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- return ::xmlscript::createDocumentHandler(
- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel ) ) );
-+ new DialogImport( xContext, xDialogModel, xDocument ) ) );
- }
-
- }
-diff --git xmlscript/source/xmllib_imexp/imp_share.hxx xmlscript/source/xmllib_imexp/imp_share.hxx
-index d602103..fdc0536 100644
---- xmlscript/source/xmllib_imexp/imp_share.hxx
-+++ xmlscript/source/xmllib_imexp/imp_share.hxx
-@@ -220,7 +220,6 @@ class LibrariesElement : public LibEleme
-
- protected:
- vector< LibDescriptor > mLibDescriptors;
--
- public:
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
- sal_Int32 nUid, OUString const & rLocalName,
-@@ -244,7 +243,7 @@ class LibraryElement : public LibElement
- {
- protected:
- vector< OUString > mElements;
--
-+ ObjectModuleDescHash mObjectDescs;
- public:
-
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
-diff --git xmlscript/source/xmllib_imexp/xmllib_import.cxx xmlscript/source/xmllib_imexp/xmllib_import.cxx
-index b533d37..ce31ee0 100644
---- xmlscript/source/xmllib_imexp/xmllib_import.cxx
-+++ xmlscript/source/xmllib_imexp/xmllib_import.cxx
-@@ -44,7 +44,20 @@ namespace xmlscript
- {
-
- //##################################################################################################
--
-+sal_Int32 lcl_getModuleTypeForStringType( const rtl::OUString& rsType )
-+{
-+ // default to normal unknown
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-+ if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("class") ) ) )
-+ nType = com::sun::star::script::ModuleType::Class;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("form") ) ) )
-+ nType = com::sun::star::script::ModuleType::Form;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("document") ) ) )
-+ nType = com::sun::star::script::ModuleType::Document;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("normal") ) ) )
-+ nType = com::sun::star::script::ModuleType::Normal;
-+ return nType;
-+}
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > LibElementBase::getParent()
- throw (RuntimeException)
-@@ -185,6 +198,13 @@ Reference< xml::input::XElement > Librar
- }
- else if (mpLibArray && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("libraries") ))
- {
-+ rtl::OUString sVbaCompatMode;
-+ sVbaCompatMode = xAttributes->getValueByUidName(
-+ XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("vbaenabled") ) );
-+
-+ if ( sVbaCompatMode.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) ) )
-+ mpLibArray->mbVBAMode = true;
- return new LibrariesElement( rLocalName, xAttributes, 0, this );
- }
- else if (mpLibDesc && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("library") ))
-@@ -269,6 +289,19 @@ Reference< xml::input::XElement > Librar
- mLibDescriptors.push_back( aDesc );
- return new LibraryElement( rLocalName, xAttributes, this, _pImport );
- }
-+ // CodeNames are only relevant for the container ( e.g. the document )
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("codename") ))
-+ {
-+ rtl::OUString sCodeName = xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) );
-+ rtl::OUString sObjectName = xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("objectname") ) );
-+ if ( ( sCodeName.getLength() > 0 ) && ( sObjectName.getLength() > 0 ) )
-+ _pImport->mpLibArray->mCodeNames[ sObjectName ] = sCodeName;
-+ return new LibElementBase( rLocalName, xAttributes, this, _pImport );
-+ }
- else
- {
- throw xml::sax::SAXException(
-@@ -311,7 +344,13 @@ Reference< xml::input::XElement > Librar
- OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ) );
- if (aValue.getLength())
- mElements.push_back( aValue );
--
-+ ObjectModuleDesc aDesc;
-+ aDesc.mnModuleType = lcl_getModuleTypeForStringType(
-+ xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("moduletype") ) ) );
-+ if ( aValue.getLength() && aDesc.mnModuleType != ::com::sun::star::script::ModuleType::Unknown )
-+ mObjectDescs[ aValue ] = aDesc;
- return new LibElementBase( rLocalName, xAttributes, this, _pImport );
- }
- else
-@@ -335,6 +374,7 @@ void LibraryElement::endElement()
- if( !pLib )
- pLib = &static_cast< LibrariesElement* >( _pParent )->mLibDescriptors.back();
- pLib->aElementNames = aElementNames;
-+ pLib->hModuleTypeDesc = mObjectDescs;
- }
-
-
-@@ -348,6 +388,16 @@ SAL_CALL importLibraryContainer( LibDesc
- static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
- }
-
-+
-+Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptorArray* pLibArray )
-+ SAL_THROW( (Exception) )
-+{
-+ return ::xmlscript::createDocumentHandler(
-+ static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
-+}
-+
-+
- //##################################################################################################
-
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-@@ -365,6 +415,7 @@ LibDescriptorArray::LibDescriptorArray(
- {
- mnLibCount = nLibCount;
- mpLibs = new LibDescriptor[ mnLibCount ];
-+ mbVBAMode = false;
- }
-
- LibDescriptorArray::~LibDescriptorArray()
diff --git a/patches/test/vba/ObjectModule.txt b/patches/test/vba/ObjectModule.txt
deleted file mode 100644
index f3a569068..000000000
--- a/patches/test/vba/ObjectModule.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-ObjectModule.diff contains some bad hacking to try and see how to implement object modules, there is a new sbdocmod.hxx for new class SbDocModule.
-
-problems:
-=========
-
- * the ide doesn't display the module ( no idea why )
- * Document, Form and Workbook modules should all subclass a common 'ObjectModule' type
- * there are other changes in this patch for moving the VBAFind to the StarBasic class and a failed attempt to try and solve the issue of Sun's helperapi and the vba interop stuff ( from openoffice ) co-existing ( andreas already has fixed that in i75428 ( so that changes about VBAFind can be safely ignored )
- * really on import we need to be able to create the Sheet, Form or Workbook object that the module delegates to. ( there are the usual bootstrap problems ( with ThisComponent ) though when trying to create the vba objects ( on document load before the document is active )
-
-ps the object module code in the diff is really really crap, I only am keeping it as a diff here so I can return to my experiments later, e.g. this code is not meant to be a basis of any real code
-
diff --git a/patches/test/vba/ObjectModuleUITest.txt b/patches/test/vba/ObjectModuleUITest.txt
deleted file mode 100644
index 669165902..000000000
--- a/patches/test/vba/ObjectModuleUITest.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-This file describe the UI test for Object Module and the test document is “TestObjectModule.xlsâ€
- 1 Open/Close Test
- 1.1 Open the test file and enable the Macro
- 1.2 Open test file's Macro form Tools->Macro->Organize Macros->OpenOffice.org Basic->TestObjectModule; Select a module and then click edit button.
- 1.3 Close the Basic Editor
- 1.4 Close OpenOffice.org
- 1.5 Expect behavior:
-Basic Editor and OpenOffice.org are opened/closed normally.
- 2 insert/delete worksheet without Basic Editor
- 2.1 Open the test file
- 2.2 insert/delete a new worksheet
- 2.3 Close openoffice.org
- 2.4 Expect behavior:
-worksheet is inserted/deleted normally.
- 3 Insert/delete worksheet with Basic Editor opened test document's macro
- 3.1 Open the test file
- 3.2 Open Basic Editor with test document's macro
- 3.3 insert/delete worksheet
- 3.4 close Basic Editor
- 3.5 close openoffice.org
- 3.6 Expect behavior:
-insert/delete worksheet will insert/delete related basic module. And Basic Editor and openoffice.org should be closed normally.
- 4 Insert/delete worksheet with Basic Editor not opened test document's macro
- 4.1 Open the test file
- 4.2 Open Basic Editor with macro that is not the test document's.
- 4.3 insert/delete worksheet
- 4.4 close Basic Editor
- 4.5 close openoffice.org
- 4.6 Expected behavior:
-insert/delete worksheet will not effect the Basic Editor. And openoffice.org should be closed normally.
- 5 Insert/delete worksheet after Basic Editor open test document's macro and then close Basic Editor
- 5.1 Open the test file
- 5.2 Open Basic Editor with test file's macro
- 5.3 And then close Basic Editor.
- 5.4 Insert/delete worksheet
- 5.5 close openoffice.org
- 5.6 Expected behavior:
-insert/delete worksheet no error and openoffice.org is closed normally.
- 6 Insert/delete worksheet with Basic Editor opened test file's macro
- 6.1 Open the test file
- 6.2 Open another test file B
- 6.3 Open test document's macro with Basic Editor
- 6.4 inset/delete worksheet to test file
- 6.5 close Basic Editor and openoffice.org
- 6.6 Expected behavior:
-insert/delete worksheet will insert/delete related basic module. And Basic Editor and openoffice.org should be closed normally.
- 7 Insert/delete worksheet with Basic Editor opened another xls file's macro
- 7.1 Open the test file
- 7.2 Open another test file B
- 7.3 Open B's macro with Basic Editor
- 7.4 insert/delete worksheet to test file
- 7.5 close Basic Editor and openoffice.org
- 7.6 Expected behavior:
-insert/delete worksheet should not effect Basic Editor and Basic Editor and openoffice.org should be closed normally.
- 8 Insert/delete worksheet with Basic Editor opened test file's macro and close document first
- 8.1 Open the test file
- 8.2 Open test file's macro with Basic Editor
- 8.3 insert/delete worksheet
- 8.4 close document and then Basic Editor
- 8.5 Expected behavior:
-document and Basic Editor are closed normally.
- 9 Create a general module with test document'
- 9.1 Open the test file
- 9.2 Open test file's macro by Basic Editor
- 9.3 insert/delete a basic module
- 9.4 Close Basic Editor and openoffice.org
- 9.5 Expected behavior:
-insert/delete basic module correctly and close Basic Editor and openoffice.org in normal behavior.
-
diff --git a/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff b/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff
deleted file mode 100644
index f941efdd7..000000000
--- a/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff
+++ /dev/null
@@ -1,840 +0,0 @@
---- svx/source/msfilter/svxmsbas.cxx 2008-05-13 16:25:54.000000000 +0100
-+++ svx/source/msfilter/svxmsbas.cxx 2008-05-13 16:29:44.000000000 +0100
-@@ -404,13 +404,16 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- aSource = modeTypeComment + aSource;
-
- Any aSourceAny;
-- if ( !bAsComment && ( xVBAObjectProvider.is() && mType == ModuleType::Document ) )
-+ if ( !bAsComment && ( xVBAObjectProvider.is() && mType == ModuleType::Document ) || mType == ModuleType::Form )
- {
- script::ModuleInfo sModuleInfo;
- sModuleInfo.ModuleName = aModName;
- sModuleInfo.ModuleSource = aSource;
- sModuleInfo.ModuleType = mType;
-- sModuleInfo.ModuleObjectProvider.set( xVBAObjectProvider, UNO_QUERY );
-+ if ( mType == ModuleType::Form )
-+ sModuleInfo.ModuleObjectProvider.set( rDocSh.GetModel(), UNO_QUERY );
-+ else
-+ sModuleInfo.ModuleObjectProvider.set( xVBAObjectProvider, UNO_QUERY );
- aSourceAny <<= sModuleInfo;
- }
- else
---- basic/inc/basic/sbdef.hxx 2008-05-13 16:25:54.000000000 +0100
-+++ basic/inc/basic/sbdef.hxx 2008-05-13 16:31:44.000000000 +0100
-@@ -99,6 +99,8 @@ void setBasicWatchMode( bool bOn );
- #define SBX_HINT_BASICSTART SFX_HINT_USER04
- #define SBX_HINT_BASICSTOP SFX_HINT_USER05
-
-+#define SBXID_USERFORMMOD 0x6d64 // Special userform Module
-+
- // #115826
- enum PropertyMode
- {
---- basic/source/classes/sb.cxx 2008-05-13 16:25:54.000000000 +0100
-+++ basic/source/classes/sb.cxx 2008-05-13 16:37:22.000000000 +0100
-@@ -770,6 +770,9 @@ SbModule* StarBASIC::MakeObjModule( cons
- case ModuleType::Document:
- p = new SbObjModule( rName, mInfo );
- break;
-+ case ModuleType::Form:
-+ p = new SbUserFormModule( rName, mInfo );
-+ break;
- default:
- break; //
- }
-@@ -953,7 +956,8 @@ SbxVariable* StarBASIC::Find( const Stri
- }
- pNamed = p;
- }
-- if ( p->GetSbxId() == SBXID_DOCUMENTMOD )
-+ if ( p->GetSbxId() == SBXID_DOCUMENTMOD
-+ || p->GetSbxId() == SBXID_USERFORMMOD )
- continue;
- // Sonst testen, ob das Element vorhanden ist
- // GBLSEARCH-Flag rausnehmen (wg. Rekursion)
---- basic/source/classes/sbxmod.cxx 2008-05-13 16:25:54.000000000 +0100
-+++ basic/source/classes/sbxmod.cxx 2008-05-13 16:43:53.000000000 +0100
-@@ -96,6 +96,7 @@ SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-
-
- SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
-+TYPEINIT1(SbUserFormModule,SbObjModule)
-
- // ##########################################################################
- // ACHTUNG!!! Alle Woerter dieser Tabelle müssen KLEIN geschrieben werden!!!
-@@ -2226,3 +2227,199 @@ SbObjModule::InitObject()
- //OSL_TRACE("Object is not exist." );
- }
- }
-+
-+typedef ::cppu::WeakImplHelper1< awt::XTopWindowListener > EventListener_BASE;
-+
-+class FormObjEventListenerImpl : public EventListener_BASE
-+{
-+ SbUserFormModule* mpUserForm;
-+ uno::Reference< lang::XComponent > mxComponent;
-+ bool mbDisposed;
-+ FormObjEventListenerImpl(); // not defined
-+ FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
-+public:
-+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false )
-+ {
-+ if ( mxComponent.is() );
-+ {
-+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ //uno::Reference< awt::XWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ OSL_TRACE("*********** Registering the listener");
-+ xList->addTopWindowListener( this );
-+ }
-+ }
-+
-+ ~FormObjEventListenerImpl()
-+ {
-+ removeListener();
-+ }
-+ void removeListener()
-+ {
-+ try
-+ {
-+ if ( mxComponent.is() && !mbDisposed )
-+ {
-+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ OSL_TRACE("*********** Removing the listener");
-+ xList->removeTopWindowListener( this );
-+ mxComponent = NULL;
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
-+ virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ {
-+ if ( mpUserForm )
-+ mpUserForm->triggerActivateEvent();
-+ }
-+
-+ virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ {
-+ if ( mpUserForm )
-+ mpUserForm->triggerDeActivateEvent();
-+ }
-+
-+
-+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+ {
-+ OSL_TRACE("** Userform/Dialog disposing");
-+ mbDisposed = true;
-+ uno::Any aSource;
-+ aSource <<= Source;
-+ mxComponent = NULL;
-+ if ( mpUserForm )
-+ mpUserForm->ResetApiObj();
-+ }
-+};
-+
-+SbUserFormModule::SbUserFormModule( const rtl::OUString& rName, const com::sun::star::script::ModuleInfo& mInfo )
-+ :SbObjModule( rName, mInfo ), m_bUnloaded( true )
-+{
-+}
-+
-+void SbUserFormModule::ResetApiObj( bool bUnload )
-+{
-+ if ( m_xDialog.is() ) // probably someone close the dialog window
-+ {
-+ triggerTerminateEvent();
-+ }
-+ pDocObject = NULL;
-+ m_xDialog = NULL;
-+}
-+
-+void SbUserFormModule::triggerMethod( const String& aMethodToRun )
-+{
-+ OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Search method
-+ SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
-+ if( pMeth )
-+ {
-+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+ }
-+}
-+
-+void SbUserFormModule::triggerActivateEvent( void )
-+{
-+ OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
-+ triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_activate") ) );
-+ OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
-+}
-+
-+void SbUserFormModule::triggerDeActivateEvent( void )
-+{
-+ OSL_TRACE("**** SbUserFormModule::triggerDeActivate");
-+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_DeActivate") ) );
-+}
-+
-+void SbUserFormModule::triggerInitializeEvent( void )
-+
-+{
-+ OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
-+ static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
-+ triggerMethod( aInitMethodName );
-+
-+}
-+
-+void SbUserFormModule::triggerTerminateEvent( void )
-+{
-+ OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
-+ static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
-+ triggerMethod( aTermMethodName );
-+}
-+
-+void SbUserFormModule::load()
-+{
-+ OSL_TRACE("** load() ");
-+ GetObject(); // forces a load
-+}
-+void SbUserFormModule::Unload()
-+{
-+ OSL_TRACE("** Unload() ");
-+ if ( m_xDialog.is() )
-+ {
-+ triggerTerminateEvent();
-+ }
-+ // Search method
-+ SbxVariable* pMeth = SbObjModule::Find( String( RTL_CONSTASCII_USTRINGPARAM( "UnloadObject" ) ), SbxCLASS_METHOD );
-+ if( pMeth )
-+ {
-+ OSL_TRACE("Attempting too run the UnloadObjectMethod");
-+ m_xDialog = NULL; //release ref to the uno object
-+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+ }
-+}
-+
-+void SbUserFormModule::InitObject()
-+{
-+ try
-+ {
-+
-+ uno::Reference< frame::XModel > xModel( m_mInfo.ModuleObjectProvider, uno::UNO_QUERY_THROW );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= xModel;
-+ rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
-+ sDialogUrl = sDialogUrl.concat( sStandard ).concat( rtl::OUString( '.') ).concat( m_mInfo.ModuleName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
-+
-+ uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
-+ m_xDialog = xProvider->createDialog( sDialogUrl );
-+
-+ // create vba api object
-+ aArgs.realloc( 3 );
-+ aArgs[ 0 ] = uno::Any();
-+ aArgs[ 1 ] <<= m_xDialog;
-+ aArgs[ 2 ] <<= xModel;
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.UserForm")), aArgs ) ) );
-+ uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
-+ // remove old listener if it exists
-+ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
-+ if ( pFormListener )
-+ pFormListener->removeListener();
-+ m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
-+
-+ // trigger initialise event
-+ triggerInitializeEvent();
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+
-+}
-+
-+SbxVariable*
-+SbUserFormModule::Find( const XubString& rName, SbxClassType t )
-+{
-+ return SbObjModule::Find( rName, t );
-+}
-+
-+
---- basic/inc/basic/sbobjmod.hxx 2008-05-13 16:25:54.000000000 +0100
-+++ basic/inc/basic/sbobjmod.hxx 2008-05-13 16:46:58.000000000 +0100
-@@ -61,6 +61,31 @@ public:
- virtual BOOL IsClass( const String& );
- };
-
-+class SbUserFormModule : public SbObjModule
-+{
-+ css::uno::Reference<css::lang::XEventListener> m_DialogListener;
-+ css::uno::Reference<css::awt::XDialog> m_xDialog;
-+ String sFormName;
-+
-+ bool m_bUnloaded;
-+ static USHORT nHideHash;
-+protected:
-+ virtual void InitObject();
-+public:
-+ TYPEINFO();
-+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_USERFORMMOD,2);
-+ SbUserFormModule( const rtl::OUString& rName, const com::sun::star::script::ModuleInfo& mInfo );
-+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-+ void ResetApiObj( bool bUnloaded = true );
-+ void Unload();
-+ void load();
-+ void triggerMethod( const String& );
-+ void triggerActivateEvent();
-+ void triggerDeActivateEvent();
-+ void triggerInitializeEvent();
-+ void triggerTerminateEvent();
-+};
-+
- #ifndef __SB_SBOBJMODULEREF_HXX
- #define __SB_SBOBJMODULEREF_HXX
-
-diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/basic/source/runtime/methods.cxx 2008-03-29 23:08:19.000000000 +0000
-+++ basic/source/runtime/methods.cxx 2008-03-28 10:30:34.000000000 +0000
-@@ -152,6 +152,8 @@ using namespace com::sun::star::io;
- #include <io.h>
- #endif
-
-+#include <basic/sbobjmod.hxx>
-+
- static void FilterWhiteSpace( String& rStr )
- {
- rStr.EraseAllChars( ' ' );
-@@ -4386,7 +4386,12 @@ RTLFUNC(Load)
-
- // Diesen Call einfach an das Object weiterreichen
- SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
-- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
-+ if( pObj && pObj->IsA( TYPE( SbUserFormModule ) ) )
-+ {
-+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
-+ pFormModule->load();
-+ }
-+ else if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
- {
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD );
-@@ -4407,7 +4409,12 @@ RTLFUNC(Unload)
-
- // Diesen Call einfach an das Object weitereichen
- SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
-- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
-+ if( pObj && pObj->IsA( TYPE( SbUserFormModule ) ) )
-+ {
-+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
-+ pFormModule->Unload();
-+ }
-+ else if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
- {
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/svx/inc/svx/msocximex.hxx 2008-04-02 12:14:58.000000000 +0100
-+++ svx/inc/svx/msocximex.hxx 2008-04-01 15:22:20.000000000 +0100
-@@ -298,6 +298,7 @@ public:
- sal_Int32 mnForeColor;
- sal_uInt16 mnTabPos;
- UniString sName;
-+ UniString msToolTip;
- OCX_FontData aFontData;
- SfxObjectShell *pDocSh;
- protected:
-@@ -908,7 +908,7 @@ public:
- sal_uInt8 nKeepScrollBarsVisible;
- sal_uInt8 nCycle;
- sal_uInt16 nBorderStyle;
-- sal_uInt16 nSpecialEffect;
-+ sal_uInt8 nSpecialEffect;
- sal_uInt16 nPicture;
- sal_uInt8 nPictureAlignment;
- sal_uInt8 nPictureSizeMode;
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/svx/source/msfilter/msocximex.cxx 2008-04-02 15:01:33.000000000 +0100
-+++ svx/source/msfilter/msocximex.cxx 2008-04-02 14:49:08.000000000 +0100
-@@ -746,13 +746,16 @@ class ContainerRecReader
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
- *pS >> rec.nLeft >> rec.nTop;
- }
--
-+
- // control infotip
- sal_uInt32 nTipBufSize = lclGetBufferSize( nTipLen );
- if( nTipBufSize > 0 )
- {
-+ std::auto_ptr< sal_Char > pTipName;
-+ pTipName.reset( new sal_Char[ nTipBufSize ] );
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nTipBufSize );
-+ pS->Read( pTipName.get(), nTipBufSize );
-+ rec.controlTip = lclCreateOUString( pTipName.get(), nTipLen );
- }
- // control id
- sal_uInt32 nCntrlIdSize = lclGetBufferSize( nCntrlIdLen );
-@@ -1262,6 +1265,11 @@ sal_Bool OCX_Control::Import(uno::Refere
- xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
- aTmp <<= sal_Int32((nHeight * 2) / 100);
- xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ if ( msToolTip.Len() > 0 )
-+ {
-+ uno::Any aTmp(&msToolTip,getCppuType((OUString *)0));
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("HelpText"), aTmp);
-+ }
-
- if ( mnStep )
- {
-@@ -3664,6 +3666,7 @@ void OCX_ContainerControl::ProcessContro
- }
-
- pControl->sName = rec.cName;
-+ pControl->msToolTip = rec.controlTip;
- // Position of controls is relative to the container
- pControl->mnTop = rec.nTop + mnTop;
- pControl->mnLeft = rec.nLeft + mnLeft;
-@@ -3750,7 +3750,8 @@ OCX_MultiPage::OCX_MultiPage( SotStorage
- nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
- pPicture(0)
- {
-- msDialogType = C2U("NotSupported");
-+ //msDialogType = C2U("NotSupported");
-+ msDialogType = C2U("com.sun.star.awt.UnoMultiPageModel");
- mnForeColor = 0x80000012L,
- mnBackColor = 0x8000000FL;
- bSetInDialog = true;// UserForm control only
-@@ -3814,7 +3815,6 @@ sal_Bool OCX_MultiPage::Read(SvStorageSt
- sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
- {
-- // Calls import on contained controls
- OCX_ContainerControl::Import( rPropSet );
- return sal_True;
- }
-@@ -3835,6 +3835,43 @@ sal_Bool OCX_MultiPage::Import(com::sun:
-
- if ( xPropSet.is() )
- {
-+ uno::Reference<lang::XMultiServiceFactory>
-+ xFactory(rDialog, uno::UNO_QUERY);
-+ OSL_TRACE("** MultiPage creating control %s", rtl::OUStringToOString( msDialogType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference<uno::XInterface> xCreate = xFactory->createInstance(msDialogType);
-+ if (!xCreate.is())
-+ return sal_False;
-+
-+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY);
-+ if (!xModel.is())
-+ return sal_False;
-+
-+ try
-+ {
-+ // we should just call MultiPage::Import( XPropertySet )
-+ OSL_TRACE("********* MULTIPAGE cName %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
-+ uno::Reference<beans::XPropertySet> xPrps(xModel, uno::UNO_QUERY);
-+ xPrps->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
-+ aTmp = uno::makeAny( mnCurrentPageStep );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp );
-+ // default current page to 0 ( #FIXME, we need to read this value )
-+ aTmp = uno::makeAny( sal_Int32(0) );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValue"), aTmp );
-+ OSL_TRACE("********* MULTIPAGE vomitted out properties");
-+
-+ // Calls import on contained controls
-+ rDialog->insertByName(sName, uno::makeAny(xModel));
-+ OSL_TRACE("*** inserted ***");
-+ }
-+ catch( uno::Exception& )
-+ {
-+ DBG_ERRORFILE(
-+ ByteString( "OCX_Control::Import - cannot insert control \"" ).
-+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ).
-+ Append( '"' ).GetBuffer() );
-+ }
-+
- // Calls import on contained pages
- return OCX_ContainerControl::Import( xPropSet );
- }
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/source/controls/unocontrols.cxx 2008-01-24 15:30:00.000000000 +0000
-+++ toolkit/source/controls/unocontrols.cxx 2008-04-11 11:07:03.000000000 +0100
-@@ -1887,6 +1887,77 @@ sal_Bool UnoGroupBoxControl::isTranspare
- return sal_True;
- }
-
-+// MultiPage
-+
-+UnoMultiPageModel::UnoMultiPageModel()
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_LABEL );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
-+}
-+
-+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-+}
-+
-+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
-+ //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-+ return aAny;
-+ }
-+ return UnoControlModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+// ----------------------------------------------------
-+// class MultiPageControl
-+// ----------------------------------------------------
-+UnoMultiPageControl::UnoMultiPageControl()
-+{
-+ maComponentInfos.nWidth = 100;
-+ maComponentInfos.nHeight = 100;
-+}
-+
-+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "multipage" );
-+}
-+
-+sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
-+
-+
- // ----------------------------------------------------
- // class UnoControlListBoxModel
- // ----------------------------------------------------
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/inc/toolkit/controls/unocontrols.hxx 2008-01-24 15:27:45.000000000 +0000
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx 2008-04-11 07:03:51.000000000 +0100
-@@ -734,6 +734,44 @@ public:
-
- };
-
-+class UnoMultiPageModel : public UnoControlModel
-+{
-+protected:
-+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
-+public:
-+ UnoMultiPageModel();
-+ UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
-+
-+ UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
-+
-+ // ::com::sun::star::io::XPersistObject
-+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::beans::XMultiPropertySet
-+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
-+
-+};
-+// ----------------------------------------------------
-+// class UnoGroupBoxControl
-+// ----------------------------------------------------
-+class UnoMultiPageControl : public UnoControlBase
-+{
-+public:
-+ UnoMultiPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
-+
-+};
-+
- // ----------------------------------------------------
- // class UnoFixedTextControl
- // ----------------------------------------------------
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/inc/toolkit/helper/servicenames.hxx 2008-01-24 15:28:36.000000000 +0000
-+++ toolkit/inc/toolkit/helper/servicenames.hxx 2008-04-09 14:22:19.000000000 +0100
-@@ -50,6 +50,8 @@ extern const sal_Char __FAR_DATA szServi
- extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
- extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
- extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
- extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/source/helper/servicenames.cxx 2008-01-24 15:31:21.000000000 +0000
-+++ toolkit/source/helper/servicenames.cxx 2008-04-09 15:26:36.000000000 +0100
-@@ -51,6 +51,8 @@ const sal_Char __FAR_DATA szServiceName_
- const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
- const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
- const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
-+
-+
- const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
- const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
- const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
-@@ -103,6 +105,8 @@ const sal_Char __FAR_DATA szServiceName_
- const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
- const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
- const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
- const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/toolkit/source/helper/registerservices.cxx 2008-01-24 15:31:06.000000000 +0000
-+++ toolkit/source/helper/registerservices.cxx 2008-04-11 06:39:56.000000000 +0100
-@@ -230,6 +230,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeField
- IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
- IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
- IMPL_CREATEINSTANCE( UnoSpinButtonModel )
-+IMPL_CREATEINSTANCE( UnoMultiPageModel )
- IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
- IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
- IMPL_CREATEINSTANCE( UnoDateFieldControl )
-@@ -249,6 +250,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl
- IMPL_CREATEINSTANCE( UnoProgressBarControl )
- IMPL_CREATEINSTANCE( UnoScrollBarControl )
- IMPL_CREATEINSTANCE( UnoSpinButtonControl )
-+IMPL_CREATEINSTANCE( UnoMultiPageControl )
- IMPL_CREATEINSTANCE( UnoFixedLineControl )
- IMPL_CREATEINSTANCE( VCLXMenuBar )
- IMPL_CREATEINSTANCE( VCLXPointer )
-@@ -333,6 +335,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL comp
- registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
- registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
- registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
-+ registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
-+ registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
- registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
- registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
- registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
-@@ -416,6 +420,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL compone
- CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
-+ CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/xmlscript/source/xmldlg_imexp/exp_share.hxx 2008-01-24 15:37:13.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx 2008-04-10 23:00:27.000000000 +0100
-@@ -179,6 +179,8 @@ public:
- //
- void readDialogModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readMultiPageModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readEditModel( StyleBag * all_styles )
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-01-24 15:37:27.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-04-10 17:10:24.000000000 +0100
-@@ -1004,6 +1004,27 @@ public:
- };
-
- //==============================================================================
-+class MultiPage
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline MultiPage(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
- class ProgressBarElement
- : public ControlElement
- {
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2008-01-24 15:37:42.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2008-04-11 10:55:48.000000000 +0100
-@@ -73,6 +73,42 @@ static inline bool readFontProps( Elemen
- }
-
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
-+
-+ OUString aTitle;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
-+ {
-+ ElementDescriptor * title = new ElementDescriptor(
-+ _xProps, _xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
-+ aTitle );
-+ addSubElement( title );
-+ }
-+
-+ readEvents();
-+}
- void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2008-01-24 15:37:58.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2008-04-14 16:29:10.000000000 +0100
-@@ -1409,6 +1409,14 @@ void SAL_CALL exportDialogModel(
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readGroupBoxModel( &all_styles );
- }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readMultiPageModel( &all_styles );
-+ }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- {
- pElem = new ElementDescriptor(
---- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-01-24 15:38:13.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-04-11 10:53:21.000000000 +0100
-@@ -47,6 +47,69 @@ using ::rtl::OUString;
-
- namespace xmlscript
- {
-+Reference< xml::input::XElement > MultiPage::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
-+ {
-+ getStringAttr( &_label,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ xAttributes,
-+ _pImport->XMLNS_DIALOGS_UID );
-+
-+ return new ElementBase(
-+ _pImport->XMLNS_DIALOGS_UID,
-+ rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+
-+void MultiPage::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
-+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
-+ _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-
- // progessmeter
- //__________________________________________________________________________________________________
-@@ -2106,6 +2169,10 @@ Reference< xml::input::XElement > Bullet
- {
- return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
- }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
-+ {
-+ return new MultiPage( rLocalName, xAttributes, this, _pImport );
-+ }
- // bulletinboard
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
- {
diff --git a/patches/test/vba/dialog-vba-fake-events.diff b/patches/test/vba/dialog-vba-fake-events.diff
deleted file mode 100644
index ea902f8bd..000000000
--- a/patches/test/vba/dialog-vba-fake-events.diff
+++ /dev/null
@@ -1,366 +0,0 @@
---- /data4/CurrentBuild/ooo-build/build/src680-m237/basic/source/classes/eventatt.cxx 2007-10-15 14:03:12.000000000 +0100
-+++ basic/source/classes/eventatt.cxx 2007-12-11 12:09:29.000000000 +0000
-@@ -99,6 +99,8 @@
-
- #include <com/sun/star/frame/XModel.hpp>
-
-+#include <org/openoffice/vba/XVBAToOOEventDescGen.hpp>
-+
- //==================================================================================================
-
- #include <xmlscript/xmldlg_imexp.hxx>
-@@ -127,10 +129,10 @@ class DialogEventAttacher : public Scrip
- ::osl::Mutex maMutex;
-
- public:
-- DialogEventAttacher( void ) {}
-+ DialogEventAttacher( void );
-
- // Methods
-- virtual void SAL_CALL attachEvents( const ::com::sun::star::uno::Sequence<
-+ virtual void SAL_CALL attachEvents( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects,
- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener,
- const ::com::sun::star::uno::Any& Helper )
-@@ -139,6 +141,30 @@ public:
- ::com::sun::star::script::CannotCreateAdapterException,
- ::com::sun::star::lang::ServiceNotRegisteredException,
- ::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL attachVBAEvents( const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects,
-+ const ::com::sun::star::uno::Any& Helper,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::beans::IntrospectionException,
-+ ::com::sun::star::script::CannotCreateAdapterException,
-+ ::com::sun::star::lang::ServiceNotRegisteredException,
-+ ::com::sun::star::uno::RuntimeException);
-+private:
-+ virtual void attachEventsToControl( com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& xEventsSupplier,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener,
-+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > xControl,
-+ com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > xControlModel,
-+ const ::com::sun::star::uno::Any& Helper );
-+
-+ virtual void processControls( const ::com::sun::star::uno::Sequence<
-+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener,
-+ const ::com::sun::star::uno::Any& Helper
-+ , bool replaceBinding = false
-+ );
-+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx;
- };
-
-
-@@ -488,10 +514,12 @@ void SAL_CALL attachDialogEvents( StarBA
- //const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener )
- {
- static Reference< XScriptEventsAttacher > xEventsAttacher;
-+ static DialogEventAttacher* pEventsAttacher = NULL;
- Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
- {
- if( !xEventsAttacher.is() )
- xEventsAttacher = new DialogEventAttacher();
-+ pEventsAttacher = static_cast< DialogEventAttacher* >( xEventsAttacher.get() );
- }
-
- if( !xDialogControl.is() )
-@@ -518,8 +546,24 @@ void SAL_CALL attachDialogEvents( StarBA
- pObjects[ nControlCount ] = xDialogIface;
-
- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pBasic, xModel );
-+
- Any Helper;
- xEventsAttacher->attachEvents( aObjectSeq, xScriptListener, Helper );
-+
-+ if ( pEventsAttacher )
-+ {
-+ try
-+ {
-+ Reference< XPropertySet > xProps( xDialogControl->getModel(), UNO_QUERY_THROW );
-+ OUString sDialogName;
-+ xProps->getPropertyValue( rtl::OUString::createFromAscii("Name" ) ) >>= sDialogName;
-+ Helper <<= sDialogName;
-+ pEventsAttacher->attachVBAEvents( aObjectSeq, Helper, xModel );
-+ }
-+ catch( Exception& e )
-+ {
-+ }
-+ }
- }
-
-
-@@ -595,6 +639,13 @@ void DialogAllListener_Impl::firing_impl
- aScriptEvent.ScriptType = maScriptType;
- aScriptEvent.ScriptCode = maScriptCode;
-
-+ if ( maScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) )
-+ {
-+ rtl::OUString sDialogName;
-+ if ( aScriptEvent.Helper >>= sDialogName )
-+ aScriptEvent.ScriptCode = sDialogName;
-+ }
-+
- if( pRet )
- *pRet = mxScriptListener->approveFiring( aScriptEvent );
- else
-@@ -603,20 +654,7 @@ void DialogAllListener_Impl::firing_impl
-
-
- //===================================================================
--
--
--
--void SAL_CALL DialogEventAttacher::attachEvents
--(
-- const Sequence< Reference< XInterface > >& Objects,
-- const Reference< XScriptListener >& xListener,
-- const Any& Helper
--)
-- throw( IllegalArgumentException,
-- IntrospectionException,
-- CannotCreateAdapterException,
-- ServiceNotRegisteredException,
-- RuntimeException )
-+DialogEventAttacher::DialogEventAttacher()
- {
- // Get EventAttacher and Introspection (Introspection???)
- {
-@@ -637,11 +675,45 @@ void SAL_CALL DialogEventAttacher::attac
- if( !mxEventAttacher.is() )
- throw ServiceNotRegisteredException();
- }
-+ Reference < XPropertySet > xProps(
-+ ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-+
-+ if( xProps.is() )
-+ {
-+ m_xCtx.set( xProps->getPropertyValue(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+ UNO_QUERY );
-+ }
-+ }
-+}
-+void
-+DialogEventAttacher::processControls( const Sequence<
-+ Reference< XInterface > >& Objects,
-+ const Reference<XScriptListener >& xListener,
-+ const Any& Helper
-+ , bool replaceBindings
-+)
-+{
-+ static Reference< org::openoffice::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc;
-+ if ( m_xCtx.is() )
-+ {
-+ Reference< XMultiComponentFactory > xMFac(
-+ m_xCtx->getServiceManager(), UNO_QUERY );
-+ if ( xMFac.is() )
-+ {
-+ if ( !xVBAToOOEvtDesc.is() )
-+ xVBAToOOEvtDesc.set(
-+ xMFac->createInstanceWithContext(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "org.openoffice.vba.VBAToOOEventDesc" ) ),
-+ m_xCtx ), UNO_QUERY );
-+ }
- }
-
- // Go over all objects
- const Reference< XInterface >* pObjects = Objects.getConstArray();
- sal_Int32 i, nObjCount = Objects.getLength();
-+
- for( i = 0 ; i < nObjCount ; i++ )
- {
- // We know that we have to do with instances of XControl
-@@ -654,68 +726,141 @@ void SAL_CALL DialogEventAttacher::attac
- // Get XEventsSupplier from ControlModel
- Reference< XControlModel > xControlModel = xControl->getModel();
- Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
-- if( xEventsSupplier.is() )
-- {
-- Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
-- Sequence< OUString > aNames = xEventCont->getElementNames();
-- const OUString* pNames = aNames.getConstArray();
-- sal_Int32 j, nNameCount = aNames.getLength();
-+ if ( replaceBindings && xVBAToOOEvtDesc.is() )
-+ // Or get XEventSupplier for VBAEvents
-+ xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl ),
-+ UNO_QUERY );
-+ else
-+ xEventsSupplier.set( xControlModel, UNO_QUERY );
-+
-+ attachEventsToControl( xEventsSupplier, xListener, xControl, xControlModel,Helper );
-+ }
-
-- for( j = 0 ; j < nNameCount ; j++ )
-- {
-- ScriptEventDescriptor aDesc;
-+}
-
-- Any aElement = xEventCont->getByName( pNames[ j ] );
-- aElement >>= aDesc;
-- Reference< XAllListener > xAllListener =
-- new DialogAllListener_Impl( xListener, aDesc.ScriptType, aDesc.ScriptCode );
--
-- // Try first to attach event to the ControlModel
-- sal_Bool bSuccess = sal_False;
-- try
-- {
-- Reference< XEventListener > xListener_ = mxEventAttacher->
-- attachSingleEventListener( xControlModel, xAllListener, Helper,
-- aDesc.ListenerType, aDesc.AddListenerParam, aDesc.EventMethod );
-+void
-+DialogEventAttacher::attachVBAEvents(
-+ const Sequence< Reference< XInterface > >& Objects,
-+ const Any& Helper,
-+ const Reference< frame::XModel >& xModel
-+)
-+ throw( IllegalArgumentException,
-+ IntrospectionException,
-+ CannotCreateAdapterException,
-+ ServiceNotRegisteredException,
-+ RuntimeException )
-+{
-+
-+ Reference< XScriptListener > xVbaScriptListener;
-+ // #TODO ?? maybe better to create this object directly and not
-+ // use UNO ( can pass the StarBasic* ptr in this case )
-+ // to do that need to create .hxx file for
-+ // basic/source/vbaevents/eventhelper.cxx ( inc file needs to be
-+ // in basic source/inc
-+ if ( m_xCtx.is() )
-+ {
-+ Reference< XMultiComponentFactory > xMFac(
-+ m_xCtx->getServiceManager(), UNO_QUERY );
-+ if ( xMFac.is() )
-+ {
-+ Sequence< Any > args(1);
-+ args[0] <<= xModel;
-+ xVbaScriptListener.set(
-+ xMFac->createInstanceWithArgumentsAndContext(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "org.openoffice.vba.EventListener" ) ), args,
-+ m_xCtx ), UNO_QUERY );
-+ }
-+ if ( xVbaScriptListener.is() )
-+ {
-+ processControls( Objects, xVbaScriptListener, Helper, true );
-+ }
-+ }
-+}
-
-- if( xListener_.is() )
-- bSuccess = sal_True;
-- }
-- catch( IllegalArgumentException& )
-- {}
-- catch( IntrospectionException& )
-- {}
-- catch( CannotCreateAdapterException& )
-- {}
-- catch( ServiceNotRegisteredException& )
-- {}
-- //{
-- //throw IntrospectionException();
-- //}
-+void
-+DialogEventAttacher::attachEventsToControl( Reference< XScriptEventsSupplier >& xEventsSupplier,
-+ const Reference< XScriptListener >& xScriptListener,
-+ Reference< XControl > xControl,
-+ Reference< XControlModel > xControlModel,
-+ const Any& Helper )
-+{
-+ if( xEventsSupplier.is() )
-+ {
-+ Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
-+ Sequence< OUString > aNames = xEventCont->getElementNames();
-+ const OUString* pNames = aNames.getConstArray();
-+ sal_Int32 j, nNameCount = aNames.getLength();
-+ for( j = 0 ; j < nNameCount ; j++ )
-+ {
-+ ScriptEventDescriptor aDesc;
-
-- try
-- {
-- // If we had no success, try to attach to the Control
-- if( !bSuccess )
-- {
-+ Any aElement = xEventCont->getByName( pNames[ j ] );
-+ aElement >>= aDesc;
-+ Reference< XAllListener > xAllListener =
-+ new DialogAllListener_Impl( xScriptListener, aDesc.ScriptType, aDesc.ScriptCode );
-+
-+ OSL_TRACE("Event [%d] name %s ", j, rtl::OUStringToOString( pNames[ j ], RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE(" ScriptType %s\n ScriptCode %s\n ListenerType %s\n EventMethod %s", rtl::OUStringToOString( aDesc.ScriptType , RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aDesc.ScriptCode, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aDesc.ListenerType, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aDesc.EventMethod, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Try first to attach event to the ControlModel
-+ sal_Bool bSuccess = sal_False;
-+ try
-+ {
-+ Reference< XEventListener > xListener = mxEventAttacher->
-+ attachSingleEventListener( xControlModel, xAllListener, Helper,
-+ aDesc.ListenerType, aDesc.AddListenerParam, aDesc.EventMethod );
-+ if( xListener.is() )
-+ bSuccess = sal_True;
-+ }
-+ catch( IllegalArgumentException& )
-+ {}
-+ catch( IntrospectionException& )
-+ {}
-+ catch( CannotCreateAdapterException& )
-+ {}
-+ catch( ServiceNotRegisteredException& )
-+ {}
-+ //{
-+ //throw IntrospectionException();
-+ //}
-+
-+ try
-+ {
-+ // If we had no success, try to attach to the Control
-+ if( !bSuccess )
-+ {
- Reference< XEventListener > xListener_; // Do we need that?!?
- xListener_ = mxEventAttacher->attachSingleEventListener
- ( xControl, xAllListener, Helper, aDesc.ListenerType,
- aDesc.AddListenerParam, aDesc.EventMethod );
- }
-- }
-- catch( IllegalArgumentException& )
-- {}
-- catch( IntrospectionException& )
-- {}
-- catch( CannotCreateAdapterException& )
-- {}
-- catch( ServiceNotRegisteredException& )
-- {}
- }
-+ catch( IllegalArgumentException& )
-+ {}
-+ catch( IntrospectionException& )
-+ {}
-+ catch( CannotCreateAdapterException& )
-+ {}
-+ catch( ServiceNotRegisteredException& )
-+ {}
- }
- }
-+}
-+
-
-+void SAL_CALL DialogEventAttacher::attachEvents
-+(
-+ const Sequence< Reference< XInterface > >& Objects,
-+ const Reference< XScriptListener >& xListener,
-+ const Any& Helper
-+)
-+ throw( IllegalArgumentException,
-+ IntrospectionException,
-+ CannotCreateAdapterException,
-+ ServiceNotRegisteredException,
-+ RuntimeException )
-+{
-+ processControls( Objects, xListener, Helper );
- }
-
- Reference< XStringResourceManager > getStringResourceFromDialogLibrary( const Any& aDlgLibAny )
diff --git a/patches/test/vba/formradiobuttongroup.diff b/patches/test/vba/formradiobuttongroup.diff
deleted file mode 100644
index d75ca06e3..000000000
--- a/patches/test/vba/formradiobuttongroup.diff
+++ /dev/null
@@ -1,327 +0,0 @@
-Index: sc/source/filter/excel/xiescher.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/excel/xiescher.cxx,v
-retrieving revision 1.54
-diff -u -p -r1.54 xiescher.cxx
---- sc/source/filter/excel/xiescher.cxx 6 Jul 2007 12:37:20 -0000 1.54
-+++ sc/source/filter/excel/xiescher.cxx 20 Feb 2008 17:21:49 -0000
-@@ -221,6 +221,7 @@
- #include "xicontent.hxx"
- #endif
-
-+#include "xlescher.hxx"
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
- using ::com::sun::star::uno::Reference;
-@@ -424,7 +425,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- {
- }
-
--XclImpDrawObjRef XclImpDrawObjBase::ReadObjCmo( XclImpStream& rStrm )
-+XclImpDrawObjRef XclImpDrawObjBase::ReadObjCmo( XclImpObjectManager& rObjMgr, XclImpStream& rStrm )
- {
- XclImpDrawObjRef xDrawObj;
-
-@@ -457,7 +458,7 @@ XclImpDrawObjRef XclImpDrawObjBase::Read
- case EXC_OBJ_CMO_COMBOBOX:
- case EXC_OBJ_CMO_SPIN:
- case EXC_OBJ_CMO_SCROLLBAR:
-- xDrawObj.reset( new XclImpTbxControlObj( rStrm.GetRoot() ) );
-+ xDrawObj.reset( new XclImpTbxControlObj( rObjMgr, rStrm.GetRoot() ) );
- break;
- case EXC_OBJ_CMO_PICTURE:
- xDrawObj.reset( new XclImpOleObj( rStrm.GetRoot() ) );
-@@ -739,23 +740,31 @@ ScfPropertySet XclImpControlObjHelper::G
- return ScfPropertySet( mxCtrlModel );
- }
-
--void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& /* rSdrObj */ ) const
-+// get service factory from Calc document
-+Reference< XMultiServiceFactory > lclGetFactoryFromRoot( const XclImpRoot& rRoot )
- {
- // get service factory from Calc document
- Reference< XMultiServiceFactory > xFactory;
- if( SfxObjectShell* pDocShell = rRoot.GetDocShell() )
- xFactory.set( pDocShell->GetModel(), UNO_QUERY );
-+ return xFactory;
-+}
-+
-+void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScAddress >& rxCellLink ) const
-+{
-+ Reference< XMultiServiceFactory > xFactory = lclGetFactoryFromRoot( rRoot );
-+
- if( !mxCtrlModel.is() || !xFactory.is() )
- return;
-
- // *** cell link *** ------------------------------------------------------
-
- Reference< XBindableValue > xBindable( mxCtrlModel, UNO_QUERY );
-- if( mxCellLink.is() && xBindable.is() )
-+ if( rxCellLink.is() && xBindable.is() )
- {
- // create argument sequence for createInstanceWithArguments()
- CellAddress aApiAddress;
-- ScUnoConversion::FillApiAddress( aApiAddress, *mxCellLink );
-+ ScUnoConversion::FillApiAddress( aApiAddress, *rxCellLink );
-
- NamedValue aValue;
- aValue.Name = CREATE_OUSTRING( SC_UNONAME_BOUNDCELL );
-@@ -792,14 +801,24 @@ void XclImpControlObjHelper::ConvertShee
- xBindable->setValueBinding( xBinding );
- }
-
-+
-+}
-+
-+void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScRange >& rxSrcRange ) const
-+{
-+ Reference< XMultiServiceFactory > xFactory = lclGetFactoryFromRoot( rRoot );
-+
-+ if( !mxCtrlModel.is() || !xFactory.is() )
-+ return;
-+
- // *** source range *** ---------------------------------------------------
-
- Reference< XListEntrySink > xEntrySink( mxCtrlModel, UNO_QUERY );
-- if( mxSrcRange.is() && xEntrySink.is() )
-+ if( rxSrcRange.is() && xEntrySink.is() )
- {
- // create argument sequence for createInstanceWithArguments()
- CellRangeAddress aApiRange;
-- ScUnoConversion::FillApiRange( aApiRange, *mxSrcRange );
-+ ScUnoConversion::FillApiRange( aApiRange, *rxSrcRange );
-
- NamedValue aValue;
- aValue.Name = CREATE_OUSTRING( SC_UNONAME_CELLRANGE );
-@@ -824,13 +843,27 @@ void XclImpControlObjHelper::ConvertShee
- if( xEntrySource.is() )
- xEntrySink->setListEntrySource( xEntrySource );
- }
-+
-+}
-+
-+void XclImpControlObjHelper::ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& /* rSdrObj */ ) const
-+{
-+ // *** cell link *** ------------------------------------------------------
-+
-+ ConvertSheetLinks( rRoot, mxCellLink );
-+
-+ // *** source range *** ---------------------------------------------------
-+
-+ ConvertSheetLinks( rRoot, mxSrcRange );
- }
-
- // ----------------------------------------------------------------------------
-
--XclImpTbxControlObj::XclImpTbxControlObj( const XclImpRoot& rRoot ) :
-+XclImpTbxControlObj::XclImpTbxControlObj( XclImpObjectManager& rObjMgr, const XclImpRoot& rRoot ) :
- XclImpDrawingObj( rRoot, true ),
- XclImpControlObjHelper( EXC_CTRL_BINDPOSITION ),
-+ mrObjManager( rObjMgr ),
-+ mbGroupLeader( false ),
- mnState( EXC_OBJ_CBLS_STATE_UNCHECK ),
- mnSelEntry( 0 ),
- mnSelType( EXC_OBJ_LBS_SEL_SIMPLE ),
-@@ -866,6 +899,9 @@ void XclImpTbxControlObj::ReadSubRecord(
- case EXC_ID_OBJ_FTGBODATA:
- ReadGboData( rStrm );
- break;
-+ case EXC_ID_OBJ_FTRBODATA:
-+ ReadRboData( rStrm );
-+ break;
- default:
- XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
- }
-@@ -904,7 +940,6 @@ void XclImpTbxControlObj::DoProcessSdrOb
-
- namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
- namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
-- using ::com::sun::star::style::VerticalAlignment_MIDDLE;
-
- // control name, printable, sheet links -----------------------------------
-
-@@ -944,24 +979,29 @@ void XclImpTbxControlObj::DoProcessSdrOb
- case EXC_OBJ_CMO_CHECKBOX:
- case EXC_OBJ_CMO_OPTIONBUTTON:
- {
-- bool bCheckBox = GetObjType() == EXC_OBJ_CMO_CHECKBOX;
--
-- sal_Int16 nApiState = 0;
-- switch( mnState )
-+ if( GetObjType() == EXC_OBJ_CMO_CHECKBOX )
-+ SetCBRBCommonProps();
-+ else
- {
-- case EXC_OBJ_CBLS_STATE_UNCHECK: nApiState = 0; break;
-- case EXC_OBJ_CBLS_STATE_CHECK: nApiState = 1; break;
-- case EXC_OBJ_CBLS_STATE_TRI: nApiState = bCheckBox ? 2 : 1; break;
-+ XclImpTbxControlObj* pTbxObj = dynamic_cast< XclImpTbxControlObj* >( mrObjManager.FindDrawObj( mNextRBInGroupId ).get() );
-+ if ( ( pTbxObj && pTbxObj->mbGroupLeader ) )
-+ {
-+ // Group has terminated
-+ // traverse each RadioButton in group and
-+ // a) apply the groupname
-+ // b) propagate the linked cell from the lead radiobutton
-+ // c) apply the correct Ref value
-+ XclImpTbxControlObj* pLeader = pTbxObj;
-+ XclObjId rLeaderId = pLeader->GetObjId();
-+ sal_Int32 nRefVal = 1;
-+ do
-+ {
-+ pTbxObj->ApplyGroupingBits( *pLeader, nRefVal++ );
-+ pTbxObj = dynamic_cast< XclImpTbxControlObj* >( mrObjManager.FindDrawObj( pTbxObj->mNextRBInGroupId ).get() );
-+ } while ( pTbxObj && !pTbxObj->mbGroupLeader );
-+ }
-+
- }
-- if( bCheckBox )
-- aPropSet.SetBoolProperty( CREATE_OUSTRING( "TriState" ), nApiState == 2 );
-- aPropSet.SetProperty( CREATE_OUSTRING( "DefaultState" ), nApiState );
--
-- sal_Int16 nApiBorder = mbFlatButton ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
-- aPropSet.SetProperty( CREATE_OUSTRING( "VisualEffect" ), nApiBorder );
--
-- // #i40279# always centered vertically
-- aPropSet.SetProperty( CREATE_OUSTRING( "VerticalAlign" ), VerticalAlignment_MIDDLE );
- }
- break;
-
-@@ -1111,6 +1151,45 @@ void XclImpTbxControlObj::ReadLbsData( X
- }
- }
-
-+void XclImpTbxControlObj::ApplyGroupingBits( XclImpTbxControlObj& rLeadRB, sal_Int32 nRefVal )
-+{
-+ ScfPropertySet aProps = GetControlPropSet();
-+ // shape Id is formed from object id + sheet id
-+ rtl::OUString sGroupName = rtl::OUString::valueOf( static_cast< sal_Int32 >( rLeadRB.GetShapeId() ) );
-+ aProps.SetStringProperty( CREATE_OUSTRING( "GroupName" ), sGroupName );
-+ aProps.SetStringProperty( CREATE_OUSTRING( "RefValue" ), rtl::OUString::valueOf( nRefVal ) );
-+ // propagate cell link info
-+ if ( rLeadRB.HasCellLink() && !HasCellLink() )
-+ {
-+ ScfRef< ScAddress > xAddress( new ScAddress( *rLeadRB.GetCellLink() ) );
-+ ConvertSheetLinks( GetRoot(), xAddress );
-+ }
-+ SetCBRBCommonProps();
-+}
-+
-+void XclImpTbxControlObj::SetCBRBCommonProps() const
-+{
-+ sal_Int16 nApiState = 0;
-+ bool bCheckBox = ( GetObjType() == EXC_OBJ_CMO_CHECKBOX );
-+ switch( mnState )
-+ {
-+ case EXC_OBJ_CBLS_STATE_UNCHECK: nApiState = 0; break;
-+ case EXC_OBJ_CBLS_STATE_CHECK: nApiState = 1; break;
-+ case EXC_OBJ_CBLS_STATE_TRI: nApiState = bCheckBox ? 2 : 1; break;
-+ }
-+ ScfPropertySet aPropSet = GetControlPropSet();
-+ if ( bCheckBox )
-+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "TriState" ), nApiState == 2 );
-+ namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
-+ using ::com::sun::star::style::VerticalAlignment_MIDDLE;
-+
-+ aPropSet.SetProperty( CREATE_OUSTRING( "DefaultState" ), nApiState );
-+ sal_Int16 nApiBorder = mbFlatButton ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
-+ aPropSet.SetProperty( CREATE_OUSTRING( "VisualEffect" ), nApiBorder );
-+ // #i40279# always centered vertically
-+ aPropSet.SetProperty( CREATE_OUSTRING( "VerticalAlign" ), VerticalAlignment_MIDDLE );
-+}
-+
- void XclImpTbxControlObj::ReadSbs( XclImpStream& rStrm )
- {
- sal_uInt16 nOrient, nStyle;
-@@ -1131,6 +1210,17 @@ void XclImpTbxControlObj::ReadGboData( X
- mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
- }
-
-+void XclImpTbxControlObj::ReadRboData( XclImpStream& rStrm )
-+{
-+ sal_Int16 mnNextRBInGroup;
-+ rStrm >> mnNextRBInGroup;
-+ sal_uInt8 nGroupLeader;
-+ rStrm >> nGroupLeader;
-+ sal_uInt8 unknown;
-+ rStrm >> unknown;
-+ mbGroupLeader = ( nGroupLeader & 0x1 );
-+ mNextRBInGroupId = XclObjId( GetScTab(), mnNextRBInGroup );
-+}
- // ----------------------------------------------------------------------------
-
- XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
-@@ -2224,7 +2314,7 @@ void XclImpObjectManager::ReadObj8( XclI
- break;
- case EXC_ID_OBJ_FTCMO:
- DBG_ASSERT( !xDrawObj, "XclImpObjectManager::ReadObj8 - multiple FTCMO subrecords" );
-- xDrawObj = XclImpDrawObjBase::ReadObjCmo( rStrm );
-+ xDrawObj = XclImpDrawObjBase::ReadObjCmo( *this, rStrm );
- bLoop = xDrawObj.is();
- break;
- default:
-Index: sc/source/filter/inc/xiescher.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/inc/xiescher.hxx,v
-retrieving revision 1.27
-diff -u -p -r1.27 xiescher.hxx
---- sc/source/filter/inc/xiescher.hxx 6 Jul 2007 12:38:40 -0000 1.27
-+++ sc/source/filter/inc/xiescher.hxx 20 Feb 2008 17:21:50 -0000
-@@ -99,7 +99,7 @@ public:
- virtual ~XclImpDrawObjBase();
-
- /** Reads the FTCMO subrecord (common object data) in an OBJ record, returns a new object. */
-- static XclImpDrawObjRef ReadObjCmo( XclImpStream& rStrm );
-+ static XclImpDrawObjRef ReadObjCmo( XclImpObjectManager& rObjMrg, XclImpStream& rStrm );
- /** Reads the contents of the specified subrecord of an OBJ record from stream. */
- virtual void ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
- /** Reads the client anchor from an msofbtClientAnchor Escher record. */
-@@ -254,6 +254,9 @@ protected:
- ScfPropertySet GetControlPropSet() const;
- /** Tries to set a spreadsheet cell link and source range link at the passed form control. */
- void ConvertSheetLinks( const XclImpRoot& rRoot, SdrObject& rSdrObj ) const;
-+ void ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScAddress >& rxCellLink ) const;
-+ void ConvertSheetLinks( const XclImpRoot& rRoot, const ScfRef< ScRange >& rxSrcRange ) const;
-+ ScAddress* GetCellLink(){ return mxCellLink.get(); }
-
- private:
- XControlModelRef mxCtrlModel; /// Model of the created form control object.
-@@ -268,7 +271,7 @@ private:
- class XclImpTbxControlObj : public XclImpDrawingObj, public XclImpControlObjHelper
- {
- public:
-- explicit XclImpTbxControlObj( const XclImpRoot& rRoot );
-+ explicit XclImpTbxControlObj( XclImpObjectManager& rObjMgr, const XclImpRoot& rRoot );
-
- /** Reads the contents of the specified subrecord of an OBJ record from stream. */
- virtual void ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
-@@ -295,8 +298,15 @@ private:
- void ReadSbs( XclImpStream& rStrm );
- /** Reads the contents of the ftGboData sub structure in an OBJ record. */
- void ReadGboData( XclImpStream& rStrm );
-+ /** Reads the contents of the ftRboData sub structure in an OBJ record. */
-+ void ReadRboData( XclImpStream& rStrm );
-
- private:
-+ void SetCBRBCommonProps() const;
-+ void ApplyGroupingBits( XclImpTbxControlObj& rTbxObj, sal_Int32 nRefVal );
-+ XclImpObjectManager& mrObjManager;
-+ bool mbGroupLeader; /// Identifies start of group
-+ XclObjId mNextRBInGroupId; ///
- ScfInt16Vec maMultiSel; /// Indexes of all selected entries in a multi selection.
- sal_uInt16 mnState; /// Checked/unchecked state.
- sal_Int16 mnSelEntry; /// Index of selected entry (1-based).
-Index: sc/source/filter/inc/xlescher.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/filter/inc/xlescher.hxx,v
-retrieving revision 1.21
-diff -u -p -r1.21 xlescher.hxx
---- sc/source/filter/inc/xlescher.hxx 22 Jan 2007 13:22:23 -0000 1.21
-+++ sc/source/filter/inc/xlescher.hxx 20 Feb 2008 17:21:50 -0000
-@@ -75,6 +75,7 @@ const sal_uInt16 EXC_ID_OBJ_FTCBLS
- const sal_uInt16 EXC_ID_OBJ_FTSBS = 0x000C; /// Scroll bar data.
- const sal_uInt16 EXC_ID_OBJ_FTSBSFMLA = 0x000E; /// Scroll bar/list box/combo box cell link.
- const sal_uInt16 EXC_ID_OBJ_FTGBODATA = 0x000F; /// Group box data.
-+const sal_uInt16 EXC_ID_OBJ_FTRBODATA = 0x0011; /// Radiobutton data.
- const sal_uInt16 EXC_ID_OBJ_FTLBSDATA = 0x0013; /// List box/combo box data.
- const sal_uInt16 EXC_ID_OBJ_FTCBLSFMLA = 0x0014; /// Check box/radio button cell link.
- const sal_uInt16 EXC_ID_OBJ_FTCMO = 0x0015; /// Common object settings.
diff --git a/patches/test/vba/native-format-things-todo.txt b/patches/test/vba/native-format-things-todo.txt
deleted file mode 100644
index a3b0064c1..000000000
--- a/patches/test/vba/native-format-things-todo.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-current patch r14298 ( vbainfo-import-export-support.diff )
-
-general status
-===============
-
-* currently changing the vba mode ( either removing it or explicitly setting it to 0 in the module source ) doesn't affect the vbamode of the library.
-* changing the vba mode wont trigger a change in the existing library ( e.g. what should happen to the autogenerated modules?, should they be deleted or just converted to normal modules )
- * what happens if someone switches the vba mode back again ( if we keep the modules there will be name clashes )
-
-note: some experimental ( but not enabled code ) in namecont.cxx ( NameContainer::convertContainer ) ( note: this code should be moved to the ScriptLibrary class )
-* switching the vba mode in the library currently just changes a local state variable, attempting to the change the library mode triggers an infinite loop ( but that should be easy to fix )
-
-* should there be a document wide switch that controls the library mode? ( or just a ui thingy that triggers the library mode )
-
-* the vba mode "library:vbaenabled="true"" is still stored in the xml in Basic/script-lc.xml, we should be storeing this in the library specific xml file e.g. Basic/Standard/script-lb.xml
- changes needed
- o xmlscript/inc/xmlscript/xmllib_imexp.hxx ( add vbamode to LibDescriptor )
- o xmlscript/source/xmllib_imexp/xmllib_import.cxx ( modify LibraryImport::startRootElement to read vbamode )
- * xmlscript/source/xmllib_imexp/xmllib_export.cxx ( need to export vba attribute here )
-
-* the ModuleInfo contains a Source member in the struct, but.. with the current design having the Source member is an unnecessary duplication ( and will probably cause problems )
- * looks like we need to
- o change ModuleInfo to remove the ModuleSource member
- o SfxScriptLibrary::insertByName( basic/source/uno/scriptcont.cxx )
- o SvxImportMSVBasic::ImportCode_Impl ( svx/source/msfilter/svxmsbas.cxx )
- o lcl_InitModuleInfo, lcl_InsertModule ( sc/source/ui/docshell/docfunc.cxx )
- o ScDocShell::MoveTable sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx )
-
-
- o create a new struct ModuleSourceInfo : ModuleInfo ( which will contain the source ) this will only be used when creating a new module ( hence allowing the source and module info to be created in one step )
-
- support for vba Attributes ( future )
- ==========================
- * we could modify the ModuleInfo structure to include a NameContainer ( or PropertySet ) this would;
- o encapsulate the vba attributes ( this would keep them nicely seperated from the source )
- o allow us to develope a similar concept in vba mode ( if necessary )
- o provide a container to contain this info for round tripping
-
-
- * a little ripple effect here
-
diff --git a/patches/test/vba/vba-intersection-union.diff b/patches/test/vba/vba-intersection-union.diff
deleted file mode 100644
index c2fa785a6..000000000
--- a/patches/test/vba/vba-intersection-union.diff
+++ /dev/null
@@ -1,436 +0,0 @@
-diff --git sc/source/ui/unoobj/.funcuno.cxx.swp sc/source/ui/unoobj/.funcuno.cxx.swp
-deleted file mode 100644
-index 481401c..0000000
-Files sc/source/ui/unoobj/.funcuno.cxx.swp and /dev/null differ
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index b451440..1c7960a 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -868,177 +868,263 @@ ScVbaApplication::PathSeparator( ) thro
- return sPathSep;
- }
-
-+typedef std::list< ScRange > Ranges;
-+typedef std::list< ScRangeList > RangesList;
-+
-+void lcl_addRangesToVec( RangesList& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException )
-+{
-+ ScRangeList theRanges;
-+ uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW );
-+ uno::Reference< vba::XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xCol->getCount();
-+ for( sal_Int32 i = 1; i <= nCount; ++i )
-+ {
-+ uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW );
-+ table::CellRangeAddress addr = xAddressable->getRangeAddress();
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, addr );
-+ theRanges.Append( refRange );
-+ }
-+ vRanges.push_back( theRanges );
-+}
-+void lcl_addRangeToVec( Ranges& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException )
-+{
-+ uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW );
-+ uno::Reference< vba::XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xCol->getCount();
-+ for( sal_Int32 i = 1; i <= nCount; ++i )
-+ {
-+ uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW );
-+ table::CellRangeAddress addr = xAddressable->getRangeAddress();
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, addr );
-+ vRanges.push_back( refRange );
-+ }
-+}
-+void lcl_strip_containedRanges( Ranges& vRanges )
-+{
-+ // get rid of ranges that are surrounded by other ranges
-+ for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it )
-+ {
-+ for( Ranges::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner )
-+ {
-+ if ( it != it_inner )
-+ {
-+ if ( it->In( *it_inner ) )
-+ it_inner = vRanges.erase( it_inner );
-+ else if ( it_inner->In( *it ) )
-+ it = vRanges.erase( it );
-+ }
-+ }
-+ }
-+
-+}
- uno::Reference< excel::XRange > SAL_CALL
- ScVbaApplication::Intersect( const uno::Reference< excel::XRange >& Arg1, const uno::Reference< excel::XRange >& Arg2, const uno::Any& Arg3, const uno::Any& Arg4, const uno::Any& Arg5, const uno::Any& Arg6, const uno::Any& Arg7, const uno::Any& Arg8, const uno::Any& Arg9, const uno::Any& Arg10, const uno::Any& Arg11, const uno::Any& Arg12, const uno::Any& Arg13, const uno::Any& Arg14, const uno::Any& Arg15, const uno::Any& Arg16, const uno::Any& Arg17, const uno::Any& Arg18, const uno::Any& Arg19, const uno::Any& Arg20, const uno::Any& Arg21, const uno::Any& Arg22, const uno::Any& Arg23, const uno::Any& Arg24, const uno::Any& Arg25, const uno::Any& Arg26, const uno::Any& Arg27, const uno::Any& Arg28, const uno::Any& Arg29, const uno::Any& Arg30 ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- std::vector< uno::Reference< excel::XRange > > vRanges;
- if ( !Arg1.is() || !Arg2.is() )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
-
-- vRanges.push_back( Arg1 );
-- vRanges.push_back( Arg2 );
-+ RangesList vRanges;
-+ lcl_addRangesToVec( vRanges, uno::makeAny( Arg1 ) );
-+ lcl_addRangesToVec( vRanges, uno::makeAny( Arg2 ) );
-
- if ( Arg3.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg3, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg3 );
- if ( Arg4.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg4, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg4 );
- if ( Arg5.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg5, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg5 );
- if ( Arg6.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg6, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg6 );
- if ( Arg7.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg7, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg7 );
- if ( Arg8.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg8, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg8 );
- if ( Arg9.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg9, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg9 );
- if ( Arg10.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg10, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg10 );
- if ( Arg11.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg11, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg11 );
- if ( Arg12.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg12, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg12 );
- if ( Arg13.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg13, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg13 );
- if ( Arg14.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg14, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg14 );
- if ( Arg15.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg15, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg15 );
- if ( Arg16.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg16, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg16 );
- if ( Arg17.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg17, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg17 );
- if ( Arg18.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg18, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg18 );
- if ( Arg19.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg19, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg19 );
- if ( Arg20.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg20, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg20 );
- if ( Arg21.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg21, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg21 );
- if ( Arg22.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg22, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg22 );
- if ( Arg23.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg23, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg23 );
- if ( Arg24.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg24, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg24 );
- if ( Arg25.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg25, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg25 );
- if ( Arg26.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg26, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg26 );
- if ( Arg27.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg27, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg27 );
- if ( Arg28.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg28, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg28 );
- if ( Arg29.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg29, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg29 );
- if ( Arg30.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg30, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangesToVec( vRanges, Arg30 );
-
-- std::vector< uno::Reference< excel::XRange > >::iterator it = vRanges.begin();
-- std::vector< uno::Reference< excel::XRange > >::iterator it_end = vRanges.end();
--
-- uno::Reference< excel::XRange > xRefRange( *it );
-- ++it;
-- for ( ; it != it_end; ++it )
-+ uno::Reference< excel::XRange > xRefRange;
-+ ScRange aIntersection;
-+ ScRangeList aCellRanges;
-+ Ranges intersections;
-+ for( RangesList::iterator it = vRanges.begin(); it != vRanges.end(); ++it )
- {
-- ScVbaRange* pRange = dynamic_cast< ScVbaRange * >( xRefRange.get());
-- if ( pRange )
-- xRefRange = pRange->intersect( *it );
-- if ( !xRefRange.is() )
-- return uno::Reference< excel::XRange >();
-- }
-+ for( RangesList::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner )
-+ {
-+ if ( it != it_inner )
-+ {
-+ for ( USHORT x = 0 ; x < it->Count(); ++x )
-+ {
-+ for ( USHORT y = 0 ; y < it_inner->Count(); ++y )
-+ {
-+ if( it->GetObject( x )->Intersects( *it_inner->GetObject( y ) ) )
-+ {
-+ aIntersection = ScRange( Max( it->GetObject( x )->aStart.Col(), it_inner->GetObject( y )->aStart.Col() ),
-+ Max( it->GetObject( x )->aStart.Row(), it_inner->GetObject( y )->aStart.Row() ),
-+ Max( it->GetObject( x )->aStart.Tab(), it_inner->GetObject( y )->aStart.Tab() ),
-+ Min( it->GetObject( x )->aEnd.Col(), it_inner->GetObject( y )->aEnd.Col() ),
-+ Min( it->GetObject( x )->aEnd.Row(), it_inner->GetObject( y )->aEnd.Row() ),
-+ Min( it->GetObject( x )->aEnd.Tab(), it_inner->GetObject( y )->aEnd.Tab() ) );
-+ intersections.push_back( aIntersection );
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ // strip out intersections contained by other intesections
-+ lcl_strip_containedRanges( intersections );
-+ for( Ranges::iterator it = intersections.begin(); it != intersections.end(); ++it )
-+ aCellRanges.Join( *it );
-+
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ ScDocShell* pDocShell = getDocShell( xModel );
-+ if ( aCellRanges.Count() == 1 )
-+ {
-+ xRefRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
-+ }
-+ else if ( aCellRanges.Count() > 1 )
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
-+ xRefRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, xRanges );
-+
-+ }
- return xRefRange;
- }
-
- uno::Reference< excel::XRange > SAL_CALL
- ScVbaApplication::Union( const uno::Reference< excel::XRange >& Arg1, const uno::Reference< excel::XRange >& Arg2, const uno::Any& Arg3, const uno::Any& Arg4, const uno::Any& Arg5, const uno::Any& Arg6, const uno::Any& Arg7, const uno::Any& Arg8, const uno::Any& Arg9, const uno::Any& Arg10, const uno::Any& Arg11, const uno::Any& Arg12, const uno::Any& Arg13, const uno::Any& Arg14, const uno::Any& Arg15, const uno::Any& Arg16, const uno::Any& Arg17, const uno::Any& Arg18, const uno::Any& Arg19, const uno::Any& Arg20, const uno::Any& Arg21, const uno::Any& Arg22, const uno::Any& Arg23, const uno::Any& Arg24, const uno::Any& Arg25, const uno::Any& Arg26, const uno::Any& Arg27, const uno::Any& Arg28, const uno::Any& Arg29, const uno::Any& Arg30 ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- std::vector< uno::Reference< excel::XRange > > vRanges;
- if ( !Arg1.is() || !Arg2.is() )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
-
-- vRanges.push_back( Arg1 );
-- vRanges.push_back( Arg2 );
-+ uno::Reference< excel::XRange > xRange;
-+ Ranges vRanges;
-+ lcl_addRangeToVec( vRanges, uno::makeAny( Arg1 ) );
-+ lcl_addRangeToVec( vRanges, uno::makeAny( Arg2 ) );
-
- if ( Arg3.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg3, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg3 );
- if ( Arg4.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg4, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg4 );
- if ( Arg5.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg5, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg5 );
- if ( Arg6.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg6, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg6 );
- if ( Arg7.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg7, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg7 );
- if ( Arg8.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg8, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg8 );
- if ( Arg9.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg9, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg9 );
- if ( Arg10.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg10, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg10 );
- if ( Arg11.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg11, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg11 );
- if ( Arg12.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg12, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg12 );
- if ( Arg13.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg13, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg13 );
- if ( Arg14.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg14, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg14 );
- if ( Arg15.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg15, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg15 );
- if ( Arg16.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg16, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg16 );
- if ( Arg17.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg17, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg17 );
- if ( Arg18.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg18, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg18 );
- if ( Arg19.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg19, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg19 );
- if ( Arg20.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg20, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg20 );
- if ( Arg21.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg21, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg21 );
- if ( Arg22.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg22, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg22 );
- if ( Arg23.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg23, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg23 );
- if ( Arg24.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg24, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg24 );
- if ( Arg25.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg25, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg25 );
- if ( Arg26.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg26, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg26 );
- if ( Arg27.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg27, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg27 );
- if ( Arg28.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg28, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg28 );
- if ( Arg29.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg29, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg29 );
- if ( Arg30.hasValue() )
-- vRanges.push_back( uno::Reference< excel::XRange >( Arg30, uno::UNO_QUERY_THROW ) );
-+ lcl_addRangeToVec( vRanges, Arg30 );
-
-- std::vector< uno::Reference< excel::XRange > >::iterator it = vRanges.begin();
-- std::vector< uno::Reference< excel::XRange > >::iterator it_end = vRanges.end();
-+ ScRangeList aCellRanges;
-+ lcl_strip_containedRanges( vRanges );
-
-- uno::Reference< excel::XRange > xRange;
-- ScRangeList aCellRanges;
-- for( ; it != it_end; ++it )
-- {
-- xRange = *it;
-- uno::Reference< table::XCellRange > xRangeParam;
-- xRange->getCellRange() >>= xRangeParam;
-- uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRangeParam, uno::UNO_QUERY_THROW );
-- ScRange refRange;
-- ScUnoConversion::FillScRange( refRange, xAddressable->getRangeAddress() );
-- aCellRanges.Append( refRange );
-- }
-+ for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it )
-+ aCellRanges.Append( *it );
-
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- ScDocShell* pDocShell = getDocShell( xModel );
-- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
-+ if ( aCellRanges.Count() == 1 )
-+ {
-+ // normal range
-+ xRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
-+ }
-+ else if ( aCellRanges.Count() > 1 ) // Multi-Area
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
-+ xRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, xRanges );
-+ }
-+
- // #FIXME need proper (WorkSheet) parent
-- xRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, xRanges );
- return xRange;
- }
-
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 1dde272..fcce0aa 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -5318,57 +5318,6 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGrou
- }
- }
-
--uno::Reference< excel::XRange >
--ScVbaRange::intersect( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (script::BasicErrorException, uno::RuntimeException)
--{
-- uno::Reference< excel::XRange > xResult;
-- sal_Int32 nLen = m_Areas->getCount();
-- if ( nLen > 1 )
-- {
-- ScRangeList aCellRanges;
-- for ( sal_Int32 index = 1; index != nLen; ++index )
-- {
-- uno::Reference< excel::XRange > xAreaRange( getArea( index ), uno::UNO_QUERY_THROW );
-- ScVbaRange* pRange = dynamic_cast< ScVbaRange * >( xAreaRange.get());
-- if ( pRange )
-- {
-- uno::Reference< excel::XRange > xResultRange = pRange->intersect( xAreaRange );
-- if ( xResultRange.is() )
-- {
-- ScRange refRange;
-- RangeHelper aRange( xResultRange->getCellRange() );
-- ScUnoConversion::FillScRange( refRange, aRange.getCellRangeAddressable()->getRangeAddress() );
-- aCellRanges.Append( refRange );
-- }
-- }
-- }
-- if ( aCellRanges.First() != aCellRanges.Last() )
-- {
-- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( getScDocShell(), aCellRanges ) );
-- xResult = new ScVbaRange( getParent(), mxContext, xRanges );
-- }
-- return xResult;
-- }
-- else
-- {
-- // This is a single range
-- try
-- {
-- // xRange could be a single of multi-area range
-- uno::Reference< sheet::XCellRangesQuery > xQuery( xRange->getCellRange(), uno::UNO_QUERY_THROW );
-- RangeHelper aRange( mxRange );
-- table::CellRangeAddress aAddress = aRange.getCellRangeAddressable()->getRangeAddress();
-- uno::Reference< sheet::XSheetCellRanges > xIntersectRanges = xQuery->queryIntersection( aAddress );
-- xResult = lcl_makeXRangeFromSheetCellRanges( getParent(), mxContext, xIntersectRanges, getScDocShell() );
--
-- }
-- catch( uno::Exception& )
-- {
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- }
-- }
-- return xResult;
--}
-
- rtl::OUString&
- ScVbaRange::getServiceImplName()
-diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index 2ece2a2..585cadf 100644
---- sc/source/ui/vba/vbarange.hxx
-+++ sc/source/ui/vba/vbarange.hxx
-@@ -128,7 +128,6 @@ public:
- virtual ~ScVbaRange();
- virtual css::uno::Reference< oo::vba::XHelperInterface > thisHelperIface() { return this; }
- bool isSingleCellRange();
-- css::uno::Reference< oo::excel::XRange > intersect( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- static css::uno::Reference< oo::excel::XRange > getRangeObjectForName( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, ScAddress::Convention eConv = ScAddress::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
-
- // Attributes
diff --git a/patches/test/vba/vbaevents-services-sources.diff b/patches/test/vba/vbaevents-services-sources.diff
deleted file mode 100644
index d27dccc51..000000000
--- a/patches/test/vba/vbaevents-services-sources.diff
+++ /dev/null
@@ -1,1896 +0,0 @@
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/document.hxx sc/inc/document.hxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/document.hxx 2007-12-10 12:08:57.000000000 +0000
-+++ sc/inc/document.hxx 2007-12-09 15:34:24.000000000 +0000
-@@ -304,6 +304,7 @@ private:
-
- com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
- String aDocName; // opt: Dokumentname
-+ String aDocCodeName; // opt: Dokumentname
- ScRangePairListRef xColNameRanges;
- ScRangePairListRef xRowNameRanges;
-
-@@ -443,6 +444,8 @@ public:
-
- const String& GetName() const { return aDocName; }
- void SetName( const String& r ) { aDocName = r; }
-+ const String& GetCodeName() const { return aDocCodeName; }
-+ void SetCodeName( const String& r ) { aDocCodeName = r; }
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -530,6 +533,8 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollec
-
- BOOL HasTable( SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
- BOOL GetTable( const String& rName, SCTAB& rTab ) const;
- inline SCTAB GetTableCount() const { return nMaxTableNumber; }
- SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/servuno.hxx sc/inc/servuno.hxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/servuno.hxx 2007-12-10 12:08:57.000000000 +0000
-+++ sc/inc/servuno.hxx 2007-11-27 13:59:17.000000000 +0000
-@@ -102,8 +102,9 @@ class ScDocShell;
-
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
-+#define SC_SERVICE_VBACONTROL_EVENTS 40
-
--#define SC_SERVICE_COUNT 40
-+#define SC_SERVICE_COUNT 41
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/table.hxx sc/inc/table.hxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/inc/table.hxx 2007-12-10 12:02:44.000000000 +0000
-+++ sc/inc/table.hxx 2007-12-09 15:34:24.000000000 +0000
-@@ -102,6 +102,7 @@ private:
- ScColumn aCol[MAXCOLCOUNT];
-
- String aName;
-+ String aCodeName;
- String aComment;
- BOOL bScenario;
- BOOL bLayoutRTL;
-@@ -232,6 +233,9 @@ public:
- void GetName( String& rName ) const;
- void SetName( const String& rNewName );
-
-+ void GetCodeName( String& rName ) const { rName = aCodeName; }
-+ void SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
-+
- const String& GetUpperName() const;
-
- const String& GetPageStyle() const { return aPageStyle; }
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/core/data/document.cxx sc/source/core/data/document.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/core/data/document.cxx 2007-12-10 12:02:49.000000000 +0000
-+++ sc/source/core/data/document.cxx 2007-12-09 16:16:31.000000000 +0000
-@@ -161,6 +161,32 @@ BOOL ScDocument::GetName( SCTAB nTab, St
- return FALSE;
- }
-
-+BOOL ScDocument::SetCodeName( SCTAB nTab, String& rName )
-+{
-+ if (VALIDTAB(nTab))
-+ {
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->SetCodeName( rName );
-+ return TRUE;
-+ }
-+ }
-+ OSL_TRACE( "**** can't set code name %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return FALSE;
-+}
-+
-+BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
-+{
-+ if (VALIDTAB(nTab))
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->GetCodeName( rName );
-+ return TRUE;
-+ }
-+ rName.Erase();
-+ return FALSE;
-+}
-+
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/core/data/table1.cxx sc/source/core/data/table1.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/core/data/table1.cxx 2007-12-10 12:08:57.000000000 +0000
-+++ sc/source/core/data/table1.cxx 2007-12-09 15:34:25.000000000 +0000
-@@ -129,6 +129,7 @@ extern BOOL bIsOlk, bOderSo;
- ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
- BOOL bColInfo, BOOL bRowInfo ) :
- aName( rNewName ),
-+ aCodeName( rNewName ),
- bScenario( FALSE ),
- bLayoutRTL( FALSE ),
- bLoadingRTL( FALSE ),
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/excdoc.cxx sc/source/filter/excel/excdoc.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/excdoc.cxx 2007-12-10 12:02:44.000000000 +0000
-+++ sc/source/filter/excel/excdoc.cxx 2007-12-09 15:34:25.000000000 +0000
-@@ -168,7 +168,7 @@ void ExcTable::FillAsHeader( ExcBoundshe
- String aTmpString;
- SCTAB nScTabCount = rTabInfo.GetScTabCount();
- UINT16 nExcTabCount = rTabInfo.GetXclTabCount();
-- UINT16 nCodenames = static_cast< UINT16 >( GetExtDocOptions().GetCodeNameCount() );
-+ UINT16 nCodenames = nScTabCount;
-
- rR.pObjRecs = NULL; // per sheet
-
-@@ -182,7 +182,8 @@ void ExcTable::FillAsHeader( ExcBoundshe
- if( HasVbaStorage() )
- {
- Add( new XclObproj );
-- const String& rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
-+ //const String& rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
-+ const String rCodeName = GetDoc().GetCodeName();
- if( rCodeName.Len() )
- Add( new XclCodename( rCodeName ) );
- }
-@@ -403,8 +404,12 @@ void ExcTable::FillAsTable( size_t nCode
- Add( new XclExpCondFormatBuffer( GetRoot() ) );
-
- if( HasVbaStorage() )
-- if( nCodeNameIdx < GetExtDocOptions().GetCodeNameCount() )
-- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
-+ if( nCodeNameIdx < GetTabInfo().GetScTabCount() )
-+ {
-+ String sCodeName;
-+ rDoc.GetCodeName( nCodeNameIdx, sCodeName );
-+ Add( new XclCodename( sCodeName ) );
-+ }
- }
-
- // list of HLINK records, generated by the cell table
-@@ -429,7 +434,7 @@ void ExcTable::FillAsEmptyTable( size_t
- {
- InitializeTable( mnScTab );
-
-- if( HasVbaStorage() && (nCodeNameIdx < GetExtDocOptions().GetCodeNameCount()) )
-+ if( HasVbaStorage() && (nCodeNameIdx < GetTabInfo().GetScTabCount()) )
- {
- if( GetBiff() <= EXC_BIFF5 )
- {
-@@ -438,7 +443,9 @@ void ExcTable::FillAsEmptyTable( size_t
- else
- {
- Add( new ExcBof8 );
-- Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
-+ String sCodeName;
-+ GetDoc().GetCodeName( nCodeNameIdx, sCodeName );
-+ Add( new XclCodename( sCodeName ) );
- }
- // sheet view settings: WINDOW2, SCL, PANE, SELECTION
- aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
-@@ -480,7 +487,7 @@ void ExcDocument::ReadDoc( void )
- aHeader.FillAsHeader( maBoundsheetList );
-
- SCTAB nScTab = 0, nScTabCount = GetTabInfo().GetScTabCount();
-- size_t nCodeNameIdx = 0, nCodeNameCount = GetExtDocOptions().GetCodeNameCount();
-+ size_t nCodeNameIdx = 0, nCodeNameCount = nScTabCount;
-
- for( ; nScTab < nScTabCount; ++nScTab )
- {
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/excimp8.cxx 2007-12-10 12:02:44.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2007-12-09 15:59:06.000000000 +0000
-@@ -148,7 +148,7 @@ using namespace com::sun::star;
-
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
-- ImportExcel( rImpData, rStrm )
-+ ImportExcel( rImpData, rStrm ), mnTab(0)
- {
- delete pFormConv;
-
-@@ -293,10 +293,17 @@ void ImportExcel8::Codename( BOOL bWorkb
- String aName( aIn.ReadUniString() );
- if( aName.Len() )
- {
-+ OSL_TRACE("****** C O D E N A M E %s - tab? %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), mnTab );
- if( bWorkbookGlobals )
-+ {
- GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ GetDoc().SetCodeName( aName );
-+ }
- else
-+ {
- GetExtDocOptions().AppendCodeName( aName );
-+ GetDoc().SetCodeName( mnTab++, aName );
-+ }
- }
- }
- }
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/makefile.mk sc/source/filter/excel/makefile.mk
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/makefile.mk 2007-12-10 12:08:57.000000000 +0000
-+++ sc/source/filter/excel/makefile.mk 2007-11-21 15:46:09.000000000 +0000
-@@ -51,6 +51,11 @@ PROJECTPCHSOURCE=..\pch\filt_pch
- .INCLUDE : sc.mk
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-+.IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+ INCPRE=$(INCCOM)$/vbaobj
-+.ENDIF
-+
- # --- Files --------------------------------------------------------
-
- SLOFILES = \
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xelink.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/excel/xelink.cxx 2007-05-22 20:47:21.000000000 +0100
-+++ sc/source/filter/excel/xelink.cxx 2007-12-09 15:34:25.000000000 +0000
-@@ -1296,7 +1296,6 @@ XclExpSupbookBuffer::XclExpSupbookBuffer
- {
- XclExpTabInfo& rTabInfo = GetTabInfo();
- sal_uInt16 nXclCnt = rTabInfo.GetXclTabCount();
-- sal_uInt16 nCodeCnt = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() );
- size_t nCount = nXclCnt + rTabInfo.GetXclExtTabCount();
-
- DBG_ASSERT( nCount > 0, "XclExpSupbookBuffer::XclExpSupbookBuffer - no sheets to export" );
-@@ -1305,7 +1304,7 @@ XclExpSupbookBuffer::XclExpSupbookBuffer
- maSBIndexVec.resize( nCount );
-
- // self-ref SUPBOOK first of list
-- XclExpSupbookRef xSupbook( new XclExpSupbook( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ) );
-+ XclExpSupbookRef xSupbook( new XclExpSupbook( GetRoot(), nXclCnt ) );
- mnOwnDocSB = Append( xSupbook );
- for( sal_uInt16 nXclTab = 0; nXclTab < nXclCnt; ++nXclTab )
- maSBIndexVec[ nXclTab ].Set( mnOwnDocSB, nXclTab );
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/inc/excimp8.hxx sc/source/filter/inc/excimp8.hxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/filter/inc/excimp8.hxx 2007-12-10 12:02:44.000000000 +0000
-+++ sc/source/filter/inc/excimp8.hxx 2007-12-09 15:34:25.000000000 +0000
-@@ -69,6 +69,7 @@ class XclImpStream;
-
- class ImportExcel8 : public ImportExcel
- {
-+ SCTAB mnTab;
- protected:
- ExcScenarioList aScenList;
-
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/docshell/docsh.cxx 2007-12-10 12:08:57.000000000 +0000
-+++ sc/source/ui/docshell/docsh.cxx 2007-12-09 15:34:25.000000000 +0000
-@@ -208,11 +208,8 @@ const static rtl::OUString sUrlPart2 = r
- rtl::OUString sCodeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- if ( pShell )
- {
-- if ( ScExtDocOptions* pExtDocOpts = pShell->GetDocument()->GetExtDocOptions() )
-- {
-- if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
-- sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
-- }
-+ if ( ScDocument* pDoc = pShell->GetDocument() )
-+ sCodeName = pDoc->GetCodeName();
- }
- return sCodeName;
- }
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/unoobj/makefile.mk sc/source/ui/unoobj/makefile.mk
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/unoobj/makefile.mk 2007-12-10 12:08:57.000000000 +0000
-+++ sc/source/ui/unoobj/makefile.mk 2007-11-30 17:44:44.000000000 +0000
-@@ -54,6 +54,8 @@ AUTOSEG=true
- .INCLUDE : sc.mk
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-+
-+INCPRE=$(INCCOM)$/vbaobj
- # --- Files --------------------------------------------------------
- SLO1FILES = \
- $(SLO)$/docuno.obj \
-@@ -119,6 +121,7 @@ NOOPTFILES= \
- $(SLO)$/cellsuno.obj
- .ENDIF
-
-+
- # --- Tagets -------------------------------------------------------
-
- .INCLUDE : target.mk
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/unoobj/servuno.cxx 2007-12-10 12:08:57.000000000 +0000
-+++ sc/source/ui/unoobj/servuno.cxx 2007-12-10 12:07:00.000000000 +0000
-@@ -49,6 +49,8 @@
- #ifndef _COM_SUN_STAR_SHEET_XSPREADSHEETDOCUMENT_HPP_
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #endif
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-
- #include "servuno.hxx"
- #include "unonames.hxx"
-@@ -77,8 +79,80 @@
- #include <svx/xmlgrhlp.hxx>
- #endif
-
-+#include <com/sun/star/script/XEventAttacherManager.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <org/openoffice/vba/XVBAToOOEventDescGen.hpp>
-+#include <org/openoffice/vba/XFakeVBAEventDescriptorSupplier.hpp>
-+#include <comphelper/processfactory.hxx>
-+#include "scextopt.hxx"
-+
- using namespace ::com::sun::star;
-
-+typedef ::cppu::WeakImplHelper1< org::openoffice::vba::XFakeVBAEventDescriptorSupplier > Initialization_BASE;
-+
-+class ScFakeVBACntrlEvtSupport : public Initialization_BASE
-+{
-+ ScDocShell* mpDoc;
-+ ScFakeVBACntrlEvtSupport();
-+ uno::Sequence< script::ScriptEventDescriptor > getFakeEvents( const uno::Reference< uno::XInterface >& xIf, sal_Int32 pageIndex )
-+ {
-+ rtl::OUString sServiceName;
-+ uno::Reference< beans::XPropertySet > xProps( xIf, uno::UNO_QUERY );
-+ xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName;
-+ OSL_TRACE("Control serviceName is %s", rtl::OUStringToOString( sServiceName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ xProps.set( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Reference< org::openoffice::vba::XVBAToOOEventDescGen > xEvtDescGen( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( "org.openoffice.vba.VBAToOOEventDesc" ), xContext ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sHandlerExtns;
-+ String sLibModName;
-+ mpDoc->GetDocument()->GetCodeName( pageIndex, sLibModName );
-+
-+ if( !sLibModName.Len() )
-+ mpDoc->GetDocument()->GetName( pageIndex, sLibModName );
-+
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents = xEvtDescGen->getEventDescriptions( xContext->getServiceManager()->createInstanceWithContext( sServiceName, xContext ), sLibModName, sHandlerExtns ) ;
-+ return aFakeEvents;
-+ }
-+public:
-+ ScFakeVBACntrlEvtSupport( ScDocShell* pDoc ) : mpDoc( pDoc )
-+ {
-+ OSL_TRACE("*** In ScFakeVBACntrlEvtSupport ");
-+ }
-+ virtual uno::Sequence< com::sun::star::script::ScriptEventDescriptor > SAL_CALL getEventDescriptions( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
-+ {
-+ OSL_TRACE( "*** In ScFakeVBACntrlEvtSupport::getEventDescriptions");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDoc->GetModel(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ aFakeEvents = getFakeEvents( xIf, index );
-+ break;
-+ }
-+ }
-+ if ( bMatched )
-+ break;
-+ }
-+ // Probably should throw here
-+ return aFakeEvents;
-+ }
-+};
-
- //------------------------------------------------------------------------
-
-@@ -128,7 +202,8 @@ static const sal_Char* __FAR_DATA aProvN
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
-- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
-+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+ "org.openoffice.vba.controlevents", // SC_SERVICE_VBACONTROL_EVENTS
- };
-
- //
-@@ -180,7 +255,8 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_SHEETDOCSET
- "", // SC_SERVICE_CHDATAPROV
- "", // SC_SERVICE_FORMULAPARS
-- "" // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_VBACONTROL_EVENTS
- };
-
-
-@@ -373,6 +449,9 @@ uno::Reference<uno::XInterface> ScServic
- case SC_SERVICE_OPCODEMAPPER:
- xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
- break;
-+ case SC_SERVICE_VBACONTROL_EVENTS:
-+ xRet.set(static_cast<org::openoffice::vba::XFakeVBAEventDescriptorSupplier*>(new ScFakeVBACntrlEvtSupport( pDocShell ) ));
-+ break;
- }
- return xRet;
- }
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/view/tabview5.cxx sc/source/ui/view/tabview5.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/sc/source/ui/view/tabview5.cxx 2007-12-10 12:02:49.000000000 +0000
-+++ sc/source/ui/view/tabview5.cxx 2007-12-09 15:34:25.000000000 +0000
-@@ -347,10 +347,15 @@ void ScTabView::TabChanged()
- aViewData.GetDocument()->BroadcastUno( SfxSimpleHint( SC_HINT_TABLECHANGED ) );
- ScExtDocOptions* pExtOptions = aViewData.GetDocument()->GetExtDocOptions();
- String sSheetModuleName;
-- aViewData.GetDocument()->GetName( aViewData.GetTabNo(), sSheetModuleName);
-+ aViewData.GetDocument()->GetCodeName( aViewData.GetTabNo(), sSheetModuleName);
-+ if ( !sSheetModuleName.Len() > 0 )
-+ aViewData.GetDocument()->GetName( aViewData.GetTabNo(), sSheetModuleName);
-+
-+/*
- // Use code name if that exists
- if ( pExtOptions )
- sSheetModuleName = pExtOptions->GetCodeName( aViewData. GetTabNo() );
-+*/
- static String sUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:Standard") );
- static String sUrl2( RTL_CONSTASCII_USTRINGPARAM("?language=Basic&location=document") );
- static String sSheetActivateScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Activate") );
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/inc/InterfaceContainer.hxx forms/source/inc/InterfaceContainer.hxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/inc/InterfaceContainer.hxx 2007-01-29 15:46:36.000000000 +0000
-+++ forms/source/inc/InterfaceContainer.hxx 2007-12-07 11:22:09.000000000 +0000
-@@ -319,6 +319,9 @@ protected:
- void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
-
- private:
-+ // hack for Vba Events
-+ void fakeVbaEventsHack( sal_Int32 _nIndex );
-+
- // the runtime event format has changed from version SO5.2 to OOo
- enum EventFormat
- {
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/misc/InterfaceContainer.cxx forms/source/misc/InterfaceContainer.cxx
---- /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/misc/InterfaceContainer.cxx 2006-12-01 16:55:25.000000000 +0000
-+++ forms/source/misc/InterfaceContainer.cxx 2007-12-07 13:08:05.000000000 +0000
-@@ -105,11 +105,14 @@
- #include <rtl/logfile.hxx>
- #endif
-
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <org/openoffice/vba/XFakeVBAEventDescriptorSupplier.hpp>
- //.........................................................................
- namespace frm
- {
- //.........................................................................
-
-+using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
-@@ -127,6 +130,83 @@ namespace
- }
- }
-
-+bool
-+lcl_hasVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ return true;
-+ }
-+ return false;
-+}
-+
-+Sequence< ScriptEventDescriptor >
-+lcl_stripVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ Sequence< ScriptEventDescriptor > sStripped( sEvents.getLength() );
-+
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ sal_Int32 nCopied = 0;
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( !pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ {
-+ sStripped[ nCopied++ ] = *pDesc;
-+ }
-+ }
-+ if ( nCopied )
-+ sStripped.realloc( nCopied );
-+ return sStripped;
-+}
-+
-+void
-+OInterfaceContainer::fakeVbaEventsHack( sal_Int32 _nIndex )
-+{
-+ // we are dealing with form controls
-+ try
-+ {
-+ Reference< XFormComponent > xForm( static_cast< XContainer* >(this), UNO_QUERY_THROW );
-+ // grand-parent should be the model, no parent ? if not
-+ // we'll ignore, we'll get called back here anyway )
-+ Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW );
-+ Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY );
-+ OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" );
-+ if ( xDocOwner.is() )
-+ {
-+ bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) );
-+ if ( hasVBABindings )
-+ {
-+ OSL_TRACE("Has VBA bindings already, returning ");
-+ return;
-+ }
-+ Reference< XMultiServiceFactory > xFac( xDocOwner, UNO_QUERY );
-+ if ( xFac.is() )
-+ {
-+ try
-+ {
-+ Reference< org::openoffice::vba::XFakeVBAEventDescriptorSupplier > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "org.openoffice.vba.controlevents" ) ), UNO_QUERY_THROW );
-+ Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
-+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xIf );
-+ // register the vba script events
-+ if ( m_xEventAttacher.is() )
-+ {
-+ m_xEventAttacher->registerScriptEvents( _nIndex, vbaEvents );
-+ }
-+ }
-+ catch( Exception& e ){ OSL_TRACE("lcl_fakevbaevents - Caught Exception trying to create control eventstuff "); }
-+ }
-+
-+ }
-+ }
-+ catch( Exception& e )
-+ {
-+ }
-+
-+}
- //==================================================================
- //= ElementDescription
- //==================================================================
-@@ -726,6 +806,7 @@ void OInterfaceContainer::approveNewElem
- void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XPropertySet >& _rxElement,
- sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException )
- {
-+ OSL_TRACE("OInterfaceContainer::implInsert( %d)", _nIndex );
- RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert" );
-
- ::osl::ClearableMutexGuard aGuard( m_rMutex );
-@@ -775,6 +856,23 @@ void OInterfaceContainer::implInsert(sal
- {
- m_xEventAttacher->insertEntry(_nIndex);
- m_xEventAttacher->attach( _nIndex, pElementMetaData->xInterface, makeAny( _rxElement ) );
-+ // insert fake events?
-+ Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY );
-+ if ( xMgr.is() )
-+ {
-+ OInterfaceContainer* pIfcMgr = dynamic_cast< OInterfaceContainer* >( xMgr.get() );
-+ sal_Int32 nLen = getCount();
-+ for ( sal_Int32 i = 0; (i < nLen) && pIfcMgr ; ++i )
-+ {
-+ // add fake events to the control at index i
-+ pIfcMgr->fakeVbaEventsHack( i );
-+ }
-+ }
-+ else
-+ {
-+ // add fake events to the control at index i
-+ fakeVbaEventsHack( _nIndex );
-+ }
- }
-
- // notify derived classes
-@@ -1054,20 +1154,29 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const ScriptEventDescriptor& aScriptEvent ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvent( nIndex, aScriptEvent );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const Sequence< ScriptEventDescriptor >& aScriptEvents ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent(s) %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvents( nIndex, aScriptEvents );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** revokeScriptEvent %d listenertype %s, eventMethod %s", nIndex, rtl::OUStringToOString( aListenerType, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aEventMethod, RTL_TEXTENCODING_UTF8 ).getStr());
- if ( m_xEventAttacher.is() )
- m_xEventAttacher->revokeScriptEvent( nIndex, aListenerType, aEventMethod, aRemoveListenerParam );
- }
-@@ -1096,9 +1206,16 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- Sequence< ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("getScriptEvents");
- Sequence< ScriptEventDescriptor > aReturn;
- if ( m_xEventAttacher.is() )
-+ {
- aReturn = m_xEventAttacher->getScriptEvents( nIndex );
-+ if ( lcl_hasVbaEvents( aReturn ) )
-+ {
-+ aReturn = lcl_stripVbaEvents( aReturn );
-+ }
-+ }
- return aReturn;
- }
-
-diff -rup /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/misc/makefile.mk forms/source/misc/makefile.mk
---- /data4/latestBuild/ooo-build/build/oog680-m5/forms/source/misc/makefile.mk 2005-09-09 00:01:56.000000000 +0100
-+++ forms/source/misc/makefile.mk 2007-12-07 11:16:14.000000000 +0000
-@@ -48,6 +48,7 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Types -------------------------------------
-
- INCPRE+=$(SOLARINCDIR)$/offuh
-+INCPRE*=$(INCCOM)$/$(TARGET)
-
- # --- Files -------------------------------------
-
-@@ -65,3 +66,12 @@ SLOFILES= $(SLO)$/limitedformats.obj \
-
- .INCLUDE : target.mk
-
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/makefile.mk 2007-11-21 15:46:09.000000000 +0000
-@@ -0,0 +1,58 @@
-+PRJ=..$/..
-+
-+PRJNAME=vbaevents
-+TARGET=vbaevents
-+.IF "$(ENABLE_VBA)"!="YES"
-+dummy:
-+ @echo "not building vbaevents..."
-+.ENDIF
-+
-+NO_BSYMBOLIC= TRUE
-+ENABLE_EXCEPTIONS=TRUE
-+COMP1TYPELIST=$(TARGET)
-+COMPRDB=$(SOLARBINDIR)$/types.rdb
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+DLLPRE =
-+
-+# ------------------------------------------------------------------
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+ $(SLOTARGET)
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+# ------------------------------------------------------------------
-+
-+#.INCLUDE : ..$/cppumaker.mk
-+
-+SLOFILES= \
-+ $(SLO)$/service.obj \
-+ $(SLO)$/eventhelper.obj
-+
-+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX).uno
-+SHL1IMPLIB= i$(TARGET)
-+
-+SHL1VERSIONMAP=$(TARGET).map
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+DEF1NAME=$(SHL1TARGET)
-+
-+SHL1STDLIBS= \
-+ $(CPPUHELPERLIB) \
-+ $(BASICLIB) \
-+ $(COMPHELPERLIB) \
-+ $(SFXLIB) \
-+ $(CPPULIB) \
-+ $(TOOLSLIB) \
-+ $(SALLIB)
-+
-+SHL1DEPN=
-+SHL1LIBS=$(SLB)$/$(TARGET).lib
-+
-+# --- Targets ------------------------------------------------------
-+
-+.INCLUDE : target.mk
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/service.cxx 2007-11-21 15:46:09.000000000 +0000
-@@ -0,0 +1,99 @@
-+#include "cppuhelper/implementationentry.hxx"
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/registry/XRegistryKey.hpp"
-+
-+// =============================================================================
-+// component exports
-+// =============================================================================
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+namespace evtlstner
-+{
-+ // =============================================================================
-+ // component operations
-+ // =============================================================================
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () );
-+
-+ // -----------------------------------------------------------------------------
-+
-+ ::rtl::OUString SAL_CALL getImplementationName();
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
-+
-+ Reference<XInterface> SAL_CALL create(
-+ Sequence<Any> const &, Reference<XComponentContext> const & );
-+} // end evtlstner
-+
-+namespace ooevtdescgen
-+{
-+ // =============================================================================
-+ // component operations
-+ // =============================================================================
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () );
-+
-+ // -----------------------------------------------------------------------------
-+
-+ ::rtl::OUString SAL_CALL getImplementationName();
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
-+
-+ Reference<XInterface> SAL_CALL create(
-+ Sequence<Any> const &, Reference<XComponentContext> const & );
-+} // end ooevtdescgen
-+
-+
-+
-+ // =============================================================================
-+
-+ const ::cppu::ImplementationEntry s_component_entries [] =
-+ {
-+ {
-+ ::evtlstner::create, ::evtlstner::getImplementationName,
-+ ::evtlstner::getSupportedServiceNames,
-+ ::cppu::createSingleComponentFactory,
-+ 0, 0
-+ },
-+ {
-+ ::ooevtdescgen::create, ::ooevtdescgen::getImplementationName,
-+ ::ooevtdescgen::getSupportedServiceNames,
-+ ::cppu::createSingleComponentFactory,
-+ 0, 0
-+ },
-+ { 0, 0, 0, 0, 0, 0 }
-+ };
-+
-+extern "C"
-+{
-+ void SAL_CALL component_getImplementationEnvironment(
-+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
-+ {
-+ OSL_TRACE("In component_getImplementationEnv");
-+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+ }
-+
-+ sal_Bool SAL_CALL component_writeInfo(
-+ lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_writeInfo");
-+ if ( ::cppu::component_writeInfoHelper(
-+ pServiceManager, pRegistryKey, s_component_entries ) )
-+ return sal_True;
-+ return sal_False;
-+ }
-+
-+ void * SAL_CALL component_getFactory(
-+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
-+ registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_getFactory");
-+ return ::cppu::component_getFactoryHelper(
-+ pImplName, pServiceManager, pRegistryKey, s_component_entries );
-+ }
-+}
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/vbaevents.map 2007-11-21 15:46:09.000000000 +0000
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/vbaevents.xml 2007-11-21 15:46:09.000000000 +0000
-@@ -0,0 +1,26 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
-+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
-+
-+ <module-name>vbaevents</module-name>
-+
-+ <component-description>
-+ <author>Noel Power </author>
-+ <name>org.openoffice.vba.EventListener</name>
-+ <description>Event listener to handle ooo events and to translate them to calls to basic macros ala Button_Click etc.</description>
-+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
-+ <language>c++</language>
-+ <status value="drafts"/>
-+ <supported-service>org.openoffice.vba.EventListener</supported-service>
-+ <type>com.sun.star.uno.XComponentContext</type>
-+ </component-description>
-+
-+ <project-build-dependency>cppuhelper</project-build-dependency>
-+ <project-build-dependency>cppu</project-build-dependency>
-+ <project-build-dependency>sal</project-build-dependency>
-+
-+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
-+ <runtime-module-dependency>cppu3</runtime-module-dependency>
-+ <runtime-module-dependency>sal3</runtime-module-dependency>
-+
-+</module-description>
---- oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl 2007-04-27 08:32:41.000000000 +0100
-+++ /data4/scratch/oog680-m5/oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl 2007-12-07 10:24:44.000000000 +0000
-@@ -50,5 +50,10 @@ interface XVBAToOOEventDescGen : com::su
- com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl );
- };
-
-+interface XFakeVBAEventDescriptorSupplier : com::sun::star::uno::XInterface
-+{
-+ sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl );
-+};
-+
- }; }; };
- #endif
---- /dev/null 2007-05-04 11:54:36.000000000 +0100
-+++ scripting/source/vbaevents/eventhelper.cxx 2007-12-10 15:30:15.000000000 +0000
-@@ -0,0 +1,1025 @@
-+#include <comphelper/processfactory.hxx>
-+#include <comphelper/uno3.hxx>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+
-+#include <org/openoffice/vba/XVBAToOOEventDescGen.hpp>
-+
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/XIntrospection.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/lang/XServiceName.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XInitialization.hpp>
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-+
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/KeyEvent.hpp>
-+#include <com/sun/star/awt/MouseEvent.hpp>
-+
-+#include <msforms/ReturnInteger.hpp>
-+
-+#include <sfx2/objsh.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbx.hxx>
-+
-+
-+
-+
-+// for debug
-+#include <comphelper/anytostring.hxx>
-+
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/script/XScriptListener.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+#include <set>
-+#include <list>
-+#include <hash_map>
-+
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::script;
-+using namespace ::com::sun::star::uno;
-+using namespace ::org::openoffice::vba;
-+
-+
-+// Some constants
-+const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" );
-+const static sal_Int32 DELIMLEN = DELIM.getLength();
-+
-+// Helper Methods
-+
-+// TODO this method now appears/is-defined in at least three places
-+// svx/source/forms/fmtools.cxx extensions/source/propctrlr/formcontroller.cxx
-+// and here. We must do better than that
-+Sequence< ::rtl::OUString> getEventMethods(const Type& type)
-+{
-+ typelib_InterfaceTypeDescription *pType=0;
-+ type.getDescription( (typelib_TypeDescription**)&pType);
-+
-+ if(!pType)
-+ return Sequence< ::rtl::OUString>();
-+
-+ Sequence< ::rtl::OUString> aNames(pType->nMembers);
-+ ::rtl::OUString* pNames = aNames.getArray();
-+ for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
-+ {
-+ // the decription reference
-+ typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
-+ // the description for the reference
-+ typelib_TypeDescription* pMemberDescription = NULL;
-+ typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
-+ if (pMemberDescription)
-+ {
-+ typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
-+ reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
-+ *pNames = pRealMemberDescription->pMemberName;
-+ }
-+ }
-+ typelib_typedescription_release( (typelib_TypeDescription *)pType );
-+ return aNames;
-+}
-+
-+// for debug only ( conditionalize out? )
-+void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, const Reference<XInterface>& xIfc)
-+{
-+ Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
-+ if ( xIntrospection.is() )
-+ {
-+ xIntrospectionAccess = xIntrospection->inspect(
-+ makeAny( xIfc ) );
-+ Sequence< Type > aControlListeners =
-+ xIntrospectionAccess->getSupportedListeners();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+
-+ for ( sal_Int32 i = 0; i< nLength; ++i )
-+ {
-+ Type& listType = aControlListeners[ i ];
-+ rtl::OUString sFullTypeName = listType.getTypeName();
-+ rtl::OUString sTypeName = listType.getTypeName();
-+ sal_Int32 lastDotIndex = -1;
-+ if ( ( lastDotIndex = sFullTypeName.lastIndexOf( '.' ) ) > -1 )
-+ {
-+ sTypeName = sFullTypeName.copy( lastDotIndex + 1 );
-+ }
-+ Sequence< ::rtl::OUString > sMeths = getEventMethods( listType );
-+ sal_Int32 sMethLen = sMeths.getLength();
-+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
-+ {
-+ OSL_TRACE("**Listener [%d] Type[%s] Method[%s]",j,
-+ rtl::OUStringToOString( sTypeName,
-+ RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( sMeths[ j ],
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+
-+ }
-+}
-+
-+void dumpEvent( const ScriptEvent& evt )
-+{
-+ OSL_TRACE("dumpEvent: Source %s",
-+ rtl::OUStringToOString( comphelper::anyToString( makeAny(evt.Source)),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ScriptType %s",
-+ rtl::OUStringToOString( evt.ScriptType,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ScriptCode %s",
-+ rtl::OUStringToOString( evt.ScriptCode,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ListenerType %s",
-+ rtl::OUStringToOString( evt.ListenerType.getTypeName(),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: Listener methodname %s",
-+ rtl::OUStringToOString( evt.MethodName,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: arguments;");
-+ sal_Int32 nLen = evt.Arguments.getLength();
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ OSL_TRACE("\t [%d] %s", index,
-+ rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[ index ] ),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+}
-+
-+
-+bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
-+bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
-+Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::MouseEvent evt;
-+
-+ if ( !( isMouseEventOk(evt, params)) ||
-+ (evt.ClickCount != 2) )
-+ return Sequence< Any >();
-+ // give back orig params, this will signal that the event is good
-+ return params;
-+}
-+
-+Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::MouseEvent evt;
-+
-+ if ( !isMouseEventOk(evt, params) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(4);
-+
-+ // Buttons
-+ translatedParams[ 0 ] <<= evt.Buttons;
-+ // Shift
-+ translatedParams[ 1 ] <<= evt.Modifiers;
-+ // X
-+ translatedParams[ 2 ] <<= evt.X;
-+ // Y
-+ translatedParams[ 3 ] <<= evt.Y;
-+ return translatedParams;
-+}
-+
-+Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::KeyEvent evt;
-+
-+ if ( !isKeyEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(1);
-+
-+ msforms::ReturnInteger keyCode;
-+ keyCode.Value = evt.KeyCode;
-+ translatedParams[0] <<= keyCode;
-+ return translatedParams;
-+}
-+
-+Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::KeyEvent evt;
-+
-+ if ( !isKeyEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(2);
-+
-+ msforms::ReturnInteger keyCode;
-+ sal_Int8 shift = evt.Modifiers;
-+
-+ // #TODO check whether values from OOO conform to values generated from vba
-+ keyCode.Value = evt.KeyCode;
-+ translatedParams[0] <<= keyCode;
-+ translatedParams[1] <<= shift;
-+ return translatedParams;
-+}
-+
-+typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-+
-+struct TranslateInfo
-+{
-+ rtl::OUString sVBAName;
-+ Translator toVBA;
-+};
-+
-+
-+typedef std::hash_map< rtl::OUString,
-+std::list< TranslateInfo >,
-+::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > EventInfoHash;
-+
-+
-+EventInfoHash& getEventTransInfo()
-+{
-+ static bool initialised = false;
-+ static EventInfoHash eventTransInfo;
-+ if ( !initialised )
-+ {
-+ TranslateInfo info;
-+ // actionPerformed ooo event
-+ std::list< TranslateInfo > actionInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Click");
-+ info.toVBA = NULL;
-+ actionInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos;
-+ // changed ooo event
-+ std::list< TranslateInfo > changeInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ changeInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("changed") ] = changeInfos;
-+ // focusGained ooo event
-+ std::list< TranslateInfo > focusGainedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_GotFocus");
-+ info.toVBA = NULL;
-+ focusGainedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusGainedInfos;
-+ // focusLost ooo event
-+ std::list< TranslateInfo > focusLostInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_LostFocus");
-+ info.toVBA = NULL;
-+ focusLostInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusLostInfos;
-+ // adjustmentValueChanged ooo event
-+ std::list< TranslateInfo > adjustInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Scroll");
-+ info.toVBA = NULL;
-+ adjustInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ adjustInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("adjustmentValueChanged") ] = adjustInfos;
-+ // textChanged ooo event
-+ std::list< TranslateInfo > txtChangedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ txtChangedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("textChanged") ] = txtChangedInfos;
-+
-+ // keyReleased ooo event
-+ std::list< TranslateInfo > keyReleasedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyUp");
-+ info.toVBA = ooKeyPressedToVBAKeyUpDown;
-+ keyReleasedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("keyReleased") ] = keyReleasedInfos;
-+ // mouseReleased ooo event
-+ std::list< TranslateInfo > mouseReleasedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseUp");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mouseReleasedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mouseReleased") ] = mouseReleasedInfos;
-+ // mousePressed ooo event
-+ std::list< TranslateInfo > mousePressedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseDown");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mousePressedInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_DblClick");
-+ // emulate double click event
-+ info.toVBA = ooMouseEvtToVBADblClick;
-+ mousePressedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mousePressed") ] = mousePressedInfos;
-+ // mouseMoved ooo event
-+ std::list< TranslateInfo > mouseMovedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseMoved");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mouseMovedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mouseMoved") ] = mouseMovedInfos;
-+ // keyPressed ooo event
-+ std::list< TranslateInfo > keyPressedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyDown");
-+ info.toVBA = ooKeyPressedToVBAKeyUpDown;
-+ keyPressedInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyPress");
-+ info.toVBA = ooKeyPressedToVBAKeyPressed;
-+ keyPressedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("keyPressed") ] = keyPressedInfos;
-+ initialised = true;
-+ }
-+ return eventTransInfo;
-+}
-+
-+// Helper class
-+
-+class ScriptEventFactory
-+{
-+public:
-+ static Sequence< ScriptEventDescriptor > createEvents( const Reference< XInterface >& xControl, const rtl::OUString& sLibModName, const Sequence< rtl::OUString >& sMethods );
-+ static ScriptEventFactory& instance() { static ScriptEventFactory inst; return inst; }
-+ static rtl::OUString getControlName( const Reference< XInterface >& xControl );
-+ static Sequence< rtl::OUString > getEventListeners( const Reference< XInterface >& xControl );
-+private:
-+ ScriptEventFactory();
-+ Reference< XComponentContext > m_xCtx;
-+};
-+
-+// Helper function
-+bool
-+eventMethodToDescriptors( const ::rtl::OUString& rEventMethod, const Reference< XInterface >& xControl, const rtl::OUString& sLibModName, const Sequence< rtl::OUString >& sHandlerExts, Sequence< ScriptEventDescriptor >& evtDescs )
-+{
-+ // format of ControlListener is TypeName::methodname e.g.
-+ // "com.sun.star.awt.XActionListener::actionPerformed" or
-+ // "XActionListener::actionPerformed
-+
-+ ::rtl::OUString sMethodName;
-+ ::rtl::OUString sTypeName;
-+ sal_Int32 nDelimPos = rEventMethod.indexOf( DELIM );
-+ if ( nDelimPos == -1 )
-+ {
-+ return false;
-+ }
-+ sMethodName = rEventMethod.copy( nDelimPos + DELIMLEN );
-+ sTypeName = rEventMethod.copy( 0, nDelimPos );
-+
-+ EventInfoHash& infos = getEventTransInfo();
-+
-+ // Only create an ScriptEventDescriptor for an event we can translate
-+ // or emulate
-+ EventInfoHash::const_iterator eventInfo_it = infos.find( sMethodName );
-+ EventInfoHash::const_iterator it_end = infos.end();
-+
-+ if ( infos.find( sMethodName ) != infos.end() )
-+ {
-+ sal_Int32 nIndex = evtDescs.getLength();
-+ evtDescs.realloc( evtDescs.getLength() + 1 );
-+ evtDescs[ nIndex ].ScriptType = rtl::OUString::createFromAscii( "VBAInterop" );
-+ evtDescs[ nIndex ].ScriptCode = sLibModName; // codeName
-+ evtDescs[ nIndex ].ListenerType = sTypeName;
-+ evtDescs[ nIndex ].EventMethod = sMethodName;
-+ return true;
-+ }
-+
-+ return false;
-+// go no further
-+
-+ // sLibModName ( could ) include the uri bits :-) from calc
-+ rtl::OUString sPartialMacroName = sLibModName + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$macro"));
-+
-+ if ( sMethodName.getLength()
-+ && sTypeName.getLength()
-+ && ( infos.find( sMethodName ) != infos.end() ) )
-+ {
-+ std::list< TranslateInfo >::const_iterator txInfo =
-+ eventInfo_it->second.begin();
-+ std::list< TranslateInfo >::const_iterator txInfo_end =
-+ eventInfo_it->second.end();
-+ for ( ; txInfo != txInfo_end; ++txInfo )
-+ {
-+ // Check if extension is support for this method, if
-+ // so create an eventdescription for that
-+ const rtl::OUString* pExt = sHandlerExts.getConstArray();
-+ sal_Int32 nCount = sHandlerExts.getLength();
-+ for ( sal_Int32 counter=0; counter<nCount; ++counter, ++pExt )
-+ {
-+ if ( (*txInfo).sVBAName.equals( *pExt ) ) // handler for event
-+ {
-+ sal_Int32 nIndex = evtDescs.getLength();
-+ evtDescs.realloc( evtDescs.getLength() + 1 );
-+ evtDescs[ nIndex ].ScriptCode = sPartialMacroName + *pExt;
-+ evtDescs[ nIndex ].ListenerType = sTypeName;
-+ evtDescs[ nIndex ].EventMethod = sMethodName;
-+
-+ // set this it VBAInterop, ensures that it doesn't
-+ // get persisted or shown in property editors
-+ evtDescs[ nIndex ].ScriptType = rtl::OUString::createFromAscii( "VBAInterop" );
-+ }
-+ }
-+ }
-+ return true;
-+ }
-+ return false;
-+
-+}
-+
-+bool
-+eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, const Reference< XInterface >& xControl, ScriptEventDescriptor& evtDesc )
-+{
-+ // format of ControlListener is TypeName::methodname e.g.
-+ // "com.sun.star.awt.XActionListener::actionPerformed" or
-+ // "XActionListener::actionPerformed
-+
-+ ::rtl::OUString sMethodName;
-+ ::rtl::OUString sTypeName;
-+ sal_Int32 nDelimPos = rEventMethod.indexOf( DELIM );
-+ if ( nDelimPos == -1 )
-+ {
-+ return false;
-+ }
-+ sMethodName = rEventMethod.copy( nDelimPos + DELIMLEN );
-+ sTypeName = rEventMethod.copy( 0, nDelimPos );
-+
-+ EventInfoHash& infos = getEventTransInfo();
-+
-+ // Only create an ScriptEventDescriptor for an event we can translate
-+ // or emulate
-+ if ( sMethodName.getLength()
-+ && sTypeName.getLength()
-+ && ( infos.find( sMethodName ) != infos.end() ) )
-+ {
-+ // just fill in control name, event handler will
-+ // do the rest e.g. search for this routine in the doc basic
-+ // and run it.
-+ evtDesc.ScriptCode = ScriptEventFactory::instance().getControlName(xControl);
-+ evtDesc.ListenerType = sTypeName;
-+ evtDesc.EventMethod = sMethodName;
-+
-+ // set this it VBAInterop, ensures that it doesn't
-+ // get persisted or shown in property editors
-+ evtDesc.ScriptType = rtl::OUString::createFromAscii(
-+ "VBAInterop" );
-+ return true;
-+ }
-+ return false;
-+
-+}
-+
-+ScriptEventFactory::ScriptEventFactory()
-+{
-+ Reference < beans::XPropertySet > xProps(
-+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-+ m_xCtx.set( xProps->getPropertyValue( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+ uno::UNO_QUERY_THROW );
-+}
-+rtl::OUString
-+ScriptEventFactory::getControlName( const Reference< XInterface >& rXControl )
-+{
-+ Reference< XInterface > xIfModel;
-+ Reference< awt::XControl > xControl( rXControl, UNO_QUERY );
-+ if ( xControl.is() )
-+ xIfModel = xControl->getModel();
-+ else
-+ xIfModel = rXControl;
-+
-+ Reference< beans::XPropertySet > xProps( xIfModel, UNO_QUERY );
-+ ::rtl::OUString sName;
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ xProps->getPropertyValue(
-+ ::rtl::OUString::createFromAscii("Name") ) >>= sName;
-+ }
-+ catch(Exception& e)
-+ {
-+ OSL_TRACE("PropertyStuff mucked up no name got exception: %s",
-+ (const sal_Char *) rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ));
-+ }
-+ }
-+ return sName;
-+}
-+
-+Sequence< rtl::OUString >
-+ScriptEventFactory::getEventListeners( const Reference< XInterface >& xControl )
-+{
-+ Reference< lang::XMultiComponentFactory > xMFac(
-+ instance().m_xCtx->getServiceManager(), UNO_QUERY );
-+ std::list< rtl::OUString > eventMethods;
-+
-+ if ( xMFac.is() )
-+ {
-+ Reference< beans::XIntrospection > xIntrospection(
-+ xMFac->createInstanceWithContext( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), instance().m_xCtx ), UNO_QUERY );
-+ //dumpListeners( xIntrospection, xControl );
-+ //dumpListeners( xIntrospection, xControl->getModel() );
-+ Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
-+ if ( xIntrospection.is() )
-+ {
-+ xIntrospectionAccess = xIntrospection->inspect(
-+ makeAny( xControl ) );
-+ Sequence< Type > aControlListeners =
-+ xIntrospectionAccess->getSupportedListeners();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+ for ( sal_Int32 i = 0; i< nLength; ++i )
-+ {
-+ Type& listType = aControlListeners[ i ];
-+ rtl::OUString sFullTypeName = listType.getTypeName();
-+ Sequence< ::rtl::OUString > sMeths =
-+ getEventMethods( listType );
-+ sal_Int32 sMethLen = sMeths.getLength();
-+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
-+ {
-+ rtl::OUString sEventMethod = sFullTypeName;
-+ sEventMethod += DELIM;
-+ sEventMethod += sMeths[ j ];
-+ eventMethods.push_back( sEventMethod );
-+ }
-+ }
-+
-+ }
-+ }
-+
-+ Sequence< rtl::OUString > sEventMethodNames( eventMethods.size() );
-+ std::list< rtl::OUString >::const_iterator it = eventMethods.begin();
-+ rtl::OUString* pDest = sEventMethodNames.getArray();
-+
-+ for ( ; it != eventMethods.end(); ++it, ++pDest )
-+ *pDest = *it;
-+
-+ return sEventMethodNames;
-+}
-+
-+Sequence< ScriptEventDescriptor >
-+ScriptEventFactory::createEvents( const Reference< XInterface >& xControl, const rtl::OUString& sLibModName, const Sequence< rtl::OUString >& sHandlerExts )
-+{
-+ Sequence< rtl::OUString > aControlListeners = ScriptEventFactory::instance().getEventListeners( xControl );
-+ rtl::OUString* pSrc = aControlListeners.getArray();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+
-+ Sequence< ScriptEventDescriptor > aDest( nLength * 2 );// sensible default
-+ ScriptEventDescriptor* pDest = aDest.getArray();
-+ sal_Int32 nEvts = 0;
-+
-+
-+ for ( sal_Int32 i = 0; i< nLength; ++i, ++pSrc )
-+ {
-+ // from getListeners eventName is of form
-+ // "com.sun.star.awt.XActionListener::actionPerformed"
-+ // we need to strip "com.sun.star.awt." from that for form
-+ // controls
-+ sal_Int32 lastDotIndex = -1;
-+ ::rtl::OUString sNoNameSpaceMethod = *pSrc;
-+ if ( ( lastDotIndex = pSrc->lastIndexOf( '.' ) ) > -1 )
-+ sNoNameSpaceMethod = sNoNameSpaceMethod.copy( lastDotIndex + 1 );
-+
-+ Sequence< ScriptEventDescriptor > evtDescs;
-+ if ( eventMethodToDescriptors( sNoNameSpaceMethod, xControl, sLibModName, sHandlerExts, evtDescs ) )
-+ {
-+ sal_Int32 dIndex = nEvts;
-+ nEvts += evtDescs.getLength();
-+ ScriptEventDescriptor* pDesc = evtDescs.getArray();
-+ if ( nEvts > aDest.getLength() )
-+ aDest.realloc( nEvts );// should never happen
-+ for ( ; dIndex < nEvts; ++dIndex, ++pDesc )
-+ aDest[ dIndex ] = *pDesc;
-+ }
-+ }
-+ aDest.realloc( nEvts );
-+
-+ return aDest;
-+}
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XNameContainer > NameContainer_BASE;
-+
-+class ReadOnlyEventsNameContainer : public NameContainer_BASE
-+{
-+public:
-+ ReadOnlyEventsNameContainer( const Sequence< rtl::OUString >& eventMethods, const Reference< XInterface >& xControl );
-+ // XNameContainer
-+
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+
-+ }
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+ }
-+
-+ // XNameReplace
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+
-+ }
-+
-+ // XNameAccess
-+ virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException);
-+ virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException);
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (RuntimeException);
-+
-+ // XElementAccess
-+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
-+ { return getCppuType(static_cast< const rtl::OUString * >(0) ); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
-+ { return ( ( m_hEvents.size() > 0 ? sal_True : sal_False ) ); }
-+private:
-+
-+typedef std::hash_map< rtl::OUString, Any, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > EventSupplierHash;
-+
-+ EventSupplierHash m_hEvents;
-+};
-+
-+ReadOnlyEventsNameContainer::ReadOnlyEventsNameContainer( const Sequence< rtl::OUString >& eventMethods, const Reference< XInterface >& xControl )
-+{
-+ const rtl::OUString* pSrc = eventMethods.getConstArray();
-+ sal_Int32 nLen = eventMethods.getLength();
-+ for ( sal_Int32 index = 0; index < nLen; ++index, ++pSrc )
-+ {
-+ Any aDesc;
-+ ScriptEventDescriptor evtDesc;
-+ if ( eventMethodToDescriptor( *pSrc, xControl, evtDesc ) )
-+ {
-+ aDesc <<= evtDesc;
-+ m_hEvents[ *pSrc ] = aDesc;
-+ }
-+ }
-+}
-+
-+Any SAL_CALL
-+ReadOnlyEventsNameContainer::getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException){
-+ EventSupplierHash::const_iterator it = m_hEvents.find( aName );
-+ if ( it == m_hEvents.end() )
-+ throw container::NoSuchElementException();
-+ return it->second;
-+}
-+
-+Sequence< ::rtl::OUString > SAL_CALL
-+ReadOnlyEventsNameContainer::getElementNames( ) throw (RuntimeException)
-+{
-+ Sequence< ::rtl::OUString > names(m_hEvents.size());
-+ rtl::OUString* pDest = names.getArray();
-+ EventSupplierHash::const_iterator it = m_hEvents.begin();
-+ EventSupplierHash::const_iterator it_end = m_hEvents.end();
-+ for ( sal_Int32 index = 0; it != it_end; ++index, ++pDest, ++it )
-+ *pDest = it->first;
-+ return names;
-+}
-+
-+sal_Bool SAL_CALL
-+ReadOnlyEventsNameContainer::hasByName( const ::rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ EventSupplierHash::const_iterator it = m_hEvents.find( aName );
-+ if ( it == m_hEvents.end() )
-+ return sal_False;
-+ return sal_True;
-+}
-+
-+typedef ::cppu::WeakImplHelper1< XScriptEventsSupplier > EventsSupplier_BASE;
-+
-+class ReadOnlyEventsSupplier : public EventsSupplier_BASE
-+{
-+public:
-+ ReadOnlyEventsSupplier( const Sequence< ::rtl::OUString >& eventMethods, const Reference< XInterface >& xControl )
-+ { m_xNameContainer = new ReadOnlyEventsNameContainer( eventMethods, xControl ); }
-+
-+ // XScriptEventSupplier
-+ virtual Reference< container::XNameContainer > SAL_CALL getEvents( ) throw (RuntimeException){ return m_xNameContainer; }
-+private:
-+ Reference< container::XNameContainer > m_xNameContainer;
-+};
-+
-+typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
-+
-+#define EVENTLSTNR_PROPERTY_ID_MODEL 1
-+#define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
-+
-+class EventListener : public EventListener_BASE
-+ ,public ::comphelper::OMutexAndBroadcastHelper
-+ ,public ::comphelper::OPropertyContainer
-+ ,public ::comphelper::OPropertyArrayUsageHelper< EventListener >
-+
-+{
-+public:
-+ EventListener( const Reference< XComponentContext >& rxContext );
-+ // XEventListener
-+ virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( RuntimeException );
-+
-+ // XScriptListener
-+ virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
-+ virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
-+ // XInitialization
-+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
-+ // XInterface
-+ DECLARE_XINTERFACE()
-+
-+ // XTypeProvider
-+ DECLARE_XTYPEPROVIDER()
-+
-+protected:
-+ // OPropertySetHelper
-+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
-+
-+ // OPropertyArrayUsageHelper
-+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-+
-+private:
-+ void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
-+
-+ Reference< XComponentContext > m_xContext;
-+ Reference< frame::XModel > m_xModel;
-+
-+};
-+
-+EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext )
-+{
-+ registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
-+ beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-+
-+}
-+
-+//XEventListener
-+void
-+EventListener::disposing(const lang::EventObject& Source) throw( RuntimeException )
-+{
-+}
-+
-+//XScriptListener
-+
-+void SAL_CALL
-+EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
-+{
-+ firing_Impl( evt );
-+}
-+
-+Any SAL_CALL
-+EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
-+{
-+ Any ret;
-+ firing_Impl( evt, &ret );
-+ return ret;
-+}
-+
-+// XInitialization
-+void SAL_CALL
-+EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
-+{
-+ if ( aArguments.getLength() == 1 )
-+ aArguments[0] >>= m_xModel;
-+ OSL_TRACE("EventListener::initialize() args %d m_xModel %d", aArguments.getLength(), m_xModel.is() );
-+}
-+
-+// XInterface
-+
-+IMPLEMENT_FORWARD_XINTERFACE2( EventListener, EventListener_BASE, OPropertyContainer )
-+
-+// XTypeProvider
-+
-+IMPLEMENT_FORWARD_XTYPEPROVIDER2( EventListener, EventListener_BASE, OPropertyContainer )
-+
-+// OPropertySetHelper
-+
-+::cppu::IPropertyArrayHelper&
-+EventListener::getInfoHelper( )
-+{
-+ return *getArrayHelper();
-+}
-+
-+// OPropertyArrayUsageHelper
-+
-+::cppu::IPropertyArrayHelper*
-+EventListener::createArrayHelper( ) const
-+{
-+ Sequence< beans::Property > aProps;
-+ describeProperties( aProps );
-+ return new ::cppu::OPropertyArrayHelper( aProps );
-+}
-+
-+// XPropertySet
-+Reference< beans::XPropertySetInfo >
-+EventListener::getPropertySetInfo( ) throw (RuntimeException)
-+{
-+ Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+
-+// EventListener
-+
-+void
-+EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
-+{
-+ OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
-+ static const ::rtl::OUString vbaInterOp =
-+ ::rtl::OUString::createFromAscii("VBAInterop");
-+
-+ // let default handlers deal with non vba stuff
-+ if ( !evt.ScriptType.equals( vbaInterOp ) )
-+ return;
-+ lang::EventObject aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("Getting Control");
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Getting properties");
-+ uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sName;
-+ OSL_TRACE("Getting Name");
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ //dumpEvent( evt );
-+ EventInfoHash& infos = getEventTransInfo();
-+ EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-+ EventInfoHash::const_iterator it_end = infos.end();
-+ if ( eventInfo_it == it_end )
-+ {
-+ OSL_TRACE("Bogus event for %s",
-+ rtl::OUStringToOString( evt.ScriptType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return;
-+ }
-+
-+ uno::Reference< script::provider::XScriptProviderSupplier > xSPS( m_xModel, uno::UNO_QUERY );
-+ uno::Reference< script::provider::XScriptProvider > xScriptProvider;
-+ if ( xSPS.is() )
-+ xScriptProvider = xSPS->getScriptProvider();
-+ if ( xScriptProvider.is() )
-+ {
-+ std::list< TranslateInfo > matchingMethods;
-+ std::list< TranslateInfo >::const_iterator txInfo =
-+ eventInfo_it->second.begin();
-+ std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
-+ for ( ; txInfo != txInfo_end; ++txInfo )
-+ {
-+ // see if we have a match for the handlerextension
-+ // where ScriptCode is methodname_handlerextension
-+ rtl::OUString sTemp = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") ).concat( sName ).concat( (*txInfo).sVBAName );
-+
-+ OSL_TRACE("*** trying to invoke %s ",
-+ rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ //if ( sTemp.equals( (*txInfo).sVBAName ) )
-+ {
-+ // !! translate arguments & emulate events where necessary
-+ Sequence< Any > aArguments;
-+ if ( (*txInfo).toVBA )
-+ aArguments = (*txInfo).toVBA( evt.Arguments );
-+ else
-+ aArguments = evt.Arguments;
-+ if ( aArguments.getLength() )
-+ {
-+ // call basic event handlers for event
-+
-+ static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+
-+ // create script url
-+ rtl::OUString url = part1 + sTemp + part2;
-+
-+ OSL_TRACE("script url = %s",
-+ rtl::OUStringToOString( url,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+ Any aRet; // temp
-+ Sequence< sal_Int16 > aOutArgsIndex;
-+ Sequence< Any > aOutArgs;
-+ try
-+ {
-+ uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
-+ if ( xScript.is() )
-+ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-+ }
-+ catch ( uno::Exception& e )
-+ {
-+ OSL_TRACE("event script raised %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+ }
-+ }
-+ }
-+}
-+
-+typedef ::cppu::WeakImplHelper1< XVBAToOOEventDescGen > VBAToOOEventDescGen_BASE;
-+
-+
-+class VBAToOOEventDescGen : public VBAToOOEventDescGen_BASE
-+{
-+public:
-+ VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext );
-+
-+ // XVBAToOOEventDescGen
-+ virtual Sequence< ScriptEventDescriptor > SAL_CALL getEventDescriptions( const Reference< XInterface >& control, const rtl::OUString& sLibModName, const Sequence< rtl::OUString >& sHandlerExts ) throw (RuntimeException);
-+ virtual Reference< XScriptEventsSupplier > SAL_CALL getEventSupplier( const Reference< XInterface >& xControl ) throw (::com::sun::star::uno::RuntimeException);
-+private:
-+ Reference< XComponentContext > m_xContext;
-+
-+};
-+
-+VBAToOOEventDescGen::VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext ):m_xContext( rxContext ) {}
-+
-+Sequence< ScriptEventDescriptor > SAL_CALL
-+VBAToOOEventDescGen::getEventDescriptions( const Reference< XInterface >& xControl, const rtl::OUString& sLibModName, const Sequence< rtl::OUString >& sHandlerExts ) throw (RuntimeException)
-+{
-+ return ScriptEventFactory::instance().createEvents( xControl, sLibModName, sHandlerExts );
-+}
-+
-+Reference< XScriptEventsSupplier > SAL_CALL
-+VBAToOOEventDescGen::getEventSupplier( const Reference< XInterface >& xControl ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ Reference< XScriptEventsSupplier > xSupplier =
-+ new ReadOnlyEventsSupplier(
-+ ScriptEventFactory::instance().getEventListeners( xControl ),
-+ xControl ) ;
-+ return xSupplier;
-+}
-+
-+// Component related
-+
-+namespace evtlstner
-+{
-+ ::rtl::OUString SAL_CALL getImplementationName()
-+ {
-+ static ::rtl::OUString* pImplName = 0;
-+ if ( !pImplName )
-+ {
-+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-+ if ( !pImplName )
-+ {
-+ static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.EventListener" ) );
-+ pImplName = &aImplName;
-+ }
-+ }
-+ return *pImplName;
-+ }
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () )
-+ {
-+ return static_cast< lang::XTypeProvider * >( new EventListener( xContext ) );
-+ }
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
-+ {
-+ const ::rtl::OUString strName( ::evtlstner::getImplementationName() );
-+ return Sequence< ::rtl::OUString >( &strName, 1 );
-+ }
-+}
-+namespace ooevtdescgen
-+{
-+ ::rtl::OUString SAL_CALL getImplementationName()
-+ {
-+ static ::rtl::OUString* pImplName = 0;
-+ if ( !pImplName )
-+ {
-+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-+ if ( !pImplName )
-+ {
-+ static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAToOOEventDesc" ) );
-+ pImplName = &aImplName;
-+ }
-+ }
-+ return *pImplName;
-+ }
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () )
-+ {
-+ return static_cast< lang::XTypeProvider * >( new VBAToOOEventDescGen( xContext ) );
-+ }
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
-+ {
-+ const ::rtl::OUString strName( ::ooevtdescgen::getImplementationName() );
-+ return Sequence< ::rtl::OUString >( &strName, 1 );
-+ }
-+}
diff --git a/patches/test/vba/vbaevents.diff b/patches/test/vba/vbaevents.diff
deleted file mode 100644
index af937fb01..000000000
--- a/patches/test/vba/vbaevents.diff
+++ /dev/null
@@ -1,2550 +0,0 @@
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/VbaEventId.idl 2008-05-28 15:37:18.000000000 +0800
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ *
-+ * $Revision$
-+ *
-+ * last change: $Author$ $Date$
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#ifndef __org_openoffice_vba_VbaEventId_idl__
-+#define __org_openoffice_vba_VbaEventId_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+constants VbaEventId
-+{
-+ // Worksheet
-+ const long VBAEVENT_WORKSHEET_ACTIVATE = 1;
-+ const long VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK = 2;
-+ const long VBAEVENT_WORKSHEET_BEFORERIGHTCLICK = 3;
-+ const long VBAEVENT_WORKSHEET_CALCULATE = 4;
-+ const long VBAEVENT_WORKSHEET_CHANGE = 5;
-+ const long VBAEVENT_WORKSHEET_DEACTIVATE = 6;
-+ const long VBAEVENT_WORKSHEET_FOLLOWHYPERLINK = 7;
-+ const long VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE = 8;
-+ const long VBAEVENT_WORKSHEET_SELECTIONCHANGE = 9;
-+ // Workbook
-+ const long VBAEVENT_WORKBOOK_ACTIVATE = 20;
-+ const long VBAEVENT_WORKBOOK_DEACTIVATE = 21;
-+ const long VBAEVENT_WORKBOOK_OPEN = 22;
-+ const long VBAEVENT_WORKBOOK_AUTOOPEN = 23;
-+ const long VBAEVENT_WORKBOOK_BEFORECLOSE = 24;
-+ const long VBAEVENT_WORKBOOK_BEFOREPRINT = 25;
-+ const long VBAEVENT_WORKBOOK_BEFORESAVE = 26;
-+ const long VBAEVENT_WORKBOOK_NEWSHEET = 27;
-+ const long VBAEVENT_WORKBOOK_WINDOWACTIVATE = 28;
-+ const long VBAEVENT_WORKBOOK_WINDOWDEACTIVATE = 29;
-+ const long VBAEVENT_WORKBOOK_WINDOWRESIZE = 30;
-+ const long VBAEVENT_WORKBOOK_WINDOWCOLSE = 31;
-+ const long VBAEVENT_WORKBOOK_CLOSE = 32;
-+ // Workbook_sheet
-+ const long VBAEVENT_WORKBOOK_SHEET_ACTIVATE = 51;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK = 52;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK = 53;
-+ const long VBAEVENT_WORKBOOK_SHEET_CALCULATE = 54;
-+ const long VBAEVENT_WORKBOOK_SHEET_CHANGE = 55;
-+ const long VBAEVENT_WORKBOOK_SHEET_DEACTIVATE = 56;
-+ const long VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK = 57;
-+ const long VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE = 58;
-+ const long VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE = 59;
-+};
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/XVbaEventsHelper.idl 2008-05-27 17:16:25.000000000 +0800
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ *
-+ * $Revision$
-+ *
-+ * last change: $Author$ $Date$
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#ifndef __org_openoffice_vba_XVbaEventsHelper_idl__
-+#define __org_openoffice_vba_XVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+interface XVbaEventsHelper
-+{
-+ // nTab -1 for workbook.
-+ boolean ProcessCompatibleVbaEvent( [in] long VbaEvent, [in] sequence< any > aArgs );
-+};
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/VbaEventsHelper.idl 2008-05-27 11:46:31.000000000 +0800
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ *
-+ * $Revision$
-+ *
-+ * last change: $Author$ $Date$
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#ifndef __org_openoffice_vba_VbaEventsHelper_idl__
-+#define __org_openoffice_vba_VbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#include <com/sun/star/frame/XModel.idl>
-+#include <com/sun/star/document/XVbaEventsHelper.idl>
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+service VbaEventsHelper : XVbaEventsHelper
-+{
-+ createVbaEventsHelper( [in] ::com::sun::star::frame::XModel xModel );
-+};
-+
-+}; }; }; };
-+
-+#endif
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl 2008-05-28 16:19:12.000000000 +0800
-@@ -0,0 +1,47 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XVbaEventHelper.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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 __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+#define __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+interface XDocumentEventCompatibleHelper
-+{
-+ boolean processCompatibleEvent( [in] short nStatus, [in] short nEventId );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/makefile.mk.bak 2008-05-08 17:24:51.000000000 +0800
-+++ offapi/com/sun/star/document/makefile.mk 2008-05-27 11:44:41.000000000 +0800
-@@ -109,6 +109,10 @@ IDLFILES=\
- DocumentRevisionListPersistence.idl \
- XDocumentLanguages.idl \
- XCodeNameQuery.idl \
-+ XDocumentEventCompatibleHelper.idl \
-+ VbaEventId.idl \
-+ XVbaEventsHelper.idl \
-+ VbaEventsHelper.idl \
-
-
- # ------------------------------------------------------------------
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbaeventshelper.hxx 2008-06-02 13:03:05.000000000 +0800
-@@ -0,0 +1,92 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.hxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBAEVENTS_HXX
-+#define SC_VBAEVENTS_HXX
-+
-+#include "document.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XNameReplace.hpp>
-+#include <com/sun/star/awt/XEnhancedMouseClickHandler.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include "vbahelper.hxx"
-+
-+using namespace com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
-+
-+//class ScTablesHint;
-+class VbaWindowListener;
-+class SfxEventHint;
-+class ImplVbaEventNameInfo;
-+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
-+{
-+private:
-+ ScDocument* pDoc;
-+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+ VbaWindowListener* mpWindowListener;
-+ sal_Bool mbOpened;
-+
-+ String getSheetModuleName( SCTAB nTab );
-+ String workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-+
-+ uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
-+ uno::Any createRange( const uno::Any& aRange );
-+ uno::Any createHyperlink( const uno::Any& rCell );
-+ uno::Any createWindow( SfxObjectShell* pShell );
-+ sal_Bool executeWorkBookMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet );
-+ sal_Bool processVbaEventWithCancel( const sal_Int32 nEventId );
-+ sal_Bool processDocBeforeSaveMacro( sal_Bool bSaveAsUI );
-+ void processVbaEventMacro_noreturn( const sal_Int32 nEventId );
-+ void processVbaEventMacroWithArgs( const sal_Int32 nEventId, uno::Sequence< uno::Any >& rArgs );
-+ void WorkbookWindowMacro( const sal_Int32 nHint );
-+ SCTAB getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos );
-+protected:
-+ rtl::OUString GetEventName( const sal_Int32 nId );
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab );
-+
-+public:
-+ ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mpWindowListener( NULL ), mbOpened( sal_False ){};
-+ ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+ ~ScVbaEventsHelper();
-+ ScDocument* getDocument() { return pDoc; };
-+ sal_Bool executeSheetMacro( USHORT nEvent, SCTAB nTab, uno::Sequence< uno::Any >& rArgs );
-+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 VbaEvent, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException);
-+};
-+
-+#endif
-+
---- /dev/null 2007-05-04 18:54:36.000000000 +0800
-+++ sc/source/ui/vba/vbaeventshelper.cxx 2008-06-02 13:03:14.000000000 +0800
-@@ -0,0 +1,1063 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.cxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * The Contents of this file are made available subject to
-+ * the terms of GNU Lesser General Public License Version 2.1.
-+ *
-+ *
-+ * GNU Lesser General Public License Version 2.1
-+ * =============================================
-+ * Copyright 2005 by Sun Microsystems, Inc.
-+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License version 2.1, as published by the Free Software Foundation.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ *
-+ ************************************************************************/
-+#include "vbaeventshelper.hxx"
-+#include "helperdecl.hxx"
-+#include <sfx2/objsh.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbx.hxx>
-+#include "scextopt.hxx"
-+#include <sfx2/evntconf.hxx>
-+#include <sfx2/event.hxx>
-+#include <sfx2/sfx.hrc>
-+#include <toolkit/unohlp.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/table/XCell.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/sheet/XSpreadsheet.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/awt/XWindowListener.hpp>
-+#include <com/sun/star/awt/WindowEvent.hpp>
-+#include <com/sun/star/awt/XMouseListener.hpp>
-+#include <com/sun/star/awt/MouseEvent.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/awt/MouseButton.hpp>
-+#include "cellsuno.hxx"
-+
-+#include <map>
-+
-+using namespace std;
-+using namespace com::sun::star;
-+using namespace org::openoffice;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+//typedef ::cppu::WeakImplHelper2< awt::XWindowListener, awt::XMouseListener > WindowListener_BASE;
-+typedef ::cppu::WeakImplHelper1< awt::XWindowListener > WindowListener_BASE;
-+
-+class VbaWindowListener : public WindowListener_BASE
-+{
-+ ScVbaEventsHelper* pVbaEventsHelper;
-+ uno::Reference< frame::XModel > m_xModel;
-+ sal_Bool m_bPrepare;
-+protected :
-+ uno::Reference< awt::XWindow > GetContainerWindow();
-+ sal_Bool IsMouseReleased();
-+ DECL_LINK( fireResizeMacro, Timer* );
-+ void processWindowResizeMacro();
-+public :
-+ VbaWindowListener( ScVbaEventsHelper* pHelper );
-+ void startWindowLinstener();
-+ void stopWindowLinstener();
-+ // XWindowListener
-+ virtual void SAL_CALL windowResized( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowMoved( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowShown( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowHidden( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+};
-+VbaWindowListener::VbaWindowListener( ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper )
-+{
-+ m_xModel.set( pVbaEventsHelper->getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-+ m_bPrepare = sal_False;
-+ //m_pTimer = 0;
-+}
-+uno::Reference< awt::XWindow >
-+VbaWindowListener::GetContainerWindow()
-+{
-+ try
-+ {
-+ if( pVbaEventsHelper )
-+ {
-+ if( m_xModel.is() )
-+ {
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_QUERY );
-+ if( xFrame.is() )
-+ {
-+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return xWindow;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return uno::Reference< awt::XWindow >();
-+}
-+sal_Bool
-+VbaWindowListener::IsMouseReleased()
-+{
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow )
-+ {
-+ Window::PointerState aPointerState = pWindow->GetPointerState();
-+ if( !aPointerState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+void
-+VbaWindowListener::startWindowLinstener()
-+{
-+ OSL_TRACE( "VbaWindowListener::startWindowLinstener" );
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ xWindow->addWindowListener( this );
-+}
-+void
-+VbaWindowListener::stopWindowLinstener()
-+{
-+ OSL_TRACE( "VbaWindowListener::stopWindowLinstener" );
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ {
-+ xWindow->removeWindowListener( this );
-+ pVbaEventsHelper = NULL;
-+ }
-+}
-+void
-+VbaWindowListener::processWindowResizeMacro()
-+{
-+ if( pVbaEventsHelper )
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
-+}
-+IMPL_LINK( VbaWindowListener, fireResizeMacro, Timer*, pTimer )
-+{
-+ if( pVbaEventsHelper && m_bPrepare && pTimer )
-+ {
-+ if( IsMouseReleased() )
-+ {
-+ pTimer->Stop();
-+ delete pTimer;
-+ pTimer = 0;
-+ m_bPrepare = sal_False;
-+ OSL_TRACE("\tfiredMacroAtHere");
-+ processWindowResizeMacro();
-+ }
-+ }
-+ return 0;
-+}
-+void SAL_CALL
-+VbaWindowListener::windowResized( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow && !m_bPrepare )
-+ {
-+ m_bPrepare = sal_True;
-+ AutoTimer* pTimer = new AutoTimer();
-+ pTimer->SetTimeoutHdl( LINK( this, VbaWindowListener, fireResizeMacro ) );
-+ pTimer->Start();
-+ OSL_TRACE("\tVbaWindowListener::windowResized");
-+ }
-+}
-+void SAL_CALL
-+VbaWindowListener::windowMoved( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowMoved");
-+}
-+void SAL_CALL
-+VbaWindowListener::windowShown( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowShown");
-+}
-+void SAL_CALL
-+VbaWindowListener::windowHidden( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+ OSL_TRACE("\tVbaWindowListener::windowHidden");
-+}
-+void SAL_CALL
-+VbaWindowListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ OSL_TRACE("\tVbaWindowListener::disposing");
-+ pVbaEventsHelper = NULL;
-+}
-+
-+class ImplVbaEventNameInfo
-+{
-+private:
-+ map< sal_Int32, rtl::OUString > m_aEventNameMap;
-+
-+protected:
-+ static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
-+ ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
-+private:
-+ void insert( const sal_Int32 nId, const rtl::OUString sEventName )
-+ {
-+ m_aEventNameMap.insert( make_pair( nId, sEventName ) );
-+ }
-+ void InitImplVbaEventNameInfo();
-+public:
-+ virtual ~ImplVbaEventNameInfo();
-+ rtl::OUString getEventName( const sal_Int32 nId )
-+ {
-+ map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
-+ if( iter != m_aEventNameMap.end() )
-+ return iter->second;
-+ return rtl::OUString();
-+ }
-+ static ImplVbaEventNameInfo* GetImplVbaEventNameInfo();
-+};
-+ImplVbaEventNameInfo* ImplVbaEventNameInfo::pImplVbaEventNameInfo = NULL;
-+
-+ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
-+{
-+ if( pImplVbaEventNameInfo )
-+ delete pImplVbaEventNameInfo;
-+}
-+
-+ImplVbaEventNameInfo*
-+ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
-+{
-+ if( !pImplVbaEventNameInfo )
-+ {
-+ pImplVbaEventNameInfo = new ImplVbaEventNameInfo;
-+ }
-+ return pImplVbaEventNameInfo;
-+}
-+
-+#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-+
-+#define INSERT_EVENT_INFO( Object, Event, ObjectName, EventName ) \
-+ insert( VBAEVENT_##Object##_##Event, ObjectName + CREATEOUSTRING( EventName ) )
-+
-+#define INSERT_WORKSHEET_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKSHEET, Event,CREATEOUSTRING("Worksheet_"), EventName ); \
-+ INSERT_EVENT_INFO( WORKBOOK_SHEET, Event, CREATEOUSTRING("Workbook_Sheet"), EventName )
-+
-+#define INSERT_WORKBOOK_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKBOOK, Event, CREATEOUSTRING("Workbook_"), EventName )
-+
-+void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
-+{
-+ INSERT_WORKSHEET_EVENT_INFO( ACTIVATE, "Activate");
-+ INSERT_WORKSHEET_EVENT_INFO( BEFOREDOUBLECLICK, "BeforeDoubleClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( BEFORERIGHTCLICK, "BeforeRightClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( CALCULATE, "Calculate" );
-+ INSERT_WORKSHEET_EVENT_INFO( CHANGE, "Change" );
-+ INSERT_WORKSHEET_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKSHEET_EVENT_INFO( FOLLOWHYPERLINK, "FollowHyperlink" );
-+ INSERT_WORKSHEET_EVENT_INFO( PIVOTTABLEUPDATE, "PivotTableUpdate" );
-+ INSERT_WORKSHEET_EVENT_INFO( SELECTIONCHANGE, "SelectionChange" );
-+
-+ // Workbook
-+ INSERT_WORKBOOK_EVENT_INFO( ACTIVATE, "Activate" );
-+ INSERT_WORKBOOK_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( OPEN, "Open" );
-+ // AUTOOPEN doesn't be used. TODO, this should be "auto_open"
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORECLOSE, "BeforeClose" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFOREPRINT, "BeforePrint" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORESAVE, "BeforeSave" );
-+ INSERT_WORKBOOK_EVENT_INFO( NEWSHEET, "NewSheet" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWACTIVATE, "WindowActivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWDEACTIVATE, "WindowDeactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
-+ // VBAEVENT_WORKBOOK_WINDOWCOLSE and VBAEVENT_WORKBOOK_CLOSE doesn't be used
-+}
-+
-+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
-+ : m_xContext( xContext ), mpWindowListener( NULL ), mbOpened( sal_False )
-+{
-+ OSL_TRACE( "ScVbaEventsHelper::ScVbaEventsHelper" );
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ ScDocShell* pDocShell = getDocShell( xModel );
-+ pDoc = pDocShell->GetDocument();
-+}
-+
-+ScVbaEventsHelper::~ScVbaEventsHelper()
-+{
-+ OSL_TRACE("ScVbaEventsHelper::~ScVbaEventsHelper");
-+ if( mpWindowListener )
-+ {
-+ mpWindowListener->stopWindowLinstener();
-+ mpWindowListener = NULL;
-+ }
-+}
-+
-+rtl::OUString
-+ScVbaEventsHelper::GetEventName( const sal_Int32 nId )
-+{
-+ rtl::OUString sEventName;
-+ ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
-+ if( pEventInfo )
-+ sEventName = pEventInfo->getEventName( nId );
-+ return sEventName;
-+}
-+
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool ScVbaEventsHelper::executeWorkBookMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
-+{
-+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-+ // document saved from XL then we won't be able to determine the codename for the Workbook
-+ // Module, so... we have no choice but to search all modules for the moment, thus the macro
-+ // passed in should be the fully specified name.
-+ rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ;
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-+ aOutArgsIndex, aOutArgs, sal_False );
-+
-+ // Script Executed?
-+ if ( nErr != ERRCODE_NONE )
-+ return sal_False;
-+
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+
-+ }
-+ return sal_True;
-+}
-+String ScVbaEventsHelper::workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
-+{
-+ String sFullName;
-+ // would use the script provider to see if the macro exists but
-+ // called at this stage tdoc content handler stuff is not set up
-+ // so it fails
-+
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+
-+ }
-+ }
-+ return sFullName;
-+}
-+
-+sal_Bool ScVbaEventsHelper::processVbaEventWithCancel( const sal_Int32 nEventId )
-+{
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ sal_Bool bCancel = sal_False;
-+ aArgs[ 0 ] <<= bCancel;
-+ processVbaEventMacroWithArgs( nEventId, aArgs );
-+ aArgs[ 0 ] >>= bCancel;
-+ return bCancel;
-+}
-+
-+uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ // Eventually we will be able to pull the Workbook/Worksheet objects
-+ // directly from basic and register them as listeners
-+
-+ // create Workbook
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( pShell->GetModel() );
-+ uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
-+
-+ // create WorkSheet
-+ String sSheetName;
-+ pDoc->GetName( nTab, sSheetName );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[ 0 ] <<= xWorkbook;
-+ aArgs[ 1 ] <<= pShell->GetModel();
-+ aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet") ), aArgs, xCtx );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createRange( const uno::Any& aRange )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aRange, uno::UNO_QUERY );
-+ uno::Reference< table::XCellRange > xRange( aRange, uno::UNO_QUERY );
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ if ( xRanges.is() || xRange.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ if ( xRanges.is() )
-+ {
-+ aArgs[1] <<= xRanges;
-+ }
-+ else if ( xRange.is() )
-+ {
-+ aArgs[1] <<= xRange;
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Range") ), aArgs, xCtx );
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createHyperlink( const uno::Any& rCell )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCell > xCell( rCell, uno::UNO_QUERY );
-+ if( xCell.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ aArgs[1] <<= rCell;
-+
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Hyperlink") ), aArgs, xCtx );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
-+{
-+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ String aCodeName;
-+ pDoc->GetName( nTab, aCodeName);
-+ // Use code name if that exists
-+ if ( pExtOptions )
-+ aCodeName = pExtOptions->GetCodeName( nTab );
-+ return aCodeName;
-+}
-+
-+rtl::OUString
-+ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ rtl::OUString sMacroPath;
-+ rtl::OUString sMacroName = GetEventName( nEventId );
-+ switch( nEventId )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE :
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKSHEET_CALCULATE :
-+ case VBAEVENT_WORKSHEET_CHANGE :
-+ case VBAEVENT_WORKSHEET_DEACTIVATE :
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
-+ {
-+ rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
-+ sMacroPath = workbookMacroExists( pShell, aSheetModuleName, sMacroName );
-+ break;
-+ }
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_OPEN :
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE :
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT :
-+ case VBAEVENT_WORKBOOK_BEFORESAVE :
-+ case VBAEVENT_WORKBOOK_NEWSHEET :
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE :
-+ case VBAEVENT_WORKBOOK_CLOSE :
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ if( pExtOptions )
-+ {
-+ ScExtDocSettings aExtDocSettings = pExtOptions->GetDocSettings();
-+ String sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
-+ sMacroPath = workbookMacroExists( pShell, sWorkbookModuleName, sMacroName );
-+ }
-+ else
-+ {
-+ // TODO need this?
-+ sMacroPath = workbookMacroExists( pShell, rtl::OUString(), sMacroName );
-+ }
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ return sMacroPath;
-+}
-+
-+sal_Bool ScVbaEventsHelper::executeSheetMacro( USHORT nEvent, SCTAB nTab, uno::Sequence< uno::Any >& rArgs )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+
-+ sal_Bool result = sal_False;
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+
-+ rtl::OUString sMacroPath = getMacroPath( nEvent, nTab );
-+ if( sMacroPath.getLength() )
-+ {
-+ switch( nEvent )
-+ {
-+ case VBAEVENT_WORKSHEET_ACTIVATE:
-+ case VBAEVENT_WORKSHEET_CALCULATE:
-+ case VBAEVENT_WORKSHEET_DEACTIVATE:
-+ {
-+ // no arguments
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ {
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE:
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
-+ {
-+ // one argument: range
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aRange;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aRange;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
-+ {
-+ // two aruments: range and cancel
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = aRange;
-+ aArgs[1] = rArgs[1];
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ // return the cancel value
-+ rArgs[1] = aArgs[1];
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aRange;
-+ aArgs[2] = aArgs[1];
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ rArgs[2] = aArgs[2];
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
-+ {
-+ // one argument: hyperlink
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aHyperlink;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ {
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aHyperlink;
-+ result = executeWorkBookMacro( pShell, sMacroPath, aArgs, aRet );
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
-+ {
-+ // one argument: pivottable
-+ break;
-+ }
-+ }
-+ }
-+
-+ return result;
-+}
-+
-+uno::Any ScVbaEventsHelper::createWindow( SfxObjectShell* pShell )
-+{
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aWindowArgs(2);
-+ aWindowArgs[0] = uno::Any( uno::Reference< uno::XInterface > () );
-+ aWindowArgs[1] = uno::Any( xModel );
-+ uno::Reference< uno::XInterface > xWindow( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Window" ) ), aWindowArgs ), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return uno::makeAny( xWindow );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return uno::Any();
-+}
-+
-+void ScVbaEventsHelper::processVbaEventMacro_noreturn( const sal_Int32 nEventId )
-+{
-+ uno::Sequence< uno::Any > aArgs;
-+ processVbaEventMacroWithArgs( nEventId, aArgs );
-+}
-+
-+void ScVbaEventsHelper::processVbaEventMacroWithArgs( const sal_Int32 nEventId, uno::Sequence< uno::Any >& rArgs )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
-+ return;
-+
-+ String sMacroName = GetEventName( nEventId );
-+ if( sMacroName.Len() > 0 )
-+ {
-+ uno::Any aRet;
-+ String sMacro = workbookMacroExists( pShell, String(), sMacroName );
-+ if ( sMacro.Len() > 0 )
-+ {
-+ executeWorkBookMacro( pShell, sMacro, rArgs, aRet );
-+ }
-+ }
-+}
-+
-+void ScVbaEventsHelper::WorkbookWindowMacro( const sal_Int32 nHint )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
-+ return;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ uno::Any aElement = createWindow( pShell );
-+ aArgs[0] = aElement;
-+ switch( nHint )
-+ {
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ // it will be called when close the doc. but should not launch the macro.
-+ processVbaEventMacroWithArgs( nHint, aArgs );
-+ break;
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE:
-+ // ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, uno::Sequence< uno::Any >() );
-+ // does Doc be closed surely? if yes. should frie the workbook deactivate event.
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, uno::Sequence< uno::Any >() );
-+ break;
-+ default:
-+ break;
-+ }
-+}
-+
-+sal_Bool ScVbaEventsHelper::processDocBeforeSaveMacro( sal_Bool bSaveAsUI )
-+{
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ sal_Bool bCancel = sal_False;
-+ aArgs[ 0 ] <<= bSaveAsUI;
-+ aArgs[ 1 ] <<= bCancel;
-+ processVbaEventMacroWithArgs( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ aArgs[ 1 ] >>= bCancel;
-+ return bCancel;
-+}
-+
-+SCTAB
-+ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos )
-+{
-+ SCTAB nTab = -1;
-+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( getXSomethingFromArgs< sheet::XCellRangeAddressable >( aArgs, nPos ), uno::UNO_QUERY );
-+ if( xCellRangeAddressable.is() )
-+ {
-+ table::CellRangeAddress aAddress = xCellRangeAddressable->getRangeAddress();
-+ nTab = aAddress.Sheet;
-+ }
-+ return nTab;
-+}
-+
-+#define INVALID_TAB -1
-+
-+sal_Bool SAL_CALL
-+ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 VbaEvent, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell )
-+ return sal_False;
-+
-+ sal_Int32 nTab = INVALID_TAB;
-+ uno::Sequence< uno::Any > aTmpArgs( aArgs );
-+ switch( VbaEvent )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ // recursive call related workbook sheet event.
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_ACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CALCULATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CALCULATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_DEACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
-+ // TODO
-+ break;
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ {
-+ if( aArgs[0] >>= nTab )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
-+ // TODO
-+ break;
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ nTab = getTabFromArgs( aTmpArgs, 0 );
-+ if( nTab > INVALID_TAB )
-+ {
-+ executeSheetMacro( (USHORT)VbaEvent, (SCTAB)nTab, aTmpArgs );
-+ }
-+ break;
-+ }
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE :
-+ {
-+ // if workbook open event do not be fired. fired it before
-+ // workbook activate event to compatible with MSO.
-+ if( !mbOpened )
-+ {
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_OPEN, aArgs );
-+ }
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_ACTIVATE );
-+ // workbook window activate event same as this one
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWACTIVATE, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_DEACTIVATE :
-+ {
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_DEACTIVATE );
-+ // same as workbook window deactivate
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_OPEN :
-+ {
-+ // process workbook open macro
-+ // does auto open work here?
-+ //WorkbookAutoOpen();
-+ if( !mbOpened )
-+ {
-+ processVbaEventMacro_noreturn( VBAEVENT_WORKBOOK_OPEN );
-+ mbOpened = sal_True;
-+ }
-+ // register the window listener.
-+ if( !mpWindowListener )
-+ {
-+ mpWindowListener = new VbaWindowListener( this );
-+ mpWindowListener->startWindowLinstener();
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
-+ break;
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE :
-+ {
-+ sal_Bool bCancel = processVbaEventWithCancel( VbaEvent );
-+ if( mpWindowListener && !bCancel )
-+ {
-+ mpWindowListener->stopWindowLinstener();
-+ mpWindowListener = NULL;
-+ }
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT :
-+ {
-+ return processVbaEventWithCancel( VbaEvent );
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORESAVE :
-+ {
-+ sal_Bool bUISave = sal_Bool();
-+ if( aArgs.getLength() && ( aArgs[0] >>= bUISave ) )
-+ return processDocBeforeSaveMacro( bUISave );
-+ }
-+ case VBAEVENT_WORKBOOK_NEWSHEET :
-+ {
-+ SCTAB nTabNum;
-+ if( aArgs.getLength() && ( aArgs[0] >>= nTabNum ) )
-+ {
-+ uno::Sequence< uno::Any > rArgs(1);
-+ rArgs[0] = createWorkSheet( pShell, nTabNum );
-+ processVbaEventMacroWithArgs( VBAEVENT_WORKBOOK_NEWSHEET, rArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ case VBAEVENT_WORKBOOK_WINDOWCOLSE :
-+ WorkbookWindowMacro( VbaEvent );
-+ break;
-+ case VBAEVENT_WORKBOOK_CLOSE :
-+ break;
-+ default:
-+ OSL_TRACE( "Invalid Event" );
-+ }
-+
-+ return sal_True;
-+}
-+
-+namespace vbaeventshelper
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<ScVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaEventsHelper",
-+ "com.sun.star.document.VbaEventsHelper" );
-+}
---- sc/source/ui/vba/service.cxx.orig 2008-05-13 16:48:00.000000000 +0800
-+++ sc/source/ui/vba/service.cxx 2008-05-13 22:54:36.000000000 +0800
-@@ -69,6 +69,10 @@ namespace hyperlink
- {
- extern sdecl::ServiceDecl const serviceDecl;
- }
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-
-
- extern "C"
-@@ -87,7 +91,7 @@ extern "C"
-
- // Component registration
- if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
-- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) )
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
- {
- // Singleton registration
- try
-@@ -116,6 +120,8 @@ extern "C"
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl );
-+ if( !pRet )
-+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
---- sc/inc/document.hxx.orig 2008-05-07 12:06:10.000000000 +0800
-+++ sc/inc/document.hxx 2008-05-27 12:15:49.000000000 +0800
-@@ -42,6 +42,7 @@
- #include "brdcst.hxx"
- #include "tabopparams.hxx"
- #include "grammar.hxx"
-+//#include <org/openoffice/vba/XVBAWorkbookEventHelper.hpp>
-
- #include <memory>
- #include <map>
-@@ -132,6 +133,7 @@ class ScAutoNameCache;
- class ScTemporaryChartLock;
- class ScLookupCache;
- struct ScLookupCacheMapImpl;
-+//class ScVbaEventsHelper;
-
- namespace com { namespace sun { namespace star {
- namespace lang {
-@@ -149,6 +151,9 @@ namespace com { namespace sun { namespac
- }
- } } }
-
-+namespace com { namespace sun { namespace star { namespace document {
-+ class XVbaEventsHelper;
-+} } } }
- #include <svtools/zforlist.hxx>
- /*
- #ifdef _ZFORLIST_DECLARE_TABLE
-@@ -307,6 +312,9 @@ private:
-
- Timer aTrackTimer;
-
-+ //ScVbaEventsHelper* pVbaEventsHelper;
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > rVbaEventsHelper;
-+
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -1717,6 +1725,8 @@ public:
- void GetSortParam( ScSortParam& rParam, SCTAB nTab );
- void SetSortParam( ScSortParam& rParam, SCTAB nTab );
-
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-+
- /** Should only be GRAM_PODF or GRAM_ODFF. */
- void SetStorageGrammar( ScGrammar::Grammar eGrammar );
- ScGrammar::Grammar GetStorageGrammar() const
---- sc/source/core/data/documen2.cxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/core/data/documen2.cxx 2008-06-02 13:45:47.000000000 +0800
-@@ -93,6 +93,7 @@
- #include "listenercalls.hxx"
- #include "recursionhelper.hxx"
- #include "lookupcache.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
- // dtor is convenient.
-@@ -146,6 +147,7 @@ ScDocument::ScDocument( ScDocumentMode e
- pRecursionHelper( NULL ),
- pAutoNameCache( NULL ),
- pLookupCacheMapImpl( NULL ),
-+ //rVbaEventsHelper( NULL ),
- nUnoObjectId( 0 ),
- nRangeOverflowType( 0 ),
- aCurTextWidthCalcPos(MAXCOL,0,0),
-@@ -434,6 +436,12 @@ ScDocument::~ScDocument()
- delete pOtherObjects;
- delete pRecursionHelper;
-
-+ /*if( rVbaEventsHelper )
-+ {
-+ delete pVbaEventsHelper;
-+ pVbaEventsHelper = NULL;
-+ }*/
-+
- DBG_ASSERT( !pAutoNameCache, "AutoNameCache still set in dtor" );
- }
-
-@@ -1857,3 +1865,26 @@ void ScDocument::RemoveLookupCache( ScLo
- EndListeningArea( pCache->getRange(), &rCache);
- }
- }
-+
-+using namespace com::sun::star;
-+uno::Reference< document::XVbaEventsHelper >
-+ScDocument::GetVbaEventsHelper()
-+{
-+ if( !rVbaEventsHelper.is() )
-+ {
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( xModel );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.VbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ // helper will always be created successfully.
-+ rVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ return rVbaEventsHelper;
-+}
---- sc/source/core/data/documen7.cxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/core/data/documen7.cxx 2008-06-02 13:46:02.000000000 +0800
-@@ -59,7 +59,15 @@
-
-
- #include "globstr.hrc"
-+#include <algorithm>
-+#include <vector>
-
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- extern const ScFormulaCell* pLastFormulaTreeTop; // cellform.cxx Err527 WorkAround
-
- // STATIC DATA -----------------------------------------------------------
-@@ -449,6 +457,7 @@ void ScDocument::TrackFormulas( ULONG nH
- ScFormulaCell* pTrack;
- ScFormulaCell* pNext;
- pTrack = pFormulaTrack;
-+ ::std::vector<SCTAB> aTabs;
- do
- {
- ScHint aHint( nHintId, pTrack->aPos, pTrack );
-@@ -458,6 +467,12 @@ void ScDocument::TrackFormulas( ULONG nH
- // Repaint fuer bedingte Formate mit relativen Referenzen:
- if ( pCondFormList )
- pCondFormList->SourceChanged( pTrack->aPos );
-+ ::std::vector<SCTAB>::iterator result;
-+ result = ::std::find( aTabs.begin(), aTabs.end(), pTrack->aPos.Tab() );
-+ if( result == aTabs.end() )
-+ {
-+ aTabs.push_back( pTrack->aPos.Tab() );
-+ }
- pTrack = pTrack->GetNextTrack();
- } while ( pTrack );
- pTrack = pFormulaTrack;
-@@ -480,6 +495,18 @@ void ScDocument::TrackFormulas( ULONG nH
- else
- SetForcedFormulaPending( TRUE );
- }
-+
-+ ::std::vector<SCTAB>::iterator iter;
-+ for( iter = aTabs.begin(); iter != aTabs.end(); iter++ )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= *iter;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CALCULATE, aArgs );
-+ }
-+ }
- }
- DBG_ASSERT( nFormulaTrackCount==0, "TrackFormulas: nFormulaTrackCount!=0" );
- }
---- sc/source/core/tool/makefile.mk.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/core/tool/makefile.mk 2008-05-13 13:47:37.000000000 +0800
-@@ -158,3 +158,11 @@ $(INCCOM)$/osversiondef.hxx :
-
- $(SLO)$/interpr5.obj : $(INCCOM)$/osversiondef.hxx
-
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
---- sc/source/ui/docshell/docsh.cxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/ui/docshell/docsh.cxx 2008-06-02 13:46:41.000000000 +0800
-@@ -131,6 +131,13 @@
- #include <rtl/logfile.hxx>
-
- #include <comphelper/processfactory.hxx>
-+#include "uiitems.hxx"
-+#include "cellsuno.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- using namespace com::sun::star;
-
-@@ -719,9 +726,70 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
- return bRet;
- }
-
-+void lcl_processCompatibleSfxHint( uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if (rHint.ISA(ScTablesHint) )
-+ {
-+ USHORT nId = ((ScTablesHint&)rHint).GetId();
-+ SCTAB nTab = ((ScTablesHint&)rHint).GetTab1();
-+ if( nId == SC_TAB_INSERTED )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= nTab;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_NEWSHEET, aArgs );
-+ }
-+ }
-+ else if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch ( nEventId )
-+ {
-+ case SFX_EVENT_ACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_DEACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_CLOSEDOC :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_CLOSE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_CLOSEVIEW :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWCOLSE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ // some later than workbook activate.
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_OPEN, aArgs );
-+ }
-+ break;
-+ default:
-+ {
-+ }
-+ break;
-+ }
-+ }
-+}
-
- void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ {
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-+ }
- if (rHint.ISA(SfxSimpleHint)) // ohne Parameter
- {
- ULONG nSlot = ((const SfxSimpleHint&)rHint).GetId();
-@@ -2246,6 +2314,16 @@ USHORT __EXPORT ScDocShell::PrepareClose
-
- DoEnterHandler();
-
-+ // start handler for possible veto from DocBefore_Close
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ {
-+ if ( !IsInPrepareClose() && xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORECLOSE, aArgs ) )
-+ return sal_False;
-+ }
-+ // end handler code
-+
- USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
- if (nRet == TRUE) // TRUE = schliessen
- aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
-@@ -2455,6 +2533,43 @@ void ScDocShell::SetModified( BOOL bModi
- }
- }
-
-+void ScDocShell::PostContentChanged( const ScRange& rRange )
-+{
-+// OSL_TRACE("ScDocShell::PostContentChanged. Changed Range Address: nTab1 = %d, nCol1 = %d, nRow1 = %d; nTab2 = %d, nCol2 = %d, nRow2 = %d;", rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row() );
-+
-+ ScRangeList aList;
-+ aList.Append(rRange);
-+ PostContentChanged(aList);
-+}
-+
-+void ScDocShell::PostContentChanged( const ScRangeList& rList )
-+{
-+#if 0
-+ String aStr;
-+ rList.Format(aStr, SCR_ABS, &aDocument, ScAddress::CONV_XL_A1);
-+ fprintf(stdout, "ScDocShell::PostContentChanged: range = '%s'\n",
-+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+#endif
-+
-+ ScCellRangesBase* pObj = NULL;
-+ const ScRange& rRange = *(rList.GetObject(0));
-+ if( rList.Count() == 1 )
-+ {
-+ if (rRange.aStart == rRange.aEnd)
-+ pObj = new ScCellObj( this, rRange.aStart );
-+ else
-+ pObj = new ScCellRangeObj( this, rRange );
-+ }
-+ else
-+ pObj = new ScCellRangesObj( this, rList );
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+}
-
- void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
- {
---- sc/source/ui/inc/docsh.hxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/ui/inc/docsh.hxx 2008-05-19 15:39:24.000000000 +0800
-@@ -47,6 +47,7 @@
- #include "refreshtimer.hxx"
-
- #include <hash_map>
-+#include <cppuhelper/implbase1.hxx>
-
- class ScEditEngineDefaulter;
- class FontList;
-@@ -326,6 +327,8 @@ public:
- void PostPaintExtras();
-
- void PostDataChanged();
-+ void PostContentChanged( const ScRange& rRange ); // for worsheet/workbook changed event
-+ void PostContentChanged( const ScRangeList& rList );
-
- void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
---- sc/source/ui/undo/undoblk3.cxx.orig 2008-05-30 17:56:31.000000000 +0800
-+++ sc/source/ui/undo/undoblk3.cxx 2008-05-30 17:57:03.000000000 +0800
-@@ -79,7 +79,17 @@ TYPEINIT1(ScUndoInsertAreaLink, SfxUndo
- TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
- TYPEINIT1(ScUndoUpdateAreaLink, SfxUndoAction);
-
--
-+void lcl_PostContentChanged( ScDocShell* pDocShell, const ScMarkData& rMark, const ScRange& rRange )
-+{
-+ if (rMark.IsMarked() || rMark.IsMultiMarked())
-+ {
-+ ScRangeList aList;
-+ rMark.FillRangeListWithMarks(&aList, false);
-+ pDocShell->PostContentChanged(aList);
-+ }
-+ else
-+ pDocShell->PostContentChanged( rRange );
-+}
- // To Do:
- /*A*/ // SetOptimalHeight auf Dokument, wenn keine View
-
-@@ -113,6 +123,8 @@ ScUndoDeleteContents::ScUndoDeleteConten
- aMarkData.SetMarkArea( aRange ); // Zelle unter Cursor markieren
-
- SetChangeTrack();
-+
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
-@@ -213,6 +225,7 @@ void __EXPORT ScUndoDeleteContents::Undo
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
-@@ -223,6 +236,7 @@ void __EXPORT ScUndoDeleteContents::Redo
- BeginRedo();
- DoChange( FALSE );
- EndRedo();
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
---- sc/source/ui/undo/undoblk.cxx.orig 2008-05-30 17:56:23.000000000 +0800
-+++ sc/source/ui/undo/undoblk.cxx 2008-05-30 17:57:03.000000000 +0800
-@@ -125,6 +125,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
- }
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- __EXPORT ScUndoInsertCells::~ScUndoInsertCells()
-@@ -271,6 +272,7 @@ void __EXPORT ScUndoInsertCells::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- void __EXPORT ScUndoInsertCells::Redo()
-@@ -279,6 +281,7 @@ void __EXPORT ScUndoInsertCells::Redo()
- BeginRedo();
- DoChange( FALSE );
- EndRedo();
-+ pDocShell->PostContentChanged( aEffRange );
-
- if ( pPasteUndo )
- pPasteUndo->Redo(); // redo paste last
-@@ -333,6 +336,7 @@ ScUndoDeleteCells::ScUndoDeleteCells( Sc
- }
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- __EXPORT ScUndoDeleteCells::~ScUndoDeleteCells()
-@@ -474,6 +478,7 @@ void __EXPORT ScUndoDeleteCells::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aEffRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-
- // Markierung erst nach EndUndo
-@@ -488,6 +493,7 @@ void __EXPORT ScUndoDeleteCells::Redo()
- BeginRedo();
- DoChange( FALSE);
- EndRedo();
-+ pDocShell->PostContentChanged( aEffRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-@@ -714,6 +720,7 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDo
- aExtendedRange( aRange )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- __EXPORT ScUndoCut::~ScUndoCut()
-@@ -778,6 +785,7 @@ void __EXPORT ScUndoCut::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Redo()
-@@ -788,6 +796,7 @@ void __EXPORT ScUndoCut::Redo()
- DoChange( FALSE );
- EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
- EndRedo();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Repeat(SfxRepeatTarget& rTarget)
-@@ -839,6 +848,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pN
- aPasteOptions = *pOptions; // used only for Repeat
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aBlockRange );
- }
-
- __EXPORT ScUndoPaste::~ScUndoPaste()
-@@ -1020,6 +1030,7 @@ void __EXPORT ScUndoPaste::Undo()
- DoChange( TRUE );
- ShowTable( aBlockRange );
- EndUndo();
-+ pDocShell->PostContentChanged( aBlockRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
- }
-
-@@ -1031,6 +1042,7 @@ void __EXPORT ScUndoPaste::Redo()
- DoChange( FALSE );
- EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
- EndRedo();
-+ pDocShell->PostContentChanged( aBlockRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
- }
-
---- sc/source/ui/undo/undocell.cxx.orig 2008-05-30 17:56:08.000000000 +0800
-+++ sc/source/ui/undo/undocell.cxx 2008-05-30 17:57:03.000000000 +0800
-@@ -214,6 +214,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
- nCount( nNewCount )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- }
-
- __EXPORT ScUndoEnterData::~ScUndoEnterData()
-@@ -319,6 +320,7 @@ void __EXPORT ScUndoEnterData::Undo()
-
- DoChange();
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- }
-
- void __EXPORT ScUndoEnterData::Redo()
-@@ -340,6 +342,7 @@ void __EXPORT ScUndoEnterData::Redo()
-
- DoChange();
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- }
-
- void __EXPORT ScUndoEnterData::Repeat(SfxRepeatTarget& rTarget)
-@@ -371,6 +374,7 @@ ScUndoEnterValue::ScUndoEnterValue( ScDo
- bNeedHeight ( bHeight )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- __EXPORT ScUndoEnterValue::~ScUndoEnterValue()
-@@ -425,6 +429,7 @@ void __EXPORT ScUndoEnterValue::Undo()
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoEnterValue::Redo()
-@@ -438,6 +443,7 @@ void __EXPORT ScUndoEnterValue::Redo()
- SetChangeTrack();
-
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoEnterValue::Repeat(SfxRepeatTarget& /* rTarget */)
-@@ -465,6 +471,7 @@ ScUndoPutCell::ScUndoPutCell( ScDocShell
- bNeedHeight ( bHeight )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- __EXPORT ScUndoPutCell::~ScUndoPutCell()
-@@ -521,6 +528,7 @@ void __EXPORT ScUndoPutCell::Undo()
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoPutCell::Redo()
-@@ -549,6 +557,7 @@ void __EXPORT ScUndoPutCell::Redo()
- SetChangeTrack();
-
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoPutCell::Repeat(SfxRepeatTarget& /* rTarget */)
---- sc/source/ui/unoobj/viewuno.cxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/ui/unoobj/viewuno.cxx 2008-05-30 16:07:06.000000000 +0800
-@@ -71,8 +71,12 @@
- #include "gridwin.hxx"
- #include <com/sun/star/view/DocumentZoomType.hpp>
- #include "AccessibilityHints.hxx"
-+#include <com/sun/star/awt/MouseButton.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- //------------------------------------------------------------------------
-
-@@ -480,7 +484,6 @@ ScTabViewObj::ScTabViewObj( ScTabViewShe
- aActivationListeners( 0 ),
- bDrawSelModeSet(sal_False)
- {
-- //! Listening oder so
- }
-
- ScTabViewObj::~ScTabViewObj()
-@@ -1206,36 +1209,67 @@ sal_Bool ScTabViewObj::MousePressed( con
- {
- sal_Bool bReturn(sal_False);
-
-- if (aMouseClickHandlers.Count())
-- {
-- uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
-+ uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
-
-- if (xTarget.is())
-- {
-- awt::EnhancedMouseEvent aMouseEvent;
-+ if (xTarget.is())
-+ {
-+ // Handle BeforeDoubleClick and BeforeRightClick events
-+ uno::Reference<table::XCell> xCell( xTarget, uno::UNO_QUERY );
-+ if( xCell.is() )
-+ {
-+ ScTabViewShell* pViewSh = GetViewShell();
-+ if ( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if ( pViewData )
-+ {
-+ if( e.ClickCount == 2 || e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(2);
-+ sal_Bool bCancel = sal_False;
-+ aArgs[0] = getSelection();
-+ aArgs[1] <<= bCancel;
-+
-+ USHORT nEvent = VBAEVENT_WORKSHEET_BEFORERIGHTCLICK;
-+ if( e.ClickCount == 2 )
-+ nEvent = VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( nEvent, aArgs );
-+
-+ // TODO... handle the cancel argument
-+ aArgs[1] >>= bCancel;
-+ }
-+ }
-+ }
-+ }
-+ }
-+
-+ awt::EnhancedMouseEvent aMouseEvent;
-
-- aMouseEvent.Buttons = e.Buttons;
-- aMouseEvent.X = e.X;
-- aMouseEvent.Y = e.Y;
-- aMouseEvent.ClickCount = e.ClickCount;
-- aMouseEvent.PopupTrigger = e.PopupTrigger;
-- aMouseEvent.Target = xTarget;
-+ aMouseEvent.Buttons = e.Buttons;
-+ aMouseEvent.X = e.X;
-+ aMouseEvent.Y = e.Y;
-+ aMouseEvent.ClickCount = e.ClickCount;
-+ aMouseEvent.PopupTrigger = e.PopupTrigger;
-+ aMouseEvent.Target = xTarget;
-
-- for ( USHORT n=0; n<aMouseClickHandlers.Count(); n++ )
-+ for ( USHORT n=0; n<aMouseClickHandlers.Count(); n++ )
-+ {
-+ try
- {
-- try
-- {
-- if (!(*aMouseClickHandlers[n])->mousePressed( aMouseEvent ))
-- bReturn = sal_True;
-- }
-- catch ( uno::Exception& )
-- {
-- aMouseClickHandlers.DeleteAndDestroy(n);
-- --n; // because it will be increased again in the loop
-- }
-+ if (!(*aMouseClickHandlers[n])->mousePressed( aMouseEvent ))
-+ bReturn = sal_True;
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ aMouseClickHandlers.DeleteAndDestroy(n);
-+ --n; // because it will be increased again in the loop
- }
- }
- }
-+
- return bReturn;
- }
-
-@@ -1709,6 +1743,22 @@ void SAL_CALL ScTabViewObj::removeSelect
-
- void ScTabViewObj::SelectionChanged()
- {
-+ ScTabViewShell* pViewSh = GetViewShell();
-+ if ( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if ( pViewData )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = getSelection();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ }
-+ }
-+
- lang::EventObject aEvent;
- aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
- for ( USHORT n=0; n<aSelectionListeners.Count(); n++ )
---- sc/source/ui/unoobj/docuno.cxx.orig 2008-05-19 10:34:38.000000000 +0800
-+++ sc/source/ui/unoobj/docuno.cxx 2008-05-27 21:57:27.000000000 +0800
-@@ -92,7 +92,12 @@
- #include "rangeutl.hxx"
- #include "ViewSettingsSequenceDefines.hxx"
-
-+#define BEFORE 0
-+#define AFTER 1
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- //------------------------------------------------------------------------
-
-@@ -329,6 +334,7 @@ uno::Any SAL_CALL ScModelObj::queryInter
- SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- SC_QUERYINTERFACE( beans::XPropertySet )
- SC_QUERYINTERFACE( document::XCodeNameQuery )
-+ SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
- SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- SC_QUERYINTERFACE( lang::XServiceInfo )
-
-@@ -1730,6 +1736,52 @@ ScModelObj::getCodeNameForObject( const
- // Probably should throw here ( if !bMatched )
- return sCodeName;
- }
-+// XVbaEventHelper
-+// For Vba Event
-+// status, 0 before, 1 done...
-+sal_Bool SAL_CALL
-+ScModelObj::processCompatibleEvent( sal_Int16 nStatus, sal_Int16 nSlotId ) throw( ::com::sun::star::uno::RuntimeException )
-+{
-+ USHORT nId = nSlotId;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ switch( nId )
-+ {
-+ case SID_SAVEDOC:
-+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_False;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ break;
-+ }
-+ case SID_SAVEASDOC:
-+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_True;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ break;
-+ }
-+ case SID_PRINTDOC:
-+ case SID_PRINTDOCDIRECT:
-+ {
-+ if( nStatus == BEFORE )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFOREPRINT, aArgs );
-+ }
-+ break;
-+ }
-+ }
-+ return sal_False;
-+ }
-+}
- // XServiceInfo
-
- rtl::OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException)
---- sc/inc/docuno.hxx.orig 2008-05-19 15:34:55.000000000 +0800
-+++ sc/inc/docuno.hxx 2008-05-27 15:29:50.000000000 +0800
-@@ -55,6 +55,7 @@
- #include <com/sun/star/sheet/XSheetAnnotations.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/sheet/XCellRangesAccess.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
-@@ -89,6 +90,7 @@ class SC_DLLPUBLIC ScModelObj : public S
- public com::sun::star::document::XLinkTargetSupplier,
- public com::sun::star::beans::XPropertySet,
- public com::sun::star::document::XCodeNameQuery,
-+ public com::sun::star::document::XDocumentEventCompatibleHelper,
- public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo
- {
-@@ -303,6 +305,8 @@ public:
- throw(::com::sun::star::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
- throw(::com::sun::star::uno::RuntimeException);
-+ // XVbaEventHelper
-+ virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nStatus, sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
- };
-
-
---- sc/source/ui/view/gridwin.cxx.orig 2008-05-07 12:06:10.000000000 +0800
-+++ sc/source/ui/view/gridwin.cxx 2008-06-02 13:46:55.000000000 +0800
-@@ -149,7 +149,13 @@
- #include <svx/sdr/overlay/overlaymanager.hxx>
- #include <vcl/svapp.hxx>
-
-+#include "cellsuno.hxx"
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Any;
-
-@@ -398,6 +404,32 @@ void lcl_UnLockComment( SdrView* pView,
-
- }
-
-+sal_Bool lcl_GetHyperlinkCell(ScDocument* pDoc, SCCOL& rPosX, SCROW& rPosY, SCTAB nTab, ScBaseCell*& rpCell )
-+{
-+ BOOL bFound = FALSE;
-+ do
-+ {
-+ pDoc->GetCell( rPosX, rPosY, nTab, rpCell );
-+ if ( !rpCell || rpCell->GetCellType() == CELLTYPE_NOTE )
-+ {
-+ if ( rPosX <= 0 )
-+ return FALSE; // alles leer bis links
-+ else
-+ --rPosX; // weitersuchen
-+ }
-+ else if ( rpCell->GetCellType() == CELLTYPE_EDIT)
-+ bFound = TRUE;
-+ else if (rpCell->GetCellType() == CELLTYPE_FORMULA &&
-+ static_cast<ScFormulaCell*>(rpCell)->IsHyperLinkCell())
-+ bFound = TRUE;
-+ else
-+ return FALSE; // andere Zelle
-+ }
-+ while ( !bFound );
-+
-+ return bFound;
-+}
-+
- //==================================================================
-
- // WB_DIALOGCONTROL noetig fuer UNO-Controls
-@@ -1442,6 +1474,7 @@ void ScGridWindow::HandleMouseButtonDown
- SCCOL nOldColFBox = bWasFilterBox ? pFilterBox->GetCol() : 0;
- SCROW nOldRowFBox = bWasFilterBox ? pFilterBox->GetRow() : 0;
- #endif
-+#include "cellsuno.hxx"
-
- ClickExtern(); // loescht FilterBox, wenn vorhanden
-
-@@ -2122,6 +2155,26 @@ void __EXPORT ScGridWindow::MouseButtonU
- {
- nMouseStatus = SC_GM_NONE; // keinen Doppelklick anfangen
- ScGlobal::OpenURL( aUrl, aTarget );
-+
-+ // fire worksheet_followhyperlink event
-+ Point aPos = rMEvt.GetPosPixel();
-+ SCsCOL nPosX;
-+ SCsROW nPosY;
-+ SCTAB nTab = pViewData->GetTabNo();
-+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
-+ ScBaseCell* pCell = NULL;
-+
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( bFound )
-+ {
-+ ScAddress aCellPos( nPosX, nPosY, nTab );
-+ ScCellObj* pObj = new ScCellObj( pViewData->GetDocShell(), aCellPos );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_FOLLOWHYPERLINK, aArgs );
-+ }
- return;
- }
- }
-@@ -2441,13 +2494,13 @@ long ScGridWindow::PreNotify( NotifyEven
- if (xController.is())
- {
- ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
-- if (pImp && pImp->IsMouseListening())
-+ if (pImp)
- {
- ::com::sun::star::awt::MouseEvent aEvent;
- lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() );
- if ( rNEvt.GetWindow() )
- aEvent.Source = rNEvt.GetWindow()->GetComponentInterface();
-- if ( nType == EVENT_MOUSEBUTTONDOWN)
-+ if ( nType == EVENT_MOUSEBUTTONDOWN )
- pImp->MousePressed( aEvent );
- else
- pImp->MouseReleased( aEvent );
-@@ -4857,26 +4910,9 @@ BOOL ScGridWindow::GetEditUrlOrError( BO
- ScDocument* pDoc = pDocSh->GetDocument();
- ScBaseCell* pCell = NULL;
-
-- BOOL bFound = FALSE;
-- do
-- {
-- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
-- if ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE )
-- {
-- if ( nPosX <= 0 )
-- return FALSE; // alles leer bis links
-- else
-- --nPosX; // weitersuchen
-- }
-- else if ( pCell->GetCellType() == CELLTYPE_EDIT)
-- bFound = TRUE;
-- else if (pCell->GetCellType() == CELLTYPE_FORMULA &&
-- static_cast<ScFormulaCell*>(pCell)->IsHyperLinkCell())
-- bFound = TRUE;
-- else
-- return FALSE; // andere Zelle
-- }
-- while ( !bFound );
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( !bFound )
-+ return FALSE;
-
- ScHideTextCursor aHideCursor( pViewData, eWhich ); // before GetEditArea (MapMode is changed)
-
---- sc/source/ui/view/tabview3.cxx.orig 2008-05-07 12:09:09.000000000 +0800
-+++ sc/source/ui/view/tabview3.cxx 2008-06-02 13:47:09.000000000 +0800
-@@ -82,6 +82,10 @@
- #include "tabprotection.hxx"
-
- #include <com/sun/star/chart2/data/HighlightedRange.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star::document::VbaEventId;
-
- namespace
- {
-@@ -1684,6 +1688,17 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- // nicht InputEnterHandler wegen Referenzeingabe !
-
- ScDocument* pDoc = aViewData.GetDocument();
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_DEACTIVATE, aArgs );
-+ }
-+ }
-+
- pDoc->MakeTable( nTab );
-
- SCTAB nTabCount = pDoc->GetTableCount();
-@@ -1782,7 +1797,18 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- if ( pGridWin[i]->IsVisible() )
- pGridWin[i]->UpdateEditViewPos();
- }
--
-+
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_ACTIVATE, aArgs );
-+ }
-+ }
-+
- TabChanged(); // DrawView
- aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
- if ( !bUnoRefDialog )
---- sc/source/ui/vba/makefile.mk.orig 2008-05-12 11:19:10.000000000 +0800
-+++ sc/source/ui/vba/makefile.mk 2008-05-12 11:20:08.000000000 +0800
-@@ -126,6 +126,7 @@ SLOFILES= \
- $(SLO)$/vbacommandbar.obj \
- $(SLO)$/vbacommandbars.obj \
- $(SLO)$/vbahyperlink.obj \
-+ $(SLO)$/vbaeventshelper.obj \
- $(SLO)$/service.obj \
-
-
---- sfx2/source/doc/objserv.cxx.orig 2008-05-07 12:06:10.000000000 +0800
-+++ sfx2/source/doc/objserv.cxx 2008-05-29 20:02:09.000000000 +0800
-@@ -28,6 +28,8 @@
- *
- ************************************************************************/
-
-+#define BEFORE 0
-+#define AFTER 1
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sfx2.hxx"
-
-@@ -108,6 +110,7 @@
- #include <com/sun/star/document/XDocumentInfo.hpp>
- #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
-
- #ifndef _SFX_HELPID_HRC
- #include "helpid.hrc"
-@@ -521,6 +524,18 @@ void SfxObjectShell::ExecFile_Impl(SfxRe
- case SID_SAVEASDOC:
- case SID_SAVEDOC:
- {
-+ if( nId == SID_SAVEDOC || nId == SID_SAVEASDOC )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
-+ {
-+ rReq.SetReturnValue( SfxBoolItem( 0, sal_True ) );
-+ return;
-+ }
-+ }
-+ }
- //!! detaillierte Auswertung eines Fehlercodes
- SfxObjectShellRef xLock( this );
-
---- sfx2/source/view/viewprn.cxx.orig 2008-05-07 12:06:10.000000000 +0800
-+++ sfx2/source/view/viewprn.cxx 2008-05-27 15:31:06.000000000 +0800
-@@ -28,10 +28,12 @@
- *
- ************************************************************************/
-
-+#define BEFORE 0
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sfx2.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <com/sun/star/view/PrintableState.hpp>
- #include <svtools/itempool.hxx>
- #ifndef _MSGBOX_HXX //autogen
-@@ -67,6 +69,8 @@
- #include "view.hrc"
- #include "helpid.hrc"
-
-+using namespace com::sun::star;
-+
- TYPEINIT1(SfxPrintingHint, SfxHint);
-
- // -----------------------------------------------------------------------
-@@ -405,6 +409,22 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
- case SID_SETUPPRINTER:
- case SID_PRINTER_NAME :
- {
-+ if( nId == SID_PRINTDOC )
-+ {
-+ SfxObjectShell* pDoc = GetObjectShell();
-+ if( pDoc )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
-+ }
-+ }
- // quiet mode (AppEvent, API call)
- SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
- bSilent = pSilentItem && pSilentItem->GetValue();
-@@ -714,6 +734,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
- if ( SID_PRINTDOCDIRECT == nId )
- {
- SfxObjectShell* pDoc = GetObjectShell();
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( BEFORE, nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
- bool bDetectHidden = ( !bSilent && pDoc );
- if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
- return;
diff --git a/patches/test/vcl-add-simle-qteventloop.diff b/patches/test/vcl-add-simle-qteventloop.diff
deleted file mode 100644
index fd01e88c8..000000000
--- a/patches/test/vcl-add-simle-qteventloop.diff
+++ /dev/null
@@ -1,27 +0,0 @@
---- vcl/unx/inc/plugins/kde/kdedata.hxx.old 2007-06-29 18:25:01.000000000 +0200
-+++ vcl/unx/inc/plugins/kde/kdedata.hxx 2007-06-29 18:24:42.000000000 +0200
-@@ -56,6 +56,8 @@ class SalKDEDisplay : public SalX11Displ
- public:
- SalKDEDisplay( Display* pDisp );
- virtual ~SalKDEDisplay();
-+
-+ virtual long Dispatch( XEvent *pEvent );
- };
-
- class KDESalFrame : public X11SalFrame
---- vcl/unx/kde/kdedata.cxx.old 2006-12-04 17:37:42.000000000 +0100
-+++ vcl/unx/kde/kdedata.cxx 2007-06-29 18:28:18.000000000 +0200
-@@ -118,6 +118,13 @@ SalKDEDisplay::~SalKDEDisplay()
- pDisp_ = NULL;
- }
-
-+long SalKDEDisplay::Dispatch( XEvent *pEvent )
-+{
-+ if ((KApplication::kApplication()->x11ProcessEvent( pEvent )) >= 0)
-+ return 0;
-+ return SalX11Display::Dispatch( pEvent );
-+}
-+
- /***************************************************************************
- * class KDEXLib *
- ***************************************************************************/
diff --git a/patches/test/vcl-bmp-correctness.diff b/patches/test/vcl-bmp-correctness.diff
deleted file mode 100644
index 63535ad17..000000000
--- a/patches/test/vcl-bmp-correctness.diff
+++ /dev/null
@@ -1,566 +0,0 @@
-Fixes to broken VclCanvasBitmap class & unit test
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- vcl/source/helper/canvasbitmap.cxx | 8 -
- vcl/source/helper/canvastools.cxx | 63 ++++++++--
- vcl/test/canvasbitmaptest.cxx | 228 +++++++++++++++++++++---------------
- vcl/test/makefile.mk | 9 -
- vcl/unx/source/gdi/salbmp.cxx | 12 +-
- 5 files changed, 189 insertions(+), 131 deletions(-)
-
-
-diff --git vcl/source/helper/canvasbitmap.cxx vcl/source/helper/canvasbitmap.cxx
-index 12eaa5e..3999a73 100644
---- vcl/source/helper/canvasbitmap.cxx
-+++ vcl/source/helper/canvasbitmap.cxx
-@@ -150,9 +150,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
- m_aLayout.ScanLineStride = m_pBmpAcc->GetScanlineSize();
- m_aLayout.PlaneStride = 0;
-
-- if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
-- m_aLayout.ScanLineStride *= -1;
--
- switch( m_pBmpAcc->GetScanlineFormat() )
- {
- case BMP_FORMAT_1BIT_MSB_PAL:
-@@ -436,8 +433,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
- const Size aSize = m_aBitmap.GetSizePixel();
- m_aLayout.ScanLineBytes =
- m_aLayout.ScanLineStride = (aSize.Width()*m_nBitsPerOutputPixel + 7)/8;
-- if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
-- m_aLayout.ScanLineStride *= -1;
- }
- }
- }
-@@ -514,9 +509,6 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
- bitmapLayout.ScanLines = aRequestedBytes.getHeight();
- bitmapLayout.ScanLineBytes =
- bitmapLayout.ScanLineStride= aRequestedBytes.getWidth();
--
-- if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
-- bitmapLayout.ScanLineStride *= -1;
-
- if( !m_aBmpEx.IsTransparent() )
- {
-diff --git vcl/source/helper/canvastools.cxx vcl/source/helper/canvastools.cxx
-index 85df8df..f94d923 100644
---- vcl/source/helper/canvastools.cxx
-+++ vcl/source/helper/canvastools.cxx
-@@ -250,28 +250,61 @@ namespace vcl
- {
- // read ARGB color
- aARGBColors = rLayout.ColorSpace->convertIntegerToARGB(aPixelData);
-- for( sal_Int32 x=0; x<nWidth; ++x )
-+
-+ if( rWriteAcc->HasPalette() )
-+ {
-+ for( sal_Int32 x=0; x<nWidth; ++x )
-+ {
-+ const rendering::ARGBColor& rColor=aARGBColors[x];
-+ rWriteAcc->SetPixel( aRect.Y1, x,
-+ rWriteAcc->GetBestPaletteIndex(
-+ BitmapColor( toByteColor(rColor.Red),
-+ toByteColor(rColor.Green),
-+ toByteColor(rColor.Blue))) );
-+ rAlphaAcc->SetPixel( aRect.Y1, x,
-+ BitmapColor( 255 - toByteColor(rColor.Alpha) ));
-+ }
-+ }
-+ else
- {
-- const rendering::ARGBColor& rColor=aARGBColors[x];
-- rWriteAcc->SetPixel( aRect.Y1, x,
-- BitmapColor( toByteColor(rColor.Red),
-- toByteColor(rColor.Green),
-- toByteColor(rColor.Blue) ));
-- rAlphaAcc->SetPixel( aRect.Y1, x,
-- BitmapColor( 255 - toByteColor(rColor.Alpha) ));
-+ for( sal_Int32 x=0; x<nWidth; ++x )
-+ {
-+ const rendering::ARGBColor& rColor=aARGBColors[x];
-+ rWriteAcc->SetPixel( aRect.Y1, x,
-+ BitmapColor( toByteColor(rColor.Red),
-+ toByteColor(rColor.Green),
-+ toByteColor(rColor.Blue) ));
-+ rAlphaAcc->SetPixel( aRect.Y1, x,
-+ BitmapColor( 255 - toByteColor(rColor.Alpha) ));
-+ }
- }
- }
- else
- {
- // read RGB color
- aRGBColors = rLayout.ColorSpace->convertIntegerToRGB(aPixelData);
-- for( sal_Int32 x=0; x<nWidth; ++x )
-+ if( rWriteAcc->HasPalette() )
- {
-- const rendering::RGBColor& rColor=aRGBColors[x];
-- rWriteAcc->SetPixel( aRect.Y1, x,
-- BitmapColor( toByteColor(rColor.Red),
-- toByteColor(rColor.Green),
-- toByteColor(rColor.Blue) ));
-+ for( sal_Int32 x=0; x<nWidth; ++x )
-+ {
-+ const rendering::RGBColor& rColor=aRGBColors[x];
-+ rWriteAcc->SetPixel( aRect.Y1, x,
-+ rWriteAcc->GetBestPaletteIndex(
-+ BitmapColor( toByteColor(rColor.Red),
-+ toByteColor(rColor.Green),
-+ toByteColor(rColor.Blue))) );
-+ }
-+ }
-+ else
-+ {
-+ for( sal_Int32 x=0; x<nWidth; ++x )
-+ {
-+ const rendering::RGBColor& rColor=aRGBColors[x];
-+ rWriteAcc->SetPixel( aRect.Y1, x,
-+ BitmapColor( toByteColor(rColor.Red),
-+ toByteColor(rColor.Green),
-+ toByteColor(rColor.Blue) ));
-+ }
- }
- }
- }
-@@ -404,7 +437,7 @@ namespace vcl
- { // limit scoped access
- ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(),
- aBitmap );
-- ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.AcquireWriteAccess(),
-+ ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL,
- aAlpha );
-
- ENSURE_OR_THROW(pWriteAccess.get() != NULL,
-diff --git vcl/test/canvasbitmaptest.cxx vcl/test/canvasbitmaptest.cxx
-index 78793c8..a950496 100644
---- vcl/test/canvasbitmaptest.cxx
-+++ vcl/test/canvasbitmaptest.cxx
-@@ -32,6 +32,7 @@
- #include "precompiled_vcl.hxx"
-
- // bootstrap stuff
-+#include <sal/main.h>
- #include <rtl/bootstrap.hxx>
- #include <rtl/ref.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -54,20 +55,45 @@
- #include <cppuhelper/compbase3.hxx>
-
- #include <tools/diagnose_ex.h>
-+#include <tools/extendapplicationenvironment.hxx>
-
- #include "vcl/svapp.hxx"
- #include "vcl/canvastools.hxx"
-+#include "vcl/canvasbitmap.hxx"
- #include "vcl/dialog.hxx"
- #include "vcl/outdev.hxx"
- #include "vcl/bmpacc.hxx"
- #include "vcl/virdev.hxx"
- #include "vcl/bitmapex.hxx"
--#include "canvasbitmap.hxx"
-
-
- using namespace ::com::sun::star;
- using namespace ::vcl::unotools;
-
-+// -----------------------------------------------------------------------
-+
-+void Main();
-+
-+// -----------------------------------------------------------------------
-+
-+SAL_IMPLEMENT_MAIN()
-+{
-+ tools::extendApplicationEnvironment();
-+
-+ uno::Reference< lang::XMultiServiceFactory > xMS;
-+ xMS = cppu::createRegistryServiceFactory(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ),
-+ sal_True );
-+
-+ InitVCL( xMS );
-+ ::Main();
-+ DeInitVCL();
-+
-+ return 0;
-+}
-+
-+// -----------------------------------------------------------------------
-+
- namespace com { namespace sun { namespace star { namespace rendering
- {
-
-@@ -192,8 +218,8 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
- test( aPixelData2.getLength() == aPixelData.getLength(),
- "getData and getPixel return same amount of data" );
-
-- aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,200,1));
-- test( aLayout.ScanLines == 1,
-+ aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,200,2));
-+ test( aLayout.ScanLines == 2,
- "# scanlines" );
- test( aLayout.ScanLineBytes == (200*nExpectedBitsPerPixel+7)/8,
- "# scanline bytes" );
-@@ -258,28 +284,28 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
- if( nOriginalDepth > 8 )
- {
- const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
-- uno::Sequence<rendering::ARGBColor> aARGBColors(1);
-- uno::Sequence<rendering::RGBColor> aRGBColors(1);
-+ uno::Sequence<rendering::ARGBColor> aARGBColor(1);
-+ uno::Sequence<rendering::RGBColor> aRGBColor(1);
- uno::Sequence<sal_Int8> aPixel3, aPixel4;
-
- const Color aCol(COL_GREEN);
-- aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-- aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-- aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-- aARGBColors[0].Alpha = 1.0;
-+ aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-+ aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-+ aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-+ aARGBColor[0].Alpha = 1.0;
-
-- aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-- aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-- aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-+ aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-+ aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-+ aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-
-- aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
-+ aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
- aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
- test( aPixel3 == aPixel4,
- "Green pixel from bitmap matches with manually converted green pixel" );
-
- if( !aContainedBmpEx.IsTransparent() )
- {
-- aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
-+ aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
- test( aPixel3 == aPixel4,
- "Green pixel from bitmap matches with manually RGB-converted green pixel" );
- }
-@@ -409,28 +435,28 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp,
- if( nOriginalDepth > 8 )
- {
- const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
-- uno::Sequence<rendering::ARGBColor> aARGBColors(1);
-- uno::Sequence<rendering::RGBColor> aRGBColors(1);
-+ uno::Sequence<rendering::ARGBColor> aARGBColor(1);
-+ uno::Sequence<rendering::RGBColor> aRGBColor(1);
- uno::Sequence<sal_Int8> aPixel3, aPixel4;
-
- const Color aCol(COL_GREEN);
-- aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-- aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-- aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-- aARGBColors[0].Alpha = 1.0;
-+ aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-+ aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-+ aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-+ aARGBColor[0].Alpha = 1.0;
-
-- aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-- aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-- aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-+ aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
-+ aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
-+ aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-
-- aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
-+ aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
- aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
- test( aPixel3 == aPixel4,
- "Green pixel from bitmap matches with manually converted green pixel" );
-
- if( !aContainedBmpEx.IsTransparent() )
- {
-- aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
-+ aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
- test( aPixel3 == aPixel4,
- "Green pixel from bitmap matches with manually RGB-converted green pixel" );
- }
-@@ -631,6 +657,13 @@ private:
- return uno::Sequence< rendering::ARGBColor >();
- }
-
-+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ test(false, "Method not implemented");
-+ return uno::Sequence< rendering::ARGBColor >();
-+ }
-+
- virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException,
- uno::RuntimeException)
- {
-@@ -645,6 +678,13 @@ private:
- return uno::Sequence< double >();
- }
-
-+ virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ test(false, "This method is not expected to be called!");
-+ return uno::Sequence< double >();
-+ }
-+
- virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException)
- {
- return mnBitsPerPixel;
-@@ -660,9 +700,17 @@ private:
- return util::Endianness::LITTLE;
- }
-
-- virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerColorSpace( const uno::Sequence< ::sal_Int8 >&,
-- const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException,
-- uno::RuntimeException)
-+ virtual uno::Sequence< double > SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
-+ const uno::Reference< rendering::XColorSpace >& ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ test(false, "Method not implemented");
-+ return uno::Sequence< double >();
-+ }
-+
-+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& ,
-+ const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
- {
- test(false, "Method not implemented");
- return uno::Sequence< sal_Int8 >();
-@@ -722,6 +770,44 @@ private:
- return aRes;
- }
-
-+ virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ const sal_Size nLen( deviceColor.getLength() );
-+ const sal_Int32 nBytesPerPixel(mnBitsPerPixel == 8 ? 1 : 4);
-+ test(nLen%nBytesPerPixel==0,
-+ "number of channels no multiple of pixel element count");
-+
-+ uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel );
-+ rendering::ARGBColor* pOut( aRes.getArray() );
-+
-+ if( getPalette().is() )
-+ {
-+ for( sal_Size i=0; i<nLen; ++i )
-+ {
-+ *pOut++ = rendering::ARGBColor(
-+ 1.0,
-+ vcl::unotools::toDoubleColor(deviceColor[i]),
-+ vcl::unotools::toDoubleColor(deviceColor[i]),
-+ vcl::unotools::toDoubleColor(deviceColor[i]));
-+ }
-+ }
-+ else
-+ {
-+ for( sal_Size i=0; i<nLen; i+=4 )
-+ {
-+ const double fAlpha=deviceColor[i+3];
-+ *pOut++ = rendering::ARGBColor(
-+ vcl::unotools::toDoubleColor(fAlpha),
-+ vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+0]),
-+ vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+1]),
-+ vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+2]));
-+ }
-+ }
-+
-+ return aRes;
-+ }
-+
- virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException,
- uno::RuntimeException)
- {
-@@ -736,6 +822,13 @@ private:
- return uno::Sequence< sal_Int8 >();
- }
-
-+ virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
-+ {
-+ test(false, "Method not implemented");
-+ return uno::Sequence< sal_Int8 >();
-+ }
-+
- public:
- TestBitmap( const geometry::IntegerSize2D& rSize, bool bPalette ) :
- maSize(rSize),
-@@ -784,14 +877,14 @@ public:
-
- void TestWindow::Paint( const Rectangle& )
- {
-- static sal_Int8 lcl_depths[]={1,4,8,16,24,32};
-+ static sal_Int8 lcl_depths[]={1,4,8,16,24};
-
- try
- {
- // Testing VclCanvasBitmap wrapper
- // ===============================
-
-- for( int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
-+ for( unsigned int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
- {
- const sal_Int8 nDepth( lcl_depths[i] );
- Bitmap aBitmap(Size(200,200),nDepth);
-@@ -801,8 +894,8 @@ void TestWindow::Paint( const Rectangle& )
- aBitmap);
- if( pAcc.get() )
- {
-- BitmapColor aBlack;
-- BitmapColor aWhite;
-+ BitmapColor aBlack(0);
-+ BitmapColor aWhite(0);
- if( pAcc->HasPalette() )
- {
- aBlack.SetIndex( sal::static_int_cast<BYTE>(pAcc->GetBestPaletteIndex(BitmapColor(0,0,0))) );
-@@ -943,73 +1036,14 @@ void TestWindow::Paint( const Rectangle& )
- exit(2);
- }
-
--USHORT TestApp::Exception( USHORT nError )
--{
-- switch( nError & EXC_MAJORTYPE )
-- {
-- case EXC_RSCNOTLOADED:
-- Abort( String::CreateFromAscii(
-- "Error: could not load language resources.\nPlease check your installation.\n" ) );
-- break;
-- }
-- return 0;
--}
-+} // namespace
-
--void TestApp::Main()
-+void Main()
- {
-- bool bHelp = false;
--
-- for( USHORT i = 0; i < GetCommandLineParamCount(); i++ )
-- {
-- ::rtl::OUString aParam = GetCommandLineParam( i );
--
-- if( aParam.equalsAscii( "--help" ) ||
-- aParam.equalsAscii( "-h" ) )
-- bHelp = true;
-- }
--
-- if( bHelp )
-- {
-- printf( "outdevgrind - Profile OutputDevice\n" );
-- return;
-- }
--
-- //-------------------------------------------------
-- // create the global service-manager
-- //-------------------------------------------------
-- uno::Reference< lang::XMultiServiceFactory > xFactory;
-- try
-- {
-- uno::Reference< uno::XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext();
-- xFactory = uno::Reference< lang::XMultiServiceFactory >( xCtx->getServiceManager(),
-- uno::UNO_QUERY );
-- if( xFactory.is() )
-- ::comphelper::setProcessServiceFactory( xFactory );
-- }
-- catch( uno::Exception& )
-- {
-- }
--
-- if( !xFactory.is() )
-- {
-- fprintf( stderr,
-- "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
-- exit( 1 );
-- }
--
-- // Create UCB.
-- uno::Sequence< 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( xFactory, aArgs );
--
-- TestWindow pWindow;
-- pWindow.Execute();
-+ TestWindow aWindow;
-+ aWindow.Execute();
-+ aWindow.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - canvasbitmaptest" ) ) );
-
-- // clean up UCB
-- ::ucbhelper::ContentBroker::deinitialize();
-+ Application::Execute();
- }
-
--} // namespace
--
--TestApp aTestApp;
-diff --git vcl/test/makefile.mk vcl/test/makefile.mk
-index f2f2125..73dd9f8 100644
---- vcl/test/makefile.mk
-+++ vcl/test/makefile.mk
-@@ -46,13 +46,12 @@ TARGETTYPE=GUI
-
- # --- Files --------------------------------------------------------
-
--OBJFILES= \
-+APP1OBJS= \
- $(OBJ)$/dndtest.obj
-
-
- APP1NOSAL= TRUE
- APP1TARGET= $(TARGET)
--APP1OBJS= $(OBJFILES) $(OBJ)$/salmain.obj
- APP1STDLIBS= $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(TOOLSLIB) \
-@@ -68,12 +67,6 @@ APP2TARGET= canvasbitmaptest
- APP2OBJS= \
- $(OBJ)$/canvasbitmaptest.obj
-
--.IF "$(GUI)"!="UNX"
-- APP2OBJS += $(OBJ)$/salmain.obj
--.ELSE
-- APP2OBJS += $(SLO)$/salmain.obj
--.ENDIF
--
- APP2NOSAL= TRUE
- APP2STDLIBS=$(TOOLSLIB) \
- $(COMPHELPERLIB) \
-diff --git vcl/unx/source/gdi/salbmp.cxx vcl/unx/source/gdi/salbmp.cxx
-index ac8caa8..b64196f 100644
---- vcl/unx/source/gdi/salbmp.cxx
-+++ vcl/unx/source/gdi/salbmp.cxx
-@@ -141,9 +141,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount,
- case( 4 ): pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break;
- case( 8 ): pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break;
- #ifdef OSL_BIGENDIAN
-- case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; break;
-+ case(16 ):
-+ pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK;
-+ pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
-+ break;
- #else
-- case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; break;
-+ case(16 ):
-+ pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK;
-+ pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
-+ break;
- #endif
- default:
- nBitCount = 24;
-@@ -251,7 +257,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
- case( 16 ):
- {
- nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
-- aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
-+ aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
-
- if( LSBFirst == pImage->byte_order )
- {
diff --git a/patches/test/vcl-font-hinting.diff b/patches/test/vcl-font-hinting.diff
deleted file mode 100644
index 61b6a3162..000000000
--- a/patches/test/vcl-font-hinting.diff
+++ /dev/null
@@ -1,157 +0,0 @@
-Index: source/glyphs/gcach_ftyp.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/source/glyphs/gcach_ftyp.cxx,v
-retrieving revision 1.114
-diff -u -p -u -r1.114 gcach_ftyp.cxx
---- source/glyphs/gcach_ftyp.cxx 3 May 2005 14:10:32 -0000 1.114
-+++ source/glyphs/gcach_ftyp.cxx 15 Aug 2005 14:33:14 -0000
-@@ -805,13 +805,13 @@ FreetypeServerFont::FreetypeServerFont(
-
- ApplyGSUB( rFSD );
-
-- // TODO: query GASP table for load flags
-- mnLoadFlags = FT_LOAD_DEFAULT;
-+ mnLoadFlags = Application::GetSettings().GetStyleSettings().GetFontRenderFlags();
-
- if( (mnSin != 0) && (mnCos != 0) ) // hinting for 0/90/180/270 degrees only
- mnLoadFlags |= FT_LOAD_NO_HINTING;
- mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334#
-
-+#ifndef UNX
- #if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
- if( nPrioAutoHint <= 0 )
- #endif
-@@ -822,6 +822,7 @@ FreetypeServerFont::FreetypeServerFont(
- if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103))
- mnLoadFlags |= FT_LOAD_TARGET_LIGHT;
- #endif
-+#endif
-
- if( ((mnCos != 0) && (mnSin != 0)) || (nPrioEmbedded <= 0) )
- mnLoadFlags |= FT_LOAD_NO_BITMAP;
-Index: unx/gtk/gdi/makefile.mk
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/gtk/gdi/makefile.mk,v
-retrieving revision 1.5
-diff -u -p -u -r1.5 makefile.mk
---- unx/gtk/gdi/makefile.mk 13 Jan 2005 18:09:28 -0000 1.5
-+++ unx/gtk/gdi/makefile.mk 15 Aug 2005 14:33:14 -0000
-@@ -82,6 +82,10 @@ dummy:
-
- .IF "$(ENABLE_GTK)" != ""
-
-+.IF "$(SYSTEM_FREETYPE)" == "YES"
-+CFLAGS+=-DSYSTEM_FREETYPE $(FREETYPE_CFLAGS)
-+.ENDIF
-+
- PKGCONFIG_MODULES=gtk+-2.0
- .INCLUDE : pkg_config.mk
-
-Index: unx/gtk/gdi/salnativewidgets-gtk.cxx
-===================================================================
-RCS file: /cvs/gsl/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx,v
-retrieving revision 1.15
-diff -u -p -u -r1.15 salnativewidgets-gtk.cxx
---- unx/gtk/gdi/salnativewidgets-gtk.cxx 6 Jul 2005 09:21:55 -0000 1.15
-+++ unx/gtk/gdi/salnativewidgets-gtk.cxx 15 Aug 2005 14:33:15 -0000
-@@ -78,6 +78,8 @@
- #include <saldisp.hxx>
- #endif
-
-+#include <ft2build.h>
-+#include FT_FREETYPE_H
-
- #ifndef _OSL_CONDITN_HXX_
- #include <osl/mutex.hxx>
-@@ -2823,6 +2879,55 @@ void printStyleColors( GtkStyle* pStyle
- }
- #endif
-
-+static void
-+updateFontDetails( StyleSettings &rStyleSet, GtkWidget *widget )
-+{
-+ GtkSettings *pSettings;
-+ long nLoadFlags = FT_LOAD_DEFAULT;
-+ gint nAntiAlias;
-+ gint nHinting;
-+ gchar *pHintStyle;
-+
-+ pSettings = gtk_widget_get_settings (widget);
-+ g_object_get (pSettings,
-+ "gtk-xft-antialias", &nAntiAlias,
-+ "gtk-xft-hinting", &nHinting,
-+ "gtk-xft-hintstyle", &pHintStyle,
-+ NULL);
-+
-+ if( nHinting >= 0 && !nHinting )
-+ nLoadFlags |= FT_LOAD_NO_HINTING;
-+ else if( pHintStyle )
-+ {
-+ if( !strcmp (pHintStyle, "hintnone") )
-+ nLoadFlags |= FT_LOAD_NO_HINTING;
-+ else if( !strcmp( pHintStyle, "hintslight") ||
-+ !strcmp( pHintStyle, "hintmedium") )
-+ nLoadFlags |= FT_LOAD_TARGET_LIGHT;
-+ else // if( !strcmp( pHintStyle, "hintfull" ) )
-+ nLoadFlags |= FT_LOAD_TARGET_NORMAL;
-+ g_free (pHintStyle);
-+ }
-+
-+ if (nAntiAlias >= 0 && !nAntiAlias)
-+ {
-+#ifdef FT_LOAD_TARGET_MONO
-+ nLoadFlags |= FT_LOAD_TARGET_MONO;
-+#endif
-+ nLoadFlags |= FT_LOAD_MONOCHROME;
-+ }
-+ // FIXME: we need to fetch: "gtk-xft-rgba" enum:
-+ // one of: rgb, bgr, vrgb, vbgr, use
-+ // FT_LOAD_TARGET_LCD & _LCD_V & do more work.
-+ // Hopefully we can move to using cairo for font
-+ // rendering in future though.
-+ else
-+ nLoadFlags |= FT_LOAD_NO_BITMAP;
-+
-+ fprintf( stderr, "Generated render flags of 0x%x\n", nLoadFlags );
-+ rStyleSet.SetFontRenderFlags( nLoadFlags );
-+}
-+
- void GtkSalGraphics::updateSettings( AllSettings& rSettings )
- {
- // get the widgets in place
-@@ -3011,6 +3115,8 @@ void GtkSalGraphics::updateSettings( All
- // FIXME: need some way of fetching toolbar icon size.
- // aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL );
-
-+ updateFontDetails( aStyleSet, m_pWindow );
-+
- // finally update the collected settings
- rSettings.SetStyleSettings( aStyleSet );
- }
-
-Index: inc/settings.hxx
-===================================================================
-RCS file: /cvs/gsl/vcl/inc/settings.hxx,v
-retrieving revision 1.29
-diff -u -p -u -r1.29 settings.hxx
---- inc/settings.hxx 31 Jan 2005 13:19:19 -0000 1.29
-+++ inc/settings.hxx 15 Aug 2005 14:50:03 -0000
-@@ -447,6 +447,7 @@ private:
- long mnIconHorzSpace;
- long mnIconVertSpace;
- long mnAntialiasedMin;
-+ long mnFontRenderFlags;
- ULONG mnCursorBlinkTime;
- ULONG mnDragFullOptions;
- ULONG mnAnimationOptions;
-@@ -910,6 +918,10 @@ public:
- { CopyData(); mpData->mnAntialiasedMin = nMinPixel; }
- ULONG GetAntialiasingMinPixelHeight() const
- { return mpData->mnAntialiasedMin; }
-+ void SetFontRenderFlags( long nFlags )
-+ { CopyData(); mpData->mnFontRenderFlags = nFlags; }
-+ ULONG GetFontRenderFlags() const
-+ { return mpData->mnFontRenderFlags; }
-
- void SetOptions( ULONG nOptions )
- { CopyData(); mpData->mnOptions = nOptions; }
diff --git a/patches/test/win32-crosscompilation.diff b/patches/test/win32-crosscompilation.diff
deleted file mode 100644
index fbb0279dd..000000000
--- a/patches/test/win32-crosscompilation.diff
+++ /dev/null
@@ -1,898 +0,0 @@
-diff --git a/solenv/inc/_tg_rslb.mk b/solenv/inc/_tg_rslb.mk
-index 9f92278..1313ea1 100755
---- a/solenv/inc/_tg_rslb.mk
-+++ b/solenv/inc/_tg_rslb.mk
-@@ -19,6 +19,9 @@ ALLTAR : $(HIDRES1PARTICLE)
-
- .ENDIF # "$(BUILDHIDS)"!=""
-
-+COLON_HACK := :
-+SOLARSRC_NATIVE := $(subst,z$(COLON_HACK), $(SOLARSRC))
-+
- $(RSC_MULTI1) : \
- $(RESLIB1SRSFILES) \
- $(RESLIB1TARGETN) \
-@@ -45,11 +48,11 @@ $(RSC_MULTI1) : \
- $(foreach,i,$(alllangiso) -lg$i \
- $(null,$(rescharset_{$i}) $(default$(LANG_GUI)) $(rescharset_{$i})) \
- -fs={$(BIN)$/$(RESLIB1NAME)$i.res} \
-- $(foreach,j,$(subst,$(PRJ),$(SOLARSRC)$/$(RSCDEFIMG)$/$(PRJNAME) $(RESLIB1IMAGES)) -lip={$j}$/$i \
-+ $(foreach,j,$(subst,$(PRJ),$(SOLARSRC_NATIVE)$/$(RSCDEFIMG)$/$(PRJNAME) $(RESLIB1IMAGES)) -lip={$j}$/$i \
- -lip={$j} ) \
-- -lip=$(SOLARSRC)$/$(RSCDEFIMG)$/res$/$i -lip=$(SOLARSRC)$/$(RSCDEFIMG)$/res ) \
-- -subMODULE=$(SOLARSRC)$/$(RSCDEFIMG) \
-- -subGLOBALRES=$(SOLARSRC)$/$(RSCDEFIMG)$/res \
-+ -lip=$(SOLARSRC_NATIVE)$/$(RSCDEFIMG)$/res$/$i -lip=$(SOLARSRC_NATIVE)$/$(RSCDEFIMG)$/res ) \
-+ -subMODULE=$(SOLARSRC_NATIVE)$/$(RSCDEFIMG) \
-+ -subGLOBALRES=$(SOLARSRC_NATIVE)$/$(RSCDEFIMG)$/res \
- -oil=$(BIN) \
- -ft=$@ \
- $(RSC1HEADER) $(RESLIB1SRSFILES) \
-diff --git a/solenv/inc/_tg_sdi.mk b/solenv/inc/_tg_sdi.mk
-index 238dc76..77374b4 100755
---- a/solenv/inc/_tg_sdi.mk
-+++ b/solenv/inc/_tg_sdi.mk
-@@ -14,19 +14,21 @@ $(HIDSID1PARTICLE): $(SDI1TARGET)
- @$(RENAME) $@.$(ROUT).tmp $@
- .ENDIF # "$(HIDSID1PARTICLE)"!=""
-
-+COLON_HACK := :
-+
- .IF "$(SDI1TARGET)"!=""
- $(SDI1TARGET): $(SVSDI1DEPEND) $(SDI1NAME).sdi
- @echo ------------------------------
- @echo Making: $@
- @-$(RM) $@
-- $(SVIDL) @$(mktmp \
-+ $(SVIDL) \
- -fs$(INCCOMX)$/$(SDI1NAME).hxx \
- -fd$(INCCOMX)$/$(SDI1NAME).ilb \
- -fm$(MISC)$/$(SDI1NAME).don \
- -fl$(MISC)$/$(SDI1NAME).lst \
- -fx$(SDI1EXPORT).sdi \
- -fz$(MISC)$/$(SDI1NAME).sid \
-- $(SDI1NAME).sdi -I$(MISC) -I$(SVSDIINC) -I$(INC) $(INCLUDE))
-+ $(SDI1NAME).sdi -I$(MISC) -I$(SVSDIINC) -I$(INC) $(subst,-Iz$(COLON_HACK),-I $(INCLUDE))
- .ENDIF # "$(SDI1TARGET)"!=""
-
- # Instruction for ???
-diff --git a/solenv/inc/_tg_shl.mk b/solenv/inc/_tg_shl.mk
-index 83dadeb..772c103 100755
---- a/solenv/inc/_tg_shl.mk
-+++ b/solenv/inc/_tg_shl.mk
-@@ -191,7 +191,7 @@ SHL1LINKRESO*=$(MISC)$/$(SHL1TARGET)_res.o
- .ENDIF # "$(SHL1RES)"!=""
-
- .IF "$(SHL1DEFAULTRES)$(use_shl_versions)"!=""
--SHL1DEFAULTRES*=$(MISC)$/$(SHL1TARGET)_def.res
-+SHL1DEFAULTRES*=$(MISC)$/$(SHL1TARGET)_def.RES
- SHL1ALLRES+=$(SHL1DEFAULTRES)
- SHL1LINKRES*=$(MISC)$/$(SHL1TARGET).res
- SHL1LINKRESO*=$(MISC)$/$(SHL1TARGET)_res.o
-@@ -382,7 +382,8 @@ $(SHL1TARGETN) : \
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)$/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
- .ELSE
-- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
-+ #mt.exe breaks in wine :-((
-+ #$(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
- .ENDIF # "$(VISTA_MANIFEST)"!=""
- $(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
- $(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
-@@ -731,7 +732,7 @@ SHL2LINKRESO*=$(MISC)$/$(SHL2TARGET)_res.o
- .ENDIF # "$(SHL2RES)"!=""
-
- .IF "$(SHL2DEFAULTRES)$(use_shl_versions)"!=""
--SHL2DEFAULTRES*=$(MISC)$/$(SHL2TARGET)_def.res
-+SHL2DEFAULTRES*=$(MISC)$/$(SHL2TARGET)_def.RES
- SHL2ALLRES+=$(SHL2DEFAULTRES)
- SHL2LINKRES*=$(MISC)$/$(SHL2TARGET).res
- SHL2LINKRESO*=$(MISC)$/$(SHL2TARGET)_res.o
-@@ -875,7 +876,8 @@ $(SHL2TARGETN) : \
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)$/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
- .ELSE
-- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
-+ #mt.exe breaks in wine :-((
-+ #$(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
- .ENDIF # "$(VISTA_MANIFEST)"!=""
- $(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
- $(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
-@@ -1271,7 +1273,7 @@ SHL3LINKRESO*=$(MISC)$/$(SHL3TARGET)_res.o
- .ENDIF # "$(SHL3RES)"!=""
-
- .IF "$(SHL3DEFAULTRES)$(use_shl_versions)"!=""
--SHL3DEFAULTRES*=$(MISC)$/$(SHL3TARGET)_def.res
-+SHL3DEFAULTRES*=$(MISC)$/$(SHL3TARGET)_def.RES
- SHL3ALLRES+=$(SHL3DEFAULTRES)
- SHL3LINKRES*=$(MISC)$/$(SHL3TARGET).res
- SHL3LINKRESO*=$(MISC)$/$(SHL3TARGET)_res.o
-@@ -1415,7 +1417,8 @@ $(SHL3TARGETN) : \
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)$/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI)
- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.tmanifest -outputresource:$@$(EMQ);2 $(FI)
- .ELSE
-- $(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
-+ #mt.exe breaks in wine :-((
-+ #$(IFEXIST) $@.manifest $(THEN) mt.exe -manifest $@.manifest -outputresource:$@$(EMQ);2 $(FI)
- .ENDIF # "$(VISTA_MANIFEST)"!=""
- $(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI)
- $(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI)
-@@ -1811,7 +1814,7 @@ SHL4LINKRESO*=$(MISC)$/$(SHL4TARGET)_res.o
- .ENDIF # "$(SHL4RES)"!=""
-
- .IF "$(SHL4DEFAULTRES)$(use_shl_versions)"!=""
--SHL4DEFAULTRES*=$(MISC)$/$(SHL4TARGET)_def.res
-+SHL4DEFAULTRES*=$(MISC)$/$(SHL4TARGET)_def.RES
- SHL4ALLRES+=$(SHL4DEFAULTRES)
- SHL4LINKRES*=$(MISC)$/$(SHL4TARGET).res
- SHL4LINKRESO*=$(MISC)$/$(SHL4TARGET)_res.o
-@@ -2351,7 +2354,7 @@ SHL5LINKRESO*=$(MISC)$/$(SHL5TARGET)_res.o
- .ENDIF # "$(SHL5RES)"!=""
-
- .IF "$(SHL5DEFAULTRES)$(use_shl_versions)"!=""
--SHL5DEFAULTRES*=$(MISC)$/$(SHL5TARGET)_def.res
-+SHL5DEFAULTRES*=$(MISC)$/$(SHL5TARGET)_def.RES
- SHL5ALLRES+=$(SHL5DEFAULTRES)
- SHL5LINKRES*=$(MISC)$/$(SHL5TARGET).res
- SHL5LINKRESO*=$(MISC)$/$(SHL5TARGET)_res.o
-@@ -2891,7 +2894,7 @@ SHL6LINKRESO*=$(MISC)$/$(SHL6TARGET)_res.o
- .ENDIF # "$(SHL6RES)"!=""
-
- .IF "$(SHL6DEFAULTRES)$(use_shl_versions)"!=""
--SHL6DEFAULTRES*=$(MISC)$/$(SHL6TARGET)_def.res
-+SHL6DEFAULTRES*=$(MISC)$/$(SHL6TARGET)_def.RES
- SHL6ALLRES+=$(SHL6DEFAULTRES)
- SHL6LINKRES*=$(MISC)$/$(SHL6TARGET).res
- SHL6LINKRESO*=$(MISC)$/$(SHL6TARGET)_res.o
-@@ -3431,7 +3434,7 @@ SHL7LINKRESO*=$(MISC)$/$(SHL7TARGET)_res.o
- .ENDIF # "$(SHL7RES)"!=""
-
- .IF "$(SHL7DEFAULTRES)$(use_shl_versions)"!=""
--SHL7DEFAULTRES*=$(MISC)$/$(SHL7TARGET)_def.res
-+SHL7DEFAULTRES*=$(MISC)$/$(SHL7TARGET)_def.RES
- SHL7ALLRES+=$(SHL7DEFAULTRES)
- SHL7LINKRES*=$(MISC)$/$(SHL7TARGET).res
- SHL7LINKRESO*=$(MISC)$/$(SHL7TARGET)_res.o
-@@ -3971,7 +3974,7 @@ SHL8LINKRESO*=$(MISC)$/$(SHL8TARGET)_res.o
- .ENDIF # "$(SHL8RES)"!=""
-
- .IF "$(SHL8DEFAULTRES)$(use_shl_versions)"!=""
--SHL8DEFAULTRES*=$(MISC)$/$(SHL8TARGET)_def.res
-+SHL8DEFAULTRES*=$(MISC)$/$(SHL8TARGET)_def.RES
- SHL8ALLRES+=$(SHL8DEFAULTRES)
- SHL8LINKRES*=$(MISC)$/$(SHL8TARGET).res
- SHL8LINKRESO*=$(MISC)$/$(SHL8TARGET)_res.o
-@@ -4511,7 +4514,7 @@ SHL9LINKRESO*=$(MISC)$/$(SHL9TARGET)_res.o
- .ENDIF # "$(SHL9RES)"!=""
-
- .IF "$(SHL9DEFAULTRES)$(use_shl_versions)"!=""
--SHL9DEFAULTRES*=$(MISC)$/$(SHL9TARGET)_def.res
-+SHL9DEFAULTRES*=$(MISC)$/$(SHL9TARGET)_def.RES
- SHL9ALLRES+=$(SHL9DEFAULTRES)
- SHL9LINKRES*=$(MISC)$/$(SHL9TARGET).res
- SHL9LINKRESO*=$(MISC)$/$(SHL9TARGET)_res.o
-@@ -5051,7 +5054,7 @@ SHL10LINKRESO*=$(MISC)$/$(SHL10TARGET)_res.o
- .ENDIF # "$(SHL10RES)"!=""
-
- .IF "$(SHL10DEFAULTRES)$(use_shl_versions)"!=""
--SHL10DEFAULTRES*=$(MISC)$/$(SHL10TARGET)_def.res
-+SHL10DEFAULTRES*=$(MISC)$/$(SHL10TARGET)_def.RES
- SHL10ALLRES+=$(SHL10DEFAULTRES)
- SHL10LINKRES*=$(MISC)$/$(SHL10TARGET).res
- SHL10LINKRESO*=$(MISC)$/$(SHL10TARGET)_res.o
-diff --git a/solenv/inc/_tg_srs.mk b/solenv/inc/_tg_srs.mk
-index 5ed60b2..eaea344 100755
---- a/solenv/inc/_tg_srs.mk
-+++ b/solenv/inc/_tg_srs.mk
-@@ -29,6 +29,8 @@ $(foreach,i,$(SRC1FILES) $(COMMONMISC)$/$(TARGET)$/$i) : $$(@:f) localize.sdf
- $(RENAME) $@.$(INPATH) $@
- -$(RM) $@.$(INPATH)
-
-+COLON_HACK := :
-+
- $(SRS)$/$(SRS1NAME).srs: $(foreach,i,$(SRC1FILES) $(COMMONMISC)$/$(TARGET)$/$i)
- .ELSE # "$(WITH_LANG)"!=""
- $(SRS)$/$(SRS1NAME).srs: $(SRC1FILES)
-@@ -37,7 +39,7 @@ $(SRS)$/$(SRS1NAME).srs: $(SRC1FILES)
- @echo Making: $@
- $(RSC) -presponse @$(mktmp \
- $(SRSDEFAULT) $(RSC_SRS_CHARSET) $(RSCFLAGS) -I$(RSCEXTINC) \
-- $(INCLUDE) $(RSCDEFS) $(RSCUPDVERDEF) \
-+ $(subst,-Iz$(COLON_HACK),-I $(INCLUDE)) $(RSCDEFS) $(RSCUPDVERDEF) \
- -fp=$@.$(INPATH) \
- $< \
- )
-diff --git a/solenv/inc/rules.mk b/solenv/inc/rules.mk
-index 626ef87..917c799 100755
---- a/solenv/inc/rules.mk
-+++ b/solenv/inc/rules.mk
-@@ -194,7 +194,7 @@ $(SLO)$/%.obj : %.cxx
- .IF "$(COM)"=="GCC"
- $(CAPTURE_COMMAND) $(CXX) $(ACT_PCH_SWITCHES) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ)$(SLO)$/$*.obj $(CFLAGSINCXX)$(PWD)$/$*.cxx $(CAPTURE_OUTPUT)
- .ELSE
-- $(CAPTURE_COMMAND) $(CXX) $(ACT_PCH_SWITCHES) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ)$(SLO)$/$*.obj $(CFLAGSINCXX)$(PWD)$/$*.cxx $(CAPTURE_OUTPUT)
-+ $(CAPTURE_COMMAND) $(CXX) $(ACT_PCH_SWITCHES) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ)$(SLO)$/$*.obj $(CFLAGSINCXX)z:$(PWD)$/$*.cxx $(CAPTURE_OUTPUT)
- .ENDIF # "$(COM)"=="GCC"
- .ENDIF # "$(GUI)"=="UNX"
- .IF "$(nodep)"==""
-diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
-index f44bc59..e463115 100755
---- a/solenv/inc/settings.mk
-+++ b/solenv/inc/settings.mk
-@@ -950,8 +950,8 @@ YACCFLAGS*=-d
-
- SVIDL=svidl
-
--LDUMP=ldump4
--LDUMP2=ldump4
-+LDUMP=wine "/local/ooo-build/ooo-build-win/build/ooo300-m3/solver/300/wntmsci12.pro/bin/ldump4.exe"
-+LDUMP2=wine "/local/ooo-build/ooo-build-win/build/ooo300-m3/solver/300/wntmsci12.pro/bin/ldump4.exe"
-
- ZIPUPDATE=-u -j
- ZIPFLAGS=$(ZIPUPDATE)
-@@ -967,7 +967,7 @@ SCPLINKFLAGS+=-v $(SCPLINKVERSION)
- .IF "$(make_srs_deps)"!=""
- RSC=rscdep
- .ELSE # "$(make_srs_deps)"!=""
--RSC=$(FLIPCMD) rsc
-+RSC=rsc
- .ENDIF # "$(make_srs_deps)"!=""
-
- #new
-diff --git a/solenv/inc/startup/WNT/CVS/Entries b/solenv/inc/startup/WNT/CVS/Entries
-new file mode 100755
-index 0000000..207dd3d
---- /dev/null
-+++ b/solenv/inc/startup/WNT/CVS/Entries
-@@ -0,0 +1,2 @@
-+/macros.mk/1.25/Thu Mar 6 15:16:17 2008//TOOO300_m3
-+D
-diff --git a/solenv/inc/startup/WNT/CVS/Repository b/solenv/inc/startup/WNT/CVS/Repository
-new file mode 100755
-index 0000000..c635f5b
---- /dev/null
-+++ b/solenv/inc/startup/WNT/CVS/Repository
-@@ -0,0 +1 @@
-+tools/solenv/inc/startup/wnt
-diff --git a/solenv/inc/startup/WNT/CVS/Root b/solenv/inc/startup/WNT/CVS/Root
-new file mode 100755
-index 0000000..ab83a92
---- /dev/null
-+++ b/solenv/inc/startup/WNT/CVS/Root
-@@ -0,0 +1 @@
-+:pserver:anoncvs@anoncvs.services.openoffice.org:/cvs
-diff --git a/solenv/inc/startup/WNT/CVS/Tag b/solenv/inc/startup/WNT/CVS/Tag
-new file mode 100755
-index 0000000..0156927
---- /dev/null
-+++ b/solenv/inc/startup/WNT/CVS/Tag
-@@ -0,0 +1 @@
-+NOOO300_m3
-diff --git a/solenv/inc/startup/WNT/CVS/Template b/solenv/inc/startup/WNT/CVS/Template
-new file mode 100755
-index 0000000..eec9bab
---- /dev/null
-+++ b/solenv/inc/startup/WNT/CVS/Template
-@@ -0,0 +1,42 @@
-+Issue number:
-+Submitted by:
-+Reviewed by:
-+CVS: ----------------------------------------------------------------------
-+CVS: Issue number:
-+CVS: If this change addresses one or more issues,
-+CVS: then enter the issue number(s) here.
-+CVS: Submitted by:
-+CVS: If this code has been contributed to the project by someone else; i.e.,
-+CVS: they sent us a patch or a set of diffs, then include their name/email
-+CVS: address here. If this is your work then delete this line.
-+CVS: Reviewed by:
-+CVS: If we are doing pre-commit code reviews and someone else has
-+CVS: reviewed your changes, include their name(s) here.
-+CVS: If you have not had it reviewed then delete this line.
-+CVS: ----------------------------------------------------------------------
-+CVS: Committers,
-+CVS:
-+CVS: Please follow these protocols:
-+CVS:
-+CVS: * Please include in the log message
-+CVS: reference(s) by ID / number and/or URL
-+CVS: to any and all relevant OpenOffice.org issue(s).
-+CVS:
-+CVS: * If the code is contributed from outside Sun
-+CVS: then please verify using the list at the following URL
-+CVS: http://www.openoffice.org/copyright/copyrightapproved.html
-+CVS: that Sun has received a signed Copyright Assignment Form
-+CVS: from the submitter.
-+CVS:
-+CVS: Otherwise,
-+CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com
-+CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun
-+CVS: (http://www.openoffice.org/copyright/assign_copyright.html).
-+CVS:
-+CVS: Please do NOT commit code until you have verified (as detailed above) that
-+CVS: Sun has received a signed Copyright Assignment Form from the submitter.
-+CVS:
-+CVS: * Please send an email TO: the submitter
-+CVS: (particularly, if from outside Sun)
-+CVS: advising that the code has been committed,
-+CVS: and gratefully recognizing the contribution.
-diff --git a/solenv/inc/startup/WNT/macros.mk b/solenv/inc/startup/WNT/macros.mk
-new file mode 100755
-index 0000000..5b8e79c
---- /dev/null
-+++ b/solenv/inc/startup/WNT/macros.mk
-@@ -0,0 +1,91 @@
-+# Define additional MSDOS specific settings.
-+#
-+
-+# --- Set Wrapper command ---
-+# Provide a macro that can be used to access the wrapper and to avoid
-+# hardcoding the program name everywhere
-+GUWCMD*=guw.exe
-+
-+# This is a no-op for native W32 dmake
-+.WINPATH !:= yes
-+
-+# Directory cache configuration.
-+.DIRCACHE *:= no
-+
-+# Applicable suffix definitions
-+#E *:= .exe # Executables
-+
-+# Now set the remaining arguments depending on which SHELL we
-+# are going to use.
-+.IF $(USE_SHELL) == 4nt
-+
-+.IMPORT : COMSPEC
-+
-+SHELL *:= $(COMSPEC)
-+
-+ SHELLFLAGS *:= $(SWITCHAR)c
-+ GROUPFLAGS *:= $(SHELLFLAGS)
-+ SHELLMETAS *:= "<>|&%^
-+# Fix syntax highlighting: "
-+ GROUPSUFFIX *:= .bat
-+ DIVFILE *= $(TMPFILE:s,/,\,)
-+ RM *= +del
-+ RMFLAGS *= /y /E
-+ MV *= +rename
-+ __.DIVSEP-sh-yes *:= \\
-+ __.DIVSEP-sh-no *:= \\
-+ DIRSEPSTR := \\
-+
-+.ELSE # Non 4nt case
-+
-+.IF $(USE_SHELL) == bash
-+ SHELLFLAGS *:= -c
-+.ELSE
-+ # See iz50689 why -f is needed.
-+ SHELLFLAGS *:= -fc
-+.ENDIF # $(USE_SHELL) == bash
-+
-+ GROUPFLAGS *:=
-+ SHELLMETAS *:= *";?<>|()&][$$\#`'
-+# Fix syntax highlighting: "
-+ GROUPSUFFIX *:= .csh
-+# This is hopefully not used. Only in: dmake/msdos/spawn.c
-+# .MKSARGS *:= yes
-+ DIVFILE *= $(TMPFILE:s,/,${__.DIVSEP-sh-${USESHELL}})
-+ RM *= $/bin$/rm
-+ RMFLAGS *= -f
-+ MV *= $/bin$/mv
-+ __.DIVSEP-sh-yes *:= \\\
-+ __.DIVSEP-sh-no *:= \\
-+ DIRSEPSTR :=/
-+
-+.ENDIF
-+
-+.EXPORT : GUWCMD
-+
-+.IF $(USE_SHELL) == 4nt
-+
-+my4ver:=$(shell @echo %_4ver)
-+
-+.IF "$(my4ver:s/.//:s/,//)" >= "400"
-+.ELSE # "$(my4ver:s/.//:s/,//)" >= "400"
-+.ERROR : ; @echo Forced error: 4NT version too old! Version 4.0 or newer is required.
-+4NT_version_too_old
-+.ENDIF # "$(my4ver:s/.//:s/,//)" >= "400"
-+
-+.ELSE # $(USE_SHELL) == 4nt
-+
-+.IF $(SHELL) == $(NULL)
-+# SHELL has to be set in (non-4NT) OOobuild environment
-+.ERROR : ; @echo Forced error: Environment variable SHELL has to be set for OOo build!
-+SHELL_variable_needed
-+.END
-+
-+.END # $(USE_SHELL) == 4nt
-+
-+GROUPSHELL *:= $(SHELL)
-+
-+# Does not respect case of filenames.
-+.DIRCACHERESPCASE := no
-+NAMEMAX = 256
-+
-diff --git a/solenv/inc/startup/wnt/CVS/Entries b/solenv/inc/startup/wnt/CVS/Entries
-deleted file mode 100755
-index 207dd3d..0000000
---- a/solenv/inc/startup/wnt/CVS/Entries
-+++ /dev/null
-@@ -1,2 +0,0 @@
--/macros.mk/1.25/Thu Mar 6 15:16:17 2008//TOOO300_m3
--D
-diff --git a/solenv/inc/startup/wnt/CVS/Repository b/solenv/inc/startup/wnt/CVS/Repository
-deleted file mode 100755
-index c635f5b..0000000
---- a/solenv/inc/startup/wnt/CVS/Repository
-+++ /dev/null
-@@ -1 +0,0 @@
--tools/solenv/inc/startup/wnt
-diff --git a/solenv/inc/startup/wnt/CVS/Root b/solenv/inc/startup/wnt/CVS/Root
-deleted file mode 100755
-index ab83a92..0000000
---- a/solenv/inc/startup/wnt/CVS/Root
-+++ /dev/null
-@@ -1 +0,0 @@
--:pserver:anoncvs@anoncvs.services.openoffice.org:/cvs
-diff --git a/solenv/inc/startup/wnt/CVS/Tag b/solenv/inc/startup/wnt/CVS/Tag
-deleted file mode 100755
-index 0156927..0000000
---- a/solenv/inc/startup/wnt/CVS/Tag
-+++ /dev/null
-@@ -1 +0,0 @@
--NOOO300_m3
-diff --git a/solenv/inc/startup/wnt/CVS/Template b/solenv/inc/startup/wnt/CVS/Template
-deleted file mode 100755
-index eec9bab..0000000
---- a/solenv/inc/startup/wnt/CVS/Template
-+++ /dev/null
-@@ -1,42 +0,0 @@
--Issue number:
--Submitted by:
--Reviewed by:
--CVS: ----------------------------------------------------------------------
--CVS: Issue number:
--CVS: If this change addresses one or more issues,
--CVS: then enter the issue number(s) here.
--CVS: Submitted by:
--CVS: If this code has been contributed to the project by someone else; i.e.,
--CVS: they sent us a patch or a set of diffs, then include their name/email
--CVS: address here. If this is your work then delete this line.
--CVS: Reviewed by:
--CVS: If we are doing pre-commit code reviews and someone else has
--CVS: reviewed your changes, include their name(s) here.
--CVS: If you have not had it reviewed then delete this line.
--CVS: ----------------------------------------------------------------------
--CVS: Committers,
--CVS:
--CVS: Please follow these protocols:
--CVS:
--CVS: * Please include in the log message
--CVS: reference(s) by ID / number and/or URL
--CVS: to any and all relevant OpenOffice.org issue(s).
--CVS:
--CVS: * If the code is contributed from outside Sun
--CVS: then please verify using the list at the following URL
--CVS: http://www.openoffice.org/copyright/copyrightapproved.html
--CVS: that Sun has received a signed Copyright Assignment Form
--CVS: from the submitter.
--CVS:
--CVS: Otherwise,
--CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com
--CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun
--CVS: (http://www.openoffice.org/copyright/assign_copyright.html).
--CVS:
--CVS: Please do NOT commit code until you have verified (as detailed above) that
--CVS: Sun has received a signed Copyright Assignment Form from the submitter.
--CVS:
--CVS: * Please send an email TO: the submitter
--CVS: (particularly, if from outside Sun)
--CVS: advising that the code has been committed,
--CVS: and gratefully recognizing the contribution.
-diff --git a/solenv/inc/startup/wnt/macros.mk b/solenv/inc/startup/wnt/macros.mk
-deleted file mode 100755
-index 58b0097..0000000
---- a/solenv/inc/startup/wnt/macros.mk
-+++ /dev/null
-@@ -1,91 +0,0 @@
--# Define additional MSDOS specific settings.
--#
--
--# --- Set Wrapper command ---
--# Provide a macro that can be used to access the wrapper and to avoid
--# hardcoding the program name everywhere
--GUWCMD*=guw.exe
--
--# This is a no-op for native W32 dmake
--.WINPATH !:= yes
--
--# Directory cache configuration.
--.DIRCACHE *:= no
--
--# Applicable suffix definitions
--E *:= .exe # Executables
--
--# Now set the remaining arguments depending on which SHELL we
--# are going to use.
--.IF $(USE_SHELL) == 4nt
--
--.IMPORT : COMSPEC
--
--SHELL *:= $(COMSPEC)
--
-- SHELLFLAGS *:= $(SWITCHAR)c
-- GROUPFLAGS *:= $(SHELLFLAGS)
-- SHELLMETAS *:= "<>|&%^
--# Fix syntax highlighting: "
-- GROUPSUFFIX *:= .bat
-- DIVFILE *= $(TMPFILE:s,/,\,)
-- RM *= +del
-- RMFLAGS *= /y /E
-- MV *= +rename
-- __.DIVSEP-sh-yes *:= \\
-- __.DIVSEP-sh-no *:= \\
-- DIRSEPSTR := \\
--
--.ELSE # Non 4nt case
--
--.IF $(USE_SHELL) == bash
-- SHELLFLAGS *:= -c
--.ELSE
-- # See iz50689 why -f is needed.
-- SHELLFLAGS *:= -fc
--.ENDIF # $(USE_SHELL) == bash
--
-- GROUPFLAGS *:=
-- SHELLMETAS *:= *";?<>|()&][$$\#`'
--# Fix syntax highlighting: "
-- GROUPSUFFIX *:= .csh
--# This is hopefully not used. Only in: dmake/msdos/spawn.c
--# .MKSARGS *:= yes
-- DIVFILE *= $(TMPFILE:s,/,${__.DIVSEP-sh-${USESHELL}})
-- RM *= $/bin$/rm
-- RMFLAGS *= -f
-- MV *= $/bin$/mv
-- __.DIVSEP-sh-yes *:= \\\
-- __.DIVSEP-sh-no *:= \\
-- DIRSEPSTR :=/
--
--.ENDIF
--
--.EXPORT : GUWCMD
--
--.IF $(USE_SHELL) == 4nt
--
--my4ver:=$(shell @echo %_4ver)
--
--.IF "$(my4ver:s/.//:s/,//)" >= "400"
--.ELSE # "$(my4ver:s/.//:s/,//)" >= "400"
--.ERROR : ; @echo Forced error: 4NT version too old! Version 4.0 or newer is required.
--4NT_version_too_old
--.ENDIF # "$(my4ver:s/.//:s/,//)" >= "400"
--
--.ELSE # $(USE_SHELL) == 4nt
--
--.IF $(SHELL) == $(NULL)
--# SHELL has to be set in (non-4NT) OOobuild environment
--.ERROR : ; @echo Forced error: Environment variable SHELL has to be set for OOo build!
--SHELL_variable_needed
--.END
--
--.END # $(USE_SHELL) == 4nt
--
--GROUPSHELL *:= $(SHELL)
--
--# Does not respect case of filenames.
--.DIRCACHERESPCASE := no
--NAMEMAX = 256
--
-diff --git a/solenv/inc/unitools.mk b/solenv/inc/unitools.mk
-index 9ffeeac..dabcd01 100755
---- a/solenv/inc/unitools.mk
-+++ b/solenv/inc/unitools.mk
-@@ -39,7 +39,7 @@ XSLTPROC*=xsltproc
-
- ULFCONV*=ulfconv
-
--MAKEDEPEND*=$(SOLARBINDIR)$/makedepend
-+MAKEDEPEND*=/local/ooo-build/ooo-build/build/ooo300-m3/solver/300/unxlngx6.pro/bin/makedepend
-
- SCP_CHECK_TOOL:=checkscp$E
-
-@@ -159,7 +159,7 @@ TYPE*=+type
- XARGS*=tr -d "\015" | xargs
- 4nt_force_shell:=+
- .ENDIF "$(USE_SHELL)"!="4nt"
--DUMPBIN*=dumpbin
-+DUMPBIN=wine "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\dumpbin.exe"
-
- .ELIF "$(GUI)"=="UNX" # "$(GUI)"=="WNT"
- SED*=sed
-diff --git a/solenv/inc/wntmsci11.mk b/solenv/inc/wntmsci11.mk
-index 5d3bb44..e5272c6 100755
---- a/solenv/inc/wntmsci11.mk
-+++ b/solenv/inc/wntmsci11.mk
-@@ -212,7 +212,7 @@ CDEFS+=-DWINVER=0x0500 -D_WIN32_IE=0x0500
- _VC_MANIFEST_BASENAME=__VC90
- .ENDIF
-
--LINK=link $(NOLOGO) /MACHINE:IX86
-+LINK=wine "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\link.exe" $(NOLOGO) /MACHINE:IX86
- LINKOUTPUTFILTER= $(PIPEERROR) $(GREP) -v "LNK4197:"
- .IF "$(PRODUCT)"!="full"
- .ELSE
-@@ -228,7 +228,8 @@ _VC_MANIFEST_INC=0
- .IF "$(PRODUCT)"!="full"
- LINKFLAGS+= -NODEFAULTLIB -DEBUG
- .ELSE # "$(PRODUCT)"!="full"
--LINKFLAGS+= -NODEFAULTLIB -RELEASE -DEBUG -INCREMENTAL:NO
-+#LINKFLAGS+= -NODEFAULTLIB -RELEASE -DEBUG -INCREMENTAL:NO #-DEBUG is broken, http://appdb.winehq.org/objectManager.php?sClass=version&iId=9569
-+LINKFLAGS+= -NODEFAULTLIB -RELEASE -INCREMENTAL:NO
- .ENDIF # "$(PRODUCT)"!="full"
- MAPFILE=-out:$$@
- .ENDIF # "$(linkinc)" != ""
-@@ -263,7 +264,7 @@ UWINAPILIB*=uwinapi.lib
- .IF "$(USE_STLP_DEBUG)" != ""
- LIBCMT=msvcrtd.lib
- .ELSE # "$(USE_STLP_DEBUG)" != ""
--LIBCMT=msvcrt.lib
-+LIBCMT="c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\lib\\msvcrt.lib"
- .ENDIF # "$(USE_STLP_DEBUG)" != ""
- .ELSE # "$(DYNAMIC_CRT)"!=""
- .IF "$(USE_STLP_DEBUG)" != ""
-@@ -280,10 +281,10 @@ STDSLOGUI=
- STDOBJCUI=
- STDSLOCUI=
-
--STDLIBGUIMT=$(LIBCMT) $(UWINAPILIB) kernel32.lib user32.lib oldnames.lib
--STDLIBCUIMT=$(LIBCMT) $(UWINAPILIB) kernel32.lib user32.lib oldnames.lib
--STDSHLGUIMT=$(LIBCMT) $(UWINAPILIB) kernel32.lib user32.lib oldnames.lib
--STDSHLCUIMT=$(LIBCMT) $(UWINAPILIB) kernel32.lib user32.lib oldnames.lib
-+STDLIBGUIMT=$(LIBCMT) $(UWINAPILIB) $(KERNEL32LIB) $(USER32LIB) $(OLDNAMESLIB)
-+STDLIBCUIMT=$(LIBCMT) $(UWINAPILIB) $(KERNEL32LIB) $(USER32LIB) $(OLDNAMESLIB)
-+STDSHLGUIMT=$(LIBCMT) $(UWINAPILIB) $(KERNEL32LIB) $(USER32LIB) $(OLDNAMESLIB)
-+STDSHLCUIMT=$(LIBCMT) $(UWINAPILIB) $(KERNEL32LIB) $(USER32LIB) $(OLDNAMESLIB)
-
- .IF "$(USE_STLP_DEBUG)" != ""
- LIBSTLPORT=stlport_vc71_stldebug.lib
-@@ -305,7 +306,7 @@ MFC_INCLUDE*=$(COMPATH)$/atlmfc$/include
- MFC_LIB*=$(COMPATH)$/atlmfc$/lib
- .ENDIF
-
--LIBMGR=lib $(NOLOGO)
-+LIBMGR=wine "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\lib.exe" $(NOLOGO)
- IMPLIB=lib
- LIBFLAGS=
-
-@@ -314,7 +315,7 @@ IMPLIBFLAGS=-machine:IX86
- MAPSYM=
- MAPSYMFLAGS=
-
--RC=rc
-+RC=wine "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Bin\\RC.Exe"
- RCFLAGS=-r -DWIN32 -fo$@ $(RCFILES)
- RCLINK=rc
- RCLINKFLAGS=
-@@ -327,7 +328,7 @@ PCHPOST=.pch
- CSC*=$(FLIPCMD) csc
- VBC*=vbc
-
--ADVAPI32LIB=advapi32.lib
-+ADVAPI32LIB="c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Lib\\advapi32.lib"
- SHELL32LIB=shell32.lib
- GDI32LIB=gdi32.lib
- OLE32LIB=ole32.lib
-@@ -340,8 +341,8 @@ WINMMLIB=winmm.lib
- WSOCK32LIB=wsock32.lib
- MPRLIB=mpr.lib
- WS2_32LIB=ws2_32.lib
--KERNEL32LIB=kernel32.lib
--USER32LIB=user32.lib
-+KERNEL32LIB="c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Lib\\kernel32.lib"
-+USER32LIB="c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Lib\\user32.lib"
- COMDLG32LIB=comdlg32.lib
- COMCTL32LIB=comctl32.lib
- CRYPT32LIB=crypt32.lib
-@@ -353,6 +354,6 @@ SHLWAPILIB=shlwapi.lib
- URLMONLIB=urlmon.lib
- UNICOWSLIB=unicows.lib
- WININETLIB=wininet.lib
--OLDNAMESLIB=oldnames.lib
-+OLDNAMESLIB="c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\lib\\oldnames.lib"
- MSIMG32LIB=msimg32.lib
-
-diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk
-index 847a51b..12bed44 100755
---- a/sw/source/ui/app/makefile.mk
-+++ b/sw/source/ui/app/makefile.mk
-@@ -100,5 +100,7 @@ LIB1OBJFILES= \
-
- .INCLUDE : target.mk
-
--$(SRS)$/app.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
-+COLON_HACK := :
-+
-+$(SRS)$/app.srs: $(subst,z$(COLON_HACK), $(SOLARINCDIR))$/svx$/globlmn.hrc
-
-diff --git a/sw/source/ui/ribbar/makefile.mk b/sw/source/ui/ribbar/makefile.mk
-index 2a64bcc..a55bd4e 100755
---- a/sw/source/ui/ribbar/makefile.mk
-+++ b/sw/source/ui/ribbar/makefile.mk
-@@ -67,5 +67,7 @@ SLOFILES = \
-
- .INCLUDE : target.mk
-
--$(SRS)$/ribbar.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
-+COLON_HACK := :
-+
-+$(SRS)$/ribbar.srs: $(subst,z$(COLON_HACK), $(SOLARINCDIR))$/svx$/globlmn.hrc
-
-diff --git a/sw/source/ui/shells/makefile.mk b/sw/source/ui/shells/makefile.mk
-index ad3f7fc..510a130 100755
---- a/sw/source/ui/shells/makefile.mk
-+++ b/sw/source/ui/shells/makefile.mk
-@@ -88,5 +88,7 @@ EXCEPTIONSFILES = \
-
- .INCLUDE : target.mk
-
--$(SRS)$/shells.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
-+COLON_HACK := :
-+
-+$(SRS)$/shells.srs: $(subst,z$(COLON_HACK), $(SOLARINCDIR))$/svx$/globlmn.hrc
-
-diff --git a/sw/source/ui/uiview/makefile.mk b/sw/source/ui/uiview/makefile.mk
-index 9647e32..ab2e772 100755
---- a/sw/source/ui/uiview/makefile.mk
-+++ b/sw/source/ui/uiview/makefile.mk
-@@ -83,5 +83,7 @@ SLOFILES = \
-
- .INCLUDE : target.mk
-
--$(SRS)$/uiview.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
-+COLON_HACK := :
-+
-+$(SRS)$/uiview.srs: $(subst,z$(COLON_HACK), $(SOLARINCDIR))$/svx$/globlmn.hrc
-
-diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
-index 097824b..061dd24 100755
---- a/sw/util/makefile.mk
-+++ b/sw/util/makefile.mk
-@@ -47,6 +47,8 @@ USE_DEFFILE=TRUE
- LINKFLAGS+=-Wl,-LD_LAYOUT:lgot_buffer=40
- .ENDIF
-
-+COLON_HACK := :
-+
- sw_res_files= \
- $(SRS)$/app.srs \
- $(SRS)$/dialog.srs \
-@@ -73,7 +75,7 @@ sw_res_files= \
- $(SRS)$/utlui.srs \
- $(SRS)$/web.srs \
- $(SRS)$/wrtsh.srs \
-- $(SOLARCOMMONRESDIR)$/sfx.srs
-+ $(subst,z$(COLON_HACK), $(SOLARCOMMONRESDIR))$/sfx.srs
-
- RESLIB1NAME=sw
- RESLIB1IMAGES=$(PRJ)$/imglst $(PRJ)$/res
-diff --git a/winenv.set.sh b/winenv.set.sh
-index 6ad392c..55163c0 100755
---- a/winenv.set.sh
-+++ b/winenv.set.sh
-@@ -5,16 +5,16 @@
- # 1. exec sh/bash/ksh
- # 2. source winenv.set
- # #################################################################
--SRC_ROOT="c:/ooo-build/ooo-build/build/ooo300-m3"
--SHELL="/usr/bin/bash"
-+SRC_ROOT="z:/local/ooo-build/ooo-build-win/build/ooo300-m3"
-+SHELL="/bin/bash"
- JAVA_HOME="c:/PROGRA~1/Java/JDK16~1.0_0"
--ANT_HOME="c:/ooo-build/ooo-build/build/apache-ant-1.7.0"
--ANT_LIB="c:/ooo-build/ooo-build/build/apache-ant-1.7.0/lib"
--ANT="c:/ooo-build/ooo-build/build/apache-ant-1.7.0/bin/ant"
-+ANT_HOME="z:/local/ooo-build/ooo-build-win/build/apache-ant-1.7.0"
-+ANT_LIB="z:/local/ooo-build/ooo-build-win/build/apache-ant-1.7.0/lib"
-+ANT="z:/local/ooo-build/ooo-build-win/build/apache-ant-1.7.0/bin/ant"
- JDKLIB="c:/PROGRA~1/Java/JDK16~1.0_0/lib"
- STLPORT4="NO_STLPORT4"
- STLPORT_VER="400"
--ASM_PATH="c:/PROGRA~1/MICROS~1.0/VC/bin"
-+ASM_PATH="\"c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\""
- BUILD_SOSL="true"
-
-
-@@ -75,7 +75,7 @@ MKDEPENDSOLVER="TRUE"
- #
- SOLAR_JAVA="TRUE"
- COM="MSC"
--COMPATH="c:/PROGRA~1/MICROS~1.0/VC"
-+COMPATH="\"c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\""
- CPU="I"
- CPUNAME="INTEL"
- CVER="M1500"
-@@ -97,7 +97,7 @@ FLIPCMD="slfl.pl"
- # Variable values.
- #
- CYGWIN_PATH="C:/cygwin/bin"
--PSDK_HOME="c:/PROGRA~1/MICROS~4/Windows/v6.1"
-+PSDK_HOME="\"c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\""
- WINDOWS_VISTA_PSDK="TRUE"
- DIRECTXSDK_LIB="c:/PROGRA~1/MI22C6~1/lib/x86"
- ATL_LIB="c:/PROGRA~1/MICROS~4/Windows/v6.1/lib"
-@@ -108,14 +108,14 @@ NSIS_PATH="c:/PROGRA~1/NSIS"
- DISABLE_ACTIVEX="TRUE"
- DISABLE_ATL="TRUE"
- USE_NEW_SDK="TRUE"
--TMPDIR="C:/cygwin/tmp"
--PERL="C:/cygwin/bin/perl"
-+TMPDIR="/tmp"
-+PERL="/usr/bin/perl"
- GNUMAKE="make"
- UPD="300"
- WORK_STAMP="OOO300"
--SOLARVER="c:/ooo-build/ooo-build/build/ooo300-m3/solver/300"
-+SOLARVER="z:/local/ooo-build/ooo-build-win/build/ooo300-m3/solver/300"
- SOLARVERSION="$SOLARVER"
--SOLARENV="c:/ooo-build/ooo-build/build/ooo300-m3/solenv"
-+SOLARENV="/local/ooo-build/ooo-build-win/build/ooo300-m3/solenv"
- SOLARENVINC="$SOLARENV/inc"
- LOCALINI="$SOLARENV/config"
- STAR_INIROOT="$SOLARENV/config"
-@@ -133,13 +133,15 @@ JAVAINTERPRETER="c:/PROGRA~1/Java/JDK16~1.0_0/bin/java.exe"
- JAVACOMPILER="c:/PROGRA~1/Java/JDK16~1.0_0/bin/javac.exe"
- JAVADOC="c:/PROGRA~1/Java/JDK16~1.0_0/bin/javadoc.exe"
- SCPDEFS=" -DWITH_ACTIVEX_COMPONENT"
--PATH=".:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solver/300/wntmsci12.pro/bin:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solenv/bin:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solenv/wntmsci12/bin:/cygdrive/c/PROGRA~1/Java/JDK16~1.0_0/bin:/cygdrive/c/PROGRA~1/Java/JDK16~1.0_0/jre/bin/client:/cygdrive/c/PROGRA~1/MICROS~1.0/VC/bin:/cygdrive/c/PROGRA~1/MICROS~1.0/Common7/IDE:/cygdrive/c/PROGRA~1/MICROS~4/Windows/v6.1/Bin:/cygdrive/c/Windows/MICROS~1.NET/FRAMEW~1/v3.5:/cygdrive/c/PROGRA~1/MICROS~1.0/VC/bin:/usr/bin:/cygdrive/c/PROGRA~1/NSIS:/cygdrive/c/PROGRA~1/MICROS~4/Windows/v6.1/bin:/cygdrive/c/ooo-build/ooo-build/build/bin:/usr/local/bin:/bin:/usr/X11R6/bin:/cygdrive/c/PROGRA~1/MI22C6~1/UTILIT~1/Bin/x86:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/ooo-build/ooo-build/bin"
-+#PATH=".:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solver/300/wntmsci12.pro/bin:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solenv/bin:/cygdrive/c/ooo-build/ooo-build/build/ooo300-m3/solenv/wntmsci12/bin:/cygdrive/c/PROGRA~1/Java/JDK16~1.0_0/bin:/cygdrive/c/PROGRA~1/Java/JDK16~1.0_0/jre/bin/client:/cygdrive/c/PROGRA~1/MICROS~1.0/VC/bin:/cygdrive/c/PROGRA~1/MICROS~1.0/Common7/IDE:/cygdrive/c/PROGRA~1/MICROS~4/Windows/v6.1/Bin:/cygdrive/c/Windows/MICROS~1.NET/FRAMEW~1/v3.5:/cygdrive/c/PROGRA~1/MICROS~1.0/VC/bin:/usr/bin:/cygdrive/c/PROGRA~1/NSIS:/cygdrive/c/PROGRA~1/MICROS~4/Windows/v6.1/bin:/cygdrive/c/ooo-build/ooo-build/build/bin:/usr/local/bin:/bin:/usr/X11R6/bin:/cygdrive/c/PROGRA~1/MI22C6~1/UTILIT~1/Bin/x86:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/ooo-build/ooo-build/bin"
- SOLARLIB=" -L$SOLARVER/$INPATH/lib -L../lib -L$SOLARENV/$OUTPATH/lib"
--SOLARINC=" -I. -I$SOLARVER/$INPATH/inc/stl -I$SOLARVER/$INPATH/inc/external -I$SOLARVER/$INPATH/inc -I$SOLARENV/$OUTPATH/inc -I$SOLARENV/inc -I$SRC_ROOT/res -Ic:/ooo-build/ooo-build/build/ooo300-m3/solver/300/wntmsci12.pro/inc/stl -I$JAVA_HOME/include/win32 -I$JAVA_HOME/include -I$PSDK_HOME/include -I$COMPATH/include -Ic:/PROGRA~1/MI22C6~1/include -Ic:/PROGRA~1/MI22C6~1/include"
-+SOLARINC=" -I. -I$SOLARVER/$INPATH/inc/stl -I$SOLARVER/$INPATH/inc/external -I$SOLARVER/$INPATH/inc -I$SOLARENV/$OUTPATH/inc -I$SOLARENV/inc -I$SRC_ROOT/res -Iz:/local/ooo-build/ooo-build-win/build/ooo300-m3/solver/300/wntmsci12.pro/inc/stl -I$JAVA_HOME/include/win32 -I$JAVA_HOME/include -I$PSDK_HOME/include -I$COMPATH/include -Ic:/PROGRA~1/MI22C6~1/include -Ic:/PROGRA~1/MI22C6~1/include"
- COMP_ENV="wntmsci12"
- JAVAHOME="$JAVA_HOME"
--CC="c:/PROGRA~1/MICROS~1.0/VC/bin/cl.exe"
--CXX="c:/PROGRA~1/MICROS~1.0/VC/bin/cl.exe"
-+CC="wine \"c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\cl.exe\""
-+CXX="wine \"c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\cl.exe\""
-+#CC="wine c:/PROGRA~1/MICROS~1.0/VC/bin/cl.exe"
-+#CXX="wine c:/PROGRA~1/MICROS~1.0/VC/bin/cl.exe"
- LFS_CFLAGS="-D_FILE_OFFSET_BITS=unknown -D_LARGE_FILES"
- ENABLE_DIRECTX="TRUE"
- ENABLE_LAYOUT="TRUE"
-@@ -160,7 +162,7 @@ SYSTEM_STDLIBS="NO"
- SYSTEM_ZLIB="NO"
- SYSTEM_OPENSSL="NO"
- SYSTEM_PYTHON="NO"
--HOME="/home/kendy"
-+HOME="/local/home/kendy"
- SYSTEM_ICU="NO"
- SYSTEM_JPEG="NO"
- SYSTEM_POPPLER="NO"
-@@ -195,18 +197,18 @@ SYSTEM_MYTHES="NO"
- GXX_INCLUDE_PATH="NO_GXX_INCLUDE"
- COMMON_BUILD_TOOLS="$SRC_ROOT/external/common"
- SOLARSRC="$SRC_ROOT"
--ILIB=".;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib;c:\\PROGRA~1\\Java\\JDK16~1.0_0\\lib;c:\\PROGRA~1\\MICROS~4\\Windows\\v6.1\\lib;c:\\PROGRA~1\\MICROS~4\\Windows\\v6.1\\lib;c:\\PROGRA~1\\MICROS~1.0\\VC\\lib;c:\\PROGRA~1\\MI22C6~1\\lib\\x86"
--GREP="$CYGWIN_PATH/grep.exe"
--FIND="$CYGWIN_PATH/find.exe"
--LS="$CYGWIN_PATH/ls.exe"
--GNUCOPY="$CYGWIN_PATH/cp.exe"
--TOUCH="$CYGWIN_PATH/touch.exe"
-+ILIB=".;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib;c:\\PROGRA~1\\Java\\JDK16~1.0_0\\lib;c:\\PROGRA~1\\MICROS~4\\Windows\\v6.1\\lib;c:\\PROGRA~1\\MICROS~4\\Windows\\v6.1\\lib;c:\\PROGRA~1\\MICROS~1.0\\VC\\lib;c:\\PROGRA~1\\MI22C6~1\\lib\\x86"
-+GREP="/usr/bin/grep"
-+FIND="/usr/bin/find"
-+LS="/bin/ls"
-+GNUCOPY="/bin/cp"
-+TOUCH="/usr/bin/touch"
- DELIVER="deliver.pl"
- MKOUT="mkout.pl"
- ZIPDEP="zipdep.pl"
- USE_SHELL="bash"
--PYTHONPATH=".;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\python;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\python\\lib-dynload;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\pyuno;c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\bin\\pyuno"
--PYTHONHOME="c:\\ooo-build\\ooo-build\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro"
-+PYTHONPATH=".;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\python;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\python\\lib-dynload;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\lib\\pyuno;z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro\\bin\\pyuno"
-+PYTHONHOME="z:\\local\\ooo-build\\ooo-build-win\\build\\ooo300-m3\\solver\\300\\wntmsci12.pro"
-
- #
- # Aliases.
diff --git a/patches/test/wmf-clipperf.diff b/patches/test/wmf-clipperf.diff
deleted file mode 100644
index 0ff8a69db..000000000
--- a/patches/test/wmf-clipperf.diff
+++ /dev/null
@@ -1,439 +0,0 @@
-Use the new B2DClipState to improve wmf clip performance
-
-From: Thorsten Behrens <thb@openoffice.org>
-
-
----
-
- svtools/source/filter.vcl/wmf/winmtf.cxx | 178 ++++++++++++------------------
- svtools/source/filter.vcl/wmf/winmtf.hxx | 54 +++++----
- svtools/util/makefile.mk | 1
- 3 files changed, 97 insertions(+), 136 deletions(-)
-
-
-diff --git svtools/source/filter.vcl/wmf/winmtf.cxx svtools/source/filter.vcl/wmf/winmtf.cxx
-index 666b0a0..026d024 100644
---- svtools/source/filter.vcl/wmf/winmtf.cxx
-+++ svtools/source/filter.vcl/wmf/winmtf.cxx
-@@ -33,8 +33,11 @@
-
-
- #include "winmtf.hxx"
-+#include <basegfx/matrix/b2dhommatrix.hxx>
-+#include <basegfx/polygon/b2dpolypolygontools.hxx>
- #include <vcl/metaact.hxx>
- #include <vcl/graphictools.hxx>
-+#include <vcl/canvastools.hxx>
- #include <vcl/metric.hxx>
- #include <rtl/tencinfo.h>
-
-@@ -45,99 +48,56 @@
-
- #define WIN_MTF_MAX_POLYPOLYCOUNT 16
-
--void WinMtfClipPath::ImpUpdateType()
-+void WinMtfClipPath::intersectClipRect( const Rectangle& rRect )
- {
-- if ( !aPolyPoly.Count() )
-- eType = EMPTY;
-- else if ( aPolyPoly.IsRect() )
-- eType = RECTANGLE;
-- else
-- eType = COMPLEX;
--
-- bNeedsUpdate = sal_True;
--}
--
--void WinMtfClipPath::IntersectClipRect( const Rectangle& rRect )
--{
-- if ( !aPolyPoly.Count() )
-- aPolyPoly = Polygon( rRect );
-- else if ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
-- {
-- Polygon aPolygon( rRect );
-- PolyPolygon aIntersection;
-- PolyPolygon aPolyPolyRect( aPolygon );
-- aPolyPoly.GetIntersection( aPolyPolyRect, aIntersection );
-- aPolyPoly = aIntersection;
-- }
-- ImpUpdateType();
-+ maClip.intersectRange(
-+ vcl::unotools::b2DRectangleFromRectangle(rRect));
- }
-
--void WinMtfClipPath::ExcludeClipRect( const Rectangle& rRect )
-+void WinMtfClipPath::excludeClipRect( const Rectangle& rRect )
- {
-- if ( aPolyPoly.Count() && ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) )
-- {
-- Polygon aPolygon( rRect );
-- PolyPolygon aPolyPolyRect( aPolygon );
-- PolyPolygon aDifference;
-- aPolyPoly.GetDifference( aPolyPolyRect, aDifference );
-- aPolyPoly = aDifference;
-- }
-- ImpUpdateType();
-+ maClip.subtractRange(
-+ vcl::unotools::b2DRectangleFromRectangle(rRect));
- }
-
--void WinMtfClipPath::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode )
-+void WinMtfClipPath::setClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode )
- {
-- if ( !rPolyPolygon.Count() )
-- aPolyPoly = rPolyPolygon;
-- else if ( rPolyPolygon.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
-+ const basegfx::B2DPolyPolygon& rB2DPoly=rPolyPolygon.getB2DPolyPolygon();
-+ switch ( nClippingMode )
- {
-- PolyPolygon aNewClipPath;
--
-- // #115345# Watch out for empty aPolyPoly here - conceptually,
-- // an empty clip path is a rectangle of infinite size, but it
-- // is represented by an empty aPolyPoly. When intersecting
-- // rPolyPolygon with this _empty_ aPolyPoly, set algebra
-- // guarantees wrong results.
-- switch ( nClippingMode )
-- {
-- case RGN_OR :
-- // #115345# clip stays empty, when ORing an arbitrary
-- // rPolyPolygon. Thus, we can save us the unnecessary
-- // clipper call.
-- if( aPolyPoly.Count() )
-- aPolyPoly.GetUnion( rPolyPolygon, aNewClipPath );
-+ case RGN_OR :
-+ maClip.unionPolyPolygon(rB2DPoly);
- break;
-- case RGN_XOR :
-- // TODO:
-- // #115345# Cannot handle this case, for the time being
-- aPolyPoly.GetXOR( rPolyPolygon, aNewClipPath );
-+ case RGN_XOR :
-+ maClip.xorPolyPolygon(rB2DPoly);
- break;
-- case RGN_DIFF :
-- // TODO:
-- // #115345# Cannot handle this case, for the time being
-- aPolyPoly.GetDifference( rPolyPolygon, aNewClipPath );
-+ case RGN_DIFF :
-+ maClip.subtractPolyPolygon(rB2DPoly);
- break;
-- case RGN_AND :
-- // #115345# Clip becomes rPolyPolygon, when ANDing
-- // with an arbitrary rPolyPolygon
-- if( aPolyPoly.Count() )
-- aPolyPoly.GetIntersection( rPolyPolygon, aNewClipPath );
-- else
-- aNewClipPath = rPolyPolygon;
-+ case RGN_AND :
-+ maClip.intersectPolyPolygon(rB2DPoly);
- break;
-- case RGN_COPY :
-- aNewClipPath = rPolyPolygon;
-+ case RGN_COPY :
-+ maClip = basegfx::tools::B2DClipState(rB2DPoly);
- break;
-- }
-- aPolyPoly = aNewClipPath;
- }
-- ImpUpdateType();
- }
-
--void WinMtfClipPath::MoveClipRegion( const Size& rSize )
-+void WinMtfClipPath::moveClipRegion( const Size& rSize )
-+{
-+ // what a weird concept. emulate, don't want this in B2DClipState
-+ // API
-+ basegfx::B2DPolyPolygon aCurrClip=maClip.getClipPoly();
-+ basegfx::B2DHomMatrix aTranslate;
-+ aTranslate.translate(rSize.Width(), rSize.Height());
-+
-+ aCurrClip.transform(aTranslate);
-+ maClip = basegfx::tools::B2DClipState( aCurrClip );
-+}
-+
-+basegfx::B2DPolyPolygon WinMtfClipPath::getClipPath() const
- {
-- aPolyPoly.Move( rSize.Width(), rSize.Height() );
-- bNeedsUpdate = sal_True;
-+ return maClip.getClipPoly();
- }
-
- // ------------------------------------------------------------------------
-@@ -882,31 +842,35 @@ void WinMtfOutput::DeleteObject( sal_Int32 nIndex )
-
- void WinMtfOutput::IntersectClipRect( const Rectangle& rRect )
- {
-- aClipPath.IntersectClipRect( ImplMap( rRect ) );
-+ mbClipNeedsUpdate=true;
-+ aClipPath.intersectClipRect( ImplMap( rRect ) );
- }
-
- //-----------------------------------------------------------------------------------
-
- void WinMtfOutput::ExcludeClipRect( const Rectangle& rRect )
- {
-- aClipPath.ExcludeClipRect( ImplMap( rRect ) );
-+ mbClipNeedsUpdate=true;
-+ aClipPath.excludeClipRect( ImplMap( rRect ) );
- }
-
- //-----------------------------------------------------------------------------------
-
- void WinMtfOutput::MoveClipRegion( const Size& rSize )
- {
-- aClipPath.MoveClipRegion( ImplMap( rSize ) );
-+ mbClipNeedsUpdate=true;
-+ aClipPath.moveClipRegion( ImplMap( rSize ) );
- }
-
- void WinMtfOutput::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode, sal_Bool bIsMapped )
- {
-+ mbClipNeedsUpdate=true;
- if ( bIsMapped )
-- aClipPath.SetClipPath( rPolyPolygon, nClippingMode );
-+ aClipPath.setClipPath( rPolyPolygon, nClippingMode );
- else
- {
- PolyPolygon aPP( rPolyPolygon );
-- aClipPath.SetClipPath( ImplMap( aPP ), nClippingMode );
-+ aClipPath.setClipPath( ImplMap( aPP ), nClippingMode );
- }
- }
-
-@@ -928,6 +892,8 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) :
- maActPos ( Point() ),
- mbNopMode ( sal_False ),
- mbFillStyleSelected ( sal_False ),
-+ mbClipNeedsUpdate ( true ),
-+ mbComplexClip ( false ),
- mnGfxMode ( GM_COMPATIBLE ),
- mnMapMode ( MM_TEXT ),
- mnDevOrgX ( 0 ),
-@@ -979,31 +945,25 @@ WinMtfOutput::~WinMtfOutput()
-
- void WinMtfOutput::UpdateClipRegion()
- {
-- if ( aClipPath.bNeedsUpdate )
-+ if ( mbClipNeedsUpdate )
- {
-- aClipPath.bNeedsUpdate = sal_False;
-+ mbClipNeedsUpdate = false;
-+ mbComplexClip = false;
-
- mpGDIMetaFile->AddAction( new MetaPopAction() ); // taking the orignal clipregion
- mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); //
-
-- switch ( aClipPath.GetType() )
-+ // skip for 'no clipping at all' case
-+ if( !aClipPath.isEmpty() )
- {
-- case RECTANGLE :
-- case COMPLEX :
-- {
--// we will not generate a RegionClipRegion Action, because this action
--// cannot be saved to the wmf format - saving to wmf always happens
--// if the placeholder graphic for ole objects is generated. (SJ)
--
--// Region aClipRegion( aClipPath.GetClipPath() );
--// mpGDIMetaFile->AddAction( new MetaISectRegionClipRegionAction( aClipRegion ) );
--
-- Rectangle aClipRect( aClipPath.GetClipPath().GetBoundRect() );
-- mpGDIMetaFile->AddAction( new MetaISectRectClipRegionAction( aClipRect ) );
-- }
-- break;
-- case EMPTY:
-- break; // -Wall not handled.
-+ const basegfx::B2DPolyPolygon& rClipPoly( aClipPath.getClipPath() );
-+ mpGDIMetaFile->AddAction(
-+ new MetaISectRectClipRegionAction(
-+ vcl::unotools::rectangleFromB2DRectangle(
-+ rClipPoly.getB2DRange())));
-+
-+ mbComplexClip = rClipPoly.count() > 1
-+ || !basegfx::tools::isRectangle(rClipPoly);
- }
- }
- }
-@@ -1182,12 +1142,12 @@ void WinMtfOutput::DrawRect( const Rectangle& rRect, BOOL bEdge )
- UpdateClipRegion();
- UpdateFillStyle();
-
-- if ( aClipPath.GetType() == COMPLEX )
-+ if ( mbComplexClip )
- {
- Polygon aPoly( ImplMap( rRect ) );
- PolyPolygon aPolyPolyRect( aPoly );
- PolyPolygon aDest;
-- aClipPath.GetClipPath().GetIntersection( aPolyPolyRect, aDest );
-+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPolyRect, aDest );
- ImplDrawClippedPolyPolygon( aDest );
- }
- else
-@@ -1342,11 +1302,11 @@ void WinMtfOutput::DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath )
- {
- UpdateFillStyle();
-
-- if ( aClipPath.GetType() == COMPLEX )
-+ if ( mbComplexClip )
- {
- PolyPolygon aPolyPoly( rPolygon );
- PolyPolygon aDest;
-- aClipPath.GetClipPath().GetIntersection( aPolyPoly, aDest );
-+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPoly, aDest );
- ImplDrawClippedPolyPolygon( aDest );
- }
- else
-@@ -1418,10 +1378,10 @@ void WinMtfOutput::DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordP
- {
- UpdateFillStyle();
-
-- if ( aClipPath.GetType() == COMPLEX )
-+ if ( mbComplexClip )
- {
- PolyPolygon aDest;
-- aClipPath.GetClipPath().GetIntersection( rPolyPolygon, aDest );
-+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( rPolyPolygon, aDest );
- ImplDrawClippedPolyPolygon( aDest );
- }
- else
-@@ -1656,7 +1616,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry
- void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap )
- {
- BitmapEx aBmpEx( rBitmap );
-- if ( aClipPath.GetType() == COMPLEX )
-+ if ( mbComplexClip )
- {
- VirtualDevice aVDev;
- MapMode aMapMode( MAP_100TH_MM );
-@@ -1671,7 +1631,7 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
- aVDev.SetMapMode( aMapMode );
- aVDev.SetOutputSizePixel( aSizePixel );
- aVDev.SetFillColor( Color( COL_BLACK ) );
-- const PolyPolygon aClip( aClipPath.GetClipPath() );
-+ const PolyPolygon aClip( aClipPath.getClipPath() );
- aVDev.DrawPolyPolygon( aClip );
- const Point aEmptyPoint;
-
-@@ -2220,7 +2180,7 @@ void WinMtfOutput::Pop()
- if ( ! ( aClipPath == pSave->aClipPath ) )
- {
- aClipPath = pSave->aClipPath;
-- aClipPath.bNeedsUpdate = sal_True;
-+ mbClipNeedsUpdate = true;
- }
- if ( meLatestRasterOp != meRasterOp )
- mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) );
-diff --git svtools/source/filter.vcl/wmf/winmtf.hxx svtools/source/filter.vcl/wmf/winmtf.hxx
-index 19e2a06..9286953 100644
---- svtools/source/filter.vcl/wmf/winmtf.hxx
-+++ svtools/source/filter.vcl/wmf/winmtf.hxx
-@@ -48,6 +48,7 @@
- #include <vcl/graph.hxx>
- #include <vcl/virdev.hxx>
- #include <tools/poly.hxx>
-+#include <basegfx/tools/b2dclipstate.hxx>
- #include <vcl/font.hxx>
- #include <vcl/bmpacc.hxx>
- #include <vcl/lineinfo.hxx>
-@@ -311,34 +312,26 @@ struct LOGFONTW
- void WinMtfAssertHandler( const sal_Char*, sal_uInt32 nFlags = WIN_MTF_ASSERT_MIFE );
- #endif
-
--enum WinMtfClipPathType{ EMPTY, RECTANGLE, COMPLEX };
--
- class WinMtfClipPath
- {
-- PolyPolygon aPolyPoly;
-- WinMtfClipPathType eType;
--
-- void ImpUpdateType();
--
-- public :
--
-- sal_Bool bNeedsUpdate;
--
-- WinMtfClipPath(): eType(EMPTY), bNeedsUpdate( sal_False ){};
-+ basegfx::tools::B2DClipState maClip;
-
-- void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode );
-- void IntersectClipRect( const Rectangle& rRect );
-- void ExcludeClipRect( const Rectangle& rRect );
-- void MoveClipRegion( const Size& rSize );
-+public :
-+ WinMtfClipPath(): maClip() {};
-
-- WinMtfClipPathType GetType() const { return eType; };
-- const PolyPolygon& GetClipPath() const { return aPolyPoly; };
-+ void setClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode );
-+ void intersectClipRect( const Rectangle& rRect );
-+ void excludeClipRect( const Rectangle& rRect );
-+ void moveClipRegion( const Size& rSize );
-
-- sal_Bool operator==( const WinMtfClipPath& rPath )
-- {
-- return ( rPath.eType == eType ) &&
-- ( rPath.aPolyPoly == aPolyPoly );
-- };
-+ bool isEmpty() const { return maClip.isCleared(); }
-+
-+ basegfx::B2DPolyPolygon getClipPath() const;
-+
-+ bool operator==( const WinMtfClipPath& rPath ) const
-+ {
-+ return maClip == rPath.maClip;
-+ };
- };
-
- class WinMtfPathObj : public PolyPolygon
-@@ -380,20 +373,25 @@ struct WinMtfFillStyle
-
- WinMtfFillStyle() :
- aFillColor ( Color( COL_BLACK ) ),
-- bTransparent( FALSE )
-+ bTransparent( FALSE ),
-+ aType(),
-+ aBmp()
- {
- };
-
- WinMtfFillStyle( const Color& rColor, BOOL bTrans = FALSE ) :
- aFillColor ( rColor ),
- bTransparent( bTrans ),
-- aType ( FillStyleSolid )
-+ aType ( FillStyleSolid ),
-+ aBmp()
- {
- };
-
- WinMtfFillStyle( Bitmap& rBmp ) :
-- aBmp ( rBmp ),
-- aType( FillStylePattern )
-+ aFillColor (),
-+ bTransparent( FALSE ),
-+ aType( FillStylePattern ),
-+ aBmp ( rBmp )
- {
- };
-
-@@ -584,6 +582,8 @@ class WinMtfOutput
- sal_uInt32 mnRop;
- sal_Bool mbNopMode;
- sal_Bool mbFillStyleSelected;
-+ sal_Bool mbClipNeedsUpdate;
-+ sal_Bool mbComplexClip;
-
- std::vector< SaveStructPtr > vSaveStack;
-
-diff --git svtools/util/makefile.mk svtools/util/makefile.mk
-index d401956..2f869a2 100644
---- svtools/util/makefile.mk
-+++ svtools/util/makefile.mk
-@@ -139,6 +139,7 @@ SHL1STDLIBS+= \
- $(VCLLIB) \
- $(SVLLIB) \
- $(SOTLIB) \
-+ $(BASEGFXLIB) \
- $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(I18NISOLANGLIB) \
diff --git a/patches/test/word-read-custom-toolbar-filter.diff b/patches/test/word-read-custom-toolbar-filter.diff
deleted file mode 100644
index 29c5a910b..000000000
--- a/patches/test/word-read-custom-toolbar-filter.diff
+++ /dev/null
@@ -1,2332 +0,0 @@
-diff --git svx/prj/d.lst svx/prj/d.lst
-index 71d507e..c056d62 100644
---- svx/prj/d.lst
-+++ svx/prj/d.lst
-@@ -662,5 +662,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table
- ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx
- ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx
- ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx
-+..\inc\svx\mstoolbar.hxx %_DEST%\inc%_EXT%\svx\mstoolbar.hxx
-
- ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
-diff --git svx/source/msfilter/makefile.mk svx/source/msfilter/makefile.mk
-index 8db71d1..768bc0e 100644
---- svx/source/msfilter/makefile.mk
-+++ svx/source/msfilter/makefile.mk
-@@ -54,7 +54,8 @@ SLOFILES=\
- $(SLO)$/msocximex.obj \
- $(SLO)$/msashape3d.obj \
- $(SLO)$/mscodec.obj \
-- $(SLO)$/msfiltertracer.obj
-+ $(SLO)$/msfiltertracer.obj\
-+ $(SLO)$/mstoolbar.obj\
-
- EXCEPTIONSFILES= \
- $(SLO)$/eschesdo.obj \
-@@ -65,7 +66,8 @@ EXCEPTIONSFILES= \
- $(SLO)$/msocximex.obj \
- $(SLO)$/msoleexp.obj \
- $(SLO)$/svxmsbas.obj \
-- $(SLO)$/msfiltertracer.obj
-+ $(SLO)$/msfiltertracer.obj\
-+ $(SLO)$/mstoolbar.obj\
-
- .INCLUDE : target.mk
-
-diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
-index 25cb969..3360d48 100644
---- sw/source/filter/ww8/makefile.mk
-+++ sw/source/filter/ww8/makefile.mk
-@@ -68,7 +68,8 @@ EXCEPTIONSFILES = \
- $(SLO)$/writerwordglue.obj \
- $(SLO)$/ww8scan.obj \
- $(SLO)$/WW8TableInfo.obj \
-- $(SLO)$/WW8FFData.obj
-+ $(SLO)$/WW8FFData.obj \
-+ $(SLO)$/ww8toolbar.obj \
-
-
- SLOFILES = \
-@@ -95,7 +96,9 @@ SLOFILES = \
- $(SLO)$/writerhelper.obj \
- $(SLO)$/writerwordglue.obj \
- $(SLO)$/WW8TableInfo.obj \
-- $(SLO)$/WW8FFData.obj
-+ $(SLO)$/WW8FFData.obj \
-+ $(SLO)$/ww8toolbar.obj \
-+
-
-
- # --- Tagets -------------------------------------------------------
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index a7f122b..3b42acd 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -142,11 +142,12 @@
- #include <stdio.h>
- #include <comphelper/processfactory.hxx>
- #include <basic/basmgr.hxx>
--
- #ifdef DEBUG
- #include <iostream>
- #include <dbgoutsw.hxx>
- #endif
-+#include <fstream>
-+#include "ww8toolbar.hxx"
-
- #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
- #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
-@@ -4173,7 +4174,40 @@ ULONG SwWW8ImplReader::SetSubStreams(SvStorageStreamRef &rTableStream,
- rTableStream = pStg->OpenSotStream( String::CreateFromAscii(
- pWwFib->fWhichTblStm ? SL::a1Table : SL::a0Table),
- STREAM_STD_READ);
-+#if 1
-+ if ( pWwFib->fWhichTblStm )
-+ {
-+// dump a1Table stream here !!!
-+ OSL_TRACE("About to dump 1table ");
-+ long nCur = rTableStream->Tell();
-+ std::ofstream fDump( "1Table.dump" );
-+
-+ while ( !rTableStream->IsEof() )
-+ {
-+ sal_uInt8 aByte;
-+ *rTableStream >> aByte;
-+ fDump << aByte;
-+ }
-+
-+ fDump.flush();
-+ rTableStream->Seek( nCur ); // restore stream pointer
-
-+// attempt to read where the offset to the Customizations is (
-+// also we should be able to find the offset to the macro table too
-+ if ( pWwFib->lcbCmds )
-+ {
-+ // there is a tgc255 structure
-+ OSL_TRACE(" tgc255 has offset 0x%x with length 0x%x", pWwFib->fcCmds, pWwFib->lcbCmds );
-+ Tcg aTCG;
-+ rTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
-+ if (!aTCG.Read( rTableStream ) )
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ rTableStream->Seek( nCur ); // return to previous position
-+ aTCG.Print( stderr );
-+ aTCG.ImportCustomToolBar( mpDocShell->GetModel() );
-+ }
-+ }
-+#endif
- pTableStream = &rTableStream;
- pTableStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
-
-diff --git vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmap2.cxx
-index 5e931a7..7c5be41 100644
---- vcl/source/gdi/bitmap2.cxx
-+++ vcl/source/gdi/bitmap2.cxx
-@@ -49,6 +49,7 @@
-
- #define DIBCOREHEADERSIZE ( 12UL )
- #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
-+#define BITMAPINFOHEADER 0x28
- #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
-
- // ----------------------
-@@ -308,16 +309,32 @@ BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal
- rIStm >> rHeader.nSize;
-
- // BITMAPCOREHEADER
-+ sal_Int16 nTmp16 = 0;
-+ sal_uInt8 nTmp8 = 0;
- if ( rHeader.nSize == DIBCOREHEADERSIZE )
- {
-- sal_Int16 nTmp16;
-
- rIStm >> nTmp16; rHeader.nWidth = nTmp16;
- rIStm >> nTmp16; rHeader.nHeight = nTmp16;
- rIStm >> rHeader.nPlanes;
- rIStm >> rHeader.nBitCount;
- }
-- else
-+ else if ( rHeader.nSize == BITMAPINFOHEADER )
-+ {
-+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
-+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
-+ rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
-+ rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
-+ rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
-+ rIStm >> nTmp16; rHeader.nCompression = nTmp16;
-+ if ( !rHeader.nSizeImage ) // uncompressed?
-+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
-+ rIStm >> rHeader.nXPelsPerMeter;
-+ rIStm >> rHeader.nYPelsPerMeter;
-+ rIStm >> rHeader.nColsUsed;
-+ rIStm >> rHeader.nColsImportant;
-+ }
-+ else
- {
- // unknown Header
- if( rHeader.nSize < DIBINFOHEADERSIZE )
---- /dev/null 2008-12-03 05:56:56.000000000 +0000
-+++ sw/source/filter/ww8/ww8toolbar.hxx 2009-02-04 17:47:05.000000000 +0000
-@@ -0,0 +1,340 @@
-+#ifndef _WW8TOOLBAR_HXX
-+#define _WW8TOOLBAR_HXX
-+
-+#include <svx/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class Xst : public TBBase
-+{
-+ rtl::OUString sString;
-+public:
-+ Xst(){}
-+ bool Read(SotStorageStream *pS);
-+ rtl::OUString getString() { return sString; }
-+ void Print( FILE* fp );
-+};
-+
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr< sal_uInt32 > cid; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+};
-+
-+class TB : public TBBase
-+{
-+ sal_Int8 bSignature; //Signed integer that specifies the toolbar signature number. MUST be 0x02.
-+ sal_Int8 bVersion; //Signed integer that specifies the toolbar version number. MUST be 0x01.
-+ sal_Int16 cCL; //Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
-+ sal_Int32 ltbid; //Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
-+ sal_uInt32 ltbtr; //Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
-+ sal_uInt16 cRowsDefault; //Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
-+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
-+ WString name; //Structure of type WString that specifies the toolbar name.
-+ TB(const TB&);
-+ TB& operator = ( const TB&);
-+public:
-+ TB();
-+ ~TB(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class CTB : public TBBase
-+{
-+ Xst name;
-+ sal_Int32 cbTBData;
-+ TB tb;
-+ sal_uInt8 rVisualData[ 100 ];
-+ sal_Int32 iWCTBl;
-+ sal_uInt16 reserved;
-+ sal_uInt16 unused;
-+ sal_Int32 cCtls;
-+ std::vector< TBC > rTBC;
-+
-+ CTB(const CTB&);
-+ CTB& operator = ( const CTB&);
-+public:
-+ CTB();
-+ ~CTB();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* fp );
-+ bool ImportCustomToolBar( CustomToolBarImportHelper& );
-+};
-+
-+class TBDelta : public TBBase
-+{
-+ sal_uInt8 doprfatendFlags;
-+ sal_uInt8 ibts;
-+ sal_Int32 cidNext;
-+ sal_Int32 cid;
-+ sal_Int32 fc;
-+ sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
-+ sal_uInt16 cbTBC;
-+public:
-+ TBDelta();
-+ ~TBDelta(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Tcg255SubStruct : public TBBase
-+{
-+friend class Tcg255;
-+ bool mbReadId;
-+ Tcg255SubStruct(const Tcg255SubStruct&);
-+ Tcg255SubStruct& operator = ( const Tcg255SubStruct&);
-+protected:
-+ sal_uInt8 ch;
-+public:
-+ Tcg255SubStruct( bool bReadId );
-+ ~Tcg255SubStruct(){}
-+ virtual sal_uInt8 id() const { return ch; }
-+ bool Read(SotStorageStream *pS);
-+};
-+
-+class Customization : public TBBase
-+{
-+ sal_Int32 tbidForTBD;
-+ sal_uInt16 reserved1;
-+ sal_Int16 ctbds;
-+
-+ boost::shared_ptr< CTB > customizationDataCTB;
-+ std::vector< TBDelta > customizationDataTBDelta;
-+
-+public:
-+ Customization();
-+ ~Customization();
-+ bool Read(SotStorageStream *pS);
-+ bool ImportCustomToolBar( CustomToolBarImportHelper& );
-+ void Print( FILE* );
-+};
-+
-+class CTBWrapper : public Tcg255SubStruct
-+{
-+ // reserved1 is the ch field of Tcg255SubStruct
-+ sal_uInt16 reserved2;
-+ sal_uInt8 reserved3;
-+ sal_uInt16 reserved4;
-+ sal_uInt16 reserved5;
-+
-+ sal_Int16 cbTBD;
-+ sal_Int16 cCust;
-+
-+ sal_Int32 cbDTBC;
-+
-+ std::vector< TBC > rtbdc; // array of TBC's - we don't read these yet
-+ std::vector< Customization > rCustomizations; // array of Customizations
-+
-+ CTBWrapper(const CTBWrapper&);
-+ CTBWrapper& operator = ( const CTBWrapper&);
-+public:
-+ CTBWrapper( bool bReadId = true );
-+ ~CTBWrapper();
-+ bool Read(SotStorageStream *pS);
-+ bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+ void Print( FILE* );
-+};
-+
-+class MCD : public TBBase
-+{
-+ sal_Int8 reserved1; // A signed integer that MUST be 0x56.
-+ sal_uInt8 reserved2; // MUST be 0.
-+ sal_uInt16 ibst; // Unsigned integer that specifies the name of the macro. Macro name is specified by MacroName.xstz of the MacroName entry in the MacroNames such that MacroName.ibst equals ibst. MacroNames MUST contain such an entry.
-+ sal_uInt16 ibstName; // An unsigned integer that specifies the index into the Command String Table (TcgSttbf.sttbf) where the macro‘s name and arguments are specified.
-+ sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
-+ sal_uInt32 reserved4; //MUST be ignored.
-+ sal_uInt32 reserved5; //MUST be 0.
-+ sal_uInt32 reserved6; //MUST be ignored.
-+ sal_uInt32 reserved7; //MUST be ignored
-+
-+ MCD(const MCD&);
-+ MCD& operator = ( const MCD&);
-+public:
-+ MCD();
-+ ~MCD(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfMcd : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ MCD* rgmcd; // array of MCD's
-+ PlfMcd(const PlfMcd&);
-+ PlfMcd& operator = ( const PlfMcd&);
-+public:
-+ PlfMcd( bool bReadId = true );
-+ ~PlfMcd();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Acd : public TBBase
-+{
-+ sal_Int16 ibst;
-+ sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
-+ Acd(const Acd&);
-+ Acd& operator = ( const Acd&);
-+public:
-+ Acd();
-+ ~Acd(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfAcd: public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Acd* rgacd;
-+ PlfAcd(const PlfAcd&);
-+ PlfAcd& operator = ( const PlfAcd&);
-+public:
-+ PlfAcd( bool bReadId = true );
-+ ~PlfAcd();
-+ bool Read(SotStorageStream *pS);
-+ void Print(FILE*);
-+};
-+
-+class Kme : public TBBase
-+{
-+ sal_Int16 reserved1; //MUST be zero.
-+ sal_Int16 reserved2; //MUST be zero.
-+ sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
-+ sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
-+ sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
-+ sal_uInt32 param; //The meaning of this field depends on the value of kt
-+
-+ Kme(const Kme&);
-+ Kme& operator = ( const Kme&);
-+public:
-+ Kme();
-+ ~Kme();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfKme : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Kme* rgkme;
-+ PlfKme(const PlfKme&);
-+ PlfKme& operator = ( const PlfKme&);
-+public:
-+ PlfKme( bool bReadId = true );
-+ ~PlfKme();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TcgSttbfCore : public TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ sal_uInt16 extraData;
-+ SBBItem() : cchData(0), extraData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+ SBBItem* dataItems;
-+ TcgSttbfCore(const TcgSttbfCore&);
-+ TcgSttbfCore& operator = ( const TcgSttbfCore&);
-+public:
-+ TcgSttbfCore();
-+ ~TcgSttbfCore();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class TcgSttbf : public Tcg255SubStruct
-+{
-+ TcgSttbfCore sttbf;
-+ TcgSttbf(const TcgSttbf&);
-+ TcgSttbf& operator = ( const TcgSttbf&);
-+public:
-+ TcgSttbf( bool bReadId = true );
-+ ~TcgSttbf(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class Xstz : public TBBase
-+{
-+ Xst xst; //An Xst specifying the string with its pre-pended length.
-+ sal_uInt16 chTerm;
-+
-+ Xstz(const Xstz&);
-+ Xstz& operator = ( const Xstz&);
-+public:
-+ Xstz();
-+ ~Xstz(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class MacroName : public TBBase
-+{
-+ sal_uInt16 ibst; //An unsigned integer that specifies the index of the current entry in the macro name table. MUST NOT be the same as the index of any other entry.
-+ Xstz xstz;
-+ MacroName(const MacroName&);
-+ MacroName& operator = ( const MacroName&);
-+public:
-+ MacroName();
-+ ~MacroName(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class MacroNames : public Tcg255SubStruct
-+{
-+ sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
-+ MacroName* rgNames;
-+
-+ MacroNames(const MacroNames&);
-+ MacroNames& operator = ( const MacroNames&);
-+public:
-+ MacroNames( bool bReadId = true );
-+ ~MacroNames();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Tcg255 : public TBBase
-+{
-+ std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
-+ Tcg255(const Tcg255&);
-+ Tcg255& operator = ( const Tcg255&);
-+ bool processSubStruct( sal_uInt8 nId, SotStorageStream* );
-+public:
-+ Tcg255();
-+ ~Tcg255();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+};
-+
-+class Tcg: public TBBase
-+{
-+ sal_Int8 nTcgVer;
-+ std::auto_ptr< Tcg255 > tcg;
-+ Tcg(const Tcg&);
-+ Tcg& operator = ( const Tcg&);
-+public:
-+ Tcg();
-+ ~Tcg(){}
-+ bool Read(SotStorageStream *pS);
-+ bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+ void Print( FILE* );
-+};
-+
-+#endif
---- /dev/null 2008-12-03 05:56:56.000000000 +0000
-+++ sw/source/filter/ww8/ww8toolbar.cxx 2009-02-04 17:54:21.000000000 +0000
-@@ -0,0 +1,974 @@
-+#include "ww8toolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <vcl/graph.hxx>
-+
-+using namespace com::sun::star;
-+
-+CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,reserved2(0)
-+,reserved3(0)
-+,reserved4(0)
-+,reserved5(0)
-+,cbTBD(0)
-+,cCust(0)
-+,cbDTBC(0)
-+,rtbdc(0)
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+bool CTBWrapper::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
-+ *pS >> cbTBD >> cCust >> cbDTBC;
-+ if ( cbDTBC )
-+ {
-+ // cbDTBC is the size in bytes of the TBC array
-+ // but the size of a TBC element is dynamic ( and this relates to TBDelta's
-+ // which we don't read right now )
-+ //pS->SeekRel( cbDTBC );
-+ int nStart = pS->Tell();
-+
-+ int bytesRead = 0;
-+ int bytesToRead = cbDTBC - bytesRead;
-+ // cbDTBC specifies the size ( in bytes ) taken by an array ( of unspecified size )
-+ // of TBC records ( TBC records have dynamic length, so we need to check our position
-+ // after each read )
-+ do
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rtbdc.push_back( aTBC );
-+ bytesToRead = cbDTBC - ( pS->Tell() - nStart );
-+ } while ( bytesToRead > 0 );
-+ }
-+ if ( cCust )
-+ {
-+ for ( sal_Int32 index = 0; index < cCust; ++index )
-+ {
-+ Customization aCust;
-+ if ( !aCust.Read( pS ) )
-+ return false;
-+ rCustomizations.push_back( aCust );
-+ }
-+ }
-+ return true;
-+}
-+
-+void CTBWrapper::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] CTBWrapper - dump\n", nOffSet );
-+ bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
-+ if ( bRes )
-+ indent_printf(fp," sanity check ( first 8 bytes conform )\n");
-+ else
-+ {
-+ indent_printf(fp," reserved1(0x%x)\n",ch);
-+ indent_printf(fp," reserved2(0x%x)\n",reserved2);
-+ indent_printf(fp," reserved3(0x%x)\n",reserved3);
-+ indent_printf(fp," reserved4(0x%x)\n",reserved4);
-+ indent_printf(fp," reserved5(0x%x)\n",reserved5);
-+ indent_printf(fp,"Quiting dump");
-+ return;
-+ }
-+ indent_printf(fp," size of TBDelta structures 0x%x\n", cbTBD );
-+ indent_printf(fp," cCust: no. of cCust structures 0x%x\n",cCust);
-+ indent_printf(fp," cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
-+
-+ sal_Int32 index = 0;
-+
-+ for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping rtbdc[%d]\n", static_cast< int >( index ));
-+ INDENT;
-+ it->Print( fp );
-+ }
-+
-+ index = 0;
-+
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping custimization [%d]\n", static_cast< int >( index ));
-+ INDENT;
-+ it->Print(fp);
-+ }
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
-+{
-+
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ CustomToolBarImportHelper helper( rxModel );
-+ if ( !(*it).ImportCustomToolBar( helper ) )
-+ return false;
-+ }
-+ return false;
-+}
-+
-+Customization::Customization() : tbidForTBD( 0 )
-+,reserved1( 0 )
-+, ctbds( 0 )
-+{
-+}
-+
-+Customization::~Customization()
-+{
-+}
-+
-+bool Customization::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbidForTBD >> reserved1 >> ctbds;
-+ if ( tbidForTBD && ctbds )
-+ {
-+ TBDelta aTBDelta;
-+ for ( sal_Int32 index = 0; index < ctbds; ++index )
-+ {
-+ if (!aTBDelta.Read( pS ) )
-+ return false;
-+ customizationDataTBDelta.push_back( aTBDelta );
-+ }
-+ }
-+ else
-+ {
-+ customizationDataCTB.reset( new CTB() );
-+ if ( !customizationDataCTB->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void Customization::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp,"[ 0x%x ] Customization -- dump \n", nOffSet );
-+ indent_printf( fp," tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
-+ indent_printf( fp," reserved1 0x%x \n", reserved1);
-+ indent_printf( fp," ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
-+ if ( !tbidForTBD && !ctbds )
-+ customizationDataCTB->Print( fp );
-+ else
-+ {
-+ std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin();
-+ for ( sal_Int32 index = 0; index < ctbds; ++it,++index )
-+ it->Print( fp );
-+ }
-+
-+}
-+
-+bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-+{
-+ if ( !customizationDataCTB.get() )
-+ return false;
-+ return customizationDataCTB->ImportCustomToolBar( helper );
-+}
-+
-+TBDelta::TBDelta() : doprfatendFlags(0)
-+,ibts(0)
-+,cidNext(0)
-+,cid(0)
-+,fc(0)
-+,cbTBC(0)
-+{
-+}
-+
-+bool TBDelta::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
-+ *pS >> CiTBDE >> cbTBC;
-+ return true;
-+}
-+
-+void TBDelta::Print( FILE* fp )
-+{
-+ // Like most of the debug output, it's raw and little ( no )
-+ // interpretation of the data is output ( e.g. flag values etc. )
-+ indent_printf( fp, "[ 0x%x ] TBDelta -- dump\n", nOffSet );
-+ indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
-+
-+ indent_printf( fp, " ibts 0x%x\n",ibts );
-+ indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
-+ indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
-+ indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
-+ indent_printf( fp, " CiTBDE 0x%x\n",CiTBDE );
-+ indent_printf( fp, " cbTBC 0x%x\n", cbTBC );
-+}
-+
-+CTB::CTB() : cbTBData( 0 )
-+,iWCTBl( 0 )
-+,reserved( 0 )
-+,unused( 0 )
-+,cCtls( 0 )
-+{
-+}
-+
-+CTB::~CTB()
-+{
-+}
-+
-+bool CTB::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !name.Read( pS ) )
-+ return false;
-+ *pS >> cbTBData;
-+ // sal_Int32 nTBSize = cbTBData - sizeof(rVisualData) - 12;
-+ if ( !tb.Read( pS ) )
-+ return false;
-+ pS->Read( &rVisualData, sizeof( rVisualData ) );
-+
-+ *pS >> iWCTBl >> reserved >> unused >> cCtls;
-+
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rTBC.push_back( aTBC );
-+ }
-+ }
-+ return true;
-+}
-+
-+void
-+CTB::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] CTB - dump\n", nOffSet );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf(fp, " cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields. %x\n", static_cast< unsigned int >( cbTBData ) );
-+
-+ tb.Print(fp);
-+ indent_printf(fp, " iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+
-+ indent_printf(fp, " dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
-+ rTBC[ index ].Print( fp );
-+ }
-+ }
-+}
-+
-+bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-+{
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ return true;
-+}
-+
-+TB::TB() : bSignature( 0 )
-+,bVersion( 0 )
-+,cCL( 0 )
-+,ltbid( 0 )
-+,ltbtr( 0 )
-+,cRowsDefault( 0 )
-+,bFlags( 0 )
-+{
-+}
-+
-+bool TB::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
-+ return name.Read( pS );
-+}
-+
-+void TB::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TB -- dump\n", nOffSet );
-+ indent_printf( fp, " bSignature (0x%x), bVersion(0x%x), cCL(0x%x), ltbid(0x%x), cRowsDefault (0x%x), ltbtr(0x%x), bFlags(0x%x)\n", bSignature, bVersion, cCL, static_cast< unsigned int >( ltbid ), static_cast< unsigned int >( ltbtr ), cRowsDefault, bFlags );
-+ indent_printf( fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+TBC::~TBC()
-+{
-+}
-+
-+bool TBC::Read( SotStorageStream *pS )
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
-+ {
-+ cid.reset( new sal_uInt32 );
-+ *pS >> *cid;
-+ }
-+ // MUST exist if tbch.tct is not equal to 0x16
-+ if ( tbch.getTct() != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void TBC::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBC -- dump\n", nOffSet );
-+ indent_printf(fp," dumping header ( TBCHeader )\n");
-+ tbch.Print( fp );
-+ if ( cid.get() )
-+ indent_printf(fp," cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
-+ if ( tbcd.get() )
-+ {
-+ indent_printf(fp," dumping toolbar data TBCData \n");
-+ tbcd->Print(fp);
-+ }
-+}
-+
-+bool
-+TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+{
-+ // cmtFci 0x1 Command based on a built-in command. See CidFci.
-+ // cmtMacro 0x2 Macro command. See CidMacro.
-+ // cmtAllocated 0x3 Allocated command. See CidAllocated.
-+ // cmtNil 0x7 No command. See Cid.
-+
-+ if ( cid.get() )
-+ {
-+ sal_uInt16 arg = ( *( cid.get() ) >> 16 );
-+ sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
-+
-+ sal_uInt8 cmt = ( arg2 & 0x7 );
-+ arg2 = ( arg2 >> 3 );
-+
-+ switch ( cmt )
-+ {
-+ case 1:
-+ OSL_TRACE("cmt is cmtFci builtin command");
-+ break;
-+ case 2:
-+ OSL_TRACE("cmt is cmtMacro macro");
-+ break;
-+ case 3:
-+ OSL_TRACE("cmt is cmtAllocated [???]");
-+ break;
-+ case 7:
-+ OSL_TRACE("cmt is cmNill no-phing ");
-+ break;
-+ default:
-+ OSL_TRACE("illegal 0x%x", cmt);
-+ break;
-+ }
-+ OSL_TRACE(" reserved 0x%x", arg2 );
-+ OSL_TRACE(" arg 0x%x", arg );
-+ }
-+
-+ if ( tbcd.get() )
-+ return tbcd->ImportToolBarControl( toolbarcontainer, helper );
-+ return true;
-+}
-+
-+bool
-+Xst::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int16 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+void
-+Xst::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
-+ indent_printf( fp, " %s", rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+Tcg::Tcg() : nTcgVer( 255 )
-+{
-+}
-+
-+bool Tcg::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> nTcgVer;
-+ if ( nTcgVer != (sal_Int8)255 )
-+ return false;
-+ tcg.reset( new Tcg255() );
-+ return tcg->Read( pS );
-+}
-+
-+void Tcg::Print( FILE* fp )
-+{
-+ INDENT_INIT;
-+ indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
-+ indent_printf(fp," nTcgVer %d\n", nTcgVer);
-+ tcg->Print( fp );
-+}
-+
-+bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
-+{
-+ return tcg->ImportCustomToolBar( rxModel );
-+}
-+
-+Tcg255::Tcg255()
-+{
-+}
-+
-+Tcg255::~Tcg255()
-+{
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ for ( ; it != rgtcgData.end(); ++it )
-+ delete *it;
-+}
-+
-+bool Tcg255::processSubStruct( sal_uInt8 nId, SotStorageStream *pS )
-+{
-+ Tcg255SubStruct* pSubStruct = NULL;
-+ switch ( nId )
-+ {
-+ case 0x1:
-+ {
-+ pSubStruct = new PlfMcd( false ); // don't read the id
-+ break;
-+ }
-+ case 0x2:
-+ {
-+ pSubStruct = new PlfAcd( false );
-+ break;
-+ }
-+ case 0x3:
-+ case 0x4:
-+ {
-+ pSubStruct = new PlfKme( false );
-+ break;
-+ }
-+ case 0x10:
-+ {
-+ pSubStruct = new TcgSttbf( false );
-+ break;
-+ }
-+ case 0x11:
-+ {
-+ pSubStruct = new MacroNames( false );
-+ break;
-+ }
-+ case 0x12:
-+ {
-+ pSubStruct = new CTBWrapper( false );
-+ break;
-+ }
-+ default:
-+ OSL_TRACE("Unknown id 0x%x",nId);
-+ return false;
-+ }
-+ pSubStruct->ch = nId;
-+ if ( !pSubStruct->Read( pS ) )
-+ return false;
-+ rgtcgData.push_back( pSubStruct );
-+ return true;
-+}
-+
-+bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
-+{
-+ // Find the CTBWrapper
-+ for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
-+ {
-+ if ( (*it)->id() == 0x12 )
-+ {
-+ // not so great, shouldn't really have to do a horror casting
-+ CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
-+ if ( pCTBWrapper )
-+ {
-+ if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
-+ return false;
-+ }
-+ }
-+ }
-+ return true;
-+}
-+
-+
-+bool Tcg255::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_uInt8 nId = 0; //
-+ *pS >> nId;
-+ while ( nId != 0x40 )
-+ {
-+ if ( !processSubStruct( nId, pS ) )
-+ return false;
-+ *pS >> nId;
-+ }
-+ return true;
-+ // Peek at
-+}
-+
-+void Tcg255::Print( FILE* fp)
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d sub records\n", rgtcgData.size() );
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end();
-+
-+ for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
-+ (*it)->Print(fp);
-+ }
-+}
-+
-+
-+Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
-+{
-+}
-+
-+bool Tcg255SubStruct::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( mbReadId )
-+ *pS >> ch;
-+ return true;
-+}
-+
-+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
-+{
-+}
-+PlfMcd::~PlfMcd()
-+{
-+ if ( rgmcd )
-+ delete[] rgmcd;
-+}
-+
-+bool PlfMcd::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgmcd = new MCD[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgmcd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfMcd::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
-+ rgmcd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac(0)
-+,rgacd(NULL)
-+{
-+}
-+
-+
-+PlfAcd::~PlfAcd()
-+{
-+ if ( rgacd )
-+ delete[] rgacd;
-+}
-+
-+bool PlfAcd::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgacd = new Acd[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgacd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+void PlfAcd::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
-+ rgacd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgkme( NULL )
-+{
-+}
-+
-+PlfKme::~PlfKme()
-+{
-+ if ( rgkme )
-+ delete[] rgkme;
-+}
-+
-+bool PlfKme::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgkme = new Kme[ iMac ];
-+ for( sal_Int32 index=0; index<iMac; ++index )
-+ {
-+ if ( !rgkme[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfKme::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
-+ rgkme[ count ].Print( fp );
-+ }
-+
-+}
-+
-+TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
-+{
-+}
-+
-+bool TcgSttbf::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ return sttbf.Read( pS );
-+}
-+
-+void TcgSttbf::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
-+ sttbf.Print( fp );
-+}
-+
-+TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+,dataItems( NULL )
-+{
-+}
-+
-+TcgSttbfCore::~TcgSttbfCore()
-+{
-+ if ( dataItems )
-+ delete[] dataItems;
-+}
-+
-+bool TcgSttbfCore::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ dataItems = new SBBItem[ cData ];
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ *pS >> dataItems[ index ].cchData;
-+ dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
-+ *pS >> dataItems[ index ].extraData;
-+ }
-+ }
-+ return true;
-+}
-+
-+void TcgSttbfCore::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TcgSttbfCore - dump\n");
-+ indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
-+ indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ indent_printf(fp," string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
-+ }
-+
-+}
-+MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgNames( NULL )
-+{
-+}
-+
-+MacroNames::~MacroNames()
-+{
-+ if ( rgNames )
-+ delete[] rgNames;
-+}
-+
-+bool MacroNames::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgNames = new MacroName[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgNames[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void MacroNames::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
-+ indent_printf(fp, " contains %d MacroName records\n", iMac );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
-+ rgNames[ count ].Print( fp );
-+ }
-+
-+}
-+
-+MacroName::MacroName():ibst(0)
-+{
-+}
-+
-+
-+bool MacroName::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst;
-+ return xstz.Read( pS );
-+}
-+
-+void MacroName::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] MacroName - dump");
-+ indent_printf( fp," index - 0x%x has associated following record\n", ibst );
-+ xstz.Print( fp );
-+}
-+
-+
-+
-+Xstz::Xstz():chTerm(0)
-+{
-+}
-+
-+bool
-+Xstz::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !xst.Read( pS ) )
-+ return false;
-+ *pS >> chTerm;
-+ if ( chTerm != 0 ) // should be an assert
-+ return false;
-+ return true;
-+}
-+
-+void Xstz::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
-+ indent_printf(fp," Xst\n");
-+ xst.Print( fp );
-+ indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
-+}
-+
-+Kme::Kme() : reserved1(0)
-+,reserved2(0)
-+,kcm1(0)
-+,kcm2(0)
-+,kt(0)
-+,param(0)
-+{
-+}
-+
-+Kme::~Kme()
-+{
-+}
-+
-+bool
-+Kme::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
-+ return true;
-+}
-+
-+void Kme::Print( FILE* fp )
-+{
-+ INDENT;
-+
-+ indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
-+ indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
-+ indent_printf( fp, " kt 0x%x \n", kt );
-+ indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
-+}
-+
-+Acd::Acd() : ibst( 0 )
-+, fciBasedOnABC( 0 )
-+{
-+}
-+
-+bool Acd::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst >> fciBasedOnABC;
-+ return true;
-+}
-+
-+void Acd::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
-+ // #TODO flesh out interpretation of these values
-+ indent_printf( fp," ibst 0x%x\n", ibst);
-+ indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
-+}
-+
-+MCD::MCD() : reserved1(0x56)
-+,reserved2( 0 )
-+,ibst( 0 )
-+,ibstName( 0 )
-+,reserved3( 0xFFFF )
-+,reserved4( 0 )
-+,reserved5( 0 )
-+,reserved6( 0 )
-+,reserved7( 0 )
-+{
-+}
-+
-+bool MCD::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
-+ *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
-+ return true;
-+}
-+
-+void MCD::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
-+ indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
-+
-+ indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
-+ indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
-+ indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
-+ indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
-+ indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
-+}
-+
---- /dev/null 2008-12-03 05:56:56.000000000 +0000
-+++ svx/inc/svx/mstoolbar.hxx 2009-02-04 18:01:38.000000000 +0000
-@@ -0,0 +1,253 @@
-+#ifndef _MSTOOLBAR_HXX
-+#define _MSTOOLBAR_HXX
-+#include "svx/svxdllapi.h"
-+#include <tools/string.hxx>
-+#include <sot/storage.hxx>
-+#include <ostream>
-+#include <memory>
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vcl/bitmap.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class TBCHeader;
-+
-+class SVX_DLLPUBLIC CustomToolBarImportHelper
-+{
-+ struct iconcontrolitem
-+ {
-+ rtl::OUString sCommand;
-+ css::uno::Reference< css::graphic::XGraphic > image;
-+ };
-+ std::vector< iconcontrolitem > iconcommands;
-+
-+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
-+public:
-+ CustomToolBarImportHelper( const css::uno::Reference< css::frame::XModel >& rxModel );
-+
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
-+
-+ static css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-+
-+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
-+ void applyIcons();
-+};
-+
-+class SVX_DLLPUBLIC TBBase
-+{
-+friend class Indent;
-+ static int nIndent; // num spaces to indent before printing
-+protected:
-+ void indent_printf(FILE* fp, const char* format, ... );
-+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
-+public:
-+ TBBase() : nOffSet( 0 ) {}
-+ virtual ~TBBase(){}
-+ rtl::OUString readUnicodeString( SotStorageStream* pS, sal_Int32 nChars );
-+
-+ virtual bool Read(SotStorageStream *pS) = 0;
-+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
-+};
-+
-+class Indent
-+{
-+public:
-+ Indent( bool binit = false )
-+ {
-+ if ( binit )
-+ init();
-+ else
-+ TBBase::nIndent = TBBase::nIndent + 2;
-+ }
-+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
-+ void init() { TBBase::nIndent = 0; }
-+};
-+
-+
-+#define INDENT_INIT Indent a(true);
-+#define INDENT Indent a;
-+
-+class SVX_DLLPUBLIC WString : public TBBase
-+{
-+ rtl::OUString sString;
-+
-+public:
-+ WString(){};
-+ ~WString(){};
-+ bool Read(SotStorageStream *pS);
-+ rtl::OUString getString(){ return sString; }
-+};
-+
-+class SVX_DLLPUBLIC TBCExtraInfo : public TBBase
-+{
-+ WString wstrHelpFile;
-+ sal_Int32 idHelpContext;
-+ WString wstrTag;
-+ WString wstrOnAction;
-+ WString wstrParam;
-+ sal_Int8 tbcu;
-+ sal_Int8 tbmg;
-+
-+ TBCExtraInfo(const TBCExtraInfo&);
-+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
-+public:
-+ TBCExtraInfo();
-+ ~TBCExtraInfo(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString getOnAction();
-+};
-+
-+class SVX_DLLPUBLIC TBCGeneralInfo : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ WString customText;
-+ WString descriptionText;
-+ WString tooltip;
-+ TBCExtraInfo extraInfo;
-+
-+public:
-+ TBCGeneralInfo();
-+ ~TBCGeneralInfo() {}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
-+};
-+
-+class SVX_DLLPUBLIC TBCBitMap : public TBBase
-+{
-+friend class TBCBSpecific; // #FIXME hacky access, need to fix
-+ sal_Int32 cbDIB;
-+// BITMapInfoHeader biHeader; // lets cheat and not read the bit map stuff right now
-+ sal_uInt8* pRestOfIt;
-+ Bitmap mBitMap;
-+ int size;
-+public:
-+ TBCBitMap();
-+ ~TBCBitMap();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ Bitmap& getBitMap();
-+};
-+
-+class SVX_DLLPUBLIC TBCMenuSpecific : public TBBase
-+{
-+ sal_Int32 tbid;
-+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
-+public:
-+ TBCMenuSpecific();
-+ ~TBCMenuSpecific(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class SVX_DLLPUBLIC TBCCDData : public TBBase
-+{
-+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
-+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
-+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
-+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
-+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
-+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
-+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
-+
-+public:
-+ TBCCDData();
-+ ~TBCCDData();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCComboDropdownSpecific : public TBBase
-+{
-+ boost::shared_ptr< TBCCDData > data;
-+public:
-+ TBCComboDropdownSpecific( const TBCHeader& header );
-+ TBCComboDropdownSpecific(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCBSpecific : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ boost::shared_ptr< TBCBitMap > icon; // optional
-+ boost::shared_ptr< TBCBitMap > iconMask; // optional
-+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
-+ boost::shared_ptr< WString > wstrAcc; // optional
-+
-+public:
-+ TBCBSpecific();
-+ ~TBCBSpecific(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ TBCBitMap* getIcon();
-+ TBCBitMap* getIconMask();
-+};
-+
-+/* TBCHeader.tct controlSpecificInfo type
-+
-+0x01 (Button control) TBCBSpecific
-+0x10 (ExpandingGrid control) TBCBSpecific
-+0x0A (Popup control) TBCMenuSpecific
-+0x0C (ButtonPopup control) TBCMenuSpecific
-+0x0D (SplitButtonPopup control) TBCMenuSpecific
-+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
-+0x02 (Edit control) TBCComboDropdow nSpecific
-+0x04 (ComboBox control) TBCComboDropdow nSpecific
-+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
-+0x03 (DropDown control) TBCComboDropdow nSpecific
-+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
-+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
-+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
-+0x0F (Label control) controlSpecificInfo MUST NOT exist
-+0x12 (Grid control) controlSpecificInfo MUST NOT exist
-+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
-+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
-+
-+*/
-+class SVX_DLLPUBLIC TBCHeader : public TBBase
-+{
-+ sal_Int8 bSignature;
-+ sal_Int8 bVersion;
-+ sal_uInt8 bFlagsTCR;
-+ sal_uInt8 tct;
-+ sal_uInt16 tcid;
-+ sal_uInt32 tbct;
-+ sal_uInt8 bPriority;
-+ boost::shared_ptr< sal_uInt16 > width; //optional
-+ boost::shared_ptr< sal_uInt16 > height; //optional
-+
-+public:
-+ TBCHeader();
-+ ~TBCHeader();
-+ sal_uInt8 getTct() const { return tct; }
-+ sal_uInt16 getTcID() const { return tcid; }
-+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ sal_uInt32 getTbct() { return tbct; };
-+};
-+
-+class SVX_DLLPUBLIC TBCData : public TBBase
-+{
-+ TBCHeader rHeader;
-+ TBCGeneralInfo controlGeneralInfo;
-+ boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
-+ TBCData(const TBCData&);
-+ TBCData& operator = ( const TBCData&);
-+public:
-+ TBCData( const TBCHeader& Header );
-+ ~TBCData(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+};
-+
-+#endif
---- /dev/null 2008-12-03 05:56:56.000000000 +0000
-+++ svx/source/msfilter/mstoolbar.cxx 2009-02-04 17:55:03.000000000 +0000
-@@ -0,0 +1,587 @@
-+#include <svx/mstoolbar.hxx>
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <vcl/graph.hxx>
-+#include <vcl/bitmapex.hxx>
-+int TBBase::nIndent = 0;
-+
-+using namespace com::sun::star;
-+
-+void CustomToolBarImportHelper::applyIcons()
-+{
-+ for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
-+ {
-+ uno::Sequence< rtl::OUString > commands(1);
-+ commands[ 0 ] = it->sCommand;
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
-+ images[ 0 ] = it->image;
-+
-+ uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xImageManager->insertImages( 1, commands, images );
-+ }
-+}
-+
-+void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
-+{
-+ iconcontrolitem item;
-+ item.sCommand = sString;
-+ item.image = xImage;
-+ iconcommands.push_back( item );
-+}
-+
-+CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel )
-+{
-+ m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getCfgManager()
-+{
-+ return m_xCfgSupp->getUIConfigurationManager();
-+}
-+
-+uno::Any
-+CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
-+{
-+//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
-+ static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+ // create script url
-+ rtl::OUString scriptURL = part1 + sCmd + part2;
-+ return uno::makeAny( scriptURL );
-+}
-+
-+void
-+TBBase::indent_printf( FILE* fp, const char* format, ... )
-+{
-+ va_list ap;
-+ va_start ( ap, format );
-+
-+ // indent nIndent spaces
-+ for ( int i=0; i<nIndent; ++i)
-+ fprintf(fp," ");
-+ // append the rest of the message
-+ vfprintf( fp, format, ap );
-+ va_end( ap );
-+}
-+
-+rtl::OUString TBBase::readUnicodeString( SotStorageStream* pS, sal_Int32 nChars )
-+{
-+ rtl::OUStringBuffer buf(40);
-+ for ( sal_Int32 index = 0; index < nChars; ++index )
-+ {
-+ sal_uInt16 ch = 0;
-+ *pS >> ch;
-+ sal_Unicode uni = static_cast< sal_Unicode >( ch );
-+ buf.append( &uni, 1 );
-+ }
-+ return buf.makeStringAndClear();
-+}
-+
-+TBCHeader::TBCHeader() : bSignature( 0x3 )
-+,bVersion( 0x01 )
-+,bFlagsTCR( 0 )
-+,tct(0x1) // default to Button
-+,tcid(0)
-+,tbct(0)
-+{
-+}
-+
-+
-+TBCHeader::~TBCHeader()
-+{
-+}
-+
-+bool TBCHeader::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
-+ // bit 4 ( from lsb )
-+ if ( bFlagsTCR & 0x10 )
-+ {
-+ width.reset( new sal_uInt16 );
-+ height.reset( new sal_uInt16 );
-+ *pS >> *width >> *height;
-+ }
-+ return true;
-+}
-+
-+void TBCHeader::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%xn", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," bFlagsTCR 0x%x\n", bFlagsTCR );
-+ indent_printf(fp," tct 0x%x\n", tct );
-+ indent_printf(fp," tcid 0x%x\n", tcid );
-+ indent_printf(fp," tbct 0x%x\n", static_cast< unsigned int >( tbct ));
-+ indent_printf(fp," bPriority 0x%x\n", bPriority );
-+ if ( width.get() )
-+ indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
-+ if ( height.get() )
-+ indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
-+}
-+
-+TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
-+{
-+}
-+
-+bool TBCData::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
-+ return false;
-+ switch ( rHeader.getTct() )
-+ {
-+ case 0x01: // (Button control)
-+ case 0x10: // (ExpandingGrid control)
-+ controlSpecificInfo.reset( new TBCBSpecific() );
-+ break;
-+ case 0x0A: // (Popup control)
-+ case 0x0C: // (ButtonPopup control)
-+ case 0x0D: // (SplitButtonPopup control)
-+ case 0x0E: // (SplitButtonMRUPopup control)
-+ controlSpecificInfo.reset( new TBCMenuSpecific() );
-+ break;
-+ case 0x02: // (Edit control)
-+ case 0x04: // (ComboBox control)
-+ case 0x14: // (GraphicCombo control)
-+ case 0x03: // (DropDown control)
-+ case 0x06: // (SplitDropDown control)
-+ case 0x09: // (GraphicDropDown control)
-+ controlSpecificInfo.reset( new TBCComboDropdownSpecific( rHeader ) );
-+ break;
-+ default:
-+ break;
-+ }
-+ if ( controlSpecificInfo.get() )
-+ return controlSpecificInfo->Read( pS );
-+ return true;
-+
-+ OSL_TRACE("#FIXME I need to be able to handle different controlSpecificInfo types.");
-+ return false;
-+}
-+
-+bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+{
-+ std::vector< css::beans::PropertyValue > props;
-+ controlGeneralInfo.ImportToolBarControlData( props );
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
-+ aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
-+/*
-+ // Style this specifies whether ICON, TEXT or ICON & TEXT is stored
-+ // 0, 1, 2 respecively for property 'Style'
-+
-+ beans::PropertyValue styleProp;
-+ // ToolBar specific only not much good for interop
-+ styleProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") );
-+
-+ if ( ( rHeader.getTbct() & 0x3 ) == 0x3 )
-+ styleProp.Value <<= sal_Int32( 2 );
-+ else if ( rHeader.getTbct() & 0x2 )
-+ styleProp.Value <<= sal_Int32( 0 );
-+ else
-+ styleProp.Value <<= sal_Int32( 1 );
-+
-+ props.push_back( styleProp );
-+*/
-+
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+
-+ rtl::OUString sCommand;
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ {
-+ *pProp = *it;
-+ if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
-+ it->Value >>= sCommand;
-+ }
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+
-+ if ( rHeader.getTct() == 0x01
-+ || rHeader.getTct() == 0x10 )
-+ {
-+ TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
-+ if ( pSpecificInfo )
-+ {
-+ // if we have a icon then lets set it for the command ( but I
-+ // have a nasty suspicion the toolbar actually needs to be set
-+ // up ( and added ) before you can asssign an image :-/
-+ if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
-+ {
-+ BitmapEx aBitEx( pIcon->getBitMap() );
-+ if ( pSpecificInfo->getIconMask() )
-+ // according to the spec:
-+ // "the iconMask is white in all the areas in which the icon is
-+ // displayed as transparent and is black in all other areas."
-+
-+ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
-+
-+ Graphic aGraphic( aBitEx );
-+ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ }
-+ }
-+ }
-+ return true; // just ignore
-+}
-+
-+void TBCData::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
-+ indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
-+ controlGeneralInfo.Print( fp );
-+ if ( rHeader.getTct() == 1 )
-+ {
-+ indent_printf(fp," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
-+ controlSpecificInfo->Print( fp );
-+ }
-+}
-+
-+bool
-+WString::Read( SotStorageStream *pS )
-+{
-+ OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int8 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
-+{
-+}
-+
-+bool
-+TBCExtraInfo::Read( SotStorageStream *pS )
-+{
-+ OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if( !wstrHelpFile.Read( pS ) )
-+ return false;
-+
-+ *pS >> idHelpContext;
-+
-+ if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
-+ return false;
-+
-+ *pS >> tbcu >> tbmg;
-+ return true;
-+}
-+
-+void
-+TBCExtraInfo::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " wstrHelpFile %s\n",
-+ rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
-+ indent_printf( fp, " wstrTag %s\n",
-+ rtl::OUStringToOString( wstrTag.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrOnAction %s\n",
-+ rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrParam %s\n",
-+ rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tbcu 0x%x\n", tbcu );
-+ indent_printf( fp, " tbmg 0x%x\n", tbmg );
-+
-+}
-+
-+rtl::OUString
-+TBCExtraInfo::getOnAction()
-+{
-+ return wstrOnAction.getString();
-+}
-+
-+TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCGeneralInfo::Read( SotStorageStream *pS )
-+{
-+ OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ if ( ( bFlags & 0x1 ) && !customText.Read( pS ) )
-+ return false;
-+ if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) || !tooltip.Read( pS ) ) )
-+ return false;
-+ if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) )
-+ return false;
-+ return true;
-+}
-+
-+void
-+TBCGeneralInfo::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ indent_printf( fp, " customText %s\n",
-+ rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " description %s\n",
-+ rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tooltip %s\n",
-+ rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( bFlags & 0x4 )
-+ extraInfo.Print( fp );
-+}
-+
-+bool
-+TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
-+{
-+ if ( ( bFlags & 0x5 ) )
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aProp.Value = uno::makeAny( customText.getString() );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
-+ aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
-+ sControlData.push_back( aProp );
-+
-+ // #TODO find out what is the property for tooltip?
-+ sControlData.push_back( aProp );
-+/*
-+aToolbarItem(0).Name = "CommandURL" wstrOnAction
-+aToolbarItem(0).Value = Command
-+aToolbarItem(1).Name = "Label" customText
-+aToolbarItem(1).Value = Label
-+aToolbarItem(2).Name = "Type"
-+aToolbarItem(2).Value = 0
-+aToolbarItem(3).Name = "Visible"
-+aToolbarItem(3).Value = true
-+*/
-+ }
-+ return true;
-+}
-+
-+TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
-+{
-+}
-+
-+bool
-+TBCMenuSpecific::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbid;
-+ if ( tbid == 1 )
-+ {
-+ name.reset( new WString() );
-+ return name->Read( pS );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCMenuSpecific::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
-+ if ( tbid == 1 )
-+ indent_printf( fp, " name %s", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+}
-+
-+TBCBSpecific::TBCBSpecific() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCBSpecific::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ // bFlags determines what we read next
-+
-+ // bFlags.fCustomBitmap = 1 ( 0x8 ) set
-+ if ( bFlags & 0x8 )
-+ {
-+ icon.reset( new TBCBitMap() );
-+ iconMask.reset( new TBCBitMap() );
-+ if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
-+ return false;
-+ }
-+ // if bFlags.fCustomBtnFace = 1 ( 0x10 )
-+ if ( bFlags & 0x10 )
-+ {
-+ iBtnFace.reset( new sal_uInt16 );
-+ *pS >> *iBtnFace.get();
-+ }
-+ // if bFlags.fAccelerator equals 1 ( 0x04 )
-+ if ( bFlags & 0x04 )
-+ {
-+ wstrAcc.reset( new WString() );
-+ return wstrAcc->Read( pS );
-+ }
-+ return true;
-+}
-+
-+
-+void TBCBSpecific::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ bool bResult = ( icon.get() != NULL );
-+ indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ INDENT;
-+ indent_printf( fp, " icon: \n");
-+ icon->Print( fp ); // will dump size
-+ }
-+ bResult = ( iconMask.get() != NULL );
-+ indent_printf( fp, " icon mask present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ INDENT;
-+ indent_printf( fp, " icon mask: \n");
-+ iconMask->Print( fp ); // will dump size
-+ }
-+ if ( iBtnFace.get() )
-+ {
-+ indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
-+ }
-+ bResult = ( wstrAcc.get() != NULL );
-+ indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIcon()
-+{
-+ return icon.get();
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIconMask()
-+{
-+ return iconMask.get();
-+}
-+
-+TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
-+{
-+ if ( header.getTcID() == 0x01 )
-+ data.reset( new TBCCDData() );
-+}
-+
-+bool TBCComboDropdownSpecific::Read( SotStorageStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ if ( data.get() )
-+ return data->Read( pS );
-+ return true;
-+}
-+
-+void TBCComboDropdownSpecific::Print( FILE* fp)
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
-+ if ( data.get() )
-+ data->Print( fp );
-+ else
-+ indent_printf(fp," no data " );
-+}
-+
-+TBCCDData::TBCCDData() : cwstrItems( 0 )
-+,iSel( 0 )
-+,cLines( 0 )
-+,dxWidth( 0 )
-+{
-+}
-+
-+TBCCDData::~TBCCDData()
-+{
-+}
-+
-+bool TBCCDData::Read( SotStorageStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ *pS >> cwstrItems;
-+ if ( cwstrItems )
-+ {
-+ for( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ WString aString;
-+ if ( !aString.Read( pS ) )
-+ return false;
-+ wstrList.push_back( aString );
-+ }
-+ }
-+ *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
-+
-+ return wstrEdit.Read( pS );
-+}
-+
-+void TBCCDData::Print( FILE* fp)
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
-+ indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems);
-+ for ( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ INDENT;
-+ indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ indent_printf(fp," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU);
-+ indent_printf(fp," iSel index of selected item 0x%d item\n", iSel);
-+ indent_printf(fp," cLines num of suggested lines to display 0x%d", cLines);
-+ indent_printf(fp," dxWidth width in pixels 0x%d", dxWidth);
-+ indent_printf(fp," wstrEdit %s", rtl::OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBCBitMap::TBCBitMap() : cbDIB( 0 ), pRestOfIt( NULL ), size( 0 )
-+{
-+}
-+
-+TBCBitMap::~TBCBitMap()
-+{
-+}
-+
-+// #FIXME Const-ness
-+Bitmap&
-+TBCBitMap::getBitMap()
-+{
-+ return mBitMap;
-+}
-+
-+bool TBCBitMap::Read( SotStorageStream* pS)
-+{
-+ OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cbDIB;
-+ // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
-+ return mBitMap.Read( *pS, FALSE );
-+}
-+
-+void TBCBitMap::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
-+ indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
-+}
diff --git a/patches/test/xmlsearch-xerces.diff b/patches/test/xmlsearch-xerces.diff
deleted file mode 100644
index 00ee83be2..000000000
--- a/patches/test/xmlsearch-xerces.diff
+++ /dev/null
@@ -1,243 +0,0 @@
-? XmlSearch/unxlngx6.pro
-cvs diff: Diffing .
-cvs diff: Diffing XmlSearch/prj
-cvs diff: Diffing XmlSearch/src
-cvs diff: Diffing XmlSearch/src/com
-cvs diff: Diffing XmlSearch/src/com/sun
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch
-Index: XmlSearch/src/com/sun/xmlsearch/makefile.mk
-===================================================================
-RCS file: /cvs/util/XmlSearch/src/com/sun/xmlsearch/makefile.mk,v
-retrieving revision 1.5
-diff -u -r1.5 makefile.mk
---- XmlSearch/src/com/sun/xmlsearch/makefile.mk 25 Oct 2005 11:11:58 -0000 1.5
-+++ XmlSearch/src/com/sun/xmlsearch/makefile.mk 2 Nov 2005 14:32:12 -0000
-@@ -21,7 +21,7 @@
-
- .INCLUDE : settings.mk
-
--JARFILES = jaxp.jar parser.jar xt.jar
-+JARFILES = jaxp.jar parser.jar xt.jar xercesImpl.jar
- #EXTRAJARFILES = jaxp.jar parser.jar xt.jar
-
- JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES)))
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/db
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/gui
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/indexer
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/qe
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/servlet
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/tree
-Index: XmlSearch/src/com/sun/xmlsearch/tree/TreeBuilder.java
-===================================================================
-RCS file: /cvs/util/XmlSearch/src/com/sun/xmlsearch/tree/TreeBuilder.java,v
-retrieving revision 1.2
-diff -u -r1.2 TreeBuilder.java
---- XmlSearch/src/com/sun/xmlsearch/tree/TreeBuilder.java 9 Sep 2005 16:41:49 -0000 1.2
-+++ XmlSearch/src/com/sun/xmlsearch/tree/TreeBuilder.java 2 Nov 2005 14:32:14 -0000
-@@ -46,7 +46,9 @@
- import org.xml.sax.HandlerBase;
- import org.xml.sax.AttributeList;
- import org.xml.sax.InputSource;
--import com.sun.xml.parser.Parser;
-+import org.xml.sax.SAXNotRecognizedException;
-+import org.xml.sax.SAXNotSupportedException;
-+import org.apache.xerces.parsers.SAXParser;
- import com.sun.xmlsearch.util.IntegerArray;
- import com.jclark.xsl.om.*;
-
-@@ -144,6 +146,7 @@
-
- public URL getURL() { return null; }
- public int getLineNumber() { return -1; }
-+ public int getColumnNumber() { return -1; }
- public NamespacePrefixMap getNamespacePrefixMap() {
- return _parent.getNamespacePrefixMap();
- }
-@@ -153,6 +156,12 @@
- public String getUnparsedEntityURI(String name) {
- return "getUnparsedEntityURI";
- }
-+ public String getPublicId() {
-+ return "getPublicId not implemented";
-+ }
-+ public String getSystemId() {
-+ return "getSystemId not implemented";
-+ }
-
- public boolean isLeaf() { return true; }
- public int getChildCount() { return 0; }
-@@ -612,7 +621,7 @@
-
- private static final int InitStackSize = 256;
- private static final Name EmptyName = null;
-- private Parser _parser = new Parser();
-+ private SAXParser _parser = new SAXParser();
- private Hashtable _names = new Hashtable(256);
-
- private NameTable _nameTable;
-@@ -625,7 +634,12 @@
- public TreeBuilder(NameTable nameTable) {
- _nameTable = nameTable;
- _nsMap = _nameTable.getEmptyNamespacePrefixMap();
-- _parser.setFastStandalone(true);
-+ try {
-+ _parser.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
-+ _parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
-+ } catch (SAXNotRecognizedException e) {
-+ } catch (SAXNotSupportedException e) {
-+ }
- }
-
- public Node makeSubstituteElement(Name name, Node2[] children, Node original) {
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/util
-Index: XmlSearch/src/com/sun/xmlsearch/util/Configuration.java
-===================================================================
-RCS file: /cvs/util/XmlSearch/src/com/sun/xmlsearch/util/Configuration.java,v
-retrieving revision 1.2
-diff -u -r1.2 Configuration.java
---- XmlSearch/src/com/sun/xmlsearch/util/Configuration.java 9 Sep 2005 16:45:09 -0000 1.2
-+++ XmlSearch/src/com/sun/xmlsearch/util/Configuration.java 2 Nov 2005 14:32:14 -0000
-@@ -40,8 +40,7 @@
- import java.util.Vector;
- import java.net.URL;
- import org.w3c.dom.*;
--import com.sun.xml.tree.XmlDocument;
--import com.sun.xml.parser.Resolver;
-+import org.apache.xerces.parsers.DOMParser;
- import org.xml.sax.InputSource;
-
- public final class Configuration {
-@@ -68,15 +67,18 @@
- }
-
- public static Element parse(URL location) throws Exception {
-- InputSource input = Resolver.createInputSource(location, true);
-- XmlDocument document = XmlDocument.createXmlDocument(input, false);
-- return document.getDocumentElement();
-+ DOMParser parser = new DOMParser();
-+ parser.setFeature("http://xml.org/sax/features/validation", true);
-+ parser.parse(location.toString());
-+ return parser.getDocument().getDocumentElement();
- }
-
- public static Element parse(byte[] xmlBytes) throws Exception {
-- ByteArrayInputStream input = new ByteArrayInputStream(xmlBytes);
-- XmlDocument document = XmlDocument.createXmlDocument(input, false);
-- return document.getDocumentElement();
-+ ByteArrayInputStream input = new ByteArrayInputStream(xmlBytes);
-+ DOMParser parser = new DOMParser();
-+ parser.setFeature("http://xml.org/sax/features/validation", false);
-+ parser.parse(new InputSource(input));
-+ return parser.getDocument().getDocumentElement();
- }
-
- /** arg: Element that can be direct parent of PrefixTranslation-s
-@@ -97,4 +99,5 @@
- else
- return null;
- }
-+
- }
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/xml
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/xml/indexer
-Index: XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexBuilder.java
-===================================================================
-RCS file: /cvs/util/XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexBuilder.java,v
-retrieving revision 1.7
-diff -u -r1.7 XmlIndexBuilder.java
---- XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexBuilder.java 9 Sep 2005 16:52:56 -0000 1.7
-+++ XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexBuilder.java 2 Nov 2005 14:32:15 -0000
-@@ -42,15 +42,15 @@
- import java.net.URL;
- import org.xml.sax.InputSource;
- import org.xml.sax.HandlerBase;
--import com.sun.xml.parser.Resolver;
--import com.sun.xml.tree.XmlDocument;
-+import org.xml.sax.SAXNotRecognizedException;
-+import org.xml.sax.SAXNotSupportedException;
- import com.sun.xmlsearch.tree.*;
- import com.sun.xmlsearch.util.*;
- import com.sun.xmlsearch.db.*;
- import com.sun.xmlsearch.xml.XmlIndex;
-
--import com.sun.xml.parser.Parser;
--import com.sun.xml.parser.ValidatingParser;
-+import org.apache.xerces.parsers.DOMParser;
-+import org.apache.xerces.parsers.SAXParser;
-
- import com.jclark.xsl.om.*;
- import com.jclark.xsl.sax.*;
-@@ -433,7 +433,7 @@
- private boolean _useLocalTransformFile = false;
-
- private TreeBuilder _treeBuilder;
-- private MyXslEngine _transformEngine;
-+ private XSLTransformEngine _transformEngine;
- private Transform _indexingTransform;
- private Transform _defaultTransform;
- private IndexAdapter _indexAdapter;
-@@ -465,16 +465,21 @@
- public void indexDocument(URL docURL, String title) throws Exception {
- InputSource source = new InputSource(docURL.openStream());
- source.setSystemId(docURL.toString());
-- Parser sourceParser = new Parser();
-- sourceParser.setFastStandalone(true);
-+ SAXParser sourceParser = new SAXParser();
-+ try {
-+ sourceParser.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
-+ sourceParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
-+ } catch (SAXNotRecognizedException e) {
-+ } catch (SAXNotSupportedException e) {
-+ }
- XMLProcessorEx sourceLoader = new XMLProcessorImpl(sourceParser);
- // long start = System.currentTimeMillis();
- Node root =
- sourceLoader.load(
- source,
- 0,
-- _transformEngine.getSourceLoadContext(),
-- _transformEngine.getNameTable());
-+ null,
-+ null);
-
- //System.out.println((System.currentTimeMillis()-start)+" msec parse");
- // build association from generated node ids to nodes
-@@ -518,7 +523,7 @@
-
- private final void initXmlProcessor(String transform) throws Exception {
- _transformEngine = new MyXslEngine();
-- NameTable nameTable = _transformEngine.getNameTable();
-+ NameTable nameTable = new NameTableImpl();
- _treeBuilder = new TreeBuilder(nameTable);
- _defaultTransform = getTransform("default");
- _indexingTransform = getTransform(transform);
-@@ -545,9 +550,9 @@
- }
- // System.out.println(stylesheetUrl.toString());
- InputStream stylesheetStream = stylesheetUrl.openStream();
-- XmlDocument sheet =
-- XmlDocument.createXmlDocument(stylesheetStream, false);
-- return _transformEngine.createTransform(sheet);
-+ DOMParser parser = new DOMParser();
-+ parser.parse(new InputSource(stylesheetStream));
-+ return _transformEngine.createTransform(parser.getDocument());
- }
-
- // GTM new:
-Index: XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexer.java
-===================================================================
-RCS file: /cvs/util/XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexer.java,v
-retrieving revision 1.2
-diff -u -r1.2 XmlIndexer.java
---- XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexer.java 9 Sep 2005 16:53:09 -0000 1.2
-+++ XmlSearch/src/com/sun/xmlsearch/xml/indexer/XmlIndexer.java 2 Nov 2005 14:32:16 -0000
-@@ -39,8 +39,6 @@
- import java.io.*;
- import java.util.*;
-
--import com.sun.xml.tree.XmlDocument;
--import com.sun.xml.parser.Resolver;
- import org.w3c.dom.*;
- import org.xml.sax.InputSource;
- import org.xml.sax.SAXException;
-cvs diff: Diffing XmlSearch/src/com/sun/xmlsearch/xml/qe