diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-21 16:06:18 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-21 16:06:18 +0000 |
commit | 0b291919ca3fadb1434a2c0fbf81c9ae64eb38cc (patch) | |
tree | ec8562376d5f802694b555f84f4f4dcfca32ce52 /toolkit | |
parent | e16c311aba5e4c9f2ce52b05a113745ac09f9fd6 (diff) |
CWS-TOOLING: integrate CWS layoutdialogs2
2009-04-09 10:11:14 +0200 mba r270680 : defective merge sets seem to have brought config_office back
2009-04-02 18:00:52 +0200 mba r270429 : #i100503#: make tralay work without LD_LIBRARY_PATH
2009-04-01 13:27:58 +0200 mba r270320 : warning on Solaris fixed
2009-03-31 22:15:03 +0200 mba r270293 : CWS-TOOLING: rebase CWS layoutdialogs2 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 13:05:08 +0100 mba r269526 : fixed some compiler warnings of the Sun compiler
2009-03-11 15:32:42 +0100 mba r269337 : some problems for ENABLE_LAYOUT fixed
2009-03-09 16:05:32 +0100 mba r269197 : merge conflict solved
2009-03-09 15:09:55 +0100 mba r269194 : merge conflict solved
2009-03-09 15:09:35 +0100 mba r269193 : merge conflict solved
2009-03-06 22:12:47 +0100 mba r269052 : compilation error fixed
2009-03-06 17:36:37 +0100 mba r269033 : integer warning fixed
2009-03-06 10:31:19 +0100 mba r268983 : CWS-TOOLING: rebase CWS layoutdialogs2 to trunk@268395 (milestone: DEV300:m42)
2009-03-03 20:03:59 +0100 jcn r268777 : Add Notes checkbox to find-and-replace dialog in anticipation of m40 resync.
2009-03-03 15:56:20 +0100 jcn r268737 : Apply layout-find-dialog-crash-fix.diff -- fixes crasher.
From http://svn.gnome.org/viewvc/ooo-build?view=revision&revision=15378
2009-02-06 17:41:24 +0100 mba r267479 : arrrrgh - svx headers must be included behind the magic define
2009-02-05 19:44:42 +0100 mba r267439 : seems that msvc preprocessor is thick as a brick
2009-02-05 15:15:16 +0100 mba r267425 : pch added
2009-02-05 08:14:01 +0100 mba r267409 : double defined symbols fixed
2009-02-05 08:13:14 +0100 mba r267408 : compile Languagebox and FontListbox with ENABLE_LAYOUT
2009-02-05 08:07:35 +0100 mba r267406 : warning fixed
2009-02-05 08:06:42 +0100 mba r267405 : warnings and errors fixed
2009-01-30 15:51:52 +0100 mba r267206 : export Container class to compile code in sfx2
2009-01-30 15:51:14 +0100 mba r267205 : remove LAYOUT_EXPERIMENTAL from sfx2, everything now compiles with ENABLE_LAYOUT
2009-01-28 17:01:27 +0100 mba r267069 : fixed namespace problems in sfx2
2009-01-28 16:59:48 +0100 mba r267068 : fixed namespace problems
2009-01-24 13:57:06 +0100 mba r266877 : move svx stuff to experimental
2009-01-24 13:56:11 +0100 mba r266876 : move svx stuff to experimental
2009-01-24 13:52:09 +0100 mba r266875 : put sfx stuff into experimental
2009-01-24 13:28:08 +0100 mba r266874 : put sfx stuff into experimental
2009-01-24 13:26:38 +0100 mba r266873 : help msvc++ compiler a bit
2009-01-24 13:24:43 +0100 mba r266872 : warning removed
2009-01-24 13:23:21 +0100 mba r266871 : moved svx stuff to svx; put sfx stuff into experimental
2009-01-24 13:22:04 +0100 mba r266870 : moved svx stuff to svx
2009-01-05 16:35:34 +0100 jcn r265879 : config_office/configure: Regenerate. Fixes naive builds.
2008-12-17 16:06:25 +0100 jcn r265638 : Wordcount: minor HIG tweaks.
2008-12-17 16:06:21 +0100 jcn r265637 : Zoom: minor HIG spacing tweaks.
2008-12-17 16:06:16 +0100 jcn r265636 : Zoom: fix align-test and update zoom.xml.
2008-12-17 16:06:12 +0100 jcn r265635 : Zoom: add align-test.xml to illustrate zoom alignment bug.
2008-12-17 16:06:07 +0100 jcn r265634 : Find-and-Replace: request font-style-name="Bold", does not seem to work.
2008-12-17 16:06:03 +0100 jcn r265633 : Find-and-Replace: Add alignment for combobox labels.
2008-12-17 16:05:59 +0100 jcn r265632 : Find-and-Replace: Replace pairs of <flow> with <align>. Fixes ugly non-emptiness of more-<hbox>.
2008-12-17 16:05:56 +0100 jcn r265631 : Find-and-Replace: add nice 12pt border.
2008-12-17 16:05:51 +0100 jcn r265630 : Find-and-Replace: also add rowsep at lower fixedline.
2008-12-17 16:05:47 +0100 jcn r265629 : Find-and-Replace: Add poor man's colsep and rowsep substitute spaces.
2008-12-17 16:05:43 +0100 jcn r265628 : Find-and-Replace: use <vbox cnt:x-expand="false"> for buttons.
2008-12-17 16:05:40 +0100 jcn r265627 : Find-and-Replace: add <vbox>s and use cnt:expand="false" to stop vertical button expansion.
2008-12-17 16:05:36 +0100 jcn r265626 : Find-and-Replace: use sc icon. Fixes FIND button height.
2008-12-17 16:05:31 +0100 jcn r265625 : Bugfix have empty/invisible containers not take up space.
2008-12-17 16:05:27 +0100 jcn r265624 : Find-and-replace: Fix/remove most property errors.
2008-12-17 16:05:23 +0100 jcn r265623 : Table: make x, y expand default.
2008-12-17 16:05:18 +0100 jcn r265622 : Use OSL_TRACE rather than printf. Fixes warning visibility.
2008-12-17 16:05:14 +0100 jcn r265621 : Boxtest: add <vbox><table x-expand="true"> pair to trigger property errors.
2008-12-17 16:05:10 +0100 jcn r265620 : Junk extra <table> from boxtest. Fixes visual output.
2008-12-17 16:05:05 +0100 jcn r265619 : Eradicate PROPHELPER_SET_INFO: junk static caching.
2008-12-17 16:05:01 +0100 jcn r265618 : Update awk+sed localize generation rules. Fixes multiple (wrong) titles in Find & Replace.
2008-12-17 16:04:56 +0100 jcn r265617 : Use dash (-) instead of underscore (_) to separate language modifiers. Fixes en_GB etc.
2008-12-17 16:04:51 +0100 jcn r265616 : Add "defbutton=true" to dialogs. Fixes ENTER doing default action: n#439222.
2008-12-17 16:04:45 +0100 jcn r265615 : Michael's new table-based find and replace.
2008-12-17 16:04:40 +0100 jcn r265614 : Apply Michael's boxtest patch.
2008-12-17 16:04:36 +0100 jcn r265613 : Make sort-options experimental. Part II. Fixes crasher n-44.patch. Fixes crasher: n#442036.
2008-12-17 16:04:31 +0100 jcn r265612 : Make sort-options experimental. Part I.
2008-12-17 16:04:26 +0100 jcn r265611 : Add --enable-layout-experimental configure switch. Part II. Typo in configure.in, add set_soenv entry.
2008-12-17 16:04:21 +0100 jcn r265610 : Add --enable-layout-experimental configure switch. Default off.
2008-11-26 16:25:18 +0100 mba r264417 : fixed compiler warnings
2008-11-26 15:52:02 +0100 mba r264407 : fixed compiler warnings
2008-11-26 15:40:44 +0100 mba r264402 : fixed compiler warnings
2008-11-26 14:50:47 +0100 mba r264395 : fixed compiler warnings
2008-11-26 14:39:12 +0100 mba r264393 : fixed compiler warnings
2008-11-26 14:38:49 +0100 mba r264392 : fixed compiler warnings
2008-11-26 14:38:31 +0100 mba r264391 : fixed compiler warnings
2008-11-26 14:38:13 +0100 mba r264390 : fixed compiler warnings
2008-11-26 14:37:38 +0100 mba r264389 : fixed compiler warnings
2008-11-26 10:11:17 +0100 mba r264352 : fixed compiler warnings
2008-11-26 10:06:12 +0100 mba r264351 : fixed compiler warnings
2008-11-26 09:58:28 +0100 mba r264347 : fixed compiler warnings
2008-11-26 09:50:41 +0100 mba r264345 : fixed compiler warnings
2008-11-26 09:46:10 +0100 mba r264343 : fixed compiler warnings
2008-10-22 10:57:09 +0200 mba r262584 : fixed small error resulting from resolved merged conflicts
2008-10-22 10:56:21 +0200 mba r262583 : fixed some small errors resulting from resolved merged conflicts
2008-10-20 19:29:27 +0200 jcn r262557 : layoutdialogs2: Remove stray patches.
2008-10-20 19:29:22 +0200 jcn r262556 : layoutdialogs2: Force resize also on second show after hiding.
2008-10-20 19:29:17 +0200 jcn r262555 : layoutdialogs2: Do not trigger handlers for api calls.
2008-10-20 19:29:13 +0200 jcn r262554 : layoutdialogs2: Use disable/enable instead of hide/show for currency box. Fixes monster lisbox.
2008-10-20 19:29:09 +0200 jcn r262553 : layoutdialogs2: Use line-count instead of linecount. Fixes sizing of listboxes.
2008-10-20 19:29:04 +0200 jcn r262552 : layoutdialogs2: vcl: respect line-count also for non-dropdown listbox.
2008-10-20 19:28:59 +0200 jcn r262551 : layoutdialogs2: Update to svn:r14142 patched.
2008-10-20 19:28:51 +0200 jcn r262550 : layoutdialogs2: Manual tweaks in number-format.xml.
2008-10-20 19:28:45 +0200 jcn r262549 : layoutdialogs2: Integrate Number Format tabpage into Format Cell dialog.
2008-10-20 19:28:36 +0200 jcn r262548 : layoutdialogs2: Windows build fixes. Thanks Noel.
2008-10-20 19:28:31 +0200 jcn r262547 : layoutdialogs2: Layout Format Cells/Number Format tabpage.
2008-10-20 19:28:24 +0200 jcn r262546 : layoutdialogs2: Remove sc/uiconfig/layout/localize.sdf.
2008-10-20 19:28:20 +0200 jcn r262545 : layoutdialogs2: --enable-debug link fix
2008-10-20 19:28:16 +0200 jcn r262544 : layoutdialogs2: Add missing localize.sdf dependency. Thanks, Petr.
2008-10-20 19:28:12 +0200 jcn r262543 : layoutdialogs2: svx linx fixlet.
2008-10-20 19:28:06 +0200 jcn r262542 : layoutdialogs2: Move layout/* to layout/core, vclcompat to layout/vcl. Distribute layout headers. Fixes sfx2 layout core includes.
2008-10-20 19:27:58 +0200 jcn r262541 : layoutdialogs2: Build fix for --enable-layout.
2008-10-20 19:27:54 +0200 jcn r262540 : layoutdialogs2: Generate localize.sdf files in uiconfig.
2008-10-20 19:27:47 +0200 jcn r262539 : layoutdialogs2: Minimalize deprecated String use further by using OUString.
2008-10-20 19:27:42 +0200 jcn r262538 : layoutdialogs2: Implement LocalizedString.GetToken and use it for aCalcBtn. Fixes empty label.
2008-10-20 19:27:36 +0200 jcn r262537 : layoutdialogs2: Add layout::Sfx*Dialog wrapper.
2008-10-20 19:27:29 +0200 jcn r262536 : layoutdialogs2: Introduce Closing*Dialog wrappers fixing closing with ESC.
2008-10-20 19:27:24 +0200 jcn r262535 : layoutdialogs2: Support <sfxmodelessdialog> from sfx2.
2008-10-20 19:27:17 +0200 jcn r262534 : layoutdialogs2: Rename find-&-replace.xml to find-and-replace.xml. Fixes split build with failing solenv patch.
2008-10-20 19:27:12 +0200 jcn r262533 : layoutdialogs2: Do not build sfx2 when --disable-layout.
2008-10-20 19:27:08 +0200 jcn r262532 : layoutdialogs2: Ignore ja/ too.
2008-10-20 19:27:04 +0200 jcn r262531 : layoutdialogs2: Add destructors for VCLXButton, VCLXComboBox.
2008-10-20 19:26:58 +0200 jcn r262530 : layoutdialogs2: Make dialogs closable with ESC: wordcount, zoom, message-box, move-copy-sheet, insert-sheet.
2008-10-20 19:26:52 +0200 jcn r262529 : layoutdialogs2: Move some implementations to .cxx.
2008-10-20 19:26:47 +0200 jcn r262528 : layoutdialogs2: Fix simple editor crasher.
2008-10-20 19:26:43 +0200 jcn r262527 : layoutdialogs2: Further cleanup: remove clean & delete from wrapperGone.
2008-10-20 19:26:38 +0200 jcn r262526 : layoutdialogs2: Add reset logic to ~WindowImpl, plugs ComboBox and Dialog leaks.
2008-10-20 19:26:34 +0200 jcn r262525 : layoutdialogs2: Interesting hack: only leaks ::ComboBox and ::Dialog.
2008-10-20 19:26:29 +0200 jcn r262524 : layoutdialogs2: Build fix.
2008-10-20 19:26:24 +0200 jcn r262523 : layoutdialogs2: Find&Replace duplicate disposal workaround inside layout.
2008-10-20 19:26:19 +0200 jcn r262522 : layoutdialogs2: Revert "Terrible crasher-fix hack. Do not dispose Dialog or any FocusHandler owners."
This reverts commit 5222b5b123a2e6c88494983bd875de574f365bae.
2008-10-20 19:26:14 +0200 jcn r262521 : layoutdialogs2: Terrible crasher-fix hack. Do not dispose Dialog or any FocusHandler owners.
2008-10-20 19:26:08 +0200 jcn r262520 : layoutdialogs2: Revert "ComboBox: crash down to (Dialog's) VCLXWindowImpl::DestroyOutputDevice();"
This reverts commit b423129aca295e84ef5986149b6ee71eb7ba0aa3.
2008-10-20 19:26:03 +0200 jcn r262519 : layoutdialogs2: ComboBox: crash down to (Dialog's) VCLXWindowImpl::DestroyOutputDevice();
2008-10-20 19:25:57 +0200 jcn r262518 : layoutdialogs2: Handler and debug cleanup.
2008-10-20 19:25:52 +0200 jcn r262517 : layoutdialogs2: Minimally remove FixedText workaround.
2008-10-20 19:25:47 +0200 jcn r262516 : layoutdialogs2: Preparations for FocusHdl fix.
2008-10-20 19:25:42 +0200 jcn r262515 : layoutdialogs2: Remove vclxwindows patch by using handler hackery.
2008-10-20 19:25:38 +0200 jcn r262514 : layoutdialogs2: Don't call deleted dialog. Hdler reset tweaks. Fixes Find&Replace.
2008-10-20 19:25:34 +0200 jcn r262513 : layoutdialogs2: Hdler and disposing cleanups.
2008-10-20 19:25:29 +0200 jcn r262512 : layoutdialogs2: Prevent Find&Replace window from being deleted twice.
2008-10-20 19:25:24 +0200 jcn r262511 : layoutdialogs2: Add destructor to SvxSearchDialogWrapper. Fixes second invocation crasher.
2008-10-20 19:25:19 +0200 jcn r262510 : layoutdialogs2: Make Find&Replace work (once) with minimal client code changes.
2008-10-20 19:25:13 +0200 jcn r262509 : layoutdialogs2: Add ComboBox/FixedText debug switching.
2008-10-20 19:25:08 +0200 jcn r262508 : layoutdialogs2: Add destructors resetting handlers.
2008-10-20 19:25:03 +0200 jcn r262507 : layoutdialogs2: Static cast fixes.
2008-10-20 19:24:59 +0200 jcn r262506 : layoutdialogs2: Always set button handler. Fixes pushbuttons.
2008-10-20 19:24:55 +0200 jcn r262505 : layoutdialogs2: Revert "Move FocusHandlers from Control down to ListBox, ComboBox, FixedText."
This reverts commit 8bc4b991539a74373bfb1ef8792276ada8c958e4.
2008-10-20 19:24:50 +0200 jcn r262504 : layoutdialogs2: Disable Timer for ENABLE_LAYOUT.
2008-10-20 19:24:45 +0200 jcn r262503 : layoutdialogs2: Move FocusHandlers from Control down to ListBox, ComboBox, FixedText.
2008-10-20 19:24:40 +0200 jcn r262502 : layoutdialogs2: Wider small symbol.
2008-10-20 19:24:36 +0200 jcn r262501 : layoutdialogs2: Listener and SetHandler cleanup.
2008-10-20 19:24:31 +0200 jcn r262500 : layoutdialogs2: Clear mxWindow upon deletion. Fixes Find&Replace crasher.
2008-10-20 19:24:27 +0200 jcn r262499 : layoutdialogs2: Typo, fixes build.
2008-10-20 19:24:22 +0200 jcn r262498 : layoutdialogs2: Ignore .log files too.
2008-10-20 19:24:19 +0200 jcn r262497 : layoutdialogs2: By default, work around #define protected public Resource hack.
2008-10-20 19:24:15 +0200 jcn r262496 : layoutdialogs2: Sw:Find&Replace: Remove wrong static cast. Fixes crasher.
2008-10-20 19:24:10 +0200 jcn r262495 : layoutdialogs2: Find&Replace: do not vertically expand buttons, add title.
2008-10-20 19:24:06 +0200 jcn r262494 : layoutdialogs2: Find&Replace: Remove need for ResId, set help id.
2008-10-20 19:24:01 +0200 jcn r262493 : layoutdialogs2: MoreButton: redraw upon resize, fix labels, use small symbol.
2008-10-20 19:23:57 +0200 jcn r262492 : layoutdialogs2: Support setting and querying small symbol on vcl:button.
2008-10-20 19:23:52 +0200 jcn r262491 : layoutdialogs2: Support redrawing of only this, make parent optional.
2008-10-20 19:23:48 +0200 jcn r262490 : layoutdialogs2: Add Kohei's wfield patch https://bugzilla.novell.com/attachment.cgi?id=235398. Fixes n#417840.
2008-10-20 19:23:44 +0200 jcn r262489 : layoutdialogs2: Redraw [parent] upon first time visibility.
Fixes weird listbox dropdown sizing in Find & Replace.
2008-10-20 19:23:39 +0200 jcn r262488 : layoutdialogs2: Add manual layouting for Find & Replace.
2008-10-20 19:23:35 +0200 jcn r262487 : layoutdialogs2: src2xml: use label instead of text for buttons.
Run on Find & Replace; fixes button texts.
2008-10-20 19:23:31 +0200 jcn r262486 : layoutdialogs2: Add initial auto-translated find-&-replace-.xml.
2008-10-20 19:23:26 +0200 jcn r262485 : layoutdialogs2: layout importer: handle ModelessDialog.
Fixes Find & Replace parsing error.
2008-10-20 19:23:22 +0200 jcn r262484 : layoutdialogs2: src2xml: Handle multiple widgets at same x,y.
Fixes silent removal of widgets in Find & Replace dialog.
2008-10-20 19:23:18 +0200 jcn r262483 : layoutdialogs2: src2xml: Handle hide= attribute, translate to show=.
2008-10-20 19:23:14 +0200 jcn r262482 : layoutdialogs2: Only use __PRETTY_FUNCTION__ on gcc. Fixes Windows build. Thanks Tor!
2008-10-20 19:23:10 +0200 jcn r262481 : layoutdialogs2: Add two missing SAL_CALL decorations. Fixes Windows build. Thanks Tor!
2008-10-20 19:23:05 +0200 jcn r262480 : layoutdialogs2: Build fixes for layout'ed Find & Replace dialog.
2008-10-20 19:22:54 +0200 jcn r262479 : layoutdialogs2: Do not use layout::SfxTabDialog for now.
2008-10-20 19:22:47 +0200 jcn r262478 : layoutdialogs2: Crufty sizing tweaks.
2008-10-20 19:22:42 +0200 jcn r262477 : layoutdialogs2: More debugging cleanups.
2008-10-20 19:22:37 +0200 jcn r262476 : layoutdialogs2: More cleanups that result in constant manual resizing...
2008-10-20 19:22:33 +0200 jcn r262475 : layoutdialogs2: Tabdlg cleanups.
2008-10-20 19:22:28 +0200 jcn r262474 : layoutdialogs2: Add GetOptimalSize () to InPlug. Fixes auto-sizing of tabcontrol.
2008-10-20 19:22:21 +0200 jcn r262473 : layoutdialogs2: Get VCLXTabControl to resize automatically (too tall), not mousable.
2008-10-20 19:22:13 +0200 jcn r262472 : layoutdialogs2: Respect show=false property; do not show everything.
2008-10-20 19:22:09 +0200 jcn r262471 : layoutdialogs2: Add show=false on buttons. Fixes displaying everything.
2008-10-20 19:22:05 +0200 jcn r262470 : layoutdialogs2: Move some code to reduce namespace and #if hacking.
2008-10-20 19:22:00 +0200 jcn r262469 : layoutdialogs2: Cleanup, remove unneeded #defines.
2008-10-20 19:21:56 +0200 jcn r262468 : layoutdialogs2: Replace static casts with dynamic_cast, fixes layout::SfxTabDialog.
Explicitly add 2 tabpages while adding tabpages, instead of relying on ResId.
2008-10-20 19:21:51 +0200 jcn r262467 : layoutdialogs2: Use cpp hacking to remove layout-tabdialog.hxx duplication.
2008-10-20 19:21:45 +0200 jcn r262466 : layoutdialogs2: Minimize diff between layout-tabdialog.hxx and tabdlg.hxx.
2008-10-20 19:21:41 +0200 jcn r262465 : layoutdialogs2: Remove copy of SfxTabDialog; use cpp logic to create both flavours.
2008-10-20 19:21:36 +0200 jcn r262464 : layoutdialogs2: Minimize diff between layout/sfxtabdialog.cxx and source/tabdlg.cxx.
This enables the next step: use cpp logic instead of code duplication.
2008-10-20 19:21:31 +0200 jcn r262463 : layoutdialogs2: Hello world on layout::SfxTabDialog.
2008-10-20 19:21:24 +0200 jcn r262462 : layoutdialogs2: Nice `Compiling:' message that shows the file being compiled.
2008-10-20 19:21:20 +0200 jcn r262461 : layoutdialogs2: Use layout::SfxTabDialog for sort options.
2008-10-20 19:21:15 +0200 jcn r262460 : layoutdialogs2: Update sort options tab.
2008-10-20 19:21:10 +0200 jcn r262459 : layoutdialogs2: Add layout::SfxTabDialog.
2008-10-20 19:21:04 +0200 jcn r262458 : layoutdialogs2: Cleanup previous attempt using layout::SfxTabPage == layout::TabPage.
2008-10-20 19:20:57 +0200 jcn r262457 : layoutdialogs2: Windows 2003 compile fixes, i#92397.
2008-10-20 19:20:52 +0200 jcn r262456 : layoutdialogs2: Set default radiogroup when none provided.
2008-10-20 19:20:48 +0200 jcn r262455 : layoutdialogs2: Add radiogroup to sort-options. Fixes crasher.
2008-10-20 19:20:43 +0200 jcn r262454 : layoutdialogs2: Cleanup ParentSet fix.
2008-10-20 19:20:36 +0200 jcn r262453 : layoutdialogs2: Add debugging in ParentSet. Works standalone, not integrated.
2008-10-20 19:20:31 +0200 jcn r262452 : layoutdialogs2: Revert "Have InPlug not derive from Window, but have as member."
This reverts commit 50ea26eec3fe14943f24900081ad923e72550345.
2008-10-20 19:20:25 +0200 jcn r262451 : layoutdialogs2: Have InPlug not derive from Window, but have as member.
2008-10-20 19:20:20 +0200 jcn r262450 : layoutdialogs2: Move layout plugin implementation from layout::SfxTabPage to InPlug.
2008-10-20 19:20:14 +0200 jcn r262449 : layoutdialogs2: Get all widgets to display in sfxtabpage plugin with Window::SetParent hack.
2008-10-20 19:20:09 +0200 jcn r262448 : layoutdialogs2: Two-button manual hello world with sfxtabpage plugin.
2008-10-20 19:20:03 +0200 jcn r262447 : layoutdialogs2: WIP: layout::SfxTabPage derived from SfxTabPage.
2008-10-20 19:19:55 +0200 jcn r262446 : layoutdialogs2: Always set parent after construction, fixes listbox dropdown.
2008-10-20 19:19:51 +0200 jcn r262445 : layoutdialogs2: Fix radio button crasher.
2008-10-20 19:19:47 +0200 jcn r262444 : layoutdialogs2: Implement ListBox method wrappers. Fixes filling of listbox.
2008-10-20 19:19:42 +0200 jcn r262443 : layoutdialogs2: Convert Move/Copy sheet to layout engine.
2008-10-20 19:19:35 +0200 jcn r262442 : layoutdialogs2: Also hide yes/no buttons if not used.
2008-10-20 19:19:31 +0200 jcn r262441 : layoutdialogs2: Elaborate on changing client code.
2008-10-20 19:19:26 +0200 jcn r262440 : layoutdialogs2: Implement winbits client-code compatibility for Message Boxes.
2008-10-20 19:19:21 +0200 jcn r262439 : layoutdialogs2: Add localize.sdf to toolkit uiconfig. Fixes build.
2008-10-20 19:19:17 +0200 jcn r262438 : layoutdialogs2: Do not use ti_layout twice in toolkit build.lst. Fixes build.
2008-10-20 19:19:13 +0200 jcn r262437 : layoutdialogs2: Oops, also dist toolkit-layout.zip.
2008-10-20 19:19:09 +0200 jcn r262436 : layoutdialogs2: Move layout.mk to solenv.
2008-10-20 19:19:03 +0200 jcn r262435 : layoutdialogs2: Add handy TEST file.
2008-10-20 19:18:58 +0200 jcn r262434 : layoutdialogs2: Implement MessageBox and wrappers ErrorBox, InfoBox, QueryBox, WarningBox.
2008-10-20 19:18:52 +0200 jcn r262433 : layoutdialogs2: QueryBox without image used for Delete Sheet dialog.
2008-10-20 19:18:46 +0200 jcn r262432 : layoutdialogs2: WIP QueryBox.
2008-10-20 19:18:39 +0200 jcn r262431 : layoutdialogs2: Add insert-sheet localization.
2008-10-20 19:18:34 +0200 jcn r262430 : layoutdialogs2: Run indent-region on zoom.xml, distribute it.
2008-10-20 19:18:30 +0200 jcn r262429 : layoutdialogs2: Dist xml files too.
2008-10-20 19:18:26 +0200 jcn r262428 : layoutdialogs2: Add insert-sheet.xml to workben.
2008-10-20 19:18:22 +0200 jcn r262427 : layoutdialogs2: Update layout TODO.
2008-10-20 19:18:18 +0200 jcn r262426 : layoutdialogs2: Cleanups and add comments.
2008-10-20 19:18:13 +0200 jcn r262425 : layoutdialogs2: Keep RadioButtons::RadioButton callback at HEAD of list.
Fixes radiobutton grouping.
2008-10-20 19:18:07 +0200 jcn r262424 : layoutdialogs2: Remove IMPORT_RADIOGROUP cruft.
2008-10-20 19:18:02 +0200 jcn r262423 : layoutdialogs2: Have code check fire event for radio button.
Fixes radio button grouping.
2008-10-20 19:17:58 +0200 jcn r262422 : layoutdialogs2: Enable IMPORT_RADIOGROUP flag.
2008-10-20 19:17:54 +0200 jcn r262421 : layoutdialogs2: Add radio groups to zoom.xml.
2008-10-20 19:17:50 +0200 jcn r262420 : layoutdialogs2: Move RadioGroup implementation to cxx file.
2008-10-20 19:17:45 +0200 jcn r262419 : layoutdialogs2: Manually set help id for insert table.
2008-10-20 19:17:41 +0200 jcn r262418 : layoutdialogs2: Cosmetic fixes for insert-sheet.
2008-10-20 19:17:37 +0200 jcn r262417 : layoutdialogs2: FindAndRemove now also skips translation prefix.
Fixes setting of title etc. from nontranslated xml.
2008-10-20 19:17:32 +0200 jcn r262416 : layoutdialogs2: Manually set help id for zoom and wordcount dialogs.
2008-10-20 19:17:27 +0200 jcn r262415 : layoutdialogs2: Set help-id from xml.
2008-10-20 19:17:21 +0200 jcn r262414 : layoutdialogs2: Move -DENABLE_LAYOUT from stray makefiles to settings.mk.
2008-10-20 19:17:13 +0200 jcn r262413 : layoutdialogs2: Initial conversion of insert-sheet dialog.
2008-10-20 19:17:08 +0200 jcn r262412 : layoutdialogs2: Add wrappers for {Get,Set}{Pointer,Text}.
2008-10-20 19:17:04 +0200 jcn r262411 : layoutdialogs2: Toolkit layout dialog copy updates.
2008-10-20 19:16:59 +0200 jcn r262410 : layoutdialogs2: Cleanup #include <layout*> disaster.
Fixes multiple inclusions of layout-pre, layout-post.
2008-10-20 19:16:53 +0200 jcn r262409 : layoutdialogs2: Implement Get,Set{,Smart}HelpId ().
2008-10-20 19:16:49 +0200 jcn r262408 : layoutdialogs2: Make some getters const.
2008-10-20 19:16:45 +0200 jcn r262407 : layoutdialogs2: Manual tweaks for string-input.xml.
2008-10-20 19:16:40 +0200 jcn r262406 : layoutdialogs2: Add string-input.xml.
2008-10-20 19:16:36 +0200 jcn r262405 : layoutdialogs2: Add dummy implementation for SetHelpId etc.
2008-10-20 19:16:32 +0200 jcn r262404 : layoutdialogs2: Actually say *what* file cannot be copied *where*. Sigh.
2008-10-20 19:16:27 +0200 jcn r262403 : layoutdialogs2: Thinko in macro name. Fixes compilation of strindlg.cxx.
2008-10-20 19:16:22 +0200 jcn r262402 : layoutdialogs2: Add layout includes to stringdlg and makefile.
2008-10-20 19:16:17 +0200 jcn r262401 : layoutdialogs2: Add sc/uiconfig/layout/localize.sdf
2008-10-20 19:16:13 +0200 jcn r262400 : layoutdialogs2: Oops, build sc/uiconfig/layout.
2008-10-20 19:16:09 +0200 jcn r262399 : layoutdialogs2: Have virtual destructor on Context, delete TabPage when deleting TabDialog.
2008-10-20 19:16:04 +0200 jcn r262398 : layoutdialogs2: Actually delete layout::TabPage objects when deleting SfxTabdialog.
2008-10-20 19:16:00 +0200 jcn r262397 : layoutdialogs2: Workaround for second invocation crash of sort dialog options tab.
2008-10-20 19:15:56 +0200 jcn r262396 : layoutdialogs2: Handle Reset button.
2008-10-20 19:15:51 +0200 jcn r262395 : layoutdialogs2: Also install sc xml zip file.
2008-10-20 19:15:46 +0200 jcn r262394 : layoutdialogs2: Integrate sort-options into sc.
2008-10-20 19:15:41 +0200 jcn r262393 : layoutdialogs2: Revert "Fix sfx2 compile warnings."
This reverts commit 8b55d402af7bd217db35f67b02dc92f93f3ada5d.
2008-10-20 19:15:34 +0200 jcn r262392 : layoutdialogs2: Remove debuging.
2008-10-20 19:15:30 +0200 jcn r262391 : layoutdialogs2: Pass set argument to layout::TabPage. Fixes OO.o integration crasher.
2008-10-20 19:15:24 +0200 jcn r262390 : layoutdialogs2: Ignore more.
2008-10-20 19:15:20 +0200 jcn r262389 : layoutdialogs2: Oops, make just one (1) sort-options tab.
2008-10-20 19:15:15 +0200 jcn r262388 : layoutdialogs2: Revert macroconf compile warnings.
2008-10-20 19:15:09 +0200 jcn r262387 : layoutdialogs2: Fix sfx2 compile warnings.
2008-10-20 19:15:01 +0200 jcn r262386 : layoutdialogs2: Collapsed tabpage and sort-options development.
2008-10-20 19:14:51 +0200 jcn r262385 : layoutdialogs2: Make dev300/src680 install layout switchable at compile time.
2008-10-20 19:14:47 +0200 jcn r262384 : layoutdialogs2: Update README, add README.
2008-10-20 19:14:43 +0200 jcn r262383 : layoutdialogs2: Repainting, hiding stuff.
2008-10-20 19:14:38 +0200 jcn r262382 : layoutdialogs2: Add allocateArea to VCLXTabPage.
2008-10-20 19:14:34 +0200 jcn r262381 : layoutdialogs2: Revert "Use VCLXContainer as base for VCLXTabPage."
This reverts commit 06a984434d0d2c356fd0cdaf96d6d613d5147b7c.
2008-10-20 19:14:30 +0200 jcn r262380 : layoutdialogs2: Use VCLXContainer as base for VCLXTabPage.
2008-10-20 19:14:26 +0200 jcn r262379 : layoutdialogs2: Revert "Derive VCLXTabPage from VBox."
This reverts commit 8ab66364bdc08151ce2c982c1aa03f7881d86b84.
2008-10-20 19:14:22 +0200 jcn r262378 : layoutdialogs2: Derive VCLXTabPage from VBox.
2008-10-20 19:14:17 +0200 jcn r262377 : layoutdialogs2: More cleanups and testing.
2008-10-20 19:14:12 +0200 jcn r262376 : layoutdialogs2: Get layout tabpage to nicely select. No content visible, though.
2008-10-20 19:14:07 +0200 jcn r262375 : layoutdialogs2: Support ScTabPageSortOptions in standalone test.
2008-10-20 19:14:02 +0200 jcn r262374 : layoutdialogs2: Support tabpage creation from xml.
2008-10-20 19:13:56 +0200 jcn r262373 : layoutdialogs2: Remove most TEST_LAYOUT conditionals.
2008-10-20 19:13:52 +0200 jcn r262372 : layoutdialogs2: Remove Args effort.
2008-10-20 19:13:48 +0200 jcn r262371 : layoutdialogs2: Attempt to create ArgSet.
2008-10-20 19:13:44 +0200 jcn r262370 : layoutdialogs2: Compile more.
2008-10-20 19:13:39 +0200 jcn r262369 : layoutdialogs2: Add sortdlg.
2008-10-20 19:13:35 +0200 jcn r262368 : layoutdialogs2: Oops, ID fix.
2008-10-20 19:13:30 +0200 jcn r262367 : layoutdialogs2: Build fix.
2008-10-20 19:13:26 +0200 jcn r262366 : layoutdialogs2: Revert "Use ::Window for plugin base iso ::Control."
This reverts commit 919ddaf2f52ad5e4df877a094cd1e336888d6210.
2008-10-20 19:13:21 +0200 jcn r262365 : layoutdialogs2: Plugin dialog cleanups.
2008-10-20 19:13:17 +0200 jcn r262364 : layoutdialogs2: Use ::Window for plugin base iso ::Control.
2008-10-20 19:13:12 +0200 jcn r262363 : layoutdialogs2: Use cstdio, remove cruft.
2008-10-20 19:13:07 +0200 jcn r262362 : layoutdialogs2: Remove cruft.
2008-10-20 19:13:02 +0200 jcn r262361 : layoutdialogs2: Remove sizing mess.
2008-10-20 19:12:57 +0200 jcn r262360 : layoutdialogs2: Trigger [re]draw of DialControl.
2008-10-20 19:12:53 +0200 jcn r262359 : layoutdialogs2: DialControl window behaves nicely and invisible.
2008-10-20 19:12:48 +0200 jcn r262358 : layoutdialogs2: Revert adding of setparent.
2008-10-20 19:12:43 +0200 jcn r262357 : layoutdialogs2: Add dialog::setparent to plugin.
2008-10-20 19:12:39 +0200 jcn r262356 : layoutdialogs2: Add a setProperty for VCLXPlugin.
2008-10-20 19:12:34 +0200 jcn r262355 : layoutdialogs2: Unhide plugin.
2008-10-20 19:12:30 +0200 jcn r262354 : layoutdialogs2: Revert.
2008-10-20 19:12:25 +0200 jcn r262353 : layoutdialogs2: Use window instead of control.
2008-10-20 19:12:20 +0200 jcn r262352 : layoutdialogs2: Lots of plugin settings.
2008-10-20 19:12:16 +0200 jcn r262351 : layoutdialogs2: More hacks.
2008-10-20 19:12:11 +0200 jcn r262350 : layoutdialogs2: Compile fixes.
2008-10-20 19:12:05 +0200 jcn r262349 : layoutdialogs2: Use c++ includes.
2008-10-20 19:12:00 +0200 jcn r262348 : layoutdialogs2: Junk UnoTunnel nonsense.
2008-10-20 19:11:55 +0200 jcn r262347 : layoutdialogs2: Remove more cruft.
2008-10-20 19:11:50 +0200 jcn r262346 : layoutdialogs2: Remove cruft.
2008-10-20 19:11:44 +0200 jcn r262345 : layoutdialogs2: Rename wrap to plugin.
2008-10-20 19:11:39 +0200 jcn r262344 : layoutdialogs2: All sorry tries.
2008-10-20 19:11:33 +0200 jcn r262343 : layoutdialogs2: Rename plugin to wrap.
2008-10-20 19:11:28 +0200 jcn r262342 : layoutdialogs2: Add ifdefs, no UNOTUNNEL, no crash on exit.
2008-10-20 19:11:23 +0200 jcn r262341 : layoutdialogs2: Redo all kind of Uno and XIface weirdness.
2008-10-20 19:11:17 +0200 jcn r262340 : layoutdialogs2: Remove extra UnoTunnel.
2008-10-20 19:11:12 +0200 jcn r262339 : layoutdialogs2: Plugin hello world. TODO: parenting/owning/sizing, ... etc.
2008-10-20 19:11:06 +0200 jcn r262338 : layoutdialogs2: Zoom updates.
2008-10-20 19:11:01 +0200 jcn r262337 : layoutdialogs2: Add missing controls.
2008-10-20 19:10:56 +0200 jcn r262336 : layoutdialogs2: Add .gitignore.
Diffstat (limited to 'toolkit')
121 files changed, 9063 insertions, 3551 deletions
diff --git a/toolkit/doc/layout/README b/toolkit/doc/layout/README index 1e3737f90a77..d7ced3891273 100644 --- a/toolkit/doc/layout/README +++ b/toolkit/doc/layout/README @@ -2,19 +2,15 @@ Layout engine for OpenOffice.org - Work in Progress Simple dialogs have been ported now: zoom and wordcount. -Code lives in "layout" CWS. +New code lives in "layoutdialogs" CWS or ooo-build trunk. -* Ceckout layout cws. +* Checkout layoutdialogs cws. * Configure using --enable-layout. -* dmake all +* [d]make all -* dmake install DESTDIR=$(pwd)/ooo-layout/ - -* Source refresh in workben/layout, do something like - - cd toolkit/workben/layout && . ./refresh --inst .../ooo-layout/ +* [d]make install DESTDIR=$(pwd)/ooo-layout/ Integration into OOo: @@ -24,3 +20,5 @@ Integration into OOo: ./soffice.bin Start a [Writer] document and choose View/Zoom or Extra/Word count. + +* Also See workben/layout/README.
\ No newline at end of file diff --git a/toolkit/doc/layout/TODO b/toolkit/doc/layout/TODO index df6b04a99790..fdffa7fad5aa 100644 --- a/toolkit/doc/layout/TODO +++ b/toolkit/doc/layout/TODO @@ -4,6 +4,11 @@ ** Move everything & development into new layout-dialogs CWS ** cleanups +*** Add XRadioButton2 and layout::VCLXRadioButton with + {get,set}RadioGroup. Remove import.cxx RadioGroups::RadioGroup, + VCLXRadioButton::getFirstActionListener () and [actionListener + juggling in] layout::RadioButton_impl::SetClickHdl() and + EnableRadioCheck() layout::RadioButton_impl::Check. *** layout/import.hxx: what's this generator stuff? #if 0 // generator @@ -87,7 +92,6 @@ but keep using yes/no on Windows, eg? *** remove -DTEST_LAYOUT=1 from util/makefile.mk? ** fixes -*** mpRadioGroup HACK --> use radiogroup property *** missing properties 'title' -> 'Set Zoom' Missing prop Title @@ -102,12 +106,18 @@ fHorAlign = fVerAlign = 0.5; --> float const [CENTER?] = 0.5; ** include full translations *** zoom -grep zoom.src svx/source/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\zoom.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/FL_\(ZOOM\)_label/FL_\1_text/' -e 's/\t_label/\tRID_SVXDLG_ZOOM_title/' -**** done, except for View Layout update: no strings in localize.sdf yet, - must redo. +grep zoom.src svx/source/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\zoom.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_ZOOM_title/' *** wordcount grep wordcountdialog.src sw/source/ui/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\workben.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/FL_\([A-Z]*\)_label/FL_\1_text/' -e 's/\t_label/\tDLG_WORDCOUNT_title/'s - +*** sortdlg +grep sortdlg.src ../../../sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\sort-options.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' | grep -E ' (nl|de|en-US) ' > localize-str.sdf +grep sortdlg.src sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\sort-options.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' > sc/uiconfig/layout/localize-sort-options.sdf +*** insert-sheet +grep instbdlg.src sc/source/ui/miscdlgs/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\insert-sheet.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_INSERT_TABLE_title/' > sc/uiconfig/layout/localize-insert-sheet.sdf +*** move-copy-sheet +grep -E 'miscdlgs.src.*(FT_DEST|FT_INSERT|STR_NEWDOC|RID_SCDLG_MOVETAB|BTN_COPY)' sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\move-copy-sheet.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_MOVETAB_title/' > sc/uiconfig/layout/localize-move-copy-sheet.sdf +*** find-and-replace +grep srchdlg.src svx/source/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "svx\\uiconfig\\layout\\find-and-replace.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_SEARCH_title/' > svx/uiconfig/layout/localize-find-and-replace.sdf * i18n + forget java property files nonsense diff --git a/toolkit/inc/layout/layout-post.hxx b/toolkit/inc/layout/layout-post.hxx index fb1a809a6156..d5597bb0073b 100644 --- a/toolkit/inc/layout/layout-post.hxx +++ b/toolkit/inc/layout/layout-post.hxx @@ -34,39 +34,72 @@ #if ENABLE_LAYOUT +/* Allow re-inclusion for cxx file. */ +#undef _LAYOUT_PRE_HXX + + #undef AdvancedButton +#undef ApplyButton #undef Box #undef Button #undef CancelButton #undef CheckBox +#undef ComboBox #undef Container +#undef Control +#undef Dialog +#undef Edit +#undef ErrorBox #undef FixedImage #undef FixedInfo #undef FixedLine #undef FixedText -#undef HelpButton #undef HBox +#undef HelpButton +#undef IgnoreButton +#undef ImageButton +#undef InfoBox +#undef ListBox +#undef MessBox +#undef MessageBox #undef MetricField +#undef MetricFormatter #undef MoreButton #undef MultiLineEdit +#undef MultiListBox +#undef NoButton +#undef NumericField +#undef NumericFormatter #undef OKButton +#undef Plugin #undef ProgressBar #undef PushButton +#undef QueryBox #undef RadioButton -#undef SfxModalDialog +#undef ResetButton +#undef RetryButton +#undef SfxTabPage +#undef SfxTabDialog +#undef SpinField +#undef TabDialog +#undef TabControl +#undef TabPage #undef Table #undef VBox +#undef WarningBox +#undef YesButton -#undef Window - -#undef SVX_RES -#define SVX_RES(i) ResId(i,DIALOG_MGR()) +#undef SvxFontListBox +#undef SvxLanguageBox -#undef SW_RES -#define SW_RES(i) ResId(i,SWDIALOG_MGR()) +#undef ModalDialog +#undef ModelessDialog +#undef ScExpandedFixedText +#undef SfxDialog +#undef SfxModalDialog +#undef SfxModelessDialog -/* Allow re-inclusion for cxx file. */ -#undef _LAYOUT_PRE_HXX +#undef Window #endif /* ENABLE_LAYOUT */ diff --git a/toolkit/inc/layout/layout-pre.hxx b/toolkit/inc/layout/layout-pre.hxx index 747c8b13db45..d8a1e5d9665c 100644 --- a/toolkit/inc/layout/layout-pre.hxx +++ b/toolkit/inc/layout/layout-pre.hxx @@ -34,83 +34,78 @@ #if ENABLE_LAYOUT -//#if !LAYOUT -//#define LAYOUT 1 -//#endif -//#define LAYOUT_NS layout - -// TWBN, but find that SfxModalDialog and FixedLine are already defined, eg compiling -// dlgfact.cxx -//typedef layout::Dialog SfxModalDialog; -//typedef layout::FixedLine FixedLine; +///* Allow re-inclusion for next hxx file. */ +#undef _LAYOUT_POST_HXX #define AdvancedButton layout::AdvancedButton +#define ApplyButton layout::ApplyButton #define Box layout::Box #define Button layout::Button #define CancelButton layout::CancelButton #define CheckBox layout::CheckBox +#define ComboBox layout::ComboBox #define Container layout::Container +#define Control layout::Control +#define Dialog layout::Dialog +#define Edit layout::Edit +#define ErrorBox layout::ErrorBox #define FixedImage layout::FixedImage #define FixedInfo layout::FixedInfo #define FixedLine layout::FixedLine #define FixedText layout::FixedText #define HBox layout::HBox #define HelpButton layout::HelpButton +#define IgnoreButton layout::IgnoreButton +#define ImageButton layout::ImageButton +#define InfoBox layout::InfoBox +#define LocalizedString layout::LocalizedString +#define ListBox layout::ListBox +#define MessBox layout::MessBox +#define MessageBox layout::MessageBox #define MetricField layout::MetricField +#define MetricFormatter layout::MetricFormatter #define MoreButton layout::MoreButton #define MultiLineEdit layout::MultiLineEdit +#define MultiListBox layout::MultiListBox +#define NoButton layout::NoButton +#define NumericField layout::NumericField +#define NumericFormatter layout::NumericFormatter #define OKButton layout::OKButton +#define Plugin layout::Plugin #define ProgressBar layout::ProgressBar #define PushButton layout::PushButton +#define QueryBox layout::QueryBox #define RadioButton layout::RadioButton -#define SfxModalDialog layout::Dialog +#define ResetButton layout::ResetButton +#define RetryButton layout::RetryButton +#define SfxTabDialog layout::SfxTabDialog +#define SfxTabPage layout::SfxTabPage +#if ENABLE_LAYOUT +#define SvxFontListBox layout::SvxFontListBox +#define SvxLanguageBox layout::SvxLanguageBox +#endif +#define SpinField layout::SpinField +#define TabControl layout::TabControl +#define TabPage layout::TabPage #define Table layout::Table #define VBox layout::VBox +#define WarningBox layout::WarningBox +#define YesButton layout::YesButton -/* FIXME: why are we defaulting to layout::Window? - /home/janneke/vc/ooo-build/build/hack/sw/source/ui/dialog/wordcountdialog.cxx:87: error: no matching function for call to 'layout::Dialog::Dialog(Window*&, const char [14], const char [7])' - ../../../../layout/inc/layout/layout.hxx:304: note: candidates are: layout::Dialog::Dialog(layout::Window*, const char*, const char*, sal_uInt32) - ../../../../layout/inc/layout/layout.hxx:300: note: layout::Dialog::Dialog(const layout::Dialog&) -*/ +#define ModalDialog Dialog +#define ModelessDialog Dialog +#define ScExpandedFixedText FixedText +#define SfxDialog Dialog +#define SfxModalDialog Dialog +#define SfxModelessDialog Dialog +#define TabDialog Dialog #define Window ::Window -#undef SVX_RES -#define SVX_RES(x) #x -#undef SW_RES -#define SW_RES(x) #x - -/* Hmm. This hack makes zoom.cxx, wordcountdialog.cxx diffs smaller - * but is not scalable. */ -#ifdef _LAYOUT_POST_HXX - -#ifdef _SVX_RECOVER_CXX -#undef SfxModalDialog -// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_RECOVER", localize.sdf -#define SfxModalDialog( pParent, SVX_RES_RID ) layout::Dialog( pParent, "recover.xml", "RID_SVXDLG_RECOVER" ) -//#define _SVX_RECOVER_HRC -#endif /* _SVX_RECOVER_CXX */ - -#ifdef SW_WORDCOUNTDIALOG_HXX -#undef SfxModalDialog -// 3rd parameter must match ID in <modaldialog> "DLG_WORDCOUNT", localize.sdf -#define SfxModalDialog( pParent, SW_RES_RID ) layout::Dialog( pParent, "wordcount.xml", "DLG_WORDCOUNT" ) -#define SW_WORDCOUNTDIALOG_HRC -#endif /* SW_WORDCOUNTDIALOG_HXX */ - -#ifdef _SVX_ZOOM_CXX -#undef SfxModalDialog -// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_ZOOM", localize.sdf -#define SfxModalDialog( pParent, SVX_RES_RID ) layout::Dialog( pParent, "zoom.xml", "RID_SVXDLG_ZOOM" ) -#define _SVX_ZOOM_HRC -#endif /* _SVX_ZOOM_CXX */ - -#endif /* _LAYOUT_POST_HXX */ - -#else /* !ENABLE_LAYOUT */ +#else -#define LAYOUT_PRE_POST +#define LocalizedString String -#endif /* !ENABLE_LAYOUT */ +#endif /* ENABLE_LAYOUT */ #endif /* _LAYOUT_PRE_HXX */ diff --git a/toolkit/inc/layout/layout.hxx b/toolkit/inc/layout/layout.hxx index 2f3ff0df461f..19179507b294 100644 --- a/toolkit/inc/layout/layout.hxx +++ b/toolkit/inc/layout/layout.hxx @@ -32,21 +32,54 @@ #ifndef _LAYOUT_HXX #define _LAYOUT_HXX -#include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/awt/XLayoutContainer.hpp> +#include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/util/Color.hpp> +#include <i18npool/lang.h> +#include <toolkit/dllapi.h> +#include <tools/gen.hxx> #include <tools/link.hxx> #include <tools/string.hxx> - -// FIXME: eventually wrap FieldUnit +#include <vcl/bitmap.hxx> +#include <vcl/combobox.h> #include <vcl/fldunit.hxx> -// FIXME: eventually wrap this too ... +#include <vcl/lstbox.h> +#include <vcl/smartid.hxx> #include <vcl/wintypes.hxx> -#include <toolkit/dllapi.h> - -class Window; +class Button; +class ComboBox; +class Color; +class Control; +class Dialog; +class Edit; +class Font; class Image; +class ListBox; +class MapMode; +class MultiListBox; +class NotifyEvent; +class Pointer; +class PushButton; +class RadioButton; +class ResId; +struct SfxChildWinInfo; +//class SvxFontListBox; +//class SvxLanguageBox; +class TabControl; +class TabPage; +class VCLXRadioButton; +class VCLXWindow; +class Window; + +namespace layoutimpl +{ +class VCLXTabControl; +} + +class VCLXTabControl; + +namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } } namespace layout { @@ -60,8 +93,8 @@ class TOOLKIT_DLLPUBLIC Context ContextImpl *pImpl; public: Context( char const* pPath ); - ~Context(); - PeerHandle GetPeerHandle( char const* pId, sal_uInt32 nId = 0 ) const; + virtual ~Context(); + PeerHandle GetPeerHandle( char const* id, sal_uInt32 nId = 0 ) const; void setToplevel( PeerHandle xToplevel ); PeerHandle getToplevel(); PeerHandle getRoot(); @@ -74,36 +107,95 @@ public: par( pImpl ) {} \ char const* GetUnoName() const; \ public: \ - t( Context *pCtx, char const* pId, sal_uInt32 nId = 0 ); \ - t( Window *pParent, WinBits nStyle = defaultWinBit ) + t( Context *context, char const* id, sal_uInt32 nId = 0 ); \ + t( Window *parent, WinBits nStyle = defaultWinBit ); \ + t (Window *parent, ResId const &res) #define DECL_GET_IMPL(t) \ inline t##Impl &getImpl() const +#define DECL_GET_WINDOW( cls ) ::cls* Get##cls() const +#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() const { return dynamic_cast< ::cls*>( GetWindow() ); } + +#define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const +#define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::VCLX##cls*>( GetVCLXWindow() ); } + +#define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const +#define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); } + // follows the VCL inheritance hierarchy ... class WindowImpl; class TOOLKIT_DLLPUBLIC Window { protected: + friend class WindowImpl; WindowImpl *mpImpl; - static PeerHandle CreatePeer( Window *pParent, WinBits nStyle, + static PeerHandle CreatePeer( Window *parent, WinBits nStyle, char const* pName); + + virtual void setRes (ResId const& res); + public: - PeerHandle GetPeer(); - Context *getContext(); DECL_GET_IMPL( Window ); explicit Window( WindowImpl *pImpl ); virtual ~Window(); + PeerHandle GetPeer() const; + Context *getContext(); + void Enable( bool bEnable = true ); inline void Disable() { Enable( false ); } - void Show( BOOL bVisible = TRUE ); - inline void Hide() { Show( FALSE ); } + void Show( bool bVisible = true ); + inline void Hide() { Show( false ); } void GrabFocus(); void FreeResource() {} + void SetParent( ::Window *parent ); + virtual void ParentSet (Window *window); + void SetParent( Window *parent ); + + css::uno::Reference<css::awt::XWindow> GetRef() const; + VCLXWindow* GetVCLXWindow() const; + ::Window* GetWindow() const; + ::Window* GetParent() const; + + void SetPointer( Pointer const& pointer ); + Pointer const& GetPointer() const; WinBits GetStyle(); - void SetStyle( WinBits nStyle ); + void SetText( rtl::OUString const& str ); + String GetText() const; + void SetStyle( WinBits style ); + void SetUpdateMode( bool mode ); + void SetHelpId( sal_uIntPtr id ); + sal_uIntPtr GetHelpId() const; + void SetSmartHelpId( SmartId const&, SmartIdUpdateMode mode=SMART_SET_SMART ); + SmartId GetSmartHelpId() const; + void EnterWait (); + void LeaveWait (); + bool IsWait () const; + //void Enable (bool enable=true, bool child=true); + //void Disable (bool child=true); + bool IsEnabled () const; + void EnableInput (bool enable=true, bool child=true); + bool IsInputEnabled () const; + + bool IsVisible () const; + bool HasChildPathFocus (bool systemWindow=false) const; + void SetPosPixel (Point const&); + Point GetPosPixel () const; + void SetSizePixel (Size const&); + Size GetSizePixel () const; + void SetPosSizePixel (Point const&, Size const&); + sal_Int32 GetCtrlTextWidth (rtl::OUString const& str) const; + sal_Int32 GetTextHeight () const; + + Size LogicToPixel( Size const& size ) const; + Size LogicToPixel( Size const& size, MapMode const& mapMode ) const; + + bool HasFocus () const; + Font& GetFont () const; + void SetFont (Font const& font); + virtual void Invalidate (sal_uInt8 flags=0); }; class ControlImpl; @@ -111,34 +203,39 @@ class TOOLKIT_DLLPUBLIC Control : public Window { DECL_GET_IMPL( Control ); DECL_CONSTRUCTORS( Control, Window, 0 ); + public: -// void SetText( String const& rStr ); - can't do this here ... + ~Control (); + void SetGetFocusHdl (Link const& link); + Link& GetGetFocusHdl (); + void SetLoseFocusHdl (Link const& link); + Link& GetLoseFocusHdl (); }; class FixedLineImpl; class TOOLKIT_DLLPUBLIC FixedLine : public Control { - friend class FixedLineImpl; DECL_GET_IMPL( FixedLine ); DECL_CONSTRUCTORS( FixedLine, Control, WB_HORZ ); + public: - bool IsEnabled(); + bool IsEnabled() const; }; class FixedTextImpl; class TOOLKIT_DLLPUBLIC FixedText : public Control { - friend class FixedTextImpl; DECL_GET_IMPL( FixedText ); DECL_CONSTRUCTORS( FixedText, Control, 0 ); + public: - void SetText( String const& rStr ); + ~FixedText (); + void SetText( rtl::OUString const& rStr ); }; class FixedImageImpl; class TOOLKIT_DLLPUBLIC FixedImage : public Control { - friend class FixedImageImpl; DECL_GET_IMPL( FixedImage ); DECL_CONSTRUCTORS( FixedImage, Control, 0 ); public: @@ -148,7 +245,6 @@ public: class FixedInfoImpl; class TOOLKIT_DLLPUBLIC FixedInfo : public FixedText { - friend class FixedInfoImpl; DECL_GET_IMPL( FixedInfo ); DECL_CONSTRUCTORS( FixedInfo, FixedText, 0 ); }; @@ -166,16 +262,21 @@ public: class ButtonImpl; class TOOLKIT_DLLPUBLIC Button : public Control { - friend class ButtonImpl; DECL_GET_IMPL( Button ); DECL_CONSTRUCTORS( Button, Control, 0 ); + DECL_GET_WINDOW (Button); + public: - void SetText( String const& rStr ); - BOOL SetModeImage( const Image& rImage ); + ~Button (); + static String GetStandardText (sal_uInt16 button_type); + void SetText( rtl::OUString const& rStr ); + bool SetModeImage (Image const& image); + bool SetModeImage (::Image const& image, BmpColorMode mode=BMP_COLOR_NORMAL); void SetImageAlign( ImageAlign eAlign ); void SetClickHdl( Link const& rLink ); virtual void Click() /* pure virtual? */; + Link& GetClickHdl (); }; class PushButtonImpl; @@ -183,9 +284,12 @@ class TOOLKIT_DLLPUBLIC PushButton : public Button { DECL_GET_IMPL( PushButton ); DECL_CONSTRUCTORS( PushButton, Button, 0 ); + DECL_GET_WINDOW (PushButton); + public: - void Check( BOOL bCheck = TRUE ); - BOOL IsChecked() const; + ~PushButton (); + void Check( bool bCheck=true ); + bool IsChecked() const; void Toggle(); void SetToggleHdl( Link const& rLink ); @@ -227,6 +331,10 @@ class TOOLKIT_DLLPUBLIC HelpButton : public PushButton { DECL_CONSTRUCTORS( HelpButton, PushButton, 0 ); }; +class TOOLKIT_DLLPUBLIC ImageButton : public PushButton +{ + DECL_CONSTRUCTORS( ImageButton, PushButton, 0 ); +}; class AdvancedButtonImpl; class TOOLKIT_DLLPUBLIC AdvancedButton : public PushButton @@ -238,6 +346,12 @@ class TOOLKIT_DLLPUBLIC AdvancedButton : public PushButton void AddSimple( Window* w ); void RemoveAdvanced( Window* w ); void RemoveSimple( Window* w ); + + void SetAdvancedText (rtl::OUString const& text); + void SetSimpleText (rtl::OUString const& text); + rtl::OUString GetAdvancedText () const; + rtl::OUString GetSimpleText () const; + void SetDelta (int); }; class MoreButtonImpl; @@ -247,6 +361,11 @@ class TOOLKIT_DLLPUBLIC MoreButton : public AdvancedButton DECL_GET_IMPL( MoreButton ); void AddWindow( Window* w ); void RemoveWindow( Window* w ); + + void SetMoreText (rtl::OUString const& text); + void SetLessText (rtl::OUString const& text); + rtl::OUString GetMoreText () const; + rtl::OUString GetLessText () const; }; class RadioButtonImpl; @@ -254,9 +373,12 @@ class TOOLKIT_DLLPUBLIC RadioButton : public Button { DECL_GET_IMPL( RadioButton ); DECL_CONSTRUCTORS( RadioButton, Button, 0 ); + DECL_GET_WINDOW( RadioButton ); + DECL_GET_VCLXWINDOW( RadioButton ); public: - void Check( BOOL bCheck = TRUE ); - BOOL IsChecked() const; + ~RadioButton (); + void Check( bool bCheck=true ); + bool IsChecked() const; void Toggle(); void SetToggleHdl( Link const& rLink ); @@ -267,9 +389,11 @@ class TOOLKIT_DLLPUBLIC CheckBox : public Button { DECL_GET_IMPL( CheckBox ); DECL_CONSTRUCTORS( CheckBox, Button, 0 ); + public: - void Check( BOOL bCheck = TRUE ); - BOOL IsChecked() const; + ~CheckBox (); + void Check( bool bCheck=true ); + bool IsChecked() const; void Toggle(); void SetToggleHdl( Link const& rLink ); @@ -280,10 +404,14 @@ class TOOLKIT_DLLPUBLIC Edit : public Control { DECL_GET_IMPL( Edit ); DECL_CONSTRUCTORS( Edit, Control, WB_BORDER ); + DECL_GET_WINDOW (Edit); + public: - void SetText( XubString const& rStr ) const; - XubString GetText() const; + ~Edit (); + void SetText( rtl::OUString const& rStr ); + String GetText() const; void SetModifyHdl( Link const& rLink ); + void SetSelection( Selection const& rSelection ); }; class MultiLineEditImpl; @@ -305,8 +433,7 @@ class TOOLKIT_DLLPUBLIC FormatterBase { protected: FormatterBaseImpl *mpFormatImpl; - FormatterBase( FormatterBaseImpl *pFormatImpl ) - : mpFormatImpl( pFormatImpl ) {} + FormatterBase( FormatterBaseImpl *pFormatImpl ); }; class NumericFormatterImpl; @@ -331,8 +458,8 @@ class TOOLKIT_DLLPUBLIC NumericField : public SpinField, public NumericFormatter { DECL_GET_IMPL( NumericField ); public: - NumericField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 ); - NumericField( Window *pParent, WinBits nStyle ); + NumericField( Context *context, char const* id, sal_uInt32 nId=0 ); + NumericField( Window *parent, WinBits nStyle ); }; class MetricFormatterImpl; @@ -343,12 +470,12 @@ class TOOLKIT_DLLPUBLIC MetricFormatter : public FormatterBase explicit MetricFormatter( FormatterBaseImpl *pImpl ); MetricFormatterImpl &getFormatImpl() const; public: - void SetMin( sal_Int64 nNewMin, FieldUnit nUnit = FUNIT_NONE ); - void SetMax( sal_Int64 nNewMax, FieldUnit nUnit = FUNIT_NONE ); - void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit = FUNIT_NONE ); - void SetLast( sal_Int64 nNewLast, FieldUnit nUnit = FUNIT_NONE ); - void SetValue( sal_Int64 nNewValue, FieldUnit nUnit = FUNIT_NONE ); - sal_Int64 GetValue( FieldUnit nUnit = FUNIT_NONE ) const; + void SetMin( sal_Int64 nNewMin, FieldUnit nUnit=FUNIT_NONE ); + void SetMax( sal_Int64 nNewMax, FieldUnit nUnit=FUNIT_NONE ); + void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit=FUNIT_NONE ); + void SetLast( sal_Int64 nNewLast, FieldUnit nUnit=FUNIT_NONE ); + void SetValue( sal_Int64 nNewValue, FieldUnit nUnit=FUNIT_NONE ); + sal_Int64 GetValue( FieldUnit nUnit=FUNIT_NONE ) const; void SetSpinSize( sal_Int64 nNewSize ); }; @@ -358,73 +485,209 @@ class TOOLKIT_DLLPUBLIC MetricField : public SpinField, public MetricFormatter { DECL_GET_IMPL( MetricField ); public: - MetricField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 ); - MetricField( Window *pParent, WinBits nStyle ); + MetricField( Context *context, char const* id, sal_uInt32 nId=0 ); + MetricField( Window *parent, WinBits nStyle ); }; -#define COMBOBOX_APPEND ((USHORT)0xFFFF) -#define COMBOBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF) class ComboBoxImpl; class TOOLKIT_DLLPUBLIC ComboBox : public Edit { DECL_GET_IMPL( ComboBox ); + DECL_GET_WINDOW (ComboBox ); DECL_CONSTRUCTORS( ComboBox, Edit, 0 ); public: - USHORT InsertEntry( XubString const& rStr, USHORT nPos = COMBOBOX_APPEND ); - void RemoveEntry( XubString const& rStr ); - void RemoveEntry( USHORT nPos ); + ~ComboBox (); + sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=COMBOBOX_APPEND ); + void RemoveEntry( String const& rStr ); + void RemoveEntry( sal_uInt16 nPos ); void Clear(); - USHORT GetEntryPos( XubString const& rStr ) const; - XubString GetEntry( USHORT nPos ) const; - USHORT GetEntryCount() const; + sal_uInt16 GetEntryPos( String const& rStr ) const; + String GetEntry( sal_uInt16 nPos ) const; + sal_uInt16 GetEntryCount() const; void SetClickHdl( Link const& rLink ); void SetSelectHdl( Link const& rLink ); + void EnableAutocomplete (bool enable, bool matchCase=false ); }; -#define LISTBOX_APPEND ((USHORT)0xFFFF) -#define LISTBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF) class ListBoxImpl; class TOOLKIT_DLLPUBLIC ListBox : public Control { DECL_GET_IMPL( ListBox ); DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER ); + DECL_GET_WINDOW (ListBox); + public: - USHORT InsertEntry( XubString const& rStr, USHORT nPos = LISTBOX_APPEND ); + ~ListBox (); + sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=LISTBOX_APPEND ); - void RemoveEntry( XubString const& rStr ); - void RemoveEntry( USHORT nPos ); + void RemoveEntry( String const& rStr ); + void RemoveEntry( sal_uInt16 nPos ); void Clear(); - USHORT GetEntryPos( XubString const& rStr ) const; - XubString GetEntry( USHORT nPos ) const; - USHORT GetEntryCount() const; + sal_uInt16 GetEntryPos( String const& rStr ) const; + String GetEntry( sal_uInt16 nPos ) const; + sal_uInt16 GetEntryCount() const; - void SelectEntry( XubString const& rStr, BOOL bSelect = TRUE ); - void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ); + void SelectEntry( String const& rStr, bool bSelect=true ); + void SelectEntryPos( sal_uInt16 nPos, bool bSelect=true ); - USHORT GetSelectEntryCount() const; - XubString GetSelectEntry( USHORT nSelIndex = 0 ) const; - USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const; + sal_uInt16 GetSelectEntryCount() const; + String GetSelectEntry( sal_uInt16 nSelIndex=0 ) const; + sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex=0 ) const; - void SetSelectHdl( Link const& rLink ); - void SetClickHdl( Link const& rLink ); + void SetSelectHdl (Link const& link); + Link& GetSelectHdl (); + + void SetClickHdl (Link const& link); + Link& GetClickHdl (); + + void SetDoubleClickHdl (Link const& link); + Link& GetDoubleClickHdl (); + + void SetEntryData (sal_uInt16 pos, void* data); + void* GetEntryData (sal_uInt16 pos) const; + + virtual void SetNoSelection (); +}; + +class MultiListBoxImpl; +class TOOLKIT_DLLPUBLIC MultiListBox : public ListBox +{ + DECL_GET_IMPL( MultiListBox ); + DECL_CONSTRUCTORS( MultiListBox, ListBox, 0 ); + DECL_GET_WINDOW( MultiListBox ); }; class DialogImpl; class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window { - DECL_GET_IMPL( Dialog ); - void SetParent( Window *pParent ); - void SetParent( ::Window *pParent ); + DECL_GET_WINDOW (Dialog); + +public: + DECL_GET_IMPL (Dialog); + Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); + Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); + ~Dialog (); + virtual short Execute(); + void EndDialog( long nResult=0 ); + void SetText( rtl::OUString const& rStr ); + void SetTitle (rtl::OUString const& rStr ); + bool Close (); + long Notify (NotifyEvent & event); + + // Sxf*Dialog + bool bConstruct; + void Initialize (SfxChildWinInfo*); +}; + +#define DECL_MESSAGE_BOX_CTORS(Name)\ + public:\ + Name##Box (::Window *parent, char const* message,\ + char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\ + char const* xml_file="message-box.xml", char const* id="message-box");\ + Name##Box (::Window *parent, rtl::OUString const& message,\ + rtl::OUString yes=String (),\ + rtl::OUString no=String (),\ + sal_uIntPtr help_id=0,\ + char const* xml_file="message-box.xml", char const* id="message-box");\ + Name##Box (::Window *parent, WinBits, char const* message,\ + char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\ + char const* xml_file="message-box.xml", char const* id="message-box");\ + Name##Box (::Window *parent, WinBits, rtl::OUString const& message,\ + rtl::OUString yes=String (),\ + rtl::OUString no=String (),\ + sal_uIntPtr help_id=0,\ + char const* xml_file="message-box.xml", char const* id="message-box")\ + +class TOOLKIT_DLLPUBLIC MessageBox : public Dialog +{ + DECL_MESSAGE_BOX_CTORS(Message); + +protected: + FixedImage imageError; + FixedImage imageInfo; + FixedImage imageQuery; + FixedImage imageWarning; + FixedText messageText; + CancelButton cancelButton; + HelpButton helpButton; + IgnoreButton ignoreButton; + NoButton noButton; + RetryButton retryButton; + YesButton yesButton; + + void bits_init (WinBits bits, rtl::OUString const& message, + rtl::OUString yes, rtl::OUString, sal_uIntPtr help_id); + void init (rtl::OUString const& message, + rtl::OUString const& yes, rtl::OUString const& no, sal_uIntPtr help_id); + void init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id); +}; + +#define CLASS_MESSAGE_BOX(Name)\ + class TOOLKIT_DLLPUBLIC Name##Box : public MessageBox\ + {\ + DECL_MESSAGE_BOX_CTORS (Name);\ + } + +//CLASS_MESSAGE_BOX (Mess); +typedef MessageBox MessBox; +CLASS_MESSAGE_BOX (Error); +CLASS_MESSAGE_BOX (Info); +CLASS_MESSAGE_BOX (Query); +CLASS_MESSAGE_BOX (Warning); + +#undef CLASS_MESSAGE_BOX + +#undef TAB_APPEND + +class TabControlImpl; +class TOOLKIT_DLLPUBLIC TabControl : public Control +{ +//#ifndef TAB_APPEND +#define TAB_APPEND 0xFFFF +//#endif /* !TAB_APPEND */ + + DECL_GET_IMPL (TabControl); + DECL_CONSTRUCTORS (TabControl, Control, 0); + DECL_GET_WINDOW (TabControl); + DECL_GET_LAYOUT_VCLXWINDOW (TabControl); + +public: + ~TabControl (); + void InsertPage (sal_uInt16 id, rtl::OUString const& title, sal_uInt16 pos=TAB_APPEND); + void RemovePage (sal_uInt16 id); + sal_uInt16 GetPageCount () const; + sal_uInt16 GetPageId (sal_uInt16 pos) const; + sal_uInt16 GetPagePos (sal_uInt16 id) const; + void SetCurPageId (sal_uInt16 id); + sal_uInt16 GetCurPageId () const; + void SetTabPage (sal_uInt16 id, ::TabPage* page); + ::TabPage* GetTabPage (sal_uInt16 id) const; + void SetActivatePageHdl (Link const& link); + Link& GetActivatePageHdl () const; + void SetDeactivatePageHdl (Link const& link); + Link& GetDeactivatePageHdl () const; + void SetTabPageSizePixel (Size const& size); + Size GetTabPageSizePixel () const; +}; + +class TabPageImpl; +class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window +{ + DECL_GET_IMPL( TabPage ); public: - Dialog( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 ); - Dialog( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 ); - short Execute(); - void EndDialog( long nResult = 0 ); - void SetText( String const& rStr ); + static ::Window* global_parent; + static TabControl* global_tabcontrol; + + TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); + TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); + ~TabPage(); + DECL_GET_WINDOW( TabPage ); + virtual void ActivatePage(); + virtual void DeactivatePage(); }; class ProgressBarImpl; @@ -450,7 +713,7 @@ protected: css::uno::Reference< css::awt::XLayoutContainer > mxContainer; Container( rtl::OUString const& rName, sal_Int32 nBorder ); public: - Container( Context const* pCtx, char const* pId ); + Container( Context const* context, char const* id ); void Add( Window *pWindow ); void Add( Container *pContainer ); @@ -474,11 +737,11 @@ class TOOLKIT_DLLPUBLIC Table : public Container protected: Table( sal_Int32 nBorder, sal_Int32 nColumns ); public: - Table( Context const* pCtx, char const* pId ); + Table( Context const* context, char const* id ); void Add( Window *pWindow, bool bXExpand, bool bYExpand, - sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 ); + sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 ); void Add( Container *pContainer, bool bXExpand, bool bYExpand, - sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 ); + sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 ); private: void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild, @@ -490,7 +753,7 @@ class TOOLKIT_DLLPUBLIC Box : public Container protected: Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous ); public: - Box( Context const* pCtx, char const* pId ); + Box( Context const* context, char const* id ); void Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding); void Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding); @@ -502,16 +765,69 @@ private: class TOOLKIT_DLLPUBLIC HBox : public Box { public: - HBox( Context const* pCtx, char const* pId ); + HBox( Context const* context, char const* id ); HBox( sal_Int32 nBorder, bool bHomogeneous ); }; class TOOLKIT_DLLPUBLIC VBox : public Box { public: - VBox( Context const* pCtx, char const* pId ); + VBox( Context const* context, char const* id ); VBox( sal_Int32 nBorder, bool bHomogeneous ); }; +class PluginImpl; +class TOOLKIT_DLLPUBLIC Plugin : public Control +{ + DECL_GET_IMPL( Plugin ); + //DECL_CONSTRUCTORS( Plugin, Control, 0 ); +public: + ::Control *mpPlugin; + Plugin( Context *context, char const* id, ::Control *plugin ); +}; + +class LocalizedStringImpl; +class TOOLKIT_DLLPUBLIC LocalizedString : public Window +{ + DECL_GET_IMPL( LocalizedString ); + +public: + LocalizedString( Context *context, char const* id ); + + rtl::OUString operator= (rtl::OUString const&); + rtl::OUString operator+= (sal_Unicode ); + rtl::OUString operator+= (rtl::OUString const&); + + operator rtl::OUString (); + operator rtl::OUString const& (); + operator String(); + String getString (); + rtl::OUString getOUString (); + String GetToken (USHORT i, sal_Char c); +}; + +class InPlugImpl; +class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window +{ + DECL_GET_IMPL (InPlug); + +public: + InPlug ( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0); + InPlug ( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0); + + void ParentSet (Window *window); +}; + } // end namespace layout +#if ENABLE_LAYOUT +#define LAYOUT_NS layout:: +#define LAYOUT_DIALOG_PARENT\ + VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow() +#define LAYOUT_THIS_WINDOW( this ) this->GetWindow () +#else /* !ENABLE_LAYOUT */ +#define LAYOUT_NS +#define LAYOUT_DIALOG_PARENT this +#define LAYOUT_THIS_WINDOW( this ) this +#endif /* !ENABLE_LAYOUT */ + #endif /* _LAYOUT_HXX */ diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index d131a0d5199a..3e61a9e9aa87 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -181,6 +181,7 @@ protected: public: VCLXButton(); + ~VCLXButton(); // ::com::sun::star::lang::XComponent void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); @@ -346,6 +347,8 @@ public: static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getFirstActionListener (); }; // ---------------------------------------------------- @@ -764,6 +767,7 @@ protected: public: VCLXComboBox(); + ~VCLXComboBox(); // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst index 8b7ac22bd209..7fa0efaded53 100644 --- a/toolkit/prj/build.lst +++ b/toolkit/prj/build.lst @@ -2,10 +2,11 @@ ti toolkit : vcl NULL ti toolkit usr1 - all ti_mkout NULL ti toolkit\prj get - all ti_prj NULL ti toolkit\inc nmake - all ti_inc NULL +ti toolkit\uiconfig\layout nmake - all ti_uiconfig_layout NULL ti toolkit\source\helper nmake - all ti_helper ti_inc NULL ti toolkit\source\awt nmake - all ti_awt ti_inc NULL ti toolkit\source\controls nmake - all ti_controls ti_inc NULL ti toolkit\source\controls\tree nmake - all ti_tree NULL -ti toolkit\source\layout nmake - all ti_layout NULL -ti toolkit\source\vclcompat nmake - all ti_vclcompat NULL -ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout ti_helper ti_tree ti_vclcompat NULL +ti toolkit\source\layout\core nmake - all ti_layout_core NULL +ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL +ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_layout_vcl NULL diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst index b73e85a59441..0c62a083b330 100644 --- a/toolkit/prj/d.lst +++ b/toolkit/prj/d.lst @@ -22,7 +22,9 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\controls ..\inc\toolkit\awt\vclxdevice.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdevice.hxx ..\inc\toolkit\awt\vclxfont.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxfont.hxx ..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx +..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx ..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx +..\source\awt\vclxdialog.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdialog.hxx ..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx ..\inc\toolkit\awt\vclxmenu.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxmenu.hxx @@ -53,3 +55,9 @@ mkdir: %_DEST%\inc%_EXT%\layout ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\inc\layout\*.hxx %_DEST%\inc%_EXT%\layout\*.hxx +mkdir: %_DEST%\inc%_EXT%\layout\core +..\source\layout\core\*.hxx %_DEST%\inc%_EXT%\layout\core\*.hxx +mkdir: %_DEST%\inc%_EXT%\layout\vcl +..\source\layout\vcl\*.hxx %_DEST%\inc%_EXT%\layout\vcl\*.hxx + +..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* diff --git a/toolkit/source/awt/makefile.mk b/toolkit/source/awt/makefile.mk index c4525516ac7f..86953691ad27 100644 --- a/toolkit/source/awt/makefile.mk +++ b/toolkit/source/awt/makefile.mk @@ -43,9 +43,6 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -# FIXME: This is bad, hmkay -CFLAGS+= -I$(PRJ)/source - .IF "$(GUIBASE)"=="aqua" OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) @@ -75,9 +72,11 @@ SLOFILES= \ $(SLO)/vclxbutton.obj\ $(SLO)/vclxdialog.obj\ $(SLO)/vclxfixedline.obj\ + $(SLO)/vclxplugin.obj\ $(SLO)/vclxscroller.obj\ $(SLO)/vclxsplitter.obj\ - $(SLO)/vclxtabcontrol.obj + $(SLO)/vclxtabcontrol.obj\ + $(SLO)/vclxtabpage.obj SRS1NAME=$(TARGET) SRC1FILES=\ diff --git a/toolkit/source/awt/vclxbutton.cxx b/toolkit/source/awt/vclxbutton.cxx index 2e16100e6d11..2665c5e1e44d 100644 --- a/toolkit/source/awt/vclxbutton.cxx +++ b/toolkit/source/awt/vclxbutton.cxx @@ -31,7 +31,7 @@ #include "vclxbutton.hxx" -#include "layout/layoutcore.hxx" +#include <layout/core/helper.hxx> #include <com/sun/star/awt/ImagePosition.hpp> #include <vcl/button.hxx> diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx index 26cff37e8e2b..74a3e000a9b0 100644 --- a/toolkit/source/awt/vclxdialog.cxx +++ b/toolkit/source/awt/vclxdialog.cxx @@ -211,6 +211,15 @@ void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star pWindow->SetText( Title ); } +void VCLXDialog::setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetHelpId( id ); +} + ::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx index b4245a7b6e65..65d4c5d42130 100644 --- a/toolkit/source/awt/vclxdialog.hxx +++ b/toolkit/source/awt/vclxdialog.hxx @@ -36,7 +36,7 @@ #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <comphelper/uno3.hxx> -#include <layout/bin.hxx> +#include <layout/core/bin.hxx> #include <toolkit/awt/vclxtopwindow.hxx> namespace layoutimpl @@ -44,10 +44,10 @@ namespace layoutimpl typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XDialog2 > VCLXDialog_Base; -class VCLXDialog :public VCLXWindow - ,public VCLXTopWindow_Base - ,public VCLXDialog_Base - ,public Bin +class TOOLKIT_DLLPUBLIC VCLXDialog : public VCLXWindow + , public VCLXTopWindow_Base + , public VCLXDialog_Base + , public Bin { private: bool bRealized, bResizeSafeguard; @@ -102,6 +102,7 @@ public: // ::com::sun::star::awt::XDialog2 void SAL_CALL endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException); }; diff --git a/toolkit/source/awt/vclxplugin.cxx b/toolkit/source/awt/vclxplugin.cxx new file mode 100644 index 000000000000..4ad306d31e70 --- /dev/null +++ b/toolkit/source/awt/vclxplugin.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#include "vclxplugin.hxx" + +#include <com/sun/star/awt/PosSize.hpp> +#include <toolkit/helper/convert.hxx> +#include <toolkit/helper/property.hxx> +#include <vcl/ctrl.hxx> + +#include "forward.hxx" + +namespace layoutimpl +{ + +using namespace ::com::sun::star; + +VCLXPlugin::VCLXPlugin( Window *p, WinBits b ) + : VCLXWindow() + , mpWindow( p ) + , mpPlugin( 0 ) + , mStyle( b ) +{ +} + +VCLXPlugin::~VCLXPlugin() +{ +} + +void SAL_CALL VCLXPlugin::dispose() throw(uno::RuntimeException) +{ + { + ::vos::OGuard aGuard( GetMutex() ); + + lang::EventObject aDisposeEvent; + aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); + } + + VCLXWindow::dispose(); +} + +void VCLXPlugin::SetPlugin( ::Control *p ) +{ + mpPlugin = p; +} + +awt::Size SAL_CALL VCLXPlugin::getMinimumSize() + throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OClearableGuard aGuard( GetMutex() ); + if ( mpPlugin ) + return AWTSize( mpPlugin->GetSizePixel() ); + return awt::Size(); +} + +} // namespace layoutimpl diff --git a/toolkit/source/awt/vclxplugin.hxx b/toolkit/source/awt/vclxplugin.hxx new file mode 100644 index 000000000000..b6a7f04b56f6 --- /dev/null +++ b/toolkit/source/awt/vclxplugin.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#ifndef LAYOUT_AWT_VCLXPLUGIN_HXX +#define LAYOUT_AWT_VCLXPLUGIN_HXX + +#include <toolkit/awt/vclxwindow.hxx> +#include <vcl/wintypes.hxx> + +class Control; +namespace layoutimpl +{ + +namespace css = ::com::sun::star; + +class VCLXPlugin : public VCLXWindow +{ +public: + Window *mpWindow; + ::Control *mpPlugin; + WinBits mStyle; + + VCLXPlugin( Window *p, WinBits b ); + + void SetPlugin( ::Control *p ); + +protected: + ~VCLXPlugin(); + + // XComponent + void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() + throw(::com::sun::star::uno::RuntimeException); + +private: + VCLXPlugin( VCLXPlugin const & ); + VCLXPlugin& operator=( VCLXPlugin const & ); +}; + +} // namespace layoutimpl + +#endif /* LAYOUT_AWT_VCLXPLUGIN_HXX */ diff --git a/toolkit/source/awt/vclxscroller.hxx b/toolkit/source/awt/vclxscroller.hxx index 02f8829a5ccf..745e4d5588d7 100644 --- a/toolkit/source/awt/vclxscroller.hxx +++ b/toolkit/source/awt/vclxscroller.hxx @@ -33,7 +33,7 @@ #define LAYOUT_AWT_VCLXSCROLLER_HXX #include <comphelper/uno3.hxx> -#include <layout/bin.hxx> +#include <layout/core/bin.hxx> #include <toolkit/awt/vclxwindow.hxx> class ScrollBar; diff --git a/toolkit/source/awt/vclxsplitter.cxx b/toolkit/source/awt/vclxsplitter.cxx index b38ed4baf38a..33c1beb6ed41 100644 --- a/toolkit/source/awt/vclxsplitter.cxx +++ b/toolkit/source/awt/vclxsplitter.cxx @@ -78,8 +78,8 @@ VCLXSplitter::createChildProps( Box_Base::ChildData *pData ) DBG_NAME( VCLXSplitter ); VCLXSplitter::VCLXSplitter( bool bHorizontal ) - : VCLXWindow() - , Box_Base() + : VCLXWindow() + , Box_Base() { DBG_CTOR( VCLXSplitter, NULL ); mnHandleRatio = 0.5; diff --git a/toolkit/source/awt/vclxsplitter.hxx b/toolkit/source/awt/vclxsplitter.hxx index 5ecb7e0cde3b..8ed5d572e030 100644 --- a/toolkit/source/awt/vclxsplitter.hxx +++ b/toolkit/source/awt/vclxsplitter.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/awt/MaxChildrenException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper/uno3.hxx> -#include <layout/box-base.hxx> +#include <layout/core/box-base.hxx> #include <toolkit/awt/vclxwindow.hxx> class Splitter; diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx index 0097c6a0a73a..908554c9ae0c 100644 --- a/toolkit/source/awt/vclxtabcontrol.cxx +++ b/toolkit/source/awt/vclxtabcontrol.cxx @@ -43,8 +43,6 @@ namespace layoutimpl { -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star; @@ -76,12 +74,20 @@ VCLXTabControl::createChildProps( Box_Base::ChildData *pData ) DBG_NAME( VCLXTabControl ); +#if !defined (__GNUC__) +#define __PRETTY_FUNCTION__ __FUNCTION__ +#endif /* !__GNUC__ */ + VCLXTabControl::VCLXTabControl() : VCLXWindow() , VCLXTabControl_Base() , Box_Base() - , mnNextTabId( 1 ) + , mTabId (1) + , bRealized (false) { +#ifndef __SUNPRO_CC + OSL_TRACE ("\n********%s:%x", __PRETTY_FUNCTION__, this); +#endif DBG_CTOR( VCLXTabControl, NULL ); } @@ -94,7 +100,7 @@ IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXTabControl, VCLXWindow, Container, VCLXTabC IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXTabControl, VCLXWindow, VCLXTabControl_Base ); -void SAL_CALL VCLXTabControl::dispose( ) throw(RuntimeException) +void SAL_CALL VCLXTabControl::dispose( ) throw(uno::RuntimeException) { { ::vos::OGuard aGuard( GetMutex() ); @@ -108,38 +114,38 @@ void SAL_CALL VCLXTabControl::dispose( ) throw(RuntimeException) } #if 0 -void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException) +void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException) { if ( listener.is() ) maTabListeners.addInterface( listener ); } -void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException) +void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException) { if ( listener.is() ) maTabListeners.removeInterface( listener ); } #endif -TabControl *VCLXTabControl::getTabControl() const throw (RuntimeException) +TabControl *VCLXTabControl::getTabControl() const throw (uno::RuntimeException) { TabControl *pTabControl = static_cast< TabControl* >( GetWindow() ); if ( pTabControl ) return pTabControl; - throw RuntimeException(); + throw uno::RuntimeException(); } -sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (RuntimeException) +sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (uno::RuntimeException) { TabControl *pTabControl = getTabControl(); - USHORT id = sal::static_int_cast< USHORT >( mnNextTabId++ ); + USHORT id = sal::static_int_cast< USHORT >( mTabId++ ); rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) ); pTabControl->InsertPage( id, title.getStr(), TAB_APPEND ); pTabControl->SetTabPage( id, new TabPage( pTabControl ) ); return id; } -void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException) +void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException) { TabControl *pTabControl = getTabControl(); if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL ) @@ -147,7 +153,7 @@ void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (RuntimeException, pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) ); } -void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException) +void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException) { TabControl *pTabControl = getTabControl(); if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL ) @@ -155,15 +161,15 @@ void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (RuntimeExceptio pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) ); } -sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (RuntimeException) +sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (uno::RuntimeException) { return getTabControl()->GetCurPageId( ); } -void SAL_CALL VCLXTabControl::addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabControl::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) { - for ( std::list< ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XTabListener > >::const_iterator it + for ( std::list< uno::Reference + < awt::XTabListener > >::const_iterator it = mxTabListeners.begin(); it != mxTabListeners.end(); it++ ) { if ( *it == xListener ) @@ -173,10 +179,10 @@ void SAL_CALL VCLXTabControl::addTabListener( const ::com::sun::star::uno::Refer mxTabListeners.push_back( xListener ); } -void SAL_CALL VCLXTabControl::removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabControl::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException) { - for ( std::list< ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XTabListener > >::iterator it + for ( std::list< uno::Reference + < awt::XTabListener > >::iterator it = mxTabListeners.begin(); it != mxTabListeners.end(); it++ ) { if ( *it == xListener ) @@ -187,7 +193,7 @@ void SAL_CALL VCLXTabControl::removeTabListener( const ::com::sun::star::uno::Re } } -void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (RuntimeException, IndexOutOfBoundsException) +void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const uno::Sequence< NamedValue >& Properties ) throw (uno::RuntimeException, IndexOutOfBoundsException) { TabControl *pTabControl = getTabControl(); if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL ) @@ -196,7 +202,7 @@ void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedVa for ( int i = 0; i < Properties.getLength(); i++ ) { const rtl::OUString &name = Properties[i].Name; - const Any &value = Properties[i].Value; + const uno::Any &value = Properties[i].Value; if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) ) { @@ -206,8 +212,8 @@ void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedVa } } -Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID ) - throw (IndexOutOfBoundsException, RuntimeException) +uno::Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID ) + throw (IndexOutOfBoundsException, uno::RuntimeException) { TabControl *pTabControl = getTabControl(); if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL ) @@ -216,11 +222,11 @@ Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID ) #define ADD_PROP( seq, i, name, val ) { \ NamedValue value; \ value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \ - value.Value = makeAny( val ); \ + value.Value = uno::makeAny( val ); \ seq[i] = value; \ } - Sequence< NamedValue > props( 2 ); + uno::Sequence< NamedValue > props( 2 ); ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) ); ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) ); #undef ADD_PROP @@ -228,7 +234,7 @@ Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID ) } // TODO: draw tab border here -void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -249,16 +255,29 @@ void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::su VCLXWindow::draw( nX, nY ); } +void VCLXTabControl::AddChild (uno::Reference< awt::XLayoutConstrains > const& xChild) + +{ +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ()); +#endif + mIdMap[ xChild ] = mTabId++; + Box_Base::AddChild( xChild ); +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ()); +#endif +} + void SAL_CALL VCLXTabControl::addChild( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild ) - throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException) + const uno::Reference< awt::XLayoutConstrains > &xChild ) + throw (uno::RuntimeException, awt::MaxChildrenException) { mIdMap[ xChild ] = insertTab(); Box_Base::addChild( xChild ); } -void SAL_CALL VCLXTabControl::removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild ) - throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabControl::removeChild( const uno::Reference< awt::XLayoutConstrains > &xChild ) + throw (uno::RuntimeException) { removeTab( mIdMap[xChild] ); mIdMap[ xChild ] = -1; @@ -284,21 +303,90 @@ static void setChildrenVisible( uno::Reference < awt::XLayoutConstrains > xChild } } -void SAL_CALL VCLXTabControl::allocateArea( - const ::com::sun::star::awt::Rectangle &rArea ) - throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabControl::allocateArea (awt::Rectangle const &area) + throw (uno::RuntimeException) { - maAllocation = rArea; +#ifndef __SUNPRO_CC + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); +#endif + maAllocation = area; TabControl *pTabControl = getTabControl(); -// FIXME: this is wrong. We just want to set tab controls pos/size for the tabs menu, -// otherwise, it gets events that should go to children (I guess we could solve this -// by making the tabcontrol as the actual XWindow parent of its children, when importing...) -// Not sure about TabPage drawing... That doesn't work on gtk+; just ignoring that. -// LATER: Nah, the proper fix is to get the XWindow hierarchy straight. +// FIXME: this is wrong. We just want to set tab controls pos/size for +// the tabs menu, otherwise, it gets events that should go to children +// (I guess we could solve this by making the tabcontrol as the actual +// XWindow parent of its children, when importing...) Not sure about +// TabPage drawing... That doesn't work on gtk+; just ignoring that. +// LATER: Nah, the proper fix is to get the XWindow hierarchy +// straight. + +#if 0 + setPosSize( area.X, area.Y, area.Width, area.Height, awt::PosSize::POSSIZE ); +#else + awt::Size currentSize = getSize(); + awt::Size requestedSize (area.Width, area.Height); +// requestedSize.Height = getHeightForWidth( area.Width ); + + awt::Size minimumSize = getMinimumSize(); + if (requestedSize.Width < minimumSize.Width) + requestedSize.Width = minimumSize.Width; + if (requestedSize.Height < minimumSize.Height) + requestedSize.Height = minimumSize.Height; + + Size pageSize = static_cast<TabControl*> (GetWindow ())->GetTabPageSizePixel (); + awt::Size pageBasedSize (0, 0); + pageBasedSize.Width = pageSize.Width (); + pageBasedSize.Height = pageSize.Height (); + + const int wc = 0; + const int hc = 20; + static int pwc = 0; + static int phc = 40; + + if (requestedSize.Width < pageBasedSize.Width) + requestedSize.Width = pageBasedSize.Width + wc; + if (requestedSize.Height < pageBasedSize.Height) + requestedSize.Height = pageBasedSize.Height + hc; + + Size windowSize = GetWindow()->GetSizePixel(); + Window *parent = GetWindow()->GetParent(); + Size parentSize = parent->GetSizePixel(); + +#ifndef __SUNPRO_CC +#ifdef GCC_MAJOR + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); +#endif /* GCC_MAJOR */ + OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height ); + OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height ); + OSL_TRACE ("%s: minimum: %d, %d", __FUNCTION__, minimumSize.Width, minimumSize.Height ); + OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height ); + OSL_TRACE ("%s: pageBasedSize: %d, %d", __FUNCTION__, pageBasedSize.Width, pageBasedSize.Height ); + + //OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() ); + //OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() ); +#endif + + //bRealized = false; + if (!bRealized) + { + setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::POSSIZE ); + bRealized = true; + } + else + { + if ( requestedSize.Width > currentSize.Width + 10) + setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH ); + if ( requestedSize.Height > currentSize.Height + 10) + setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT ); + } +#endif - setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE ); + if (pageBasedSize.Width > parentSize.Width () + || pageBasedSize.Height > parentSize.Height ()) + //parent->SetSizePixel ( Size (pageBasedSize.Width, pageBasedSize.Height)); + //parent->SetSizePixel ( Size (pageBasedSize.Width + pwc, pageBasedSize.Height + phc)); + parent->SetSizePixel ( Size (requestedSize.Width + pwc, requestedSize.Height + phc)); // FIXME: we can save cycles by setting visibility more sensibly. Having // it here does makes it easier when changing tabs (just needs a recalc()) @@ -307,8 +395,8 @@ void SAL_CALL VCLXTabControl::allocateArea( = maChildren.begin(); it != maChildren.end(); it++, i++ ) { ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it ); - ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XLayoutConstrains > xChild( child->mxChild ); + uno::Reference + < awt::XLayoutConstrains > xChild( child->mxChild ); if ( xChild.is() ) { uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY ); @@ -340,15 +428,15 @@ void SAL_CALL VCLXTabControl::allocateArea( } } -::com::sun::star::awt::Size SAL_CALL VCLXTabControl::getMinimumSize() - throw(::com::sun::star::uno::RuntimeException) +awt::Size SAL_CALL VCLXTabControl::getMinimumSize() + throw(uno::RuntimeException) { - awt::Size size = VCLXWindow::getMinimumSize(); + awt::Size requestedSize = VCLXWindow::getMinimumSize(); awt::Size childrenSize( 0, 0 ); TabControl* pTabControl = static_cast< TabControl* >( GetWindow() ); if ( !pTabControl ) - return size; + return requestedSize; // calculate size to accomodate all children unsigned i = 0; @@ -367,10 +455,19 @@ void SAL_CALL VCLXTabControl::allocateArea( } } - size.Width += childrenSize.Width; - size.Height += childrenSize.Height + 20; - maRequisition = size; - return size; +#ifndef __SUNPRO_CC +#ifdef GCC_MAJOR + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); +#endif /* GCC_MAJOR */ + OSL_TRACE ("%s: children: %d", __FUNCTION__, i); + OSL_TRACE ("%s: childrenSize: %d, %d", __FUNCTION__, childrenSize.Width, childrenSize.Height ); +#endif + + requestedSize.Width += childrenSize.Width; + requestedSize.Height += childrenSize.Height + 20; + + maRequisition = requestedSize; + return requestedSize; } void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) @@ -391,12 +488,12 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent case VCLEVENT_TABPAGE_PAGETEXTCHANGED: { ULONG page = (ULONG) _rVclWindowEvent.GetData(); - for ( std::list< ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XTabListener > >::iterator it + for ( std::list< uno::Reference + < awt::XTabListener > >::iterator it = mxTabListeners.begin(); it != mxTabListeners.end(); it++) { - ::com::sun::star::uno::Reference - < ::com::sun::star::awt::XTabListener > listener = *it; + uno::Reference + < awt::XTabListener > listener = *it; switch ( _rVclWindowEvent.GetId() ) { @@ -414,7 +511,7 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent listener->removed( page ); break; case VCLEVENT_TABPAGE_REMOVEDALL: - for ( int i = 1; i < mnNextTabId; i++) + for ( int i = 1; i < mTabId; i++) { if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( i ) ) ) listener->removed( i ); @@ -434,12 +531,12 @@ void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent } } -void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException) +void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const uno::Any &Value ) throw(uno::RuntimeException) { VCLXWindow::setProperty( PropertyName, Value ); } -Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +uno::Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(uno::RuntimeException) { return VCLXWindow::getProperty( PropertyName ); } diff --git a/toolkit/source/awt/vclxtabcontrol.hxx b/toolkit/source/awt/vclxtabcontrol.hxx index 7db18b19a609..0db5d9707a3f 100644 --- a/toolkit/source/awt/vclxtabcontrol.hxx +++ b/toolkit/source/awt/vclxtabcontrol.hxx @@ -34,7 +34,7 @@ #include <com/sun/star/awt/XSimpleTabController.hpp> #include <comphelper/uno3.hxx> -#include <layout/box-base.hxx> +#include <layout/core/box-base.hxx> #include <map> #include <toolkit/awt/vclxwindow.hxx> @@ -50,9 +50,14 @@ class VCLXTabControl :public VCLXWindow ,public VCLXTabControl_Base ,public Box_Base { + int mTabId; + bool bRealized; + public: VCLXTabControl(); + void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &); + protected: ~VCLXTabControl(); @@ -65,7 +70,7 @@ protected: // XComponent void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException); // XSimpleTabController virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); @@ -108,10 +113,6 @@ protected: // VCLXWindow void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - - // Each tab page needs an unique id. - int mnNextTabId; - public: // Maps page ids to child references struct ChildData : public Box_Base::ChildData diff --git a/toolkit/source/awt/vclxtabpage.cxx b/toolkit/source/awt/vclxtabpage.cxx new file mode 100644 index 000000000000..0b7bbd008a86 --- /dev/null +++ b/toolkit/source/awt/vclxtabpage.cxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#include "vclxtabpage.hxx" +#include "forward.hxx" + +#include <com/sun/star/awt/PosSize.hpp> +#include <toolkit/helper/convert.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/tabctrl.hxx> + +#if !defined (__GNUC__) +#define __PRETTY_FUNCTION__ __FUNCTION__ +#endif /* !__GNUC__ */ + +namespace layoutimpl +{ + +using namespace ::com::sun::star; + +// XInterface +IMPLEMENT_FORWARD_XINTERFACE2( VCLXTabPage, VCLXWindow, Bin ); + +// XTypeProvider +IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXTabPage, VCLXWindow ); + +VCLXTabPage::VCLXTabPage( Window *p ) + : VCLXWindow() + , Bin() + , bRealized( false ) +{ + /* FIXME: before Window is set, setLabel, setProperty->setImage + * are silent no-ops. */ + p->SetComponentInterface( this ); +} + +VCLXTabPage::~VCLXTabPage() +{ +} + +void SAL_CALL VCLXTabPage::dispose() throw(uno::RuntimeException) +{ + { + ::vos::OGuard aGuard( GetMutex() ); + + lang::EventObject aDisposeEvent; + aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this); + } + + VCLXWindow::dispose(); +} + +void SAL_CALL VCLXTabPage::allocateArea( awt::Rectangle const& area ) + throw (uno::RuntimeException) +{ + awt::Size currentSize = getSize(); + awt::Size requestedSize = getMinimumSize(); + requestedSize.Height = getHeightForWidth( area.Width ); + + if ( currentSize.Width > 0 && currentSize.Height > 0 + && requestedSize.Width > currentSize.Width ) + requestedSize.Width = currentSize.Width; + if ( currentSize.Width > 0 && currentSize.Height > 0 + && requestedSize.Height > currentSize.Height ) + requestedSize.Height = currentSize.Height; + + // FIXME: missing destructor? + if ( !GetWindow() ) + return; + + Size windowSize = GetWindow()->GetSizePixel(); + Window *parent = GetWindow()->GetParent(); + Size parentSize = parent->GetSizePixel(); + + Point pos = GetWindow()->GetPosPixel(); +#ifndef __SUNPRO_CC + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__); + OSL_TRACE ("%s: curpos: %d ,%d", __FUNCTION__, pos.X(), pos.Y() ); + + OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height ); + OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height ); + OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height ); + OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() ); + OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() ); +#endif + +#if 0 + if (requestedSize.Width > parentSize.Width () + || requestedSize.Height > parentSize.Height ()) + { +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: ***setting parent: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height ); +#endif + parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) ); + + if (Window *grand_parent = parent->GetParent ()) + grand_parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) ); + } +#endif + + if ( !bRealized ) + { + setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::SIZE ); + bRealized = true; + } + else + { + if ( requestedSize.Width > currentSize.Width + 10) + setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH ); + if ( requestedSize.Height > currentSize.Height + 10) + setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT ); + } + + awt::Size newSize = getSize(); +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: newSize: %d, %d", __FUNCTION__, newSize.Width, newSize.Height ); +#endif + maAllocation.Width = newSize.Width; + maAllocation.Height = newSize.Height; + + Bin::allocateArea( maAllocation ); +} + +awt::Size SAL_CALL VCLXTabPage::getMinimumSize() + throw(uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + return Bin::getMinimumSize(); +} + +} // namespace layoutimpl diff --git a/toolkit/source/awt/vclxtabpage.hxx b/toolkit/source/awt/vclxtabpage.hxx new file mode 100644 index 000000000000..a31db2e69781 --- /dev/null +++ b/toolkit/source/awt/vclxtabpage.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#ifndef LAYOUT_AWT_VCLXTABPAGE_HXX +#define LAYOUT_AWT_VCLXTABPAGE_HXX + +#include <toolkit/awt/vclxwindow.hxx> +#include <layout/core/bin.hxx> +#include <comphelper/uno3.hxx> + +namespace layoutimpl +{ + +namespace css = ::com::sun::star; + +class VCLXTabPage : public VCLXWindow + , public Bin +{ + bool bRealized; + +public: + VCLXTabPage( Window *p ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + +protected: + ~VCLXTabPage(); + + // XComponent + void SAL_CALL dispose() throw(css::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutContainer + virtual void SAL_CALL allocateArea( css::awt::Rectangle const& rArea ) + throw (css::uno::RuntimeException); + virtual css::awt::Size SAL_CALL getMinimumSize() + throw(css::uno::RuntimeException); + +private: + VCLXTabPage( VCLXTabPage const & ); + VCLXTabPage& operator=( VCLXTabPage const & ); +}; + +} // namespace layoutimpl + +#endif /* LAYOUT_AWT_VCLXTABPAGE_HXX */ diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index dadb1300675a..59cb9632b7e1 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -417,6 +417,13 @@ VCLXButton::VCLXButton() { } +VCLXButton::~VCLXButton() +{ +#ifndef __SUNPRO_CC + OSL_TRACE ("%s", __FUNCTION__); +#endif +} + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext() { return getAccessibleFactory().createAccessibleContext( this ); @@ -1361,6 +1368,13 @@ void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled ) } } +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener () +{ + if (!maItemListeners.getLength ()) + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (); + return maActionListeners.getElements()[0]; +} + // ---------------------------------------------------- // class VCLXSpinField // ---------------------------------------------------- @@ -2175,6 +2189,9 @@ VCLXDialog::VCLXDialog() VCLXDialog::~VCLXDialog() { +#ifndef __SUNPRO_CC + OSL_TRACE ("%s", __FUNCTION__); +#endif } // ::com::sun::star::uno::XInterface @@ -3743,6 +3760,13 @@ VCLXComboBox::VCLXComboBox() { } +VCLXComboBox::~VCLXComboBox() +{ +#ifndef __SUNPRO_CC + OSL_TRACE ("%s", __FUNCTION__); +#endif +} + // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { diff --git a/toolkit/source/layout/bin.cxx b/toolkit/source/layout/core/bin.cxx index fa521ca91ca3..390c574c46c6 100644 --- a/toolkit/source/layout/bin.cxx +++ b/toolkit/source/layout/core/bin.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bin.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -165,6 +165,12 @@ Align::allocateArea( const awt::Rectangle &rArea ) allocateChildAt( mxChild, aChildArea ); } +bool +Align::emptyVisible () +{ + return true; +} + /* MinSize */ MinSize::MinSize() : Bin() @@ -178,6 +184,12 @@ MinSize::MinSize() : Bin() &mnMinHeight ); } +bool +MinSize::emptyVisible () +{ + return true; +} + awt::Size SAL_CALL MinSize::getMinimumSize() throw(uno::RuntimeException) { diff --git a/toolkit/source/layout/bin.hxx b/toolkit/source/layout/core/bin.hxx index fb3991869a6c..23d082076359 100644 --- a/toolkit/source/layout/bin.hxx +++ b/toolkit/source/layout/core/bin.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bin.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -31,10 +31,10 @@ /* A few simple binary containers */ -#ifndef CORE_BIN_HXX -#define CORE_BIN_HXX +#ifndef LAYOUT_CORE_BIN_HXX +#define LAYOUT_CORE_BIN_HXX -#include "container.hxx" +#include <layout/core/container.hxx> namespace layoutimpl { @@ -75,8 +75,6 @@ public: // css::awt::XLayoutConstrains virtual css::awt::Size SAL_CALL getMinimumSize() throw(css::uno::RuntimeException); - - PROPHELPER_SET_INFO }; // Align gives control over child position on the allocated space. @@ -91,11 +89,11 @@ protected: public: Align(); + bool emptyVisible (); + // css::awt::XLayoutContainer virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) throw (css::uno::RuntimeException); - - PROPHELPER_SET_INFO }; // Makes child request its or a specified size, whatever is larger. @@ -108,13 +106,12 @@ protected: public: MinSize(); + bool emptyVisible (); // css::awt::XLayoutContainer virtual css::awt::Size SAL_CALL getMinimumSize() throw(css::uno::RuntimeException); - - PROPHELPER_SET_INFO }; } // namespace layoutimpl -#endif /*CORE_BIN_HXX*/ +#endif /* LAYOUT_CORE_BIN_HXX */ diff --git a/toolkit/source/layout/box-base.cxx b/toolkit/source/layout/core/box-base.cxx index 7addc617a511..63cb49901ec4 100644 --- a/toolkit/source/layout/box-base.cxx +++ b/toolkit/source/layout/core/box-base.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: box-base.cxx,v $ + * $RCSfile$ * - * $Revision: 1.2 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -69,9 +69,9 @@ static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget ) uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren = xContainer->getChildren(); - // FIXME: <flow> workaround: empty visible containers always visible: - if ( !aChildren.getLength() ) - return true; + if (!aChildren.getLength ()) + if (Container *c = dynamic_cast <Container*> (xWidget.get ())) + return c->emptyVisible (); for ( int i = 0; i < aChildren.getLength(); i++ ) if ( isVisible( aChildren[i] ) ) @@ -88,16 +88,22 @@ bool Box_Base::ChildData::isVisible() return layoutimpl::isVisible( mxChild ); } +void +Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild) +{ + ChildData *pData = createChild (xChild); + maChildren.push_back (pData); + queueResize (); +} + void SAL_CALL -Box_Base::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) +Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild) throw (uno::RuntimeException, awt::MaxChildrenException) { - if ( xChild.is() ) + if (xChild.is ()) { - ChildData *pData = createChild( xChild ); - maChildren.push_back( pData ); - setChildParent( xChild ); - queueResize(); + AddChild (xChild); + setChildParent (xChild); } } diff --git a/toolkit/source/layout/box-base.hxx b/toolkit/source/layout/core/box-base.hxx index 208b8dd6a537..c4958a303540 100644 --- a/toolkit/source/layout/box-base.hxx +++ b/toolkit/source/layout/core/box-base.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: box-base.hxx,v $ + * $RCSfile$ * - * $Revision: 1.2 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,10 +29,10 @@ * ************************************************************************/ -#ifndef CORE_BOX_BASE_HXX -#define CORE_BOX_BASE_HXX +#ifndef LAYOUT_CORE_BOX_BASE_HXX +#define LAYOUT_CORE_BOX_BASE_HXX -#include "container.hxx" +#include <layout/core/container.hxx> #include <list> @@ -57,7 +57,6 @@ public: struct ChildProps: public PropHelper { //ChildProps( ChildProps* ); - PROPHELPER_SET_INFO }; protected: @@ -70,8 +69,10 @@ protected: ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child ); public: + void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child); + // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child) throw (css::uno::RuntimeException, css::awt::MaxChildrenException); virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) throw (css::uno::RuntimeException); @@ -87,4 +88,4 @@ public: } // namespace layoutimpl -#endif /* CORE_BOX__BASE HXX */ +#endif /* LAYOUT_CORE_BOX_BASE HXX */ diff --git a/toolkit/source/layout/box.cxx b/toolkit/source/layout/core/box.cxx index 6466ab9cd07d..254099d96411 100644 --- a/toolkit/source/layout/box.cxx +++ b/toolkit/source/layout/core/box.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: box.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -65,9 +65,9 @@ Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChil Box::ChildData* Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) -{ + { return new ChildData( xChild ); -} + } Box::ChildProps* Box::createChildProps( Box_Base::ChildData *pData ) diff --git a/toolkit/source/layout/box.hxx b/toolkit/source/layout/core/box.hxx index 2b09ede7f357..0c36ce335213 100644 --- a/toolkit/source/layout/box.hxx +++ b/toolkit/source/layout/core/box.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: box.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,10 +29,10 @@ * ************************************************************************/ -#ifndef CORE_BOX_HXX -#define CORE_BOX_HXX +#ifndef LAYOUT_CORE_BOX_HXX +#define LAYOUT_CORE_BOX_HXX -#include "box-base.hxx" +#include <layout/core/box-base.hxx> #include <com/sun/star/awt/Point.hpp> @@ -83,8 +83,6 @@ public: // helper: mix of getMinimumSize() and getHeightForWidth() css::awt::Size calculateSize( long nWidth = 0 ); - PROPHELPER_SET_INFO - private: /* Helpers to deal with the joint Box directions. */ inline int primDim (const css::awt::Size &size) @@ -105,4 +103,4 @@ struct HBox : public Box } // namespace layoutimpl -#endif /* CORE_BOX_HXX */ +#endif /* LAYOUT_CORE_BOX_HXX */ diff --git a/toolkit/source/layout/byteseq.cxx b/toolkit/source/layout/core/byteseq.cxx index a40807100c3b..ffa9852bd303 100644 --- a/toolkit/source/layout/byteseq.cxx +++ b/toolkit/source/layout/core/byteseq.cxx @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: byteseq.cxx,v $ - * $Revision: 1.4 $ + * $RCSfile$ + * $Revision$ * * This file is part of OpenOffice.org. * diff --git a/toolkit/source/layout/container.cxx b/toolkit/source/layout/core/container.cxx index af40af05e36d..5978ae7f04a4 100644 --- a/toolkit/source/layout/container.cxx +++ b/toolkit/source/layout/core/container.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: container.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -50,6 +50,12 @@ Container::Container() setChangeListener( this ); } +bool +Container::emptyVisible () +{ + return false; +} + uno::Any Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException) { diff --git a/toolkit/source/layout/container.hxx b/toolkit/source/layout/core/container.hxx index 70ec10c678d2..4dbd61cd398c 100644 --- a/toolkit/source/layout/container.hxx +++ b/toolkit/source/layout/core/container.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: container.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,10 +29,10 @@ * ************************************************************************/ -#ifndef CORE_CONTAINER_HXX -#define CORE_CONTAINER_HXX +#ifndef LAYOUT_CORE_CONTAINER_HXX +#define LAYOUT_CORE_CONTAINER_HXX -#include "helper.hxx" +#include <layout/core/helper.hxx> #include <cppuhelper/implbase2.hxx> #include <com/sun/star/awt/MaxChildrenException.hpp> @@ -44,7 +44,7 @@ namespace css = ::com::sun::star; typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer, css::awt::XLayoutConstrains > Container_Base; -class Container : public Container_Base, public PropHelper, public PropHelper::Listener +class TOOLKIT_DLLPUBLIC Container : public Container_Base, public PropHelper, public PropHelper::Listener { friend class ChildProps; protected: @@ -73,6 +73,8 @@ public: Container(); virtual ~Container() {} + virtual bool emptyVisible (); + // XInterface virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); } virtual void SAL_CALL release() throw() { PropHelper::release(); } @@ -129,12 +131,10 @@ public: css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) throw(css::uno::RuntimeException) { return rNewSize; } -PROPHELPER_SET_INFO - protected: void propertiesChanged(); }; } // namespace layoutimpl -#endif /*CORE_CONTAINER_HXX*/ +#endif /* LAYOUT_CORE_CONTAINER_HXX */ diff --git a/toolkit/source/layout/dialogbuttonhbox.cxx b/toolkit/source/layout/core/dialogbuttonhbox.cxx index 1337b79cce8c..9334ef688135 100644 --- a/toolkit/source/layout/dialogbuttonhbox.cxx +++ b/toolkit/source/layout/core/dialogbuttonhbox.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialogbuttonhbox.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -39,13 +39,12 @@ #include "proplist.hxx" #if TEST_LAYOUT && !defined( DBG_UTIL ) -#include <stdio.h> #undef DBG_ERROR -#define DBG_ERROR printf +#define DBG_ERROR OSL_TRACE #undef DBG_ERROR1 -#define DBG_ERROR1 printf +#define DBG_ERROR1 OSL_TRACE #undef DBG_ERROR2 -#define DBG_ERROR2 printf +#define DBG_ERROR2 OSL_TRACE #endif /* TEST_LAYOUT && !DBG_UTIL */ namespace layoutimpl diff --git a/toolkit/source/layout/dialogbuttonhbox.hxx b/toolkit/source/layout/core/dialogbuttonhbox.hxx index 23ea3b2c9c00..26bab6d0602c 100644 --- a/toolkit/source/layout/dialogbuttonhbox.hxx +++ b/toolkit/source/layout/core/dialogbuttonhbox.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialogbuttonhbox.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,11 +29,11 @@ * ************************************************************************/ -#ifndef CORE_DIALOGBUTTONHBOX_HXX -#define CORE_DIALOGBUTTONHBOX_HXX +#ifndef LAYOUT_CORE_DIALOGBUTTONHBOX_HXX +#define LAYOUT_CORE_DIALOGBUTTONHBOX_HXX -#include "box.hxx" -#include "flow.hxx" +#include <layout/core/box.hxx> +#include <layout/core/flow.hxx> namespace layoutimpl { @@ -74,4 +74,4 @@ private: } // namespace layoutimpl -#endif /* CORE_DIALOGBUTTONHBOX_HXX */ +#endif /* LAYOUT_CORE_DIALOGBUTTONHBOX_HXX */ diff --git a/toolkit/source/layout/factory.cxx b/toolkit/source/layout/core/factory.cxx index 0e5ce93756f4..3462ba51648d 100644 --- a/toolkit/source/layout/factory.cxx +++ b/toolkit/source/layout/core/factory.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: factory.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -41,52 +41,52 @@ using namespace ::com::sun::star; using namespace layoutimpl; void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ ) -{ - void * pRet = 0; + { + void * pRet = 0; - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); - uno::Reference< lang::XSingleServiceFactory > xFactory; + ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); + uno::Reference< lang::XSingleServiceFactory > xFactory; - if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) ) - xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ), - LayoutFactory::impl_staticGetImplementationName(), - LayoutFactory::impl_staticCreateSelfInstance, - LayoutFactory::impl_staticGetSupportedServiceNames() ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } + if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) ) + xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ), + LayoutFactory::impl_staticGetImplementationName(), + LayoutFactory::impl_staticCreateSelfInstance, + LayoutFactory::impl_staticGetSupportedServiceNames() ); + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } - return pRet; -} + return pRet; + } sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * /*serviceManager*/, void * pRegistryKey ) -{ - if ( pRegistryKey ) { - try + if ( pRegistryKey ) { - uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ); - uno::Reference< registry::XRegistryKey > xNewKey; - - xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + - LayoutFactory::impl_staticGetImplementationName() + - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - - const uno::Sequence< ::rtl::OUString > aServices = LayoutFactory::impl_staticGetSupportedServiceNames(); - for ( sal_Int32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i] ); - - return sal_True; - } - catch (registry::InvalidRegistryException &) + try + { + uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ); + uno::Reference< registry::XRegistryKey > xNewKey; + + xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + + LayoutFactory::impl_staticGetImplementationName() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); + + const uno::Sequence< ::rtl::OUString > aServices = LayoutFactory::impl_staticGetSupportedServiceNames(); + for ( sal_Int32 i = 0; i < aServices.getLength(); i++ ) + xNewKey->createKey( aServices.getConstArray()[i] ); + + return sal_True; + } + catch (registry::InvalidRegistryException &) { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); } + } + return sal_False; } - return sal_False; -} // Component registration ::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName() diff --git a/toolkit/source/layout/factory.hxx b/toolkit/source/layout/core/factory.hxx index 6c7162475e6d..3715b1f7efcb 100644 --- a/toolkit/source/layout/factory.hxx +++ b/toolkit/source/layout/core/factory.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: factory.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,8 +29,8 @@ * ************************************************************************/ -#ifndef FACTORY_HXX_ -#define FACTORY_HXX_ +#ifndef LAYOUT_CORE_FACTORY_HXX +#define LAYOUT_CORE_FACTORY_HXX #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -75,4 +75,4 @@ public: }; -#endif /* FACTORY_HXX */ +#endif /* LAYOUT_CORE_FACTORY_HXX */ diff --git a/toolkit/source/layout/flow.cxx b/toolkit/source/layout/core/flow.cxx index 5d53a17ccd4f..7d856de1f714 100644 --- a/toolkit/source/layout/flow.cxx +++ b/toolkit/source/layout/core/flow.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: flow.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -56,6 +56,12 @@ Flow::Flow() &mnSpacing ); } +bool +Flow::emptyVisible () +{ + return true; +} + void SAL_CALL Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) throw (uno::RuntimeException, css::awt::MaxChildrenException) @@ -97,7 +103,7 @@ Flow::getChildren() uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() ); unsigned int i = 0; for ( std::list< ChildData * >::iterator it = maChildren.begin(); - it != maChildren.end(); it++, i++ ) + it != maChildren.end(); it++, i++ ) children[i] = (*it)->xChild; return children; diff --git a/toolkit/source/layout/flow.hxx b/toolkit/source/layout/core/flow.hxx index de217720315e..d650d61f4e40 100644 --- a/toolkit/source/layout/flow.hxx +++ b/toolkit/source/layout/core/flow.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: flow.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,10 +29,10 @@ * ************************************************************************/ -#ifndef CORE_FLOW_HXX -#define CORE_FLOW_HXX +#ifndef LAYOUT_CORE_FLOW_HXX +#define LAYOUT_CORE_FLOW_HXX -#include "container.hxx" +#include <layout/core/container.hxx> #include <list> @@ -63,6 +63,8 @@ protected: public: Flow(); + bool emptyVisible (); + // css::awt::XLayoutContainer virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) throw (css::uno::RuntimeException, css::awt::MaxChildrenException); @@ -87,8 +89,6 @@ public: virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) throw(css::uno::RuntimeException); -PROPHELPER_SET_INFO - private: // shared between getMinimumSize() and getHeightForWidth() css::awt::Size calculateSize( long nMaxWidth ); @@ -96,4 +96,4 @@ private: } // namespace layoutimpl -#endif /*FLOW_CORE_HXX*/ +#endif /* LAYOUT_FLOW_CORE_HXX */ diff --git a/toolkit/source/layout/core/helper.cxx b/toolkit/source/layout/core/helper.cxx new file mode 100644 index 000000000000..02c10ed9dc2b --- /dev/null +++ b/toolkit/source/layout/core/helper.cxx @@ -0,0 +1,676 @@ +/************************************************************************* + * + * 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 "helper.hxx" + +#include <assert.h> +#include <list> +#include <com/sun/star/awt/WindowAttribute.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#include <toolkit/awt/vclxwindow.hxx> +#include <tools/debug.hxx> + +#include "proplist.hxx" + +#if TEST_LAYOUT && !defined( DBG_UTIL ) +#undef DBG_ERROR +#define DBG_ERROR OSL_TRACE +#undef DBG_ERROR1 +#define DBG_ERROR1 OSL_TRACE +#undef DBG_ERROR2 +#define DBG_ERROR2 OSL_TRACE +#endif /* TEST_LAYOUT && !DBG_UTIL */ + +namespace layoutimpl +{ +using namespace com::sun::star; +using rtl::OUString; + +uno::Reference< awt::XWindowPeer > +getParent( uno::Reference< uno::XInterface > xRef ) +{ + do + { + uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY ); + if ( xPeer.is() ) + return xPeer; + + uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY ); + if ( xCont.is() ) + xRef = xCont->getParent(); + } + while ( xRef.is() ); + + return uno::Reference< awt::XWindowPeer >(); +} + +#if 0 +static uno::Reference< awt::XWindowPeer > +getToplevel( uno::Reference< uno::XInterface > xRef ) +{ + uno::Reference< awt::XWindowPeer > xTop, i; + while ( ( i = uno::Reference< awt::XWindowPeer >( xRef, uno::UNO_QUERY ) ).is() ) + { + xTop = i; + + uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY ); + if ( xCont.is() ) + xRef = xCont->getParent(); + else + xRef = uno::Reference< awt::XWindowPeer >(); + } + + return xTop; +} +#endif + +} + +#include "bin.hxx" +#include "box.hxx" +#include "dialogbuttonhbox.hxx" +#include "flow.hxx" +#include "localized-string.hxx" +#include "table.hxx" + +namespace layoutimpl +{ + +oslModule WidgetFactory::mSfx2Library = 0; +WindowCreator WidgetFactory::mSfx2CreateWidget = 0; + +uno::Reference <awt::XLayoutContainer> WidgetFactory::createContainer (OUString const& name) +{ + uno::Reference< awt::XLayoutContainer > xPeer; + + if ( name.equalsAscii( "hbox" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() ); + else if ( name.equalsAscii( "vbox" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() ); + else if ( name.equalsAscii( "table" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new Table() ); + else if ( name.equalsAscii( "flow" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() ); + else if ( name.equalsAscii( "bin" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() ); + else if ( name.equalsAscii( "min-size" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() ); + else if ( name.equalsAscii( "align" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new Align() ); + else if ( name.equalsAscii( "dialogbuttonhbox" ) ) + xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() ); + + return xPeer; +} + +uno::Reference <awt::XLayoutConstrains> WidgetFactory::toolkitCreateWidget (uno::Reference <awt::XToolkit> xToolkit, uno::Reference <uno::XInterface> xParent, OUString const& name, long properties) +{ + uno::Reference< awt::XLayoutConstrains > xPeer; + bool bToplevel = !xParent.is(); + + // UNO Control Widget + awt::WindowDescriptor desc; + if ( bToplevel ) + desc.Type = awt::WindowClass_TOP; + else + { + desc.Type = awt::WindowClass_SIMPLE; + +#if 0 + // top container -- a wrapper for framewindow -- is de-coupled + // from awt::XWindowPeer. So, getParent() fails at it. + uno::Reference< awt::XWindowPeer > xWinParent = getParent( xParent ); +#else + uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY ); +#endif + assert( xParent.is() ); + assert( xWinParent.is() ); + /* + With the new three layer instarr/rpath feature, when + prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to + LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0 + vclxtoolkit::ImplCreateWindow failing to create any widget; + although it succeeds here. + + While developing, one now must copy libtlx.so to + $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so + each time. + */ + VCLXWindow* parentComponent = VCLXWindow::GetImplementation( xWinParent ); + if ( !parentComponent ) + throw uno::RuntimeException( + OUString::createFromAscii( "parent has no implementation" ), + uno::Reference< uno::XInterface >() ); + desc.Parent = xWinParent; + } + + desc.ParentIndex = 0; + // debugging help ... + desc.Bounds.X = 0; + desc.Bounds.Y = 0; + desc.Bounds.Width = 300; + desc.Bounds.Height = 200; + + desc.WindowAttributes = properties; + desc.WindowServiceName = name; + + uno::Reference< awt::XWindowPeer > xWinPeer; + try + { + OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) ); + xWinPeer = xToolkit->createWindow( desc ); + if ( !xWinPeer.is() ) + throw uno::RuntimeException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ), + uno::Reference< uno::XInterface >() ); + xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY ); + } + catch( uno::Exception & ) + { + DBG_ERROR1( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( name ) ); + return uno::Reference< awt::XLayoutConstrains >(); + } + +#if 0 // This shadows the show="false" property and seems otherwise + // unnecessary + + // default to visible, let then people change it on properties + if ( ! bToplevel ) + { + uno::Reference< awt::XWindow> xWindow( xPeer, uno::UNO_QUERY ); + if ( xWindow.is() ) + xWindow->setVisible( true ); + } +#endif + + return xPeer; +} + +uno::Reference< awt::XLayoutConstrains > +WidgetFactory::createWidget (uno::Reference< awt::XToolkit > xToolkit, uno::Reference< uno::XInterface > xParent, OUString const& name, long properties) +{ + uno::Reference< awt::XLayoutConstrains > xPeer; + + xPeer = uno::Reference <awt::XLayoutConstrains> (createContainer (name), uno::UNO_QUERY); + if ( xPeer.is() ) + return xPeer; + + xPeer = implCreateWidget (xParent, name, properties); + if (xPeer.is ()) + return xPeer; + +#define FIXED_INFO 1 +#if FIXED_INFO + OUString tName = name; + // FIXME + if ( name.equalsAscii( "fixedinfo" ) ) + tName = OUString::createFromAscii( "fixedtext" ); + xPeer = toolkitCreateWidget (xToolkit, xParent, tName, properties); +#else + xPeer = toolkitCreateWidget (xToolkit, xParent, name, properties); +#endif + + return xPeer; +} + +PropHelper::PropHelper() : LockHelper() + , cppu::OPropertySetHelper( maBrdcstHelper ) + , pHelper( NULL ) +{ +} + +void +PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e, + uno::Type aType, void *pPtr) +{ + // this sucks rocks for effiency ... + PropDetails aDetails; + aDetails.aName = rtl::OUString::intern( pName, nNameLen, e ); + aDetails.aType = aType; + aDetails.pValue = pPtr; + maDetails.push_back( aDetails ); +} + +cppu::IPropertyArrayHelper & SAL_CALL +PropHelper::getInfoHelper() +{ + if ( ! pHelper ) + { + uno::Sequence< beans::Property > aProps( maDetails.size() ); + for ( unsigned int i = 0; i < maDetails.size(); i++) + { + aProps[i].Name = maDetails[i].aName; + aProps[i].Type = maDetails[i].aType; + aProps[i].Handle = i; + aProps[i].Attributes = 0; + } + pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ ); + + } + return *pHelper; +} + +sal_Bool SAL_CALL +PropHelper::convertFastPropertyValue( + uno::Any & rConvertedValue, + uno::Any & rOldValue, + sal_Int32 nHandle, + const uno::Any& rValue ) + throw (lang::IllegalArgumentException) +{ + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); + + // FIXME: no Any::getValue ... + getFastPropertyValue( rOldValue, nHandle ); + if ( rOldValue != rValue ) + { + rConvertedValue = rValue; + return sal_True; // changed + } + else + { + rConvertedValue.clear(); + rOldValue.clear(); + } + return sal_False; +} + + +void SAL_CALL +PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, + const uno::Any& rValue ) + throw (uno::Exception) +{ + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); + + const PropDetails &rInfo = maDetails[ nHandle ]; + + uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(), + rValue.pData, rValue.pType, + 0, 0, 0 ); + + if ( mpListener ) + mpListener->propertiesChanged(); +} + +void SAL_CALL +PropHelper::getFastPropertyValue( uno::Any& rValue, + sal_Int32 nHandle ) const +{ + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); + const PropDetails &rInfo = maDetails[ nHandle ]; +#if 0 + switch ( rInfo.aType.getTypeClass() ) + { +#define MAP(classtype,ctype) \ + case uno::TypeClass_##classtype: \ + rValue <<= *(ctype *)(rInfo.pValue); \ + break + MAP( DOUBLE, double ); + MAP( SHORT, sal_Int16 ); + MAP( LONG, sal_Int32 ); + MAP( UNSIGNED_SHORT, sal_uInt16 ); + MAP( UNSIGNED_LONG, sal_uInt32 ); + MAP( STRING, ::rtl::OUString ); + default: + DBG_ERROR( "ERROR: unknown type to map!" ); + break; + } +#undef MAP +#endif + rValue.setValue( rInfo.pValue, rInfo.aType ); +} + +::com::sun::star::uno::Any +PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + return OPropertySetHelper::queryInterface( rType ); +} + +uno::Reference <beans::XPropertySetInfo> SAL_CALL PropHelper::getPropertySetInfo () throw (uno::RuntimeException) +{ + return css::uno::Reference <css::beans::XPropertySetInfo> (createPropertySetInfo (getInfoHelper ())); +} + +} // namespace layoutimpl + +#include <awt/vclxbutton.hxx> +#include <awt/vclxdialog.hxx> +#include <awt/vclxfixedline.hxx> +#include <awt/vclxplugin.hxx> +#include <awt/vclxscroller.hxx> +#include <awt/vclxsplitter.hxx> +#include <awt/vclxtabcontrol.hxx> +#include <awt/vclxtabpage.hxx> +#include <toolkit/awt/vclxtoolkit.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/fixed.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/unohelp.hxx> + +#include <layout/layout.hxx> +#include <toolkit/awt/vclxwindows.hxx> +#include <vcl/lstbox.hxx> +#include <vcl.hxx> + +#include <typeinfo> + +namespace layoutimpl +{ + +uno::Reference <awt::XLayoutConstrains> WidgetFactory::implCreateWidget (uno::Reference <uno::XInterface> xParent, OUString name, long attributes) +{ + Window* parent = 0; + + if (VCLXWindow* parentComponent = VCLXWindow::GetImplementation (xParent)) + parent = parentComponent->GetWindow (); + + VCLXWindow* component = 0; + Window* window = 0; //sfx2CreateWindow (&component, parent, name, attributes); + if (!window) + window = layoutCreateWindow (&component, parent, name, attributes); + + uno::Reference <awt::XLayoutConstrains> reference; + if (window) + { + window->SetCreatedWithToolkit( sal_True ); + if ( component ) + component->SetCreatedWithToolkit( true ); + reference = component; + window->SetComponentInterface( component ); + if ( attributes & awt::WindowAttribute::SHOW ) + window->Show(); + } + + return reference; +} + +extern "C" { static void SAL_CALL thisModule() {} } + +Window* WidgetFactory::sfx2CreateWindow (VCLXWindow** component, Window* parent, OUString const& name, long& attributes) +{ + OSL_TRACE("Asking sfx2: %s", OUSTRING_CSTR (name)); + + if (!mSfx2Library) + { + OUString libraryName = ::vcl::unohelper::CreateLibraryName ("sfx", TRUE); + mSfx2Library = osl_loadModuleRelative (&thisModule, libraryName.pData, SAL_LOADMODULE_DEFAULT); + if (mSfx2Library) + { + OUString functionName (RTL_CONSTASCII_USTRINGPARAM ("CreateWindow")); + mSfx2CreateWidget = (WindowCreator) osl_getFunctionSymbol (mSfx2Library, functionName.pData); + } + } + + if (mSfx2CreateWidget) + return mSfx2CreateWidget (component, name, parent, attributes); + + return 0; +} + +Window* WidgetFactory::layoutCreateWindow (VCLXWindow** component, Window *parent, OUString const& name, long& attributes) +{ + Window* window = 0; + + if (0) + { + ; + } + if ( name.equalsAscii( "dialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new Dialog( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "modaldialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new ModalDialog( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "modelessdialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new ModelessDialog (parent, ImplGetWinBits (attributes, 0)); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "sfxdialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new ClosingDialog (parent, ImplGetWinBits (attributes, 0)); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "sfxmodaldialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new ClosingModalDialog( parent, + ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "sfxmodelessdialog" ) ) + { + if ( parent == NULL ) + parent = DIALOG_NO_PARENT; + window = new ClosingModelessDialog (parent, ImplGetWinBits (attributes, 0)); + *component = new layoutimpl::VCLXDialog(); + + attributes ^= awt::WindowAttribute::SHOW; + } + else if ( name.equalsAscii( "tabcontrol" ) ) + { + window = new TabControl( parent, ImplGetWinBits( attributes, WINDOW_TABCONTROL ) ); + *component = new layoutimpl::VCLXTabControl(); + } + else if ( name.equalsAscii( "scroller" ) ) + { + // used FixedImage because I just want some empty non-intrusive widget + window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXScroller(); + } + else if ( name.equalsAscii( "hsplitter" ) || name.equalsAscii( "vsplitter" ) ) + { + window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXSplitter( name.equalsAscii( "hsplitter" ) ); + } + else if ( name.equalsAscii( "hfixedline" ) || name.equalsAscii( "vfixedline" ) ) + { + WinBits nStyle = ImplGetWinBits( attributes, 0 ); + nStyle ^= WB_HORZ; + if ( name.equalsAscii( "hfixedline" ) ) + nStyle |= WB_HORZ; + else + nStyle |= WB_VERT; + window = new FixedLine( parent, nStyle ); + *component = new layoutimpl::VCLXFixedLine(); + } + else if ( name.equalsAscii( "okbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXOKButton( window ); + window->SetType (WINDOW_OKBUTTON); + } + else if ( name.equalsAscii( "cancelbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXCancelButton( window ); + window->SetType (WINDOW_CANCELBUTTON); + } + else if ( name.equalsAscii( "yesbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXYesButton( window ); + window->SetType (WINDOW_OKBUTTON); + } + else if ( name.equalsAscii( "nobutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + window->SetType (WINDOW_CANCELBUTTON); + *component = new layoutimpl::VCLXNoButton( window ); + } + else if ( name.equalsAscii( "retrybutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXRetryButton( window ); + } + else if ( name.equalsAscii( "ignorebutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXIgnoreButton( window ); + } + else if ( name.equalsAscii( "resetbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXResetButton( window ); + } + else if ( name.equalsAscii( "applybutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXApplyButton( window ); + } + else if ( name.equalsAscii( "helpbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXHelpButton( window ); + window->SetType (WINDOW_HELPBUTTON); + } + else if ( name.equalsAscii( "morebutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXMoreButton( window ); + window->SetType (WINDOW_MOREBUTTON); + } + else if ( name.equalsAscii( "advancedbutton" ) ) + { + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::VCLXAdvancedButton( window ); + } + else if ( name.equalsAscii( "plugin" ) ) + { + window = new Control( parent, ImplGetWinBits( attributes, 0 ) ); +#ifndef __SUNPRO_CC + OSL_TRACE( "%s: parent=%p (%s)\n", __FUNCTION__, parent, typeid( *parent ).name() ); +#endif + *component = new layoutimpl::VCLXPlugin( window, ImplGetWinBits( attributes, 0 ) ); + } + else if ( name.equalsAscii( "tabpage" ) ) + { +#if 0 + if ( !parent ) + parent = layout::TabPage::global_parent; +#else + if (layout::TabPage::global_parent) + parent = layout::TabPage::global_parent; + layout::TabPage::global_parent = 0; +#endif + //window = new TabPage( parent, ImplGetWinBits( attributes, 0 ) ); + attributes ^= awt::WindowAttribute::SHOW; + WinBits nStyle = ImplGetWinBits( attributes, 0 ); + nStyle |= WB_HIDE; + + if (!parent) + { + window = new Dialog( parent, nStyle ); + *component = new VCLXDialog(); + } + else + { + window = new TabPage( parent, nStyle ); + *component = new VCLXTabPage( window ); + } + } + else if ( name.equalsAscii( "string" ) ) + { + // FIXME: move <string>s.text to simple map<string> in root? + attributes &= ~awt::WindowAttribute::SHOW; + window = new Window( parent, ImplGetWinBits( attributes, 0 ) ); + *component = new layoutimpl::LocalizedString(); + } +#if 0 // parent paranoia + else if ( name.equalsAscii( "listbox" ) ) + { + window = new ListBox (parent, ImplGetWinBits (attributes, 0)); + *component = new VCLXListBox (); + } +#endif + else if (name.equalsAscii ("svxfontlistbox") + || name.equalsAscii ("svxlanguagebox")) + { + window = new ListBox (parent, ImplGetWinBits (attributes, 0)); + *component = new VCLXListBox (); + } + return window; +} + +} // namespace layoutimpl + +// Avoid polluting the rest of the code with vcl linkage pieces ... + +#include <vcl/imagerepository.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/graph.hxx> + +namespace layoutimpl +{ + +uno::Reference< graphic::XGraphic > loadGraphic( const char *pName ) +{ + BitmapEx aBmp; + + OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ); + if ( aStr.compareToAscii( ".uno:" ) == 0 ) + aStr = aStr.copy( 5 ).toAsciiLowerCase(); + + if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) ) + return uno::Reference< graphic::XGraphic >(); + + return Graphic( aBmp ).GetXGraphic(); +} + +} // namespace layoutimpl diff --git a/toolkit/source/layout/helper.hxx b/toolkit/source/layout/core/helper.hxx index b4dc7e0d0858..787e4f4132b4 100644 --- a/toolkit/source/layout/helper.hxx +++ b/toolkit/source/layout/core/helper.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helper.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,8 +29,8 @@ * ************************************************************************/ -#ifndef HELPER_HXX -#define HELPER_HXX +#ifndef LAYOUT_CORE_HELPER_HXX +#define LAYOUT_CORE_HELPER_HXX #include <toolkit/dllapi.h> #include <vector> @@ -39,10 +39,19 @@ #include <com/sun/star/awt/XLayoutContainer.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/xml/input/XRoot.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/propshlp.hxx> +#include <osl/module.h> #include <rtl/ustring.hxx> +class Window; +class VCLXWindow; +extern "C" +{ + typedef Window* (SAL_CALL *WindowCreator) (VCLXWindow** component, rtl::OUString const& name, Window* parent, long& attributes); +} + namespace layoutimpl { @@ -97,23 +106,13 @@ public: virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const; - // you -must- use this macro in sub-classes that define new properties. - // NB. 'static' ... - // com::sun::star::beans::XMultiPropertySet -#define PROPHELPER_SET_INFO \ - css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL \ - getPropertySetInfo() throw(css::uno::RuntimeException) \ - { \ - static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( \ - createPropertySetInfo( getInfoHelper() ) ); \ - return xInfo; \ - } - PROPHELPER_SET_INFO + virtual css::uno::Reference <css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo () throw (css::uno::RuntimeException); struct Listener { virtual void propertiesChanged() = 0; }; + void setChangeListener( Listener *pListener ) { mpListener = pListener; @@ -131,25 +130,24 @@ css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &t css::uno::Reference< css::awt::XWindowPeer > getParent( css::uno::Reference< css::uno::XInterface > xPeer ); - -struct WidgetFactory +class TOOLKIT_DLLPUBLIC WidgetFactory { - virtual css::uno::Reference< css::awt::XLayoutConstrains > - createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::uno::XInterface > xParent, - const rtl::OUString &rName, long nProps ); +public: + static oslModule mSfx2Library; + static WindowCreator mSfx2CreateWidget; + + // Should use UNO services in due course + static css::uno::Reference <css::awt::XLayoutConstrains> toolkitCreateWidget (css::uno::Reference <css::awt::XToolkit> xToolkit, css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString const& name, long properties); + static css::uno::Reference< css::awt::XLayoutConstrains > createWidget( css::uno::Reference <css::awt::XToolkit > xToolkit, css::uno::Reference< css::uno::XInterface > xParent, rtl::OUString const &name, long properties); + static css::uno::Reference <css::awt::XLayoutContainer> createContainer (rtl::OUString const& name); + static css::uno::Reference <css::awt::XLayoutConstrains> implCreateWidget (css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString name, long attributes); + static Window* sfx2CreateWindow (VCLXWindow** component, Window* parent, rtl::OUString const& name, long& attributes); + static Window* layoutCreateWindow (VCLXWindow** component, Window *parent, rtl::OUString const& name, long& attributes); }; -// A local factory method - should use UNO services in due course -css::uno::Reference< css::awt::XLayoutConstrains > TOOLKIT_DLLPUBLIC -createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::uno::XInterface > xParent, - const rtl::OUString &rName, long nProps ); -// Factory for containers (not visible ones) -css::uno::Reference< css::awt::XLayoutContainer > -createContainer( const rtl::OUString &rName ); +css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName ); -} // namespace layoutimpl +} // end namespace layoutimpl -#endif /* HELPER_HXX */ +#endif /* LAYOUT_CORE_HELPER_HXX */ diff --git a/toolkit/source/layout/import.cxx b/toolkit/source/layout/core/import.cxx index 75d4656f2971..dede47ad3ceb 100644 --- a/toolkit/source/layout/import.cxx +++ b/toolkit/source/layout/core/import.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: import.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -35,14 +35,12 @@ #include <com/sun/star/awt/XDialog2.hpp> #include <vcl/image.hxx> #include <tools/debug.hxx> +#include <layout/layout.hxx> #include "root.hxx" #include "helper.hxx" #include "dialogbuttonhbox.hxx" -// Hmm... -#include "layout/layout.hxx" -#include "layout/layoutcore.hxx" #define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout" #define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container" @@ -99,7 +97,16 @@ SAL_THROW (()) { OUString aTitle; if ( findAndRemove( "title", aProps, aTitle ) ) + { + OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) ); xDialog->setTitle( aTitle ); + } + OUString aHelpId; + if ( findAndRemove( "help-id", aProps, aHelpId ) ) + { + OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) ); + xDialog->setHelpId( aHelpId.toInt32 () ); + } } // DEBUG: else if ( pParent == NULL ) { @@ -122,32 +129,23 @@ SAL_THROW (()) if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) ) b->setOrdering ( aOrdering ); -#ifdef IMPORT_RADIOGROUP - bool bSetRadioGroup, bSetTitle; - OUString aRadioGroup, aTitle; + bool bSetRadioGroup; + OUString aRadioGroup; bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup ); - bSetTitle = findAndRemove( "title", aProps, aTitle ); - setProperties( mxPeer, aProps ); + mpWidget->setProperties( aProps ); // we need to add radio buttons to the group after their properties are // set, so we can check if they should be the one selected by default or not. // And the state changed event isn't fired when changing properties. - if ( bSetRadioGroup ) - { - static int i = 0; - i++; - uno::Reference< awt::XRadioButton > xRadio( mxPeer, uno::UNO_QUERY ); - if ( xRadio.is() ) - pImport->mxRadioGroups.addItem( aRadioGroup, xRadio ); - } - if ( bSetTitle ) + + uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY ); + if ( xRadio.is() ) { - uno::Reference< awt::XDialog2 > xDialog( mxPeer, uno::UNO_QUERY ); - if ( xDialog.is() ) - xDialog->setTitle( aTitle ); + if (!bSetRadioGroup) + aRadioGroup = OUString::createFromAscii ("default"); + pImport->mxRadioGroups.addItem( aRadioGroup, xRadio ); } -#endif } WidgetElement::~WidgetElement() @@ -181,7 +179,7 @@ WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name, // transex3 hack. void SAL_CALL WidgetElement::characters( OUString const& rChars ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) + throw (xml::sax::SAXException, uno::RuntimeException) { if ( mpWidget && rChars.trim().getLength() ) { @@ -239,11 +237,104 @@ uno::Reference< xml::input::XElement > ImportContext::startRootElement( uno::Reference< xml::input::XAttributes > const & xAttributes ) throw (xml::sax::SAXException, uno::RuntimeException) { - if (XMLNS_LAYOUT_UID != nUid) + if ( XMLNS_LAYOUT_UID != nUid ) throw xml::sax::SAXException( OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ), uno::Reference< uno::XInterface >(), uno::Any() ); - return new ToplevelElement( rLocalName, xAttributes, this ); + return new ToplevelElement( rLocalName, xAttributes, this ); +} + +RadioGroups::RadioGroups() +{ +} + +void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio ) + throw (uno::RuntimeException) +{ + if ( ! xRadio.is() ) + throw uno::RuntimeException(); + + uno::Reference< RadioGroup > group; + RadioGroupsMap::iterator it = mxRadioGroups.find( id ); + if ( it == mxRadioGroups.end() ) + { + group = uno::Reference< RadioGroup > ( new RadioGroup() ); + mxRadioGroups [id] = group; + } + else + group = it->second; + group->addItem( xRadio ); +} + +RadioGroups::RadioGroup::RadioGroup() +{ +} + +void RadioGroups::RadioGroup::addItem( uno::Reference< awt::XRadioButton > xRadio ) +{ + if ( ! mxSelectedRadio.is() ) + { + xRadio->setState( true ); + mxSelectedRadio = xRadio; + } + else if ( xRadio->getState() ) + { +#if 1 + xRadio->setState( false ); +#else // huh, why select last added? + mxSelectedRadio->setState( false ); + mxSelectedRadio = xRadio; +#endif + } + + // TOO late: actionPerformed is called before itemStateChanged. + // If client code (wrongly?) uses actionPerformed, it will see + // the previous RadioButtons' state. + xRadio->addItemListener( this ); + + uno::Reference< awt::XButton > xButton = uno::Reference< awt::XButton > ( xRadio, uno::UNO_QUERY ); + xButton->addActionListener( this ); + + mxRadios.push_back (xRadio); +} + +void RadioGroups::RadioGroup::handleSelected () + throw (uno::RuntimeException) +{ + for ( RadioButtonsList::iterator it = mxRadios.begin(); + it != mxRadios.end(); it++ ) + if ( *it != mxSelectedRadio && (*it)->getState() ) + { + mxSelectedRadio->setState( false ); + mxSelectedRadio = *it; + break; + } +} + +// awt::XItemListener +void RadioGroups::RadioGroup::itemStateChanged( const awt::ItemEvent& e ) + throw (uno::RuntimeException) +{ + // TOO late: actionPerformed is called before itemStateChanged. + // If client code (wrongly?) uses actionPerformed, it will see + // the previous RadioButtons' state. + + // Need this for initialization, though. + if ( e.Selected ) + handleSelected (); +} + +// awt::XActionListener +void RadioGroups::RadioGroup::actionPerformed( const awt::ActionEvent& ) + throw (uno::RuntimeException) +{ + handleSelected (); +} + +// lang::XEventListener +void SAL_CALL RadioGroups::RadioGroup::disposing( const lang::EventObject& ) + throw (uno::RuntimeException) +{ } } // namespace layoutimpl diff --git a/toolkit/source/layout/import.hxx b/toolkit/source/layout/core/import.hxx index 9f32d2263ccf..d72e8a337f56 100644 --- a/toolkit/source/layout/import.hxx +++ b/toolkit/source/layout/core/import.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: import.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,15 +29,19 @@ * ************************************************************************/ -#ifndef IMPORT_HXX -#define IMPORT_HXX +#ifndef LAYOUT_CORE_IMPORT_HXX +#define LAYOUT_CORE_IMPORT_HXX #include <map> #include <list> +#define _BACKWARD_BACKWARD_WARNING_H 1 #include <hash_map> + #include <com/sun/star/xml/input/XRoot.hpp> #include <cppuhelper/implbase1.hxx> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> namespace layoutimpl { @@ -45,94 +49,41 @@ class LayoutRoot; class LayoutWidget; namespace css = ::com::sun::star; -/* blocks under IMPORT_RADIOGROUP are marked for deletion. - The use of it is to synchronize radio buttons into groups. - But toolkit doesn't fire toggle events when toggled from the code. - Another approach is to implement our own XRadioButton from our - internal toolkit. We could have some singleton where they would - register... We would need to add another attribute... -*/ - -#ifdef IMPORT_RADIOGROUP -#include <com/sun/star/awt/XRadioButton.hpp> class RadioGroups { public: - RadioGroups() - { - } + RadioGroups(); void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio ) - throw (css::uno::RuntimeException) - { - if ( ! xRadio.is() ) - throw css::uno::RuntimeException(); - - css::uno::Reference< RadioGroup > group; - RadioGroupsMap::iterator it = mxRadioGroups.find( id ); - if ( it == mxRadioGroups.end() ) - { - group = css::uno::Reference< RadioGroup > ( new RadioGroup() ); - mxRadioGroups [id] = group; - } - else - group = it->second; - group->addItem( xRadio ); - } + throw (css::uno::RuntimeException); private: class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener > + , public ::cppu::WeakImplHelper1< css::awt::XActionListener > { public: - RadioGroup() - { - } - - void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio ) - { - if ( ! mxSelectedRadio.is() ) - { - xRadio->setState( true ); - mxSelectedRadio = xRadio; - } - else if ( xRadio->getState() ) - { - mxSelectedRadio->setState( false ); - mxSelectedRadio = xRadio; - } - - xRadio->addItemListener( this ); - mxRadios.push_back (xRadio); - } + RadioGroup(); + void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio ); private: typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList; RadioButtonsList mxRadios; css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio; + void handleSelected () + throw (css::uno::RuntimeException); + // awt::XItemListener - void itemStateChanged( const com::sun::star::awt::ItemEvent& e) - throw (css::uno::RuntimeException) - { - if ( e.Selected ) - { - mxSelectedRadio->setState( false ); - // the only radio button selected would be the one that fired the event - for ( RadioButtonsList::iterator it = mxRadios.begin(); - it != mxRadios.end(); it++ ) - if ( (*it)->getState() ) - { - mxSelectedRadio = *it; - break; - } - } - } + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e ) + throw (css::uno::RuntimeException); + + // awt::XActionListener + void SAL_CALL actionPerformed( const css::awt::ActionEvent& e ) + throw (css::uno::RuntimeException); // lang::XEventListener void SAL_CALL disposing( const css::lang::EventObject& ) - throw (css::uno::RuntimeException) - { - } + throw (css::uno::RuntimeException); }; // each RadioGroup will stay alive after RadioGroups die with the ImportContext @@ -140,7 +91,6 @@ private: typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap; RadioGroupsMap mxRadioGroups; }; -#endif #if 0 // generator @@ -196,9 +146,7 @@ class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot > public: sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID; LayoutRoot &mrRoot; // switch to XNameContainer ref ? -#ifdef IMPORT_RADIOGROUP RadioGroups mxRadioGroups; -#endif inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () ) : mrRoot( rRoot ) {} @@ -312,4 +260,4 @@ public: } // namespace layoutimpl -#endif /* IMPORT_HXX */ +#endif /* LAYOUT_CORE_IMPORT_HXX */ diff --git a/toolkit/source/layout/core/localized-string.cxx b/toolkit/source/layout/core/localized-string.cxx new file mode 100644 index 000000000000..9bc9df372832 --- /dev/null +++ b/toolkit/source/layout/core/localized-string.cxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#include "localized-string.hxx" + +#include <toolkit/helper/property.hxx> +#include <vcl/window.hxx> + +namespace layoutimpl +{ + +namespace css = ::com::sun::star; +using namespace css; +using rtl::OUString; + +LocalizedString::LocalizedString() + : VCLXWindow() +{ +} + +void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids ) +{ + PushPropertyIds( ids, BASEPROPERTY_TEXT, 0); + VCLXWindow::ImplGetPropertyIds( ids ); +} + +// XInterface +uno::Any LocalizedString::queryInterface( uno::Type const& rType ) + throw(uno::RuntimeException) +{ + uno::Any aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( awt::XFixedText*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +void LocalizedString::setText( OUString const& s ) + throw(uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( Window *w = GetWindow() ) + return w->SetText( s ); +} + +OUString LocalizedString::getText() + throw(uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( Window *w = GetWindow() ) + return w->GetText(); + return OUString(); +} + +} // namespace layoutimpl diff --git a/toolkit/source/layout/core/localized-string.hxx b/toolkit/source/layout/core/localized-string.hxx new file mode 100644 index 000000000000..7c897f2c713d --- /dev/null +++ b/toolkit/source/layout/core/localized-string.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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., 51 Franklin Street, 5th Floor, Boston, + * MA 02110-1301 USA + * + ************************************************************************/ + +#ifndef LAYOUT_CORE_LOCALIZED_STRING_HXX +#define LAYOUT_CORE_LOCALIZED_STRING_HXX + +#include <com/sun/star/awt/XFixedText.hpp> +#include <toolkit/awt/vclxwindow.hxx> + +namespace layoutimpl +{ +namespace css = ::com::sun::star; + +// FIXME: misuse XFixedText interface for simple string +class LocalizedString : public css::awt::XFixedText + , public VCLXWindow +{ +public: + LocalizedString(); + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType ) + throw(css::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // css::awt::XFixedText + void SAL_CALL setText( ::rtl::OUString const& s ) + throw(css::uno::RuntimeException); + ::rtl::OUString SAL_CALL getText() + throw(css::uno::RuntimeException); + void SAL_CALL setAlignment( sal_Int16 ) + throw(css::uno::RuntimeException) { } + sal_Int16 SAL_CALL getAlignment() + throw(css::uno::RuntimeException) { return 0; } + + // css::awt::XLayoutConstrains + virtual css::awt::Size SAL_CALL getMinimumSize() + throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); } + css::awt::Size SAL_CALL getPreferredSize() + throw(css::uno::RuntimeException) { return getMinimumSize(); } + css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size ) + throw(css::uno::RuntimeException) { return size; } + + static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids ); + virtual void GetPropertyIds( std::list< sal_uInt16 > &ids ) + { return ImplGetPropertyIds( ids ); } +}; + +} // namespace layoutimpl + +#endif /* LAYOUT_CORE_LOCALIZED_STRING_HXX */ diff --git a/toolkit/source/layout/makefile.mk b/toolkit/source/layout/core/makefile.mk index a9b743742117..131be7eb237c 100644 --- a/toolkit/source/layout/makefile.mk +++ b/toolkit/source/layout/core/makefile.mk @@ -6,9 +6,9 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# $RCSfile$ # -# $Revision: 1.3 $ +# $Revision$ # # This file is part of OpenOffice.org. # @@ -29,9 +29,9 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=../../.. PRJNAME=toolkit -TARGET=layoutcore +TARGET=layout-core ENABLE_EXCEPTIONS=true # --- Settings ----------------------------------------------------- @@ -55,11 +55,14 @@ SLOFILES= \ $(SLO)$/flow.obj \ $(SLO)$/helper.obj \ $(SLO)$/import.obj \ + $(SLO)$/localized-string.obj \ $(SLO)$/proplist.obj \ $(SLO)$/root.obj \ $(SLO)$/table.obj \ $(SLO)$/timer.obj \ - $(SLO)$/translate.obj + $(SLO)$/translate.obj\ + $(SLO)$/vcl.obj\ +# # --- Targets ------------------------------------------------------ diff --git a/toolkit/source/layout/precompiled_xmlscript.hxx b/toolkit/source/layout/core/precompiled_xmlscript.hxx index 0c554b41402a..f8ad22b56678 100644 --- a/toolkit/source/layout/precompiled_xmlscript.hxx +++ b/toolkit/source/layout/core/precompiled_xmlscript.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_xmlscript.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * diff --git a/toolkit/source/layout/proplist.cxx b/toolkit/source/layout/core/proplist.cxx index 2d3d1265c0fc..9b154077eaa8 100644 --- a/toolkit/source/layout/proplist.cxx +++ b/toolkit/source/layout/core/proplist.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: proplist.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -39,16 +39,15 @@ #include <com/sun/star/awt/VclWindowPeerAttribute.hpp> #include <tools/debug.hxx> -#include "layout/layoutcore.hxx" +#include "helper.hxx" #if TEST_LAYOUT && !defined( DBG_UTIL ) -#include <stdio.h> #undef DBG_ERROR -#define DBG_ERROR printf +#define DBG_ERROR OSL_TRACE #undef DBG_ERROR1 -#define DBG_ERROR1 printf +#define DBG_ERROR1 OSL_TRACE #undef DBG_ERROR2 -#define DBG_ERROR2 printf +#define DBG_ERROR2 OSL_TRACE #endif /* TEST_LAYOUT && !DBG_UTIL */ namespace layoutimpl @@ -251,18 +250,17 @@ setProperties( uno::Reference< uno::XInterface > const& xPeer, if ( !prophlp::canHandleProps( xPeer ) ) { DBG_ERROR( "Error: setProperties - bad handle ignoring props:\n" ); - PropList::const_iterator cur; - for ( cur = rProps.begin(); cur != rProps.end(); cur++ ) + for ( PropList::const_iterator it = rProps.begin(); it != rProps.end(); + it++ ) { - OString attr = OUStringToOString( cur->first, RTL_TEXTENCODING_UTF8 ); - OString value = OUStringToOString( cur->second, RTL_TEXTENCODING_UTF8 ); + DBG_ERROR2( "%s=%s\n", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) ); } return; } - PropList::const_iterator cur; - for ( cur = rProps.begin(); cur != rProps.end(); cur++ ) - setProperty( xPeer, cur->first, cur->second ); + for ( PropList::const_iterator it = rProps.begin(); it != rProps.end(); + it++ ) + setProperty( xPeer, it->first, it->second ); } void @@ -271,7 +269,7 @@ setProperty( uno::Reference< uno::XInterface > const& xPeer, { OUString unoAttr = toUnoNaming( attr ); - OSL_TRACE( "setting %s=%s\n", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) ); + OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) ); // get a Property object beans::Property prop; try @@ -350,7 +348,7 @@ static const AttributesMap attribsMap[] = { "spin", awt::VclWindowPeerAttribute::SPIN, false }, { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false }, - // cutting on OK, YES_NO_CANCEL and related obscure attributes... + // cutting on OK, YES_NO_CANCEL and related obsite attributes... }; static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap ); @@ -382,8 +380,6 @@ long getAttribute( const OUString &rName, bool bTopWindow ) void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes, PropList &rProps, sal_Int32 nNamespace ) { - - sal_Int32 nAttrs = xAttributes->getLength(); for ( sal_Int32 i = 0; i < nAttrs; i++ ) { @@ -402,15 +398,16 @@ void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttri bool findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue ) { - PropList::iterator cur; + PropList::iterator it; OUString aName = OUString::createFromAscii( pAttr ); - for ( cur = rProps.begin(); cur != rProps.end(); cur++ ) + for ( it = rProps.begin(); it != rProps.end(); it++ ) { - if ( cur->first.equalsIgnoreAsciiCase( aName ) ) + if ( it->first.equalsIgnoreAsciiCase( aName ) + || it->first.equalsIgnoreAsciiCase( OUString::createFromAscii ("_") + aName ) ) { - rValue = cur->second; - rProps.erase( cur ); + rValue = it->second; + rProps.erase( it ); return true; } } diff --git a/toolkit/inc/layout/layoutcore.hxx b/toolkit/source/layout/core/proplist.hxx index 2ffe777c59ae..27682faf8902 100644 --- a/toolkit/inc/layout/layoutcore.hxx +++ b/toolkit/source/layout/core/proplist.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: layoutcore.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,40 +29,39 @@ * ************************************************************************/ -#ifndef _LAYOUT_CORE_HXX_ -#define _LAYOUT_CORE_HXX_ - -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <com/sun/star/awt/XLayoutContainer.hpp> -#include <com/sun/star/awt/XLayoutConstrains.hpp> - -#include <layout/layout.hxx> +#ifndef LAYOUT_CORE_PROPLIST_HXX +#define LAYOUT_CORE_PROPLIST_HXX +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/xml/input/XAttributes.hpp> +#include <list> +#include <rtl/ustring.hxx> +#include <toolkit/dllapi.h> +\ namespace layoutimpl { -namespace css = layout::css; +namespace css = ::com::sun::star; + +typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList; -css::uno::Reference< css::awt::XLayoutContainer > -createContainer( const rtl::OUString &rName ); +void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes, + PropList &rProps, sal_Int32 nNamespace ); -css::uno::Reference< css::awt::XLayoutConstrains > -createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::uno::XInterface > xParent, - const rtl::OUString &rName, long nProps ); +void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer, + PropList const& rProps); -css::uno::Reference< css::awt::XLayoutConstrains > -createInternalWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::uno::XInterface > xParent, - const rtl::OUString &rName, long nProps ); +void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer, + rtl::OUString const& attr, rtl::OUString const& value ); -css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName ); +long getAttributeProps( PropList &rProps ); +bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue); // Helpers - unfortunately VCLXWindows don't implement XPropertySet // but containers do - these helpers help us to hide this namespace prophlp { + // can we set properties on this handle ? bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef ); // if so which properties ? @@ -75,6 +74,22 @@ void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterf css::uno::Any TOOLKIT_DLLPUBLIC getProperty( const css::uno::Reference< css::uno::XInterface > &xRef, const rtl::OUString &rName ); } // namespace prophlp + } // namespace layoutimpl -#endif // _LAYOUT_CORE_HXX_ + +#if !OUSTRING_CSTR_PARANOIA +#define OUSTRING_CSTR( str ) \ + rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr() +#else + +inline char const* OUSTRING_CSTR( rtl::OUString const& str ) +{ + rtl::OString *leak + = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US)); + return leak->getStr(); +} + +#endif + +#endif /* LAYOUT_CORE_PROPLIST_HXX */ diff --git a/toolkit/source/layout/root.cxx b/toolkit/source/layout/core/root.cxx index 6934c997f1e8..b316fdfc8e9e 100644 --- a/toolkit/source/layout/root.cxx +++ b/toolkit/source/layout/core/root.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: root.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -31,8 +31,7 @@ #include "root.hxx" -#include <assert.h> -#include <stdio.h> +#include <cassert> #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/awt/XMessageBox.hpp> @@ -47,7 +46,6 @@ #include "timer.hxx" #include "translate.hxx" - namespace layoutimpl { @@ -102,11 +100,12 @@ void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactor xMessageBox->execute(); //FIXME: exceptions not caught and printed at top level?? //else - printf( "%s\n", OUSTRING_CSTR( aMessage ) ); + //printf( "%s\n", OUSTRING_CSTR( aMessage ) ); } void LayoutRoot::error( OUString const& message ) { + OSL_TRACE( "%s\n", OUSTRING_CSTR( message ) ); ShowMessageBox( mxFactory, mxToolkit, OUString::createFromAscii( "Fatal error" ), message ); @@ -140,7 +139,7 @@ void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArgument OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) ), uno::UNO_QUERY ); OSL_ASSERT( xParser.is() ); - if (! xParser.is() ) + if (! xParser.is()) { throw uno::RuntimeException( OUString::createFromAscii( "cannot create sax-parser component" ), @@ -249,9 +248,9 @@ uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames() uno::Sequence< OUString > aNames( maItems.size() ); sal_Int32 nPos = 0; - for ( ItemHash::const_iterator i = maItems.begin(); - i != maItems.end(); i++ ) - aNames[ nPos++ ] = i->first; + for ( ItemHash::const_iterator it = maItems.begin(); + it != maItems.end(); it++ ) + aNames[ nPos++ ] = it->first; return aNames; } @@ -345,9 +344,9 @@ uno::Reference< awt::XLayoutConstrains > LayoutRoot::getToplevel() uno::Reference< awt::XLayoutConstrains > LayoutRoot::getById( OUString id ) { uno::Reference< awt::XLayoutConstrains > rRef = 0; - ItemHash::iterator i = maItems.find( id ); - if ( i != maItems.end() ) - rRef = i->second; + ItemHash::iterator it = maItems.find( id ); + if ( it != maItems.end() ) + rRef = it->second; return rRef; } #endif @@ -363,7 +362,7 @@ LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit, xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); } - mxWidget = createWidget( xToolkit, xParent, unoName, attrbs ); + mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, attrbs ); assert( mxWidget.is() ); mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); } diff --git a/toolkit/source/layout/root.hxx b/toolkit/source/layout/core/root.hxx index 73421dfe4bd2..92824f0d8ada 100644 --- a/toolkit/source/layout/root.hxx +++ b/toolkit/source/layout/core/root.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: root.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,9 +29,10 @@ * ************************************************************************/ -#ifndef CORE_ROOT_HXX -#define CORE_ROOT_HXX +#ifndef LAYOUT_CORE_ROOT_HXX +#define LAYOUT_CORE_ROOT_HXX +#define _BACKWARD_BACKWARD_WARNING_H 1 #include <hash_map> #include <com/sun/star/awt/XLayoutRoot.hpp> @@ -44,7 +45,7 @@ #include <cppuhelper/interfacecontainer.h> #include <toolkit/dllapi.h> -#include "proplist.hxx" +#include <layout/core/proplist.hxx> namespace layoutimpl { @@ -156,4 +157,4 @@ protected: } // namespace layoutimpl -#endif // CORE_ROOT_HXX +#endif /* LAYOUT_CORE_ROOT_HXX */ diff --git a/toolkit/source/layout/table.cxx b/toolkit/source/layout/core/table.cxx index c172f71d5ff1..f8b2639c2258 100644 --- a/toolkit/source/layout/table.cxx +++ b/toolkit/source/layout/core/table.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: table.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -79,7 +79,7 @@ Table::Table() Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) : Box_Base::ChildData( xChild ) -// , mbExpand( { 0, 1 } ) +// , mbExpand( { 1, 1 } ) , mnColSpan( 1 ) , mnRowSpan( 1 ) , mnLeftCol( 0 ) @@ -87,7 +87,7 @@ Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xCh , mnTopRow( 0 ) , mnBottomRow( 0 ) { - mbExpand[ 0 ] = 0; + mbExpand[ 0 ] = 1; mbExpand[ 1 ] = 1; } @@ -139,7 +139,7 @@ Table::getMinimumSize() throw( uno::RuntimeException ) col = 0; row++; - unsigned int i = col + ( row*mnColsLen ); + unsigned int i = col +( row*mnColsLen ); while ( aTable.size() > i && !aTable[ i ] ) i++; diff --git a/toolkit/source/layout/table.hxx b/toolkit/source/layout/core/table.hxx index eb0d81e9a81b..f4fd70d0a1f9 100644 --- a/toolkit/source/layout/table.hxx +++ b/toolkit/source/layout/core/table.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: table.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,10 +29,10 @@ * ************************************************************************/ -#ifndef TABLE_HXX -#define TABLE_HXX +#ifndef LAYOUT_CORE_TABLE_HXX +#define LAYOUT_CORE_TABLE_HXX -#include "box-base.hxx" +#include <layout/core/box-base.hxx> namespace layoutimpl { @@ -99,10 +99,8 @@ public: virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) throw(css::uno::RuntimeException) { return maRequisition.Height; } - - PROPHELPER_SET_INFO }; } // namespace layoutimpl -#endif /*TABLE_HXX*/ +#endif /* LAYOUT_CORE_TABLE_HXX */ diff --git a/toolkit/source/layout/timer.cxx b/toolkit/source/layout/core/timer.cxx index 8104bf79e470..0da0f2c2abee 100644 --- a/toolkit/source/layout/timer.cxx +++ b/toolkit/source/layout/core/timer.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: timer.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -101,12 +101,12 @@ public: // 1. remove duplications and children for ( ContainerList::iterator it = mxContainers.begin(); - it != mxContainers.end(); it++ ) + it != mxContainers.end(); it++ ) eraseChildren( it, mxContainers ); // 2. check damage extent for ( ContainerList::iterator it = mxContainers.begin(); - it != mxContainers.end(); it++ ) + it != mxContainers.end(); it++ ) { uno::Reference< awt::XLayoutContainer > xContainer = *it; while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) ) @@ -126,7 +126,7 @@ public: } // 3. force re-calculations - for( ContainerList::iterator it = mxContainers.begin(); + for ( ContainerList::iterator it = mxContainers.begin(); it != mxContainers.end(); it++ ) (*it)->allocateArea( (*it)->getAllocatedArea() ); } diff --git a/toolkit/source/layout/timer.hxx b/toolkit/source/layout/core/timer.hxx index 3cecd48359ab..b1d7c7597b2e 100644 --- a/toolkit/source/layout/timer.hxx +++ b/toolkit/source/layout/core/timer.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: timer.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,8 +29,8 @@ * ************************************************************************/ -#ifndef CORE_TIMER_HXX -#define CORE_TIMER_HXX +#ifndef LAYOUT_CORE_TIMER_HXX +#define LAYOUT_CORE_TIMER_HXX #include <com/sun/star/awt/XLayoutUnit.hpp> #include <cppuhelper/implbase1.hxx> @@ -50,4 +50,4 @@ public: } -#endif /*CORE_TIMER_HXX*/ +#endif /* LAYOUT_CORE_TIMER_HXX */ diff --git a/toolkit/source/layout/translate.cxx b/toolkit/source/layout/core/translate.cxx index 2a39f93c35a9..cca51632557b 100644 --- a/toolkit/source/layout/translate.cxx +++ b/toolkit/source/layout/core/translate.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: translate.cxx,v $ + * $RCSfile$ * - * $Revision: 1.4 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -33,7 +33,7 @@ #include <list> #if TEST_LAYOUT -#include <stdio.h> +#include <cstdio> #include "tools/getprocessworkingdir.hxx" #endif @@ -58,13 +58,13 @@ getLocaleSubdirList( lang::Locale const& rLocale ) { std::list<OUString> aSubdirs; aSubdirs.push_front( OUString::createFromAscii( "." ) ); - aSubdirs.push_front( OUString::createFromAscii( "en_US" ) ); + aSubdirs.push_front( OUString::createFromAscii( "en-US" ) ); if ( rLocale.Language.getLength() ) aSubdirs.push_front( rLocale.Language ); if ( rLocale.Country.getLength() ) { OUString aLocaleCountry = rLocale.Language - + OUString::createFromAscii( "_" ) + + OUString::createFromAscii( "-" ) + rLocale.Country; aSubdirs.push_front( aLocaleCountry ); if ( rLocale.Variant.getLength() ) @@ -93,9 +93,7 @@ getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs, i != aSubDirs.end(); i++ ) { String aFile = aDir + aSlash + *i + aSlash + aXMLName; -#if TEST_LAYOUT - printf( "testing: %s\n", OUSTRING_CSTR( aFile ) ); -#endif + OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) ); if ( fileExists( aFile ) ) return aFile; } @@ -129,9 +127,7 @@ readRightTranslation( OUString const& aXMLName ) aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName ); } -#if TEST_LAYOUT - printf( "FOUND:%s\n", OUSTRING_CSTR ( OUString (aXMLFile) ) ); -#endif /* TEST_LAYOUT */ + OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) ); return aXMLFile; } diff --git a/toolkit/source/layout/translate.hxx b/toolkit/source/layout/core/translate.hxx index ca59f5046d29..05043baa4fb6 100644 --- a/toolkit/source/layout/translate.hxx +++ b/toolkit/source/layout/core/translate.hxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: translate.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,8 +29,8 @@ * ************************************************************************/ -#ifndef CORE_TRANSLATE_HXX -#define CORE_TRANSLATE_HXX +#ifndef LAYOUT_CORE_TRANSLATE_HXX +#define LAYOUT_CORE_TRANSLATE_HXX namespace rtl { class OUString; @@ -41,4 +41,4 @@ namespace layoutimpl ::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName ); } // namespace layoutimpl -#endif /* CORE_TRANSLATE_HXX */ +#endif /* LAYOUT_CORE_TRANSLATE_HXX */ diff --git a/toolkit/source/layout/proplist.hxx b/toolkit/source/layout/core/vcl.cxx index 1e962cdf63c7..418229351084 100644 --- a/toolkit/source/layout/proplist.hxx +++ b/toolkit/source/layout/core/vcl.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: proplist.hxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -29,37 +29,42 @@ * ************************************************************************/ -#ifndef CORE_PROPLIST_HXX -#define CORE_PROPLIST_HXX +#include <vcl.hxx> -#include <list> -#include <com/sun/star/xml/input/XAttributes.hpp> +#include <sal/types.h> +#include <vcl/button.hxx> -#include <rtl/ustring.hxx> - -namespace layoutimpl +static PushButton* get_button (Dialog const* dialog, sal_uInt32 type) { + Window* child = dialog->GetWindow (WINDOW_FIRSTCHILD); + while (child) + { + if (child->GetType () == type) + return static_cast <PushButton*> (child); + child = child->GetWindow (WINDOW_NEXT); + } -namespace css = ::com::sun::star; - -typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList; - -void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes, - PropList &rProps, sal_Int32 nNamespace ); - -void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer, - PropList const& rProps); - -void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer, - rtl::OUString const& attr, rtl::OUString const& value ); - -long getAttributeProps( PropList &rProps ); -bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue); - + return 0; } -// Convert a rtl::OUString to a byte string. -#define OUSTRING_CSTR( str ) \ - rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr() +#define IMPLEMENT_CLOSING_DIALOG(cls)\ + Closing##cls::Closing##cls (Window* parent, WinBits bits)\ + : cls (parent, bits)\ + , mClosing (false)\ + {\ + }\ + BOOL Closing##cls::Close ()\ + {\ + if (mClosing)\ + EndDialog (false);\ + else if (PushButton *cancel = get_button (this, WINDOW_CANCELBUTTON))\ + cancel->Click ();\ + else if (PushButton *ok = get_button (this, WINDOW_OKBUTTON))\ + ok->Click ();\ + mClosing = true;\ + return false;\ + } -#endif // CORE_PROPLIST_HXX +IMPLEMENT_CLOSING_DIALOG (Dialog); +IMPLEMENT_CLOSING_DIALOG (ModelessDialog); +IMPLEMENT_CLOSING_DIALOG (ModalDialog); diff --git a/toolkit/source/layout/core/vcl.hxx b/toolkit/source/layout/core/vcl.hxx new file mode 100644 index 000000000000..d072fa4bf25e --- /dev/null +++ b/toolkit/source/layout/core/vcl.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 LAYOUT_CORE_VCL_HXX +#define LAYOUT_CORE_VCL_HXX + +#include <vcl/dialog.hxx> + +#define DECLARE_CLOSING_DIALOG(cls)\ + class Closing##cls : public cls\ + {\ + public:\ + bool mClosing;\ + Closing##cls (Window* parent, WinBits bits);\ + virtual BOOL Close ();\ + } + +DECLARE_CLOSING_DIALOG (Dialog); +DECLARE_CLOSING_DIALOG (ModalDialog); +DECLARE_CLOSING_DIALOG (ModelessDialog); + +#undef DECLARE_CLOSING_DIALOG + +#endif /* LAYOUT_CORE_VCL_HXX */ diff --git a/toolkit/source/layout/helper.cxx b/toolkit/source/layout/helper.cxx deleted file mode 100644 index b03de8394fee..000000000000 --- a/toolkit/source/layout/helper.cxx +++ /dev/null @@ -1,520 +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: helper.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. - * - ************************************************************************/ - -#include "helper.hxx" - -#include <assert.h> -#include <list> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <tools/debug.hxx> - -#include "proplist.hxx" -#include "layout/layoutcore.hxx" - -#if TEST_LAYOUT && !defined( DBG_UTIL ) -#include <stdio.h> -#undef DBG_ERROR -#define DBG_ERROR printf -#undef DBG_ERROR1 -#define DBG_ERROR1 printf -#undef DBG_ERROR2 -#define DBG_ERROR2 printf -#endif /* TEST_LAYOUT && !DBG_UTIL */ - -namespace layoutimpl -{ -using namespace com::sun::star; -using rtl::OUString; - -uno::Reference< awt::XWindowPeer > -getParent( uno::Reference< uno::XInterface > xRef ) -{ - do - { - uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY ); - if ( xPeer.is() ) - return xPeer; - - uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY ); - if ( xCont.is() ) - xRef = xCont->getParent(); - } - while ( xRef.is() ); - - return uno::Reference< awt::XWindowPeer >(); -} - -#if 0 -static uno::Reference< awt::XWindowPeer > -getToplevel( uno::Reference< uno::XInterface > xRef ) -{ - uno::Reference< awt::XWindowPeer > xTop, i; - while ( ( i = uno::Reference< awt::XWindowPeer >( xRef, uno::UNO_QUERY ) ).is() ) - { - xTop = i; - - uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY ); - if ( xCont.is() ) - xRef = xCont->getParent(); - else - xRef = uno::Reference< awt::XWindowPeer >(); - } - - return xTop; -} -#endif - -} - -#include "dialogbuttonhbox.hxx" -#include "bin.hxx" -#include "box.hxx" -#include "table.hxx" -#include "flow.hxx" - -namespace layoutimpl -{ - -static uno::Reference< awt::XLayoutConstrains > ImplCreateWindow( - uno::Reference< uno::XInterface > xParent, - OUString aName, long WindowAttributes ); - -uno::Reference< awt::XLayoutContainer > -createContainer( const OUString &rName ) -{ - uno::Reference< awt::XLayoutContainer > xPeer; - - if ( rName.equalsAscii( "hbox" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() ); - else if ( rName.equalsAscii( "vbox" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() ); - else if ( rName.equalsAscii( "table" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Table() ); - else if ( rName.equalsAscii( "flow" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() ); - else if ( rName.equalsAscii( "bin" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() ); - else if ( rName.equalsAscii( "min-size" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() ); - else if ( rName.equalsAscii( "align" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Align() ); - else if ( rName.equalsAscii( "dialogbuttonhbox" ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() ); - - return xPeer; -} - -static uno::Reference< awt::XLayoutConstrains > -createToolkitWidget( uno::Reference< awt::XToolkit > xToolkit, - uno::Reference< uno::XInterface > xParent, - const OUString &rName, long nProps ) -{ - uno::Reference< awt::XLayoutConstrains > xPeer; - bool bToplevel = !xParent.is(); - - // UNO Control Widget - awt::WindowDescriptor desc; - if ( bToplevel ) - desc.Type = awt::WindowClass_TOP; - else - { - desc.Type = awt::WindowClass_SIMPLE; - - // top container -- a wrapper for framewindow -- is de-coupled - // from awt::XWindowPeer. So, getParent() fails at it. -// uno::Reference< awt::XWindowPeer > xWinParent = getParent( xParent ); - - uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY ); - - assert( xParent.is() ); - assert( xWinParent.is() ); - desc.Parent = xWinParent; - } - - desc.ParentIndex = 0; - // debugging help ... - desc.Bounds.X = 0; - desc.Bounds.Y = 0; - desc.Bounds.Width = 300; - desc.Bounds.Height = 200; - - desc.WindowAttributes = nProps; - desc.WindowServiceName = rName; - - uno::Reference< awt::XWindowPeer > xWinPeer; - try - { -// DBG_ERROR1("Asking toolkit: %s\n", OUSTRING_CSTR( desc.WindowServiceName ) ); - xWinPeer = xToolkit->createWindow( desc ); - if ( !xWinPeer.is() ) - throw uno::RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ), - uno::Reference< uno::XInterface >() ); - xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY ); - } - catch( uno::Exception & ) - { - DBG_ERROR1( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( rName ) ); - return uno::Reference< awt::XLayoutConstrains >(); - } - - // default to visible, let then people change it on properties - if ( ! bToplevel ) - { - uno::Reference< awt::XWindow> xWindow( xPeer, uno::UNO_QUERY ); - if ( xWindow.is() ) - xWindow->setVisible( true ); - } - return xPeer; -} - -uno::Reference< awt::XLayoutConstrains > -createWidget( uno::Reference< awt::XToolkit > xToolkit, - uno::Reference< uno::XInterface > xParent, - const OUString &rName, long nProps ) -{ - uno::Reference< awt::XLayoutConstrains > xPeer; - - xPeer = uno::Reference< awt::XLayoutConstrains >( - createContainer( rName ), uno::UNO_QUERY ); - if ( xPeer.is() ) - return xPeer; - - xPeer = ImplCreateWindow( xParent, rName, nProps ); - if ( xPeer.is() ) - return xPeer; - -#if FIXED_INFO - OUString tName = rName; - // FIXME - if ( rName.equalsAscii( "fixedinfo" ) ) - tName = OUString::createFromAscii( "fixedtext" ); - xPeer = createToolkitWidget( xToolkit, xParent, tName, nProps ); -#else - xPeer = createToolkitWidget( xToolkit, xParent, rName, nProps ); -#endif - return xPeer; -} - -PropHelper::PropHelper() : LockHelper() - , cppu::OPropertySetHelper( maBrdcstHelper ) - , pHelper( NULL ) -{ -} - -void -PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e, - uno::Type aType, void *pPtr) -{ - // this sucks rocks for effiency ... - PropDetails aDetails; - aDetails.aName = rtl::OUString::intern( pName, nNameLen, e ); - aDetails.aType = aType; - aDetails.pValue = pPtr; - maDetails.push_back( aDetails ); -} - -cppu::IPropertyArrayHelper & SAL_CALL -PropHelper::getInfoHelper() -{ - if ( ! pHelper ) - { - uno::Sequence< beans::Property > aProps( maDetails.size() ); - for ( unsigned int i = 0; i < maDetails.size(); i++) - { - aProps[i].Name = maDetails[i].aName; - aProps[i].Type = maDetails[i].aType; - aProps[i].Handle = i; - aProps[i].Attributes = 0; - } - pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ ); - - } - return *pHelper; -} - -sal_Bool SAL_CALL -PropHelper::convertFastPropertyValue( - uno::Any & rConvertedValue, - uno::Any & rOldValue, - sal_Int32 nHandle, - const uno::Any& rValue ) - throw (lang::IllegalArgumentException) -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - - // FIXME: no Any::getValue ... - getFastPropertyValue( rOldValue, nHandle ); - if ( rOldValue != rValue ) - { - rConvertedValue = rValue; - return sal_True; // changed - } - else - { - rConvertedValue.clear(); - rOldValue.clear(); - } - return sal_False; -} - - -void SAL_CALL -PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const uno::Any& rValue ) - throw (uno::Exception) -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - - const PropDetails &rInfo = maDetails[ nHandle ]; - - uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(), - rValue.pData, rValue.pType, - 0, 0, 0 ); - - if ( mpListener ) - mpListener->propertiesChanged(); -} - -void SAL_CALL -PropHelper::getFastPropertyValue( uno::Any& rValue, - sal_Int32 nHandle ) const -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - const PropDetails &rInfo = maDetails[ nHandle ]; -#if 0 - switch ( rInfo.aType.getTypeClass() ) - { -#define MAP(classtype,ctype) \ - case uno::TypeClass_##classtype: \ - rValue <<= *(ctype *)(rInfo.pValue); \ - break - MAP( DOUBLE, double ); - MAP( SHORT, sal_Int16 ); - MAP( LONG, sal_Int32 ); - MAP( UNSIGNED_SHORT, sal_uInt16 ); - MAP( UNSIGNED_LONG, sal_uInt32 ); - MAP( STRING, ::rtl::OUString ); - default: - DBG_ERROR( "ERROR: unknown type to map!" ); - break; - } -#undef MAP -#endif - rValue.setValue( rInfo.pValue, rInfo.aType ); -} - -::com::sun::star::uno::Any -PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - return OPropertySetHelper::queryInterface( rType ); -} - -} // namespace layoutimpl - -#include <awt/vclxbutton.hxx> -#include <awt/vclxdialog.hxx> -#include <awt/vclxfixedline.hxx> -#include <awt/vclxscroller.hxx> -#include <awt/vclxsplitter.hxx> -#include <awt/vclxtabcontrol.hxx> -#include <toolkit/awt/vclxtoolkit.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/tabpage.hxx> - - -///#include <svtools/prgsbar.hxx> - -namespace layoutimpl -{ - -uno::Reference< awt::XLayoutConstrains > ImplCreateWindow( - uno::Reference< uno::XInterface > xParent, - OUString aName, long WindowAttributes ) -{ - VCLXWindow *pNewComp = NULL; - Window *pNewWindow = NULL; - Window *pParent = NULL; - uno::Reference< awt::XLayoutConstrains > xRef; - - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xParent ); - if ( pParentComponent ) - pParent = pParentComponent->GetWindow(); - - if ( aName.equalsAscii( "dialog" ) ) - { - if ( pParent == NULL ) - pParent = DIALOG_NO_PARENT; - pNewWindow = new Dialog( pParent, - ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXDialog(); - - WindowAttributes ^= awt::WindowAttribute::SHOW; - } - else if ( aName.equalsAscii( "modaldialog" ) ) - { - if ( pParent == NULL ) - pParent = DIALOG_NO_PARENT; - pNewWindow = new ModalDialog( pParent, - ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXDialog(); - - WindowAttributes ^= awt::WindowAttribute::SHOW; - } - else if ( aName.equalsAscii( "tabcontrol" ) ) - { - pNewWindow = new TabControl( pParent, - ImplGetWinBits( WindowAttributes, WINDOW_TABCONTROL ) ); - pNewComp = new layoutimpl::VCLXTabControl(); - } - else if ( aName.equalsAscii( "scroller" ) ) - { - // used FixedImage because I just want some empty non-intrusive widget - pNewWindow = new FixedImage( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXScroller(); - } - else if ( aName.equalsAscii( "hsplitter" ) || aName.equalsAscii( "vsplitter" ) ) - { - pNewWindow = new FixedImage( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXSplitter( aName.equalsAscii( "hsplitter" ) ); - } - else if ( aName.equalsAscii( "hfixedline" ) || aName.equalsAscii( "vfixedline" ) ) - { - WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 ); - nStyle ^= WB_HORZ; - if ( aName.equalsAscii( "hfixedline" ) ) - nStyle |= WB_HORZ; - else - nStyle |= WB_VERT; - pNewWindow = new FixedLine( pParent, nStyle ); - pNewComp = new layoutimpl::VCLXFixedLine(); - } - else if ( aName.equalsAscii( "okbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXOKButton( pNewWindow ); - } - else if ( aName.equalsAscii( "cancelbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXCancelButton( pNewWindow ); - } - else if ( aName.equalsAscii( "yesbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXYesButton( pNewWindow ); - } - else if ( aName.equalsAscii( "nobutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXNoButton( pNewWindow ); - } - else if ( aName.equalsAscii( "retrybutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXRetryButton( pNewWindow ); - } - else if ( aName.equalsAscii( "ignorebutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXIgnoreButton( pNewWindow ); - } - else if ( aName.equalsAscii( "resetbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXResetButton( pNewWindow ); - } - else if ( aName.equalsAscii( "applybutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXApplyButton( pNewWindow ); - } - else if ( aName.equalsAscii( "helpbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXHelpButton( pNewWindow ); - } - else if ( aName.equalsAscii( "morebutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXMoreButton( pNewWindow ); - } - else if ( aName.equalsAscii( "advancedbutton" ) ) - { - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) ); - pNewComp = new layoutimpl::VCLXAdvancedButton( pNewWindow ); - } - - if ( !pNewWindow ) - return xRef; - - pNewWindow->SetCreatedWithToolkit( sal_True ); - pNewComp->SetCreatedWithToolkit( TRUE ); - xRef = pNewComp; - pNewWindow->SetComponentInterface( pNewComp ); - if ( WindowAttributes & awt::WindowAttribute::SHOW ) - pNewWindow->Show(); - - return xRef; -} - -} // namespace layoutimpl - -// Avoid polluting the rest of the code with vcl linkage pieces ... - -#include <vcl/imagerepository.hxx> -#include <vcl/bitmapex.hxx> -#include <vcl/graph.hxx> - -namespace layoutimpl -{ - -uno::Reference< graphic::XGraphic > loadGraphic( const char *pName ) -{ - BitmapEx aBmp; - - OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ); - if ( aStr.compareToAscii( ".uno:" ) == 0 ) - aStr = aStr.copy( 5 ).toAsciiLowerCase(); - - if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) ) - return uno::Reference< graphic::XGraphic >(); - - return Graphic( aBmp ).GetXGraphic(); -} - -} // namespace layoutimpl diff --git a/toolkit/source/vclcompat/makefile.mk b/toolkit/source/layout/vcl/makefile.mk index a4405e186508..a6cc754efa1b 100644 --- a/toolkit/source/vclcompat/makefile.mk +++ b/toolkit/source/layout/vcl/makefile.mk @@ -6,9 +6,9 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# $RCSfile$ # -# $Revision: 1.3 $ +# $Revision$ # # This file is part of OpenOffice.org. # @@ -29,9 +29,9 @@ # #************************************************************************* -PRJ=..$/.. +PRJ=../../.. PRJNAME=toolkit -TARGET=vclcompat +TARGET=layout-vcl ENABLE_EXCEPTIONS=true # --- Settings ----------------------------------------------------- @@ -39,10 +39,11 @@ ENABLE_EXCEPTIONS=true .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk -# --- Files -------------------------------------------------------- +.IF "$(COMNAME)" == "gcc3" +CFLAGS+=-Wall -fno-default-inline +.ENDIF -# FIXME: This is bad, hmkay -CFLAGS+= -I$(PRJ)/source +# --- Files -------------------------------------------------------- SLOFILES= \ $(SLO)$/wrapper.obj \ diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx new file mode 100644 index 000000000000..0b8b41299315 --- /dev/null +++ b/toolkit/source/layout/vcl/wbutton.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$ + * + * $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 "wrapper.hxx" + +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XRadioButton.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxwindows.hxx> +#include <toolkit/helper/convert.hxx> +#include <vcl/button.hxx> +#include <vcl/event.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/window.hxx> + +#include <list> + +#include <layout/core/helper.hxx> + +using namespace ::com::sun::star; + +using rtl::OUString; + +namespace layout +{ + +class ImageImpl +{ + public: + uno::Reference< graphic::XGraphic > mxGraphic; + ImageImpl( const char *pName ) + : mxGraphic( layoutimpl::loadGraphic( pName ) ) + { + if ( !mxGraphic.is() ) + { + DBG_ERROR1( "ERROR: failed to load image: `%s'\n", pName ); + } + } +}; + +Image::Image( const char *pName ) + : pImpl( new ImageImpl( pName ) ) +{ +} + +Image::~Image() +{ + delete pImpl; +} + +class ButtonImpl : public ControlImpl + , public ::cppu::WeakImplHelper1< awt::XActionListener > +{ + Link maClickHdl; + +public: + uno::Reference< awt::XButton > mxButton; + ButtonImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + , mxButton( peer, uno::UNO_QUERY ) + { + /* We have default action when clicked, always listen. */ + mxButton->addActionListener( this ); + } + + ~ButtonImpl() + { + } + + virtual void Click() { /* make me pure virtual? */ }; + + Link& GetClickHdl () + { + return maClickHdl; + } + + virtual void SetClickHdl( Link const& link ) + { + maClickHdl = link; + } + + void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + mxButton->removeActionListener( this ); + ControlImpl::disposing (e); + mxButton.clear (); + } + + virtual void SAL_CALL actionPerformed( const awt::ActionEvent& ) + throw (uno::RuntimeException) + { + if ( !maClickHdl ) + Click(); + else + maClickHdl.Call( static_cast<Window *>( mpWindow ) ); + } + + bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph ) + { + setProperty( "Graphic", uno::Any( xGraph ) ); + return true; + } +}; + +Button::~Button () +{ +} + +String Button::GetStandardText (sal_uInt16 button_type) +{ + return ::Button::GetStandardText (button_type); +} + +void Button::SetText( OUString const& rStr ) +{ + if ( !getImpl().mxButton.is() ) + return; + getImpl().mxButton->setLabel( rStr ); +} + +void Button::SetClickHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxButton.is ()) + getImpl().SetClickHdl( link ); +} + +Link& Button::GetClickHdl () +{ + return getImpl().GetClickHdl (); +} + +bool Button::SetModeImage (Image const& image) +{ + return getImpl().SetModeImage (image.getImpl().mxGraphic); +} + +bool Button::SetModeImage (::Image const& image, BmpColorMode mode) +{ + return GetButton ()->SetModeImage (image, mode); +} + +void Button::SetImageAlign( ImageAlign eAlign ) +{ + getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) ); +} + +void Button::Click() +{ +} + +IMPL_GET_IMPL( Button ); +IMPL_CONSTRUCTORS( Button, Control, "button" ); +IMPL_GET_WINDOW (Button); + +class PushButtonImpl : public ButtonImpl + , public ::cppu::WeakImplHelper1< awt::XItemListener > +{ + Link maToggleHdl; +public: + PushButtonImpl( Context *context, const PeerHandle &peer, Window *window ) + : ButtonImpl( context, peer, window ) + { + } + + void SetToggleHdl( const Link& link ) + { + // XButton doesn't have an explicit event for Toggle. Anyway, it is a + // superset of the clicks: all clicks, and explicit toggles + if (!link && !!maToggleHdl) + mxButton->removeActionListener( this ); + else if (!!link && !maToggleHdl) + mxButton->addActionListener( this ); + maToggleHdl = link; + } + void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + ButtonImpl::disposing (e); + } + virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e ) + throw (uno::RuntimeException) + { + ButtonImpl::actionPerformed( e ); + fireToggle(); + } + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) + throw (uno::RuntimeException) + { + maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); + } + void fireToggle() + { + maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); + } + +}; + +PushButton::~PushButton () +{ + SetToggleHdl (Link ()); +} + +void PushButton::Check( bool bCheck ) +{ + getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) ); + // XButton doesn't have explicit toggle event + getImpl().fireToggle(); +} + +bool PushButton::IsChecked() const +{ + return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() ); +} + +void PushButton::Toggle() +{ + Check( true ); +} + +void PushButton::SetToggleHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxButton.is ()) + getImpl().SetToggleHdl( link ); +} + +IMPL_GET_IMPL( PushButton ); +IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" ); +IMPL_GET_WINDOW (PushButton); + +class RadioButtonImpl : public ButtonImpl + , public ::cppu::WeakImplHelper1< awt::XItemListener > +{ + Link maToggleHdl; +public: + uno::Reference< awt::XRadioButton > mxRadioButton; + RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window ) + : ButtonImpl( context, peer, window ) + , mxRadioButton( peer, uno::UNO_QUERY ) + { + } + + void Check( bool bCheck ) + { + if ( !mxRadioButton.is() ) + return; + +#if 1 + // Have setState fire item event for + // RadioGroups::RadioGroup::itemStateChanged () + ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton (); + bool state = r->IsRadioCheckEnabled (); + r->EnableRadioCheck(); + mxRadioButton->setState( !!bCheck ); + r->EnableRadioCheck (state); +#else + mxRadioButton->setState( !!bCheck ); +#endif + fireToggle(); + } + + bool IsChecked() + { + if ( !mxRadioButton.is() ) + return false; + return mxRadioButton->getState(); + } + + void SetToggleHdl( const Link& link ) + { + if (!link && !!maToggleHdl) + mxRadioButton->removeItemListener( this ); + else if (!!link && !maToggleHdl) + mxRadioButton->addItemListener( this ); + maToggleHdl = link; + } + + inline void fireToggle() + { + maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); + } + + virtual void SetClickHdl( const Link& link ) + { + // Keep RadioGroups::RadioGroup's actionListener at HEAD + // of list. This way, it can handle RadioGroup's button + // states before all other callbacks and make sure the + // client code has the right state. + + // IWBN to add an XRadioButton2 and layout::VCLXRadioButton + // with {get,set}RadioGroup() (and a "radiogroup" property + // even) and handle the grouping here in RadioButtonImpl. + uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener (); + uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY ); + mxButton->removeActionListener (a); + ButtonImpl::SetClickHdl (link); + mxButton->addActionListener (a); + } + + void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + ButtonImpl::disposing (e); + } + + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) + throw (uno::RuntimeException) + { + maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); + } +}; + +RadioButton::~RadioButton () +{ + SetToggleHdl (Link ()); +} + +void RadioButton::Check( bool bCheck ) +{ + getImpl().Check( bCheck ); +} + +bool RadioButton::IsChecked() const +{ + return getImpl().IsChecked(); +} + +void RadioButton::SetToggleHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxRadioButton.is ()) + getImpl().SetToggleHdl( link ); +} + +IMPL_GET_IMPL( RadioButton ); +IMPL_GET_WINDOW( RadioButton ); +IMPL_GET_VCLXWINDOW( RadioButton ); +IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" ); + +class CheckBoxImpl : public ButtonImpl + , public ::cppu::WeakImplHelper1< awt::XItemListener > +{ + Link maToggleHdl; + public: + uno::Reference< awt::XCheckBox > mxCheckBox; + CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window ) + : ButtonImpl( context, peer, window ) + , mxCheckBox( peer, uno::UNO_QUERY ) + { + } + + void SetToggleHdl( const Link& link ) + { + if (!link && !!maToggleHdl) + mxCheckBox->removeItemListener( this ); + else if (!!link && !maToggleHdl) + mxCheckBox->addItemListener( this ); + maToggleHdl = link; + } + void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + ButtonImpl::disposing (e); + } + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) + throw (uno::RuntimeException) + { + maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); + } +}; + +CheckBox::~CheckBox () +{ + SetToggleHdl (Link ()); +} + +void CheckBox::Check( bool bCheck ) +{ + if ( !getImpl().mxCheckBox.is() ) + return; + getImpl().mxCheckBox->setState( !!bCheck ); +} + +bool CheckBox::IsChecked() const +{ + if ( !getImpl().mxCheckBox.is() ) + return false; + return getImpl().mxCheckBox->getState() != 0; +} + +void CheckBox::SetToggleHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxCheckBox.is ()) + getImpl().SetToggleHdl( link ); +} + +IMPL_GET_IMPL( CheckBox ); +IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" ); + +#define BUTTON_IMPL(t, parent, response) \ + class t##Impl : public parent##Impl \ + { \ + public: \ + t##Impl( Context *context, PeerHandle const& peer, Window *window ) \ + : parent##Impl( context, peer, window ) \ + { \ + } \ + void Click() \ + { \ + if (Dialog *d = static_cast<Dialog *> (mpCtx)) \ + d->EndDialog( response ); \ + } \ + } + +/* Common button types currently unavailable in OOo: */ +/* mpReset */ +/* mpApply */ +/* mpAction */ +#define RET_RESET 6 +#define RET_APPLY 7 +#define BUTTONID_RESET RET_RESET +#define BUTTONID_APPLY RET_APPLY + +BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK ); +BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL ); +BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES ); +BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO ); +BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY ); +BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE ); +BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET ); +BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */ +BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP ); + +IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" ); +IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" ); +IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" ); +IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" ); +IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" ); +IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" ); +IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" ); +IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */ +IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" ); + +IMPL_IMPL (ImageButton, PushButton) + + +IMPL_CONSTRUCTORS( ImageButton, PushButton, "imagebutton" ); + +class AdvancedButtonImpl : public PushButtonImpl +{ +protected: + bool bAdvancedMode; + std::list< Window*> maAdvanced; + std::list< Window*> maSimple; + +public: + rtl::OUString mAdvancedLabel; + rtl::OUString mSimpleLabel; + +protected: + Window* Remove( std::list< Window*> lst, Window* w ) + { + for ( std::list< Window*>::iterator it = maAdvanced.begin(); + it != maAdvanced.end(); it++ ) + if ( *it == w ) + { + lst.erase( it ); + return *it; + } + return 0; + } + +public: + AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window ) + : PushButtonImpl( context, peer, window ) + , bAdvancedMode( false ) + // TODO: i18n + // Button::GetStandardText( BUTTON_ADVANCED ); + // Button::GetStandardText( BUTTON_SIMPLE ); + , mAdvancedLabel( rtl::OUString::createFromAscii( "Advanced..." ) ) + , mSimpleLabel( rtl::OUString::createFromAscii( "Simple..." ) ) + { + } + void Click() + { + bAdvancedMode = !bAdvancedMode; + if ( bAdvancedMode ) + advancedMode(); + else + simpleMode(); + } + void setAlign () + { + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); + b->SetSymbolAlign (SYMBOLALIGN_RIGHT); + b->SetSmallSymbol (); + //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER); + } + void advancedMode() + { + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); + b->SetSymbol (SYMBOL_PAGEUP); + setAlign (); + if (mSimpleLabel.getLength ()) + b->SetText (mSimpleLabel); + for ( std::list< Window*>::iterator it = maAdvanced.begin(); + it != maAdvanced.end(); it++ ) + ( *it )->Show(); + for ( std::list< Window*>::iterator it = maSimple.begin(); + it != maSimple.end(); it++ ) + ( *it )->Hide(); + + redraw (); + } + void simpleMode() + { + //mxButton->setLabel( mSimpleLabel ); + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); + b->SetSymbol (SYMBOL_PAGEDOWN); + if (mAdvancedLabel.getLength ()) + b->SetText (mAdvancedLabel); + setAlign (); + for ( std::list< Window*>::iterator it = maAdvanced.begin(); + it != maAdvanced.end(); it++ ) + ( *it )->Hide(); + for ( std::list< Window*>::iterator it = maSimple.begin(); + it != maSimple.end(); it++ ) + ( *it )->Show(); + + redraw (true); + } + void AddAdvanced( Window* w ) + { + maAdvanced.push_back( w ); + if ( !bAdvancedMode ) + w->Hide(); + } + void AddSimple( Window* w ) + { + maSimple.push_back( w ); + if ( bAdvancedMode ) + w->Hide(); + } + void RemoveAdvanced( Window* w ) + { + Remove( maAdvanced, w ); + } + void RemoveSimple( Window* w ) + { + Remove( maSimple, w ); + } +}; + +void AdvancedButton::AddAdvanced( Window* w ) +{ + getImpl().AddAdvanced( w ); +} + +void AdvancedButton::AddSimple( Window* w ) +{ + getImpl().AddSimple( w ); +} + +void AdvancedButton::RemoveAdvanced( Window* w ) +{ + getImpl().RemoveAdvanced( w ); +} + +void AdvancedButton::RemoveSimple( Window* w ) +{ + getImpl().RemoveSimple( w ); +} + +void AdvancedButton::SetAdvancedText (rtl::OUString const& text) +{ + if (text.getLength ()) + getImpl ().mAdvancedLabel = text; +} + +void AdvancedButton::SetSimpleText (rtl::OUString const& text) +{ + if (text.getLength ()) + getImpl ().mSimpleLabel = text; +} + +rtl::OUString AdvancedButton::GetAdvancedText () const +{ + return getImpl ().mAdvancedLabel; +} + +rtl::OUString AdvancedButton::GetSimpleText () const +{ + return getImpl ().mSimpleLabel; +} + +void AdvancedButton::SetDelta (int) +{ +} + +IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () ); +IMPL_GET_IMPL( AdvancedButton ); + + +class MoreButtonImpl : public AdvancedButtonImpl +{ +public: + MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window ) + : AdvancedButtonImpl( context, peer, window) + { + mSimpleLabel = Button::GetStandardText( BUTTON_MORE ); + mAdvancedLabel = Button::GetStandardText( BUTTON_LESS ); + } + void AddWindow( Window* w ) { AddAdvanced( w ); } + void RemoveWindow( Window* w ) { RemoveAdvanced( w ); } +}; + +// TODO +//BUTTON_IMPL( MoreButton, PushButton, 0 ); +IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () ); +IMPL_GET_IMPL( MoreButton ); + +void MoreButton::AddWindow( Window* w ) +{ + getImpl().AddWindow( w ); +} + +void MoreButton::RemoveWindow( Window* w ) +{ + getImpl().RemoveWindow( w ); +} + +void MoreButton::SetMoreText (rtl::OUString const& text) +{ + SetAdvancedText (text); +} + +void MoreButton::SetLessText (rtl::OUString const& text) +{ + SetSimpleText (text); +} + +rtl::OUString MoreButton::GetMoreText () const +{ + return GetAdvancedText (); +} + +rtl::OUString MoreButton::GetLessText () const +{ + return GetSimpleText (); +} + +} // namespace layout diff --git a/toolkit/source/vclcompat/wcontainer.cxx b/toolkit/source/layout/vcl/wcontainer.cxx index 5fed9c34cc24..e4f5a92f69e0 100644 --- a/toolkit/source/vclcompat/wcontainer.cxx +++ b/toolkit/source/layout/vcl/wcontainer.cxx @@ -6,9 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: wcontainer.cxx,v $ + * $RCSfile$ * - * $Revision: 1.3 $ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -31,12 +31,10 @@ #include "wrapper.hxx" -#include "layout/layoutcore.hxx" #include <com/sun/star/awt/XLayoutRoot.hpp> #include <com/sun/star/awt/XLayoutContainer.hpp> - #include <comphelper/processfactory.hxx> - +#include <layout/core/helper.hxx> #include <tools/debug.hxx> using namespace ::com::sun::star; @@ -44,8 +42,8 @@ using namespace ::com::sun::star; namespace layout { -Container::Container( Context const* pCtx, char const* pId ) - : mxContainer( pCtx->GetPeerHandle( pId ), uno::UNO_QUERY ) +Container::Container( Context const* context, char const* pId ) + : mxContainer( context->GetPeerHandle( pId ), uno::UNO_QUERY ) { if ( !mxContainer.is() ) { @@ -55,7 +53,7 @@ Container::Container( Context const* pCtx, char const* pId ) Container::Container( rtl::OUString const& rName, sal_Int32 nBorder ) { - mxContainer = layoutimpl::createContainer( rName ); + mxContainer = layoutimpl::WidgetFactory::createContainer( rName ); uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW ); xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ), @@ -102,8 +100,8 @@ void Container::Clear() { css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children; children = mxContainer->getChildren(); - for ( int i = 0; i < children.getLength(); i++ ) - mxContainer->removeChild( children[ i ] ); + for (int i = 0; i < children.getLength(); i++) + mxContainer->removeChild( children[i] ); } void Container::ShowAll( bool bShow ) @@ -117,7 +115,7 @@ void Container::ShowAll( bool bShow ) { uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren; aChildren = xCont->getChildren(); - for ( int i = 0; i < aChildren.getLength(); i++ ) + for (int i = 0; i < aChildren.getLength(); i++) { uno::Reference < awt::XLayoutConstrains > xChild( aChildren[ i ] ); @@ -154,12 +152,12 @@ Table::Table( sal_Int32 nBorder, sal_Int32 nColumns ) uno::Any( nColumns ) ); } -void Table::Add( Window *pWindow, bool bXExpand, bool bYExpand, +void Table::Add( Window *window, bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan ) { - if ( !pWindow ) + if ( !window ) return; - WindowImpl &rImpl = pWindow->getImpl(); + WindowImpl &rImpl = window->getImpl(); uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow, uno::UNO_QUERY ); mxContainer->addChild( xChild ); @@ -200,11 +198,11 @@ Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous ) uno::Any( bHomogeneous ) ); } -void Box::Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding) +void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding) { - if ( !pWindow ) + if ( !window ) return; - WindowImpl &rImpl = pWindow->getImpl(); + WindowImpl &rImpl = window->getImpl(); uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow, uno::UNO_QUERY ); @@ -237,13 +235,13 @@ void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild, uno::Any( nPadding ) ); } -Table::Table( Context const* pCtx, char const* pId ) - : Container( pCtx, pId ) +Table::Table( Context const* context, char const* pId ) + : Container( context, pId ) { } -Box::Box( Context const* pCtx, char const* pId ) - : Container( pCtx, pId ) +Box::Box( Context const* context, char const* pId ) + : Container( context, pId ) { } @@ -253,8 +251,8 @@ HBox::HBox( sal_Int32 nBorder, bool bHomogeneous ) { } -HBox::HBox( Context const* pCtx, char const* pId ) - : Box( pCtx, pId ) +HBox::HBox( Context const* context, char const* pId ) + : Box( context, pId ) { } @@ -264,8 +262,8 @@ VBox::VBox( sal_Int32 nBorder, bool bHomogeneous ) { } -VBox::VBox( Context const* pCtx, char const* pId ) - : Box( pCtx, pId ) +VBox::VBox( Context const* context, char const* pId ) + : Box( context, pId ) { } diff --git a/toolkit/source/layout/vcl/wfield.cxx b/toolkit/source/layout/vcl/wfield.cxx new file mode 100644 index 000000000000..281d909530b0 --- /dev/null +++ b/toolkit/source/layout/vcl/wfield.cxx @@ -0,0 +1,796 @@ +/************************************************************************* + * + * 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 "wrapper.hxx" + +#include <comphelper/processfactory.hxx> +#include <com/sun/star/awt/XMetricField.hpp> +#include <com/sun/star/awt/XNumericField.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XMouseListener.hpp> +#include <vcl/combobox.hxx> +#include <vcl/lstbox.hxx> + +#include <toolkit/awt/vclxwindows.hxx> + +using namespace ::com::sun::star; +using rtl::OUString; + +#define LAYOUT_API_CALLS_HANDLER 0 + +namespace layout +{ + +class EditImpl : public ControlImpl + , public ::cppu::WeakImplHelper1< awt::XTextListener > +{ +public: + Link maModifyHdl; + + uno::Reference< awt::XTextComponent > mxEdit; + EditImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + , mxEdit( peer, uno::UNO_QUERY ) + { + } + + ~EditImpl (); + + virtual void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException); + + virtual void SetModifyHdl( Link const& link ); + + void SAL_CALL textChanged( const awt::TextEvent& /* rEvent */ ) + throw (uno::RuntimeException) + { + maModifyHdl.Call( mpWindow ); + } +}; + +EditImpl::~EditImpl () +{ +} + +void SAL_CALL EditImpl::disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) +{ + ControlImpl::disposing (e); + mxEdit.clear (); +} + +void EditImpl::SetModifyHdl( Link const& link ) +{ + if (!link && !!maModifyHdl) + mxEdit->removeTextListener( this ); + else if (!!link && !maModifyHdl) + mxEdit->addTextListener( this ); + maModifyHdl = link; +} + +Edit::~Edit () +{ + SetModifyHdl (Link ()); +} + +void Edit::SetSelection( Selection const& rSelection ) +{ +#if LAYOUT_API_CALLS_HANDLER + if ( !getImpl().mxEdit.is() ) + getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) ); +#else /* !LAYOUT_API_CALLS_HANDLER */ + GetEdit ()->SetSelection (rSelection); +#endif /* !LAYOUT_API_CALLS_HANDLER */ +} + +void Edit::SetText( OUString const& rStr ) +{ +#if LAYOUT_API_CALLS_HANDLER + if ( getImpl().mxEdit.is() ) + /// this calls handlers; endless loop in numfmt.cxx + getImpl().mxEdit->setText( rStr ); +#else /* !LAYOUT_API_CALLS_HANDLER */ + GetEdit ()->SetText (rStr); +#endif /* !LAYOUT_API_CALLS_HANDLER */ +} + +String Edit::GetText() const +{ + if ( !getImpl().mxEdit.is() ) + return getImpl().mxEdit->getText(); + return OUString(); +} + +void Edit::SetModifyHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxEdit.is ()) + getImpl().SetModifyHdl( link ); +} + +IMPL_CONSTRUCTORS( Edit, Control, "edit" ); +IMPL_GET_IMPL( Edit ); +IMPL_GET_WINDOW (Edit); + +class MultiLineEditImpl : public EditImpl +{ +public: + MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window ) + : EditImpl( context, peer, window ) + { + } +}; + +IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" ); +IMPL_GET_IMPL( MultiLineEdit ); + +class SpinFieldImpl : public EditImpl +{ + public: + SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window ) + : EditImpl( context, peer, window ) + { + } +}; + +IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" ); + +class NumericFieldImpl : public SpinFieldImpl +{ + public: + NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window ) + : SpinFieldImpl( context, peer, window ) + { + } +}; + +class MetricFieldImpl : public SpinFieldImpl +{ + public: + MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window ) + : SpinFieldImpl( context, peer, window ) + { + } +}; + +IMPL_GET_IMPL( SpinField ); +IMPL_GET_IMPL( NumericField ); +IMPL_GET_IMPL( MetricField ); + +class FormatterBaseImpl +{ + protected: + PeerHandle mpeer; + public: + explicit FormatterBaseImpl( const PeerHandle &peer ) + : mpeer( peer ) + { + }; +}; + +FormatterBase::FormatterBase( FormatterBaseImpl *pFormatImpl ) + : mpFormatImpl( pFormatImpl ) +{ +} + +class NumericFormatterImpl : public FormatterBaseImpl +{ + public: + uno::Reference< awt::XNumericField > mxField; + explicit NumericFormatterImpl( const PeerHandle &peer ) + : FormatterBaseImpl( peer ) + , mxField( peer, uno::UNO_QUERY ) + { + } + + // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx + double valueToDouble( sal_Int64 nValue ) + { + sal_Int16 nDigits = mxField->getDecimalDigits(); + double n = (double)nValue; + for ( sal_uInt16 d = 0; d < nDigits; d++ ) + n /= 10; + return n; + } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx + sal_Int64 doubleToValue( double nValue ) + { + sal_Int16 nDigits = mxField->getDecimalDigits(); + double n = nValue; + for ( sal_uInt16 d = 0; d < nDigits; d++ ) + n *= 10; + return (sal_Int64) n; + } +}; + +class MetricFormatterImpl : public FormatterBaseImpl +{ + public: + uno::Reference< awt::XMetricField > mxField; + explicit MetricFormatterImpl( const PeerHandle &peer ) + : FormatterBaseImpl( peer ) + , mxField( peer, uno::UNO_QUERY ) + { + } +}; + +NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl ) + : FormatterBase( pImpl ) +{ +} + +NumericFormatterImpl& NumericFormatter::getFormatImpl() const +{ + return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) ); +} + +#define SET_IMPL(vclmethod, idlmethod) \ + void NumericFormatter::vclmethod( sal_Int64 nValue ) \ + { \ + if ( !getFormatImpl().mxField.is() ) \ + return; \ + getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \ + } + +SET_IMPL( SetMin, setMin ) +SET_IMPL( SetMax, setMax ) +SET_IMPL( SetLast, setLast ) +SET_IMPL( SetFirst, setFirst ) +SET_IMPL( SetValue, setValue ) +SET_IMPL( SetSpinSize, setSpinSize ) + +sal_Int64 NumericFormatter::GetValue() const +{ + if ( !getFormatImpl().mxField.is() ) + return 0; + return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() ); +} + +#undef SET_IMPL + +IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" ); + +MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl ) + : FormatterBase( pImpl ) +{ +} +MetricFormatterImpl& MetricFormatter::getFormatImpl() const +{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); } + +#define MetricUnitVclToUno(a) ((sal_uInt16)(a)) + +#define SET_IMPL(vclmethod, idlmethod) \ + void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \ + { \ + if ( !getFormatImpl().mxField.is() ) \ + return; \ + getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \ + } + +SET_IMPL( SetMin, setMin ) +SET_IMPL( SetMax, setMax ) +SET_IMPL( SetLast, setLast ) +SET_IMPL( SetFirst, setFirst ) +SET_IMPL( SetValue, setValue ) + +#undef SET_IMPL + +void MetricFormatter::SetSpinSize( sal_Int64 nValue ) +{ + if ( !getFormatImpl().mxField.is() ) + return; + getFormatImpl().mxField->setSpinSize( nValue ); +} + +sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const +{ + if ( !getFormatImpl().mxField.is() ) + return 0; + return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) ); +} + +IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" ); + +class ComboBoxImpl : public EditImpl + , public ::cppu::WeakImplHelper1< awt::XActionListener > + , public ::cppu::WeakImplHelper1< awt::XItemListener > +{ +public: + uno::Reference< awt::XComboBox > mxComboBox; + + Link maClickHdl; + Link maSelectHdl; + + Window *parent; + + ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window ) + : EditImpl( context, peer, window ) + , mxComboBox( peer, uno::UNO_QUERY ) + { + } + + ~ComboBoxImpl (); + + sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos ) + { + if ( nPos == COMBOBOX_APPEND ) + nPos = GetEntryCount(); + mxComboBox->addItem( rtl::OUString( rStr ), nPos ); + return nPos; + } + + void RemoveEntry( sal_uInt16 nPos ) + { + mxComboBox->removeItems( nPos, 1 ); + } + + sal_uInt16 GetEntryPos( String const& rStr ) const + { + uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() ); + rtl::OUString rKey( rStr ); + sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength()); + for (sal_uInt16 i = 0; i < n; i++) + { + if ( aItems[ i ] == rKey ) + return i; + } + return COMBOBOX_ENTRY_NOTFOUND; + } + + OUString GetEntry( sal_uInt16 nPos ) const + { + return OUString( mxComboBox->getItem( nPos ) ); + } + + sal_uInt16 GetEntryCount() const + { + return mxComboBox->getItemCount(); + } + + void SetClickHdl( Link const& link ) + { + if (!link && !!maClickHdl) + mxComboBox->removeActionListener( this ); + else if (!!link && !maClickHdl) + mxComboBox->addActionListener( this ); + maClickHdl = link; + } + + void SetSelectHdl( Link const& link ) + { + if (!link && !!maSelectHdl) + mxComboBox->removeItemListener( this ); + else if (!!link && !maSelectHdl) + mxComboBox->addItemListener( this ); + maSelectHdl = link; + } + + void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException); + + void SAL_CALL actionPerformed (const awt::ActionEvent&) + throw (uno::RuntimeException) + { + ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); + if ( !pComboBox ) + return; + maClickHdl.Call( pComboBox ); + } + + void SAL_CALL itemStateChanged( awt::ItemEvent const&) + throw (uno::RuntimeException) + { + ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); + if ( !pComboBox ) + return; + maSelectHdl.Call( pComboBox ); + } +}; + +ComboBox::~ComboBox () +{ +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ()); +#endif +} + +ComboBoxImpl::~ComboBoxImpl () +{ +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0); + OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this)); +#endif +} + +void ComboBoxImpl::disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) +{ + EditImpl::disposing (e); + mxComboBox.clear (); +} + +sal_uInt16 ComboBox::InsertEntry( String const& rStr, sal_uInt16 nPos ) +{ + return getImpl().InsertEntry( rStr, nPos ); +} + +void ComboBox::RemoveEntry( String const& rStr ) +{ + getImpl().RemoveEntry( GetEntryPos( rStr ) ); +} + +void ComboBox::RemoveEntry( sal_uInt16 nPos ) +{ + getImpl().RemoveEntry( nPos ); +} + +void ComboBox::Clear() +{ + uno::Sequence< rtl::OUString> aNoItems; + getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); +} + +sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const +{ + return getImpl().GetEntryPos( rStr ); +} + +String ComboBox::GetEntry( sal_uInt16 nPos ) const +{ + rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos ); + return OUString( rItem ); +} + +sal_uInt16 ComboBox::GetEntryCount() const +{ + return getImpl().GetEntryCount(); +} + +void ComboBox::SetClickHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxComboBox.is ()) + getImpl().SetClickHdl( link ); +} + +void ComboBox::SetSelectHdl( const Link& link ) +{ + if (&getImpl () && getImpl().mxComboBox.is ()) + getImpl().SetSelectHdl( link ); +} + +void ComboBox::EnableAutocomplete (bool enable, bool matchCase) +{ + GetComboBox ()->EnableAutocomplete (enable, matchCase); +} + +IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; ); +IMPL_GET_WINDOW (ComboBox); +/// IMPL_GET_IMPL( ComboBox ); + +static ComboBoxImpl* null_combobox_impl = 0; + +ComboBoxImpl &ComboBox::getImpl () const +{ + if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl)) + return *c; + return *null_combobox_impl; +} + +class ListBoxImpl : public ControlImpl + , public ::cppu::WeakImplHelper1< awt::XActionListener > + , public ::cppu::WeakImplHelper1< awt::XItemListener > + , public ::cppu::WeakImplHelper1< awt::XMouseListener > +{ + Link maClickHdl; + Link maSelectHdl; + Link maDoubleClickHdl; + +public: + uno::Reference< awt::XListBox > mxListBox; + ListBoxImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + , mxListBox( peer, uno::UNO_QUERY ) + { + SelectEntryPos (0, true); + } + + sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos) + { + if ( nPos == LISTBOX_APPEND ) + nPos = mxListBox->getItemCount(); + mxListBox->addItem( rtl::OUString( rStr ), nPos ); + return nPos; + } + + void RemoveEntry( sal_uInt16 nPos ) + { + mxListBox->removeItems( nPos, 1 ); + } + + sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos) + { + if ( nPos == LISTBOX_APPEND ) + nPos = mxListBox->getItemCount(); + mxListBox->addItem( rtl::OUString( rStr ), nPos ); + return nPos; + } + + sal_uInt16 GetEntryPos( String const& rStr ) const + { + uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() ); + rtl::OUString rKey( rStr ); + sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength()); + for (sal_uInt16 i = 0; i < n; i++) + { + if ( aItems[ i ] == rKey ) + return i; + } + return LISTBOX_ENTRY_NOTFOUND; + } + + OUString GetEntry( sal_uInt16 nPos ) const + { + return mxListBox->getItem( nPos ); + } + + sal_uInt16 GetEntryCount() const + { + return mxListBox->getItemCount(); + } + + void SelectEntryPos( sal_uInt16 nPos, bool bSelect ) + { + mxListBox->selectItemPos( nPos, bSelect ); + } + + sal_uInt16 GetSelectEntryCount() const + { + return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() ); + } + + sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const + { + sal_uInt16 nSelected = 0; + if ( mxListBox->isMutipleMode() ) + { + uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() ); + if ( nSelIndex < aItems.getLength() ) + nSelected = aItems[ nSelIndex ]; + } + else + nSelected = mxListBox->getSelectedItemPos(); + return nSelected; + } + + virtual void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + ControlImpl::disposing (e); + mxListBox.clear (); + } + + Link& GetClickHdl () + { + return maClickHdl; + } + + void SetClickHdl( Link const& link ) + { + if (!link && !!maClickHdl) + mxListBox->removeActionListener( this ); + else if (!!link && !maClickHdl) + mxListBox->addActionListener( this ); + maClickHdl = link; + } + + void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ ) + throw (uno::RuntimeException) + { + maClickHdl.Call( mpWindow ); + } + + Link& GetSelectHdl () + { + return maSelectHdl; + } + + void SetSelectHdl( Link const& link ) + { + if (!link && !!maSelectHdl) + mxListBox->removeItemListener( this ); + else if (!!link && !maSelectHdl) + mxListBox->addItemListener( this ); + maSelectHdl = link; + } + + void SAL_CALL itemStateChanged (awt::ItemEvent const&) + throw (uno::RuntimeException) + { + maSelectHdl.Call (static_cast <ListBox*> (mpWindow)); + } + + Link& GetDoubleClickHdl () + { + return maDoubleClickHdl; + } + + void SetDoubleClickHdl (Link const& link) + { + if (!link && !!maDoubleClickHdl) + mxWindow->removeMouseListener (this); + else if (!!link && !maSelectHdl) + mxWindow->addMouseListener (this); + maDoubleClickHdl = link; + } + + void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException) + { + } + void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException) + { + if (e.ClickCount == 2) + maDoubleClickHdl.Call (mpWindow); + } + void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException) + { + } + void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException) + { + } +}; + +ListBox::~ListBox () +{ +} + +sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos) +{ + return getImpl().InsertEntry(rStr, nPos); +} + +void ListBox::RemoveEntry( sal_uInt16 nPos ) +{ + return getImpl().RemoveEntry( nPos ); +} + +void ListBox::RemoveEntry( String const& rStr ) +{ + return getImpl().RemoveEntry( GetEntryPos( rStr ) ); +} + +void ListBox::Clear() +{ + uno::Sequence< rtl::OUString> aNoItems; + getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); +} + +sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const +{ + return getImpl().GetEntryPos( rStr ); +} + +String ListBox::GetEntry( sal_uInt16 nPos ) const +{ + return getImpl().GetEntry( nPos ); +} + +sal_uInt16 ListBox::GetEntryCount() const +{ + return getImpl().GetEntryCount(); +} + +void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect ) +{ +#if LAYOUT_API_CALLS_HANDLER + getImpl().SelectEntryPos( nPos, bSelect ); +#else /* !LAYOUT_API_CALLS_HANDLER */ + GetListBox ()->SelectEntryPos (nPos, bSelect); +#endif /* !LAYOUT_API_CALLS_HANDLER */ +} + +void ListBox::SelectEntry( String const& rStr, bool bSelect ) +{ + SelectEntryPos( GetEntryPos( rStr ), bSelect ); +} + +sal_uInt16 ListBox::GetSelectEntryCount() const +{ + return getImpl().GetSelectEntryCount(); +} + +sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const +{ + return getImpl().GetSelectEntryPos( nSelIndex ); +} + +String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const +{ + return GetEntry( GetSelectEntryPos( nSelIndex ) ); +} + +Link& ListBox::GetSelectHdl () +{ + return getImpl ().GetSelectHdl (); +} + +void ListBox::SetSelectHdl( Link const& link ) +{ + getImpl().SetSelectHdl( link ); +} + +Link& ListBox::GetClickHdl () +{ + return getImpl ().GetSelectHdl (); +} + +void ListBox::SetClickHdl( Link const& link ) +{ + if (&getImpl () && getImpl().mxListBox.is ()) + getImpl().SetClickHdl( link ); +} + +Link& ListBox::GetDoubleClickHdl () +{ + return getImpl ().GetSelectHdl (); +} + +void ListBox::SetDoubleClickHdl( Link const& link ) +{ + getImpl().SetDoubleClickHdl( link ); +} + +void ListBox::SetEntryData( sal_uInt16 pos, void* data) +{ + GetListBox ()->SetEntryData (pos, data); +} + +void* ListBox::GetEntryData( sal_uInt16 pos) const +{ + return GetListBox ()->GetEntryData (pos); +} + +void ListBox::SetNoSelection () +{ + GetListBox ()->SetNoSelection (); +} + +IMPL_CONSTRUCTORS (ListBox, Control, "listbox"); +IMPL_GET_IMPL (ListBox); +IMPL_GET_WINDOW (ListBox); + +IMPL_IMPL (MultiListBox, ListBox) +IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); ); +IMPL_GET_IMPL( MultiListBox ); +IMPL_GET_WINDOW( MultiListBox ); +} // namespace layout diff --git a/toolkit/source/layout/vcl/wrapper.cxx b/toolkit/source/layout/vcl/wrapper.cxx new file mode 100644 index 000000000000..0e2eec91773e --- /dev/null +++ b/toolkit/source/layout/vcl/wrapper.cxx @@ -0,0 +1,1630 @@ +/************************************************************************* + * + * 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 <tools/rc.h> +//#define RESOURCE_PUBLISH_PROTECTED 1 +#if RESOURCE_PUBLISH_PROTECTED +// ugh, override non-helpful proctection +#define protected public +#endif /* RESOURCE_PUBLISH_PROTECTED */ +#include <tools/rc.hxx> +#undef protected + + +#include "wrapper.hxx" + +#include <awt/vclxplugin.hxx> +#include <awt/vclxtabcontrol.hxx> +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> +#include <com/sun/star/awt/XDialog2.hpp> +#include <com/sun/star/awt/XProgressBar.hpp> +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <com/sun/star/awt/XTabListener.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <comphelper/processfactory.hxx> +#include <layout/core/factory.hxx> +#include <layout/core/localized-string.hxx> +#include <layout/core/root.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/dialog.hxx> +#include <vcl/image.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/window.hxx> + +using namespace ::com::sun::star; +using rtl::OUString; + +namespace layout +{ + +// Context bits ... +class ContextImpl +{ + uno::Reference< awt::XLayoutRoot > mxRoot; + uno::Reference< container::XNameAccess > mxNameAccess; + PeerHandle mxTopLevel; + +public: + ContextImpl( char const *pPath ) + { + uno::Sequence< uno::Any > aParams( 1 ); + aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 ); + + uno::Reference< lang::XSingleServiceFactory > xFactory( + comphelper::createProcessComponent( + OUString::createFromAscii( "com.sun.star.awt.Layout" ) ), + uno::UNO_QUERY ); + if ( !xFactory.is() ) + { + throw uno::RuntimeException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ), + uno::Reference< uno::XInterface >() ); + } + mxRoot = uno::Reference< awt::XLayoutRoot >( + xFactory->createInstanceWithArguments( aParams ), + uno::UNO_QUERY ); + + mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY ); + } + + ~ContextImpl() + { + } + + PeerHandle getByName( const OUString &rName ) + { + uno::Any val = mxNameAccess->getByName( rName ); + PeerHandle xRet; + val >>= xRet; + return xRet; + } + PeerHandle getTopLevel() + { + return mxTopLevel; + } + void setTopLevel( PeerHandle xToplevel ) + { + mxTopLevel = xToplevel; + } + PeerHandle getRoot() + { + return mxRoot; + } +}; + +Context::Context( const char *pPath ) + : pImpl( new ContextImpl( pPath ) ) +{ +} +Context::~Context() +{ + delete pImpl; + pImpl = NULL; +} + +void Context::setToplevel( PeerHandle xToplevel ) +{ + pImpl->setTopLevel( xToplevel ); +} + +PeerHandle Context::getToplevel() +{ + return pImpl->getTopLevel(); +} +PeerHandle Context::getRoot() +{ + return pImpl->getRoot(); +} + +PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const +{ + PeerHandle xHandle; + xHandle = pImpl->getByName( OUString( id, strlen( id ), RTL_TEXTENCODING_UTF8 ) ); + if ( !xHandle.is() ) + { + DBG_ERROR1( "Failed to fetch widget '%s'", id ); + } + + if ( nId != 0 ) + { + rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId ); + xHandle = GetPeerHandle( aStr, 0 ); + } + return xHandle; +} + +WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window) + : mpWindow (window) + , mpCtx (context) + , mxWindow (peer, uno::UNO_QUERY) + , mxVclPeer (peer, uno::UNO_QUERY) + , mvclWindow (0) + , bFirstTimeVisible (true) +{ +} + +WindowImpl::~WindowImpl () +{ + if (mpWindow) + mpWindow->mpImpl = 0; + if (mvclWindow) + { + VCLXWindow *v = mvclWindow->GetWindowPeer (); + v->SetWindow (0); + mvclWindow->SetComponentInterface (uno::Reference <awt::XWindowPeer> ()); + mvclWindow->SetWindowPeer (uno::Reference <awt::XWindowPeer> (), 0); + delete mvclWindow; + mvclWindow = 0; + } +} + +void WindowImpl::wrapperGone () +{ + mvclWindow = 0; + mpWindow->mpImpl = 0; + mpWindow = 0; + mpCtx = 0; + if ( mxWindow.is() ) + { + uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY ); + mxWindow.clear (); + if ( xComp.is() ) + xComp->dispose(); + } +} + +void SAL_CALL WindowImpl::disposing (lang::EventObject const&) + throw (uno::RuntimeException) +{ + if (mxWindow.is ()) + mxWindow.clear (); +} + +uno::Any WindowImpl::getProperty (char const* name) +{ + if ( !this || !mxVclPeer.is() ) + return css::uno::Any(); + return mxVclPeer->getProperty + ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ) ); +} + +void WindowImpl::setProperty (char const *name, uno::Any any) +{ + if ( !this || !mxVclPeer.is() ) + return; + mxVclPeer->setProperty + ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any ); +} + +void WindowImpl::redraw (bool resize) +{ + uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY); + ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow (); + ::Window* parent = window->GetParent(); + ::Rectangle r = Rectangle (parent->GetPosPixel (), + parent->GetSizePixel ()); + parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN ); + if (resize) + parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE); + else + parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop, + awt::PosSize::SIZE); +} + +Window::Window( WindowImpl *pImpl ) + : mpImpl( pImpl ) +{ + mpImpl->mvclWindow = GetVCLXWindow () ? GetWindow () : 0; +} + +Window::~Window() +{ + /* likely to be an UNO object - with floating references */ + if (mpImpl) + mpImpl->wrapperGone (); + mpImpl = 0; +} + +///IMPL_GET_IMPL( Control ); + +static ControlImpl* null_control_impl = 0; + +ControlImpl &Control::getImpl () const +{ + if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl)) + return *c; + return *null_control_impl; +} + +Control::~Control () +{ + SetGetFocusHdl (Link ()); + SetLoseFocusHdl (Link ()); +} + +void Window::setRes (ResId const& res) +{ +#if RESOURCE_PUBLISH_PROTECTED + // Resources are shut-off from use. Is that really necessary? + Resource &r = *GetWindow (); + r.GetRes (res); +#else /* !RESOURCE_PUBLISH_PROTECTED */ + //We *must* derive. Is this also really necessary? + //Resource r (res); + + // ugh, I wonder which solution is cleaner... + class Resource_open_up : public Resource + { + public: + Resource_open_up (ResId const& r) + : Resource (r) + { + } + static sal_Int32 GetLongRes (void *p) + { + return Resource::GetLongRes (p); + } + void* GetClassRes () + { + return Resource::GetClassRes (); + } + sal_Int32 ReadLongRes () + { + return Resource::ReadLongRes (); + } + UniString ReadStringRes () + { + return Resource::ReadStringRes (); + } + }; + + Resource_open_up r (res); +#endif /* !RESOURCE_PUBLISH_PROTECTED */ + if (sal_uInt32 help_id = (sal_uInt32)r.GetLongRes (static_cast<char *> (r.GetClassRes ()) + 12)) + SetHelpId (help_id); + sal_uInt32 mask = r.ReadLongRes (); + if ( mask & WINDOW_TEXT ) + SetText( r.ReadStringRes ()); +} + +void Window::SetParent( ::Window *parent ) +{ + uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY ); + if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref )) + if (::Window *window = vcl->GetWindow()) + window->SetParent( parent ); +} + +void Window::SetParent( Window *parent ) +{ + /* Let's hear it for C++: poor man's dynamic binding. */ + parent->ParentSet (this); +} + +void Window::ParentSet (Window *window) +{ + window->SetParent (GetWindow ()); +} + +Context *Window::getContext() +{ + return this && mpImpl ? mpImpl->mpCtx : NULL; +} + +PeerHandle Window::GetPeer() const +{ + if ( !mpImpl ) + return PeerHandle(); + return mpImpl->mxWindow; +} + +uno::Reference<awt::XWindow> Window::GetRef() const +{ + return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ); +} + +VCLXWindow* Window::GetVCLXWindow() const +{ + return VCLXWindow::GetImplementation( GetRef() ); +} + +::Window* Window::GetWindow() const +{ + return GetVCLXWindow()->GetWindow(); +} + +::Window* Window::GetParent() const +{ + return GetWindow()->GetParent(); +} + +void Window::SetHelpId( sal_uIntPtr id ) +{ + GetWindow()->SetHelpId( id ); +} + +sal_uIntPtr Window::GetHelpId() const +{ + return GetWindow()->GetHelpId(); +} + +void Window::SetSmartHelpId( SmartId const& id, SmartIdUpdateMode mode ) +{ + GetWindow()->SetSmartHelpId( id, mode ); +} + +SmartId Window::GetSmartHelpId() const +{ + return GetWindow()->GetSmartHelpId(); +} + +void Window::EnterWait () +{ + GetWindow()->EnterWait (); +} +void Window::LeaveWait () +{ + GetWindow()->LeaveWait (); +} +bool Window::IsWait () const +{ + return GetWindow()->IsWait (); +} + +bool Window::IsVisible () const +{ + if (GetWindow ()) + return GetWindow()->IsVisible (); + return false; +} + +bool Window::HasChildPathFocus (bool systemWindow) const +{ + return GetWindow()->HasChildPathFocus (systemWindow); +} + +void Window::SetPosPixel (Point const&) +{ +} + +Point Window::GetPosPixel () const +{ + return Point (); +} + +void Window::SetSizePixel (Size const&) +{ +} + +void Window::SetPosSizePixel (Point const&, Size const&) +{ +} + +Size Window::GetSizePixel () const +{ + return Size (); +} + +// void Window::Enable (bool enable, bool child); +// { +// GetWindow ()->Enable (enable, child); +// } + +// void Window::Disable (bool child) +// { +// GetWindow ()->Disable (child); +// } + +bool Window::IsEnabled () const +{ + return GetWindow ()->IsEnabled (); +// if (getImpl().mxWindow.is ()) +// return getImpl ().mxWindow->isEnabled (); +// return false; +} + +void Window::EnableInput (bool enable, bool child) +{ + GetWindow ()->EnableInput (enable, child); +} + +bool Window::IsInputEnabled () const +{ + return GetWindow ()->IsInputEnabled (); +} + +bool Window::HasFocus () const +{ + return GetWindow ()->HasFocus (); +} + +Font& Window::GetFont () const +{ + return const_cast <Font&> (GetWindow ()->GetFont ()); +} + +void Window::SetFont (Font const& font) +{ + GetWindow ()->SetFont (font); +} + +void Window::Invalidate (sal_uInt8 flags) +{ + GetWindow ()->Invalidate (flags); +} + +struct ToolkitVclPropsMap +{ + WinBits vclStyle; + long initAttr; + const char *propName; + + // the value to give the prop to enable/disable it -- not the most brilliant + // type declaration and storage, but does the work... properties are + // either a boolean or a short since they are either a directly wrappers for + // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER). + bool isBoolean; + short enableProp, disableProp; +}; + +#define TYPE_BOOL true +#define TYPE_SHORT false +#define NOTYPE 0 +static const ToolkitVclPropsMap toolkitVclPropsMap[] = +{ + { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 }, + { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 }, + { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 }, + { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 }, + { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 }, + + { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 }, + { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 }, + { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 }, + { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 }, + { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 }, + { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 }, + { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 }, + { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 }, + { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 }, + { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 }, + { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 }, + { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 }, + + { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 }, + { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 }, + { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 }, + { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 }, + { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 }, + { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 }, + { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 }, + { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 }, + { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 }, + { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 }, + + { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 }, + { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 }, + + { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 }, + { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 }, + { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 }, + { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 }, + { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 }, +}; +#undef TYPE_BOOL +#undef TYPE_SHORT +#undef NOTYPE + +static const int toolkitVclPropsMapLen = + sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap ); + +void Window::SetStyle( WinBits nStyle ) +{ + uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer; + for (int i = 0; i < toolkitVclPropsMapLen; i++) + { + if ( toolkitVclPropsMap[ i ].propName ) + { + short nValue; + if ( nStyle & toolkitVclPropsMap[ i ].vclStyle ) + nValue = toolkitVclPropsMap[ i ].enableProp; + else + nValue = toolkitVclPropsMap[ i ].disableProp; + uno::Any aValue; + if ( toolkitVclPropsMap[ i ].isBoolean ) + aValue = uno::makeAny( (bool) nValue ); + else + aValue = uno::makeAny( (short) nValue ); + mpImpl->setProperty( toolkitVclPropsMap[ i ].propName, aValue ); + } + } +} + +WinBits Window::GetStyle() +{ + uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer; + WinBits ret = 0; + for (int i = 0; i < toolkitVclPropsMapLen; i++) + { + if ( toolkitVclPropsMap[ i ].propName ) + { + short nValue = 0; + if ( toolkitVclPropsMap[ i ].isBoolean ) + { + bool bValue = false; + mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= bValue; + nValue = bValue ? 1 : 0; + } + else + mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= nValue; + if ( nValue == toolkitVclPropsMap[ i ].enableProp ) + ret |= toolkitVclPropsMap[i].vclStyle; + } + } + return ret; +} + +/* Unpleasant way to get an xToolkit pointer ... */ +uno::Reference< awt::XToolkit > getToolkit() +{ + static uno::Reference< awt::XToolkit > xToolkit; + if (!xToolkit.is()) + { + // Urgh ... + xToolkit = uno::Reference< awt::XToolkit >( + ::comphelper::getProcessServiceFactory()->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), + uno::UNO_QUERY ); + if ( !xToolkit.is() ) + throw uno::RuntimeException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ), + uno::Reference< uno::XInterface >() ); + } + return xToolkit; +} + +PeerHandle Window::CreatePeer( Window *parent, WinBits nStyle, const char *pName) +{ + long nWinAttrbs = 0; + for (int i = 0; i < toolkitVclPropsMapLen; i++) + if ( nStyle & toolkitVclPropsMap[ i ].vclStyle ) + nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr; + + return layoutimpl::WidgetFactory::createWidget (getToolkit(), parent->GetPeer(), OUString::createFromAscii( pName ), nWinAttrbs); +} + +void Window::Enable( bool bEnable ) +{ + if ( !getImpl().mxWindow.is() ) + return; + getImpl().mxWindow->setEnable( bEnable ); +} + +void Window::Show( bool bVisible ) +{ + if ( !getImpl().mxWindow.is() ) + return; + getImpl().mxWindow->setVisible( bVisible ); + if (!bVisible) + getImpl ().bFirstTimeVisible = true; + else if (GetParent() && getImpl().bFirstTimeVisible) + { + getImpl().redraw (); + getImpl().bFirstTimeVisible = false; + } +} + +void Window::GrabFocus() +{ + if ( !getImpl().mxWindow.is() ) + return; + getImpl().mxWindow->setFocus(); +} + +void Window::SetUpdateMode(bool mode) +{ + GetWindow()->SetUpdateMode( mode ); +} + +void Window::SetPointer( Pointer const& pointer ) +{ + GetWindow()->SetPointer( pointer ); +} + +Pointer const& Window::GetPointer() const +{ + return GetWindow()->GetPointer(); +} + +void Window::SetText( OUString const& str ) +{ + GetWindow()->SetText( str ); +} + +String Window::GetText() const +{ + return GetWindow()->GetText(); +} + +sal_Int32 Window::GetCtrlTextWidth (OUString const&) const +{ + return 0; +} + +sal_Int32 Window::GetTextHeight () const +{ + return 0; +} + +Size Window::LogicToPixel( Size const& size, MapMode const&) const +{ + return size; +} + +ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window) + : WindowImpl( context, peer, window ) +{ +} + +ControlImpl::~ControlImpl () +{ + if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ()) + /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear() + don't do it twice */ + mxWindow.clear (); +} + +void ControlImpl::SetGetFocusHdl (Link const& link) +{ + if (!mLoseFocusHdl || !link) + UpdateListening (link); + mGetFocusHdl = link; +} + +Link& ControlImpl::GetGetFocusHdl () +{ + return mGetFocusHdl; +} + +void ControlImpl::SetLoseFocusHdl (Link const& link) +{ + if (!mGetFocusHdl || !link) + UpdateListening (link); + mLoseFocusHdl = link; +} + +Link& ControlImpl::GetLoseFocusHdl () +{ + return mGetFocusHdl; +} + +void ControlImpl::UpdateListening (Link const& link) +{ + if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl) + && (!mGetFocusHdl || !mLoseFocusHdl)) + mxWindow->removeFocusListener (this); + else if (!!link && !mGetFocusHdl && !mLoseFocusHdl) + mxWindow->addFocusListener (this); +} + +void SAL_CALL ControlImpl::disposing (lang::EventObject const&) + throw (uno::RuntimeException) +{ +/// mxWindow.clear (); +} + +void SAL_CALL ControlImpl::focusGained (awt::FocusEvent const&) + throw (uno::RuntimeException) +{ + mGetFocusHdl.Call (mpWindow); +} + +void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&) + throw (uno::RuntimeException) +{ + mLoseFocusHdl.Call (mpWindow); +} + +Link& Control::GetGetFocusHdl () +{ + return getImpl ().GetGetFocusHdl (); +} + +void Control::SetGetFocusHdl (Link const& link) +{ + if (&getImpl () && getImpl().mxWindow.is ()) + getImpl ().SetGetFocusHdl (link); +} + +Link& Control::GetLoseFocusHdl () +{ + return getImpl ().GetLoseFocusHdl (); +} + +void Control::SetLoseFocusHdl (Link const& link) +{ + if (&getImpl () && getImpl().mxWindow.is ()) + getImpl ().SetLoseFocusHdl (link); +} + +class DialogImpl : public WindowImpl +{ +public: + uno::Reference< awt::XDialog2 > mxDialog; + DialogImpl( Context *context, PeerHandle const &peer, Window *window ); +}; + +DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window ) + : WindowImpl( context, peer, window ) + , mxDialog( peer, uno::UNO_QUERY ) +{ +} + +Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId ) + : Context( xml_file ) + , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) ) + , bConstruct (true) +{ + if ( parent ) + SetParent( parent ); +} + +Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId ) + : Context( xml_file ) + , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) ) +{ + if ( parent ) + SetParent( parent ); +} + +Dialog::~Dialog () +{ +} + +IMPL_GET_WINDOW (Dialog); +IMPL_GET_IMPL (Dialog); + +#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog +#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog + +short Dialog::Execute() +{ + RETURN_MX_DIALOG->execute (); + return -1; +} + +void Dialog::EndDialog( long result ) +{ + MX_DIALOG->endDialog (result); +} + +void Dialog::SetText( OUString const& str ) +{ + SetTitle (str); +} + +void Dialog::SetTitle( OUString const& str ) +{ + MX_DIALOG->setTitle (str); +} + +bool Dialog::Close () +{ + EndDialog (false); + return true; +} + +long Dialog::Notify (NotifyEvent& event) +{ + return GetDialog ()->Notify (event); +} + +void Dialog::Initialize (SfxChildWinInfo*) +{ +} + +#define MESSAGE_BOX_MEMBER_INIT\ + Dialog (parent, xml_file, id)\ + , imageError (this, "FI_ERROR")\ + , imageInfo (this, "FI_INFO")\ + , imageQuery (this, "FI_QUERY")\ + , imageWarning (this, "FI_WARNING")\ + , messageText (this, "FT_MESSAGE")\ + , cancelButton (this, "BTN_CANCEL")\ + , helpButton (this, "BTN_HELP")\ + , ignoreButton (this, "BTN_IGNORE")\ + , noButton (this, "BTN_NO")\ + , retryButton (this, "BTN_RETRY")\ + , yesButton (this, "BTN_YES") + +MessageBox::MessageBox (::Window *parent, char const* message, + char const* yes, char const* no, sal_uIntPtr help_id, + char const* xml_file, char const* id) + : MESSAGE_BOX_MEMBER_INIT +{ + ignoreButton.Hide (); + retryButton.Hide (); + init (message, yes, no, help_id); +} + +MessageBox::MessageBox (::Window *parent, OUString const& message, + OUString yes, OUString no, sal_uIntPtr help_id, + char const* xml_file, char const* id) + : MESSAGE_BOX_MEMBER_INIT +{ + ignoreButton.Hide (); + retryButton.Hide (); + init (message, yes, no, help_id); +} + +#if !defined (__GNUC__) +#define __PRETTY_FUNCTION__ __FUNCTION__ +#endif /* !__GNUC__ */ + +MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message, + char const* yes, char const* no, sal_uIntPtr help_id, + char const* xml_file, char const* id) + : MESSAGE_BOX_MEMBER_INIT +{ + // HIG suggests using verbs instead of yes/no/retry etc. + // This constructor provides client-code compatibility: Client code should be fixed. +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__); +#endif + bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id); +} + +MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message, + OUString yes, OUString no, sal_uIntPtr help_id, + char const* xml_file, char const* id) + : MESSAGE_BOX_MEMBER_INIT +{ + // HIG suggests using verbs instead of yes/no/retry etc. + // This constructor provides client-code compatibility: Client code should be fixed. +#ifndef __SUNPRO_CC + OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__); +#endif + bits_init (bits, message, yes, no, help_id); +} + +void MessageBox::bits_init (WinBits bits, OUString const& message, + OUString yes, OUString no, sal_uIntPtr help_id) +{ + if ( bits & ( WB_OK_CANCEL | WB_OK )) + yes = Button::GetStandardText ( BUTTON_OK ); + if ( bits & (WB_YES_NO | WB_YES_NO_CANCEL )) + { + yes = Button::GetStandardText ( BUTTON_YES ); + no = Button::GetStandardText ( BUTTON_NO ); + } + if (! (bits & (WB_RETRY_CANCEL | WB_YES_NO_CANCEL | WB_ABORT_RETRY_IGNORE ))) + cancelButton.Hide (); + if (! (bits & (WB_RETRY_CANCEL | WB_ABORT_RETRY_IGNORE))) + retryButton.Hide (); + if ( bits & WB_ABORT_RETRY_IGNORE ) + cancelButton.SetText ( Button::GetStandardText (BUTTON_ABORT)); + else + ignoreButton.Hide (); + if ( !(bits & ( WB_OK | WB_OK_CANCEL | WB_YES_NO | WB_YES_NO_CANCEL))) + yesButton.Hide (); + if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL))) + noButton.Hide (); + + init (message, yes, no, help_id); +} + +void MessageBox::init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id) +{ + init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id); +} + +void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, sal_uIntPtr help_id) +{ + imageError.Hide (); + imageInfo.Hide (); + imageQuery.Hide (); + imageWarning.Hide (); + if (message.getLength ()) + messageText.SetText (message); + if (yes.getLength ()) + { + yesButton.SetText (yes); + if (yes != OUString (Button::GetStandardText (BUTTON_OK)) + && yes != OUString (Button::GetStandardText (BUTTON_YES))) + SetTitle (yes); + if (no.getLength ()) + noButton.SetText (no); + else + noButton.Hide (); + } + if (help_id) + SetHelpId (help_id); + else + helpButton.Hide (); +} + +#undef MESSAGE_BOX_IMPL +#define MESSAGE_BOX_IMPL(Name)\ + Name##Box::Name##Box (::Window *parent, char const* message,\ + char const* yes, char const* no, sal_uIntPtr help_id,\ + char const* xml_file, char const* id)\ + : MessageBox (parent, message, yes, no, help_id, xml_file, id)\ + {\ + image##Name.Show ();\ + }\ + Name##Box::Name##Box (::Window *parent, OUString const& message,\ + OUString yes, OUString no, sal_uIntPtr help_id,\ + char const* xml_file, char const* id)\ + : MessageBox (parent, message, yes, no, help_id, xml_file, id)\ + {\ + image##Name.Show ();\ + }\ + Name##Box::Name##Box (::Window *parent, WinBits bits, char const* message,\ + char const* yes, char const* no, sal_uIntPtr help_id,\ + char const* xml_file, char const* id)\ + : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\ + {\ + image##Name.Show ();\ + }\ + Name##Box::Name##Box (::Window *parent, WinBits bits, OUString const& message,\ + OUString yes, OUString no, sal_uIntPtr help_id,\ + char const* xml_file, char const* id)\ + : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\ + {\ + image##Name.Show ();\ + } + +MESSAGE_BOX_IMPL (Error); +MESSAGE_BOX_IMPL (Info); +MESSAGE_BOX_IMPL (Query); +MESSAGE_BOX_IMPL (Warning); + +class TabControlImpl + : public ControlImpl + , public ::cppu::WeakImplHelper1 <awt::XTabListener> +{ + Link mActivatePageHdl; + Link mDeactivatePageHdl; + +public: + uno::Reference <awt::XSimpleTabController> mxTabControl; + TabControlImpl (Context *context, const PeerHandle &peer, Window *window) + : ControlImpl (context, peer, window) + , mxTabControl (peer, uno::UNO_QUERY) + { + } + + virtual void SAL_CALL disposing (lang::EventObject const& e) + throw (uno::RuntimeException) + { + ControlImpl::disposing (e); + mxTabControl.clear (); + } + + Link& GetActivatePageHdl () + { + return mActivatePageHdl; + } + + void SetActivatePageHdl (Link const& link) + { + if (!mDeactivatePageHdl || !link) + UpdateListening (link); + mActivatePageHdl = link; + } + + Link& GetDeactivatePageHdl () + { + return mDeactivatePageHdl; + } + + void SetDeactivatePageHdl (Link const& link) + { + if (!mActivatePageHdl || !link) + UpdateListening (link); + mDeactivatePageHdl = link; + } + + void UpdateListening (Link const& link) + { + if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl)) + mxTabControl->removeTabListener (this); + else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl) + mxTabControl->addTabListener (this); + } + + void SAL_CALL activated (sal_Int32) + throw (uno::RuntimeException) + { + mActivatePageHdl.Call (mpWindow); + } + + void SAL_CALL deactivated (sal_Int32) + throw (uno::RuntimeException) + { + mDeactivatePageHdl.Call (mpWindow); + } + + void SAL_CALL inserted (sal_Int32) + throw (uno::RuntimeException) + { + } + + void SAL_CALL removed (sal_Int32) + throw (uno::RuntimeException) + { + } + + void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&) + throw (uno::RuntimeException) + { + } +}; + +IMPL_GET_WINDOW (TabControl); +IMPL_GET_LAYOUT_VCLXWINDOW (TabControl); + +#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl +#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl + +TabControl::~TabControl () +{ + SetActivatePageHdl (Link ()); + SetDeactivatePageHdl (Link ()); +} + +void TabControl::InsertPage (sal_uInt16 id, OUString const& title, sal_uInt16 pos) +{ + (void) pos; +// GetTabControl ()->InsertPage (id, title, pos); +// GetTabControl ()->SetTabPage (id, new ::TabPage (GetTabControl ())); + + MX_TABCONTROL->insertTab (); + SetCurPageId (id); + +#if 1 // colour me loc productive -- NOT +#define ADD_PROP( seq, i, name, val )\ + { \ + beans::NamedValue value; \ + value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \ + value.Value = uno::makeAny( val ); \ + seq[i] = value; \ + } + + uno::Sequence< beans::NamedValue > seq (1); + ADD_PROP ( seq, 0, "Title", OUString (title) ); + MX_TABCONTROL->setTabProps (id, seq); +#else + GetTabPage (id)->SetText (title); +#endif + +#if 0 + /// This so seems the right solution, but it makes the buttons of the + /// tabdialog move up + + ::TabPage *page = GetTabPage (id); + if (Window *w = dynamic_cast <Window*> (page)) + { + w->SetParent (this); + //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->AddChild (w); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //uno::Reference <uno::XInterface> x (page->GetWindowPeer()); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->::Window::GetWindowPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY)); + } + getImpl ().redraw (); +#endif +} +void TabControl::RemovePage (sal_uInt16 id) +{ + GetTabControl ()->RemovePage (id); +} +sal_uInt16 TabControl::GetPageCount () const +{ + return GetTabControl ()->GetPageCount (); +} +sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const +{ + return GetTabControl ()->GetPageId (pos); +} +sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const +{ + getImpl ().redraw (); + return GetTabControl ()->GetPagePos (id); +} +void TabControl::SetCurPageId (sal_uInt16 id) +{ + getImpl ().redraw (); + GetTabControl ()->SetCurPageId (id); +} +sal_uInt16 TabControl::GetCurPageId () const +{ + return GetTabControl ()->GetCurPageId (); +} +void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page) +{ + GetTabControl ()->SetTabPage (id, page); + +#if 0 + /// This so seems the right solution, but it makes the buttons of the + /// tabdialog move up + if (Window *w = dynamic_cast <Window*> (page)) + { + w->SetParent (this); + //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->AddChild (w); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetWindowPeer (), uno::UNO_QUERY)); + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY)); + } +#endif + getImpl ().redraw (); +} +::TabPage* TabControl::GetTabPage (sal_uInt16 id) const +{ + return GetTabControl ()->GetTabPage (id); +} +void TabControl::SetActivatePageHdl (Link const& link) +{ + if (&getImpl () && getImpl().mxTabControl.is ()) + getImpl ().SetActivatePageHdl (link); +} +Link& TabControl::GetActivatePageHdl () const +{ + return getImpl ().GetActivatePageHdl (); +} +void TabControl::SetDeactivatePageHdl (Link const& link) +{ + if (&getImpl () && getImpl().mxTabControl.is ()) + getImpl ().SetDeactivatePageHdl (link); +} +Link& TabControl::GetDeactivatePageHdl () const +{ + return getImpl ().GetDeactivatePageHdl (); +} +void TabControl::SetTabPageSizePixel (Size const& size) +{ + GetTabControl ()->SetTabPageSizePixel (size); +// GetParent()->SetSizePixel (size); +// GetWindow()->SetSizePixel (size); + //GetVCLXTabControl->SetTabSize (size); +} +Size TabControl::GetTabPageSizePixel () const +{ +#if 0 + //return GetTabControl ()->GetTabPageSizePixel (); + static size_t const tab_page_first_index = 1; + for (size_t i = 0; i < GetPageCount (); i++) + { + ::TabPage *p = GetTabPage (i + tab_page_first_index); + //if (dynamic_cast<Windowt*> (p)) + if (i) // URG + return p->GetOptimalSize (WINDOWSIZE_MINIMUM); + } +#endif + return GetTabControl ()->GetTabPageSizePixel (); +} + +IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol"); +IMPL_GET_IMPL (TabControl); + +class TabPageImpl : public WindowImpl +{ +public: + uno::Reference< awt::XWindow > mxTabPage; + TabPageImpl( Context *context, const PeerHandle &peer, Window *window ) + : WindowImpl( context, peer, window ) + , mxTabPage( peer, uno::UNO_QUERY ) + { + } +}; + +::Window* TabPage::global_parent = 0; +TabControl* TabPage::global_tabcontrol = 0; + +IMPL_GET_IMPL( TabPage ); + +TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId) + : Context( xml_file ) + , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) ) +{ + if ( parent ) + SetParent( parent ); +} + +TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId) + : Context( xml_file ) + , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) ) +{ + if ( parent ) + SetParent( parent ); +} + +TabPage::~TabPage() +{ + delete GetTabPage(); +} + +IMPL_GET_WINDOW( TabPage ); + +void TabPage::ActivatePage() +{ +} + +void TabPage::DeactivatePage() +{ +} + +class FixedLineImpl : public ControlImpl +{ +public: + FixedLineImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + { + } +}; + +IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" ); +IMPL_GET_IMPL( FixedLine ); + +bool FixedLine::IsEnabled() const +{ + //FIXME + return true; +} + +class FixedTextImpl : public ControlImpl +{ +public: + uno::Reference< awt::XFixedText > mxFixedText; + FixedTextImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + , mxFixedText( peer, uno::UNO_QUERY ) + { + } + + ~FixedTextImpl (); + + virtual void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException); +}; + +FixedTextImpl::~FixedTextImpl () +{ +} + +void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) +{ + ControlImpl::disposing (e); + mxFixedText.clear (); +} + +FixedText::~FixedText () +{ +} + +IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" ); +IMPL_GET_IMPL( FixedText ); + +void FixedText::SetText( OUString const& rStr ) +{ + if ( !getImpl().mxFixedText.is() ) + return; + getImpl().mxFixedText->setText( rStr ); +} + +class FixedInfoImpl : public FixedTextImpl +{ +public: + FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window ) + : FixedTextImpl( context, peer, window ) + { + } +}; + +IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" ); +IMPL_GET_IMPL( FixedInfo ); + +class ProgressBarImpl : public ControlImpl +{ +public: + uno::Reference< awt::XProgressBar > mxProgressBar; + ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window ) + : ControlImpl( context, peer, window ) + , mxProgressBar( peer, uno::UNO_QUERY ) + { + } + + virtual void SAL_CALL disposing( lang::EventObject const& e ) + throw (uno::RuntimeException) + { + ControlImpl::disposing (e); + mxProgressBar.clear (); + } +}; + + +class FixedImageImpl: public ControlImpl +{ +public: + uno::Reference< graphic::XGraphic > mxGraphic; + FixedImageImpl( Context *context, const PeerHandle &peer, Window *window) +// const char *pName ) + : ControlImpl( context, peer, window ) + //, mxGraphic( layoutimpl::loadGraphic( pName ) ) + , mxGraphic( peer, uno::UNO_QUERY ) + { + if ( !mxGraphic.is() ) + { + DBG_ERROR( "ERROR: failed to load image: `%s'" /*, pName*/ ); + } +#if 0 + else + getImpl().mxGraphic->...(); +#endif + } +}; + +IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" ); +IMPL_GET_IMPL( FixedImage ) + +void FixedImage::setImage( ::Image const& i ) +{ + (void) i; + if ( !getImpl().mxGraphic.is() ) + return; + //FIXME: hack moved to proplist + //getImpl().mxGraphic = +} + +#if 0 + +FixedImage::FixedImage( const char *pName ) + : pImpl( new FixedImageImpl( pName ) ) +{ +} + +FixedImage::~FixedImage() +{ + delete pImpl; +} + +#endif + + +IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" ); +IMPL_GET_IMPL( ProgressBar ); + +void ProgressBar::SetForegroundColor( util::Color color ) +{ + if ( !getImpl().mxProgressBar.is() ) + return; + getImpl().mxProgressBar->setForegroundColor( color ); +} + +void ProgressBar::SetBackgroundColor( util::Color color ) +{ + if ( !getImpl().mxProgressBar.is() ) + return; + getImpl().mxProgressBar->setBackgroundColor( color ); +} + +void ProgressBar::SetValue( sal_Int32 i ) +{ + if ( !getImpl().mxProgressBar.is() ) + return; + getImpl().mxProgressBar->setValue( i ); +} + +void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max ) +{ + if ( !getImpl().mxProgressBar.is() ) + return; + getImpl().mxProgressBar->setRange( min, max ); +} + +sal_Int32 ProgressBar::GetValue() +{ + if ( !getImpl().mxProgressBar.is() ) + return 0; + return getImpl().mxProgressBar->getValue(); +} + +class PluginImpl: public ControlImpl +{ +public: + ::Control *mpPlugin; + + PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin ) + : ControlImpl( context, peer, window ) + , mpPlugin( plugin ) + { + uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY ); + layoutimpl::VCLXPlugin *vcl + = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) ); + ::Window *parent = vcl->mpWindow->GetParent(); + vcl->SetWindow( plugin ); + vcl->SetPlugin( mpPlugin ); + plugin->SetParent( parent ); + plugin->SetStyle( vcl->mStyle ); + plugin->SetCreatedWithToolkit( true ); + plugin->SetComponentInterface( vcl ); + plugin->Show(); + } +}; + +Plugin::Plugin( Context *context, char const *id, ::Control *plugin ) + : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) ) + , mpPlugin( plugin ) +{ +} + +IMPL_GET_IMPL( Plugin ); + +class LocalizedStringImpl : public WindowImpl +{ +public: + layoutimpl::LocalizedString *mpString; + OUString maString; + LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window ) + : WindowImpl( context, peer, window ) + , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) ) + , maString () + { + } + OUString getText() + { + if (mpString) + maString = mpString->getText (); + return maString; + } + void setText( OUString const& s ) + { + if (mpString) + mpString->setText( s ); + } +}; + +IMPL_GET_IMPL( LocalizedString ); + +LocalizedString::LocalizedString( Context *context, char const* id ) + : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) ) +{ +} + +String LocalizedString::getString () +{ + return getImpl ().getText (); +} + +OUString LocalizedString::getOUString () +{ + return getImpl ().getText (); +} + +LocalizedString::operator OUString () +{ + return getOUString (); +} + +LocalizedString::operator OUString const& () +{ + getOUString (); + return getImpl ().maString; +} + +LocalizedString::operator String() +{ + getOUString (); + return getImpl ().maString; +} + +String LocalizedString::GetToken (USHORT i, sal_Char c) +{ + return getString ().GetToken (i, c); +} + +OUString LocalizedString::operator= (OUString const& s) +{ + getImpl().setText( s ); + return getImpl().getText(); +} + +OUString LocalizedString::operator+= (OUString const& b) +{ + OUString a = getImpl ().getText (); + a += b; + getImpl ().setText (a); + return getImpl ().getText (); +} + +OUString LocalizedString::operator+= (sal_Unicode const b) +{ + String a = getImpl ().getText (); + a += b; + getImpl ().setText (a); + return getImpl ().getText (); +} + +class InPlugImpl : public WindowImpl +{ +public: + InPlugImpl (Context *context, const PeerHandle &peer, Window *window) + : WindowImpl (context, peer, window) + { + } +}; + +IMPL_GET_IMPL (InPlug); + +static char const *FIXME_set_parent (::Window *parent, char const *xml_file) +{ + layout::TabPage::global_parent = parent; + return xml_file; +} + +InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId) + : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file)) + , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this)) +{ + if (parent) + SetParent (parent); + if (::Window *w = dynamic_cast< ::Window* > (this)) + w->SetComponentInterface (GetVCLXWindow ()); +} + +InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId) + : Context (FIXME_set_parent (parent, xml_file)) + , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this)) +{ + if (parent) + layout::Window::SetParent (parent); + if (::Window *w = dynamic_cast< ::Window* > (this)) + w->SetComponentInterface (GetVCLXWindow ()); +} + +void InPlug::ParentSet (Window *window) +{ + window->SetParent (dynamic_cast< ::Window* > (this)); + + /// FIXME: for standalone run of layout::SfxTabDialog + SetParent (window->GetParent ()); +} + +} // namespace layout diff --git a/toolkit/source/layout/vcl/wrapper.hxx b/toolkit/source/layout/vcl/wrapper.hxx new file mode 100644 index 000000000000..a9d5a6490c31 --- /dev/null +++ b/toolkit/source/layout/vcl/wrapper.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * 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 LAYOUT_VCL_WRAPPER_HXX +#define LAYOUT_VCL_WRAPPER_HXX + +#include <layout/layout.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/awt/XDialog2.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <cppuhelper/implbase1.hxx> + +#include <cstring> + +namespace layout +{ + +namespace css = com::sun::star; + +class WindowImpl +{ +public: + Window *mpWindow; + Context *mpCtx; + css::uno::Reference< css::awt::XWindow > mxWindow; + css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer; + ::Window *mvclWindow; + bool bFirstTimeVisible; + + WindowImpl (Context *context, PeerHandle const &peer, Window *window); + virtual ~WindowImpl (); + + void wrapperGone(); + css::uno::Any getProperty (char const *name); + void setProperty (char const *name, css::uno::Any any); + void redraw (bool resize=false); + + // XFocusListener + virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException); +}; + +class ControlImpl : public WindowImpl + , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener> +{ +public: + Link mGetFocusHdl; + Link mLoseFocusHdl; + + ControlImpl( Context *context, PeerHandle const& peer, Window *window ); + ~ControlImpl (); + + virtual void SetGetFocusHdl (Link const& link); + Link& GetGetFocusHdl (); + virtual void SetLoseFocusHdl (Link const& link); + Link& GetLoseFocusHdl (); + virtual void UpdateListening (Link const& link); + + // XFocusListener + virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException); + void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException); + void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException); +}; + +inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); } + +// Helpers for defining boiler-plate constructors ... +// Could in-line in top-level but not with safe static_casts. +#define IMPL_GET_IMPL(t) \ + inline t##Impl &t::getImpl() const \ + { \ + return *(static_cast<t##Impl *>(mpImpl)); \ + } +#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \ + t::t( Context *context, const char *pId, sal_uInt32 nId ) \ + : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \ + { \ + Window *parent = dynamic_cast<Window*> (context);\ + body;\ + if (parent)\ + SetParent (parent);\ + } \ + t::t( Window *parent, WinBits bits) \ + : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \ + { \ + body;\ + if ( parent )\ + SetParent (parent);\ + } \ + t::t( Window *parent, ResId const& res) \ + : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \ + { \ + body;\ + setRes (res);\ + if (parent)\ + SetParent (parent);\ + } +#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, ) +#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \ + t::t( Context *context, const char *pId, sal_uInt32 nId ) \ + : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \ + , other_par( new other_par##Impl( Window::GetPeer() ) ) \ + { \ + } \ + t::t( Window *parent, WinBits bits) \ + : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \ + , other_par( new other_par##Impl( Window::GetPeer() ) ) \ + { \ + } + +#define IMPL_IMPL(t, parent) \ + class t##Impl : public parent##Impl \ + { \ + public: \ + t##Impl( Context *context, PeerHandle const& peer, Window *window ) \ + : parent##Impl( context, peer, window ) \ + { \ + } \ + }; + + +} // namespace layout + +#endif /* LAYOUT_VCL_WRAPPER_HXX */ diff --git a/toolkit/source/vclcompat/wbutton.cxx b/toolkit/source/vclcompat/wbutton.cxx deleted file mode 100644 index 9268e5ee4770..000000000000 --- a/toolkit/source/vclcompat/wbutton.cxx +++ /dev/null @@ -1,582 +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: wbutton.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. - * - ************************************************************************/ - -#include "wrapper.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/XActionListener.hpp> -#include <com/sun/star/awt/XButton.hpp> -#include <com/sun/star/awt/XCheckBox.hpp> -#include <com/sun/star/awt/XRadioButton.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <cppuhelper/implbase1.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/helper/convert.hxx> -#include <vcl/button.hxx> -#include <vcl/event.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <vcl/window.hxx> - -#include <list> - -#include "layout/layoutcore.hxx" - -using namespace ::com::sun::star; - -namespace layout -{ - -class ImageImpl -{ - public: - css::uno::Reference< css::graphic::XGraphic > mxGraphic; - ImageImpl( const char *pName ) - : mxGraphic( layoutimpl::loadGraphic( pName ) ) - { - if ( !mxGraphic.is() ) - { - DBG_ERROR1( "ERROR: failed to load image: `%s'\n", pName ); - } - } -}; - -Image::Image( const char *pName ) - : pImpl( new ImageImpl( pName ) ) -{ -} - -Image::~Image() -{ - delete pImpl; -} - -class ButtonImpl : public ControlImpl - , public ::cppu::WeakImplHelper1< awt::XActionListener > - , public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maClickHdl; -protected: - // we add toggle hooks here to cut on code - Link maToggleHdl; -public: - uno::Reference< awt::XButton > mxButton; - ButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ) - , mxButton( xPeer, uno::UNO_QUERY ) - { - mxButton->addActionListener( this ); - } - - ~ButtonImpl() - { - } - - virtual void Click() { /* make me pure virtual? */ }; - - void SetClickHdl( const Link& rLink ) - { - maClickHdl = rLink; - if ( !rLink ) - mxButton->removeActionListener( this ); - else - mxButton->addActionListener( this ); - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { mxButton.clear(); } - - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - if ( !maClickHdl ) - Click(); - else - maClickHdl.Call( static_cast<Window *>( mpWindow ) ); - } - - virtual // HACK: doesn't need to be virtual... remove in future... - void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } - - BOOL SetModeImage( css::uno::Reference< css::graphic::XGraphic > xGraph ) - { - setProperty( "Graphic", uno::Any( xGraph ) ); - return true; - } -}; - -void Button::SetText( const String& rStr ) -{ - if ( !getImpl().mxButton.is() ) - return; - getImpl().mxButton->setLabel( rStr ); -} - -void Button::SetClickHdl( const Link& rLink ) -{ - getImpl().SetClickHdl( rLink ); -} - -BOOL Button::SetModeImage( const Image& rImage ) -{ - return getImpl().SetModeImage( rImage.getImpl().mxGraphic ); -} - -void Button::SetImageAlign( ImageAlign eAlign ) -{ - getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) ); -} - -void Button::Click() -{ -} - -DECL_GET_IMPL_IMPL( Button ); -DECL_CONSTRUCTOR_IMPLS( Button, Control, "button" ); - -class PushButtonImpl : public ButtonImpl -{ - public: - PushButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ButtonImpl( pCtx, xPeer, pWindow ) {} - - void SetToggleHdl( const Link& rLink ) - { - // XButton doesn't have an explicit event for Toggle. Anyway, it is a - // superset of the clicks: all clicks, and explicit toggles - maToggleHdl = rLink; - if ( !rLink ) - mxButton->removeActionListener( this ); - else - mxButton->addActionListener( this ); - } - - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent ) - throw (css::uno::RuntimeException) - { - ButtonImpl::actionPerformed( rEvent ); - fireToggle(); - } - - inline void fireToggle() - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } -}; - -void PushButton::Check( BOOL bCheck ) -{ - getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) ); - // XButton doesn't have explicit toggle event - getImpl().fireToggle(); -} - -BOOL PushButton::IsChecked() const -{ - return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() ); -} - -void PushButton::Toggle() -{ - Check( true ); -} - -void PushButton::SetToggleHdl( const Link& rLink ) -{ - getImpl().SetToggleHdl( rLink ); -} - -DECL_GET_IMPL_IMPL( PushButton ); -DECL_CONSTRUCTOR_IMPLS( PushButton, Button, "pushbutton" ); - - // HACK: put every radio button into a group :/ -static std::list< RadioButtonImpl*> mpRadioGroup; - -class RadioButtonImpl : public ButtonImpl -{ -public: - uno::Reference< awt::XRadioButton > mxRadioButton; - RadioButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ButtonImpl( pCtx, xPeer, pWindow ) - , mxRadioButton( xPeer, uno::UNO_QUERY ) - { - // TEMP: - mpRadioGroup.push_back( this ); - mxRadioButton->addItemListener( this ); - } - - ~RadioButtonImpl() - { - //mxRadioButton->removeItemListener( this ); - mpRadioGroup.pop_front(); - } - - void Check( BOOL bCheck ) - { - if ( !mxRadioButton.is() ) - return; - mxRadioButton->setState( !!bCheck ); - fireToggle(); - - if ( bCheck ) - unsetOthersGroup( this ); - } - - BOOL IsChecked() - { - if ( !mxRadioButton.is() ) - return FALSE; - return mxRadioButton->getState(); - } - - static void unsetOthersGroup( RadioButtonImpl* current ) - { - // set all others to false - for ( std::list< RadioButtonImpl*>::iterator i = mpRadioGroup.begin(); - i != mpRadioGroup.end(); i++ ) - { - if ( *i != current ) - ( *i )->Check( false ); - } - } - - void SetToggleHdl( const Link& rLink ) - { - maToggleHdl = rLink; -#if 0 - if ( !rLink ) - mxRadioButton->removeItemListener( this ); - else - mxRadioButton->addItemListener( this ); -#endif - } - - inline void fireToggle() - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } - -//HACK: temp - virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) - throw (css::uno::RuntimeException) - { - if ( !!maToggleHdl ) - ButtonImpl::itemStateChanged( rEvent ); - - if ( IsChecked() ) - unsetOthersGroup( this ); - } -}; - -void RadioButton::Check( BOOL bCheck ) -{ - getImpl().Check( bCheck ); -} - -BOOL RadioButton::IsChecked() const -{ - return getImpl().IsChecked(); -} - -void RadioButton::SetToggleHdl( const Link& rLink ) -{ - getImpl().SetToggleHdl( rLink ); -} - -DECL_GET_IMPL_IMPL( RadioButton ); -#if 1 -DECL_CONSTRUCTOR_IMPLS( RadioButton, Button, "radiobutton" ); -#else //debugging aid -RadioButton::RadioButton( Context *pCtx, const char *pId, sal_uInt32 nId ) - : Button( new RadioButtonImpl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) -{ - printf( "%s: name=%s\n", __PRETTY_FUNCTION__, pId ); -} - -RadioButton::RadioButton( Window *pParent, WinBits nBits ) - : Button( new RadioButtonImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "radiobutton" ), this ) ) -{ -} -#endif - -class CheckBoxImpl : public ButtonImpl -{ - public: - uno::Reference< awt::XCheckBox > mxCheckBox; - CheckBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ButtonImpl( pCtx, xPeer, pWindow ) - , mxCheckBox( xPeer, uno::UNO_QUERY ) {} - - void SetToggleHdl( const Link& rLink ) - { - maToggleHdl = rLink; - if ( !rLink ) - mxCheckBox->removeItemListener( this ); - else - mxCheckBox->addItemListener( this ); - } -}; - -void CheckBox::Check( BOOL bCheck ) -{ - if ( !getImpl().mxCheckBox.is() ) - return; - getImpl().mxCheckBox->setState( !!bCheck ); -} - -BOOL CheckBox::IsChecked() const -{ - if ( !getImpl().mxCheckBox.is() ) - return FALSE; - return getImpl().mxCheckBox->getState() != 0; -} - -void CheckBox::SetToggleHdl( const Link& rLink ) -{ - getImpl().SetToggleHdl( rLink ); -} - -DECL_GET_IMPL_IMPL( CheckBox ); -DECL_CONSTRUCTOR_IMPLS( CheckBox, Button, "checkbox" ); - -#define BUTTON_IMPL(t, parent, response) \ - class t##Impl : public parent##Impl \ - { \ - public: \ - t##Impl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow ) \ - : parent##Impl( pCtx, xPeer, pWindow ) \ - { \ - } \ - void Click() \ - { \ - Dialog *d = static_cast<Dialog *>( mpCtx ); \ - d->EndDialog( response ); \ - } \ - } - -/* Common button types currently unavailable in OOo: */ -/* mpReset */ -/* mpApply */ -/* mpAction */ -#define RET_RESET 6 -#define RET_APPLY 7 -#define BUTTONID_RESET RET_RESET -#define BUTTONID_APPLY RET_APPLY - -BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK ); -BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL ); -BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES ); -BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO ); -BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY ); -BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE ); -BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET ); -BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */ -BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP ); - -DECL_CONSTRUCTOR_IMPLS( OKButton, PushButton, "okbutton" ); -DECL_CONSTRUCTOR_IMPLS( CancelButton, PushButton, "cancelbutton" ); -DECL_CONSTRUCTOR_IMPLS( YesButton, PushButton, "yesbutton" ); -DECL_CONSTRUCTOR_IMPLS( NoButton, PushButton, "nobutton" ); -DECL_CONSTRUCTOR_IMPLS( RetryButton, PushButton, "retrybutton" ); -DECL_CONSTRUCTOR_IMPLS( IgnoreButton, PushButton, "ignorebutton" ); -DECL_CONSTRUCTOR_IMPLS( ResetButton, PushButton, "resetbutton" ); -DECL_CONSTRUCTOR_IMPLS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */ -DECL_CONSTRUCTOR_IMPLS( HelpButton, PushButton, "helpbutton" ); - -class AdvancedButtonImpl : public PushButtonImpl -{ -protected: - bool bAdvancedMode; - std::list< Window*> maAdvanced; - std::list< Window*> maSimple; - rtl::OUString mSimpleLabel; - rtl::OUString mAdvancedLabel; - - Window* Remove( std::list< Window*> lst, Window* w ) - { - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); it++ ) - if ( *it == w ) - { - lst.erase( it ); - return *it; - } - return 0; - } - void redraw() - { - uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY ); - ::Window* window = VCLXWindow::GetImplementation( ref )->GetWindow(); - ::Window* parent = window->GetParent(); - - ::Rectangle r = Rectangle( parent->GetPosPixel(), - parent->GetSizePixel() ); - - parent->Invalidate( r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN ); - parent->SetPosSizePixel( 0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop, - awt::PosSize::SIZE ); - } - -public: - AdvancedButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow ) - : PushButtonImpl( pCtx, xPeer, pWindow ) - , bAdvancedMode( false ) - // TODO: i18n - // Button::GetStandardText( BUTTON_ADVANCED ); - // Button::GetStandardText( BUTTON_SIMPLE ); - , mSimpleLabel( rtl::OUString::createFromAscii( "Advanced..." ) ) - , mAdvancedLabel( rtl::OUString::createFromAscii( "Simple..." ) ) - { - } - void Click() - { - bAdvancedMode = !bAdvancedMode; - if ( bAdvancedMode ) - advancedMode(); - else - simpleMode(); - } - void advancedMode() - { - // TODO: set symbol/image? - // SYMBOL_PAGEUP, SYMBOL_PAGEDOWN -#if 0 - // How to set images from here? - // XImageConsumer looks like a disaster - // Should move all this switching functionality to VCLXAdvancedButton? - /biek/home/janneke/vc/layout-cws/default_images/res/commandimagelist/ - sc_arrowshapes_down.png - sch_flowchartshapes.flowchart-extract.png - sch_flowchartshapes.flowchart-merge.png -#endif - mxButton->setLabel( mAdvancedLabel ); - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); it++ ) - ( *it )->Show(); - for ( std::list< Window*>::iterator it = maSimple.begin(); - it != maSimple.end(); it++ ) - ( *it )->Hide(); - - redraw(); - } - - void simpleMode() - { - mxButton->setLabel( mSimpleLabel ); - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); it++ ) - ( *it )->Hide(); - for ( std::list< Window*>::iterator it = maSimple.begin(); - it != maSimple.end(); it++ ) - ( *it )->Show(); - - redraw(); - } - void AddAdvanced( Window* w ) - { - maAdvanced.push_back( w ); - if ( !bAdvancedMode ) - w->Hide(); - } - void AddSimple( Window* w ) - { - maSimple.push_back( w ); - if ( bAdvancedMode ) - w->Hide(); - } - void RemoveAdvanced( Window* w ) - { - Remove( maAdvanced, w ); - } - void RemoveSimple( Window* w ) - { - Remove( maSimple, w ); - } -}; - -void AdvancedButton::AddAdvanced( Window* w ) -{ - getImpl().AddAdvanced( w ); -} - -void AdvancedButton::AddSimple( Window* w ) -{ - getImpl().AddSimple( w ); -} - -void AdvancedButton::RemoveAdvanced( Window* w ) -{ - getImpl().RemoveAdvanced( w ); -} - -void AdvancedButton::RemoveSimple( Window* w ) -{ - getImpl().RemoveSimple( w ); -} - -DECL_CONSTRUCTOR_IMPLS( AdvancedButton, PushButton, "advancedbutton" ); -DECL_GET_IMPL_IMPL( AdvancedButton ); - - -class MoreButtonImpl : public AdvancedButtonImpl -{ -public: - MoreButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow ) - : AdvancedButtonImpl( pCtx, xPeer, pWindow) - { - mAdvancedLabel = ::Button::GetStandardText( BUTTON_LESS ); - mSimpleLabel = ::Button::GetStandardText( BUTTON_MORE ); - } - void AddWindow( Window* w ) { AddAdvanced( w ); } - void RemoveWindow( Window* w ) { RemoveAdvanced( w ); } -}; - -// TODO -//BUTTON_IMPL( MoreButton, PushButton, 0 ); -DECL_CONSTRUCTOR_IMPLS( MoreButton, AdvancedButton, "morebutton" ); -DECL_GET_IMPL_IMPL( MoreButton ); - -void MoreButton::AddWindow( Window* w ) -{ - getImpl().AddWindow( w ); -} - -void MoreButton::RemoveWindow( Window* w ) -{ - getImpl().RemoveWindow( w ); -} - -} // namespace layout diff --git a/toolkit/source/vclcompat/wfield.cxx b/toolkit/source/vclcompat/wfield.cxx deleted file mode 100644 index 0d2284126e87..000000000000 --- a/toolkit/source/vclcompat/wfield.cxx +++ /dev/null @@ -1,627 +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: wfield.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. - * - ************************************************************************/ - -#include "wrapper.hxx" - -#include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/XMetricField.hpp> -#include <com/sun/star/awt/XCurrencyField.hpp> -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/awt/XListBox.hpp> -#include <com/sun/star/awt/XComboBox.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/awt/XActionListener.hpp> -#include <com/sun/star/awt/XItemListener.hpp> - -using namespace ::com::sun::star; - -namespace layout -{ - -class EditImpl : public ControlImpl, - public ::cppu::WeakImplHelper1< awt::XTextListener > -{ - Link maModifyHdl; -public: - uno::Reference< awt::XTextComponent > mxEdit; - EditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ) - , mxEdit( xPeer, uno::UNO_QUERY ) - { - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { - SetModifyHdl( Link() ); - mxEdit.clear(); - } - - void SetModifyHdl( const Link& rLink ) - { - if ( !mxEdit.is() ) - return; - maModifyHdl = rLink; - if ( !rLink ) - mxEdit->removeTextListener( this ); - else - mxEdit->addTextListener( this ); - } - - void SAL_CALL textChanged( const css::awt::TextEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - maModifyHdl.Call( mpWindow ); - } -}; - -void Edit::SetText( const XubString& rStr ) const -{ - if ( !getImpl().mxEdit.is() ) - return; - getImpl().mxEdit->setText( rStr ); -} - -XubString Edit::GetText() const -{ - if ( !getImpl().mxEdit.is() ) - return XubString(); - return XubString( getImpl().mxEdit->getText()); -} - -void Edit::SetModifyHdl( const Link& rLink ) -{ - getImpl().SetModifyHdl( rLink ); -} - -DECL_CONSTRUCTOR_IMPLS( Edit, Control, "edit" ); -DECL_GET_IMPL_IMPL( Edit ); - -// Window/Control/Edit/MultiLineEdit -class MultiLineEditImpl : public EditImpl -{ -public: - MultiLineEditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : EditImpl( pCtx, xPeer, pWindow ) - { - } -}; - -DECL_CONSTRUCTOR_IMPLS( MultiLineEdit, Edit, "multilineedit" ); -DECL_GET_IMPL_IMPL( MultiLineEdit ); - -// Window/Control/Edit/SpinField -class SpinFieldImpl : public EditImpl -{ -public: - SpinFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : EditImpl( pCtx, xPeer, pWindow ) - { - } -}; - -DECL_CONSTRUCTOR_IMPLS( SpinField, Edit, "spinfield" ); - -// Window/Control/Edit/SpinField/NumericField -class NumericFieldImpl : public SpinFieldImpl -{ -public: - NumericFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : SpinFieldImpl( pCtx, xPeer, pWindow ) - { - } -}; - -// Window/Control/Edit/SpinField/MetricField -class MetricFieldImpl : public SpinFieldImpl -{ -public: - MetricFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : SpinFieldImpl( pCtx, xPeer, pWindow ) - { - } -}; - -DECL_GET_IMPL_IMPL( SpinField ); -DECL_GET_IMPL_IMPL( NumericField ); -DECL_GET_IMPL_IMPL( MetricField ); - -// FormatterBase -class FormatterBaseImpl -{ -protected: - PeerHandle mxPeer; -public: - explicit FormatterBaseImpl( const PeerHandle &xPeer ) - : mxPeer( xPeer ) - { - }; -}; - -class NumericFormatterImpl : public FormatterBaseImpl -{ -public: - uno::Reference< awt::XCurrencyField > mxField; - explicit NumericFormatterImpl( const PeerHandle &xPeer ) - : FormatterBaseImpl( xPeer ) - , mxField( xPeer, uno::UNO_QUERY ) - { - } - - // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx - double valueToDouble( sal_Int64 nValue ) - { - sal_Int16 nDigits = mxField->getDecimalDigits(); - double n = (double)nValue; - for ( sal_uInt16 d = 0; d < nDigits; d++ ) - n /= 10; - return n; - } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx - sal_Int64 doubleToValue( double nValue ) - { - sal_Int16 nDigits = mxField->getDecimalDigits(); - double n = nValue; - for ( sal_uInt16 d = 0; d < nDigits; d++ ) - n *= 10; - return (sal_Int64) n; - } -}; - -class MetricFormatterImpl : public FormatterBaseImpl -{ -public: - uno::Reference< awt::XMetricField > mxField; - explicit MetricFormatterImpl( const PeerHandle &xPeer ) - : FormatterBaseImpl( xPeer ) - , mxField( xPeer, uno::UNO_QUERY ) - { - } -}; - -// NumericFormatter - -NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl ) - : FormatterBase( pImpl ) -{ -} - -NumericFormatterImpl& NumericFormatter::getFormatImpl() const -{ - return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) ); -} - -#define SET_IMPL(vclmethod, idlmethod) \ - void NumericFormatter::vclmethod( sal_Int64 nValue ) \ - { \ - if ( !getFormatImpl().mxField.is() ) \ - return; \ - getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \ - } - -SET_IMPL( SetMin, setMin ) -SET_IMPL( SetMax, setMax ) -SET_IMPL( SetLast, setLast ) -SET_IMPL( SetFirst, setFirst ) -SET_IMPL( SetValue, setValue ) -SET_IMPL( SetSpinSize, setSpinSize ) - -sal_Int64 NumericFormatter::GetValue() const -{ - if ( !getFormatImpl().mxField.is() ) - return 0; - return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() ); -} - -#undef SET_IMPL - -DECL_CONSTRUCTOR_IMPLS_2( NumericField, SpinField, NumericFormatter, "numericfield" ); - -// MetricFormatter - -MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl ) - : FormatterBase( pImpl ) -{ -} -MetricFormatterImpl& MetricFormatter::getFormatImpl() const -{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); } - -#define MetricUnitVclToUno(a) ((sal_uInt16)(a)) - -#define SET_IMPL(vclmethod, idlmethod) \ - void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \ - { \ - if ( !getFormatImpl().mxField.is() ) \ - return; \ - getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \ - } - -SET_IMPL( SetMin, setMin ) -SET_IMPL( SetMax, setMax ) -SET_IMPL( SetLast, setLast ) -SET_IMPL( SetFirst, setFirst ) -SET_IMPL( SetValue, setValue ) - -#undef SET_IMPL - -void MetricFormatter::SetSpinSize( sal_Int64 nValue ) -{ - if ( !getFormatImpl().mxField.is() ) - return; - getFormatImpl().mxField->setSpinSize( nValue ); -} - -sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const -{ - if ( !getFormatImpl().mxField.is() ) - return 0; - return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) ); -} - -DECL_CONSTRUCTOR_IMPLS_2( MetricField, SpinField, MetricFormatter, "metricfield" ); - -// Window/Control/Edit/ComboBox -class ComboBoxImpl : public EditImpl, - public ::cppu::WeakImplHelper1< awt::XActionListener >, - public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maClickHdl, maSelectHdl; -public: - uno::Reference< awt::XComboBox > mxComboBox; - ComboBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : EditImpl( pCtx, xPeer, pWindow ), - mxComboBox( xPeer, uno::UNO_QUERY ) - { - } - - USHORT InsertEntry(const XubString& rStr, USHORT nPos) - { - if ( nPos == COMBOBOX_APPEND ) - nPos = GetEntryCount(); - mxComboBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - void RemoveEntry( USHORT nPos ) - { - mxComboBox->removeItems( nPos, 1 ); - } - - USHORT GetEntryPos( const XubString& rStr ) const - { - uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() ); - rtl::OUString rKey( rStr ); - for ( unsigned int i = 0; aItems.getLength(); i++ ) - { - if ( aItems[ i ] == rKey ) - return sal::static_int_cast< USHORT >( i ); - } - return COMBOBOX_ENTRY_NOTFOUND; - } - - XubString GetEntry( USHORT nPos ) const - { - return XubString( mxComboBox->getItem( nPos ) ); - } - - USHORT GetEntryCount() const - { - return mxComboBox->getItemCount(); - } - - void SetClickHdl( const Link& rLink ) - { - maClickHdl = rLink; - if ( !rLink ) - mxComboBox->removeActionListener( this ); - else - mxComboBox->addActionListener( this ); - } - - void SetSelectHdl( const Link& rLink ) - { - maSelectHdl = rLink; - if ( !rLink ) - mxComboBox->removeItemListener( this ); - else - mxComboBox->addItemListener( this ); - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { - mxComboBox.clear(); - } - - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); - if ( !pComboBox ) - return; - maClickHdl.Call( pComboBox ); - } - - virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); - if ( !pComboBox ) - return; - maSelectHdl.Call( pComboBox ); - } -}; - -USHORT ComboBox::InsertEntry( const XubString &rStr, USHORT nPos ) -{ - return getImpl().InsertEntry( rStr, nPos ); -} - -void ComboBox::RemoveEntry( const XubString& rStr ) -{ - getImpl().RemoveEntry( GetEntryPos( rStr ) ); -} - -void ComboBox::RemoveEntry( USHORT nPos ) -{ - getImpl().RemoveEntry( nPos ); -} - -void ComboBox::Clear() -{ - uno::Sequence< rtl::OUString> aNoItems; - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); -} - -USHORT ComboBox::GetEntryPos( const XubString& rStr ) const -{ - return getImpl().GetEntryPos( rStr ); -} - -XubString ComboBox::GetEntry( USHORT nPos ) const -{ - rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos ); - return XubString( rItem ); -} - -USHORT ComboBox::GetEntryCount() const -{ - return getImpl().GetEntryCount(); -} - -void ComboBox::SetClickHdl( const Link& rLink ) -{ - getImpl().SetClickHdl( rLink ); -} - -void ComboBox::SetSelectHdl( const Link& rLink ) -{ - getImpl().SetSelectHdl( rLink ); -} - -DECL_CONSTRUCTOR_IMPLS( ComboBox, Edit, "combobox" ); -DECL_GET_IMPL_IMPL( ComboBox ); - -// Window/Control/ListBox -class ListBoxImpl : public ControlImpl, - public ::cppu::WeakImplHelper1< awt::XActionListener >, - public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maClickHdl, maSelectHdl; -public: - uno::Reference< awt::XListBox > mxListBox; - ListBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ), - mxListBox( xPeer, uno::UNO_QUERY ) - { - } - - USHORT InsertEntry(const XubString& rStr, USHORT nPos) - { - if ( nPos == LISTBOX_APPEND ) - nPos = mxListBox->getItemCount(); - mxListBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - void RemoveEntry( USHORT nPos ) - { - mxListBox->removeItems( nPos, 1 ); - } - - USHORT RemoveEntry(const XubString& rStr, USHORT nPos) - { - if ( nPos == LISTBOX_APPEND ) - nPos = mxListBox->getItemCount(); - mxListBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - USHORT GetEntryPos( const XubString& rStr ) const - { - uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() ); - rtl::OUString rKey( rStr ); - for ( unsigned int i = 0; aItems.getLength(); i++ ) - { - if ( aItems[ i ] == rKey ) - return sal::static_int_cast< USHORT >( i ); - } - return LISTBOX_ENTRY_NOTFOUND; - } - - XubString GetEntry( USHORT nPos ) const - { - return mxListBox->getItem( nPos ); - } - - USHORT GetEntryCount() const - { - return mxListBox->getItemCount(); - } - - void SelectEntryPos( USHORT nPos, BOOL bSelect ) - { - mxListBox->selectItemPos( nPos, bSelect ); - } - - USHORT GetSelectEntryCount() const - { - return sal::static_int_cast< USHORT >( mxListBox->getSelectedItems().getLength() ); - } - - USHORT GetSelectEntryPos( USHORT nSelIndex ) const - { - USHORT nSelected = 0; - if ( mxListBox->isMutipleMode() ) - { - uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() ); - if ( nSelIndex < aItems.getLength() ) - nSelected = aItems[ nSelIndex ]; - } - else - nSelected = mxListBox->getSelectedItemPos(); - return nSelected; - } - - void SetClickHdl( const Link& rLink ) - { - maClickHdl = rLink; - if ( !rLink ) - mxListBox->removeActionListener( this ); - else - mxListBox->addActionListener( this ); - } - - void SetSelectHdl( const Link& rLink ) - { - maSelectHdl = rLink; - if ( !rLink ) - mxListBox->removeItemListener( this ); - else - mxListBox->addItemListener( this ); - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { - mxListBox.clear(); - } - - void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - maClickHdl.Call( mpWindow ); - } - - void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ ) - throw (css::uno::RuntimeException) - { - ListBox* pListBox = static_cast<ListBox*>( mpWindow ); - if ( !pListBox ) - return; - maSelectHdl.Call( pListBox ); - } -}; - -USHORT ListBox::InsertEntry(const XubString& rStr, USHORT nPos) -{ - return getImpl().InsertEntry(rStr, nPos); -} - -void ListBox::RemoveEntry( USHORT nPos ) -{ - return getImpl().RemoveEntry( nPos ); -} - -void ListBox::RemoveEntry( const XubString& rStr ) -{ - return getImpl().RemoveEntry( GetEntryPos( rStr ) ); -} - -void ListBox::Clear() -{ - uno::Sequence< rtl::OUString> aNoItems; - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); -} - -USHORT ListBox::GetEntryPos( const XubString& rStr ) const -{ - return getImpl().GetEntryPos( rStr ); -} - -XubString ListBox::GetEntry( USHORT nPos ) const -{ - return getImpl().GetEntry( nPos ); -} - -USHORT ListBox::GetEntryCount() const -{ - return getImpl().GetEntryCount(); -} - -void ListBox::SelectEntryPos( USHORT nPos, BOOL bSelect ) -{ - getImpl().SelectEntryPos( nPos, bSelect ); -} - -void ListBox::SelectEntry( const XubString& rStr, BOOL bSelect ) -{ - SelectEntryPos( GetEntryPos( rStr ), bSelect ); -} - -USHORT ListBox::GetSelectEntryCount() const -{ - return getImpl().GetSelectEntryCount(); -} - -USHORT ListBox::GetSelectEntryPos( USHORT nSelIndex ) const -{ - return getImpl().GetSelectEntryPos( nSelIndex ); -} - -XubString ListBox::GetSelectEntry( USHORT nSelIndex ) const -{ - return GetEntry( GetSelectEntryPos( nSelIndex ) ); -} - -void ListBox::SetSelectHdl( const Link& rLink ) -{ - getImpl().SetSelectHdl( rLink ); -} - -void ListBox::SetClickHdl( const Link& rLink ) -{ - getImpl().SetClickHdl( rLink ); -} - -DECL_CONSTRUCTOR_IMPLS( ListBox, Control, "listbox" ); -DECL_GET_IMPL_IMPL( ListBox ); - -} // namespace layout diff --git a/toolkit/source/vclcompat/wrapper.cxx b/toolkit/source/vclcompat/wrapper.cxx deleted file mode 100644 index 77e6c6c7fdb0..000000000000 --- a/toolkit/source/vclcompat/wrapper.cxx +++ /dev/null @@ -1,569 +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: wrapper.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. - * - ************************************************************************/ - -#include "wrapper.hxx" - -#include <com/sun/star/graphic/XGraphic.hpp> -#include <com/sun/star/awt/XFixedText.hpp> -#include <com/sun/star/awt/XDialog2.hpp> -#include <com/sun/star/awt/XProgressBar.hpp> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <comphelper/processfactory.hxx> -#include <vcl/window.hxx> -#include <toolkit/awt/vclxwindow.hxx> - -#include <layout/layoutcore.hxx> -#include <layout/factory.hxx> -#include <layout/root.hxx> -#include <vcl/image.hxx> - -using namespace ::com::sun::star; - -namespace layout -{ - -// Context bits ... -class ContextImpl -{ - uno::Reference< awt::XLayoutRoot > mxRoot; - uno::Reference< container::XNameAccess > mxNameAccess; - PeerHandle mxTopLevel; - -public: - ContextImpl( char const *pPath ) - { - uno::Sequence< uno::Any > aParams( 1 ); - aParams[0] <<= rtl::OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 ); - - uno::Reference< lang::XSingleServiceFactory > xFactory( - comphelper::createProcessComponent( - rtl::OUString::createFromAscii( "com.sun.star.awt.Layout" ) ), - uno::UNO_QUERY ); - if ( !xFactory.is() ) - { - throw uno::RuntimeException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ), - uno::Reference< uno::XInterface >() ); - } - mxRoot = uno::Reference< awt::XLayoutRoot >( - xFactory->createInstanceWithArguments( aParams ), - uno::UNO_QUERY ); - - mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY ); - } - - ~ContextImpl() - { - } - - PeerHandle getByName( const rtl::OUString &rName ) - { - uno::Any val = mxNameAccess->getByName( rName ); - PeerHandle xRet; - val >>= xRet; - return xRet; - } - PeerHandle getTopLevel() { return mxTopLevel; } - void setTopLevel( PeerHandle xToplevel ) { mxTopLevel = xToplevel; } - PeerHandle getRoot() { return mxRoot; } -}; - -Context::Context( const char *pPath ) - : pImpl( new ContextImpl( pPath ) ) -{ -} -Context::~Context() -{ - delete pImpl; - pImpl = NULL; -} - -void Context::setToplevel( PeerHandle xToplevel ) -{ - pImpl->setTopLevel( xToplevel ); -} - -PeerHandle Context::getToplevel() -{ - return pImpl->getTopLevel(); -} -PeerHandle Context::getRoot() -{ - return pImpl->getRoot(); -} - -PeerHandle Context::GetPeerHandle( const char *pId, sal_uInt32 nId ) const -{ - PeerHandle xHandle; - xHandle = pImpl->getByName( rtl::OUString( pId, strlen( pId ), RTL_TEXTENCODING_UTF8 ) ); - if ( !xHandle.is() ) - { - DBG_ERROR1( "Failed to fetch widget '%s'", pId ); - } - - if ( nId != 0 ) - { - rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId ); - xHandle = GetPeerHandle( aStr, 0 ); - } - return xHandle; -} - -// Window/Dialog -class DialogImpl : public WindowImpl -{ -public: - uno::Reference< awt::XDialog2 > mxDialog; - DialogImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : WindowImpl( pCtx, xPeer, pWindow ) - , mxDialog( xPeer, uno::UNO_QUERY ) - { - } -}; - -// Accessors -DECL_GET_IMPL_IMPL( Control ) -DECL_GET_IMPL_IMPL( Dialog ) - -Window::Window( WindowImpl *pImpl ) -: mpImpl( pImpl ) -{ -} - -Window::~Window() -{ - /* likely to be an UNO object - with floating references */ - mpImpl->wrapperGone(); - mpImpl = NULL; -} - -Context *Window::getContext() -{ - return this && mpImpl ? mpImpl->mpCtx : NULL; -} - -PeerHandle Window::GetPeer() -{ - if (!mpImpl) - return PeerHandle(); - return mpImpl->mxWindow; -} - -struct ToolkitVclPropsMap -{ - WinBits vclStyle; - long initAttr; - const char *propName; - - // the value to give the prop to enable/disable it -- not the most brilliant - // type declaration and storage, but does the work... properties are - // either a boolean or a short since they are either a directly wrappers for - // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER). - bool isBoolean; - short enableProp, disableProp; -}; - -#define TYPE_BOOL true -#define TYPE_SHORT false -#define NOTYPE 0 -static const ToolkitVclPropsMap toolkitVclPropsMap[] = -{ - { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 }, - { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 }, - { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 }, - { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 }, - { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 }, - - { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 }, - { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 }, - { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 }, - { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 }, - { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 }, - { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 }, - { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 }, - { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 }, - { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 }, - { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 }, - { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 }, - { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 }, - - { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 }, - { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 }, - { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 }, - { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 }, - { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 }, - { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 }, - { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 }, - - { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 }, - { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 }, - - { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 }, - { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 }, - { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 }, - { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 }, - { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 }, -}; -#undef TYPE_BOOL -#undef TYPE_SHORT -#undef NOTYPE - -static const int toolkitVclPropsMapLen = - sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap ); - -void Window::SetStyle( WinBits nStyle ) -{ - uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer; - for ( int i = 0; i < toolkitVclPropsMapLen; i++ ) - { - if ( toolkitVclPropsMap[ i ].propName ) - { - short nValue; - if ( nStyle & toolkitVclPropsMap[ i ].vclStyle ) - nValue = toolkitVclPropsMap[ i ].enableProp; - else - nValue = toolkitVclPropsMap[ i ].disableProp; - uno::Any aValue; - if ( toolkitVclPropsMap[ i ].isBoolean ) - aValue = uno::makeAny( (bool) nValue ); - else - aValue = uno::makeAny( (short) nValue ); - mpImpl->setProperty( toolkitVclPropsMap[ i ].propName, aValue ); - } - } -} - -WinBits Window::GetStyle() -{ - uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer; - WinBits ret = 0; - for ( int i = 0; i < toolkitVclPropsMapLen; i++ ) - { - if ( toolkitVclPropsMap[ i ].propName ) - { - short nValue = 0; - if ( toolkitVclPropsMap[ i ].isBoolean ) - { - bool bValue = false; - mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= bValue; - nValue = bValue ? 1 : 0; - } - else - mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= nValue; - if ( nValue == toolkitVclPropsMap[ i ].enableProp ) - ret |= toolkitVclPropsMap[i].vclStyle; - } - } - return ret; -} - -/* Unpleasant way to get an xToolkit pointer ... */ -uno::Reference< awt::XToolkit > getToolkit() -{ - static uno::Reference< awt::XToolkit > xToolkit; - if (!xToolkit.is()) - { - // Urgh ... - xToolkit = uno::Reference< awt::XToolkit >( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), - uno::UNO_QUERY ); - if ( !xToolkit.is() ) - throw uno::RuntimeException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ), - uno::Reference< uno::XInterface >() ); - } - return xToolkit; -} - -PeerHandle Window::CreatePeer( Window *pParent, WinBits nStyle, const char *pName) -{ - - long nWinAttrbs = 0; - for ( int i = 0; i < toolkitVclPropsMapLen; i++ ) - if ( nStyle & toolkitVclPropsMap[ i ].vclStyle ) - nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr; - - return layoutimpl::createWidget( getToolkit(), pParent->GetPeer(), - rtl::OUString::createFromAscii( pName ), nWinAttrbs ); -} - -void Window::Enable( bool bEnable ) -{ - if ( !getImpl().mxWindow.is() ) - return; - getImpl().mxWindow->setEnable( bEnable ); -} - -void Window::Show( BOOL bVisible ) -{ - if ( !getImpl().mxWindow.is() ) - return; - getImpl().mxWindow->setVisible( bVisible ); -} - -void Window::GrabFocus() -{ - if ( !getImpl().mxWindow.is() ) - return; - getImpl().mxWindow->setFocus(); -} - -Dialog::Dialog( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId ) - : Context( pXMLPath ) - , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) ) -{ - if ( pParent ) - SetParent( pParent ); -} - -Dialog::Dialog( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId ) - : Context( pXMLPath ) - , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) ) -{ - if ( pParent ) - SetParent( pParent ); -} - -void Dialog::SetParent( ::Window *pParent ) -{ - uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY ); - ::Window *window = VCLXWindow::GetImplementation( ref )->GetWindow(); - window->SetParent( pParent ); -} - -void Dialog::SetParent( Window *pParent ) -{ - uno::Reference <awt::XWindow> parentRef( pParent->GetPeer(), uno::UNO_QUERY ); - ::Window *parentWindow = VCLXWindow::GetImplementation( parentRef )->GetWindow(); - SetParent( parentWindow ); -} - -short Dialog::Execute() -{ - if ( !getImpl().mxDialog.is() ) - return -1; - return getImpl().mxDialog->execute(); -} - -void Dialog::EndDialog( long nResult ) -{ - if ( !getImpl().mxDialog.is() ) - return; - getImpl().mxDialog->endDialog( nResult ); -} - -void Dialog::SetText( const String& rStr ) -{ - if ( !getImpl().mxDialog.is() ) - return; - getImpl().mxDialog->setTitle( rStr ); -} - -class FixedLineImpl : public ControlImpl -{ -public: - FixedLineImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ) - { - } -}; - -DECL_CONSTRUCTOR_IMPLS( FixedLine, Control, "hfixedline" ); -DECL_GET_IMPL_IMPL( FixedLine ) - -bool FixedLine::IsEnabled() -{ - //FIXME - return true; -} - -class FixedTextImpl : public ControlImpl -{ -public: - uno::Reference< awt::XFixedText > mxFixedText; - FixedTextImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ) - , mxFixedText( xPeer, uno::UNO_QUERY ) - { - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { - mxFixedText.clear(); - } -}; - -DECL_CONSTRUCTOR_IMPLS( FixedText, Control, "fixedtext" ); -DECL_GET_IMPL_IMPL( FixedText ) - -void FixedText::SetText( const String& rStr ) -{ - if ( !getImpl().mxFixedText.is() ) - return; - getImpl().mxFixedText->setText( rStr ); -} - -class FixedInfoImpl : public FixedTextImpl -{ -public: - FixedInfoImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : FixedTextImpl( pCtx, xPeer, pWindow ) - { - } -}; - -DECL_CONSTRUCTOR_IMPLS( FixedInfo, FixedText, "fixedinfo" ); -DECL_GET_IMPL_IMPL( FixedInfo ); - -class ProgressBarImpl : public ControlImpl -{ -public: - uno::Reference< awt::XProgressBar > mxProgressBar; - ProgressBarImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : ControlImpl( pCtx, xPeer, pWindow ) - , mxProgressBar( xPeer, uno::UNO_QUERY ) - { - } - - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ ) - throw (css::uno::RuntimeException) - { - mxProgressBar.clear(); - } -}; - - -class FixedImageImpl: public ControlImpl -{ -public: - uno::Reference< graphic::XGraphic > mxGraphic; - FixedImageImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow) -// const char *pName ) - : ControlImpl( pCtx, xPeer, pWindow ) - //, mxGraphic( layoutimpl::loadGraphic( pName ) ) - , mxGraphic( xPeer, uno::UNO_QUERY ) - { - if ( !mxGraphic.is() ) - { - DBG_ERROR( "ERROR: failed to load image: `%s'" /*, pName*/ ); - } -#if 0 - else - getImpl().mxGraphic->...(); -#endif - } -}; - -DECL_CONSTRUCTOR_IMPLS( FixedImage, Control, "fixedimage" ); -DECL_GET_IMPL_IMPL( FixedImage ) - -void FixedImage::setImage( ::Image const& i ) -{ - (void) i; - if ( !getImpl().mxGraphic.is() ) - return; - //FIXME: hack moved to proplist - //getImpl().mxGraphic = -} - -#if 0 - - FixedImage::FixedImage( const char *pName ) - : pImpl( new FixedImageImpl( pName ) ) -{ -} - -FixedImage::~FixedImage() -{ - delete pImpl; -} - -#endif - - -DECL_CONSTRUCTOR_IMPLS( ProgressBar, Control, "ProgressBar" ); -#if 0 -ProgressBar::ProgressBar( Context *pCtx, const char *pId, sal_uInt32 nId ) - : Control( new ProgressBarImpl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) -{ -} -ProgressBar::ProgressBar( Window *pParent, WinBits nBits) -// : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "ProgressBar" ), this ) ) - : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "progressbar" ), this ) ) -{ -} -#endif - -DECL_GET_IMPL_IMPL( ProgressBar ) - - -void ProgressBar::SetForegroundColor( css::util::Color color ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setForegroundColor( color ); -} - -void ProgressBar::SetBackgroundColor( css::util::Color color ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setBackgroundColor( color ); -} - -void ProgressBar::SetValue( sal_Int32 i ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setValue( i ); -} - -void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setRange( min, max ); -} - -sal_Int32 ProgressBar::GetValue() -{ - if ( !getImpl().mxProgressBar.is() ) - return 0; - return getImpl().mxProgressBar->getValue(); -} - -} // namespace layout diff --git a/toolkit/source/vclcompat/wrapper.hxx b/toolkit/source/vclcompat/wrapper.hxx deleted file mode 100644 index 9135aa1148ce..000000000000 --- a/toolkit/source/vclcompat/wrapper.hxx +++ /dev/null @@ -1,136 +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: wrapper.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 WRAPPER_HXX -#define WRAPPER_HXX - -#include <layout/layout.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> - -#include <cstring> - -namespace css = com::sun::star; - -namespace layout -{ - -class WindowImpl -{ - public: - Window *mpWindow; - Context *mpCtx; - css::uno::Reference< css::awt::XWindow > mxWindow; - css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer; - - WindowImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : mpWindow ( pWindow ) - , mpCtx ( pCtx ) - , mxWindow ( xPeer, css::uno::UNO_QUERY ) - , mxVclPeer( xPeer, css::uno::UNO_QUERY ) - { - } - - virtual ~WindowImpl() - { - } - - void wrapperGone() - { - mpWindow = NULL; - mpCtx = NULL; - if ( mxWindow.is() ) - { - css::uno::Reference< css::lang::XComponent > xComp( mxWindow, css::uno::UNO_QUERY ); - mxWindow.clear(); - if ( xComp.is() ) - xComp->dispose(); - } - } - - css::uno::Any getProperty( const char *pName ) - { - if ( !this || !mxVclPeer.is() ) - return css::uno::Any(); - return mxVclPeer->getProperty - ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ) ); - } - void setProperty( const char *pName, css::uno::Any aAny ) - { - if ( !this || !mxVclPeer.is() ) - return; - mxVclPeer->setProperty - ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ), aAny ); - } -}; - -class ControlImpl : public WindowImpl -{ - public: - ControlImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow ) - : WindowImpl( pCtx, xPeer, pWindow ) {} -}; - -inline WindowImpl &Window::getImpl() const -{ return *(static_cast< WindowImpl * >( mpImpl )); } - -// Helpers for defining boiler-plate constructors ... -// Could in-line in top-level but not with safe static_casts. -#define DECL_GET_IMPL_IMPL(t) \ - inline t##Impl &t::getImpl() const \ - { \ - return *(static_cast<t##Impl *>(mpImpl)); \ - } -#define DECL_CONSTRUCTOR_IMPLS(t,par,unoName) \ - t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \ - : par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \ - { \ - } \ - t::t( Window *pParent, WinBits nBits) \ - : par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \ - { \ - } -#define DECL_CONSTRUCTOR_IMPLS_2(t,win_par,other_par,unoName) \ - t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \ - : win_par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \ - , other_par( new other_par##Impl( Window::GetPeer() ) ) \ - { \ - } \ - t::t( Window *pParent, WinBits nBits ) \ - : win_par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \ - , other_par( new other_par##Impl( Window::GetPeer() ) ) \ - { \ - } - -} // namespace layout - -#endif // WRAPPER_HXX diff --git a/toolkit/src2xml/source/boxer.py b/toolkit/src2xml/source/boxer.py index c697ec8f1c52..1b716d757299 100644 --- a/toolkit/src2xml/source/boxer.py +++ b/toolkit/src2xml/source/boxer.py @@ -9,11 +9,11 @@ class DlgLayoutBuilder(object): def addWidget (self, elem): x, y = int(elem.getAttr('x')), int(elem.getAttr('y')) - if self.rows.has_key(y): - self.rows[y][x] = elem - else: - self.rows[y] = {} - self.rows[y][x] = elem + self.rows[y] = self.rows.get (y, {}) + while self.rows[y].has_key(x): + y += 1 + self.rows[y] = self.rows.get (y, {}) + self.rows[y][x] = elem def build (self): root = Element('vbox') @@ -53,6 +53,8 @@ class Boxer(object): newnode = Element(dlgnode.name) newnode.clone(dlgnode) + if dlgnode.name == 'string': + return newnode newnode.setAttr("xmlns", "http://openoffice.org/2007/layout") newnode.setAttr("xmlns:cnt", "http://openoffice.org/2007/layout/container") mx = DlgLayoutBuilder(newnode) diff --git a/toolkit/src2xml/source/src2xml.py b/toolkit/src2xml/source/src2xml.py index a2a7714b963d..b03c5e61ede1 100644 --- a/toolkit/src2xml/source/src2xml.py +++ b/toolkit/src2xml/source/src2xml.py @@ -127,7 +127,6 @@ def convert (file_name, options): lexer.includeDirs = options.include_path lexer.stopOnHeader = options.stopOnHeader lexer.debugMacro = options.debug_macro -# lexer.debug = True if options.debug_lexer: lexer.debug = True lexer.tokenize() @@ -145,8 +144,8 @@ def convert (file_name, options): if options.debug_parser: parser.debug = True root = parser.parse() - print root.dump() - return + s = root.dump() + return s # Parse the tokens. root = parser.parse() @@ -174,13 +173,18 @@ def post_process (s): """Make output directly usable by layout module.""" s = re.sub ('(</?)([a-z]+)-([a-z]+)-([a-z]+)', r'\1\2\3\4', s) s = re.sub ('(</?)([a-z]+)-([a-z]+)', r'\1\2\3', s) - s = re.sub ('(<(radiobutton|(fixed(info|text)))[^>]*) text=', r'\1 label=', s) + s = re.sub ('(<(checkbox|(cancel|help|ignore|ok|push|more|no|radio|reset|retry|yes)button|(fixed(info|text)))[^>]*) text=', r'\1 label=', s) s = re.sub (' (height|width|x|y)="[0-9]*"', '', s) + s = re.sub (' (label|text|title)="', r' _\1="', s) + s = re.sub ('&([^m][^p]*[^;]*)', r'&\1', s) + s = re.sub (' hide="(TRUE|true|1)"', ' show="false"', s) s = s.replace ('<modaldialog', '<modaldialog sizeable="true"') s = s.replace (' rid=', ' id=') s = s.replace (' border="true"', ' has_border="true"') - s = s.replace (' def-button="true"', ' default="true"') + s = s.replace (' def-button="true"', ' defbutton="true"') + s = s.replace (' drop-down="', ' dropdown="') + s = s.replace (' tab-stop="', ' tabstop="') return s XML_HEADER = '''<?xml version="1.0" encoding="UTF-8"?> diff --git a/toolkit/uiconfig/layout/delzip b/toolkit/uiconfig/layout/delzip new file mode 100644 index 000000000000..7b4d68d70fca --- /dev/null +++ b/toolkit/uiconfig/layout/delzip @@ -0,0 +1 @@ +empty
\ No newline at end of file diff --git a/toolkit/uiconfig/layout/makefile.mk b/toolkit/uiconfig/layout/makefile.mk new file mode 100644 index 000000000000..f0fe9159fc04 --- /dev/null +++ b/toolkit/uiconfig/layout/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# 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., 51 Franklin Street, 5th Floor, Boston, +# MA 02110-1301 USA +# +#************************************************************************* + +PRJ=../.. +PRJNAME=toolkit +TARGET=layout + +.INCLUDE : settings.mk + +.IF "$(ENABLE_LAYOUT)" == "TRUE" + +all: ALLTAR + +XML_FILES=\ + message-box.xml\ + tab-dialog.xml\ + +# + +.INCLUDE : layout.mk + +.ELSE # ENABLE_LAYOUT != TRUE +all .PHONY: +.ENDIF # ENABLE_LAYOUT != TRUE + +.INCLUDE : target.mk + +localize.sdf: + echo '#empty' | cat - > $@ + rm -f *-$@ diff --git a/toolkit/uiconfig/layout/message-box.xml b/toolkit/uiconfig/layout/message-box.xml new file mode 100644 index 000000000000..61305e443fa3 --- /dev/null +++ b/toolkit/uiconfig/layout/message-box.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated xml files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="message-box" _title="" optimumsize="true" + has_border="true" sizeable="true" moveable="true" closeable="true"> + <vbox border="5" spacing="5"> + <hbox border="5" spacing="20"> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" /> + </align> + <flow/> + </hbox> + <dialogbuttonhbox border="0" spacing="5"> + <flow/> + <!-- deprecoted vcl/MsgBox compatibility !--> + <retrybutton id="BTN_RETRY" /> + <ignorebutton id="BTN_IGNORE" /> + + <yesbutton id="BTN_YES"/> + <cancelbutton id="BTN_CANCEL"/> + <helpbutton id="BTN_HELP"/> + <nobutton id="BTN_NO" xlabel="~Alternate"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/uiconfig/layout/tab-dialog.xml b/toolkit/uiconfig/layout/tab-dialog.xml new file mode 100644 index 000000000000..da75f03e9df5 --- /dev/null +++ b/toolkit/uiconfig/layout/tab-dialog.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + _title="layout::TabDialog" optimumsize="true" + id="tab-dialog" + has_border="true" sizeable="true" moveable="true"> + <vbox spacing="5" border="5"> + <tabcontrol id="ID_TABCONTROL"/> + <dialogbuttonhbox border="5" spacing="5" cnt:expand="false"> + <flow/> + <okbutton defbutton="true" id="BTN_OK" show="false"/> + <pushbutton id="BTN_USER" _label="<User>" show="false"/> + <cancelbutton id="BTN_CANCEL" show="false"/> + <helpbutton id="BTN_HELP" show="false"/> + <resetbutton id="BTN_RESET" show="false"/> + <pushbutton id="BTN_BASEFMT" _label="<Base Format>" show="false"/> + </dialogbuttonhbox> + </vbox> +</dialog> diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk index a52922f2bfe4..a69bd5211345 100644 --- a/toolkit/util/makefile.mk +++ b/toolkit/util/makefile.mk @@ -54,8 +54,8 @@ LIB1FILES= $(SLB)$/awt.lib \ $(SLB)$/tree.lib \ $(SLB)$/controls.lib \ $(SLB)$/helper.lib\ - $(SLB)$/layoutcore.lib \ - $(SLB)$/vclcompat.lib + $(SLB)$/layout-core.lib \ + $(SLB)$/layout-vcl.lib SHL1TARGET= tk$(DLLPOSTFIX) SHL1IMPLIB= itk diff --git a/toolkit/util/makefile.pmk b/toolkit/util/makefile.pmk index 8bb9f5d4bc28..720cb4b913fa 100644 --- a/toolkit/util/makefile.pmk +++ b/toolkit/util/makefile.pmk @@ -33,11 +33,8 @@ CDEFS += -DTOOLKIT_DLLIMPLEMENTATION VISIBILITY_HIDDEN=TRUE -# FIXME: sprinkle some TOOLKIT_DLLPUBLIC +CFLAGS+=-I$(PRJ)/source -CFLAGS+=-I$(PRJ)/inc/layout .IF "$(ENABLE_LAYOUT)" == "TRUE" -CFLAGS+=-DENABLE_LAYOUT=1 -DTEST_LAYOUT=1 -.ELSE -CFLAGS+=-DENABLE_LAYOUT=0 +CFLAGS+=-DTEST_LAYOUT=1 .ENDIF # ENABLE_LAYOUT == TRUE diff --git a/toolkit/workben/layout/.gitignore b/toolkit/workben/layout/.gitignore new file mode 100644 index 000000000000..142ba57c1444 --- /dev/null +++ b/toolkit/workben/layout/.gitignore @@ -0,0 +1,4 @@ +/de +/en-US +/nl +/ja
\ No newline at end of file diff --git a/toolkit/workben/layout/README b/toolkit/workben/layout/README new file mode 100644 index 000000000000..3b83bbfc00cd --- /dev/null +++ b/toolkit/workben/layout/README @@ -0,0 +1,43 @@ +Testing workbench and editor for Layout engine. + +* Configure using --enable-layout. + +* [d]make all + +* export OOO_INSTALL_PREFIX=$(pwd)/ooo-layout + +* [d]make install DESTDIR=$OOO_INSTALL_PREFIX + +* Compile test program in toolkit/workben/layout + + cd toolkit/workben/layout && dmake all + +* FIXME: New three layer install/rpath feature needs these workarounds +| +| test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX +| cp -f ../..$INPATH/lib/libtkx.so $OOO_PREFIX/openoffice.org/basis3.0/program +| export LD_LIBRARY_PATH=$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib +| +| (see source/layout/helper.cxx) + +* Run it on any .xml file + + ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] zoom.xml + +* Run it for specific dialogs, see test.cxx + + ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test zoom + ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test wordcount + +* Or source refresh in workben/layout, do something like + + cd toolkit/workben/layout && . ./refresh [--inst $OOO_INSTALL_PREFIX] + +Integration into OOo: + +* After instaling, run + + cd ooo-cvs/program + ./soffice.bin + + Start a [Writer] document and choose View/Zoom or Extra/Word count. diff --git a/toolkit/workben/layout/TEST b/toolkit/workben/layout/TEST new file mode 100755 index 000000000000..8a04a6628da8 --- /dev/null +++ b/toolkit/workben/layout/TEST @@ -0,0 +1,11 @@ +#! /bin/sh +for d in $(cd ../../../../.. && pwd)/ooo-svn /usr/lib/ooo3/; do + if test -d $d; then + export OOO_INSTALL_PREFIX=$d + break + fi +done +export SAL_ALLOW_LINKOO_SYMLINKS=1 +test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX +export LD_LIBRARY_PATH="$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib" +../../unx*.pro/bin/test "$@" diff --git a/toolkit/workben/layout/align-test.xml b/toolkit/workben/layout/align-test.xml new file mode 100644 index 000000000000..60c34b4655a5 --- /dev/null +++ b/toolkit/workben/layout/align-test.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated xml files are generated from this template by + transex3/layout/tralay. !--> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="Align Test" optimumsize="true" has_border="true" sizeable="true" moveable="true"> + <vbox spacing="5" border="5"> + <fixedline/> + <hbox spacing="0" border="0"> + <vbox spacing="5" border="5"> + <fixedline _text="X" cnt:expand="false"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + <pushbutton label="foo"/> + </vbox> + <vbox spacing="5" border="5"> + <fixedline _text="X" cnt:expand="false"/> + <pushbutton label="bar"/> + </vbox> + </hbox> + <fixedline/> + <min-size cnt:spacing="0" min-width="200"/> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/boxtest.xml b/toolkit/workben/layout/boxtest.xml index 60b714d7d894..24ead837c057 100644 --- a/toolkit/workben/layout/boxtest.xml +++ b/toolkit/workben/layout/boxtest.xml @@ -4,6 +4,8 @@ xmlns:cnt="http://openoffice.org/2007/layout/container" title="Box Test" optimumsize="true" has_border="true" sizeable="true" moveable="true"> <vbox> + <table> + <vbox> <hbox cnt:expand="false" cnt:fill="false"> <pushbutton label="XML Left" cnt:expand="false" cnt:fill="false"/> @@ -28,5 +30,7 @@ <pushbutton label="XML Right" cnt:expand="true" cnt:fill="true"/> </hbox> + </vbox> + </table> </vbox> </dialog> diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx index 0ef31560b69f..dd218de40da7 100644 --- a/toolkit/workben/layout/editor.cxx +++ b/toolkit/workben/layout/editor.cxx @@ -32,43 +32,41 @@ #include "editor.hxx" #undef NDEBUG + +/* #include <assert.h> #include <stdio.h> #include <string.h> +*/ -#include <vector> +#include <cassert> +#include <cstdio> +#include <cstring> #include <list> -#include <rtl/strbuf.hxx> -#include <rtl/ustrbuf.hxx> - -using namespace layout::css; - -using rtl::OUString; +#include <vector> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/awt/XLayoutConstrains.hpp> #include <com/sun/star/awt/XLayoutContainer.hpp> -#include <com/sun/star/awt/WindowAttribute.hpp> - #include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> #include <toolkit/helper/property.hxx> - #include <vcl/lstbox.h> -// FIXME: -//#define FILEDLG +using namespace layout::css; -// somewhat of a hack unfortunately ... -#include "layout/layoutcore.hxx" -#include "root.hxx" -#include "helper.hxx" +using rtl::OUString; -//** Utilities +// FIXME: +//#define FILEDLG -#define OUSTRING_CSTR( str ) \ - rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr() +#include <layout/core/helper.hxx> +#include <layout/core/root.hxx> +#include <layout/core/helper.hxx> // TODO: automatically generated struct WidgetSpec { @@ -94,19 +92,6 @@ static const WidgetSpec WIDGETS_SPECS[] = { }; const int WIDGETS_SPECS_LEN = sizeof (WIDGETS_SPECS) / sizeof (WidgetSpec); -// TEMP: from helper -namespace layoutimpl { - - typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList; - - css::uno::Reference< css::awt::XLayoutConstrains > - createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::uno::XInterface > xParent, - const rtl::OUString &rName, long nProps, bool bToplevel ); - - uno::Any anyFromString (const rtl::OUString &value, const uno::Type &type); -} - using namespace layout; using namespace layoutimpl; namespace css = ::com::sun::star; @@ -136,9 +121,9 @@ static rtl::OUString anyToString (uno::Any value) bool val = value.get<sal_Bool>(); return rtl::OUString( val ? "1" : "0", 1, RTL_TEXTENCODING_ASCII_US ); /* if ( val ) - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ); - else - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ); + else + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/ } default: break; @@ -155,8 +140,9 @@ static inline double anyToDecimal (uno::Any value) /* XLayoutContainer/XLayoutConstrains are a bit of a hasle to work with. Let's wrap them. */ -class Widget : public layoutimpl::LayoutWidget { -friend class EditorRoot; +class Widget : public layoutimpl::LayoutWidget +{ + friend class EditorRoot; Widget *mpParent; std::vector< Widget *> maChildren; @@ -173,7 +159,7 @@ public: // to be used to wrap the root Widget( uno::Reference< awt::XLayoutConstrains > xImport, const char *label ) - : mpParent( 0 ), mbForeign( true ) + : mpParent( 0 ), mbForeign( true ) { mxWidget = xImport; mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); @@ -197,17 +183,17 @@ public: Widget( rtl::OUString id, uno::Reference< awt::XToolkit > xToolkit, uno::Reference< awt::XLayoutContainer > xParent, rtl::OUString unoName, long nAttrbs ) - : mpParent( 0 ), mbForeign( false ), mrId( id ), - mnOriAttrbs( nAttrbs ) + : mpParent( 0 ), mbForeign( false ), mrId( id ), + mnOriAttrbs( nAttrbs ) { - while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() ) - { - uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY ); - assert( xContainer.is() ); - xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); - } + while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() ) + { + uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY ); + assert( xContainer.is() ); + xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); + } - mxWidget = layoutimpl::createWidget( xToolkit, xParent, unoName, nAttrbs ); + mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs ); assert( mxWidget.is() ); mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); @@ -225,14 +211,14 @@ public: // TODO: disable editing of text fields, check boxes selected, etc... #if 0 uno::Reference< awt::XVclWindowPeer> xVclPeer( mxWidget, uno::UNO_QUERY ) - if ( xVclPeer.is() ) // XVclWindowPeer ignores missing / incorrect properties + if ( xVclPeer.is() ) // XVclWindowPeer ignores missing / incorrect properties //FIXME: it looks odd on widgets like NumericField seeing text which is deleted // when you interact with it... We can avoid it for those widgets, by doing a getProp // of "Text" and check if it is empty or not. - xVclPeer->setProperty( rtl::OUString::createFromAscii( "Text" ), - uno::makeAny( rtl::OUString::createFromAscii( "new widget" ) ) ); + xVclPeer->setProperty( rtl::OUString::createFromAscii( "Text" ), + uno::makeAny( rtl::OUString::createFromAscii( "new widget" ) ) ); #endif // store original properties @@ -365,9 +351,14 @@ public: { beans::Property prop = it.next(); rtl::OUString name( prop.Name ); - rtl::OUString value( pChild->getProperty( name, CONTAINER_PROPERTY ) ); - std::pair< rtl::OUString, rtl::OUString > pair( name, value ); - pChild->maOriChildProps.push_back( pair ); + try { + rtl::OUString value( pChild->getProperty( name, CONTAINER_PROPERTY ) ); + std::pair< rtl::OUString, rtl::OUString > pair( name, value ); + pChild->maOriChildProps.push_back( pair ); + } catch ( beans::UnknownPropertyException &rEx ) { + fprintf (stderr, "ERROR: widget reports that it has a property it cannot return: '%s' this normally means that someone screwed up their PROPERTY_SET_INFO macro usage.\n", + rtl::OUStringToOString (rEx.Message, RTL_TEXTENCODING_UTF8).getStr()); + } } } @@ -402,7 +393,7 @@ public: std::vector< Widget *> aChildChildren = pChild->maChildren; for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin(); - it != aChildChildren.end(); it++ ) + it != aChildChildren.end(); it++ ) pChild->removeChild( *it ); for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin(); @@ -410,10 +401,10 @@ public: if ( !addChild( *it ) ) { // failure for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin(); - jt != it; jt++ ) + jt != it; jt++ ) removeChild( *jt ); for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin(); - jt != aChildChildren.end(); jt++ ) + jt != aChildChildren.end(); jt++ ) pChild->addChild( *jt ); return false; } @@ -433,7 +424,7 @@ public: { int i = 0; for ( std::vector< Widget *>::const_iterator it = maChildren.begin(); - it != maChildren.end(); it++, i++ ) + it != maChildren.end(); it++, i++ ) if ( *it == pChild ) break; return i; @@ -507,7 +498,7 @@ public: case CONTAINER_PROPERTY: if ( mpParent ) rValue = anyToString( layoutimpl::prophlp::getProperty( - mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) ); + mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) ); break; case WINBITS_PROPERTY: // TODO @@ -554,7 +545,7 @@ public: int nPropIt; PropertyIterator( Widget *pWidget, PropertyKind rKind ) - : mrKind( rKind ), nPropIt( 0 ) + : mrKind( rKind ), nPropIt( 0 ) { switch ( rKind ) { @@ -596,10 +587,10 @@ public: beans::Property next() { /* rtl::OUString propName, propValue; - propName = maProps[ nPropIt ]; - propValue = getProperty( propName, mrKind, false); - nPropIt++; - return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/ + propName = maProps[ nPropIt ]; + propValue = getProperty( propName, mrKind, false); + nPropIt++; + return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/ return maProps[ nPropIt++ ]; } }; @@ -611,13 +602,13 @@ class EditorRoot : public layoutimpl::LayoutRoot { public: EditorRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory, Widget *pParent ) - : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent ) + : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent ) { } // generation virtual layoutimpl::LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, - long attrbs, uno::Reference< awt::XLayoutContainer > xParent ) + long attrbs, uno::Reference< awt::XLayoutContainer > xParent ) { if ( unoName.compareToAscii( "dialog" ) == 0 ) return mpParent; @@ -637,126 +628,126 @@ public: /* Working with the layout in 1D, as if it was a flat list. */ namespace FlatLayout { - Widget *next( Widget *pWidget ) - { - Widget *pNext; - pNext = pWidget->down(); - if ( pNext ) return pNext; - pNext = pWidget->next(); - if ( pNext ) return pNext; - for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() ) - if ( (pNext = pUp->next()) != NULL ) - return pNext; - return NULL; - } +Widget *next( Widget *pWidget ) +{ + Widget *pNext; + pNext = pWidget->down(); + if ( pNext ) return pNext; + pNext = pWidget->next(); + if ( pNext ) return pNext; + for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() ) + if ( (pNext = pUp->next()) != NULL ) + return pNext; + return NULL; +} /* - Widget *prev( Widget *pWidget ) - { - Widget *pPrev; - pPrev = pWidget->prev(); - if ( !pPrev ) - return pWidget->up(); - - Widget *pBottom = pPrev->down(); - if ( pBottom ) - { - while ( pBottom->down() || pBottom->next() ) - { - for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() ) - pBottom = pNext; - Widget *pDown = pBottom->down(); - if ( pDown ) - pBottom = pDown; - } - return pBottom; - } - return pPrev; - } + Widget *prev( Widget *pWidget ) + { + Widget *pPrev; + pPrev = pWidget->prev(); + if ( !pPrev ) + return pWidget->up(); + + Widget *pBottom = pPrev->down(); + if ( pBottom ) + { + while ( pBottom->down() || pBottom->next() ) + { + for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() ) + pBottom = pNext; + Widget *pDown = pBottom->down(); + if ( pDown ) + pBottom = pDown; + } + return pBottom; + } + return pPrev; + } */ - bool moveWidget( Widget *pWidget, bool up /*or down*/ ) - { - // Keep child parent&pos for in case of failure - Widget *pOriContainer = pWidget->up(); - unsigned int oriChildPos = pOriContainer->getChildPos( pWidget ); - - // Get parent&sibling before removing it, since relations get cut - Widget *pSibling = up ? pWidget->prev() : pWidget->next(); - Widget *pContainer = pWidget->up(); - if ( !pContainer ) - return false; +bool moveWidget( Widget *pWidget, bool up /*or down*/ ) +{ + // Keep child parent&pos for in case of failure + Widget *pOriContainer = pWidget->up(); + unsigned int oriChildPos = pOriContainer->getChildPos( pWidget ); + + // Get parent&sibling before removing it, since relations get cut + Widget *pSibling = up ? pWidget->prev() : pWidget->next(); + Widget *pContainer = pWidget->up(); + if ( !pContainer ) + return false; - // try to swap with parent or child - // We need to allow for this at least for the root node... - if ( !pSibling ) + // try to swap with parent or child + // We need to allow for this at least for the root node... + if ( !pSibling ) + { + if ( up ) + { + if ( pContainer->swapWithChild( pWidget ) ) + return true; + } + else { - if ( up ) - { - if ( pContainer->swapWithChild( pWidget ) ) - return true; - } - else - { // TODO: this is a nice feature, but we probably want to do it explicitely... #if 0 - if ( pWidget->down() && pWidget->swapWithChild( pWidget->down() ) ) - return true; + if ( pWidget->down() && pWidget->swapWithChild( pWidget->down() ) ) + return true; #endif - } } + } - pContainer->removeChild( pWidget ); - - // if has up sibling -- append to it, else swap with it - if ( pSibling ) - { - if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) ) - return true; + pContainer->removeChild( pWidget ); - unsigned int childPos = pContainer->getChildPos( pSibling ); - if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) ) - return true; // should always be succesful - } - // go through parents -- try to get prepended to them - else - { - for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() ) - { - unsigned int childPos = pContainer->up()->getChildPos( pContainer ); - if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) ) - return true; - } - } + // if has up sibling -- append to it, else swap with it + if ( pSibling ) + { + if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) ) + return true; - // failed -- try to get it to its old position - if ( !pOriContainer->addChild( pWidget, oriChildPos ) ) + unsigned int childPos = pContainer->getChildPos( pSibling ); + if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) ) + return true; // should always be succesful + } + // go through parents -- try to get prepended to them + else + { + for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() ) { - // a parent should never reject a child back. but if it ever - // happens, just kill it, we don't run an orphanate here ;P - delete pWidget; - return true; + unsigned int childPos = pContainer->up()->getChildPos( pContainer ); + if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) ) + return true; } - return false; } - // NOTE: root is considered to be number -1 - Widget *get( Widget *pRoot, int nb ) + // failed -- try to get it to its old position + if ( !pOriContainer->addChild( pWidget, oriChildPos ) ) { - Widget *it; - for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) ) - nb--; - return it; + // a parent should never reject a child back. but if it ever + // happens, just kill it, we don't run an orphanate here ;P + delete pWidget; + return true; } + return false; +} - int get( Widget *pRoot, Widget *pWidget ) - { - int nRet = -1; - Widget *it; - for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) ) - nRet++; - return nRet; - } +// NOTE: root is considered to be number -1 +Widget *get( Widget *pRoot, int nb ) +{ + Widget *it; + for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) ) + nb--; + return it; +} + +int get( Widget *pRoot, Widget *pWidget ) +{ + int nRet = -1; + Widget *it; + for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) ) + nRet++; + return nRet; +} } //** PropertiesList widget @@ -774,7 +765,7 @@ class PropertiesList : public layout::Table DECL_LINK( FlagToggledHdl, layout::CheckBox* ); AnyWidget( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind ) - : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind ) + : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind ) { mpFlag = 0; mbBlockFlagCallback = false; @@ -852,7 +843,7 @@ class PropertiesList : public layout::Table AnyEdit( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, layout::Window *pWinParent ) - : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent ) + : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent ) { mpEdit = NULL; mpExpand = new layout::PushButton( pWinParent, WB_TOGGLE ); @@ -880,7 +871,7 @@ class PropertiesList : public layout::Table if ( mpEdit ) { text = mpEdit->GetText(); -printf("Remove mpEdit and expand\n"); + printf("Remove mpEdit and expand\n"); Remove( mpEdit ); Remove( mpExpand ); delete mpEdit; @@ -974,7 +965,7 @@ printf("Remove mpEdit and expand\n"); { AnyInteger( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER ) + : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER ) { load(); SetModifyHdl( LINK( this, AnyInteger, ApplyPropertyHdl ) ); @@ -1003,7 +994,7 @@ printf("Remove mpEdit and expand\n"); { AnyFloat( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyInteger( pWidget, aPropName, aPropKind, pWinParent ) + : AnyInteger( pWidget, aPropName, aPropKind, pWinParent ) {} virtual void store() @@ -1016,7 +1007,7 @@ printf("Remove mpEdit and expand\n"); { AnyCheckBox( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, layout::Window *pWinParent ) - : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent ) + : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent ) { // adding some whitespaces to make the hit area larger // SetText( String::CreateFromAscii( "" ) ); @@ -1060,7 +1051,7 @@ printf("Remove mpEdit and expand\n"); { AnyListBox( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN ) + : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN ) { SetSelectHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) ); } @@ -1084,7 +1075,7 @@ printf("Remove mpEdit and expand\n"); { AnyAlign( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyListBox( pWidget, aPropName, aPropKind, pWinParent ) + : AnyListBox( pWidget, aPropName, aPropKind, pWinParent ) { InsertEntry( XubString::CreateFromAscii( "Left" ) ); InsertEntry( XubString::CreateFromAscii( "Center" ) ); @@ -1100,7 +1091,7 @@ printf("Remove mpEdit and expand\n"); { AnyComboBox( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN ) + : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN ) { SetModifyHdl( LINK( this, AnyComboBox, ApplyPropertyHdl ) ); } @@ -1124,7 +1115,7 @@ printf("Remove mpEdit and expand\n"); { AnyFontStyle( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind, Window *pWinParent ) - : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent ) + : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent ) { InsertEntry( XubString::CreateFromAscii( "Bold" ) ); InsertEntry( XubString::CreateFromAscii( "Italic" ) ); @@ -1138,71 +1129,71 @@ printf("Remove mpEdit and expand\n"); layout::CheckBox *mpFlag; AnyWidget *mpValue; - public: - PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget ) + public: + PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget ) + { + mpLabel = new layout::FixedText( pWinParent ); { - mpLabel = new layout::FixedText( pWinParent ); - { - // append ':' to aPropName - rtl::OUStringBuffer buf( pAnyWidget->maPropName ); - buf.append( sal_Unicode (':') ); - mpLabel->SetText( buf.makeStringAndClear() ); - } - mpValue = pAnyWidget; - mpFlag = new layout::CheckBox( pWinParent ); - mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) ); - mpValue->mpFlag = mpFlag; + // append ':' to aPropName + rtl::OUStringBuffer buf( pAnyWidget->maPropName ); + buf.append( sal_Unicode (':') ); + mpLabel->SetText( buf.makeStringAndClear() ); } + mpValue = pAnyWidget; + mpFlag = new layout::CheckBox( pWinParent ); + mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) ); + mpValue->mpFlag = mpFlag; + } - ~PropertyEntry() - { + ~PropertyEntry() + { #if DEBUG_PRINT fprintf(stderr, "REMOVING label, flag and value\n"); #endif - delete mpLabel; - delete mpFlag; - delete mpValue; - } + delete mpLabel; + delete mpFlag; + delete mpValue; + } - // Use this factory rather than the constructor -- check for NULL - static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName, - Widget::PropertyKind aPropKind, sal_uInt16 nType, - layout::Window *pWinParent ) - { - AnyWidget *pAnyWidget; - switch (nType) { - case uno::TypeClass_STRING: - if ( aPropName.compareToAscii( "FontStyleName" ) == 0 ) - { - pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent ); - break; - } - pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent ); - break; - case uno::TypeClass_SHORT: - if ( aPropName.compareToAscii( "Align" ) == 0 ) - { - pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent ); - break; - } - // otherwise, treat as any other number... - case uno::TypeClass_LONG: - case uno::TypeClass_UNSIGNED_LONG: - pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent ); - break; - case uno::TypeClass_FLOAT: - case uno::TypeClass_DOUBLE: - pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent ); + // Use this factory rather than the constructor -- check for NULL + static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName, + Widget::PropertyKind aPropKind, sal_uInt16 nType, + layout::Window *pWinParent ) + { + AnyWidget *pAnyWidget; + switch (nType) { + case uno::TypeClass_STRING: + if ( aPropName.compareToAscii( "FontStyleName" ) == 0 ) + { + pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent ); break; - case uno::TypeClass_BOOLEAN: - pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent ); + } + pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent ); + break; + case uno::TypeClass_SHORT: + if ( aPropName.compareToAscii( "Align" ) == 0 ) + { + pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent ); break; - default: - return NULL; - } - return new PropertyEntry( pWinParent, pAnyWidget ); + } + // otherwise, treat as any other number... + case uno::TypeClass_LONG: + case uno::TypeClass_UNSIGNED_LONG: + pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent ); + break; + case uno::TypeClass_FLOAT: + case uno::TypeClass_DOUBLE: + pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent ); + break; + case uno::TypeClass_BOOLEAN: + pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent ); + break; + default: + return NULL; } - }; + return new PropertyEntry( pWinParent, pAnyWidget ); + } + }; layout::Window *mpParentWindow; @@ -1249,12 +1240,12 @@ printf("Remove mpEdit and expand\n"); return true; } while ( min <= max ); return false; - } + } public: PropertiesList( layout::Dialog *dialog ) - : layout::Table( dialog, "properties-box" ) - , mpParentWindow( dialog ), mpSeparator( 0 ) + : layout::Table( dialog, "properties-box" ) + , mpParentWindow( dialog ), mpSeparator( 0 ) { } @@ -1318,7 +1309,7 @@ public: Container::Clear(); for ( std::list< PropertyEntry* >::iterator it = maPropertiesList.begin(); - it != maPropertiesList.end(); it++) + it != maPropertiesList.end(); it++) delete *it; maPropertiesList.clear(); @@ -1378,14 +1369,14 @@ IMPL_LINK( PropertiesList::PropertyEntry::AnyEdit, ExpandEditHdl, layout::PushBu class SortListBox { // For a manual sort ListBox; asks for a ListBox and Up/Down/Remove // buttons to wrap -DECL_LINK( ItemSelectedHdl, layout::ListBox* ); -DECL_LINK( UpPressedHdl, layout::Button* ); -DECL_LINK( DownPressedHdl, layout::Button* ); -DECL_LINK( RemovePressedHdl, layout::Button* ); -layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton; + DECL_LINK( ItemSelectedHdl, layout::ListBox* ); + DECL_LINK( UpPressedHdl, layout::Button* ); + DECL_LINK( DownPressedHdl, layout::Button* ); + DECL_LINK( RemovePressedHdl, layout::Button* ); + layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton; protected: -layout::ListBox *mpListBox; + layout::ListBox *mpListBox; virtual void upPressed( USHORT nPos ) { @@ -1431,8 +1422,8 @@ layout::ListBox *mpListBox; public: SortListBox( layout::ListBox *pListBox, layout::PushButton *pUpButton, layout::PushButton *pDownButton, layout::PushButton *pRemoveButton ) - : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ), - mpListBox( pListBox ) + : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ), + mpListBox( pListBox ) { mpListBox->SetSelectHdl( LINK( this, SortListBox, ItemSelectedHdl ) ); @@ -1516,10 +1507,10 @@ public: Widget *mpRootWidget; LayoutTree( layout::Dialog *dialog ) - : SortListBox( new layout::ListBox( dialog, "layout-tree" ), - new layout::PushButton( dialog, "layout-up-button" ), - new layout::PushButton( dialog, "layout-down-button" ), - new layout::PushButton( dialog, "layout-remove-button" ) ) + : SortListBox( new layout::ListBox( dialog, "layout-tree" ), + new layout::PushButton( dialog, "layout-up-button" ), + new layout::PushButton( dialog, "layout-down-button" ), + new layout::PushButton( dialog, "layout-remove-button" ) ) { layout::PeerHandle handle = dialog->GetPeerHandle( "preview-box" ); uno::Reference< awt::XLayoutConstrains > xWidget( handle, uno::UNO_QUERY ); @@ -1617,7 +1608,7 @@ public: for ( int kind = 0; kind < 2; kind++ ) { Widget::PropertyKind wKind = kind == 0 ? Widget::WINDOW_PROPERTY - : Widget::CONTAINER_PROPERTY; + : Widget::CONTAINER_PROPERTY; Widget::PropertyIterator it( i, wKind ); while ( it.hasNext() ) { @@ -1629,16 +1620,16 @@ public: if ( prop.Type.getTypeClass() == uno::TypeClass_BOOLEAN ) { if ( value.compareToAscii( "0" ) ) - value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") ); + value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") ); else - value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") ); + value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") ); } if ( value.getLength() > 0 ) printf("%s%s=\"%s\" ", - kind == 0 ? "" : "cnt:", - OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value ) - ); + kind == 0 ? "" : "cnt:", + OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value ) + ); } } @@ -1719,7 +1710,7 @@ class EditorImpl : public LayoutTree::Listener public: EditorImpl( layout::Dialog *dialog, - // we should probable open this channel (or whatever its called) ourselves + // we should probable open this channel (or whatever its called) ourselves uno::Reference< lang::XMultiServiceFactory > xMSF ); virtual ~EditorImpl(); @@ -1754,7 +1745,7 @@ EditorImpl::EditorImpl( layout::Dialog *dialog, mpLayoutTree->setListener( this ); /* if ( xImport.is() ) - mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/ + mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/ // create buttons layout::Container aWidgets( dialog, "create-widget" ); @@ -1797,7 +1788,7 @@ EditorImpl::~EditorImpl() delete mpPropertiesList; delete mpLayoutTree; for ( std::list< layout::PushButton * >::const_iterator i = maCreateButtons.begin(); - i != maCreateButtons.end(); i++) + i != maCreateButtons.end(); i++) delete *i; delete pImportButton; delete pExportButton; @@ -1808,14 +1799,14 @@ EditorImpl::~EditorImpl() void EditorImpl::loadFile( const rtl::OUString &aTestFile ) { -fprintf( stderr, "TEST: layout instance\n" ); + fprintf( stderr, "TEST: layout instance\n" ); uno::Reference< awt::XLayoutRoot > xRoot ( new EditorRoot( mxFactory, mpLayoutTree->mpRootWidget ) ); /* -mxMSF->createInstance - ( ::rtl::OUString::createFromAscii( "com.sun.star.awt.Layout" ) ), - uno::UNO_QUERY ); + mxMSF->createInstance + ( ::rtl::OUString::createFromAscii( "com.sun.star.awt.Layout" ) ), + uno::UNO_QUERY ); */ if ( !xRoot.is() ) { @@ -1877,13 +1868,13 @@ void EditorImpl::widgetSelected( Widget *pWidget ) if ( !pWidget || pWidget->isContainer() ) { for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin(); - it != maCreateButtons.end(); it++) + it != maCreateButtons.end(); it++) (*it)->Enable(); } else { for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin(); - it != maCreateButtons.end(); it++) + it != maCreateButtons.end(); it++) (*it)->Disable(); } @@ -1894,7 +1885,7 @@ IMPL_LINK( EditorImpl, CreateWidgetHdl, layout::Button *, pBtn ) { int i = 0; for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin(); - it != maCreateButtons.end(); it++, i++ ) + it != maCreateButtons.end(); it++, i++ ) { if ( pBtn == *it ) break; diff --git a/toolkit/workben/layout/empty.xml b/toolkit/workben/layout/empty.xml new file mode 100644 index 000000000000..a8408e55719e --- /dev/null +++ b/toolkit/workben/layout/empty.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated xml files are generated from this template by + transex3/layout/tralay. !--> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="Empty Test" optimumsize="true" has_border="true" sizeable="true" moveable="true"> + <vbox spacing="1" border="10"> + <min-size min-width="200"/> + <fixedline height="1"/> + <vbox spacing="10"> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + <vbox show="false"/> + </vbox> + <fixedline height="1"/> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/insert-sheet.xml b/toolkit/workben/layout/insert-sheet.xml new file mode 100644 index 000000000000..2350da9aec77 --- /dev/null +++ b/toolkit/workben/layout/insert-sheet.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog sizeable="true" closeable="true" moveable="true" output-size="true" id="RID_SCDLG_INSERT_TABLE" sv-look="true" _title="Insert Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox spacing="5" border="5"> + <fixedline id="FL_POSITION" _text="Position"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <radiobutton radiogroup="insert-sheet-position" id="RB_BEFORE" tabstop="true" _label="B~efore current sheet"/> + <radiobutton radiogroup="insert-sheet-position" id="RB_BEHIND" tabstop="true" _label="~After current sheet"/> + </vbox> + </hbox> + <fixedline id="FL_TABLE" _text="Sheet"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <radiobutton radiogroup="insert-sheet-source" id="RB_NEW" _label="~New sheet"/> + <hbox> + <vbox cnt:padding="13" spacing="5" cnt:fill="false" cnt:expand="false"> + <fixedtext id="FT_COUNT" _label="N~o. of sheets"/> + <fixedtext id="FT_NAME" _label="Na~me"/> + </vbox> + <vbox> + <hbox> + <numericfield has_border="true" maximum="256" minimum="1" repeat="true" id="NF_COUNT" spin="true" spin-size="1" tabstop="true" value="1" cnt:fill="true" cnt:expand="false"/> + </hbox> + <edit has_border="true" id="ED_TABNAME" cnt:fill="true" cnt:expand="true"/> + </vbox> + </hbox> + </vbox> + </hbox> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <radiobutton radiogroup="insert-sheet-source" id="RB_FROMFILE" _label="~From file"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <hbox> + <multilistbox auto-hscroll="true" has_border="true" id="LB_TABLES" simple-mode="true" string-item-list=" : : : : " cnt:fill="true" cnt:expand="true"/> + <vbox cnt:fill="false" cnt:expand="false" spacing="5"> + <pushbutton id="BTN_BROWSE" _label="~Browse..." cnt:expand="false"/> + <checkbox id="CB_LINK" _label="Lin~k" cnt:expand="false"/> + <flow/> + </vbox> + </hbox> + <fixedtext id="FT_PATH" label="FT-PATH"/> + </vbox> + </hbox> + </vbox> + </hbox> + <dialogbuttonhbox border="5" spacing="5"> + <okbutton defbutton="true" id="BTN_OK"/> + <cancelbutton id="BTN_CANCEL"/> + <helpbutton id="BTN_HELP"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/makefile.mk b/toolkit/workben/layout/makefile.mk index a7f1a8dfcb97..0741a210d2e3 100644 --- a/toolkit/workben/layout/makefile.mk +++ b/toolkit/workben/layout/makefile.mk @@ -40,21 +40,18 @@ ENABLE_EXCEPTIONS=TRUE .IF "$(ENABLE_LAYOUT)" == "TRUE" -CFLAGS += -I$(PRJ)/source/layout - # Allow zoom and wordcount to be built without depending on svx,sv,sfx2 -CFLAGS += -I../$(PRJ)/svx/inc -I../$(PRJ)/svtools/inc -I../$(PRJ)/sfx2/inc +CFLAGS += -I../$(PRJ)/svx/inc -I../$(PRJ)/svtools/inc -I../$(PRJ)/sfx2/inc -I../$(PRJ)/sc/inc -I../$(PRJ)/sc/source/ui/inc -I../$(PRJ)/sw/inc .INCLUDE : $(PRJ)$/util$/makefile.pmk -CFLAGS += -DENABLE_LAYOUT=1 -DTEST_LAYOUT=1 - .IF "$(COMNAME)" == "gcc3" CFLAGS+=-Wall -Wno-non-virtual-dtor .ENDIF CXXFILES=\ editor.cxx \ + plugin.cxx \ recover.cxx \ wordcountdialog.cxx \ test.cxx \ @@ -62,8 +59,11 @@ CXXFILES=\ OBJFILES=\ $(OBJ)$/editor.obj \ + $(OBJ)$/plugin.obj \ $(OBJ)$/recover.obj \ $(OBJ)$/test.obj \ + $(OBJ)$/tpsort.obj \ + $(OBJ)$/sortdlg.obj \ $(OBJ)$/wordcountdialog.obj \ $(OBJ)$/zoom.obj @@ -77,28 +77,39 @@ APP1STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) \ $(XMLSCRIPTLIB) \ - $(TKLIB) + $(TKLIB) \ + $(SVXLIB) \ + $(ISCLIB) \ +# svtools = $(INCCOM)/svtools -all: $(svtools) ALLTAR +default: ALLTAR -.INCLUDE : target.mk +.INCLUDE : target.mk XML_FILES=\ + insert-sheet.xml\ + message-box.xml\ + move-copy-sheet.xml\ recover.xml\ + sort-options.xml\ + string-input.xml\ + tab-dialog.xml\ wordcount.xml\ zoom.xml\ TRALAY=$(AUGMENT_LIBRARY_PATH) tralay XML_LANGS=$(alllangiso) -#ALL_XMLS=$(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $i/$j)) -ALLTAR: $(foreach,i,$(XML_FILES) en-US/$i) +ALLTAR: localize.sdf $(BIN)/testrc $(svtools) $(foreach,i,$(XML_FILES) en-US/$i) $(XML_LANGS:f:t"/%.xml ")/%.xml: %.xml $(TRALAY) -m localize.sdf -o . -l $(XML_LANGS:f:t" -l ") $< rm -rf en-US +$(BIN)/%: %.in + cp $< $@ + $(svtools): # FIXME: there's a bug in svtools layout or usage # Include files are in svtools/inc, but are referenced as <svtools/..> @@ -109,14 +120,35 @@ $(svtools): ln -sf ..$/$(PRJ)$/svtools$/inc $(INCCOM)$/svtools dist .PHONY : + cp -pv message-box.xml $(PRJ)/uiconfig/layout + cp -pv tab-dialog.xml $(PRJ)/uiconfig/layout $(SHELL) ./un-test.sh zoom.cxx > ../$(PRJ)/svx/source/dialog/zoom.cxx $(SHELL) ./un-test.sh zoom.hxx > ../$(PRJ)/svx/source/dialog/zoom.hxx touch ../$(PRJ)/svx/source/dialog/dlgfact.cxx + cp -pv zoom.xml ../$(PRJ)/svx/uiconfig/layout $(SHELL) ./un-test.sh wordcountdialog.cxx > ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.cxx $(SHELL) ./un-test.sh wordcountdialog.hxx > ../$(PRJ)/sw/source/ui/inc/wordcountdialog.hxx touch ../$(PRJ)/sw/source/ui/dialog/swdlgfact.cxx -# FIXME: broken setup + cp -pv wordcount.xml ../$(PRJ)/sw/uiconfig/layout + # FIXME: broken setup ln -sf ../inc/wordcountdialog.hxx ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.hxx + $(SHELL) ./un-test.sh tpsort.cxx > ../$(PRJ)/sc/source/ui/dbgui/tpsort.cxx + $(SHELL) ./un-test.sh tpsort.hxx > ../$(PRJ)/sc/source/ui/inc/tpsort.hxx + $(SHELL) ./un-test.sh sortdlg.cxx > ../$(PRJ)/sc/source/ui/dbgui/sortdlg.cxx + $(SHELL) ./un-test.sh sortdlg.hxx > ../$(PRJ)/sc/source/ui/inc/sortdlg.hxx + touch ../$(PRJ)/sc/source/ui/attrdlg/scdlgfact.cxx + touch ../$(PRJ)/sc/source/ui/view/cellsh2.cxx + cp -pv insert-sheet.xml ../$(PRJ)/sc/uiconfig/layout + cp -pv move-copy-sheet.xml ../$(PRJ)/sc/uiconfig/layout + cp -pv sort-options.xml ../$(PRJ)/sc/uiconfig/layout + cp -pv string-input.xml ../$(PRJ)/sc/uiconfig/layout + +localize.sdf: $(PRJ)/../svx/source/dialog/localize.sdf $(PRJ)/../sw/source/ui/dialog/localize.sdf $(PRJ)/../sc/source/ui/src/localize.sdf + grep sortdlg.src $(PRJ)/../sc/source/ui/src/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\sort-options.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' > sort-options-$@ + grep wordcountdialog.src $(PRJ)/../sw/source/ui/dialog/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sw\\uiconfig\\layout\\wordcount.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tDLG_WORDCOUNT_title/' > wordcount-$@ + grep zoom.src $(PRJ)/source/dialog/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "svx\\uiconfig\\layout\\zoom.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_ZOOM_title/' > zoom-$@ + echo '#empty' | cat - sort-options-$@ wordcount-$@ zoom-$@ > $@ + rm -f *-$@ .ELSE # ENABLE_LAYOUT != TRUE all .PHONY: diff --git a/toolkit/workben/layout/message-box.xml b/toolkit/workben/layout/message-box.xml new file mode 100644 index 000000000000..61305e443fa3 --- /dev/null +++ b/toolkit/workben/layout/message-box.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated xml files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="message-box" _title="" optimumsize="true" + has_border="true" sizeable="true" moveable="true" closeable="true"> + <vbox border="5" spacing="5"> + <hbox border="5" spacing="20"> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" /> + </align> + <align cnt:expand="false" cnt:fill="true"> + <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" /> + </align> + <flow/> + </hbox> + <dialogbuttonhbox border="0" spacing="5"> + <flow/> + <!-- deprecoted vcl/MsgBox compatibility !--> + <retrybutton id="BTN_RETRY" /> + <ignorebutton id="BTN_IGNORE" /> + + <yesbutton id="BTN_YES"/> + <cancelbutton id="BTN_CANCEL"/> + <helpbutton id="BTN_HELP"/> + <nobutton id="BTN_NO" xlabel="~Alternate"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/move-copy-sheet.xml b/toolkit/workben/layout/move-copy-sheet.xml new file mode 100644 index 000000000000..3d26db1aa73d --- /dev/null +++ b/toolkit/workben/layout/move-copy-sheet.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog sizeable="true" closeable="true" help-id="FID_TAB_MOVE" moveable="true" output-size="true" id="RID_SCDLG_MOVETAB" sv-look="true" _title="Move/Copy Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox spacing="5" border="5"> + <string id="STR_NEWDOC" _text="- new document -"/> + <fixedtext id="FT_DEST" _label="To ~document"/> + <listbox has_border="true" dropdown="true" id="LB_DEST" tabstop="true"/> + <fixedtext id="FT_INSERT" _label="~Insert before"/> + <listbox has_border="true" id="LB_INSERT" tabstop="true" string-item-list=" : : : : " /> + <checkbox id="BTN_COPY" tabstop="true" _label="~Copy"/> + <dialogbuttonhbox border="5" spacing="5"> + <flow/> + <cancelbutton id="BTN_CANCEL" tabstop="true"/> + <helpbutton id="BTN_HELP" tabstop="true"/> + <okbutton defbutton="true" id="BTN_OK" tabstop="true"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/number-format.xml b/toolkit/workben/layout/number-format.xml new file mode 100644 index 000000000000..6f4c61d01b3e --- /dev/null +++ b/toolkit/workben/layout/number-format.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<tabpage help-id="HID_NUMBERFORMAT" show="false" id="RID_SVXPAGE_NUMBERFORMAT" _title="Number Format" _text="Number Format" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" sizeable="true"> + <!-- + <imagelist prefix="nu" id="IL_ICON"> + <maskcolor blue="0xFFFF" green="0x0000" red="0xFFFF" type="Color"/> + <idlist none="IID_INFO"/> + <idcount none="3"/> + </imagelist> + <imagelist prefix="nuh" id="IL_ICON_HC"> + <maskcolor blue="0xFFFF" green="0x0000" red="0xFFFF" type="Color"/> + <idlist none="IID_INFO"/> + <idcount none="3"/> + </imagelist> + !--> + <vbox spacing="5" border="5"> + <string id="STR_EUROPE" _text="Europe"/> + <string id="STR_AUTO_ENTRY" _text="Automatic"/> + <hbox spacing="5"> + <vbox spacing="5" cnt:fill="true" cnt:expand="true"> + <fixedtext id="FT_CATEGORY" _label="~Category"/> + <listbox line-count="8" auto-hscroll="true" has_border="true" id="LB_CATEGORY" _string-item-list="All:User-defined:Number:Percent:Currency:Date:Time:Scientific:Fraction:Boolean Value:Text"/> + <flow/> + </vbox> + <vbox spacing="5" cnt:fill="true" cnt:expand="true"> + <fixedtext id="FT_FORMAT" _label="F~ormat"/> + <listbox has_border="true" line-count="7" dropdown="true" id="LB_CURRENCY" tabstop="true" _string-item-list="Automatically" cnt:expand="false" cnt:fill="false"/> + <svxfontlistbox line-count="7" dropdown="false" has_border="true" help-id="HID_NUMBERFORMAT_LB_FORMAT" id="LB_FORMAT" tabstop="true" string-item-list=" : : : : : : : : : : : : : : : "/> + </vbox> + <vbox spacing="5" cnt:fill="true" cnt:expand="true"> + <fixedtext id="FT_LANGUAGE" _label="~Language" cnt:expand="false" cnt:fill="false"/> + <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" string-item-list="Dutch:" cnt:expand="false" cnt:fill="false"/> + <checkbox id="CB_SOURCEFORMAT" show="false" _label="So~urce format" cnt:expand="false" cnt:fill="false"/> + <flow cnt:expand="true" cnt:fill="true"/> + <window has_border="true" help-id="HID_NUMBERFORMAT_WND_NUMBER_PREVIEW" id="WND_NUMBER_PREVIEW" sv-look="true"/> + </vbox> + </hbox> + <fixedline id="FL_OPTIONS" _text="Options"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <hbox spacing="5"> + <vbox spacing="5" cnt:fill="false" cnt:expand="false"> + <fixedtext id="FT_DECIMALS" _label="~Decimal places"/> + <fixedtext id="FT_LEADZEROES" _label="Leading ~zeroes"/> + </vbox> + <vbox spacing="5" cnt:fill="false" cnt:expand="false"> + <numericfield has_border="true" first="0" last="15" minimum="0" value="2" maximum="20" repeat="true" id="ED_DECIMALS" spin="true" spin-size="1" strict-format="true" cnt:expand="false"/> + <numericfield has_border="true" first="0" last="15" minimum="0" value="1" maximum="20" repeat="true" id="ED_LEADZEROES" spin="true" spin-size="1" strict-format="true" cnt:fill="false"/> + </vbox> + <vbox spacing="5" cnt:fill="false" cnt:expand="false"> + <checkbox id="BTN_NEGRED" _label="~Negative numbers red"/> + <checkbox id="BTN_THOUSAND" _label="~Thousands separator"/> + </vbox> + </hbox> + </vbox> + </hbox> + <fixedtext id="FT_EDFORMAT" _label="~Format code"/> + <hbox spacing="5" cnt:expand="false"> + <edit has_border="true" id="ED_FORMAT"/> + <imagebutton cnt:expand="false" cnt:fill="false" help-id="HID_NUMBERFORMAT_TBI_ADD" quick-help-text="Add" id="IB_ADD" sv-look="true" graphic="svx/res/nu01.png"/> + <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_INFO" quick-help-text="Edit Comment" id="IB_INFO" sv-look="true" graphic="svx/res/nu03.png"/> + <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_REMOVE" quick-help-text="Remove" id="IB_REMOVE" sv-look="true" graphic="svx/res/nu02.png"/> + </hbox> + <fixedtext no-label="true" show="false" id="FT_COMMENT" word-break="true" cnt:expand="false"/> + <edit has_border="true" show="false" id="ED_COMMENT" cnt:expand="false"/> + </vbox> +</tabpage> diff --git a/toolkit/workben/layout/plugin.cxx b/toolkit/workben/layout/plugin.cxx new file mode 100644 index 000000000000..28dafc2bba78 --- /dev/null +++ b/toolkit/workben/layout/plugin.cxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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 + * + ************************************************************************/ + +#define _LAYOUT_PLUGIN_CXX + +#include "plugin.hxx" + +#include <com/sun/star/awt/XDialog2.hpp> +#include <dialcontrol.hxx> +#include <toolkit/awt/vclxwindow.hxx> + +#include <layout/layout-pre.hxx> + +using namespace com::sun::star; + +#define LAYOUT_RES(x) #x + +#undef ModalDialog +#define ModalDialog( parent, id ) Dialog( parent, "plugin.xml", id ) + +PluginDialog::PluginDialog( Window* pParent ) + : ModalDialog( pParent, LAYOUT_RES( RID_DLG_PLUGIN ) ) + , aHeaderImage( this, LAYOUT_RES( FI_HEADER ) ) + , aHeaderText( this, LAYOUT_RES( FT_HEADER ) ) + , aHeaderLine( this, LAYOUT_RES( FL_HEADER ) ) + , aPlugin( this, LAYOUT_RES( PL_DIAL ), +// FIXME: width=, height=, are not recognized as properties. +// new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 0, 0 ), 0 ) ) + new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 80, 80 ), 0 ) ) + //, aDialControl( static_cast<svx::DialControl&> ( aPlugin.GetPlugin() ) ) + , aDialControl( static_cast<svx::DialControl&> ( *aPlugin.mpPlugin ) ) + , aOKBtn( this, LAYOUT_RES( BTN_OK ) ) + , aCancelBtn( this, LAYOUT_RES( BTN_CANCEL ) ) + , aHelpBtn( this, LAYOUT_RES( BTN_HELP ) ) +{ + aDialControl.SetRotation( 425 ); +} + +PluginDialog::~PluginDialog() +{ +} diff --git a/toolkit/workben/layout/plugin.hxx b/toolkit/workben/layout/plugin.hxx new file mode 100644 index 000000000000..4fe8edf36dc9 --- /dev/null +++ b/toolkit/workben/layout/plugin.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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 _LAYOUT_PLUGIN_HXX +#define _LAYOUT_PLUGIN_HXX + +#include <layout/layout.hxx> +#include <layout/layout-pre.hxx> + +namespace svx { +class DialControl; +} + +class PluginDialog : public ModalDialog +{ +private: + FixedImage aHeaderImage; + FixedText aHeaderText; + FixedLine aHeaderLine; + Plugin aPlugin; + svx::DialControl& aDialControl; + OKButton aOKBtn; + CancelButton aCancelBtn; + HelpButton aHelpBtn; + +public: + PluginDialog( Window* pParent ); + ~PluginDialog(); +}; + +#include <layout/layout-post.hxx> + +#endif /* _LAYOUT_PLUGIN_HXX */ + diff --git a/toolkit/workben/layout/plugin.xml b/toolkit/workben/layout/plugin.xml new file mode 100644 index 000000000000..c5f1b2abe040 --- /dev/null +++ b/toolkit/workben/layout/plugin.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated xml files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="RID_DLG_PLUGIN" _title="Plugin Test" optimumsize="true" + help-id="SID_ATTR_PLUGIN" + has_border="true" sizeable="true" moveable="true"> + <vbox spacing="5" border="5"> + <hbox spacing="5" cnt:expand="false"> + <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" /> + <fixedtext id="FT_HEADER" _label="Plugin Test"/> + </hbox> + <fixedline id="FL_HEADER"/> + <hbox> + <flow cnt:padding="80"/> + <plugin id="PL_DIAL" width="80" height="80"/> + </hbox> + <dialogbuttonhbox border="5" spacing="5"> + <flow/> + <okbutton defbutton="true" id="BTN_OK"/> + <cancelbutton id="BTN_CANCEL" /> + <helpbutton id="BTN_HELP"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> + diff --git a/toolkit/workben/layout/recover.cxx b/toolkit/workben/layout/recover.cxx index d5bd542b36ac..c9a826688dc9 100644 --- a/toolkit/workben/layout/recover.cxx +++ b/toolkit/workben/layout/recover.cxx @@ -55,6 +55,13 @@ using namespace com::sun::star; #include <layout/layout-pre.hxx> +#if ENABLE_LAYOUT +#undef SVX_RES +#define SVX_RES(x) #x +#undef SfxModalDialog +#define SfxModalDialog( parent, id ) Dialog( parent, "recover.xml", id ) +#endif /* ENABLE_LAYOUT */ + #if TEST_LAYOUT SvxRecoverDialog::SvxRecoverDialog( Window* pParent ) #else /* !TEST_LAYOUT */ diff --git a/toolkit/workben/layout/recover.hxx b/toolkit/workben/layout/recover.hxx index dabaa863e511..0d0eee278e6b 100644 --- a/toolkit/workben/layout/recover.hxx +++ b/toolkit/workben/layout/recover.hxx @@ -35,7 +35,7 @@ #include <vcl/button.hxx> #include <vcl/field.hxx> #include <vcl/fixed.hxx> -#include <box.hxx> +#include <layout/core/box.hxx> #include <layout/layout-pre.hxx> class SvxRecoverDialog : public SfxModalDialog diff --git a/toolkit/workben/layout/recover.xml b/toolkit/workben/layout/recover.xml index a065c7d9243b..b7387b687de2 100644 --- a/toolkit/workben/layout/recover.xml +++ b/toolkit/workben/layout/recover.xml @@ -58,7 +58,7 @@ LINE TEST"/> <checkbox id="CH_LOGFILE" _label="Open additional text document to display the restore logfile"/> <dialogbuttonhbox border="5" spacing="5"> <flow/> - <okbutton id="BTN_OK" _label="Restore"/> + <okbutton defbutton="true" id="BTN_OK" _label="Restore"/> <cancelbutton id="BTN_CANCEL" /> <helpbutton id="BTN_HELP"/> </dialogbuttonhbox> diff --git a/toolkit/workben/layout/refresh b/toolkit/workben/layout/refresh index de2652ce2810..796999549c36 100644 --- a/toolkit/workben/layout/refresh +++ b/toolkit/workben/layout/refresh @@ -1,3 +1,7 @@ echo "source me ..." test -n "${INPATH}" && rm -Rf ../../${INPATH} -build debug=true && cp ../../${INPATH}/lib/*.so ../../../solver/680/${INPATH}/lib && dmake debug=true && ../../${INPATH}/bin/test "$@" +build debug=true\ + && cp ../../${INPATH}/lib/*.so ../../../solver/300/${INPATH}/lib \ + && cp -f ../..$INPATH/lib/libtkx.so $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program \ + && dmake debug=true \ + && ../../${INPATH}/bin/test "$@" diff --git a/toolkit/workben/layout/simple-paragraph.cxx b/toolkit/workben/layout/simple-paragraph.cxx index a7e60f83d3fa..c3f54a35f963 100644 --- a/toolkit/workben/layout/simple-paragraph.cxx +++ b/toolkit/workben/layout/simple-paragraph.cxx @@ -37,12 +37,12 @@ // include --------------------------------------------------------------- -#include <stdio.h> +#include <cstdio> #include <tools/shl.hxx> #include <sfx2/objsh.hxx> #include <vcl/msgbox.hxx> -#include <stdio.h> +#include <cstdio> namespace SVX { #include <svx/paraprev.hxx> // Preview diff --git a/toolkit/workben/layout/sort-options.xml b/toolkit/workben/layout/sort-options.xml new file mode 100644 index 000000000000..a409ac2d530a --- /dev/null +++ b/toolkit/workben/layout/sort-options.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<tabpage help-id="HID_SCPAGE_SORT_OPTIONS" + id="RID_SCPAGE_SORT_OPTIONS" + sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" + optimumsize="true" + sizeable="true" moveable="true"> + <vbox spacing="4" border="5"> + <string id="STR_COL_LABEL" _text="Range contains column la~bels"/> + <string id="STR_ROW_LABEL" _text="Range contains ~row labels"/> + <string id="SCSTR_UNDEFINED" _text="- undefined -"/> + <vbox spacing="4" border="5"> + <checkbox id="BTN_CASESENSITIVE" tabstop="true" _label="Case ~sensitive"/> + <checkbox id="BTN_LABEL" tabstop="true"/> + <checkbox id="BTN_FORMATS" tabstop="true" _label="Include ~formats"/> + <checkbox id="BTN_NATURALSORT" tabstop="true" _label="Enable ~natural sort"/> + <checkbox id="BTN_COPYRESULT" tabstop="true" _label="~Copy sort results to:"/> + <hbox> + <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/> + <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/> + </hbox> + <checkbox id="BTN_SORT_USER" tabstop="true" _label="Custom sort ~order"/> + <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/> + <hbox> + <fixedtext id="FT_LANGUAGE" _label="~Language"/> + <fixedtext id="FT_ALGORITHM" _label="O~ptions"/> + </hbox> + <hbox> + <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true" _string-item-list="Default"/> + <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/> + </hbox> + <fixedline id="FL_DIRECTION" _text="Direction"/> + <radiobutton id="BTN_TOP_DOWN" radiogroup="sort-options" tabstop="true" _label="~Top to bottom (sort rows)"/> + <radiobutton id="BTN_LEFT_RIGHT" radiogroup="sort-options" tabstop="true" _label="L~eft to right (sort columns)"/> + </vbox> + </vbox> +</tabpage> diff --git a/toolkit/workben/layout/sortdlg.cxx b/toolkit/workben/layout/sortdlg.cxx new file mode 100644 index 000000000000..9666e5a39124 --- /dev/null +++ b/toolkit/workben/layout/sortdlg.cxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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: sortdlg.cxx,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. + * + ************************************************************************/ + +#if !TEST_LAYOUT +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" +#endif /*! TEST_LAYOUT */ + +#undef SC_DLLIMPLEMENTATION + + + +#include "tpsort.hxx" +#include "sortdlg.hxx" +#include "scresid.hxx" +#include "sortdlg.hrc" + +#if !LAYOUT_SFX_TABDIALOG_BROKEN +#include <layout/layout-pre.hxx> +#endif + +ScSortDlg::ScSortDlg( Window* pParent, + const SfxItemSet* pArgSet ) : + SfxTabDialog( pParent, + ScResId( RID_SCDLG_SORT ), + pArgSet ), + bIsHeaders ( FALSE ), + bIsByRows ( FALSE ) + +{ +#if LAYOUT_SFX_TABDIALOG_BROKEN + AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 ); + AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 ); +#else /* !LAYOUT_SFX_TABDIALOG_BROKEN */ + String fields = rtl::OUString::createFromAscii ("fields"); + AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND); + String options = rtl::OUString::createFromAscii ("options"); + AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND); +#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */ + FreeResource(); +} + +__EXPORT ScSortDlg::~ScSortDlg() +{ +} + diff --git a/toolkit/workben/layout/sortdlg.hrc b/toolkit/workben/layout/sortdlg.hrc new file mode 100644 index 000000000000..4bf07ad3f59a --- /dev/null +++ b/toolkit/workben/layout/sortdlg.hrc @@ -0,0 +1,91 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sortdlg.hrc,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 21:51:32 $ + * + * 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 "sc.hrc" // -> RID_SCDLG_SORT + // -> RID_SCPAGE_SORT_FIELDS + // -> RID_SCPAGE_SORT_OPTIONS + // -> SCSTR_NONAME + // -> SCSTR_UNDEFINED + // -> SCSTR_FIELD + +/* +#define RID_SCDLG_SORT 256 +#define RID_SCPAGE_SORT_FIELDS 257 +#define RID_SCPAGE_SORT_OPTIONS 258 +*/ + +#define TP_FIELDS 1 +#define TP_OPTIONS 2 + +// TP_SORT_FIELDS: +#define FL_SORT1 1 +#define FL_SORT2 2 +#define FL_SORT3 3 +#define LB_SORT1 4 +#define LB_SORT2 5 +#define LB_SORT3 6 +#define BTN_UP1 7 +#define BTN_UP2 8 +#define BTN_UP3 9 +#define BTN_DOWN1 10 +#define BTN_DOWN2 11 +#define BTN_DOWN3 12 + +// TP_SORT_OPTIONS: +#define FL_DIRECTION 1 +#define LB_SORT_USER 2 +#define LB_OUTAREA 3 +#define ED_OUTAREA 4 +//#define FT_AREA_LABEL 5 +//#define FT_AREA 6 +#define BTN_SORT_USER 7 +#define BTN_CASESENSITIVE 8 +#define BTN_LABEL 9 +#define BTN_FORMATS 10 +#define BTN_COPYRESULT 11 +#define BTN_TOP_DOWN 12 +#define BTN_LEFT_RIGHT 13 +#define STR_COL_LABEL 14 +#define STR_ROW_LABEL 15 +#define FT_LANGUAGE 16 +#define LB_LANGUAGE 17 +#define FT_ALGORITHM 18 +#define LB_ALGORITHM 19 +#define BTN_NATURALSORT 20 + + + + diff --git a/toolkit/workben/layout/sortdlg.hxx b/toolkit/workben/layout/sortdlg.hxx new file mode 100644 index 000000000000..2be123f091ab --- /dev/null +++ b/toolkit/workben/layout/sortdlg.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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: sortdlg.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 SC_SORTDLG_HXX +#define SC_SORTDLG_HXX + +#include <sfx2/tabdlg.hxx> + +#if TEST_LAYOUT +#define LAYOUT_SFX_TABDIALOG_BROKEN 0 +#else /* !TEST_LAYOUT */ +#ifndef LAYOUT_SFX_TABDIALOG_BROKEN +#define LAYOUT_SFX_TABDIALOG_BROKEN 1 +#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */ +#endif /* !TEST_LAYOUT */ + +#if !LAYOUT_SFX_TABDIALOG_BROKEN +#include <sfx2/layout.hxx> +#include <layout/layout-pre.hxx> +#endif + +class ScSortDlg : public SfxTabDialog +{ +public: + ScSortDlg( Window* pParent, + const SfxItemSet* pArgSet ); + ~ScSortDlg(); + + void SetHeaders( BOOL bHeaders ); + void SetByRows ( BOOL bByRows ); + BOOL GetHeaders() const; + BOOL GetByRows () const; + + +private: + BOOL bIsHeaders; + BOOL bIsByRows; +}; + +inline void ScSortDlg::SetHeaders( BOOL bHeaders ) { bIsHeaders = bHeaders; } +inline void ScSortDlg::SetByRows ( BOOL bByRows ) { bIsByRows = bByRows; } +inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; } +inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; } + +#if !LAYOUT_SFX_TABDIALOG_BROKEN +#include <layout/layout-post.hxx> +#endif + +#endif // SC_SORTDLG_HXX diff --git a/toolkit/workben/layout/sortdlg.src b/toolkit/workben/layout/sortdlg.src new file mode 100644 index 000000000000..06453e54fd29 --- /dev/null +++ b/toolkit/workben/layout/sortdlg.src @@ -0,0 +1,325 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sortdlg.src,v $ + * + * $Revision: 1.41 $ + * + * last change: $Author: ihi $ $Date: 2007/04/19 16:48:19 $ + * + * 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 "sortdlg.hrc" +TabPage RID_SCPAGE_SORT_FIELDS +{ + Hide = TRUE ; + SVLook = TRUE ; + HelpId = HID_SCPAGE_SORT_FIELDS ; + Size = MAP_APPFONT ( 260 , 185 ) ; + ListBox LB_SORT1 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 19 ) ; + Size = MAP_APPFONT ( 154 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + RadioButton BTN_UP1 + { + Pos = MAP_APPFONT ( 172 , 14 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "~Ascending" ; + TabStop = TRUE ; + }; + RadioButton BTN_DOWN1 + { + Pos = MAP_APPFONT ( 172 , 28 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "~Descending" ; + TabStop = TRUE ; + }; + FixedLine FL_SORT1 + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Sort ~by" ; + }; + ListBox LB_SORT2 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 60 ) ; + Size = MAP_APPFONT ( 154 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + RadioButton BTN_UP2 + { + Pos = MAP_APPFONT ( 172 , 55 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "A~scending" ; + TabStop = TRUE ; + }; + RadioButton BTN_DOWN2 + { + Pos = MAP_APPFONT ( 172 , 69 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "D~escending" ; + TabStop = TRUE ; + }; + FixedLine FL_SORT2 + { + Pos = MAP_APPFONT ( 6 , 44 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Then b~y" ; + }; + ListBox LB_SORT3 + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 101 ) ; + Size = MAP_APPFONT ( 154 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + RadioButton BTN_UP3 + { + Pos = MAP_APPFONT ( 172 , 96 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "As~cending" ; + TabStop = TRUE ; + }; + RadioButton BTN_DOWN3 + { + Pos = MAP_APPFONT ( 172 , 110 ) ; + Size = MAP_APPFONT ( 79 , 10 ) ; + Text [ en-US ] = "Desce~nding" ; + TabStop = TRUE ; + }; + FixedLine FL_SORT3 + { + Pos = MAP_APPFONT ( 6 , 85 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "T~hen by" ; + }; +}; +TabPage RID_SCPAGE_SORT_OPTIONS +{ + Hide = TRUE ; + SVLook = TRUE ; + HelpId = HID_SCPAGE_SORT_OPTIONS ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + CheckBox BTN_CASESENSITIVE + { + Pos = MAP_APPFONT ( 12 , 6 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Case ~sensitive" ; + TabStop = TRUE ; + }; + CheckBox BTN_LABEL + { + Pos = MAP_APPFONT ( 12 , 20 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + TabStop = TRUE ; + }; + String STR_COL_LABEL + { + Text [ en-US ] = "Range contains column la~bels" ; + }; + String STR_ROW_LABEL + { + Text [ en-US ] = "Range contains ~row labels" ; + }; + CheckBox BTN_FORMATS + { + Pos = MAP_APPFONT ( 12 , 34 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Include ~formats" ; + TabStop = TRUE ; + }; + CheckBox BTN_NATURALSORT + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ de ] = "Enable ~natural sort" ; + Text [ en-US ] = "Enable ~natural sort" ; + Text [ cs ] = "Aktivovat přirozené třídění" ; + Text [ sk ] = "Aktivovať prirodzené triedenie" ; + TabStop = TRUE ; + Text [ x-comment ] = " " ; + }; + CheckBox BTN_COPYRESULT + { + Pos = MAP_APPFONT ( 12 , 62 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "~Copy sort results to:" ; + TabStop = TRUE ; + }; + ListBox LB_OUTAREA + { + Border = TRUE ; + Pos = MAP_APPFONT ( 20 , 73 ) ; + Size = MAP_APPFONT ( 93 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Edit ED_OUTAREA + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 119 , 73 ) ; + Size = MAP_APPFONT ( 132 , 12 ) ; + TabStop = TRUE ; + }; + CheckBox BTN_SORT_USER + { + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "Custom sort ~order" ; + TabStop = TRUE ; + }; + ListBox LB_SORT_USER + { + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 20 , 100 ) ; + Size = MAP_APPFONT ( 231 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_LANGUAGE + { + Pos = MAP_APPFONT ( 12 , 118 ) ; + Size = MAP_APPFONT ( 101 , 8 ) ; + Text [ en-US ] = "~Language"; + }; + ListBox LB_LANGUAGE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 129 ) ; + Size = MAP_APPFONT ( 101 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + FixedText FT_ALGORITHM + { + Pos = MAP_APPFONT ( 119 , 118 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "O~ptions"; + }; + ListBox LB_ALGORITHM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 119 , 129 ) ; + Size = MAP_APPFONT ( 132 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedLine FL_DIRECTION + { + Pos = MAP_APPFONT ( 6 , 147 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Direction" ; + }; + RadioButton BTN_TOP_DOWN + { + Pos = MAP_APPFONT ( 12 , 158 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "~Top to bottom (sort rows)" ; + TabStop = TRUE ; + }; + RadioButton BTN_LEFT_RIGHT + { + Pos = MAP_APPFONT ( 12 , 172 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text [ en-US ] = "L~eft to right (sort columns)" ; + TabStop = TRUE ; + }; +/* + FixedText FT_AREA_LABEL + { + Pos = MAP_APPFONT ( 6 , 171 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Data area:" ; + }; +*/ +}; +TabDialog RID_SCDLG_SORT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 220 , 175 ) ; + Text [ en-US ] = "Sort" ; + Moveable = TRUE ; + Closeable = FALSE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 210 , 170 ) ; + PageList = + { + PageItem + { + Identifier = TP_FIELDS ; + PageResID = TP_FIELDS ; + Text [ en-US ] = "Sort Criteria" ; + }; + PageItem + { + Identifier = TP_OPTIONS ; + PageResID = TP_OPTIONS ; + Text [ en-US ] = "Options" ; + }; + }; + }; + OKButton 1 + { + Pos = MAP_APPFONT ( 3 , 157 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + }; + CancelButton 1 + { + Pos = MAP_APPFONT ( 49 , 157 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + }; + PushButton 1 + { + Pos = MAP_APPFONT ( 137 , 157 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + }; + HelpButton 1 + { + Pos = MAP_APPFONT ( 94 , 157 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + }; +}; + + diff --git a/toolkit/workben/layout/sortdlg.xml b/toolkit/workben/layout/sortdlg.xml new file mode 100644 index 000000000000..ce45a60ff1ee --- /dev/null +++ b/toolkit/workben/layout/sortdlg.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<tabpage help-id="HID_SCPAGE_SORT_FIELDS" hide="true" id="RID_SCPAGE_SORT_FIELDS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox> + <fixedline id="FL_SORT1" text="Sort ~by"/> + <radiobutton id="BTN_UP1" tabstop="true" label="~Ascending"/> + <listbox has_border="true" dropdown="true" id="LB_SORT1" tabstop="true"/> + <radiobutton id="BTN_DOWN1" tabstop="true" label="~Descending"/> + <fixedline id="FL_SORT2" text="Then b~y"/> + <radiobutton id="BTN_UP2" tabstop="true" label="A~scending"/> + <listbox has_border="true" dropdown="true" id="LB_SORT2" tabstop="true"/> + <radiobutton id="BTN_DOWN2" tabstop="true" label="D~escending"/> + <fixedline id="FL_SORT3" text="T~hen by"/> + <radiobutton id="BTN_UP3" tabstop="true" label="As~cending"/> + <listbox has_border="true" dropdown="true" id="LB_SORT3" tabstop="true"/> + <radiobutton id="BTN_DOWN3" tabstop="true" label="Desce~nding"/> + </vbox> +</tabpage> +<tabpage help-id="HID_SCPAGE_SORT_OPTIONS" hide="true" id="RID_SCPAGE_SORT_OPTIONS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <string id="STR_COL_LABEL" text="Range contains column la~bels"/> + <string id="STR_ROW_LABEL" text="Range contains ~row labels"/> + <vbox> + <checkbox id="BTN_CASESENSITIVE" tabstop="true" label="Case ~sensitive"/> + <checkbox id="BTN_LABEL" tabstop="true"/> + <checkbox id="BTN_FORMATS" tabstop="true" label="Include ~formats"/> + <checkbox id="BTN_NATURALSORT" tabstop="true" label=" "/> + <checkbox id="BTN_COPYRESULT" tabstop="true" label="~Copy sort results to:"/> + <hbox> + <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/> + <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/> + </hbox> + <checkbox id="BTN_SORT_USER" tabstop="true" label="Custom sort ~order"/> + <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/> + <hbox> + <fixedtext id="FT_LANGUAGE" label="~Language"/> + <fixedtext id="FT_ALGORITHM" label="O~ptions"/> + </hbox> + <hbox> + <listbox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true"/> + <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/> + </hbox> + <fixedline id="FL_DIRECTION" text="Direction"/> + <radiobutton id="BTN_TOP_DOWN" tabstop="true" label="~Top to bottom (sort rows)"/> + <radiobutton id="BTN_LEFT_RIGHT" tabstop="true" label="L~eft to right (sort columns)"/> + </vbox> +</tabpage> +<tabdialog closeable="false" moveable="true" output-size="true" id="RID_SCDLG_SORT" sv-look="true" text="Sort" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox> + <tabcontrol output-size="true" id="1"> + <pagelist> + <pageitem identifier="TP_FIELDS" page-res-id="TP_FIELDS" text="Sort Criteria"/> + <pageitem identifier="TP_OPTIONS" page-res-id="TP_OPTIONS" text="Options"/> + </pagelist> + </tabcontrol> + <hbox> + <okbutton defbutton="true" id="1" tabstop="true"/> + <cancelbutton id="1" tabstop="true"/> + <helpbutton id="1" tabstop="true"/> + <pushbutton id="1" tabstop="true"/> + </hbox> + </vbox> +</tabdialog> diff --git a/toolkit/workben/layout/string-input.xml b/toolkit/workben/layout/string-input.xml new file mode 100644 index 000000000000..b1aed5197c17 --- /dev/null +++ b/toolkit/workben/layout/string-input.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- This is a template. i18n translation is not performed in-place; + i18n translated XML files are generated from this template by + transex3/layout/tralay. !--> + +<modaldialog sizeable="true" closeable="false" moveable="true" output-size="true" id="RID_SCDLG_STRINPUT" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" title="Insert String"> + <vbox spacing="5" border="5"> + <fixedtext id="FT_LABEL" label="FT-LABEL"/> + <edit has_border="true" id="ED_INPUT" tabstop="true"/> + <dialogbuttonhbox border="5" spacing="5"> + <okbutton defbutton="true" id="BTN_OK" tabstop="true"/> + <cancelbutton id="BTN_CANCEL" tabstop="true"/> + <helpbutton id="BTN_HELP" tabstop="true"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/tab-dialog.xml b/toolkit/workben/layout/tab-dialog.xml new file mode 100644 index 000000000000..da75f03e9df5 --- /dev/null +++ b/toolkit/workben/layout/tab-dialog.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + _title="layout::TabDialog" optimumsize="true" + id="tab-dialog" + has_border="true" sizeable="true" moveable="true"> + <vbox spacing="5" border="5"> + <tabcontrol id="ID_TABCONTROL"/> + <dialogbuttonhbox border="5" spacing="5" cnt:expand="false"> + <flow/> + <okbutton defbutton="true" id="BTN_OK" show="false"/> + <pushbutton id="BTN_USER" _label="<User>" show="false"/> + <cancelbutton id="BTN_CANCEL" show="false"/> + <helpbutton id="BTN_HELP" show="false"/> + <resetbutton id="BTN_RESET" show="false"/> + <pushbutton id="BTN_BASEFMT" _label="<Base Format>" show="false"/> + </dialogbuttonhbox> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/tabcontrol.xml b/toolkit/workben/layout/tabcontrol.xml index 106489a457a9..2986f1f9e0d9 100644 --- a/toolkit/workben/layout/tabcontrol.xml +++ b/toolkit/workben/layout/tabcontrol.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <dialog xmlns="http://openoffice.org/2007/layout" - xmlns:cnt="http://openoffice.org/2007/layout/container" - title="TabControl Test" optimumsize="true" - has_border="true" sizeable="true" moveable="true"> + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="TabControl Test" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> <vbox> - <tabcontrol> - <pushbutton label="Child 1" cnt:title="Page 1" /> - <edit has_border="true" text="Child 2" cnt:title="Page 2" /> - <vbox cnt:title="Page 3"> - <pushbutton label="Child 3"/> - <edit has_border="true" text="Child 4" /> - </vbox> - </tabcontrol> - <okbutton cnt:expand="false" /> + <tabcontrol> + <pushbutton label="Child 1" cnt:title="Page 1" /> + <edit has_border="true" text="Child 2" cnt:title="Page 2" /> + <vbox cnt:title="Page 3"> + <pushbutton label="Child 3"/> + <edit has_border="true" text="Child 4" /> + </vbox> + </tabcontrol> + <okbutton cnt:expand="false" /> </vbox> </dialog> diff --git a/toolkit/workben/layout/test.cxx b/toolkit/workben/layout/test.cxx index b98eaff2fc80..1bd9603fc5ac 100644 --- a/toolkit/workben/layout/test.cxx +++ b/toolkit/workben/layout/test.cxx @@ -30,7 +30,6 @@ ************************************************************************/ #include <vcl/svapp.hxx> -//#include <transex3/vosapp.hxx> // This works and was used before for standalone test, not sure why // we'd want it. @@ -38,29 +37,41 @@ #include "uno.hxx" #include <cstdio> -#include <osl/file.h> +#include <cstdlib> +#include <sys/stat.h> -#include <rtl/ustring.hxx> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <comphelper/processfactory.hxx> #include <cppuhelper/bootstrap.hxx> - -#include <ucbhelper/contentbroker.hxx> +#include <rtl/ustring.hxx> #include <ucbhelper/configurationkeys.hxx> +#include <ucbhelper/contentbroker.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/xml/sax/SAXException.hpp> +#define SORT_DLG 1 /* requires sfx2, svx to be compiled */ +#if SORT_DLG +#include "scitems.hxx" +#include "uiitems.hxx" +#endif /* SORT_DLG */ #include "editor.hxx" -#include "wordcountdialog.hxx" +#include "plugin.hxx" #undef _LAYOUT_POST_HXX -#include "zoom.hxx" +#include "recover.hxx" #undef _LAYOUT_POST_HXX -#include "recover.hxx" +#if SORT_DLG +#include "sortdlg.hxx" +#undef _LAYOUT_POST_HXX +#endif /* SORT_DLG */ + +#include "wordcountdialog.hxx" +#undef _LAYOUT_POST_HXX + +#include "zoom.hxx" #undef _LAYOUT_POST_HXX -//#undef SW_WORDCOUNTDIALOG_HXX #include <layout/layout-pre.hxx> using namespace ::rtl; @@ -68,38 +79,6 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -Reference< XComponentContext > createInitialComponentContext( - OUString const & inst_dir ) -{ - Reference< XComponentContext > xContext; - - try - { - OUString file_url; - oslFileError rc = osl_getFileURLFromSystemPath( - inst_dir.pData, &file_url.pData ); - OSL_ASSERT( osl_File_E_None == rc ); - (void) rc; // quiet warning - - OUString unorc = file_url + OUString( - OUString::createFromAscii( "/program/" SAL_CONFIGFILE( "uno" )) ); - - return defaultBootstrap_InitialComponentContext( unorc ); - } - - catch( Exception& rExc ) - { - OString aStr( OUStringToOString( rExc.Message, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( 0, aStr.getStr() ); - } - - return xContext; -} - - -// ----------------------------------------------------------------------- - class LayoutTest : public Application { Reference< XComponentContext > mxContext; @@ -115,7 +94,7 @@ public: void RunEditor(); void RunFiles(); void ExceptionalMain(); - void IInit(); + void Init(); void InitUCB(); void LoadFile( OUString const &aName ); void Main(); @@ -124,18 +103,29 @@ public: static void usage() { - fprintf (stderr, "usage: test [--inst inst_dir] [DIALOG.XML]... | --test [DIALOG.XML]\n" ); + fprintf (stderr, "usage: test [--inst OOO_INSTALL_PREFIX] [DIALOG.XML]... | --test [DIALOG.XML]\n" ); exit( 2 ); } +static uno::Reference< lang::XSingleServiceFactory > get_factory( char const *service ) +{ + uno::Reference< lang::XSingleServiceFactory > xFactory( + comphelper::createProcessComponent( + rtl::OUString::createFromAscii( service ) ), uno::UNO_QUERY ); + + if ( !xFactory.is() ) + fprintf( stderr, "error loading: %s\n", service ); + return xFactory; +} + +#define GET_FACTORY(x) get_factory( #x ) + void LayoutTest::LoadFile( const OUString &aTestFile ) { fprintf( stderr, "TEST: layout instance\n" ); - uno::Reference< lang::XSingleServiceFactory > xFactory( - comphelper::createProcessComponent( - rtl::OUString::createFromAscii( "com.sun.star.awt.Layout" ) ), - uno::UNO_QUERY ); + uno::Reference< lang::XSingleServiceFactory > xFactory + = GET_FACTORY( com.sun.star.awt.Layout ); if ( !xFactory.is() ) { fprintf( stderr, "Layout engine not installed\n" ); @@ -155,40 +145,51 @@ void LayoutTest::LoadFile( const OUString &aTestFile ) fprintf( stderr, "TEST: file loaded\n" ); } -// Nurgh ... void LayoutTest::InitUCB() { OUString aEmpty; - Sequence< Any > aArgs(6); + Sequence< Any > aArgs( 6 ); aArgs[0] - <<= OUString::createFromAscii(UCB_CONFIGURATION_KEY1_LOCAL); + <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); aArgs[1] - <<= OUString::createFromAscii(UCB_CONFIGURATION_KEY2_OFFICE); + <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); aArgs[2] <<= OUString::createFromAscii( "PIPE" ); aArgs[3] <<= aEmpty; aArgs[4] <<= OUString::createFromAscii( "PORTAL" ); aArgs[5] <<= aEmpty; - if (! ::ucbhelper::ContentBroker::initialize( mxMSF, aArgs ) ) + if ( !::ucbhelper::ContentBroker::initialize( mxMSF, aArgs ) ) + { fprintf( stderr, "Failed to init content broker\n" ); + fprintf( stderr, "arg[0]: %s\n", UCB_CONFIGURATION_KEY1_LOCAL ); + fprintf( stderr, "arg[1]: %s\n", UCB_CONFIGURATION_KEY2_OFFICE ); + } +} + +static void support_upstream_brand_prefix () +{ + if ( char const* inst = getenv( "OOO_INSTALL_PREFIX" ) ) + { + char const *brand_prefix = "/openoffice.org3"; + OUString brand_dir = OUString::createFromAscii( inst ) + + OUString::createFromAscii( brand_prefix ); + struct stat stat_info; + if ( !stat ( OUSTRING_CSTR( brand_dir ), &stat_info ) ) + { + OSL_TRACE( "Appending %s to OOO_INSTALL_PREFIX", brand_prefix ); + setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( brand_dir ), 1 ); + } + } } -#define INIT_ENV_VOODOO( installDir ) \ - /* Unless you do this, obviously you don't deserve to have anything work */ \ - OString aCfg = "CFG_INIFILE=file://" \ - + OUStringToOString( installDir, RTL_TEXTENCODING_UTF8 ) \ - + "/program/configmgrrc"; \ - putenv( (char *)aCfg.getStr() ); \ - /* Unless you do this, obviously you don't want your paths to be correct & \ - hence no images.zip location is possible. */ \ - OString aBaseInst = "BaseInstallation=file://" \ - + OUStringToOString( installDir, RTL_TEXTENCODING_UTF8 ); \ - putenv( (char *)aBaseInst.getStr() ); \ - -void LayoutTest::IInit() +void LayoutTest::Init() { - INIT_ENV_VOODOO( mInstallDir ); - mxContext = createInitialComponentContext( mInstallDir ); + ParseCommandLine(); + setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 0 ); + support_upstream_brand_prefix (); + OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) ); + + mxContext = defaultBootstrap_InitialComponentContext(); mxMSF = new UnoBootstrapLayout( Reference< lang::XMultiServiceFactory >( mxContext->getServiceManager(), UNO_QUERY ) ); ::comphelper::setProcessServiceFactory( mxMSF ); InitUCB(); @@ -196,6 +197,7 @@ void LayoutTest::IInit() void LayoutTest::ParseCommandLine() { + printf ("%s\n", __PRETTY_FUNCTION__); for ( sal_uInt16 i = 0; i < GetCommandLineParamCount(); i++ ) { OUString aParam = OUString( GetCommandLineParam( i ) ); @@ -206,6 +208,7 @@ void LayoutTest::ParseCommandLine() if ( i >= GetCommandLineParamCount() - 1) usage(); mInstallDir = GetCommandLineParam( ++i ); + setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 1 ); } else if ( aParam.equalsAscii( "--test" ) ) { @@ -234,32 +237,77 @@ void LayoutTest::RunEditor() editor.Execute(); } -void RunDialog( layout::Dialog& dialog ) +short RunDialog( Dialog& dialog ) { dialog.Show(); - dialog.Execute(); - fprintf( stderr, "1st execute exited" ); - dialog.Execute(); - fprintf( stderr, "2nd execute exited" ); + short result = dialog.Execute(); + fprintf( stderr, "Done: dialog execute exited:%d\n", result); + return result; } +#undef Dialog +short RunDialog( ::Dialog& dialog ) +{ + dialog.Show(); + short result = dialog.Execute(); + fprintf( stderr, "Done: dialog execute exited:%d\n", result); + return result; +} + +#if SORT_DLG +static void LoadSC() +{ + get_factory( "com.sun.star.comp.sfx2.DocumentTemplates" ); + get_factory( "com.sun.star.comp.Calc.SpreadsheetDocument" ); + GET_FACTORY( com.sun.star.i18n.Transliteration.l10n ); +} +#endif /* SORT_DLG */ + void TestDialog( OUString const& name ) { - if ( name.equalsAscii( "zoom" ) ) + if ( 0 ) + ; + else if ( name.equalsAscii( "plugin" ) ) { - SvxZoomDialog zoom( 0 ); - RunDialog( zoom ); + PluginDialog plugin ( 0 ); + RunDialog( plugin ); } - else if ( name.equalsAscii( "wordcount" ) ) + else if ( name.equalsAscii( "query" ) ) { - SwWordCountDialog words ( 0 ); - RunDialog( words ); + QueryBox query ( 0, "Do you want to do?", "do"); + RunDialog( query ); + } + else if ( name.equalsAscii( "query-compat" ) ) + { + QueryBox query ( 0, + WinBits( WB_YES_NO | WB_DEF_YES ), +// WinBits( WB_ABORT_RETRY_IGNORE ), + OUString::createFromAscii ("Do you want to do?")); + RunDialog( query ); } else if ( name.equalsAscii( "recover" ) ) { SvxRecoverDialog recover ( 0 ); RunDialog( recover ); } +#if SORT_DLG + else if ( name.equalsAscii( "sort" ) ) + { + LoadSC(); + ScSortDlg sort (0, 0); + RunDialog( sort ); + } +#endif /* SORT_DLG */ + else if ( name.equalsAscii( "wordcount" ) ) + { + SwWordCountDialog words ( 0 ); + RunDialog( words ); + } + else if ( name.equalsAscii( "zoom" ) ) + { + SvxZoomDialog zoom( 0 ); + RunDialog( zoom ); + } } void LayoutTest::RunFiles() @@ -274,10 +322,6 @@ void LayoutTest::RunFiles() void LayoutTest::ExceptionalMain() { - ParseCommandLine(); - IInit(); - INIT_ENV_VOODOO( mInstallDir ); - if ( mTestDialog.getLength() ) TestDialog( mTestDialog ); else if ( mEditMode ) @@ -323,4 +367,4 @@ LayoutTest::LayoutTest( char const* installDir ) { } -LayoutTest lt( "/usr/local/lib/ooo" ); +LayoutTest layout_test( "/usr/local/lib/ooo" ); diff --git a/toolkit/workben/layout/testrc.in b/toolkit/workben/layout/testrc.in new file mode 100644 index 000000000000..00ae5eb3cd5e --- /dev/null +++ b/toolkit/workben/layout/testrc.in @@ -0,0 +1,12 @@ +OOO_INSTALL_PREFIX_URL=file://${OOO_INSTALL_PREFIX} +OOO_BASIS_URL=${OOO_INSTALL_PREFIX_URL}/basis-link +OOO_BASIS_BIN_URL=${OOO_BASIS_URL}/program +OOO_URE_URL=${OOO_BASIS_URL}/ure-link +# +#CFG_INIFILE=${OOO_BASIS_BIN_URL}/configmgrrc +#BaseInstallation=${OOO_BASIS_URL} +BRAND_BASE_DIR=${OOO_INSTALL_PREFIX_URL} +OOO_BASE_DIR=${OOO_BASIS_URL} +# +UNO_TYPES=${OOO_URE_URL}/share/misc/types.rdb ${OOO_BASIS_BIN_URL}/offapi.rdb +UNO_SERVICES=${OOO_URE_URL}/share/misc/services.rdb ${OOO_BASIS_BIN_URL}/services.rdb diff --git a/toolkit/workben/layout/tpsort.cxx b/toolkit/workben/layout/tpsort.cxx new file mode 100644 index 000000000000..3463eff4efab --- /dev/null +++ b/toolkit/workben/layout/tpsort.cxx @@ -0,0 +1,1108 @@ +/************************************************************************* + * + * 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: tpsort.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. + * + ************************************************************************/ + +#if !TEST_LAYOUT +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" +#endif /* !TEST_LAYOUT */ + +#undef SC_DLLIMPLEMENTATION + + + +#include <vcl/msgbox.hxx> +#include <i18npool/mslangid.hxx> +#include <svtools/collatorres.hxx> +#include <unotools/collatorwrapper.hxx> +#include <unotools/localedatawrapper.hxx> +#include <comphelper/processfactory.hxx> + +#include "scitems.hxx" +#include "uiitems.hxx" +#include "viewdata.hxx" +#include "document.hxx" +#include "global.hxx" +#include "dbcolect.hxx" +#include "userlist.hxx" +#include "rangeutl.hxx" +#include "scresid.hxx" +#include "sc.hrc" // -> Slot IDs +#include "globstr.hrc" + +#include "sortdlg.hxx" +#include "sortdlg.hrc" + +#define _TPSORT_CXX +#include "tpsort.hxx" +#undef _TPSORT_CXX + +using namespace com::sun::star; + +// STATIC DATA ----------------------------------------------------------- + +static USHORT pSortRanges[] = +{ + SID_SORT, + SID_SORT, + 0 +}; + +// ----------------------------------------------------------------------- + +/* + * Da sich Einstellungen auf der zweiten TabPage (Optionen) auf + * die erste TabPage auswirken, muss es die Moeglichkeit geben, + * dies der jeweils anderen Seite mitzuteilen. + * + * Im Moment wird dieses Problem ueber zwei Datenmember des TabDialoges + * geloest. Wird eine Seite Aktiviert/Deaktiviert, so gleicht sie diese + * Datenmember mit dem eigenen Zustand ab (->Activate()/Deactivate()). + * + * 31.01.95: + * Die Klasse SfxTabPage bietet mittlerweile ein Verfahren an: + * + * virtual BOOL HasExchangeSupport() const; -> return TRUE; + * virtual void ActivatePage(const SfxItemSet &); + * virtual int DeactivatePage(SfxItemSet * = 0); + * + * muss noch geaendert werden! + */ + +//======================================================================== +//======================================================================== +// Sortierkriterien-Tabpage: + +ScTabPageSortFields::ScTabPageSortFields( Window* pParent, + const SfxItemSet& rArgSet ) + + : SfxTabPage ( pParent, + ScResId( RID_SCPAGE_SORT_FIELDS ), + rArgSet ), + // + aFlSort1 ( this, ScResId( FL_SORT1 ) ), + aLbSort1 ( this, ScResId( LB_SORT1 ) ), + aBtnUp1 ( this, ScResId( BTN_UP1 ) ), + aBtnDown1 ( this, ScResId( BTN_DOWN1 ) ), + // + aFlSort2 ( this, ScResId( FL_SORT2 ) ), + aLbSort2 ( this, ScResId( LB_SORT2 ) ), + aBtnUp2 ( this, ScResId( BTN_UP2 ) ), + aBtnDown2 ( this, ScResId( BTN_DOWN2 ) ), + // + aFlSort3 ( this, ScResId( FL_SORT3 ) ), + aLbSort3 ( this, ScResId( LB_SORT3 ) ), + aBtnUp3 ( this, ScResId( BTN_UP3 ) ), + aBtnDown3 ( this, ScResId( BTN_DOWN3 ) ), + + aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ), + aStrColumn ( ScResId( SCSTR_COLUMN ) ), + aStrRow ( ScResId( SCSTR_ROW ) ), + // +#if !TEST_LAYOUT + nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ), +#else /* TEST_LAYOUT */ + nWhichSort ( 0 ), +#endif /* TEST_LAYOUT */ + pDlg ( (ScSortDlg*)(GetParent()->GetParent()) ), + pViewData ( NULL ), +#if !TEST_LAYOUT + rSortData ( ((const ScSortItem&) + rArgSet.Get( nWhichSort )). + GetSortData() ), +#else /* TEST_LAYOUT */ + rSortData ( *new ScSortParam() ), +#endif /* TEST_LAYOUT */ + nFieldCount ( 0 ), + bHasHeader ( FALSE ), + bSortByRows ( FALSE ) +{ + Init(); + FreeResource(); + SetExchangeSupport(); +} + +// ----------------------------------------------------------------------- + +__EXPORT ScTabPageSortFields::~ScTabPageSortFields() +{ +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortFields::Init() +{ +#if !TEST_LAYOUT + const ScSortItem& rSortItem = (const ScSortItem&) + GetItemSet().Get( nWhichSort ); + + pViewData = rSortItem.GetViewData(); + + DBG_ASSERT( pViewData, "ViewData not found!" ); +#endif /* !TEST_LAYOUT */ + + nFieldArr[0] = 0; + nFirstCol = 0; + nFirstRow = 0; + + aLbSort1.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) ); + aLbSort2.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) ); + aLbSort3.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) ); + aLbSort1.Clear(); + aLbSort2.Clear(); + aLbSort3.Clear(); + + aSortLbArr[0] = &aLbSort1; + aSortLbArr[1] = &aLbSort2; + aSortLbArr[2] = &aLbSort3; + aDirBtnArr[0][0] = &aBtnUp1; + aDirBtnArr[0][1] = &aBtnDown1; + aDirBtnArr[1][0] = &aBtnUp2; + aDirBtnArr[1][1] = &aBtnDown2; + aDirBtnArr[2][0] = &aBtnUp3; + aDirBtnArr[2][1] = &aBtnDown3; + aFlArr[0] = &aFlSort1; + aFlArr[1] = &aFlSort2; + aFlArr[2] = &aFlSort3; +} + +//------------------------------------------------------------------------ + +USHORT* __EXPORT ScTabPageSortFields::GetRanges() +{ + return pSortRanges; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* __EXPORT ScTabPageSortFields::Create( Window* pParent, + const SfxItemSet& rArgSet ) +{ + return ( new ScTabPageSortFields( pParent, rArgSet ) ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) +{ + bSortByRows = rSortData.bByRow; + bHasHeader = rSortData.bHasHeader; + + if ( aLbSort1.GetEntryCount() == 0 ) + FillFieldLists(); + + // Selektieren der ListBoxen: + + if ( rSortData.bDoSort[0] ) + { + for ( USHORT i=0; i<3; i++ ) + { + if ( rSortData.bDoSort[i] ) + { + aSortLbArr[i]->SelectEntryPos( + GetFieldSelPos( rSortData.nField[i] ) ); + + (rSortData.bAscending[i]) + ? aDirBtnArr[i][0]->Check() // Up + : aDirBtnArr[i][1]->Check(); // Down + } + else + { + aSortLbArr[i]->SelectEntryPos( 0 ); // "keiner" selektieren + aDirBtnArr[i][0]->Check(); // Up + } + } + + EnableField( 1 ); + EnableField( 2 ); + EnableField( 3 ); + if ( aLbSort1.GetSelectEntryPos() == 0 ) + DisableField( 2 ); + if ( aLbSort2.GetSelectEntryPos() == 0 ) + DisableField( 3 ); + } + else + { + aLbSort1.SelectEntryPos( 1 ); + aLbSort2.SelectEntryPos( 0 ); + aLbSort3.SelectEntryPos( 0 ); + aBtnUp1.Check(); + aBtnUp2.Check(); + aBtnUp3.Check(); + EnableField ( 1 ); + EnableField ( 2 ); + DisableField( 3 ); + } + + if ( pDlg ) + { + pDlg->SetByRows ( bSortByRows ); + pDlg->SetHeaders( bHasHeader ); + } +} + +// ----------------------------------------------------------------------- + +BOOL __EXPORT ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet ) +{ + ScSortParam theSortData = rSortData; + if (pDlg) + { + const SfxItemSet* pExample = pDlg->GetExampleSet(); + const SfxPoolItem* pItem; + if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET ) + theSortData = ((const ScSortItem*)pItem)->GetSortData(); + } + + USHORT nSort1Pos = aLbSort1.GetSelectEntryPos(); + USHORT nSort2Pos = aLbSort2.GetSelectEntryPos(); + USHORT nSort3Pos = aLbSort3.GetSelectEntryPos(); + + DBG_ASSERT( (nSort1Pos <= SC_MAXFIELDS) + && (nSort2Pos <= SC_MAXFIELDS) + && (nSort3Pos <= SC_MAXFIELDS), + "Array-Range Fehler!" ); + + if ( nSort1Pos == LISTBOX_ENTRY_NOTFOUND ) nSort1Pos = 0; + if ( nSort2Pos == LISTBOX_ENTRY_NOTFOUND ) nSort2Pos = 0; + if ( nSort3Pos == LISTBOX_ENTRY_NOTFOUND ) nSort3Pos = 0; + + if ( nSort1Pos > 0 ) + { + theSortData.bDoSort[0] = (nSort1Pos > 0); + theSortData.bDoSort[1] = (nSort2Pos > 0); + theSortData.bDoSort[2] = (nSort3Pos > 0); + + // wenn auf Optionen-Seite "OK" gewaehlt wurde und + // dabei die Sortierrichtung umgestellt wurde, so + // wird das erste Feld der jeweiligen Richtung als + // Sortierkriterium gewaehlt (steht in nFieldArr[0]): + if ( bSortByRows != pDlg->GetByRows() ) + { + theSortData.nField[0] = + theSortData.nField[1] = + theSortData.nField[2] = ( bSortByRows ? + static_cast<SCCOLROW>(nFirstRow) : + static_cast<SCCOLROW>(nFirstCol) ); + } + else + { + theSortData.nField[0] = nFieldArr[nSort1Pos]; + theSortData.nField[1] = nFieldArr[nSort2Pos]; + theSortData.nField[2] = nFieldArr[nSort3Pos]; + } + + theSortData.bAscending[0] = aBtnUp1.IsChecked(); + theSortData.bAscending[1] = aBtnUp2.IsChecked(); + theSortData.bAscending[2] = aBtnUp3.IsChecked(); + // bHasHeader ist in ScTabPageSortOptions::FillItemSet, wo es hingehoert + } + else + { + theSortData.bDoSort[0] = + theSortData.bDoSort[1] = + theSortData.bDoSort[2] = FALSE; + } + + rArgSet.Put( ScSortItem( SCITEM_SORTDATA, NULL, &theSortData ) ); + + return TRUE; +} + +// ----------------------------------------------------------------------- + +// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !) +// void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet ) + +void __EXPORT ScTabPageSortFields::ActivatePage() +{ + if ( pDlg ) + { + if ( bHasHeader != pDlg->GetHeaders() + || bSortByRows != pDlg->GetByRows() ) + { + USHORT nCurSel1 = aLbSort1.GetSelectEntryPos(); + USHORT nCurSel2 = aLbSort2.GetSelectEntryPos(); + USHORT nCurSel3 = aLbSort3.GetSelectEntryPos(); + + bHasHeader = pDlg->GetHeaders(); + bSortByRows = pDlg->GetByRows(); + FillFieldLists(); + aLbSort1.SelectEntryPos( nCurSel1 ); + aLbSort2.SelectEntryPos( nCurSel2 ); + aLbSort3.SelectEntryPos( nCurSel3 ); + } + } +} + +// ----------------------------------------------------------------------- + +int __EXPORT ScTabPageSortFields::DeactivatePage( SfxItemSet* pSetP ) +{ + if ( pDlg ) + { + if ( bHasHeader != pDlg->GetHeaders() ) + pDlg->SetHeaders( bHasHeader ); + + if ( bSortByRows != pDlg->GetByRows() ) + pDlg->SetByRows( bSortByRows ); + } + + if ( pSetP ) + FillItemSet( *pSetP ); + + return SfxTabPage::LEAVE_PAGE; +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortFields::DisableField( USHORT nField ) +{ + nField--; + + if ( nField<=2 ) + { + aSortLbArr[nField] ->Disable(); + aDirBtnArr[nField][0]->Disable(); + aDirBtnArr[nField][1]->Disable(); + aFlArr[nField] ->Disable(); + } +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortFields::EnableField( USHORT nField ) +{ + nField--; + + if ( nField<=2 ) + { + aSortLbArr[nField] ->Enable(); + aDirBtnArr[nField][0]->Enable(); + aDirBtnArr[nField][1]->Enable(); + aFlArr[nField] ->Enable(); + } +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortFields::FillFieldLists() +{ + if ( pViewData ) + { + ScDocument* pDoc = pViewData->GetDocument(); + + if ( pDoc ) + { + aLbSort1.Clear(); + aLbSort2.Clear(); + aLbSort3.Clear(); + aLbSort1.InsertEntry( aStrUndefined, 0 ); + aLbSort2.InsertEntry( aStrUndefined, 0 ); + aLbSort3.InsertEntry( aStrUndefined, 0 ); + + SCCOL nFirstSortCol = rSortData.nCol1; + SCROW nFirstSortRow = rSortData.nRow1; + SCTAB nTab = pViewData->GetTabNo(); + USHORT i = 1; + + if ( bSortByRows ) + { + String aFieldName; + SCCOL nMaxCol = rSortData.nCol2; + SCCOL col; + + for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ ) + { + pDoc->GetString( col, nFirstSortRow, nTab, aFieldName ); + if ( !bHasHeader || (aFieldName.Len() == 0) ) + { + aFieldName = aStrColumn; + aFieldName += ' '; + aFieldName += ColToAlpha( col ); + } + nFieldArr[i] = col; + aLbSort1.InsertEntry( aFieldName, i ); + aLbSort2.InsertEntry( aFieldName, i ); + aLbSort3.InsertEntry( aFieldName, i ); + i++; + } + } + else + { + String aFieldName; + SCROW nMaxRow = rSortData.nRow2; + SCROW row; + + for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ ) + { + pDoc->GetString( nFirstSortCol, row, nTab, aFieldName ); + if ( !bHasHeader || (aFieldName.Len() == 0) ) + { + aFieldName = aStrRow; + aFieldName += ' '; + aFieldName += String::CreateFromInt32( row+1 ); + } + nFieldArr[i] = row; + aLbSort1.InsertEntry( aFieldName, i ); + aLbSort2.InsertEntry( aFieldName, i ); + aLbSort3.InsertEntry( aFieldName, i ); + i++; + } + } + nFieldCount = i; + } + } +} + +//------------------------------------------------------------------------ + +USHORT ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField ) +{ + USHORT nFieldPos = 0; + BOOL bFound = FALSE; + + for ( USHORT n=1; n<nFieldCount && !bFound; n++ ) + { + if ( nFieldArr[n] == nField ) + { + nFieldPos = n; + bFound = TRUE; + } + } + + return nFieldPos; +} + +// ----------------------------------------------------------------------- +// Handler: +//--------- + +IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) +{ + String aSelEntry = pLb->GetSelectEntry(); + + if ( pLb == &aLbSort1 ) + { + if ( aSelEntry == aStrUndefined ) + { + aLbSort2.SelectEntryPos( 0 ); + aLbSort3.SelectEntryPos( 0 ); + + if ( aFlSort2.IsEnabled() ) + DisableField( 2 ); + + if ( aFlSort3.IsEnabled() ) + DisableField( 3 ); + } + else + { + if ( !aFlSort2.IsEnabled() ) + EnableField( 2 ); + } + } + else if ( pLb == &aLbSort2 ) + { + if ( aSelEntry == aStrUndefined ) + { + aLbSort3.SelectEntryPos( 0 ); + if ( aFlSort3.IsEnabled() ) + DisableField( 3 ); + } + else + { + if ( !aFlSort3.IsEnabled() ) + EnableField( 3 ); + } + } + return 0; +} + +//======================================================================== +// Sortieroptionen-Tabpage: +//======================================================================== + +#include <layout/layout-pre.hxx> + +#if ENABLE_LAYOUT +#undef ScResId +#define ScResId(x) #x +#undef SfxTabPage +#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args ) +#endif /* ENABLE_LAYOUT */ + +ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent, + const SfxItemSet& rArgSet ) + + : SfxTabPage ( pParent, + ScResId( RID_SCPAGE_SORT_OPTIONS ), + rArgSet ), + // + aBtnCase ( this, ScResId( BTN_CASESENSITIVE ) ), + aBtnHeader ( this, ScResId( BTN_LABEL ) ), + aBtnFormats ( this, ScResId( BTN_FORMATS ) ), + aBtnCopyResult ( this, ScResId( BTN_COPYRESULT ) ), + aBtnNaturalSort ( this, ScResId( BTN_NATURALSORT ) ), + aLbOutPos ( this, ScResId( LB_OUTAREA ) ), + aEdOutPos ( this, ScResId( ED_OUTAREA ) ), + aBtnSortUser ( this, ScResId( BTN_SORT_USER ) ), + aLbSortUser ( this, ScResId( LB_SORT_USER ) ), + aFtLanguage ( this, ScResId( FT_LANGUAGE ) ), + aLbLanguage ( this, ScResId( LB_LANGUAGE ) ), + aFtAlgorithm ( this, ScResId( FT_ALGORITHM ) ), + aLbAlgorithm ( this, ScResId( LB_ALGORITHM ) ), + aLineDirection ( this, ScResId( FL_DIRECTION ) ), + aBtnTopDown ( this, ScResId( BTN_TOP_DOWN ) ), + aBtnLeftRight ( this, ScResId( BTN_LEFT_RIGHT ) ), +// aFtAreaLabel ( this, ScResId( FT_AREA_LABEL ) ), +// aFtArea ( this, ScResId( FT_AREA ) ), + // +#if ENABLE_LAYOUT +#undef this +#undef ScResId +#define ScResId(x) this, #x +#endif /* ENABLE_LAYOUT */ + aStrRowLabel ( ScResId( STR_ROW_LABEL ) ), + aStrColLabel ( ScResId( STR_COL_LABEL ) ), + aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ), + aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ), + // +#if !TEST_LAYOUT + nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ), + rSortData ( ((const ScSortItem&) + rArgSet.Get( nWhichSort )).GetSortData() ), +#else /* TEST_LAYOUT */ + nWhichSort ( 0 ), + rSortData ( *new ScSortParam() ), +#endif /* TEST_LAYOUT */ + pViewData ( NULL ), + pDoc ( NULL ), + pDlg ( (ScSortDlg*)(GetParent() ? GetParent()->GetParent() : 0 ) ), + pColRes ( NULL ), + pColWrap ( NULL ) +{ +#if TEST_LAYOUT + (void) rArgSet; +#endif /* TEST_LAYOUT */ + Init(); + FreeResource(); + SetExchangeSupport(); +} + +// ----------------------------------------------------------------------- + +__EXPORT ScTabPageSortOptions::~ScTabPageSortOptions() +{ +#if !TEST_LAYOUT + USHORT nEntries = aLbOutPos.GetEntryCount(); + + for ( USHORT i=1; i<nEntries; i++ ) + delete (String*)aLbOutPos.GetEntryData( i ); +#endif /* !TEST_LAYOUT */ + + delete pColRes; + delete pColWrap; //! not if from document +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortOptions::Init() +{ +// aStrAreaLabel = aFtAreaLabel.GetText(); +// aStrAreaLabel.Append( (sal_Unicode) ' ' ); + + // CollatorRessource has user-visible names for sort algorithms + pColRes = new CollatorRessource(); + + //! use CollatorWrapper from document? + pColWrap = new CollatorWrapper( comphelper::getProcessServiceFactory() ); + +#if !TEST_LAYOUT + const ScSortItem& rSortItem = (const ScSortItem&) + GetItemSet().Get( nWhichSort ); +#endif /* !TEST_LAYOUT */ + + aLbOutPos.SetSelectHdl ( LINK( this, ScTabPageSortOptions, SelOutPosHdl ) ); + aBtnCopyResult.SetClickHdl( LINK( this, ScTabPageSortOptions, EnableHdl ) ); + aBtnSortUser.SetClickHdl ( LINK( this, ScTabPageSortOptions, EnableHdl ) ); + aBtnTopDown.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) ); + aBtnLeftRight.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) ); + aLbLanguage.SetSelectHdl ( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) ); + +#if !TEST_LAYOUT + pViewData = rSortItem.GetViewData(); +#endif /* TEST_LAYOUT */ + pDoc = pViewData ? pViewData->GetDocument() : NULL; + + DBG_ASSERT( pViewData, "ViewData not found! :-/" ); + +#if !TEST_LAYOUT + if ( pViewData && pDoc ) + { + String theArea; + ScDBCollection* pDBColl = pDoc->GetDBCollection(); + String theDbArea; + String theDbName = aStrNoName; + const SCTAB nCurTab = pViewData->GetTabNo(); + const ScAddress::Convention eConv = pDoc->GetAddressConvention(); +#endif /* !TEST_LAYOUT */ + + aLbOutPos.Clear(); + aLbOutPos.InsertEntry( aStrUndefined, 0 ); + aLbOutPos.Disable(); + +#if !TEST_LAYOUT + ScAreaNameIterator aIter( pDoc ); + String aName; + ScRange aRange; + String aRefStr; + while ( aIter.Next( aName, aRange ) ) + { + USHORT nInsert = aLbOutPos.InsertEntry( aName ); + + aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv ); + aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) ); + } +#endif /* !TEST_LAYOUT */ + + aLbOutPos.SelectEntryPos( 0 ); + aEdOutPos.SetText( EMPTY_STRING ); + +#if !TEST_LAYOUT + /* + * Ueberpruefen, ob es sich bei dem uebergebenen + * Bereich um einen Datenbankbereich handelt: + */ + + ScAddress aScAddress( rSortData.nCol1, rSortData.nRow1, nCurTab ); + ScRange( aScAddress, + ScAddress( rSortData.nCol2, rSortData.nRow2, nCurTab ) + ).Format( theArea, SCR_ABS, pDoc, eConv ); + + if ( pDBColl ) + { + ScDBData* pDBData + = pDBColl->GetDBAtArea( nCurTab, + rSortData.nCol1, rSortData.nRow1, + rSortData.nCol2, rSortData.nRow2 ); + if ( pDBData ) + { + pDBData->GetName( theDbName ); + aBtnHeader.Check( pDBData->HasHeader() ); + } + } + + theArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" (")); + theArea += theDbName; + theArea += ')'; + + //aFtArea.SetText( theArea ); + //theArea.Insert( aStrAreaLabel, 0 ); + //aFtAreaLabel.SetText( theArea ); + + aBtnHeader.SetText( aStrColLabel ); + } +#endif /* TEST_LAYOUT */ + + FillUserSortListBox(); + + // get available languages + + aLbLanguage.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE ); + aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM ); +} + +//------------------------------------------------------------------------ + +USHORT* __EXPORT ScTabPageSortOptions::GetRanges() +{ + return pSortRanges; +} + +// ----------------------------------------------------------------------- + +#if ENABLE_LAYOUT +#undef SfxTabPage +#endif /* ENABLE_LAYOUT */ +SfxTabPage* __EXPORT ScTabPageSortOptions::Create( + Window* pParent, + const SfxItemSet& rArgSet ) +{ + return ( new ScTabPageSortOptions( pParent, rArgSet ) ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ ) +{ + if ( rSortData.bUserDef ) + { + aBtnSortUser.Check( TRUE ); + aLbSortUser.Enable(); + aLbSortUser.SelectEntryPos( rSortData.nUserIndex ); + } + else + { + aBtnSortUser.Check( FALSE ); + aLbSortUser.Disable(); + aLbSortUser.SelectEntryPos( 0 ); + } + + aBtnCase.Check ( rSortData.bCaseSens ); + aBtnFormats.Check ( rSortData.bIncludePattern ); + aBtnHeader.Check ( rSortData.bHasHeader ); + aBtnNaturalSort.Check ( rSortData.bNaturalSort ); + + if ( rSortData.bByRow ) + { + aBtnTopDown.Check(); + aBtnHeader.SetText( aStrColLabel ); + } + else + { + aBtnLeftRight.Check(); + aBtnHeader.SetText( aStrRowLabel ); + } + + LanguageType eLang = MsLangId::convertLocaleToLanguage( rSortData.aCollatorLocale ); + if ( eLang == LANGUAGE_DONTKNOW ) + eLang = LANGUAGE_SYSTEM; + aLbLanguage.SelectLanguage( eLang ); + FillAlgorHdl( &aLbLanguage ); // get algorithms, select default + if ( rSortData.aCollatorAlgorithm.Len() ) + aLbAlgorithm.SelectEntry( pColRes->GetTranslation( rSortData.aCollatorAlgorithm ) ); + + if ( pDoc && !rSortData.bInplace ) + { + String aStr; + USHORT nFormat = (rSortData.nDestTab != pViewData->GetTabNo()) + ? SCR_ABS_3D + : SCR_ABS; + + theOutPos.Set( rSortData.nDestCol, + rSortData.nDestRow, + rSortData.nDestTab ); + + theOutPos.Format( aStr, nFormat, pDoc, pDoc->GetAddressConvention() ); + aBtnCopyResult.Check(); + aLbOutPos.Enable(); + aEdOutPos.Enable(); + aEdOutPos.SetText( aStr ); + EdOutPosModHdl( &aEdOutPos ); + aEdOutPos.GrabFocus(); + aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) ); + } + else + { + aBtnCopyResult.Check( FALSE ); + aLbOutPos.Disable(); + aEdOutPos.Disable(); + aEdOutPos.SetText( EMPTY_STRING ); + } +} + +// ----------------------------------------------------------------------- + +BOOL __EXPORT ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet ) +{ + ScSortParam theSortData = rSortData; + if (pDlg) + { + const SfxItemSet* pExample = pDlg->GetExampleSet(); + const SfxPoolItem* pItem; + if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET ) + theSortData = ((const ScSortItem*)pItem)->GetSortData(); + } + + theSortData.bByRow = aBtnTopDown.IsChecked(); + theSortData.bHasHeader = aBtnHeader.IsChecked(); + theSortData.bCaseSens = aBtnCase.IsChecked(); + theSortData.bNaturalSort = aBtnNaturalSort.IsChecked(); + theSortData.bIncludePattern = aBtnFormats.IsChecked(); + theSortData.bInplace = !aBtnCopyResult.IsChecked(); + theSortData.nDestCol = theOutPos.Col(); + theSortData.nDestRow = theOutPos.Row(); + theSortData.nDestTab = theOutPos.Tab(); + theSortData.bUserDef = aBtnSortUser.IsChecked(); + theSortData.nUserIndex = (aBtnSortUser.IsChecked()) + ? aLbSortUser.GetSelectEntryPos() + : 0; + + // get locale + LanguageType eLang = aLbLanguage.GetSelectLanguage(); + theSortData.aCollatorLocale = MsLangId::convertLanguageToLocale( eLang, false ); + + // get algorithm + String sAlg; + if ( eLang != LANGUAGE_SYSTEM ) + { + uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms( + theSortData.aCollatorLocale ); + USHORT nSel = aLbAlgorithm.GetSelectEntryPos(); + if ( nSel < aAlgos.getLength() ) + sAlg = aAlgos[nSel]; + } + theSortData.aCollatorAlgorithm = sAlg; + +#if !TEST_LAYOUT + rArgSet.Put( ScSortItem( SCITEM_SORTDATA, &theSortData ) ); +#endif /* TEST_LAYOUT */ + return TRUE; +} + +// ----------------------------------------------------------------------- + +// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !) +// void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet ) +void __EXPORT ScTabPageSortOptions::ActivatePage() +{ + if ( pDlg ) + { + if ( aBtnHeader.IsChecked() != pDlg->GetHeaders() ) + { + aBtnHeader.Check( pDlg->GetHeaders() ); + } + + if ( aBtnTopDown.IsChecked() != pDlg->GetByRows() ) + { + aBtnTopDown.Check( pDlg->GetByRows() ); + aBtnLeftRight.Check( !pDlg->GetByRows() ); + } + + aBtnHeader.SetText( (pDlg->GetByRows()) + ? aStrColLabel + : aStrRowLabel ); + } +} + +// ----------------------------------------------------------------------- + +int __EXPORT ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP ) +{ + BOOL bPosInputOk = TRUE; + + if ( aBtnCopyResult.IsChecked() ) + { + String thePosStr = aEdOutPos.GetText(); + ScAddress thePos; + xub_StrLen nColonPos = thePosStr.Search( ':' ); + + if ( STRING_NOTFOUND != nColonPos ) + thePosStr.Erase( nColonPos ); + + if ( pViewData ) + { + // visible table is default for input without table + // must be changed to GetRefTabNo when sorting has RefInput! + thePos.SetTab( pViewData->GetTabNo() ); + } + + USHORT nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() ); + + bPosInputOk = ( SCA_VALID == (nResult & SCA_VALID) ); + + if ( !bPosInputOk ) + { +#if !ENABLE_LAYOUT + ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ), + ScGlobal::GetRscString( STR_INVALID_TABREF ) + ).Execute(); +#endif /* ENABLE_LAYOUT */ + aEdOutPos.GrabFocus(); + aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) ); + theOutPos.Set(0,0,0); + } + else + { + aEdOutPos.SetText( thePosStr ); + theOutPos = thePos; + } + } + + if ( pDlg && bPosInputOk ) + { + pDlg->SetHeaders( aBtnHeader.IsChecked() ); + pDlg->SetByRows ( aBtnTopDown.IsChecked() ); + } + + if ( pSetP && bPosInputOk ) + FillItemSet( *pSetP ); + + return bPosInputOk ? SfxTabPage::LEAVE_PAGE : SfxTabPage::KEEP_PAGE; +} + +// ----------------------------------------------------------------------- + +void ScTabPageSortOptions::FillUserSortListBox() +{ + ScUserList* pUserLists = ScGlobal::GetUserList(); + + aLbSortUser.Clear(); + if ( pUserLists ) + { + USHORT nCount = pUserLists->GetCount(); + if ( nCount > 0 ) + for ( USHORT i=0; i<nCount; i++ ) + aLbSortUser.InsertEntry( (*pUserLists)[i]->GetString() ); + } +} + +// ----------------------------------------------------------------------- +// Handler: + +IMPL_LINK( ScTabPageSortOptions, EnableHdl, CheckBox *, pBox ) +{ + if ( pBox == &aBtnCopyResult ) + { + if ( pBox->IsChecked() ) + { + aLbOutPos.Enable(); + aEdOutPos.Enable(); + aEdOutPos.GrabFocus(); + } + else + { + aLbOutPos.Disable(); + aEdOutPos.Disable(); + } + } + else if ( pBox == &aBtnSortUser ) + { + if ( pBox->IsChecked() ) + { + aLbSortUser.Enable(); + aLbSortUser.GrabFocus(); + } + else + aLbSortUser.Disable(); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( ScTabPageSortOptions, SelOutPosHdl, ListBox *, pLb ) +{ + if ( pLb == &aLbOutPos ) + { + String aString; + USHORT nSelPos = aLbOutPos.GetSelectEntryPos(); + + if ( nSelPos > 0 ) + aString = *(String*)aLbOutPos.GetEntryData( nSelPos ); + + aEdOutPos.SetText( aString ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( ScTabPageSortOptions, SortDirHdl, RadioButton *, pBtn ) +{ + if ( pBtn == &aBtnTopDown ) + { + aBtnHeader.SetText( aStrColLabel ); + } + else if ( pBtn == &aBtnLeftRight ) + { + aBtnHeader.SetText( aStrRowLabel ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd ) +{ + if ( pEd == &aEdOutPos ) + { + String theCurPosStr = aEdOutPos.GetText(); + USHORT nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() ); + + if ( SCA_VALID == (nResult & SCA_VALID) ) + { + String* pStr = NULL; + BOOL bFound = FALSE; + USHORT i = 0; + USHORT nCount = aLbOutPos.GetEntryCount(); + + for ( i=2; i<nCount && !bFound; i++ ) + { + pStr = (String*)aLbOutPos.GetEntryData( i ); + bFound = (theCurPosStr == *pStr); + } + + if ( bFound ) + aLbOutPos.SelectEntryPos( --i ); + else + aLbOutPos.SelectEntryPos( 0 ); + } + } +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( ScTabPageSortOptions, FillAlgorHdl, void *, EMPTYARG ) +{ + aLbAlgorithm.SetUpdateMode( FALSE ); + aLbAlgorithm.Clear(); + + LanguageType eLang = aLbLanguage.GetSelectLanguage(); + if ( eLang == LANGUAGE_SYSTEM ) + { + // for LANGUAGE_SYSTEM no algorithm can be selected because + // it wouldn't necessarily exist for other languages + // -> leave list box empty if LANGUAGE_SYSTEM is selected + aFtAlgorithm.Enable( FALSE ); // nothing to select + aLbAlgorithm.Enable( FALSE ); // nothing to select + } + else + { + lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang )); + uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms( aLocale ); + + long nCount = aAlgos.getLength(); + const rtl::OUString* pArray = aAlgos.getConstArray(); + for (long i=0; i<nCount; i++) + { + String sAlg = pArray[i]; + String sUser = pColRes->GetTranslation( sAlg ); + aLbAlgorithm.InsertEntry( sUser, LISTBOX_APPEND ); + } + aLbAlgorithm.SelectEntryPos( 0 ); // first entry is default + aFtAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice + aLbAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice + } + + aLbAlgorithm.SetUpdateMode( TRUE ); + return 0; +} + + diff --git a/toolkit/workben/layout/tpsort.hxx b/toolkit/workben/layout/tpsort.hxx new file mode 100644 index 000000000000..bb8b30e396df --- /dev/null +++ b/toolkit/workben/layout/tpsort.hxx @@ -0,0 +1,220 @@ +/************************************************************************* + * + * 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: tpsort.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_TPSORT_HXX +#define SC_TPSORT_HXX + + +#include <sfx2/tabdlg.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <svtools/stdctrl.hxx> +#include <svx/langbox.hxx> + + +#include "global.hxx" +#include "address.hxx" + +//------------------------------------------------------------------------ + +// +1 because one field is reserved for the "- undefined -" entry +#define SC_MAXFIELDS MAXCOLCOUNT+1 + +class ScViewData; +class ScSortDlg; +struct ScSortParam; + +//======================================================================== +// Kriterien (Sort Criteria) + +class ScTabPageSortFields : public SfxTabPage +{ +public: + ScTabPageSortFields( Window* pParent, + const SfxItemSet& rArgSet ); + ~ScTabPageSortFields(); + + static SfxTabPage* Create ( Window* pParent, + const SfxItemSet& rArgSet ); + static USHORT* GetRanges (); + virtual BOOL FillItemSet ( SfxItemSet& rArgSet ); + virtual void Reset ( const SfxItemSet& rArgSet ); + +protected: +// fuer Datenaustausch (sollte noch umgestellt werden!) +// virtual void ActivatePage ( const SfxItemSet& rSet ); + using SfxTabPage::ActivatePage; + using SfxTabPage::DeactivatePage; + virtual void ActivatePage (); + virtual int DeactivatePage ( SfxItemSet* pSet = 0); + +private: + FixedLine aFlSort1; + ListBox aLbSort1; + RadioButton aBtnUp1; + RadioButton aBtnDown1; + + FixedLine aFlSort2; + ListBox aLbSort2; + RadioButton aBtnUp2; + RadioButton aBtnDown2; + + FixedLine aFlSort3; + ListBox aLbSort3; + RadioButton aBtnUp3; + RadioButton aBtnDown3; + + String aStrUndefined; + String aStrColumn; + String aStrRow; + + const USHORT nWhichSort; + ScSortDlg* pDlg; + ScViewData* pViewData; + const ScSortParam& rSortData; + SCCOLROW nFieldArr[SC_MAXFIELDS]; + USHORT nFieldCount; + SCCOL nFirstCol; + SCROW nFirstRow; + BOOL bHasHeader; + BOOL bSortByRows; + + ListBox* aSortLbArr[3]; + RadioButton* aDirBtnArr[3][2]; + FixedLine* aFlArr[3]; + +#ifdef _TPSORT_CXX +private: + void Init (); + void DisableField ( USHORT nField ); + void EnableField ( USHORT nField ); + void FillFieldLists (); + USHORT GetFieldSelPos ( SCCOLROW nField ); + + // Handler ------------------------ + DECL_LINK( SelectHdl, ListBox * ); +#endif +}; + +//======================================================================== +// Sortieroptionen (Sort Options) + +class ScDocument; +class ScRangeData; +class CollatorRessource; +class CollatorWrapper; + +#include <sfx2/layout.hxx> +#include <layout/layout-pre.hxx> + +class ScTabPageSortOptions : public SfxTabPage +{ +public: + ScTabPageSortOptions( Window* pParent, + const SfxItemSet& rArgSet ); + ~ScTabPageSortOptions(); + +#undef SfxTabPage +#define SfxTabPage ::SfxTabPage + static SfxTabPage* Create ( Window* pParent, + const SfxItemSet& rArgSet ); + static USHORT* GetRanges (); + virtual BOOL FillItemSet ( SfxItemSet& rArgSet ); + virtual void Reset ( const SfxItemSet& rArgSet ); + +protected: +// fuer Datenaustausch (sollte noch umgestellt werden!) +// virtual void ActivatePage ( const SfxItemSet& rSet ); + using SfxTabPage::ActivatePage; + using SfxTabPage::DeactivatePage; + virtual void ActivatePage (); + virtual int DeactivatePage ( SfxItemSet* pSet = 0); + +private: + + CheckBox aBtnCase; + CheckBox aBtnHeader; + CheckBox aBtnFormats; + CheckBox aBtnCopyResult; + + CheckBox aBtnNaturalSort; + ListBox aLbOutPos; + Edit aEdOutPos; + + CheckBox aBtnSortUser; + ListBox aLbSortUser; + + FixedText aFtLanguage; + SvxLanguageBox aLbLanguage; + FixedText aFtAlgorithm; + ListBox aLbAlgorithm; + + FixedLine aLineDirection; + RadioButton aBtnTopDown; + RadioButton aBtnLeftRight; + +// FixedText aFtAreaLabel; +// FixedInfo aFtArea; + LocalizedString aStrRowLabel; + LocalizedString aStrColLabel; + LocalizedString aStrUndefined; + String aStrNoName; + String aStrAreaLabel; + + const USHORT nWhichSort; + const ScSortParam& rSortData; + ScViewData* pViewData; + ScDocument* pDoc; + ScSortDlg* pDlg; + ScAddress theOutPos; + + CollatorRessource* pColRes; + CollatorWrapper* pColWrap; + +#ifdef _TPSORT_CXX +private: + void Init (); + void FillUserSortListBox (); + void FillOutPosList (); + + // Handler ------------------------ + DECL_LINK( EnableHdl, CheckBox * ); + DECL_LINK( SelOutPosHdl, ListBox * ); + void EdOutPosModHdl ( Edit* pEd ); + DECL_LINK( SortDirHdl, RadioButton * ); + DECL_LINK( FillAlgorHdl, void * ); +#endif +}; + +#include <layout/layout-post.hxx> + +#endif // SC_TPSORT_HXX + diff --git a/toolkit/workben/layout/uno.hxx b/toolkit/workben/layout/uno.hxx index 890341deccdf..a449429338fc 100644 --- a/toolkit/workben/layout/uno.hxx +++ b/toolkit/workben/layout/uno.hxx @@ -32,13 +32,13 @@ #ifndef _LAYOUT_UNO_HXX #define _LAYOUT_UNO_HXX -#include <stdio.h> +#include <cstdio> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include "root.hxx" -#include "factory.hxx" +#include <layout/core/root.hxx> +#include <layout/core/factory.hxx> #if LAYOUT_WEAK #include <cppuhelper/implbase1.hxx> diff --git a/toolkit/workben/layout/wordcount-plain.xml b/toolkit/workben/layout/wordcount-plain.xml index cf31a7614840..a7c34fe5a16f 100644 --- a/toolkit/workben/layout/wordcount-plain.xml +++ b/toolkit/workben/layout/wordcount-plain.xml @@ -22,7 +22,7 @@ </hbox> <fixedline height="8" id="FL_BOTTOM" width="158" x="6" y="77"/> <hbox> - <okbutton def-button="true" height="14" id="PB_OK" width="50" x="61" y="88"/> + <okbutton defbutton="true" height="14" id="PB_OK" width="50" x="61" y="88"/> <helpbutton height="14" id="PB_HELP" width="50" x="114" y="88"/> </hbox> </vbox> diff --git a/toolkit/workben/layout/wordcount-tight.xml b/toolkit/workben/layout/wordcount-tight.xml index 009113f6cdcf..a9f6a7a09393 100644 --- a/toolkit/workben/layout/wordcount-tight.xml +++ b/toolkit/workben/layout/wordcount-tight.xml @@ -28,7 +28,7 @@ <fixedline cnt:padding="1" id="FL_BOTTOM"/> <hbox border="5"> <flow homogeneous="true"/> - <okbutton id="PB_OK" cnt:expand="false" default="true"/> + <okbutton id="PB_OK" cnt:expand="false" defbutton="true"/> <helpbutton id="PB_HELP" cnt:expand="false"/> </hbox> </vbox> diff --git a/toolkit/workben/layout/wordcount.xml b/toolkit/workben/layout/wordcount.xml index c8f8092e3698..fa9d44f896ad 100644 --- a/toolkit/workben/layout/wordcount.xml +++ b/toolkit/workben/layout/wordcount.xml @@ -7,12 +7,12 @@ xmlns:cnt="http://openoffice.org/2007/layout/container" help-id="HID_DLG_WORDCOUNT" id="DLG_WORDCOUNT" - sizeable="true" moveable="true" optimumsize="true" + sizeable="true" moveable="true" optimumsize="true" closeable="true" has_border="true" sv-look="true" _title="Word Count"> - <vbox border="5" spacing="5"> + <vbox border="12" spacing="6"> <fixedline id="FL_CURRENT" _text="Current selection"/> <hbox> - <vbox cnt:padding="13" spacing="5"> + <vbox cnt:padding="12" spacing="6"> <hbox> <fixedtext id="FT_CURRENTWORD" _label="Words:"/> <flow cnt:padding="60"/> @@ -25,11 +25,11 @@ </hbox> </vbox> </hbox> - <!-- if we could do cnt:cnt:padding="-13" here, we would not have to close - and reope the hbox/vbox thing !--> + <!-- if we could do cnt:cnt:padding="-12" here, we would not have to close + and reopen the hbox/vbox thing !--> <fixedline id="FL_DOC" _text="Whole document"/> <hbox> - <vbox cnt:padding="13" spacing="5"> + <vbox cnt:padding="12" spacing="6"> <hbox> <fixedtext id="FT_DOCWORD" _label="Words:"/> <fixedtext id="FI_DOCWORD" right="true" _label="000"/> @@ -41,9 +41,9 @@ </vbox> </hbox> <fixedline cnt:padding="1" id="FL_BOTTOM"/> - <dialogbuttonhbox spacing="5"> + <dialogbuttonhbox spacing="12"> <flow/> - <okbutton id="PB_OK"/> + <okbutton defbutton="true" id="PB_OK"/> <helpbutton id="PB_HELP"/> </dialogbuttonhbox> </vbox> diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx index 87bca710aabf..49aa2f9ae7a7 100644 --- a/toolkit/workben/layout/wordcountdialog.cxx +++ b/toolkit/workben/layout/wordcountdialog.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: wordcountdialog.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.10 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,15 @@ #include <wordcountdialog.hrc> #endif /* !TEST_LAYOUT */ +#if ENABLE_LAYOUT +#undef SW_RES +#define SW_RES(x) #x +#undef SfxModalDialog +#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id ) +#define SW_WORDCOUNTDIALOG_HRC +#include <helpid.h> +#endif /* ENABLE_LAYOUT */ + /*-- 06.04.2004 16:05:55--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -73,6 +82,9 @@ SwWordCountDialog::SwWordCountDialog(Window* pParent) : #pragma warning (default : 4355) #endif { +#if ENABLE_LAYOUT + SetHelpId (HID_DLG_WORDCOUNT); +#endif /* ENABLE_LAYOUT */ FreeResource(); } /*-- 06.04.2004 16:05:56--------------------------------------------------- @@ -84,17 +96,12 @@ SwWordCountDialog::~SwWordCountDialog() /*-- 06.04.2004 16:05:57--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwWordCountDialog::SetValues(const SwDocStat& -#if !TEST_LAYOUT - rCurrent, -#endif - , const SwDocStat& -#if !TEST_LAYOUT - rDoc -#endif - ) +void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) { -#if !TEST_LAYOUT +#if TEST_LAYOUT + (void) rCurrent; + (void) rDoc; +#else /* !TEST_LAYOUT */ aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord )); aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar )); aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord )); diff --git a/toolkit/workben/layout/wordcountdialog.hxx b/toolkit/workben/layout/wordcountdialog.hxx index 50c43459d12d..b19b3cca8c94 100644 --- a/toolkit/workben/layout/wordcountdialog.hxx +++ b/toolkit/workben/layout/wordcountdialog.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: wordcountdialog.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.5 $ * * This file is part of OpenOffice.org. * diff --git a/toolkit/workben/layout/zoom-indent.xml b/toolkit/workben/layout/zoom-indent.xml index 7389780a3a9d..bd5853acdce4 100644 --- a/toolkit/workben/layout/zoom-indent.xml +++ b/toolkit/workben/layout/zoom-indent.xml @@ -33,7 +33,7 @@ </hbox> </vbox> <vbox border="6" spacing="4"> - <okbutton id="OkButton" cnt:expand="false" default="true"/> + <okbutton id="OkButton" cnt:expand="false" defbutton="true"/> <cancelbutton id="CancelButton" cnt:expand="false"/> <helpbutton id="HelpButton" cnt:expand="false"/> </vbox> diff --git a/toolkit/workben/layout/zoom-plain.xml b/toolkit/workben/layout/zoom-plain.xml index 30b72a3e564f..c8383b8767a7 100644 --- a/toolkit/workben/layout/zoom-plain.xml +++ b/toolkit/workben/layout/zoom-plain.xml @@ -3,7 +3,7 @@ <modaldialog sizeable="true" height="142" help-id="SID_ATTR_ZOOM" moveable="true" output-size="true" id="RID_SVXDLG_ZOOM" sv-look="true" text="Zoom" width="160" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> <vbox> <fixedline height="8" id="FL_ZOOM" text="Zoom factor" width="92" x="6" y="3"/> - <okbutton def-button="true" height="14" id="BTN_ZOOM_OK" width="50" x="104" y="6"/> + <okbutton defbutton="true" height="14" id="BTN_ZOOM_OK" width="50" x="104" y="6"/> <radiobutton height="10" id="BTN_WHOLE_PAGE" width="80" x="12" y="14"/> <cancelbutton height="14" id="BTN_ZOOM_CANCEL" width="50" x="104" y="23"/> <radiobutton height="10" id="BTN_PAGE_WIDTH" width="80" x="12" y="27"/> diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx index 6717f831b509..39fcb5e94401 100644 --- a/toolkit/workben/layout/zoom.cxx +++ b/toolkit/workben/layout/zoom.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zoom.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.12 $ * * This file is part of OpenOffice.org. * @@ -51,9 +51,9 @@ #define _SVX_ZOOM_CXX #include <svx/dialogs.hrc> -#if !ENABLE_LAYOUT +#if !TEST_LAYOUT #include "zoom.hrc" -#endif /* !ENABLE_LAYOUT */ +#endif /* !TEST_LAYOUT */ #include "zoom.hxx" #if TEST_LAYOUT @@ -114,6 +114,13 @@ struct SvxViewLayoutItem : public LAYOUT_SfxPoolItem #include <layout/layout-pre.hxx> +#if ENABLE_LAYOUT +#undef SVX_RES +#define SVX_RES(x) #x +#undef SfxModalDialog +#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id ) +#endif /* ENABLE_LAYOUT */ + // static ---------------------------------------------------------------- static USHORT pRanges[] = @@ -284,6 +291,9 @@ SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) : bModified ( FALSE ) { +#if ENABLE_LAYOUT + SetHelpId (SID_ATTR_ZOOM); +#endif /* ENABLE_LAYOUT */ Link aLink = LINK( this, SvxZoomDialog, UserHdl ); a100Btn.SetClickHdl( aLink ); aOptimalBtn.SetClickHdl( aLink ); diff --git a/toolkit/workben/layout/zoom.hrc b/toolkit/workben/layout/zoom.hrc new file mode 100644 index 000000000000..3f0f979bd4ae --- /dev/null +++ b/toolkit/workben/layout/zoom.hrc @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zoom.hrc,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: kz $ $Date: 2008/03/07 15:16:57 $ + * + * 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 _SVX_ZOOM_HRC +#define _SVX_ZOOM_HRC + +// defines ------------------------------------------------------------------ + +#define FL_ZOOM 14 +#define BTN_OPTIMAL 15 +#define BTN_WHOLE_PAGE 16 +#define BTN_PAGE_WIDTH 17 +#define BTN_100 18 +#define BTN_USER 19 +#define ED_USER 20 + +#define FL_VIEWLAYOUT 21 +#define BTN_AUTOMATIC 22 +#define BTN_SINGLE 23 +#define BTN_COLUMNS 24 +#define ED_COLUMNS 25 +#define CHK_BOOK 26 + +#define FL_BOTTOM 27 +#define BTN_ZOOM_OK 28 +#define BTN_ZOOM_CANCEL 29 +#define BTN_ZOOM_HELP 30 + +#endif + diff --git a/toolkit/workben/layout/zoom.hxx b/toolkit/workben/layout/zoom.hxx index b865a9b8fc9e..f16e08d558aa 100644 --- a/toolkit/workben/layout/zoom.hxx +++ b/toolkit/workben/layout/zoom.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zoom.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.6 $ * * This file is part of OpenOffice.org. * diff --git a/toolkit/workben/layout/zoom.xml b/toolkit/workben/layout/zoom.xml index 78e30ee11dfd..5cc376168a27 100644 --- a/toolkit/workben/layout/zoom.xml +++ b/toolkit/workben/layout/zoom.xml @@ -7,20 +7,20 @@ xmlns:cnt="http://openoffice.org/2007/layout/container" id="RID_SVXDLG_ZOOM" _title="Zoom & View Layout" optimumsize="true" help-id="SID_ATTR_ZOOM" - has_border="true" sizeable="true" moveable="true"> - <vbox spacing="5" border="5"> + has_border="true" sizeable="true" moveable="true" closeable="true"> + <vbox spacing="0" border="12"> <hbox spacing="0" border="0"> - <vbox spacing="5" border="5"> - <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="true"/> - <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" _label="Optimal"/> - <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/> - <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/> - <radiobutton radiogroup="zoom" id="BTN_100" _label="100 %"/> + <vbox spacing="6" border="0"> + <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="false"/> + <radiobutton radiogroup="zoom-factor" id="BTN_OPTIMAL" _label="Optimal"/> + <radiobutton radiogroup="zoom-factor" id="BTN_WHOLE_PAGE" _label="Whole Page"/> + <radiobutton radiogroup="zoom-factor" id="BTN_PAGE_WIDTH" _label="Page Width"/> + <radiobutton radiogroup="zoom-factor" id="BTN_100" _label="100 %"/> <hbox cnt:expand="false" cnt:fill="true"> <align cnt:expand="false" cnt:fill="true"> - <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" _label="Variable"/> + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-factor" id="BTN_USER" _label="Variable"/> </align> - <flow cnt:padding="10" cnt:expand="false"/> + <flow cnt:padding="12" cnt:expand="false"/> <metricfield id="ED_USER" value-step="1" repeat="true" has_border="true" spin="true" _text="100%" unit="11" custom-unit-text="%" @@ -28,15 +28,16 @@ cnt:expand="false"/> </hbox> </vbox> - <vbox spacing="5" border="5"> - <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="true"/> - <radiobutton radiogroup="zoom" id="BTN_AUTOMATIC" _label="~Automatic"/> - <radiobutton radiogroup="zoom" id="BTN_SINGLE" _label="~Single page"/> + <flow/> + <vbox spacing="6" border="0"> + <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="false"/> + <radiobutton radiogroup="zoom-layout" id="BTN_AUTOMATIC" _label="~Automatic"/> + <radiobutton radiogroup="zoom-layout" id="BTN_SINGLE" _label="~Single page"/> <hbox cnt:expand="false" cnt:fill="true"> <align cnt:expand="false" cnt:fill="true"> - <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_COLUMNS" _label="~Columns"/> + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-layout" id="BTN_COLUMNS" _label="~Columns"/> </align> - <flow cnt:padding="10" cnt:expand="false"/> + <flow cnt:padding="12" cnt:expand="false"/> <metricfield id="ED_COLUMNS" value-step="1" repeat="true" has_border="true" spin="true" _text="100%" @@ -45,15 +46,15 @@ spin-value="1" cnt:expand="false"/> </hbox> - <hbox><flow cnt:expand="false" cnt:padding="10"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox> + <hbox><flow cnt:expand="false" cnt:padding="12"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox> </vbox> </hbox> - <fixedline cnt:padding="1" id="FL_BOTTOM"/> - <dialogbuttonhbox border="5" spacing="5"> + <fixedline cnt:padding="6" id="FL_BOTTOM"/> + <dialogbuttonhbox border="0" spacing="12"> <flow/> - <okbutton id="BTN_ZOOM_OK"/> + <okbutton defbutton="true" id="BTN_ZOOM_OK"/> <cancelbutton id="BTN_ZOOM_CANCEL"/> - <helpbutton id="BTN_ZOOM_HELP"/> + <helpbutton id="BTN_ZOOM_HELP"/> </dialogbuttonhbox> </vbox> </modaldialog> |