1 --- toolkit/doc/layout/TODO.old 2009-04-06 16:42:11.000000000 +0000
2 +++ toolkit/doc/layout/TODO 2009-04-06 16:42:13.000000000 +0000
4 ** Move everything & development into new layout-dialogs CWS
7 +*** Add XRadioButton2 and layout::VCLXRadioButton with
8 + {get,set}RadioGroup. Remove import.cxx RadioGroups::RadioGroup,
9 + VCLXRadioButton::getFirstActionListener () and [actionListener
10 + juggling in] layout::RadioButton_impl::SetClickHdl() and
11 + EnableRadioCheck() layout::RadioButton_impl::Check.
12 *** layout/import.hxx: what's this generator stuff?
15 @@ -87,7 +92,6 @@ but keep using yes/no on Windows, eg?
16 *** remove -DTEST_LAYOUT=1 from util/makefile.mk?
19 -*** mpRadioGroup HACK --> use radiogroup property
20 *** missing properties
23 @@ -102,14 +106,18 @@ fHorAlign = fVerAlign = 0.5; --> float c
25 ** include full translations
27 -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/'
28 -**** done, except for View Layout update: no strings in localize.sdf yet,
30 +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/'
32 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
34 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
36 +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
38 +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
40 +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
42 +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
45 + forget java property files nonsense
46 --- toolkit/inc/layout/layout-post.hxx.old 2009-04-06 16:42:11.000000000 +0000
47 +++ toolkit/inc/layout/layout-post.hxx 2009-04-06 16:42:13.000000000 +0000
52 +/* Allow re-inclusion for cxx file. */
53 +#undef _LAYOUT_PRE_HXX
76 #undef MetricFormatter
82 #undef NumericFormatter
104 #undef ModelessDialog
105 +#undef ScExpandedFixedText
107 #undef SfxModalDialog
109 +#undef SfxModelessDialog
111 #undef SvxLanguageBox
117 -#define SVX_RES(i) ResId(i,DIALOG_MGR())
122 -#define SW_RES(i) ResId(i,SWDIALOG_MGR())
124 -/* Allow re-inclusion for cxx file. */
125 -#undef _LAYOUT_PRE_HXX
127 #endif /* ENABLE_LAYOUT */
129 #endif /* _LAYOUT_POST_HXX */
130 --- toolkit/inc/layout/layout-pre.hxx.old 2009-04-06 16:42:11.000000000 +0000
131 +++ toolkit/inc/layout/layout-pre.hxx 2009-04-06 16:42:13.000000000 +0000
139 -//#define LAYOUT_NS layout
141 -// TWBN, but find that SfxModalDialog and FixedLine are already defined, eg compiling
143 -//typedef layout::Dialog SfxModalDialog;
144 -//typedef layout::FixedLine FixedLine;
145 +///* Allow re-inclusion for next hxx file. */
146 +#undef _LAYOUT_POST_HXX
148 #define AdvancedButton layout::AdvancedButton
149 #define ApplyButton layout::ApplyButton
151 #define Control layout::Control
152 #define Dialog layout::Dialog
153 #define Edit layout::Edit
154 +#define ErrorBox layout::ErrorBox
155 #define FixedImage layout::FixedImage
156 #define FixedInfo layout::FixedInfo
157 #define FixedLine layout::FixedLine
159 #define HBox layout::HBox
160 #define HelpButton layout::HelpButton
161 #define IgnoreButton layout::IgnoreButton
162 +#define InfoBox layout::InfoBox
163 +#define LocalizedString layout::LocalizedString
164 #define ListBox layout::ListBox
165 +#define MessBox layout::MessBox
166 +#define MessageBox layout::MessageBox
167 #define MetricField layout::MetricField
168 #define MetricFormatter layout::MetricFormatter
169 #define MoreButton layout::MoreButton
170 #define MultiLineEdit layout::MultiLineEdit
171 +#define MultiListBox layout::MultiListBox
172 #define NoButton layout::NoButton
173 #define NumericField layout::NumericField
174 #define NumericFormatter layout::NumericFormatter
176 #define Plugin layout::Plugin
177 #define ProgressBar layout::ProgressBar
178 #define PushButton layout::PushButton
179 +#define QueryBox layout::QueryBox
180 #define RadioButton layout::RadioButton
181 #define ResetButton layout::ResetButton
182 #define RetryButton layout::RetryButton
183 +#define SfxTabDialog layout::SfxTabDialog
184 +#define SfxTabPage layout::SfxTabPage
185 #define SpinField layout::SpinField
186 -#define Table layout::Table
187 +#define TabControl layout::TabControl
188 #define TabPage layout::TabPage
189 +#define Table layout::Table
190 #define VBox layout::VBox
191 +#define WarningBox layout::WarningBox
192 #define YesButton layout::YesButton
194 #define ModalDialog Dialog
195 #define ModelessDialog Dialog
196 +#define ScExpandedFixedText FixedText
197 +#define SfxDialog Dialog
198 #define SfxModalDialog Dialog
199 -#define SfxTabPage TabPage
200 +#define SfxModelessDialog Dialog
201 +#define TabDialog Dialog
203 #define SvxLanguageBox ListBox
205 #define Window ::Window
207 -#define LAYOUT_DIALOG_PARENT\
208 - VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
211 -#define SVX_RES(x) #x
213 -#define SvtResId(x) #x
215 -#define SW_RES(x) #x
217 -/* Hmm. These hacks make zoom.cxx, wordcountdialog.cxx, ... diffs
218 - * smaller but 'tis not really scalable. */
219 -#ifdef _LAYOUT_POST_HXX
221 -#ifdef _SVX_RECOVER_CXX
222 -#undef SfxModalDialog
223 -// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_RECOVER", localize.sdf
224 -#define SfxModalDialog( pParent, SVX_RES_RID ) Dialog( pParent, "recover.xml", "RID_SVXDLG_RECOVER" )
225 -#endif /* _SVX_RECOVER_CXX */
227 -#ifdef SW_WORDCOUNTDIALOG_HXX
228 -#undef SfxModalDialog
229 -// 3rd parameter must match ID in <modaldialog> "DLG_WORDCOUNT", localize.sdf
230 -#define SfxModalDialog( pParent, SW_RES_RID ) Dialog( pParent, "wordcount.xml", "DLG_WORDCOUNT" )
231 -#define SW_WORDCOUNTDIALOG_HRC
232 -#endif /* SW_WORDCOUNTDIALOG_HXX */
234 -#ifdef _SVX_ZOOM_CXX
235 -#undef SfxModalDialog
236 -// 3rd parameter must match ID in <modaldialog> "RID_SVXDLG_ZOOM", localize.sdf
237 -#define SfxModalDialog( pParent, SVX_RES_RID ) Dialog( pParent, "zoom.xml", "RID_SVXDLG_ZOOM" )
238 -#define _SVX_ZOOM_HRC
239 -#endif /* _SVX_ZOOM_CXX */
241 -#endif /* _LAYOUT_POST_HXX */
243 -#else /* !ENABLE_LAYOUT */
246 -#define LAYOUT_PRE_POST 1
247 +#define LocalizedString String
249 -#endif /* !ENABLE_LAYOUT */
250 +#endif /* ENABLE_LAYOUT */
252 #endif /* _LAYOUT_PRE_HXX */
253 --- toolkit/inc/layout/layout.hxx.old 2009-04-06 16:42:11.000000000 +0000
254 +++ toolkit/inc/layout/layout.hxx 2009-04-06 16:42:13.000000000 +0000
259 -#include <com/sun/star/uno/XInterface.hpp>
260 #include <com/sun/star/awt/XLayoutContainer.hpp>
261 +#include <com/sun/star/uno/XInterface.hpp>
262 #include <com/sun/star/util/Color.hpp>
263 #include <i18npool/lang.h>
264 +#include <toolkit/dllapi.h>
265 #include <tools/gen.hxx>
266 #include <tools/link.hxx>
267 #include <tools/string.hxx>
269 -// FIXME: eventually wrap FieldUnit
270 +#include <vcl/combobox.h>
271 #include <vcl/fldunit.hxx>
272 -// FIXME: eventually wrap this too ...
273 +#include <vcl/lstbox.h>
274 +#include <vcl/smartid.hxx>
275 #include <vcl/wintypes.hxx>
277 -#include <toolkit/dllapi.h>
294 +struct SfxChildWinInfo;
297 +class VCLXRadioButton;
302 +namespace layoutimpl
304 +class VCLXTabControl;
307 +class VCLXTabControl;
309 namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
311 @@ -70,7 +88,7 @@ class TOOLKIT_DLLPUBLIC Context
313 Context( char const* pPath );
315 - PeerHandle GetPeerHandle( char const* pId, sal_uInt32 nId = 0 ) const;
316 + PeerHandle GetPeerHandle( char const* id, sal_uInt32 nId = 0 ) const;
317 void setToplevel( PeerHandle xToplevel );
318 PeerHandle getToplevel();
319 PeerHandle getRoot();
320 @@ -83,46 +101,88 @@ public:
322 char const* GetUnoName() const; \
324 - t( Context *pCtx, char const* pId, sal_uInt32 nId = 0 ); \
325 - t( Window *pParent, WinBits nStyle = defaultWinBit )
326 + t( Context *context, char const* id, sal_uInt32 nId = 0 ); \
327 + t( Window *parent, WinBits nStyle = defaultWinBit ); \
328 + t (Window *parent, ResId const &res)
329 #define DECL_GET_IMPL(t) \
330 inline t##Impl &getImpl() const
332 +#define DECL_GET_WINDOW( cls ) ::cls* Get##cls() const
333 +#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() const { return reinterpret_cast< ::cls*>( GetWindow() ); }
335 +#define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const
336 +#define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return reinterpret_cast< ::VCLX##cls*>( GetVCLXWindow() ); }
338 +#define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const
339 +#define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return reinterpret_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); }
341 // follows the VCL inheritance hierarchy ...
344 class TOOLKIT_DLLPUBLIC Window
347 + friend class WindowImpl;
349 - static PeerHandle CreatePeer( Window *pParent, WinBits nStyle,
350 + static PeerHandle CreatePeer( Window *parent, WinBits nStyle,
353 + virtual void setRes (ResId const& res);
356 DECL_GET_IMPL( Window );
357 explicit Window( WindowImpl *pImpl );
360 - PeerHandle GetPeer();
361 + PeerHandle GetPeer() const;
362 Context *getContext();
364 void Enable( bool bEnable = true );
365 inline void Disable() { Enable( false ); }
366 - void Show( BOOL bVisible = TRUE );
367 - inline void Hide() { Show( FALSE ); }
368 + void Show( bool bVisible = true );
369 + inline void Hide() { Show( false ); }
371 void FreeResource() {}
373 - void SetParent( Window *pParent );
374 - void SetParent( ::Window *pParent );
376 - css::uno::Reference<css::awt::XWindow> GetRef();
377 - VCLXWindow* GetVCLXWindow();
378 - ::Window* GetWindow();
379 - ::Window* GetParent();
380 + void SetParent( ::Window *parent );
381 + virtual void ParentSet (Window *window);
382 + void SetParent( Window *parent );
384 + css::uno::Reference<css::awt::XWindow> GetRef() const;
385 + VCLXWindow* GetVCLXWindow() const;
386 + ::Window* GetWindow() const;
387 + ::Window* GetParent() const;
389 + void SetPointer( Pointer const& pointer );
390 + Pointer const& GetPointer() const;
392 - void SetStyle( WinBits nStyle );
393 - void SetUpdateMode( bool /*bUpdate*/ ) { }
394 + void SetText( rtl::OUString const& str );
395 + String GetText() const;
396 + void SetStyle( WinBits style );
397 + void SetUpdateMode( bool mode );
398 + void SetHelpId( sal_uIntPtr id );
399 + sal_uIntPtr GetHelpId() const;
400 + void SetSmartHelpId( SmartId const&, SmartIdUpdateMode mode=SMART_SET_SMART );
401 + SmartId GetSmartHelpId() const;
404 + bool IsWait () const;
405 + //void Enable (bool enable=true, bool child=true);
406 + //void Disable (bool child=true);
407 + bool IsEnabled () const;
408 + void EnableInput (bool enable=true, bool child=true);
409 + bool IsInputEnabled () const;
411 + bool IsVisible () const;
412 + bool HasChildPathFocus (bool systemWindow=false) const;
413 + void SetPosPixel (Point const&);
414 + Point GetPosPixel () const;
415 + void SetSizePixel (Size const&);
416 + Size GetSizePixel () const;
417 + sal_Int32 GetCtrlTextWidth (rtl::OUString const& str) const;
418 + sal_Int32 GetTextHeight () const;
420 + Size LogicToPixel( Size const& size, MapMode const& mapMode=(MapMode const&)*(MapMode*)0 ) const;
424 @@ -130,8 +190,13 @@ class TOOLKIT_DLLPUBLIC Control : public
426 DECL_GET_IMPL( Control );
427 DECL_CONSTRUCTORS( Control, Window, 0 );
430 -// void SetText( String const& rStr ); - can't do this here ...
432 + void SetGetFocusHdl (Link const& link);
433 + Link& GetGetFocusHdl ();
434 + void SetLoseFocusHdl (Link const& link);
435 + Link& GetLoseFocusHdl ();
439 @@ -139,6 +204,7 @@ class TOOLKIT_DLLPUBLIC FixedLine : publ
441 DECL_GET_IMPL( FixedLine );
442 DECL_CONSTRUCTORS( FixedLine, Control, WB_HORZ );
447 @@ -148,8 +214,10 @@ class TOOLKIT_DLLPUBLIC FixedText : publ
449 DECL_GET_IMPL( FixedText );
450 DECL_CONSTRUCTORS( FixedText, Control, 0 );
453 - void SetText( String const& rStr );
455 + void SetText( rtl::OUString const& rStr );
458 class FixedImageImpl;
459 @@ -183,13 +251,18 @@ class TOOLKIT_DLLPUBLIC Button : public
461 DECL_GET_IMPL( Button );
462 DECL_CONSTRUCTORS( Button, Control, 0 );
463 + DECL_GET_WINDOW (Button);
466 - void SetText( String const& rStr );
467 - BOOL SetModeImage( const Image& rImage );
469 + static String GetStandardText (sal_uInt16 button_type);
470 + void SetText( rtl::OUString const& rStr );
471 + bool SetModeImage( const Image& rImage );
472 void SetImageAlign( ImageAlign eAlign );
474 void SetClickHdl( Link const& rLink );
475 virtual void Click() /* pure virtual? */;
476 + Link& GetClickHdl ();
479 class PushButtonImpl;
480 @@ -197,9 +270,12 @@ class TOOLKIT_DLLPUBLIC PushButton : pub
482 DECL_GET_IMPL( PushButton );
483 DECL_CONSTRUCTORS( PushButton, Button, 0 );
484 + DECL_GET_WINDOW (PushButton);
487 - void Check( BOOL bCheck = TRUE );
488 - BOOL IsChecked() const;
490 + void Check( bool bCheck=true );
491 + bool IsChecked() const;
494 void SetToggleHdl( Link const& rLink );
495 @@ -252,6 +328,12 @@ class TOOLKIT_DLLPUBLIC AdvancedButton :
496 void AddSimple( Window* w );
497 void RemoveAdvanced( Window* w );
498 void RemoveSimple( Window* w );
500 + void SetAdvancedText (rtl::OUString const& text);
501 + void SetSimpleText (rtl::OUString const& text);
502 + rtl::OUString GetAdvancedText () const;
503 + rtl::OUString GetSimpleText () const;
504 + void SetDelta (int);
507 class MoreButtonImpl;
508 @@ -261,6 +343,11 @@ class TOOLKIT_DLLPUBLIC MoreButton : pub
509 DECL_GET_IMPL( MoreButton );
510 void AddWindow( Window* w );
511 void RemoveWindow( Window* w );
513 + void SetMoreText (rtl::OUString const& text);
514 + void SetLessText (rtl::OUString const& text);
515 + rtl::OUString GetMoreText () const;
516 + rtl::OUString GetLessText () const;
519 class RadioButtonImpl;
520 @@ -268,9 +355,12 @@ class TOOLKIT_DLLPUBLIC RadioButton : pu
522 DECL_GET_IMPL( RadioButton );
523 DECL_CONSTRUCTORS( RadioButton, Button, 0 );
524 + DECL_GET_WINDOW( RadioButton );
525 + DECL_GET_VCLXWINDOW( RadioButton );
527 - void Check( BOOL bCheck = TRUE );
528 - BOOL IsChecked() const;
530 + void Check( bool bCheck=true );
531 + bool IsChecked() const;
534 void SetToggleHdl( Link const& rLink );
535 @@ -281,9 +371,11 @@ class TOOLKIT_DLLPUBLIC CheckBox : publi
537 DECL_GET_IMPL( CheckBox );
538 DECL_CONSTRUCTORS( CheckBox, Button, 0 );
541 - void Check( BOOL bCheck = TRUE );
542 - BOOL IsChecked() const;
544 + void Check( bool bCheck=true );
545 + bool IsChecked() const;
548 void SetToggleHdl( Link const& rLink );
549 @@ -294,9 +386,11 @@ class TOOLKIT_DLLPUBLIC Edit : public Co
551 DECL_GET_IMPL( Edit );
552 DECL_CONSTRUCTORS( Edit, Control, WB_BORDER );
555 - void SetText( XubString const& rStr ) const;
556 - XubString GetText() const;
558 + void SetText( rtl::OUString const& rStr ) const;
559 + String GetText() const;
560 void SetModifyHdl( Link const& rLink );
561 void SetSelection( Selection const& rSelection );
563 @@ -320,8 +414,7 @@ class TOOLKIT_DLLPUBLIC FormatterBase
566 FormatterBaseImpl *mpFormatImpl;
567 - FormatterBase( FormatterBaseImpl *pFormatImpl )
568 - : mpFormatImpl( pFormatImpl ) {}
569 + FormatterBase( FormatterBaseImpl *pFormatImpl );
572 class NumericFormatterImpl;
573 @@ -346,8 +439,8 @@ class TOOLKIT_DLLPUBLIC NumericField : p
575 DECL_GET_IMPL( NumericField );
577 - NumericField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 );
578 - NumericField( Window *pParent, WinBits nStyle );
579 + NumericField( Context *context, char const* id, sal_uInt32 nId=0 );
580 + NumericField( Window *parent, WinBits nStyle );
583 class MetricFormatterImpl;
584 @@ -358,12 +451,12 @@ class TOOLKIT_DLLPUBLIC MetricFormatter
585 explicit MetricFormatter( FormatterBaseImpl *pImpl );
586 MetricFormatterImpl &getFormatImpl() const;
588 - void SetMin( sal_Int64 nNewMin, FieldUnit nUnit = FUNIT_NONE );
589 - void SetMax( sal_Int64 nNewMax, FieldUnit nUnit = FUNIT_NONE );
590 - void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit = FUNIT_NONE );
591 - void SetLast( sal_Int64 nNewLast, FieldUnit nUnit = FUNIT_NONE );
592 - void SetValue( sal_Int64 nNewValue, FieldUnit nUnit = FUNIT_NONE );
593 - sal_Int64 GetValue( FieldUnit nUnit = FUNIT_NONE ) const;
594 + void SetMin( sal_Int64 nNewMin, FieldUnit nUnit=FUNIT_NONE );
595 + void SetMax( sal_Int64 nNewMax, FieldUnit nUnit=FUNIT_NONE );
596 + void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit=FUNIT_NONE );
597 + void SetLast( sal_Int64 nNewLast, FieldUnit nUnit=FUNIT_NONE );
598 + void SetValue( sal_Int64 nNewValue, FieldUnit nUnit=FUNIT_NONE );
599 + sal_Int64 GetValue( FieldUnit nUnit=FUNIT_NONE ) const;
601 void SetSpinSize( sal_Int64 nNewSize );
603 @@ -373,124 +466,209 @@ class TOOLKIT_DLLPUBLIC MetricField : pu
605 DECL_GET_IMPL( MetricField );
607 - MetricField( Context *pCtx, char const* pId, sal_uInt32 nId = 0 );
608 - MetricField( Window *pParent, WinBits nStyle );
609 + MetricField( Context *context, char const* id, sal_uInt32 nId=0 );
610 + MetricField( Window *parent, WinBits nStyle );
613 -#define COMBOBOX_APPEND ((USHORT)0xFFFF)
614 -#define COMBOBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF)
616 class TOOLKIT_DLLPUBLIC ComboBox : public Edit
618 DECL_GET_IMPL( ComboBox );
619 + DECL_GET_WINDOW (ComboBox );
620 DECL_CONSTRUCTORS( ComboBox, Edit, 0 );
623 - USHORT InsertEntry( XubString const& rStr, USHORT nPos = COMBOBOX_APPEND );
624 - void RemoveEntry( XubString const& rStr );
625 - void RemoveEntry( USHORT nPos );
627 + sal_uInt16 InsertEntry( rtl::OUString const& rStr, sal_uInt16 nPos=COMBOBOX_APPEND );
628 + void RemoveEntry( rtl::OUString const& rStr );
629 + void RemoveEntry( sal_uInt16 nPos );
632 - USHORT GetEntryPos( XubString const& rStr ) const;
633 - XubString GetEntry( USHORT nPos ) const;
634 - USHORT GetEntryCount() const;
635 + sal_uInt16 GetEntryPos( rtl::OUString const& rStr ) const;
636 + String GetEntry( sal_uInt16 nPos ) const;
637 + sal_uInt16 GetEntryCount() const;
639 void SetClickHdl( Link const& rLink );
640 void SetSelectHdl( Link const& rLink );
641 + void EnableAutocomplete (bool enable, bool matchCase=false );
644 -#define LISTBOX_APPEND ((USHORT)0xFFFF)
645 -#define LISTBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF)
647 class TOOLKIT_DLLPUBLIC ListBox : public Control
649 DECL_GET_IMPL( ListBox );
650 DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER );
651 + DECL_GET_WINDOW (ListBox);
654 - USHORT InsertEntry( XubString const& rStr, USHORT nPos = LISTBOX_APPEND );
656 + sal_uInt16 InsertEntry( rtl::OUString const& rStr, sal_uInt16 nPos=LISTBOX_APPEND );
658 - void RemoveEntry( XubString const& rStr );
659 - void RemoveEntry( USHORT nPos );
660 + void RemoveEntry( rtl::OUString const& rStr );
661 + void RemoveEntry( sal_uInt16 nPos );
664 - USHORT GetEntryPos( XubString const& rStr ) const;
665 - XubString GetEntry( USHORT nPos ) const;
666 - USHORT GetEntryCount() const;
668 - void SelectEntry( XubString const& rStr, BOOL bSelect = TRUE );
669 - void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE );
671 - USHORT GetSelectEntryCount() const;
672 - XubString GetSelectEntry( USHORT nSelIndex = 0 ) const;
673 - USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const;
674 + sal_uInt16 GetEntryPos( rtl::OUString const& rStr ) const;
675 + String GetEntry( sal_uInt16 nPos ) const;
676 + sal_uInt16 GetEntryCount() const;
678 + void SelectEntry( rtl::OUString const& rStr, bool bSelect=true );
679 + void SelectEntryPos( sal_uInt16 nPos, bool bSelect=true );
681 + sal_uInt16 GetSelectEntryCount() const;
682 + String GetSelectEntry( sal_uInt16 nSelIndex=0 ) const;
683 + sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex=0 ) const;
685 void SetSelectHdl( Link const& rLink );
686 void SetClickHdl( Link const& rLink );
688 - void SetEntryData( USHORT/*nPos*/, void*/*pNewData*/) { }
689 - void* GetEntryData( USHORT/*nPos*/) const { return 0; }
690 + void SetEntryData (sal_uInt16 pos, void* data);
691 + void* GetEntryData (sal_uInt16 pos) const;
694 - void SetLanguageList( INT16/*nLangList*/, bool/*bHasLangNone*/, bool /*bLangNoneIsLangAll*/= false, bool /*bCheckSpellAvail*/= false ) { }
695 + void SetLanguageList (sal_Int16 list, bool hasLangNone, bool langNoneIsLangAll=false, bool checkSpellAvailable=false);
697 - USHORT InsertLanguage( const LanguageType/*eLangType*/, USHORT/*nPos*/= LISTBOX_APPEND ) { return 0; }
698 - USHORT InsertLanguage( const LanguageType/*eLangType*/, bool/*bCheckEntry*/, USHORT /*nPos*/= LISTBOX_APPEND ) { return 0; }
699 - void RemoveLanguage( const LanguageType/*eLangType*/) { }
700 - void SelectLanguage( const LanguageType/*eLangType*/, bool/*bSelect*/= true) { }
701 - LanguageType GetSelectLanguage() const { return 0; }
702 - bool IsLanguageSelected( const LanguageType/*eLangType*/) const { return true; }
703 + sal_uInt16 InsertLanguage (LanguageType const type, sal_uInt16 pos=LISTBOX_APPEND);
704 + sal_uInt16 InsertLanguage (LanguageType const type, bool checkEntry, sal_uInt16 pos=LISTBOX_APPEND);
705 + void RemoveLanguage (LanguageType const type);
706 + void SelectLanguage (LanguageType const type, bool select=true);
707 + LanguageType GetSelectLanguage () const;
708 + bool IsLanguageSelected( LanguageType const type) const;
711 +class MultiListBoxImpl;
712 +class TOOLKIT_DLLPUBLIC MultiListBox : public ListBox
714 + DECL_GET_IMPL( MultiListBox );
715 + DECL_CONSTRUCTORS( MultiListBox, ListBox, 0 );
716 + DECL_GET_WINDOW( MultiListBox );
720 class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window
722 - DECL_GET_IMPL( Dialog );
723 + DECL_GET_WINDOW (Dialog);
726 - Dialog( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 );
727 - Dialog( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0 );
729 - void EndDialog( long nResult = 0 );
730 - void SetText( String const& rStr );
731 + DECL_GET_IMPL (Dialog);
732 + Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
733 + Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
735 + virtual short Execute();
736 + void EndDialog( long nResult=0 );
737 + void SetText( rtl::OUString const& rStr );
738 + void SetTitle (rtl::OUString const& rStr );
740 + long Notify (NotifyEvent & event);
744 + void Initialize (SfxChildWinInfo*);
747 +#define DECL_MESSAGE_BOX_CTORS(Name)\
749 + Name##Box (::Window *parent, char const* message,\
750 + char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\
751 + char const* xml_file="message-box.xml", char const* id="message-box");\
752 + Name##Box (::Window *parent, rtl::OUString const& message,\
753 + rtl::OUString yes=String (),\
754 + rtl::OUString no=String (),\
755 + sal_uIntPtr help_id=0,\
756 + char const* xml_file="message-box.xml", char const* id="message-box");\
757 + Name##Box (::Window *parent, WinBits, char const* message,\
758 + char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\
759 + char const* xml_file="message-box.xml", char const* id="message-box");\
760 + Name##Box (::Window *parent, WinBits, rtl::OUString const& message,\
761 + rtl::OUString yes=String (),\
762 + rtl::OUString no=String (),\
763 + sal_uIntPtr help_id=0,\
764 + char const* xml_file="message-box.xml", char const* id="message-box")\
766 +class TOOLKIT_DLLPUBLIC MessageBox : public Dialog
768 + DECL_MESSAGE_BOX_CTORS(Message);
771 + FixedImage imageError;
772 + FixedImage imageInfo;
773 + FixedImage imageQuery;
774 + FixedImage imageWarning;
775 + FixedText messageText;
776 + CancelButton cancelButton;
777 + HelpButton helpButton;
778 + IgnoreButton ignoreButton;
780 + RetryButton retryButton;
781 + YesButton yesButton;
783 + void bits_init (WinBits bits, rtl::OUString const& message,
784 + rtl::OUString yes, rtl::OUString, sal_uIntPtr help_id);
785 + void init (rtl::OUString const& message,
786 + rtl::OUString const& yes, rtl::OUString const& no, sal_uIntPtr help_id);
787 + void init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id);
790 +#define CLASS_MESSAGE_BOX(Name)\
791 + class TOOLKIT_DLLPUBLIC Name##Box : public MessageBox\
793 + DECL_MESSAGE_BOX_CTORS (Name);\
796 +//CLASS_MESSAGE_BOX (Mess);
797 +typedef MessageBox MessBox;
798 +CLASS_MESSAGE_BOX (Error);
799 +CLASS_MESSAGE_BOX (Info);
800 +CLASS_MESSAGE_BOX (Query);
801 +CLASS_MESSAGE_BOX (Warning);
803 +#undef CLASS_MESSAGE_BOX
806 +#define TAB_APPEND -1
807 +#endif /* !TAB_APPEND */
809 +class TabControlImpl;
810 +class TOOLKIT_DLLPUBLIC TabControl : public Control
812 + DECL_GET_IMPL (TabControl);
813 + DECL_CONSTRUCTORS (TabControl, Control, 0);
814 + DECL_GET_WINDOW (TabControl);
815 + DECL_GET_LAYOUT_VCLXWINDOW (TabControl);
819 + void InsertPage (sal_uInt16 id, rtl::OUString const& title, sal_uInt16 pos=TAB_APPEND);
820 + void RemovePage (sal_uInt16 id);
821 + sal_uInt16 GetPageCount () const;
822 + sal_uInt16 GetPageId (sal_uInt16 pos) const;
823 + sal_uInt16 GetPagePos (sal_uInt16 id) const;
824 + void SetCurPageId (sal_uInt16 id);
825 + sal_uInt16 GetCurPageId () const;
826 + void SetTabPage (sal_uInt16 id, ::TabPage* page);
827 + ::TabPage* GetTabPage (sal_uInt16 id) const;
828 + void SetActivatePageHdl (Link const& link);
829 + Link& GetActivatePageHdl () const;
830 + void SetDeactivatePageHdl (Link const& link);
831 + Link& GetDeactivatePageHdl () const;
832 + void SetTabPageSizePixel (Size const& size);
833 + Size GetTabPageSizePixel () const;
836 -#define DECL_GET_WINDOW( cls ) ::cls* Get##cls()
837 -#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() { return reinterpret_cast< ::cls*>( GetWindow() ); }
839 class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window
841 DECL_GET_IMPL( TabPage );
843 static ::Window* global_parent;
844 + static TabControl* global_tabcontrol;
846 - TabPage( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
847 - TabPage( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
848 + TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
849 + TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
851 - //DECL_GET_WINDOW( TabPage );
852 - ::TabPage* GetTabPage();
853 + DECL_GET_WINDOW( TabPage );
854 virtual void ActivatePage();
855 virtual void DeactivatePage();
859 -//FIXME: move to sfx2 or svtools layout.hxx
860 -class TOOLKIT_DLLPUBLIC SfxTabPage : public TabPage
863 - SfxTabPage( Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
864 - SfxTabPage( ::Window *pOptParent, char const* pXMLPath, char const* pId, sal_uInt32 nId = 0, SfxItemSet const* set = 0 );
867 - enum PageAction { KEEP_PAGE, LEAVE_PAGE, REFRESH_SET };
869 - bool bHasExchangeSupport;
870 - bool HasExchangeSupport() { return bHasExchangeSupport; }
871 - SfxItemSet const* pSet;
872 - SfxItemSet const& GetItemSet() const { return *pSet; }
873 - virtual void Reset( SfxItemSet const& r );
874 - void SetExchangeSupport( bool exchangeSupport = true ) { bHasExchangeSupport = exchangeSupport; }
875 - //static const SfxPoolItem* GetItem( const SfxItemSet& rSet, USHORT nSlot );
876 - virtual void ActivatePage( SfxItemSet const& ) { }
877 - virtual int DeactivatePage( SfxItemSet* ) { return LEAVE_PAGE; }
880 class ProgressBarImpl;
881 @@ -516,7 +694,7 @@ protected:
882 css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
883 Container( rtl::OUString const& rName, sal_Int32 nBorder );
885 - Container( Context const* pCtx, char const* pId );
886 + Container( Context const* context, char const* id );
888 void Add( Window *pWindow );
889 void Add( Container *pContainer );
890 @@ -540,11 +718,11 @@ class TOOLKIT_DLLPUBLIC Table : public C
892 Table( sal_Int32 nBorder, sal_Int32 nColumns );
894 - Table( Context const* pCtx, char const* pId );
895 + Table( Context const* context, char const* id );
896 void Add( Window *pWindow, bool bXExpand, bool bYExpand,
897 - sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 );
898 + sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
899 void Add( Container *pContainer, bool bXExpand, bool bYExpand,
900 - sal_Int32 nXSpan = 1, sal_Int32 nYSpan = 1 );
901 + sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
904 void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild,
905 @@ -556,7 +734,7 @@ class TOOLKIT_DLLPUBLIC Box : public Con
907 Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous );
909 - Box( Context const* pCtx, char const* pId );
910 + Box( Context const* context, char const* id );
911 void Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding);
912 void Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding);
914 @@ -568,13 +746,13 @@ private:
915 class TOOLKIT_DLLPUBLIC HBox : public Box
918 - HBox( Context const* pCtx, char const* pId );
919 + HBox( Context const* context, char const* id );
920 HBox( sal_Int32 nBorder, bool bHomogeneous );
922 class TOOLKIT_DLLPUBLIC VBox : public Box
925 - VBox( Context const* pCtx, char const* pId );
926 + VBox( Context const* context, char const* id );
927 VBox( sal_Int32 nBorder, bool bHomogeneous );
930 @@ -585,21 +763,50 @@ class TOOLKIT_DLLPUBLIC Plugin : public
931 //DECL_CONSTRUCTORS( Plugin, Control, 0 );
934 - Plugin( Context *pCtx, char const* pId, ::Control *plugin );
935 + Plugin( Context *context, char const* id, ::Control *plugin );
938 class LocalizedStringImpl;
939 class TOOLKIT_DLLPUBLIC LocalizedString : public Window
941 DECL_GET_IMPL( LocalizedString );
944 - LocalizedString( Context *pCtx, char const* pId );
945 + LocalizedString( Context *context, char const* id );
947 - String operator =( String const& );
949 -// operator String const&() const;
950 + rtl::OUString operator= (rtl::OUString const&);
951 + rtl::OUString operator+= (sal_Unicode );
952 + rtl::OUString operator+= (rtl::OUString const&);
954 + operator rtl::OUString();
955 + String getString ();
956 + rtl::OUString getOUString ();
957 + rtl::OUString GetToken (sal_uInt32 i, sal_Char c);
961 +class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window
963 + DECL_GET_IMPL (InPlug);
966 + InPlug ( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
967 + InPlug ( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
969 + void ParentSet (Window *window);
972 } // end namespace layout
975 +#define LAYOUT_NS layout::
976 +#define LAYOUT_DIALOG_PARENT\
977 + VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
978 +#define LAYOUT_THIS_WINDOW( this ) this->GetWindow ()
979 +#else /* !ENABLE_LAYOUT */
981 +#define LAYOUT_DIALOG_PARENT this
982 +#define LAYOUT_THIS_WINDOW( this ) this
983 +#endif /* !ENABLE_LAYOUT */
985 #endif /* _LAYOUT_HXX */
986 --- toolkit/inc/layout/layoutcore.hxx.old 2009-04-02 10:49:37.000000000 +0000
987 +++ toolkit/inc/layout/layoutcore.hxx 1970-01-01 00:00:00.000000000 +0000
989 -/*************************************************************************
991 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
993 - * Copyright 2008 by Sun Microsystems, Inc.
995 - * OpenOffice.org - a multi-platform office productivity suite
997 - * $RCSfile: layoutcore.hxx,v $
1001 - * This file is part of OpenOffice.org.
1003 - * OpenOffice.org is free software: you can redistribute it and/or modify
1004 - * it under the terms of the GNU Lesser General Public License version 3
1005 - * only, as published by the Free Software Foundation.
1007 - * OpenOffice.org is distributed in the hope that it will be useful,
1008 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1009 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1010 - * GNU Lesser General Public License version 3 for more details
1011 - * (a copy is included in the LICENSE file that accompanied this code).
1013 - * You should have received a copy of the GNU Lesser General Public License
1014 - * version 3 along with OpenOffice.org. If not, see
1015 - * <http://www.openoffice.org/license.html>
1016 - * for a copy of the LGPLv3 License.
1018 - ************************************************************************/
1020 -#ifndef _LAYOUT_CORE_HXX_
1021 -#define _LAYOUT_CORE_HXX_
1023 -#include <com/sun/star/awt/XToolkit.hpp>
1024 -#include <com/sun/star/graphic/XGraphic.hpp>
1025 -#include <com/sun/star/awt/XLayoutContainer.hpp>
1026 -#include <com/sun/star/awt/XLayoutConstrains.hpp>
1028 -#include <layout/layout.hxx>
1030 -namespace layoutimpl
1033 -namespace css = layout::css;
1035 -css::uno::Reference< css::awt::XLayoutContainer >
1036 -createContainer( const rtl::OUString &rName );
1038 -css::uno::Reference< css::awt::XLayoutConstrains >
1039 -createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
1040 - css::uno::Reference< css::uno::XInterface > xParent,
1041 - const rtl::OUString &rName, long nProps );
1043 -css::uno::Reference< css::awt::XLayoutConstrains >
1044 -createInternalWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
1045 - css::uno::Reference< css::uno::XInterface > xParent,
1046 - const rtl::OUString &rName, long nProps );
1048 -css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName );
1050 -// Helpers - unfortunately VCLXWindows don't implement XPropertySet
1051 -// but containers do - these helpers help us to hide this
1054 -// can we set properties on this handle ?
1055 -bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef );
1056 -// if so which properties ?
1057 -css::uno::Reference< css::beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC queryPropertyInfo(
1058 - const css::uno::Reference< css::uno::XInterface > &xRef );
1060 -void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
1061 - const rtl::OUString &rName,
1062 - css::uno::Any aValue );
1063 -css::uno::Any TOOLKIT_DLLPUBLIC getProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
1064 - const rtl::OUString &rName );
1065 -} // namespace prophlp
1066 -} // namespace layoutimpl
1068 -#endif // _LAYOUT_CORE_HXX_
1069 --- toolkit/inc/toolkit/awt/vclxwindows.hxx.old 2009-04-02 10:49:37.000000000 +0000
1070 +++ toolkit/inc/toolkit/awt/vclxwindows.hxx 2009-04-06 16:42:13.000000000 +0000
1071 @@ -181,6 +181,7 @@ protected:
1077 // ::com::sun::star::lang::XComponent
1078 void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
1079 @@ -346,6 +347,8 @@ public:
1081 static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
1082 virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
1084 + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getFirstActionListener ();
1087 // ----------------------------------------------------
1088 @@ -764,6 +767,7 @@ protected:
1094 // ::com::sun::star::uno::XInterface
1095 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
1096 --- toolkit/prj/build.lst.old 2009-04-02 10:49:37.000000000 +0000
1097 +++ toolkit/prj/build.lst 2009-04-06 16:42:13.000000000 +0000
1098 @@ -2,10 +2,11 @@ ti toolkit : vcl NULL
1099 ti toolkit usr1 - all ti_mkout NULL
1100 ti toolkit\prj get - all ti_prj NULL
1101 ti toolkit\inc nmake - all ti_inc NULL
1102 +ti toolkit\uiconfig\layout nmake - all ti_uiconfig_layout NULL
1103 ti toolkit\source\helper nmake - all ti_helper ti_inc NULL
1104 ti toolkit\source\awt nmake - all ti_awt ti_inc NULL
1105 ti toolkit\source\controls nmake - all ti_controls ti_inc NULL
1106 ti toolkit\source\controls\tree nmake - all ti_tree NULL
1107 -ti toolkit\source\layout nmake - all ti_layout NULL
1108 -ti toolkit\source\vclcompat nmake - all ti_vclcompat NULL
1109 -ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout ti_helper ti_tree ti_vclcompat NULL
1110 +ti toolkit\source\layout\core nmake - all ti_layout_core NULL
1111 +ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL
1112 +ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_layout_vcl NULL
1113 --- toolkit/prj/d.lst.old 2009-04-02 10:49:37.000000000 +0000
1114 +++ toolkit/prj/d.lst 2009-04-06 16:42:13.000000000 +0000
1115 @@ -22,7 +22,9 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\control
1116 ..\inc\toolkit\awt\vclxdevice.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdevice.hxx
1117 ..\inc\toolkit\awt\vclxfont.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxfont.hxx
1118 ..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx
1119 +..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx
1120 ..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx
1121 +..\source\awt\vclxdialog.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdialog.hxx
1122 ..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx
1123 ..\inc\toolkit\awt\vclxmenu.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxmenu.hxx
1125 @@ -53,3 +55,9 @@ mkdir: %_DEST%\inc%_EXT%\layout
1126 ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
1128 ..\inc\layout\*.hxx %_DEST%\inc%_EXT%\layout\*.hxx
1129 +mkdir: %_DEST%\inc%_EXT%\layout\core
1130 +..\source\layout\core\*.hxx %_DEST%\inc%_EXT%\layout\core\*.hxx
1131 +mkdir: %_DEST%\inc%_EXT%\layout\vcl
1132 +..\source\layout\vcl\*.hxx %_DEST%\inc%_EXT%\layout\vcl\*.hxx
1134 +..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
1135 --- toolkit/source/awt/makefile.mk.old 2009-04-06 16:42:11.000000000 +0000
1136 +++ toolkit/source/awt/makefile.mk 2009-04-06 16:42:13.000000000 +0000
1137 @@ -43,9 +43,6 @@ ENABLE_EXCEPTIONS=TRUE
1139 # --- Files --------------------------------------------------------
1141 -# FIXME: This is bad, hmkay
1142 -CFLAGS+= -I$(PRJ)/source
1144 .IF "$(GUIBASE)"=="aqua"
1145 OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
1146 CFLAGSCXX+=$(OBJCXXFLAGS)
1147 --- toolkit/source/awt/vclxbutton.cxx.old 2009-04-06 16:42:11.000000000 +0000
1148 +++ toolkit/source/awt/vclxbutton.cxx 2009-04-06 16:42:13.000000000 +0000
1151 #include "vclxbutton.hxx"
1153 -#include <layout/layoutcore.hxx>
1154 +#include <layout/core/helper.hxx>
1155 #include <com/sun/star/awt/ImagePosition.hpp>
1156 #include <vcl/button.hxx>
1158 --- toolkit/source/awt/vclxdialog.cxx.old 2009-04-02 10:49:36.000000000 +0000
1159 +++ toolkit/source/awt/vclxdialog.cxx 2009-04-06 16:42:13.000000000 +0000
1160 @@ -211,6 +211,15 @@ void VCLXDialog::setTitle( const ::rtl::
1161 pWindow->SetText( Title );
1164 +void VCLXDialog::setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException)
1166 + ::vos::OGuard aGuard( GetMutex() );
1168 + Window* pWindow = GetWindow();
1170 + pWindow->SetHelpId( id );
1173 ::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
1175 ::vos::OGuard aGuard( GetMutex() );
1176 --- toolkit/source/awt/vclxdialog.hxx.old 2009-04-02 10:49:36.000000000 +0000
1177 +++ toolkit/source/awt/vclxdialog.hxx 2009-04-06 16:42:13.000000000 +0000
1179 #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
1180 #include <com/sun/star/awt/XTopWindow.hpp>
1181 #include <comphelper/uno3.hxx>
1182 -#include <layout/bin.hxx>
1183 +#include <layout/core/bin.hxx>
1184 #include <toolkit/awt/vclxtopwindow.hxx>
1186 namespace layoutimpl
1187 @@ -44,10 +44,10 @@ namespace layoutimpl
1189 typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XDialog2 > VCLXDialog_Base;
1191 -class VCLXDialog :public VCLXWindow
1192 - ,public VCLXTopWindow_Base
1193 - ,public VCLXDialog_Base
1195 +class TOOLKIT_DLLPUBLIC VCLXDialog : public VCLXWindow
1196 + , public VCLXTopWindow_Base
1197 + , public VCLXDialog_Base
1201 bool bRealized, bResizeSafeguard;
1202 @@ -102,6 +102,7 @@ public:
1204 // ::com::sun::star::awt::XDialog2
1205 void SAL_CALL endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException);
1206 + void SAL_CALL setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException);
1210 --- toolkit/source/awt/vclxplugin.cxx.old 2009-04-06 16:42:11.000000000 +0000
1211 +++ toolkit/source/awt/vclxplugin.cxx 2009-04-06 16:42:13.000000000 +0000
1213 #include <toolkit/helper/property.hxx>
1214 #include <vcl/ctrl.hxx>
1216 +#include "forward.hxx"
1218 namespace layoutimpl
1221 @@ -63,7 +65,7 @@ void SAL_CALL VCLXPlugin::dispose() thro
1222 ::vos::OGuard aGuard( GetMutex() );
1224 lang::EventObject aDisposeEvent;
1225 - aDisposeEvent.Source = *this;
1226 + aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
1229 VCLXWindow::dispose();
1230 --- toolkit/source/awt/vclxscroller.hxx.old 2009-04-02 10:49:36.000000000 +0000
1231 +++ toolkit/source/awt/vclxscroller.hxx 2009-04-06 16:42:13.000000000 +0000
1233 #define LAYOUT_AWT_VCLXSCROLLER_HXX
1235 #include <comphelper/uno3.hxx>
1236 -#include <layout/bin.hxx>
1237 +#include <layout/core/bin.hxx>
1238 #include <toolkit/awt/vclxwindow.hxx>
1241 --- toolkit/source/awt/vclxsplitter.hxx.old 2009-04-02 10:49:36.000000000 +0000
1242 +++ toolkit/source/awt/vclxsplitter.hxx 2009-04-06 16:42:13.000000000 +0000
1244 #include <com/sun/star/awt/MaxChildrenException.hpp>
1245 #include <com/sun/star/beans/XPropertySet.hpp>
1246 #include <comphelper/uno3.hxx>
1247 -#include <layout/box-base.hxx>
1248 +#include <layout/core/box-base.hxx>
1249 #include <toolkit/awt/vclxwindow.hxx>
1252 --- toolkit/source/awt/vclxtabcontrol.cxx.old 2009-04-02 10:49:36.000000000 +0000
1253 +++ toolkit/source/awt/vclxtabcontrol.cxx 2009-04-06 16:42:13.000000000 +0000
1255 namespace layoutimpl
1258 -using namespace ::com::sun::star::uno;
1259 -using namespace ::com::sun::star::awt;
1260 using namespace ::com::sun::star::lang;
1261 using namespace ::com::sun::star::beans;
1262 using namespace ::com::sun::star;
1263 @@ -76,12 +74,19 @@ VCLXTabControl::createChildProps( Box_Ba
1265 DBG_NAME( VCLXTabControl );
1267 +#if !defined (__GNUC__)
1268 +#define __PRETTY_FUNCTION__ __FUNCTION__
1269 +#endif /* !__GNUC__ */
1271 VCLXTabControl::VCLXTabControl()
1273 , VCLXTabControl_Base()
1275 - , mnNextTabId( 1 )
1277 + , bRealized (false)
1279 + OSL_TRACE ("\n********%s:%x", __PRETTY_FUNCTION__, this);
1281 DBG_CTOR( VCLXTabControl, NULL );
1284 @@ -94,7 +99,7 @@ IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXTab
1286 IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXTabControl, VCLXWindow, VCLXTabControl_Base );
1288 -void SAL_CALL VCLXTabControl::dispose( ) throw(RuntimeException)
1289 +void SAL_CALL VCLXTabControl::dispose( ) throw(uno::RuntimeException)
1292 ::vos::OGuard aGuard( GetMutex() );
1293 @@ -108,38 +113,38 @@ void SAL_CALL VCLXTabControl::dispose( )
1297 -void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException)
1298 +void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
1300 if ( listener.is() )
1301 maTabListeners.addInterface( listener );
1304 -void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (RuntimeException)
1305 +void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
1307 if ( listener.is() )
1308 maTabListeners.removeInterface( listener );
1312 -TabControl *VCLXTabControl::getTabControl() const throw (RuntimeException)
1313 +TabControl *VCLXTabControl::getTabControl() const throw (uno::RuntimeException)
1315 TabControl *pTabControl = static_cast< TabControl* >( GetWindow() );
1318 - throw RuntimeException();
1319 + throw uno::RuntimeException();
1322 -sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (RuntimeException)
1323 +sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (uno::RuntimeException)
1325 TabControl *pTabControl = getTabControl();
1326 - USHORT id = sal::static_int_cast< USHORT >( mnNextTabId++ );
1327 + USHORT id = sal::static_int_cast< USHORT >( mTabId++ );
1328 rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) );
1329 pTabControl->InsertPage( id, title.getStr(), TAB_APPEND );
1330 pTabControl->SetTabPage( id, new TabPage( pTabControl ) );
1334 -void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException)
1335 +void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
1337 TabControl *pTabControl = getTabControl();
1338 if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
1339 @@ -147,7 +152,7 @@ void SAL_CALL VCLXTabControl::removeTab(
1340 pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) );
1343 -void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (RuntimeException, IndexOutOfBoundsException)
1344 +void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
1346 TabControl *pTabControl = getTabControl();
1347 if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
1348 @@ -155,15 +160,15 @@ void SAL_CALL VCLXTabControl::activateTa
1349 pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) );
1352 -sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (RuntimeException)
1353 +sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (uno::RuntimeException)
1355 return getTabControl()->GetCurPageId( );
1358 -void SAL_CALL VCLXTabControl::addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
1359 +void SAL_CALL VCLXTabControl::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
1361 - for ( std::list< ::com::sun::star::uno::Reference
1362 - < ::com::sun::star::awt::XTabListener > >::const_iterator it
1363 + for ( std::list< uno::Reference
1364 + < awt::XTabListener > >::const_iterator it
1365 = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
1367 if ( *it == xListener )
1368 @@ -173,10 +178,10 @@ void SAL_CALL VCLXTabControl::addTabList
1369 mxTabListeners.push_back( xListener );
1372 -void SAL_CALL VCLXTabControl::removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
1373 +void SAL_CALL VCLXTabControl::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
1375 - for ( std::list< ::com::sun::star::uno::Reference
1376 - < ::com::sun::star::awt::XTabListener > >::iterator it
1377 + for ( std::list< uno::Reference
1378 + < awt::XTabListener > >::iterator it
1379 = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
1381 if ( *it == xListener )
1382 @@ -187,7 +192,7 @@ void SAL_CALL VCLXTabControl::removeTabL
1386 -void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (RuntimeException, IndexOutOfBoundsException)
1387 +void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const uno::Sequence< NamedValue >& Properties ) throw (uno::RuntimeException, IndexOutOfBoundsException)
1389 TabControl *pTabControl = getTabControl();
1390 if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
1391 @@ -196,7 +201,7 @@ void SAL_CALL VCLXTabControl::setTabProp
1392 for ( int i = 0; i < Properties.getLength(); i++ )
1394 const rtl::OUString &name = Properties[i].Name;
1395 - const Any &value = Properties[i].Value;
1396 + const uno::Any &value = Properties[i].Value;
1398 if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) )
1400 @@ -206,8 +211,8 @@ void SAL_CALL VCLXTabControl::setTabProp
1404 -Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
1405 - throw (IndexOutOfBoundsException, RuntimeException)
1406 +uno::Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
1407 + throw (IndexOutOfBoundsException, uno::RuntimeException)
1409 TabControl *pTabControl = getTabControl();
1410 if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
1411 @@ -216,11 +221,11 @@ Sequence< NamedValue > SAL_CALL VCLXTabC
1412 #define ADD_PROP( seq, i, name, val ) { \
1414 value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
1415 - value.Value = makeAny( val ); \
1416 + value.Value = uno::makeAny( val ); \
1420 - Sequence< NamedValue > props( 2 );
1421 + uno::Sequence< NamedValue > props( 2 );
1422 ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) );
1423 ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) );
1425 @@ -228,7 +233,7 @@ Sequence< NamedValue > SAL_CALL VCLXTabC
1428 // TODO: draw tab border here
1429 -void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
1430 +void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(uno::RuntimeException)
1432 ::vos::OGuard aGuard( GetMutex() );
1434 @@ -249,16 +254,25 @@ void SAL_CALL VCLXTabControl::draw( sal_
1435 VCLXWindow::draw( nX, nY );
1438 +void VCLXTabControl::AddChild (uno::Reference< awt::XLayoutConstrains > const& xChild)
1441 + OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
1442 + mIdMap[ xChild ] = mTabId++;
1443 + Box_Base::AddChild( xChild );
1444 + OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
1447 void SAL_CALL VCLXTabControl::addChild(
1448 - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild )
1449 - throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException)
1450 + const uno::Reference< awt::XLayoutConstrains > &xChild )
1451 + throw (uno::RuntimeException, awt::MaxChildrenException)
1453 mIdMap[ xChild ] = insertTab();
1454 Box_Base::addChild( xChild );
1457 -void SAL_CALL VCLXTabControl::removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild )
1458 - throw (::com::sun::star::uno::RuntimeException)
1459 +void SAL_CALL VCLXTabControl::removeChild( const uno::Reference< awt::XLayoutConstrains > &xChild )
1460 + throw (uno::RuntimeException)
1462 removeTab( mIdMap[xChild] );
1463 mIdMap[ xChild ] = -1;
1464 @@ -284,22 +298,87 @@ static void setChildrenVisible( uno::Ref
1468 -void SAL_CALL VCLXTabControl::allocateArea(
1469 - const ::com::sun::star::awt::Rectangle &rArea )
1470 - throw (::com::sun::star::uno::RuntimeException)
1471 +void SAL_CALL VCLXTabControl::allocateArea (awt::Rectangle const &area)
1472 + throw (uno::RuntimeException)
1474 - maAllocation = rArea;
1475 + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
1476 + maAllocation = area;
1478 TabControl *pTabControl = getTabControl();
1480 -// FIXME: this is wrong. We just want to set tab controls pos/size for the tabs menu,
1481 -// otherwise, it gets events that should go to children (I guess we could solve this
1482 -// by making the tabcontrol as the actual XWindow parent of its children, when importing...)
1483 -// Not sure about TabPage drawing... That doesn't work on gtk+; just ignoring that.
1484 -// LATER: Nah, the proper fix is to get the XWindow hierarchy straight.
1485 +// FIXME: this is wrong. We just want to set tab controls pos/size for
1486 +// the tabs menu, otherwise, it gets events that should go to children
1487 +// (I guess we could solve this by making the tabcontrol as the actual
1488 +// XWindow parent of its children, when importing...) Not sure about
1489 +// TabPage drawing... That doesn't work on gtk+; just ignoring that.
1490 +// LATER: Nah, the proper fix is to get the XWindow hierarchy
1494 + setPosSize( area.X, area.Y, area.Width, area.Height, awt::PosSize::POSSIZE );
1496 + awt::Size currentSize = getSize();
1497 + awt::Size requestedSize (area.Width, area.Height);
1498 +// requestedSize.Height = getHeightForWidth( area.Width );
1500 + awt::Size minimumSize = getMinimumSize();
1501 + if (requestedSize.Width < minimumSize.Width)
1502 + requestedSize.Width = minimumSize.Width;
1503 + if (requestedSize.Height < minimumSize.Height)
1504 + requestedSize.Height = minimumSize.Height;
1506 + Size pageSize = static_cast<TabControl*> (GetWindow ())->GetTabPageSizePixel ();
1507 + awt::Size pageBasedSize (0, 0);
1508 + pageBasedSize.Width = pageSize.Width ();
1509 + pageBasedSize.Height = pageSize.Height ();
1512 + const int hc = 20;
1513 + static int pwc = 0;
1514 + static int phc = 40;
1516 + if (requestedSize.Width < pageBasedSize.Width)
1517 + requestedSize.Width = pageBasedSize.Width + wc;
1518 + if (requestedSize.Height < pageBasedSize.Height)
1519 + requestedSize.Height = pageBasedSize.Height + hc;
1521 + Size windowSize = GetWindow()->GetSizePixel();
1522 + Window *parent = GetWindow()->GetParent();
1523 + Size parentSize = parent->GetSizePixel();
1526 + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
1527 +#endif /* GCC_MAJOR */
1528 + OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
1529 + OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
1530 + OSL_TRACE ("%s: minimum: %d, %d", __FUNCTION__, minimumSize.Width, minimumSize.Height );
1531 + OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
1532 + OSL_TRACE ("%s: pageBasedSize: %d, %d", __FUNCTION__, pageBasedSize.Width, pageBasedSize.Height );
1534 - setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE );
1535 + //OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
1536 + //OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
1538 + //bRealized = false;
1541 + setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::POSSIZE );
1546 + if ( requestedSize.Width > currentSize.Width + 10)
1547 + setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
1548 + if ( requestedSize.Height > currentSize.Height + 10)
1549 + setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
1553 + if (pageBasedSize.Width > parentSize.Width ()
1554 + || pageBasedSize.Height > parentSize.Height ())
1555 + //parent->SetSizePixel ( Size (pageBasedSize.Width, pageBasedSize.Height));
1556 + //parent->SetSizePixel ( Size (pageBasedSize.Width + pwc, pageBasedSize.Height + phc));
1557 + parent->SetSizePixel ( Size (requestedSize.Width + pwc, requestedSize.Height + phc));
1559 // FIXME: we can save cycles by setting visibility more sensibly. Having
1560 // it here does makes it easier when changing tabs (just needs a recalc())
1562 @@ -307,8 +386,8 @@ void SAL_CALL VCLXTabControl::allocateAr
1563 = maChildren.begin(); it != maChildren.end(); it++, i++ )
1565 ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it );
1566 - ::com::sun::star::uno::Reference
1567 - < ::com::sun::star::awt::XLayoutConstrains > xChild( child->mxChild );
1569 + < awt::XLayoutConstrains > xChild( child->mxChild );
1572 uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY );
1573 @@ -340,15 +419,15 @@ void SAL_CALL VCLXTabControl::allocateAr
1577 -::com::sun::star::awt::Size SAL_CALL VCLXTabControl::getMinimumSize()
1578 - throw(::com::sun::star::uno::RuntimeException)
1579 +awt::Size SAL_CALL VCLXTabControl::getMinimumSize()
1580 + throw(uno::RuntimeException)
1582 - awt::Size size = VCLXWindow::getMinimumSize();
1583 + awt::Size requestedSize = VCLXWindow::getMinimumSize();
1584 awt::Size childrenSize( 0, 0 );
1586 TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
1589 + return requestedSize;
1591 // calculate size to accomodate all children
1593 @@ -367,10 +446,17 @@ void SAL_CALL VCLXTabControl::allocateAr
1597 - size.Width += childrenSize.Width;
1598 - size.Height += childrenSize.Height + 20;
1599 - maRequisition = size;
1602 + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
1603 +#endif /* GCC_MAJOR */
1604 + OSL_TRACE ("%s: children: %d", __FUNCTION__, i);
1605 + OSL_TRACE ("%s: childrenSize: %d, %d", __FUNCTION__, childrenSize.Width, childrenSize.Height );
1607 + requestedSize.Width += childrenSize.Width;
1608 + requestedSize.Height += childrenSize.Height + 20;
1610 + maRequisition = requestedSize;
1611 + return requestedSize;
1614 void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
1615 @@ -391,12 +477,12 @@ void VCLXTabControl::ProcessWindowEvent(
1616 case VCLEVENT_TABPAGE_PAGETEXTCHANGED:
1618 ULONG page = (ULONG) _rVclWindowEvent.GetData();
1619 - for ( std::list< ::com::sun::star::uno::Reference
1620 - < ::com::sun::star::awt::XTabListener > >::iterator it
1621 + for ( std::list< uno::Reference
1622 + < awt::XTabListener > >::iterator it
1623 = mxTabListeners.begin(); it != mxTabListeners.end(); it++)
1625 - ::com::sun::star::uno::Reference
1626 - < ::com::sun::star::awt::XTabListener > listener = *it;
1628 + < awt::XTabListener > listener = *it;
1630 switch ( _rVclWindowEvent.GetId() )
1632 @@ -414,7 +500,7 @@ void VCLXTabControl::ProcessWindowEvent(
1633 listener->removed( page );
1635 case VCLEVENT_TABPAGE_REMOVEDALL:
1636 - for ( int i = 1; i < mnNextTabId; i++)
1637 + for ( int i = 1; i < mTabId; i++)
1639 if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( i ) ) )
1640 listener->removed( i );
1641 @@ -434,12 +520,12 @@ void VCLXTabControl::ProcessWindowEvent(
1645 -void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException)
1646 +void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const uno::Any &Value ) throw(uno::RuntimeException)
1648 VCLXWindow::setProperty( PropertyName, Value );
1651 -Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
1652 +uno::Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(uno::RuntimeException)
1654 return VCLXWindow::getProperty( PropertyName );
1656 --- toolkit/source/awt/vclxtabcontrol.hxx.old 2009-04-02 10:49:36.000000000 +0000
1657 +++ toolkit/source/awt/vclxtabcontrol.hxx 2009-04-06 16:42:13.000000000 +0000
1660 #include <com/sun/star/awt/XSimpleTabController.hpp>
1661 #include <comphelper/uno3.hxx>
1662 -#include <layout/box-base.hxx>
1663 +#include <layout/core/box-base.hxx>
1665 #include <toolkit/awt/vclxwindow.hxx>
1667 @@ -50,9 +50,14 @@ class VCLXTabControl :public VCLXWindow
1668 ,public VCLXTabControl_Base
1677 + void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &);
1682 @@ -65,7 +70,7 @@ protected:
1684 void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
1686 - virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException);
1687 + virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException);
1689 // XSimpleTabController
1690 virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
1691 @@ -108,10 +113,6 @@ protected:
1693 void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
1696 - // Each tab page needs an unique id.
1700 // Maps page ids to child references
1701 struct ChildData : public Box_Base::ChildData
1702 --- toolkit/source/awt/vclxtabpage.cxx.old 2009-04-06 16:42:11.000000000 +0000
1703 +++ toolkit/source/awt/vclxtabpage.cxx 2009-04-06 16:42:13.000000000 +0000
1705 #include <vcl/tabpage.hxx>
1706 #include <vcl/tabctrl.hxx>
1708 +#if !defined (__GNUC__)
1709 +#define __PRETTY_FUNCTION__ __FUNCTION__
1710 +#endif /* !__GNUC__ */
1712 namespace layoutimpl
1715 @@ -72,7 +76,7 @@ void SAL_CALL VCLXTabPage::dispose() thr
1716 ::vos::OGuard aGuard( GetMutex() );
1718 lang::EventObject aDisposeEvent;
1719 - aDisposeEvent.Source = *this;
1720 + aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
1723 VCLXWindow::dispose();
1724 @@ -81,44 +85,58 @@ void SAL_CALL VCLXTabPage::dispose() thr
1725 void SAL_CALL VCLXTabPage::allocateArea( awt::Rectangle const& area )
1726 throw (uno::RuntimeException)
1728 - awt::Size curSize = getSize();
1729 - awt::Size reqSize = getMinimumSize();
1730 - reqSize.Height = getHeightForWidth( area.Width );
1732 - if ( curSize.Width > 0 && curSize.Height > 0
1733 - && reqSize.Width > curSize.Width )
1734 - reqSize.Width = curSize.Width;
1735 - if ( curSize.Width > 0 && curSize.Height > 0
1736 - && reqSize.Height > curSize.Height )
1737 - reqSize.Height = curSize.Height;
1738 + awt::Size currentSize = getSize();
1739 + awt::Size requestedSize = getMinimumSize();
1740 + requestedSize.Height = getHeightForWidth( area.Width );
1742 + if ( currentSize.Width > 0 && currentSize.Height > 0
1743 + && requestedSize.Width > currentSize.Width )
1744 + requestedSize.Width = currentSize.Width;
1745 + if ( currentSize.Width > 0 && currentSize.Height > 0
1746 + && requestedSize.Height > currentSize.Height )
1747 + requestedSize.Height = currentSize.Height;
1749 // FIXME: missing destructor?
1753 - Size window = GetWindow()->GetSizePixel();
1754 - Size parent = GetWindow()->GetParent()->GetSizePixel();
1755 + Size windowSize = GetWindow()->GetSizePixel();
1756 + Window *parent = GetWindow()->GetParent();
1757 + Size parentSize = parent->GetSizePixel();
1759 Point pos = GetWindow()->GetPosPixel();
1760 + OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
1761 OSL_TRACE ("%s: curpos: %d ,%d", __FUNCTION__, pos.X(), pos.Y() );
1763 - OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, curSize.Width, curSize.Height );
1764 + OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
1765 OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
1766 - OSL_TRACE ("%s: reqSize: %d, %d", __FUNCTION__, reqSize.Width, reqSize.Height );
1767 - OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parent.Width(), parent.Height() );
1768 - OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, window.Width(), window.Height() );
1769 + OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
1770 + OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
1771 + OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
1774 + if (requestedSize.Width > parentSize.Width ()
1775 + || requestedSize.Height > parentSize.Height ())
1777 + OSL_TRACE ("%s: ***setting parent: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
1778 + parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
1780 + if (Window *grand_parent = parent->GetParent ())
1781 + grand_parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
1787 - setPosSize( 0, 0, reqSize.Width, reqSize.Height, awt::PosSize::SIZE );
1788 + setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::SIZE );
1793 - if ( reqSize.Width > curSize.Width )
1794 - setPosSize( 0, 0, reqSize.Width, 0, awt::PosSize::WIDTH );
1795 - if ( reqSize.Height > curSize.Height )
1796 - setPosSize( 0, 0, 0, reqSize.Height, awt::PosSize::HEIGHT );
1797 + if ( requestedSize.Width > currentSize.Width + 10)
1798 + setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
1799 + if ( requestedSize.Height > currentSize.Height + 10)
1800 + setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
1803 awt::Size newSize = getSize();
1804 --- toolkit/source/awt/vclxtabpage.hxx.old 2009-04-06 16:42:11.000000000 +0000
1805 +++ toolkit/source/awt/vclxtabpage.hxx 2009-04-06 16:42:13.000000000 +0000
1807 #define LAYOUT_AWT_VCLXTABPAGE_HXX
1809 #include <toolkit/awt/vclxwindow.hxx>
1810 -#include <layout/bin.hxx>
1811 +#include <layout/core/bin.hxx>
1812 #include <comphelper/uno3.hxx>
1814 namespace layoutimpl
1815 @@ -49,6 +49,7 @@ class VCLXTabPage : public VCLXWindow
1821 VCLXTabPage( Window *p );
1823 --- toolkit/source/awt/vclxwindow.cxx.old 2009-04-06 16:41:46.000000000 +0000
1824 +++ toolkit/source/awt/vclxwindow.cxx 2009-04-06 16:42:13.000000000 +0000
1825 @@ -402,6 +402,10 @@ void VCLXWindowImpl::disposing()
1826 aEvent.Source = mrAntiImpl;
1828 maEventListeners.disposeAndClear( aEvent );
1829 +#if 0 // ENABLE_LAYOUT
1830 + /* FIXME: see layout::~ComboBox () */
1831 + if (!dynamic_cast<VCLXComboBox*> (this))
1832 +#endif /* 0 ENABLE_LAYOUT */
1833 maFocusListeners.disposeAndClear( aEvent );
1834 maWindowListeners.disposeAndClear( aEvent );
1835 maKeyListeners.disposeAndClear( aEvent );
1836 --- toolkit/source/awt/vclxwindows.cxx.old 2009-04-06 16:41:46.000000000 +0000
1837 +++ toolkit/source/awt/vclxwindows.cxx 2009-04-06 16:42:13.000000000 +0000
1838 @@ -417,6 +417,11 @@ VCLXButton::VCLXButton()
1842 +VCLXButton::~VCLXButton()
1844 + OSL_TRACE ("%s", __FUNCTION__);
1847 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
1849 return getAccessibleFactory().createAccessibleContext( this );
1850 @@ -1362,6 +1367,13 @@ void VCLXRadioButton::ImplClickedOrToggl
1854 +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
1856 + if (!maItemListeners.getLength ())
1857 + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
1858 + return maActionListeners.getElements()[0];
1861 // ----------------------------------------------------
1862 // class VCLXSpinField
1863 // ----------------------------------------------------
1864 @@ -2176,6 +2188,7 @@ VCLXDialog::VCLXDialog()
1866 VCLXDialog::~VCLXDialog()
1868 + OSL_TRACE ("%s", __FUNCTION__);
1871 // ::com::sun::star::uno::XInterface
1872 @@ -3744,6 +3757,11 @@ VCLXComboBox::VCLXComboBox()
1876 +VCLXComboBox::~VCLXComboBox()
1878 + OSL_TRACE ("%s", __FUNCTION__);
1881 // ::com::sun::star::uno::XInterface
1882 ::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1884 --- toolkit/source/layout/bin.cxx.old 2009-04-02 10:49:36.000000000 +0000
1885 +++ toolkit/source/layout/bin.cxx 1970-01-01 00:00:00.000000000 +0000
1887 -/*************************************************************************
1889 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1891 - * Copyright 2008 by Sun Microsystems, Inc.
1893 - * OpenOffice.org - a multi-platform office productivity suite
1895 - * $RCSfile: bin.cxx,v $
1897 - * $Revision: 1.3 $
1899 - * This file is part of OpenOffice.org.
1901 - * OpenOffice.org is free software: you can redistribute it and/or modify
1902 - * it under the terms of the GNU Lesser General Public License version 3
1903 - * only, as published by the Free Software Foundation.
1905 - * OpenOffice.org is distributed in the hope that it will be useful,
1906 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1907 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1908 - * GNU Lesser General Public License version 3 for more details
1909 - * (a copy is included in the LICENSE file that accompanied this code).
1911 - * You should have received a copy of the GNU Lesser General Public License
1912 - * version 3 along with OpenOffice.org. If not, see
1913 - * <http://www.openoffice.org/license.html>
1914 - * for a copy of the LGPLv3 License.
1916 - ************************************************************************/
1920 -#include <sal/macros.h>
1922 -namespace layoutimpl
1925 -using namespace css;
1929 -Bin::Bin() : Container()
1934 -Bin::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
1935 - throw (uno::RuntimeException, awt::MaxChildrenException)
1937 - if ( mxChild.is() )
1938 - throw awt::MaxChildrenException();
1939 - if ( xChild.is() )
1942 - setChildParent( xChild );
1948 -Bin::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
1949 - throw (uno::RuntimeException)
1951 - if ( xChild == mxChild )
1953 - mxChild = uno::Reference< awt::XLayoutConstrains >();
1954 - unsetChildParent( xChild );
1959 -uno::Sequence< uno::Reference< awt::XLayoutConstrains > > SAL_CALL
1961 - throw (uno::RuntimeException)
1963 - return getSingleChild (mxChild);
1967 -Bin::allocateArea( const awt::Rectangle &rArea )
1968 - throw (uno::RuntimeException)
1970 - maAllocation = rArea;
1971 - if ( mxChild.is() )
1972 - allocateChildAt( mxChild, rArea );
1976 -Bin::getMinimumSize()
1977 - throw(uno::RuntimeException)
1979 - if ( mxChild.is() )
1980 - return maRequisition = maChildRequisition = mxChild->getMinimumSize();
1981 - return maRequisition = awt::Size( 0, 0 );
1984 -uno::Reference< beans::XPropertySet > SAL_CALL
1985 -Bin::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& )
1986 - throw (uno::RuntimeException)
1988 - return uno::Reference< beans::XPropertySet >();
1992 -Bin::hasHeightForWidth()
1993 - throw(uno::RuntimeException)
1995 - uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
1996 - if ( xChildCont.is() )
1997 - return xChildCont->hasHeightForWidth();
2002 -Bin::getHeightForWidth( sal_Int32 nWidth )
2003 - throw(uno::RuntimeException)
2005 - uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
2006 - if ( xChildCont.is() )
2007 - return xChildCont->getHeightForWidth( nWidth );
2008 - return maRequisition.Height;
2013 -Align::Align() : Bin()
2015 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Halign" ),
2016 - ::getCppuType( static_cast< const float* >( NULL ) ),
2018 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Valign" ),
2019 - ::getCppuType( static_cast< const float* >( NULL ) ),
2021 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Hfill" ),
2022 - ::getCppuType( static_cast< const float* >( NULL ) ),
2024 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Vfill" ),
2025 - ::getCppuType( static_cast< const float* >( NULL ) ),
2028 - fHorAlign = fVerAlign = 0.5;
2029 - fHorFill = fVerFill = 0;
2033 -Align::allocateArea( const awt::Rectangle &rArea )
2034 - throw (uno::RuntimeException)
2036 - maAllocation = rArea;
2037 - if ( !mxChild.is() )
2040 - awt::Rectangle aChildArea;
2041 - aChildArea.Width = SAL_MIN( rArea.Width, maChildRequisition.Width );
2042 - aChildArea.Width += (sal_Int32) SAL_MAX(
2043 - 0, (rArea.Width - maChildRequisition.Width) * fHorFill );
2044 - aChildArea.Height = SAL_MIN( rArea.Height, maChildRequisition.Height );
2045 - aChildArea.Height += (sal_Int32) SAL_MAX(
2046 - 0, (rArea.Height - maChildRequisition.Height) * fVerFill );
2048 - aChildArea.X = rArea.X + (sal_Int32)( (rArea.Width - aChildArea.Width) * fHorAlign );
2049 - aChildArea.Y = rArea.Y + (sal_Int32)( (rArea.Height - aChildArea.Height) * fVerAlign );
2051 - allocateChildAt( mxChild, aChildArea );
2056 -MinSize::MinSize() : Bin()
2058 - mnMinWidth = mnMinHeight = 0;
2059 - addProp( RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ),
2060 - ::getCppuType( static_cast< const long* >( NULL ) ),
2062 - addProp( RTL_CONSTASCII_USTRINGPARAM( "MinHeight" ),
2063 - ::getCppuType( static_cast< const long* >( NULL ) ),
2067 -awt::Size SAL_CALL MinSize::getMinimumSize()
2068 - throw(uno::RuntimeException)
2070 - Bin::getMinimumSize();
2071 - maRequisition.Width = SAL_MAX( maRequisition.Width, mnMinWidth );
2072 - maRequisition.Height = SAL_MAX( maRequisition.Height, mnMinHeight );
2073 - return maRequisition;
2076 -} // namespace layoutimpl
2077 --- toolkit/source/layout/bin.hxx.old 2009-04-02 10:49:36.000000000 +0000
2078 +++ toolkit/source/layout/bin.hxx 1970-01-01 00:00:00.000000000 +0000
2080 -/*************************************************************************
2082 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2084 - * Copyright 2008 by Sun Microsystems, Inc.
2086 - * OpenOffice.org - a multi-platform office productivity suite
2088 - * $RCSfile: bin.hxx,v $
2090 - * $Revision: 1.3 $
2092 - * This file is part of OpenOffice.org.
2094 - * OpenOffice.org is free software: you can redistribute it and/or modify
2095 - * it under the terms of the GNU Lesser General Public License version 3
2096 - * only, as published by the Free Software Foundation.
2098 - * OpenOffice.org is distributed in the hope that it will be useful,
2099 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2100 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2101 - * GNU Lesser General Public License version 3 for more details
2102 - * (a copy is included in the LICENSE file that accompanied this code).
2104 - * You should have received a copy of the GNU Lesser General Public License
2105 - * version 3 along with OpenOffice.org. If not, see
2106 - * <http://www.openoffice.org/license.html>
2107 - * for a copy of the LGPLv3 License.
2109 - ************************************************************************/
2111 -/* A few simple binary containers */
2113 -#ifndef CORE_BIN_HXX
2114 -#define CORE_BIN_HXX
2116 -#include "container.hxx"
2118 -namespace layoutimpl
2121 -class Bin : public Container
2125 - css::awt::Size maChildRequisition;
2126 - css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
2132 - // css::awt::XLayoutContainer
2133 - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2134 - throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
2135 - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2136 - throw (css::uno::RuntimeException);
2138 - virtual css::uno::Sequence< css::uno::Reference
2139 - < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
2140 - throw (css::uno::RuntimeException);
2142 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
2143 - throw (css::uno::RuntimeException);
2145 - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
2146 - const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2147 - throw (css::uno::RuntimeException);
2149 - virtual sal_Bool SAL_CALL hasHeightForWidth()
2150 - throw(css::uno::RuntimeException);
2151 - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
2152 - throw(css::uno::RuntimeException);
2154 - // css::awt::XLayoutConstrains
2155 - virtual css::awt::Size SAL_CALL getMinimumSize()
2156 - throw(css::uno::RuntimeException);
2158 - PROPHELPER_SET_INFO
2161 -// Align gives control over child position on the allocated space.
2162 -class Align : public Bin
2164 - friend class AlignChildProps;
2167 - float fHorAlign, fVerAlign;
2168 - float fHorFill, fVerFill;
2173 - // css::awt::XLayoutContainer
2174 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
2175 - throw (css::uno::RuntimeException);
2177 - PROPHELPER_SET_INFO
2180 -// Makes child request its or a specified size, whatever is larger.
2181 -class MinSize : public Bin
2185 - long mnMinWidth, mnMinHeight;
2190 - // css::awt::XLayoutContainer
2191 - virtual css::awt::Size SAL_CALL getMinimumSize()
2192 - throw(css::uno::RuntimeException);
2194 - PROPHELPER_SET_INFO
2197 -} // namespace layoutimpl
2199 -#endif /*CORE_BIN_HXX*/
2200 --- toolkit/source/layout/box-base.cxx.old 2009-04-02 10:49:36.000000000 +0000
2201 +++ toolkit/source/layout/box-base.cxx 1970-01-01 00:00:00.000000000 +0000
2203 -/*************************************************************************
2205 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2207 - * Copyright 2008 by Sun Microsystems, Inc.
2209 - * OpenOffice.org - a multi-platform office productivity suite
2211 - * $RCSfile: box-base.cxx,v $
2213 - * $Revision: 1.2 $
2215 - * This file is part of OpenOffice.org.
2217 - * OpenOffice.org is free software: you can redistribute it and/or modify
2218 - * it under the terms of the GNU Lesser General Public License version 3
2219 - * only, as published by the Free Software Foundation.
2221 - * OpenOffice.org is distributed in the hope that it will be useful,
2222 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2223 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2224 - * GNU Lesser General Public License version 3 for more details
2225 - * (a copy is included in the LICENSE file that accompanied this code).
2227 - * You should have received a copy of the GNU Lesser General Public License
2228 - * version 3 along with OpenOffice.org. If not, see
2229 - * <http://www.openoffice.org/license.html>
2230 - * for a copy of the LGPLv3 License.
2232 - ************************************************************************/
2236 -#include <tools/debug.hxx>
2237 -#include <sal/macros.h>
2239 -#include <com/sun/star/awt/XWindow2.hpp>
2241 -// fixed point precision for distributing error
2242 -#define FIXED_PT 16
2244 -namespace layoutimpl
2247 -using namespace css;
2249 -Box_Base::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
2250 - : mxChild( xChild )
2256 -static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget )
2258 - if ( !xWidget.is() )
2260 - DBG_ERROR( "FIXME: invalid child !" );
2264 - uno::Reference< awt::XWindow2 > xWindow( xWidget, uno::UNO_QUERY );
2265 - if ( xWindow.is() && !xWindow->isVisible() )
2268 - uno::Reference< awt::XLayoutContainer > xContainer( xWidget, uno::UNO_QUERY );
2269 - if ( xContainer.is() )
2271 - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren
2272 - = xContainer->getChildren();
2274 - // FIXME: <flow> workaround: empty visible containers always visible:
2275 - if ( !aChildren.getLength() )
2278 - for ( int i = 0; i < aChildren.getLength(); i++ )
2279 - if ( isVisible( aChildren[i] ) )
2281 - return false; // this would kill flow without workaround above
2287 -bool Box_Base::ChildData::isVisible()
2289 - // FIXME: call the 'isVisible' method on it ?
2290 - return layoutimpl::isVisible( mxChild );
2294 -Box_Base::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
2295 - throw (uno::RuntimeException, awt::MaxChildrenException)
2297 - if ( xChild.is() )
2299 - ChildData *pData = createChild( xChild );
2300 - maChildren.push_back( pData );
2301 - setChildParent( xChild );
2306 -Box_Base::ChildData*
2307 -Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
2309 - for ( std::list< ChildData* >::iterator it = lst.begin();
2310 - it != lst.end(); it++ )
2312 - if ( (*it)->mxChild == xChild )
2322 -Box_Base::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
2323 - throw (uno::RuntimeException)
2325 - if ( ChildData* p = removeChildData( maChildren, xChild ) )
2328 - unsetChildParent( xChild );
2333 - DBG_ERROR( "Box_Base: removeChild: no such child" );
2337 -uno::Sequence< uno::Reference < awt::XLayoutConstrains > > SAL_CALL
2338 -Box_Base::getChildren()
2339 - throw (uno::RuntimeException)
2341 - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
2342 - unsigned int index = 0;
2343 - for ( std::list< ChildData* >::iterator it = maChildren.begin();
2344 - it != maChildren.end(); it++, index++ )
2345 - children[index] = ( *it )->mxChild;
2350 -uno::Reference< beans::XPropertySet > SAL_CALL
2351 -Box_Base::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& xChild )
2352 - throw (uno::RuntimeException)
2355 - for ( std::list< ChildData * >::iterator it = maChildren.begin();
2356 - it != maChildren.end(); it++)
2358 - if ( ( *it )->mxChild == xChild )
2360 - if ( !( *it )->mxProps.is() )
2362 - PropHelper *pProps = createChildProps( *it );
2363 - pProps->setChangeListener( this );
2364 - ( *it )->mxProps = pProps;
2366 - return (*it)->mxProps;
2369 - return uno::Reference< beans::XPropertySet >();
2372 -} // namespace layoutimpl
2373 --- toolkit/source/layout/box-base.hxx.old 2009-04-06 16:42:11.000000000 +0000
2374 +++ toolkit/source/layout/box-base.hxx 1970-01-01 00:00:00.000000000 +0000
2376 -/*************************************************************************
2378 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2380 - * Copyright 2008 by Sun Microsystems, Inc.
2382 - * OpenOffice.org - a multi-platform office productivity suite
2384 - * $RCSfile: box-base.hxx,v $
2386 - * $Revision: 1.2 $
2388 - * This file is part of OpenOffice.org.
2390 - * OpenOffice.org is free software: you can redistribute it and/or modify
2391 - * it under the terms of the GNU Lesser General Public License version 3
2392 - * only, as published by the Free Software Foundation.
2394 - * OpenOffice.org is distributed in the hope that it will be useful,
2395 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2396 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2397 - * GNU Lesser General Public License version 3 for more details
2398 - * (a copy is included in the LICENSE file that accompanied this code).
2400 - * You should have received a copy of the GNU Lesser General Public License
2401 - * version 3 along with OpenOffice.org. If not, see
2402 - * <http://www.openoffice.org/license.html>
2403 - * for a copy of the LGPLv3 License.
2405 - ************************************************************************/
2407 -#ifndef CORE_BOX_BASE_HXX
2408 -#define CORE_BOX_BASE_HXX
2410 -#include "container.hxx"
2414 -namespace layoutimpl
2417 -class Box_Base : public Container
2420 - // Children properties
2423 - css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
2424 - css::uno::Reference< css::beans::XPropertySet > mxProps;
2425 - css::awt::Size maRequisition;
2426 - virtual bool isVisible();
2428 - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
2429 - virtual ~ChildData() { };
2432 - struct ChildProps: public PropHelper
2434 - //ChildProps( ChildProps* );
2435 - PROPHELPER_SET_INFO
2439 - std::list< ChildData* > maChildren;
2442 - virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
2443 - virtual ChildProps *createChildProps( ChildData* pData ) = 0;
2445 - ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
2448 - // css::awt::XLayoutContainer
2449 - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2450 - throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
2451 - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2452 - throw (css::uno::RuntimeException);
2454 - virtual css::uno::Sequence< css::uno::Reference
2455 - < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
2456 - throw (css::uno::RuntimeException);
2458 - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
2459 - const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
2460 - throw (css::uno::RuntimeException);
2463 -} // namespace layoutimpl
2465 -#endif /* CORE_BOX_BASE HXX */
2466 --- toolkit/source/layout/box.cxx.old 2009-04-02 10:49:36.000000000 +0000
2467 +++ toolkit/source/layout/box.cxx 1970-01-01 00:00:00.000000000 +0000
2469 -/*************************************************************************
2471 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2473 - * Copyright 2008 by Sun Microsystems, Inc.
2475 - * OpenOffice.org - a multi-platform office productivity suite
2477 - * $RCSfile: box.cxx,v $
2479 - * $Revision: 1.3 $
2481 - * This file is part of OpenOffice.org.
2483 - * OpenOffice.org is free software: you can redistribute it and/or modify
2484 - * it under the terms of the GNU Lesser General Public License version 3
2485 - * only, as published by the Free Software Foundation.
2487 - * OpenOffice.org is distributed in the hope that it will be useful,
2488 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2489 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2490 - * GNU Lesser General Public License version 3 for more details
2491 - * (a copy is included in the LICENSE file that accompanied this code).
2493 - * You should have received a copy of the GNU Lesser General Public License
2494 - * version 3 along with OpenOffice.org. If not, see
2495 - * <http://www.openoffice.org/license.html>
2496 - * for a copy of the LGPLv3 License.
2498 - ************************************************************************/
2502 -#include <tools/debug.hxx>
2503 -#include <sal/macros.h>
2505 -// fixed point precision for distributing error
2506 -#define FIXED_PT 16
2508 -namespace layoutimpl
2511 -using namespace css;
2513 -Box::ChildProps::ChildProps( Box::ChildData *pData )
2515 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Expand" ),
2516 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
2517 - &(pData->mbExpand) );
2518 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Fill" ),
2519 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
2520 - &(pData->mbFill) );
2521 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Padding" ),
2522 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
2523 - &(pData->mnPadding) );
2526 -Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
2527 - : Box_Base::ChildData( xChild )
2529 - , mbExpand( true )
2535 -Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
2537 - return new ChildData( xChild );
2541 -Box::createChildProps( Box_Base::ChildData *pData )
2543 - return new ChildProps( static_cast<Box::ChildData*> ( pData ) );
2546 -Box::Box( bool horizontal )
2549 - , mbHomogeneous( false )
2550 - , mbHorizontal( horizontal )
2552 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
2553 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
2555 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
2556 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
2558 - mbHasFlowChildren = false;
2562 -Box::calculateSize( long nWidth )
2564 - int nVisibleChildren = 0;
2565 - // primary vs secundary axis (instead of a X and Y)
2566 - int nPrimSize = 0;
2568 - int nFlowMinWidth = 0; // in case the box only has flow children
2570 - mbHasFlowChildren = false;
2572 - for ( std::list<Box_Base::ChildData *>::const_iterator it
2573 - = maChildren.begin(); it != maChildren.end(); it++ )
2575 - ChildData *child = static_cast<Box::ChildData*> ( *it );
2576 - if ( !child->isVisible() )
2579 - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
2580 - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
2582 - awt::Size aChildSize = child->maRequisition = child->mxChild->getMinimumSize();
2584 - if ( !mbHorizontal /*vertical*/ && bFlow )
2586 - if ( nFlowMinWidth == 0 || nFlowMinWidth > aChildSize.Width )
2587 - nFlowMinWidth = aChildSize.Width;
2588 - mbHasFlowChildren = true;
2592 - int size = primDim( aChildSize ) + child->mnPadding * 2;
2593 - if ( mbHomogeneous )
2594 - nPrimSize = SAL_MAX( nPrimSize, size );
2596 - nPrimSize += size;
2598 - nSecSize = SAL_MAX( nSecSize, secDim( aChildSize ) );
2600 - nVisibleChildren++;
2603 - if ( nVisibleChildren )
2605 - if ( mbHomogeneous )
2606 - nPrimSize *= nVisibleChildren;
2607 - nPrimSize += (nVisibleChildren - 1) * mnSpacing;
2610 - if ( mbHasFlowChildren )
2612 - if ( nWidth == 0 )
2613 - nWidth = nSecSize ? nSecSize : nFlowMinWidth;
2614 - for ( std::list<Box_Base::ChildData *>::const_iterator it
2615 - = maChildren.begin(); it != maChildren.end(); it++ )
2617 - ChildData *child = static_cast<Box::ChildData*> ( *it );
2618 - if ( !child->isVisible() )
2621 - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
2622 - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
2625 - nPrimSize += xChildCont->getHeightForWidth( nWidth );
2629 - nPrimSize += mnBorderWidth * 2;
2630 - nSecSize += mnBorderWidth * 2;
2631 - return awt::Size( mbHorizontal ? nPrimSize : nSecSize,
2632 - mbHorizontal ? nSecSize : nPrimSize );
2636 -Box::getMinimumSize() throw(uno::RuntimeException)
2638 - maRequisition = calculateSize();
2639 - return maRequisition;
2643 -Box::hasHeightForWidth()
2644 - throw(uno::RuntimeException)
2646 - return mbHasFlowChildren;
2650 -Box::getHeightForWidth( sal_Int32 nWidth )
2651 - throw(uno::RuntimeException)
2653 - if ( hasHeightForWidth() )
2654 - return calculateSize( nWidth ).Height;
2655 - return maRequisition.Height;
2659 -Box::allocateArea( const awt::Rectangle &newArea )
2660 - throw (uno::RuntimeException)
2662 - maAllocation = newArea;
2663 - int nVisibleChildren = 0, nExpandChildren = 0;
2665 - for ( std::list<Box_Base::ChildData *>::const_iterator it
2666 - = maChildren.begin(); it != maChildren.end(); it++ )
2668 - ChildData *child = static_cast<Box::ChildData*> ( *it );
2669 - if ( child->isVisible() )
2671 - nVisibleChildren++;
2672 - if ( child->mbExpand )
2673 - nExpandChildren++;
2676 - if ( !nVisibleChildren )
2679 - // split rectangle for dimension helpers
2680 - awt::Point newPoint( newArea.X, newArea.Y );
2681 - awt::Size newSize( newArea.Width, newArea.Height );
2684 - if ( mbHomogeneous )
2685 - nExtraSpace = ( ( primDim( newSize ) - mnBorderWidth * 2 -
2686 - ( nVisibleChildren - 1 ) * mnSpacing )) / nVisibleChildren;
2687 - else if ( nExpandChildren )
2689 - int reqSize = primDim( maRequisition );
2690 - if ( !mbHorizontal && hasHeightForWidth() )
2691 - reqSize = getHeightForWidth( newArea.Width );
2692 - nExtraSpace = ( primDim( newSize ) - reqSize ) / nExpandChildren;
2697 - int nChildPrimPoint, nChildSecPoint, nChildPrimSize, nChildSecSize;
2699 - int nStartPoint = primDim( newPoint ) + mnBorderWidth;
2700 - int nBoxSecSize = SAL_MAX( 1, secDim( newSize ) - mnBorderWidth * 2 );
2702 - for ( std::list<Box_Base::ChildData *>::const_iterator it
2703 - = maChildren.begin(); it != maChildren.end(); it++ )
2705 - ChildData *child = static_cast<Box::ChildData*> ( *it );
2706 - if ( !child->isVisible() )
2709 - awt::Point aChildPos;
2710 - int nBoxPrimSize; // of the available box space
2712 - if ( mbHomogeneous )
2713 - nBoxPrimSize = nExtraSpace;
2716 - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
2717 - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
2718 - if ( !mbHorizontal && bFlow )
2719 - nBoxPrimSize = xChildCont->getHeightForWidth( newArea.Width );
2721 - nBoxPrimSize = primDim( child->maRequisition );
2722 - nBoxPrimSize += child->mnPadding;
2723 - if ( child->mbExpand )
2724 - nBoxPrimSize += nExtraSpace;
2727 - nChildPrimPoint = nStartPoint + child->mnPadding;
2728 - nChildSecPoint = secDim( newPoint ) + mnBorderWidth;
2730 - nChildSecSize = nBoxSecSize;
2731 - if ( child->mbFill )
2732 - nChildPrimSize = SAL_MAX( 1, nBoxPrimSize - child->mnPadding);
2735 - nChildPrimSize = primDim( child->maRequisition );
2736 - nChildPrimPoint += (nBoxPrimSize - nChildPrimSize) / 2;
2738 - nChildSecPoint += (nBoxSecSize - nChildSecSize) / 2;
2741 - awt::Rectangle area;
2742 - area.X = mbHorizontal ? nChildPrimPoint : nChildSecPoint;
2743 - area.Y = mbHorizontal ? nChildSecPoint : nChildPrimPoint;
2744 - area.Width = mbHorizontal ? nChildPrimSize : nChildSecSize;
2745 - area.Height = mbHorizontal ? nChildSecSize : nChildPrimSize;
2747 - allocateChildAt( child->mxChild, area );
2749 - nStartPoint += nBoxPrimSize + mnSpacing + child->mnPadding;
2753 -} // namespace layoutimpl
2754 --- toolkit/source/layout/box.hxx.old 2009-04-02 10:49:36.000000000 +0000
2755 +++ toolkit/source/layout/box.hxx 1970-01-01 00:00:00.000000000 +0000
2757 -/*************************************************************************
2759 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2761 - * Copyright 2008 by Sun Microsystems, Inc.
2763 - * OpenOffice.org - a multi-platform office productivity suite
2765 - * $RCSfile: box.hxx,v $
2767 - * $Revision: 1.3 $
2769 - * This file is part of OpenOffice.org.
2771 - * OpenOffice.org is free software: you can redistribute it and/or modify
2772 - * it under the terms of the GNU Lesser General Public License version 3
2773 - * only, as published by the Free Software Foundation.
2775 - * OpenOffice.org is distributed in the hope that it will be useful,
2776 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2777 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2778 - * GNU Lesser General Public License version 3 for more details
2779 - * (a copy is included in the LICENSE file that accompanied this code).
2781 - * You should have received a copy of the GNU Lesser General Public License
2782 - * version 3 along with OpenOffice.org. If not, see
2783 - * <http://www.openoffice.org/license.html>
2784 - * for a copy of the LGPLv3 License.
2786 - ************************************************************************/
2788 -#ifndef CORE_BOX_HXX
2789 -#define CORE_BOX_HXX
2791 -#include "box-base.hxx"
2793 -#include <com/sun/star/awt/Point.hpp>
2795 -namespace layoutimpl
2798 -class Box : public Box_Base
2801 - // Box properties (i.e. affect all children)
2802 - sal_Int32 mnSpacing;
2803 - sal_Bool mbHomogeneous;
2804 - sal_Bool mbHorizontal; // false for Vertical
2805 - bool mbHasFlowChildren;
2808 - // Children properties
2809 - struct ChildData : public Box_Base::ChildData
2811 - sal_Int32 mnPadding;
2812 - sal_Bool mbExpand;
2814 - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
2817 - struct ChildProps : public Box_Base::ChildProps
2819 - ChildProps( ChildData *pData );
2823 - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
2824 - ChildProps *createChildProps( Box_Base::ChildData* pData );
2827 - Box( bool horizontal );
2829 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
2830 - throw (css::uno::RuntimeException);
2832 - virtual css::awt::Size SAL_CALL getMinimumSize()
2833 - throw(css::uno::RuntimeException);
2834 - virtual sal_Bool SAL_CALL hasHeightForWidth()
2835 - throw(css::uno::RuntimeException);
2836 - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
2837 - throw(css::uno::RuntimeException);
2839 - // helper: mix of getMinimumSize() and getHeightForWidth()
2840 - css::awt::Size calculateSize( long nWidth = 0 );
2842 - PROPHELPER_SET_INFO
2845 - /* Helpers to deal with the joint Box directions. */
2846 - inline int primDim (const css::awt::Size &size)
2847 - { if (mbHorizontal) return size.Width; else return size.Height; }
2848 - inline int secDim (const css::awt::Size &size)
2849 - { if (mbHorizontal) return size.Height; else return size.Width; }
2850 - inline int primDim (const css::awt::Point &point)
2851 - { if (mbHorizontal) return point.X; else return point.Y; }
2852 - inline int secDim (const css::awt::Point &point)
2853 - { if (mbHorizontal) return point.Y; else return point.X; }
2856 -struct VBox : public Box
2857 -{ VBox() : Box (false) {} };
2859 -struct HBox : public Box
2860 -{ HBox() : Box (true) {} };
2862 -} // namespace layoutimpl
2864 -#endif /* CORE_BOX_HXX */
2865 --- toolkit/source/layout/byteseq.cxx.old 2009-04-02 10:49:36.000000000 +0000
2866 +++ toolkit/source/layout/byteseq.cxx 1970-01-01 00:00:00.000000000 +0000
2868 -/*************************************************************************
2870 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2872 - * Copyright 2008 by Sun Microsystems, Inc.
2874 - * OpenOffice.org - a multi-platform office productivity suite
2876 - * $RCSfile: byteseq.cxx,v $
2877 - * $Revision: 1.4 $
2879 - * This file is part of OpenOffice.org.
2881 - * OpenOffice.org is free software: you can redistribute it and/or modify
2882 - * it under the terms of the GNU Lesser General Public License version 3
2883 - * only, as published by the Free Software Foundation.
2885 - * OpenOffice.org is distributed in the hope that it will be useful,
2886 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2887 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2888 - * GNU Lesser General Public License version 3 for more details
2889 - * (a copy is included in the LICENSE file that accompanied this code).
2891 - * You should have received a copy of the GNU Lesser General Public License
2892 - * version 3 along with OpenOffice.org. If not, see
2893 - * <http://www.openoffice.org/license.html>
2894 - * for a copy of the LGPLv3 License.
2896 - ************************************************************************/
2898 -#include <com/sun/star/io/XInputStream.hpp>
2899 -#include <osl/file.hxx>
2900 -#include <comphelper/oslfile2streamwrap.hxx>
2903 -using osl::FileBase;
2904 -using namespace ::com::sun::star;
2906 -namespace layoutimpl
2909 -uno::Reference< io::XInputStream > getFileAsStream( const rtl::OUString &rName )
2911 - rtl::OUString sFileURL;
2912 - if( FileBase::E_None != FileBase::getFileURLFromSystemPath( rName, sFileURL ) )
2913 - sFileURL = rName; // maybe it already was a file url
2915 - File * blobFile = new File(sFileURL);
2916 - File::RC errorCode = blobFile->open(OpenFlag_Read);
2918 - uno::Reference<io::XInputStream> xResult;
2919 - switch (errorCode)
2921 - case osl::File::E_None: // got it
2922 - xResult.set( new comphelper::OSLInputStreamWrapper(blobFile,true) );
2925 - case osl::File::E_NOENT: // no file => no stream
2932 - rtl::OUStringBuffer sMsg;
2933 - sMsg.appendAscii("Cannot open output file \"");
2934 - sMsg.append(aURL);
2935 - sMsg.appendAscii("\" : ");
2936 - sMsg.append(configmgr::FileHelper::createOSLErrorString(errorCode));
2938 - throw io::IOException(sMsg.makeStringAndClear(),NULL);
2946 -} // namespace layoutimpl
2947 --- toolkit/source/layout/container.cxx.old 2009-04-02 10:49:36.000000000 +0000
2948 +++ toolkit/source/layout/container.cxx 1970-01-01 00:00:00.000000000 +0000
2950 -/*************************************************************************
2952 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2954 - * Copyright 2008 by Sun Microsystems, Inc.
2956 - * OpenOffice.org - a multi-platform office productivity suite
2958 - * $RCSfile: container.cxx,v $
2960 - * $Revision: 1.3 $
2962 - * This file is part of OpenOffice.org.
2964 - * OpenOffice.org is free software: you can redistribute it and/or modify
2965 - * it under the terms of the GNU Lesser General Public License version 3
2966 - * only, as published by the Free Software Foundation.
2968 - * OpenOffice.org is distributed in the hope that it will be useful,
2969 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2970 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2971 - * GNU Lesser General Public License version 3 for more details
2972 - * (a copy is included in the LICENSE file that accompanied this code).
2974 - * You should have received a copy of the GNU Lesser General Public License
2975 - * version 3 along with OpenOffice.org. If not, see
2976 - * <http://www.openoffice.org/license.html>
2977 - * for a copy of the LGPLv3 License.
2979 - ************************************************************************/
2981 -#include "container.hxx"
2983 -#include <com/sun/star/awt/XWindow.hpp>
2984 -#include <com/sun/star/awt/PosSize.hpp>
2985 -#include <tools/debug.hxx>
2987 -namespace layoutimpl {
2989 -using namespace css;
2991 -Container::Container()
2992 - : Container_Base()
2994 - , mnBorderWidth( 0 )
2996 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Border" ),
2997 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
2999 - setChangeListener( this );
3003 -Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException)
3005 - uno::Any aRet = Container_Base::queryInterface( rType );
3006 - return aRet.hasValue() ? aRet : PropHelper::queryInterface( rType );
3010 -Container::allocateChildAt( const uno::Reference< awt::XLayoutConstrains > &xChild,
3011 - const awt::Rectangle &rArea )
3012 - throw( uno::RuntimeException )
3014 - uno::Reference< awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY );
3016 - xCont->allocateArea( rArea );
3019 - uno::Reference< awt::XWindow > xWindow( xChild, uno::UNO_QUERY );
3020 - if ( xWindow.is() )
3021 - xWindow->setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height,
3022 - awt::PosSize::POSSIZE );
3025 - DBG_ERROR( "Error: non-sizeable child" );
3030 -uno::Sequence< uno::Reference< awt::XLayoutConstrains > >
3031 -Container::getSingleChild ( uno::Reference< awt::XLayoutConstrains >const &xChildOrNil )
3033 - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aSeq( ( xChildOrNil.is() ? 1 : 0 ) );
3034 - if ( xChildOrNil.is() )
3035 - aSeq[0] = xChildOrNil;
3040 -Container::queueResize()
3042 - if ( mxLayoutUnit.is() )
3043 - mxLayoutUnit->queueResize( uno::Reference< awt::XLayoutContainer >( this ) );
3047 -Container::setChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
3049 - uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
3050 - if ( xContChild.is() )
3052 - xContChild->setParent( uno::Reference< awt::XLayoutContainer >( this ) );
3054 - assert( !mxLayoutUnit.is() );
3055 - xContChild->setLayoutUnit( mxLayoutUnit );
3061 -Container::unsetChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
3063 - uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
3064 - if ( xContChild.is() )
3066 - xContChild->setParent( uno::Reference< awt::XLayoutContainer >() );
3068 - xContChild->setLayoutUnit( uno::Reference< awt::XLayoutUnit >() );
3075 -Container::getLabel() // debug label
3077 - std::string depth;
3078 - uno::Reference< awt::XLayoutContainer > xContainer( this );
3079 - while ( xContainer.is() )
3081 - int node = 0; // child nb
3082 - uno::Reference< awt::XLayoutContainer > xParent = xContainer->getContainerParent();
3083 - if ( xParent.is() )
3086 - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren;
3087 - aChildren = xParent->getChildren();
3088 - for ( node = 0; node < aChildren.getLength(); node++ )
3089 - if ( aChildren[ node ] == xContainer )
3094 - snprintf( str, 8, "%d", node );
3095 - if ( depth.empty() )
3096 - depth = std::string( str );
3098 - depth = std::string( str ) + ":" + depth;
3100 - xContainer = xParent;
3103 - return std::string( getName() ) + " (" + depth + ")";
3107 -void Container::propertiesChanged()
3109 - // cl: why this assertion? This is also called to set properties at the top level widget which has no parent!?
3110 - // DBG_ASSERT( mxParent.is(), "Properties listener: error container doesn't have parent" );
3112 - if ( mxLayoutUnit.is() && mxParent.is() )
3113 - mxLayoutUnit->queueResize( mxParent );
3117 --- toolkit/source/layout/container.hxx.old 2009-04-02 10:49:36.000000000 +0000
3118 +++ toolkit/source/layout/container.hxx 1970-01-01 00:00:00.000000000 +0000
3120 -/*************************************************************************
3122 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3124 - * Copyright 2008 by Sun Microsystems, Inc.
3126 - * OpenOffice.org - a multi-platform office productivity suite
3128 - * $RCSfile: container.hxx,v $
3130 - * $Revision: 1.3 $
3132 - * This file is part of OpenOffice.org.
3134 - * OpenOffice.org is free software: you can redistribute it and/or modify
3135 - * it under the terms of the GNU Lesser General Public License version 3
3136 - * only, as published by the Free Software Foundation.
3138 - * OpenOffice.org is distributed in the hope that it will be useful,
3139 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3140 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3141 - * GNU Lesser General Public License version 3 for more details
3142 - * (a copy is included in the LICENSE file that accompanied this code).
3144 - * You should have received a copy of the GNU Lesser General Public License
3145 - * version 3 along with OpenOffice.org. If not, see
3146 - * <http://www.openoffice.org/license.html>
3147 - * for a copy of the LGPLv3 License.
3149 - ************************************************************************/
3151 -#ifndef CORE_CONTAINER_HXX
3152 -#define CORE_CONTAINER_HXX
3154 -#include "helper.hxx"
3156 -#include <cppuhelper/implbase2.hxx>
3157 -#include <com/sun/star/awt/MaxChildrenException.hpp>
3159 -namespace layoutimpl
3161 -namespace css = ::com::sun::star;
3163 -typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer,
3164 - css::awt::XLayoutConstrains > Container_Base;
3166 -class Container : public Container_Base, public PropHelper, public PropHelper::Listener
3168 - friend class ChildProps;
3170 - // Widget properties
3171 - css::uno::Reference< css::awt::XLayoutContainer > mxParent;
3172 - css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
3173 - css::awt::Size maRequisition;
3174 - css::awt::Rectangle maAllocation;
3176 - // Container properties
3177 - sal_Int32 mnBorderWidth;
3180 - void allocateChildAt( const css::uno::Reference< css::awt::XLayoutConstrains > &xChild,
3181 - const css::awt::Rectangle &rArea )
3182 - throw (css::uno::RuntimeException);
3183 - static css::uno::Sequence< css::uno::Reference< css::awt::XLayoutConstrains > >
3184 - getSingleChild (const css::uno::Reference< css::awt::XLayoutConstrains > &xChildOrNil);
3185 - void setChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
3186 - void unsetChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
3188 - void queueResize();
3189 - void forceRecalc() { allocateArea( maAllocation ); }
3193 - virtual ~Container() {}
3196 - virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); }
3197 - virtual void SAL_CALL release() throw() { PropHelper::release(); }
3198 - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
3200 - // css::awt::XLayoutContainer
3201 - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3202 - throw (css::uno::RuntimeException, css::awt::MaxChildrenException) = 0;
3203 - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3204 - throw (css::uno::RuntimeException) = 0;
3206 - virtual css::uno::Sequence< css::uno::Reference
3207 - < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
3208 - throw (css::uno::RuntimeException) = 0;
3210 - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
3211 - const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3212 - throw (css::uno::RuntimeException) = 0;
3214 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
3215 - throw (css::uno::RuntimeException) = 0;
3217 - void SAL_CALL setLayoutUnit( const css::uno::Reference< css::awt::XLayoutUnit > &xUnit )
3218 - throw(css::uno::RuntimeException)
3219 - { mxLayoutUnit = xUnit; }
3220 - css::uno::Reference< css::awt::XLayoutUnit > SAL_CALL getLayoutUnit()
3221 - throw(css::uno::RuntimeException)
3222 - { return mxLayoutUnit; }
3224 - css::awt::Size SAL_CALL getRequestedSize() throw(css::uno::RuntimeException)
3225 - { return maRequisition; }
3226 - com::sun::star::awt::Rectangle SAL_CALL getAllocatedArea() throw(css::uno::RuntimeException)
3227 - { return maAllocation; }
3229 - virtual sal_Bool SAL_CALL hasHeightForWidth()
3230 - throw(css::uno::RuntimeException) = 0;
3231 - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
3232 - throw(css::uno::RuntimeException) = 0;
3234 - // css::awt::XLayoutContainer: css::container::XChild
3235 - css::uno::Reference< css::uno::XInterface > SAL_CALL getParent()
3236 - throw (css::uno::RuntimeException)
3237 - { return mxParent; }
3238 - void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface > &xParent )
3239 - throw (css::uno::RuntimeException)
3240 - { mxParent = css::uno::Reference< css::awt::XLayoutContainer >( xParent, css::uno::UNO_QUERY ); }
3242 - // css::awt::XLayoutConstrains
3243 - virtual css::awt::Size SAL_CALL getMinimumSize()
3244 - throw(css::uno::RuntimeException) = 0;
3245 - // (not properly implemented in toolkit, ignore it.)
3246 - css::awt::Size SAL_CALL getPreferredSize()
3247 - throw(css::uno::RuntimeException) { return getMinimumSize(); } // TODO: use this for flow?
3248 - css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize )
3249 - throw(css::uno::RuntimeException) { return rNewSize; }
3251 -PROPHELPER_SET_INFO
3254 - void propertiesChanged();
3257 -} // namespace layoutimpl
3259 -#endif /*CORE_CONTAINER_HXX*/
3260 --- toolkit/source/layout/core/bin.cxx.old 1970-01-01 00:00:00.000000000 +0000
3261 +++ toolkit/source/layout/core/bin.cxx 2009-04-06 16:42:13.000000000 +0000
3263 +/*************************************************************************
3265 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3267 + * Copyright 2008 by Sun Microsystems, Inc.
3269 + * OpenOffice.org - a multi-platform office productivity suite
3275 + * This file is part of OpenOffice.org.
3277 + * OpenOffice.org is free software: you can redistribute it and/or modify
3278 + * it under the terms of the GNU Lesser General Public License version 3
3279 + * only, as published by the Free Software Foundation.
3281 + * OpenOffice.org is distributed in the hope that it will be useful,
3282 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3283 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3284 + * GNU Lesser General Public License version 3 for more details
3285 + * (a copy is included in the LICENSE file that accompanied this code).
3287 + * You should have received a copy of the GNU Lesser General Public License
3288 + * version 3 along with OpenOffice.org. If not, see
3289 + * <http://www.openoffice.org/license.html>
3290 + * for a copy of the LGPLv3 License.
3292 + ************************************************************************/
3296 +#include <sal/macros.h>
3298 +namespace layoutimpl
3301 +using namespace css;
3305 +Bin::Bin() : Container()
3310 +Bin::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
3311 + throw (uno::RuntimeException, awt::MaxChildrenException)
3313 + if ( mxChild.is() )
3314 + throw awt::MaxChildrenException();
3315 + if ( xChild.is() )
3318 + setChildParent( xChild );
3324 +Bin::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
3325 + throw (uno::RuntimeException)
3327 + if ( xChild == mxChild )
3329 + mxChild = uno::Reference< awt::XLayoutConstrains >();
3330 + unsetChildParent( xChild );
3335 +uno::Sequence< uno::Reference< awt::XLayoutConstrains > > SAL_CALL
3337 + throw (uno::RuntimeException)
3339 + return getSingleChild (mxChild);
3343 +Bin::allocateArea( const awt::Rectangle &rArea )
3344 + throw (uno::RuntimeException)
3346 + maAllocation = rArea;
3347 + if ( mxChild.is() )
3348 + allocateChildAt( mxChild, rArea );
3352 +Bin::getMinimumSize()
3353 + throw(uno::RuntimeException)
3355 + if ( mxChild.is() )
3356 + return maRequisition = maChildRequisition = mxChild->getMinimumSize();
3357 + return maRequisition = awt::Size( 0, 0 );
3360 +uno::Reference< beans::XPropertySet > SAL_CALL
3361 +Bin::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& )
3362 + throw (uno::RuntimeException)
3364 + return uno::Reference< beans::XPropertySet >();
3368 +Bin::hasHeightForWidth()
3369 + throw(uno::RuntimeException)
3371 + uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
3372 + if ( xChildCont.is() )
3373 + return xChildCont->hasHeightForWidth();
3378 +Bin::getHeightForWidth( sal_Int32 nWidth )
3379 + throw(uno::RuntimeException)
3381 + uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
3382 + if ( xChildCont.is() )
3383 + return xChildCont->getHeightForWidth( nWidth );
3384 + return maRequisition.Height;
3389 +Align::Align() : Bin()
3391 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Halign" ),
3392 + ::getCppuType( static_cast< const float* >( NULL ) ),
3394 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Valign" ),
3395 + ::getCppuType( static_cast< const float* >( NULL ) ),
3397 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Hfill" ),
3398 + ::getCppuType( static_cast< const float* >( NULL ) ),
3400 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Vfill" ),
3401 + ::getCppuType( static_cast< const float* >( NULL ) ),
3404 + fHorAlign = fVerAlign = 0.5;
3405 + fHorFill = fVerFill = 0;
3409 +Align::allocateArea( const awt::Rectangle &rArea )
3410 + throw (uno::RuntimeException)
3412 + maAllocation = rArea;
3413 + if ( !mxChild.is() )
3416 + awt::Rectangle aChildArea;
3417 + aChildArea.Width = SAL_MIN( rArea.Width, maChildRequisition.Width );
3418 + aChildArea.Width += (sal_Int32) SAL_MAX(
3419 + 0, (rArea.Width - maChildRequisition.Width) * fHorFill );
3420 + aChildArea.Height = SAL_MIN( rArea.Height, maChildRequisition.Height );
3421 + aChildArea.Height += (sal_Int32) SAL_MAX(
3422 + 0, (rArea.Height - maChildRequisition.Height) * fVerFill );
3424 + aChildArea.X = rArea.X + (sal_Int32)( (rArea.Width - aChildArea.Width) * fHorAlign );
3425 + aChildArea.Y = rArea.Y + (sal_Int32)( (rArea.Height - aChildArea.Height) * fVerAlign );
3427 + allocateChildAt( mxChild, aChildArea );
3432 +MinSize::MinSize() : Bin()
3434 + mnMinWidth = mnMinHeight = 0;
3435 + addProp( RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ),
3436 + ::getCppuType( static_cast< const long* >( NULL ) ),
3438 + addProp( RTL_CONSTASCII_USTRINGPARAM( "MinHeight" ),
3439 + ::getCppuType( static_cast< const long* >( NULL ) ),
3443 +awt::Size SAL_CALL MinSize::getMinimumSize()
3444 + throw(uno::RuntimeException)
3446 + Bin::getMinimumSize();
3447 + maRequisition.Width = SAL_MAX( maRequisition.Width, mnMinWidth );
3448 + maRequisition.Height = SAL_MAX( maRequisition.Height, mnMinHeight );
3449 + return maRequisition;
3452 +} // namespace layoutimpl
3453 --- toolkit/source/layout/core/bin.hxx.old 1970-01-01 00:00:00.000000000 +0000
3454 +++ toolkit/source/layout/core/bin.hxx 2009-04-06 16:42:13.000000000 +0000
3456 +/*************************************************************************
3458 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3460 + * Copyright 2008 by Sun Microsystems, Inc.
3462 + * OpenOffice.org - a multi-platform office productivity suite
3468 + * This file is part of OpenOffice.org.
3470 + * OpenOffice.org is free software: you can redistribute it and/or modify
3471 + * it under the terms of the GNU Lesser General Public License version 3
3472 + * only, as published by the Free Software Foundation.
3474 + * OpenOffice.org is distributed in the hope that it will be useful,
3475 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3476 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3477 + * GNU Lesser General Public License version 3 for more details
3478 + * (a copy is included in the LICENSE file that accompanied this code).
3480 + * You should have received a copy of the GNU Lesser General Public License
3481 + * version 3 along with OpenOffice.org. If not, see
3482 + * <http://www.openoffice.org/license.html>
3483 + * for a copy of the LGPLv3 License.
3485 + ************************************************************************/
3487 +/* A few simple binary containers */
3489 +#ifndef LAYOUT_CORE_BIN_HXX
3490 +#define LAYOUT_CORE_BIN_HXX
3492 +#include <layout/core/container.hxx>
3494 +namespace layoutimpl
3497 +class Bin : public Container
3501 + css::awt::Size maChildRequisition;
3502 + css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
3508 + // css::awt::XLayoutContainer
3509 + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3510 + throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
3511 + virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3512 + throw (css::uno::RuntimeException);
3514 + virtual css::uno::Sequence< css::uno::Reference
3515 + < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
3516 + throw (css::uno::RuntimeException);
3518 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
3519 + throw (css::uno::RuntimeException);
3521 + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
3522 + const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3523 + throw (css::uno::RuntimeException);
3525 + virtual sal_Bool SAL_CALL hasHeightForWidth()
3526 + throw(css::uno::RuntimeException);
3527 + virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
3528 + throw(css::uno::RuntimeException);
3530 + // css::awt::XLayoutConstrains
3531 + virtual css::awt::Size SAL_CALL getMinimumSize()
3532 + throw(css::uno::RuntimeException);
3534 + PROPHELPER_SET_INFO
3537 +// Align gives control over child position on the allocated space.
3538 +class Align : public Bin
3540 + friend class AlignChildProps;
3543 + float fHorAlign, fVerAlign;
3544 + float fHorFill, fVerFill;
3549 + // css::awt::XLayoutContainer
3550 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
3551 + throw (css::uno::RuntimeException);
3553 + PROPHELPER_SET_INFO
3556 +// Makes child request its or a specified size, whatever is larger.
3557 +class MinSize : public Bin
3561 + long mnMinWidth, mnMinHeight;
3566 + // css::awt::XLayoutContainer
3567 + virtual css::awt::Size SAL_CALL getMinimumSize()
3568 + throw(css::uno::RuntimeException);
3570 + PROPHELPER_SET_INFO
3573 +} // namespace layoutimpl
3575 +#endif /* LAYOUT_CORE_BIN_HXX */
3576 --- toolkit/source/layout/core/box-base.cxx.old 1970-01-01 00:00:00.000000000 +0000
3577 +++ toolkit/source/layout/core/box-base.cxx 2009-04-06 16:42:13.000000000 +0000
3579 +/*************************************************************************
3581 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3583 + * Copyright 2008 by Sun Microsystems, Inc.
3585 + * OpenOffice.org - a multi-platform office productivity suite
3591 + * This file is part of OpenOffice.org.
3593 + * OpenOffice.org is free software: you can redistribute it and/or modify
3594 + * it under the terms of the GNU Lesser General Public License version 3
3595 + * only, as published by the Free Software Foundation.
3597 + * OpenOffice.org is distributed in the hope that it will be useful,
3598 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3599 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3600 + * GNU Lesser General Public License version 3 for more details
3601 + * (a copy is included in the LICENSE file that accompanied this code).
3603 + * You should have received a copy of the GNU Lesser General Public License
3604 + * version 3 along with OpenOffice.org. If not, see
3605 + * <http://www.openoffice.org/license.html>
3606 + * for a copy of the LGPLv3 License.
3608 + ************************************************************************/
3612 +#include <tools/debug.hxx>
3613 +#include <sal/macros.h>
3615 +#include <com/sun/star/awt/XWindow2.hpp>
3617 +// fixed point precision for distributing error
3618 +#define FIXED_PT 16
3620 +namespace layoutimpl
3623 +using namespace css;
3625 +Box_Base::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
3626 + : mxChild( xChild )
3632 +static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget )
3634 + if ( !xWidget.is() )
3636 + DBG_ERROR( "FIXME: invalid child !" );
3640 + uno::Reference< awt::XWindow2 > xWindow( xWidget, uno::UNO_QUERY );
3641 + if ( xWindow.is() && !xWindow->isVisible() )
3644 + uno::Reference< awt::XLayoutContainer > xContainer( xWidget, uno::UNO_QUERY );
3645 + if ( xContainer.is() )
3647 + uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren
3648 + = xContainer->getChildren();
3650 + // FIXME: <flow> workaround: empty visible containers always visible:
3651 + if ( !aChildren.getLength() )
3654 + for ( int i = 0; i < aChildren.getLength(); i++ )
3655 + if ( isVisible( aChildren[i] ) )
3657 + return false; // this would kill flow without workaround above
3663 +bool Box_Base::ChildData::isVisible()
3665 + // FIXME: call the 'isVisible' method on it ?
3666 + return layoutimpl::isVisible( mxChild );
3670 +Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
3672 + ChildData *pData = createChild (xChild);
3673 + maChildren.push_back (pData);
3678 +Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
3679 + throw (uno::RuntimeException, awt::MaxChildrenException)
3683 + AddChild (xChild);
3684 + setChildParent (xChild);
3688 +Box_Base::ChildData*
3689 +Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
3691 + for ( std::list< ChildData* >::iterator it = lst.begin();
3692 + it != lst.end(); it++ )
3694 + if ( (*it)->mxChild == xChild )
3704 +Box_Base::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
3705 + throw (uno::RuntimeException)
3707 + if ( ChildData* p = removeChildData( maChildren, xChild ) )
3710 + unsetChildParent( xChild );
3715 + DBG_ERROR( "Box_Base: removeChild: no such child" );
3719 +uno::Sequence< uno::Reference < awt::XLayoutConstrains > > SAL_CALL
3720 +Box_Base::getChildren()
3721 + throw (uno::RuntimeException)
3723 + uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
3724 + unsigned int index = 0;
3725 + for ( std::list< ChildData* >::iterator it = maChildren.begin();
3726 + it != maChildren.end(); it++, index++ )
3727 + children[index] = ( *it )->mxChild;
3732 +uno::Reference< beans::XPropertySet > SAL_CALL
3733 +Box_Base::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& xChild )
3734 + throw (uno::RuntimeException)
3737 + for ( std::list< ChildData * >::iterator it = maChildren.begin();
3738 + it != maChildren.end(); it++)
3740 + if ( ( *it )->mxChild == xChild )
3742 + if ( !( *it )->mxProps.is() )
3744 + PropHelper *pProps = createChildProps( *it );
3745 + pProps->setChangeListener( this );
3746 + ( *it )->mxProps = pProps;
3748 + return (*it)->mxProps;
3751 + return uno::Reference< beans::XPropertySet >();
3754 +} // namespace layoutimpl
3755 --- toolkit/source/layout/core/box-base.hxx.old 1970-01-01 00:00:00.000000000 +0000
3756 +++ toolkit/source/layout/core/box-base.hxx 2009-04-06 16:42:13.000000000 +0000
3758 +/*************************************************************************
3760 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3762 + * Copyright 2008 by Sun Microsystems, Inc.
3764 + * OpenOffice.org - a multi-platform office productivity suite
3770 + * This file is part of OpenOffice.org.
3772 + * OpenOffice.org is free software: you can redistribute it and/or modify
3773 + * it under the terms of the GNU Lesser General Public License version 3
3774 + * only, as published by the Free Software Foundation.
3776 + * OpenOffice.org is distributed in the hope that it will be useful,
3777 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3778 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3779 + * GNU Lesser General Public License version 3 for more details
3780 + * (a copy is included in the LICENSE file that accompanied this code).
3782 + * You should have received a copy of the GNU Lesser General Public License
3783 + * version 3 along with OpenOffice.org. If not, see
3784 + * <http://www.openoffice.org/license.html>
3785 + * for a copy of the LGPLv3 License.
3787 + ************************************************************************/
3789 +#ifndef LAYOUT_CORE_BOX_BASE_HXX
3790 +#define LAYOUT_CORE_BOX_BASE_HXX
3792 +#include <layout/core/container.hxx>
3796 +namespace layoutimpl
3799 +class Box_Base : public Container
3802 + // Children properties
3805 + css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
3806 + css::uno::Reference< css::beans::XPropertySet > mxProps;
3807 + css::awt::Size maRequisition;
3808 + virtual bool isVisible();
3810 + ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
3811 + virtual ~ChildData() { };
3814 + struct ChildProps: public PropHelper
3816 + //ChildProps( ChildProps* );
3817 + PROPHELPER_SET_INFO
3821 + std::list< ChildData* > maChildren;
3824 + virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
3825 + virtual ChildProps *createChildProps( ChildData* pData ) = 0;
3827 + ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
3830 + void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
3832 + // css::awt::XLayoutContainer
3833 + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child)
3834 + throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
3835 + virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3836 + throw (css::uno::RuntimeException);
3838 + virtual css::uno::Sequence< css::uno::Reference
3839 + < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
3840 + throw (css::uno::RuntimeException);
3842 + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
3843 + const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
3844 + throw (css::uno::RuntimeException);
3847 +} // namespace layoutimpl
3849 +#endif /* LAYOUT_CORE_BOX_BASE HXX */
3850 --- toolkit/source/layout/core/box.cxx.old 1970-01-01 00:00:00.000000000 +0000
3851 +++ toolkit/source/layout/core/box.cxx 2009-04-06 16:42:13.000000000 +0000
3853 +/*************************************************************************
3855 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3857 + * Copyright 2008 by Sun Microsystems, Inc.
3859 + * OpenOffice.org - a multi-platform office productivity suite
3865 + * This file is part of OpenOffice.org.
3867 + * OpenOffice.org is free software: you can redistribute it and/or modify
3868 + * it under the terms of the GNU Lesser General Public License version 3
3869 + * only, as published by the Free Software Foundation.
3871 + * OpenOffice.org is distributed in the hope that it will be useful,
3872 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3873 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3874 + * GNU Lesser General Public License version 3 for more details
3875 + * (a copy is included in the LICENSE file that accompanied this code).
3877 + * You should have received a copy of the GNU Lesser General Public License
3878 + * version 3 along with OpenOffice.org. If not, see
3879 + * <http://www.openoffice.org/license.html>
3880 + * for a copy of the LGPLv3 License.
3882 + ************************************************************************/
3886 +#include <tools/debug.hxx>
3887 +#include <sal/macros.h>
3889 +// fixed point precision for distributing error
3890 +#define FIXED_PT 16
3892 +namespace layoutimpl
3895 +using namespace css;
3897 +Box::ChildProps::ChildProps( Box::ChildData *pData )
3899 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Expand" ),
3900 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
3901 + &(pData->mbExpand) );
3902 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Fill" ),
3903 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
3904 + &(pData->mbFill) );
3905 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Padding" ),
3906 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
3907 + &(pData->mnPadding) );
3910 +Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
3911 + : Box_Base::ChildData( xChild )
3913 + , mbExpand( true )
3919 +Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
3921 + return new ChildData( xChild );
3925 +Box::createChildProps( Box_Base::ChildData *pData )
3927 + return new ChildProps( static_cast<Box::ChildData*> ( pData ) );
3930 +Box::Box( bool horizontal )
3933 + , mbHomogeneous( false )
3934 + , mbHorizontal( horizontal )
3936 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
3937 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
3939 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
3940 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
3942 + mbHasFlowChildren = false;
3946 +Box::calculateSize( long nWidth )
3948 + int nVisibleChildren = 0;
3949 + // primary vs secundary axis (instead of a X and Y)
3950 + int nPrimSize = 0;
3952 + int nFlowMinWidth = 0; // in case the box only has flow children
3954 + mbHasFlowChildren = false;
3956 + for ( std::list<Box_Base::ChildData *>::const_iterator it
3957 + = maChildren.begin(); it != maChildren.end(); it++ )
3959 + ChildData *child = static_cast<Box::ChildData*> ( *it );
3960 + if ( !child->isVisible() )
3963 + uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
3964 + bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
3966 + awt::Size aChildSize = child->maRequisition = child->mxChild->getMinimumSize();
3968 + if ( !mbHorizontal /*vertical*/ && bFlow )
3970 + if ( nFlowMinWidth == 0 || nFlowMinWidth > aChildSize.Width )
3971 + nFlowMinWidth = aChildSize.Width;
3972 + mbHasFlowChildren = true;
3976 + int size = primDim( aChildSize ) + child->mnPadding * 2;
3977 + if ( mbHomogeneous )
3978 + nPrimSize = SAL_MAX( nPrimSize, size );
3980 + nPrimSize += size;
3982 + nSecSize = SAL_MAX( nSecSize, secDim( aChildSize ) );
3984 + nVisibleChildren++;
3987 + if ( nVisibleChildren )
3989 + if ( mbHomogeneous )
3990 + nPrimSize *= nVisibleChildren;
3991 + nPrimSize += (nVisibleChildren - 1) * mnSpacing;
3994 + if ( mbHasFlowChildren )
3996 + if ( nWidth == 0 )
3997 + nWidth = nSecSize ? nSecSize : nFlowMinWidth;
3998 + for ( std::list<Box_Base::ChildData *>::const_iterator it
3999 + = maChildren.begin(); it != maChildren.end(); it++ )
4001 + ChildData *child = static_cast<Box::ChildData*> ( *it );
4002 + if ( !child->isVisible() )
4005 + uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
4006 + bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
4009 + nPrimSize += xChildCont->getHeightForWidth( nWidth );
4013 + nPrimSize += mnBorderWidth * 2;
4014 + nSecSize += mnBorderWidth * 2;
4015 + return awt::Size( mbHorizontal ? nPrimSize : nSecSize,
4016 + mbHorizontal ? nSecSize : nPrimSize );
4020 +Box::getMinimumSize() throw(uno::RuntimeException)
4022 + maRequisition = calculateSize();
4023 + return maRequisition;
4027 +Box::hasHeightForWidth()
4028 + throw(uno::RuntimeException)
4030 + return mbHasFlowChildren;
4034 +Box::getHeightForWidth( sal_Int32 nWidth )
4035 + throw(uno::RuntimeException)
4037 + if ( hasHeightForWidth() )
4038 + return calculateSize( nWidth ).Height;
4039 + return maRequisition.Height;
4043 +Box::allocateArea( const awt::Rectangle &newArea )
4044 + throw (uno::RuntimeException)
4046 + maAllocation = newArea;
4047 + int nVisibleChildren = 0, nExpandChildren = 0;
4049 + for ( std::list<Box_Base::ChildData *>::const_iterator it
4050 + = maChildren.begin(); it != maChildren.end(); it++ )
4052 + ChildData *child = static_cast<Box::ChildData*> ( *it );
4053 + if ( child->isVisible() )
4055 + nVisibleChildren++;
4056 + if ( child->mbExpand )
4057 + nExpandChildren++;
4060 + if ( !nVisibleChildren )
4063 + // split rectangle for dimension helpers
4064 + awt::Point newPoint( newArea.X, newArea.Y );
4065 + awt::Size newSize( newArea.Width, newArea.Height );
4068 + if ( mbHomogeneous )
4069 + nExtraSpace = ( ( primDim( newSize ) - mnBorderWidth * 2 -
4070 + ( nVisibleChildren - 1 ) * mnSpacing )) / nVisibleChildren;
4071 + else if ( nExpandChildren )
4073 + int reqSize = primDim( maRequisition );
4074 + if ( !mbHorizontal && hasHeightForWidth() )
4075 + reqSize = getHeightForWidth( newArea.Width );
4076 + nExtraSpace = ( primDim( newSize ) - reqSize ) / nExpandChildren;
4081 + int nChildPrimPoint, nChildSecPoint, nChildPrimSize, nChildSecSize;
4083 + int nStartPoint = primDim( newPoint ) + mnBorderWidth;
4084 + int nBoxSecSize = SAL_MAX( 1, secDim( newSize ) - mnBorderWidth * 2 );
4086 + for ( std::list<Box_Base::ChildData *>::const_iterator it
4087 + = maChildren.begin(); it != maChildren.end(); it++ )
4089 + ChildData *child = static_cast<Box::ChildData*> ( *it );
4090 + if ( !child->isVisible() )
4093 + awt::Point aChildPos;
4094 + int nBoxPrimSize; // of the available box space
4096 + if ( mbHomogeneous )
4097 + nBoxPrimSize = nExtraSpace;
4100 + uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
4101 + bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
4102 + if ( !mbHorizontal && bFlow )
4103 + nBoxPrimSize = xChildCont->getHeightForWidth( newArea.Width );
4105 + nBoxPrimSize = primDim( child->maRequisition );
4106 + nBoxPrimSize += child->mnPadding;
4107 + if ( child->mbExpand )
4108 + nBoxPrimSize += nExtraSpace;
4111 + nChildPrimPoint = nStartPoint + child->mnPadding;
4112 + nChildSecPoint = secDim( newPoint ) + mnBorderWidth;
4114 + nChildSecSize = nBoxSecSize;
4115 + if ( child->mbFill )
4116 + nChildPrimSize = SAL_MAX( 1, nBoxPrimSize - child->mnPadding);
4119 + nChildPrimSize = primDim( child->maRequisition );
4120 + nChildPrimPoint += (nBoxPrimSize - nChildPrimSize) / 2;
4122 + nChildSecPoint += (nBoxSecSize - nChildSecSize) / 2;
4125 + awt::Rectangle area;
4126 + area.X = mbHorizontal ? nChildPrimPoint : nChildSecPoint;
4127 + area.Y = mbHorizontal ? nChildSecPoint : nChildPrimPoint;
4128 + area.Width = mbHorizontal ? nChildPrimSize : nChildSecSize;
4129 + area.Height = mbHorizontal ? nChildSecSize : nChildPrimSize;
4131 + allocateChildAt( child->mxChild, area );
4133 + nStartPoint += nBoxPrimSize + mnSpacing + child->mnPadding;
4137 +} // namespace layoutimpl
4138 --- toolkit/source/layout/core/box.hxx.old 1970-01-01 00:00:00.000000000 +0000
4139 +++ toolkit/source/layout/core/box.hxx 2009-04-06 16:42:13.000000000 +0000
4141 +/*************************************************************************
4143 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4145 + * Copyright 2008 by Sun Microsystems, Inc.
4147 + * OpenOffice.org - a multi-platform office productivity suite
4153 + * This file is part of OpenOffice.org.
4155 + * OpenOffice.org is free software: you can redistribute it and/or modify
4156 + * it under the terms of the GNU Lesser General Public License version 3
4157 + * only, as published by the Free Software Foundation.
4159 + * OpenOffice.org is distributed in the hope that it will be useful,
4160 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4161 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4162 + * GNU Lesser General Public License version 3 for more details
4163 + * (a copy is included in the LICENSE file that accompanied this code).
4165 + * You should have received a copy of the GNU Lesser General Public License
4166 + * version 3 along with OpenOffice.org. If not, see
4167 + * <http://www.openoffice.org/license.html>
4168 + * for a copy of the LGPLv3 License.
4170 + ************************************************************************/
4172 +#ifndef LAYOUT_CORE_BOX_HXX
4173 +#define LAYOUT_CORE_BOX_HXX
4175 +#include <layout/core/box-base.hxx>
4177 +#include <com/sun/star/awt/Point.hpp>
4179 +namespace layoutimpl
4182 +class Box : public Box_Base
4185 + // Box properties (i.e. affect all children)
4186 + sal_Int32 mnSpacing;
4187 + sal_Bool mbHomogeneous;
4188 + sal_Bool mbHorizontal; // false for Vertical
4189 + bool mbHasFlowChildren;
4192 + // Children properties
4193 + struct ChildData : public Box_Base::ChildData
4195 + sal_Int32 mnPadding;
4196 + sal_Bool mbExpand;
4198 + ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
4201 + struct ChildProps : public Box_Base::ChildProps
4203 + ChildProps( ChildData *pData );
4207 + ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
4208 + ChildProps *createChildProps( Box_Base::ChildData* pData );
4211 + Box( bool horizontal );
4213 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
4214 + throw (css::uno::RuntimeException);
4216 + virtual css::awt::Size SAL_CALL getMinimumSize()
4217 + throw(css::uno::RuntimeException);
4218 + virtual sal_Bool SAL_CALL hasHeightForWidth()
4219 + throw(css::uno::RuntimeException);
4220 + virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
4221 + throw(css::uno::RuntimeException);
4223 + // helper: mix of getMinimumSize() and getHeightForWidth()
4224 + css::awt::Size calculateSize( long nWidth = 0 );
4226 + PROPHELPER_SET_INFO
4229 + /* Helpers to deal with the joint Box directions. */
4230 + inline int primDim (const css::awt::Size &size)
4231 + { if (mbHorizontal) return size.Width; else return size.Height; }
4232 + inline int secDim (const css::awt::Size &size)
4233 + { if (mbHorizontal) return size.Height; else return size.Width; }
4234 + inline int primDim (const css::awt::Point &point)
4235 + { if (mbHorizontal) return point.X; else return point.Y; }
4236 + inline int secDim (const css::awt::Point &point)
4237 + { if (mbHorizontal) return point.Y; else return point.X; }
4240 +struct VBox : public Box
4241 +{ VBox() : Box (false) {} };
4243 +struct HBox : public Box
4244 +{ HBox() : Box (true) {} };
4246 +} // namespace layoutimpl
4248 +#endif /* LAYOUT_CORE_BOX_HXX */
4249 --- toolkit/source/layout/core/byteseq.cxx.old 1970-01-01 00:00:00.000000000 +0000
4250 +++ toolkit/source/layout/core/byteseq.cxx 2009-04-06 16:42:13.000000000 +0000
4252 +/*************************************************************************
4254 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4256 + * Copyright 2008 by Sun Microsystems, Inc.
4258 + * OpenOffice.org - a multi-platform office productivity suite
4260 + * $RCSfile: byteseq.cxx,v $
4261 + * $Revision: 1.3 $
4263 + * This file is part of OpenOffice.org.
4265 + * OpenOffice.org is free software: you can redistribute it and/or modify
4266 + * it under the terms of the GNU Lesser General Public License version 3
4267 + * only, as published by the Free Software Foundation.
4269 + * OpenOffice.org is distributed in the hope that it will be useful,
4270 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4271 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4272 + * GNU Lesser General Public License version 3 for more details
4273 + * (a copy is included in the LICENSE file that accompanied this code).
4275 + * You should have received a copy of the GNU Lesser General Public License
4276 + * version 3 along with OpenOffice.org. If not, see
4277 + * <http://www.openoffice.org/license.html>
4278 + * for a copy of the LGPLv3 License.
4280 + ************************************************************************/
4282 +#include <com/sun/star/io/XInputStream.hpp>
4283 +#include <osl/file.hxx>
4284 +#include <comphelper/oslfile2streamwrap.hxx>
4287 +using osl::FileBase;
4288 +using namespace ::com::sun::star;
4290 +namespace layoutimpl
4293 +uno::Reference< io::XInputStream > getFileAsStream( const rtl::OUString &rName )
4295 + rtl::OUString sFileURL;
4296 + if( FileBase::E_None != FileBase::getFileURLFromSystemPath( rName, sFileURL ) )
4297 + sFileURL = rName; // maybe it already was a file url
4299 + File * blobFile = new File(sFileURL);
4300 + File::RC errorCode = blobFile->open(OpenFlag_Read);
4302 + uno::Reference<io::XInputStream> xResult;
4303 + switch (errorCode)
4305 + case osl::File::E_None: // got it
4306 + xResult.set( new comphelper::OSLInputStreamWrapper(blobFile,true) );
4309 + case osl::File::E_NOENT: // no file => no stream
4316 + rtl::OUStringBuffer sMsg;
4317 + sMsg.appendAscii("Cannot open output file \"");
4318 + sMsg.append(aURL);
4319 + sMsg.appendAscii("\" : ");
4320 + sMsg.append(configmgr::FileHelper::createOSLErrorString(errorCode));
4322 + throw io::IOException(sMsg.makeStringAndClear(),NULL);
4330 +} // namespace layoutimpl
4331 --- toolkit/source/layout/core/container.cxx.old 1970-01-01 00:00:00.000000000 +0000
4332 +++ toolkit/source/layout/core/container.cxx 2009-04-06 16:42:13.000000000 +0000
4334 +/*************************************************************************
4336 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4338 + * Copyright 2008 by Sun Microsystems, Inc.
4340 + * OpenOffice.org - a multi-platform office productivity suite
4346 + * This file is part of OpenOffice.org.
4348 + * OpenOffice.org is free software: you can redistribute it and/or modify
4349 + * it under the terms of the GNU Lesser General Public License version 3
4350 + * only, as published by the Free Software Foundation.
4352 + * OpenOffice.org is distributed in the hope that it will be useful,
4353 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4354 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4355 + * GNU Lesser General Public License version 3 for more details
4356 + * (a copy is included in the LICENSE file that accompanied this code).
4358 + * You should have received a copy of the GNU Lesser General Public License
4359 + * version 3 along with OpenOffice.org. If not, see
4360 + * <http://www.openoffice.org/license.html>
4361 + * for a copy of the LGPLv3 License.
4363 + ************************************************************************/
4365 +#include "container.hxx"
4367 +#include <com/sun/star/awt/XWindow.hpp>
4368 +#include <com/sun/star/awt/PosSize.hpp>
4369 +#include <tools/debug.hxx>
4371 +namespace layoutimpl {
4373 +using namespace css;
4375 +Container::Container()
4376 + : Container_Base()
4378 + , mnBorderWidth( 0 )
4380 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Border" ),
4381 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
4383 + setChangeListener( this );
4387 +Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException)
4389 + uno::Any aRet = Container_Base::queryInterface( rType );
4390 + return aRet.hasValue() ? aRet : PropHelper::queryInterface( rType );
4394 +Container::allocateChildAt( const uno::Reference< awt::XLayoutConstrains > &xChild,
4395 + const awt::Rectangle &rArea )
4396 + throw( uno::RuntimeException )
4398 + uno::Reference< awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY );
4400 + xCont->allocateArea( rArea );
4403 + uno::Reference< awt::XWindow > xWindow( xChild, uno::UNO_QUERY );
4404 + if ( xWindow.is() )
4405 + xWindow->setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height,
4406 + awt::PosSize::POSSIZE );
4409 + DBG_ERROR( "Error: non-sizeable child" );
4414 +uno::Sequence< uno::Reference< awt::XLayoutConstrains > >
4415 +Container::getSingleChild ( uno::Reference< awt::XLayoutConstrains >const &xChildOrNil )
4417 + uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aSeq( ( xChildOrNil.is() ? 1 : 0 ) );
4418 + if ( xChildOrNil.is() )
4419 + aSeq[0] = xChildOrNil;
4424 +Container::queueResize()
4426 + if ( mxLayoutUnit.is() )
4427 + mxLayoutUnit->queueResize( uno::Reference< awt::XLayoutContainer >( this ) );
4431 +Container::setChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
4433 + uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
4434 + if ( xContChild.is() )
4436 + xContChild->setParent( uno::Reference< awt::XLayoutContainer >( this ) );
4438 + assert( !mxLayoutUnit.is() );
4439 + xContChild->setLayoutUnit( mxLayoutUnit );
4445 +Container::unsetChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
4447 + uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
4448 + if ( xContChild.is() )
4450 + xContChild->setParent( uno::Reference< awt::XLayoutContainer >() );
4452 + xContChild->setLayoutUnit( uno::Reference< awt::XLayoutUnit >() );
4459 +Container::getLabel() // debug label
4461 + std::string depth;
4462 + uno::Reference< awt::XLayoutContainer > xContainer( this );
4463 + while ( xContainer.is() )
4465 + int node = 0; // child nb
4466 + uno::Reference< awt::XLayoutContainer > xParent = xContainer->getContainerParent();
4467 + if ( xParent.is() )
4470 + uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren;
4471 + aChildren = xParent->getChildren();
4472 + for ( node = 0; node < aChildren.getLength(); node++ )
4473 + if ( aChildren[ node ] == xContainer )
4478 + snprintf( str, 8, "%d", node );
4479 + if ( depth.empty() )
4480 + depth = std::string( str );
4482 + depth = std::string( str ) + ":" + depth;
4484 + xContainer = xParent;
4487 + return std::string( getName() ) + " (" + depth + ")";
4491 +void Container::propertiesChanged()
4493 + // cl: why this assertion? This is also called to set properties at the top level widget which has no parent!?
4494 + // DBG_ASSERT( mxParent.is(), "Properties listener: error container doesn't have parent" );
4496 + if ( mxLayoutUnit.is() && mxParent.is() )
4497 + mxLayoutUnit->queueResize( mxParent );
4501 --- toolkit/source/layout/core/container.hxx.old 1970-01-01 00:00:00.000000000 +0000
4502 +++ toolkit/source/layout/core/container.hxx 2009-04-06 16:42:13.000000000 +0000
4504 +/*************************************************************************
4506 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4508 + * Copyright 2008 by Sun Microsystems, Inc.
4510 + * OpenOffice.org - a multi-platform office productivity suite
4516 + * This file is part of OpenOffice.org.
4518 + * OpenOffice.org is free software: you can redistribute it and/or modify
4519 + * it under the terms of the GNU Lesser General Public License version 3
4520 + * only, as published by the Free Software Foundation.
4522 + * OpenOffice.org is distributed in the hope that it will be useful,
4523 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4524 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4525 + * GNU Lesser General Public License version 3 for more details
4526 + * (a copy is included in the LICENSE file that accompanied this code).
4528 + * You should have received a copy of the GNU Lesser General Public License
4529 + * version 3 along with OpenOffice.org. If not, see
4530 + * <http://www.openoffice.org/license.html>
4531 + * for a copy of the LGPLv3 License.
4533 + ************************************************************************/
4535 +#ifndef LAYOUT_CORE_CONTAINER_HXX
4536 +#define LAYOUT_CORE_CONTAINER_HXX
4538 +#include <layout/core/helper.hxx>
4540 +#include <cppuhelper/implbase2.hxx>
4541 +#include <com/sun/star/awt/MaxChildrenException.hpp>
4543 +namespace layoutimpl
4545 +namespace css = ::com::sun::star;
4547 +typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer,
4548 + css::awt::XLayoutConstrains > Container_Base;
4550 +class Container : public Container_Base, public PropHelper, public PropHelper::Listener
4552 + friend class ChildProps;
4554 + // Widget properties
4555 + css::uno::Reference< css::awt::XLayoutContainer > mxParent;
4556 + css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
4557 + css::awt::Size maRequisition;
4558 + css::awt::Rectangle maAllocation;
4560 + // Container properties
4561 + sal_Int32 mnBorderWidth;
4564 + void allocateChildAt( const css::uno::Reference< css::awt::XLayoutConstrains > &xChild,
4565 + const css::awt::Rectangle &rArea )
4566 + throw (css::uno::RuntimeException);
4567 + static css::uno::Sequence< css::uno::Reference< css::awt::XLayoutConstrains > >
4568 + getSingleChild (const css::uno::Reference< css::awt::XLayoutConstrains > &xChildOrNil);
4569 + void setChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
4570 + void unsetChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
4572 + void queueResize();
4573 + void forceRecalc() { allocateArea( maAllocation ); }
4577 + virtual ~Container() {}
4580 + virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); }
4581 + virtual void SAL_CALL release() throw() { PropHelper::release(); }
4582 + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
4584 + // css::awt::XLayoutContainer
4585 + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
4586 + throw (css::uno::RuntimeException, css::awt::MaxChildrenException) = 0;
4587 + virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
4588 + throw (css::uno::RuntimeException) = 0;
4590 + virtual css::uno::Sequence< css::uno::Reference
4591 + < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
4592 + throw (css::uno::RuntimeException) = 0;
4594 + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
4595 + const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
4596 + throw (css::uno::RuntimeException) = 0;
4598 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
4599 + throw (css::uno::RuntimeException) = 0;
4601 + void SAL_CALL setLayoutUnit( const css::uno::Reference< css::awt::XLayoutUnit > &xUnit )
4602 + throw(css::uno::RuntimeException)
4603 + { mxLayoutUnit = xUnit; }
4604 + css::uno::Reference< css::awt::XLayoutUnit > SAL_CALL getLayoutUnit()
4605 + throw(css::uno::RuntimeException)
4606 + { return mxLayoutUnit; }
4608 + css::awt::Size SAL_CALL getRequestedSize() throw(css::uno::RuntimeException)
4609 + { return maRequisition; }
4610 + com::sun::star::awt::Rectangle SAL_CALL getAllocatedArea() throw(css::uno::RuntimeException)
4611 + { return maAllocation; }
4613 + virtual sal_Bool SAL_CALL hasHeightForWidth()
4614 + throw(css::uno::RuntimeException) = 0;
4615 + virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
4616 + throw(css::uno::RuntimeException) = 0;
4618 + // css::awt::XLayoutContainer: css::container::XChild
4619 + css::uno::Reference< css::uno::XInterface > SAL_CALL getParent()
4620 + throw (css::uno::RuntimeException)
4621 + { return mxParent; }
4622 + void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface > &xParent )
4623 + throw (css::uno::RuntimeException)
4624 + { mxParent = css::uno::Reference< css::awt::XLayoutContainer >( xParent, css::uno::UNO_QUERY ); }
4626 + // css::awt::XLayoutConstrains
4627 + virtual css::awt::Size SAL_CALL getMinimumSize()
4628 + throw(css::uno::RuntimeException) = 0;
4629 + // (not properly implemented in toolkit, ignore it.)
4630 + css::awt::Size SAL_CALL getPreferredSize()
4631 + throw(css::uno::RuntimeException) { return getMinimumSize(); } // TODO: use this for flow?
4632 + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize )
4633 + throw(css::uno::RuntimeException) { return rNewSize; }
4635 +PROPHELPER_SET_INFO
4638 + void propertiesChanged();
4641 +} // namespace layoutimpl
4643 +#endif /* LAYOUT_CORE_CONTAINER_HXX */
4644 --- toolkit/source/layout/core/dialogbuttonhbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
4645 +++ toolkit/source/layout/core/dialogbuttonhbox.cxx 2009-04-06 16:42:13.000000000 +0000
4647 +/*************************************************************************
4649 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4651 + * Copyright 2008 by Sun Microsystems, Inc.
4653 + * OpenOffice.org - a multi-platform office productivity suite
4659 + * This file is part of OpenOffice.org.
4661 + * OpenOffice.org is free software: you can redistribute it and/or modify
4662 + * it under the terms of the GNU Lesser General Public License version 3
4663 + * only, as published by the Free Software Foundation.
4665 + * OpenOffice.org is distributed in the hope that it will be useful,
4666 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4667 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4668 + * GNU Lesser General Public License version 3 for more details
4669 + * (a copy is included in the LICENSE file that accompanied this code).
4671 + * You should have received a copy of the GNU Lesser General Public License
4672 + * version 3 along with OpenOffice.org. If not, see
4673 + * <http://www.openoffice.org/license.html>
4674 + * for a copy of the LGPLv3 License.
4676 + ************************************************************************/
4678 +#include <awt/vclxbutton.hxx>
4679 +#include <tools/debug.hxx>
4680 +#include <toolkit/awt/vclxwindows.hxx>
4681 +#include <vcl/button.hxx>
4683 +#include "dialogbuttonhbox.hxx"
4684 +#include "flow.hxx"
4685 +#include "proplist.hxx"
4687 +#if TEST_LAYOUT && !defined( DBG_UTIL )
4690 +#define DBG_ERROR printf
4692 +#define DBG_ERROR1 printf
4694 +#define DBG_ERROR2 printf
4695 +#endif /* TEST_LAYOUT && !DBG_UTIL */
4697 +namespace layoutimpl
4700 +using namespace css;
4702 +//FIXME: how to set platform-dependant variables?
4703 +DialogButtonHBox::Ordering const DialogButtonHBox::DEFAULT_ORDERING =
4704 +#if defined( MACOSX )
4705 + DialogButtonHBox::MACOS;
4706 +#elif defined( SAL_W32 )
4707 +DialogButtonHBox::WINDOWS;
4708 +#elif defined( ENABLE_KDE )
4709 +DialogButtonHBox::KDE;
4710 +#else /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
4711 +DialogButtonHBox::GNOME;
4712 +#endif /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
4714 +DialogButtonHBox::DialogButtonHBox()
4716 + , mnOrdering( DEFAULT_ORDERING )
4719 + , mpAffirmative( 0 )
4720 + , mpAlternate( 0 )
4723 + , mpFlow( createChild( uno::Reference< awt::XLayoutConstrains > ( &mFlow ) ) )
4727 + mbHomogeneous = true;
4731 +DialogButtonHBox::setOrdering( rtl::OUString const& ordering )
4733 + if ( ordering.equalsIgnoreAsciiCaseAscii( "GNOME" ) )
4734 + mnOrdering = GNOME;
4735 + else if ( ordering.equalsIgnoreAsciiCaseAscii( "KDE" ) )
4737 + else if ( ordering.equalsIgnoreAsciiCaseAscii( "MacOS" ) )
4738 + mnOrdering = MACOS;
4739 + else if ( ordering.equalsIgnoreAsciiCaseAscii( "Windows" ) )
4740 + mnOrdering = WINDOWS;
4743 + DBG_ERROR1( "DialogButtonHBox: no such ordering: %s", OUSTRING_CSTR( ordering ) );
4748 +DialogButtonHBox::addChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
4749 + throw ( uno::RuntimeException, awt::MaxChildrenException )
4751 + if ( !xChild.is() )
4754 + ChildData *p = createChild( xChild );
4756 +#define IS_BUTTON(t) dynamic_cast<VCLX##t##Button *>( xChild.get () )
4758 + /* Sort Retry as Action */
4759 + if ( !mpAction && IS_BUTTON( Retry ) )
4761 + else if ( !mpAffirmative && IS_BUTTON( OK ) )
4762 + mpAffirmative = p;
4763 + else if ( !mpAffirmative && IS_BUTTON( Yes ) )
4764 + mpAffirmative = p;
4765 + else if ( !mpAlternate && IS_BUTTON( No ) )
4767 + /* Sort Ignore as Alternate */
4768 + else if ( !mpAlternate && IS_BUTTON( Ignore ) )
4770 + else if ( !mpApply && IS_BUTTON( Apply ) )
4772 + else if ( !mpCancel && IS_BUTTON( Cancel ) )
4774 + /* Let the user overwrite Flow */
4775 + else if ( /* !mpFlow && */ dynamic_cast<Flow *>( xChild.get () ) )
4777 + else if ( !mpHelp && IS_BUTTON( Help ) )
4779 + else if ( !mpReset && IS_BUTTON( Reset ) )
4782 + maOther.push_back( p );
4784 + setChildParent( xChild );
4789 +DialogButtonHBox::orderChildren()
4791 + if ( mnOrdering == WINDOWS )
4792 + windowsOrdering();
4793 + else if ( mnOrdering == MACOS )
4795 + else if ( mnOrdering == KDE )
4797 + else if ( 1 || mnOrdering == GNOME )
4802 +DialogButtonHBox::removeChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
4803 + throw ( uno::RuntimeException)
4805 + if ( !xChild.is ())
4808 + Box_Base::ChildData *p = 0;
4810 + if ( mpAction && mpAction->mxChild == xChild )
4812 + else if ( mpAffirmative && mpAffirmative->mxChild == xChild )
4813 + p = mpAffirmative;
4814 + else if ( mpAlternate && mpAlternate->mxChild == xChild )
4816 + else if ( mpApply && mpApply->mxChild == xChild )
4818 + else if ( mpCancel && mpCancel->mxChild == xChild )
4820 + else if ( mpFlow && mpFlow->mxChild == xChild )
4822 + else if ( mpReset && mpReset->mxChild == xChild )
4824 + else if ( mpHelp && mpHelp->mxChild == xChild )
4827 + p = removeChildData( maOther, xChild );
4832 + unsetChildParent( xChild );
4838 + DBG_ERROR( "DialogButtonHBox: removeChild: no such child" );
4843 +DialogButtonHBox::gnomeOrdering()
4845 + std::list< Box_Base::ChildData * > ordered;
4847 + ordered.push_back( mpHelp );
4849 + ordered.push_back( mpReset );
4850 + if ( mpFlow && ( mpHelp || mpReset ) )
4851 + ordered.push_back( mpFlow );
4852 + ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
4854 + ordered.push_back( mpAction );
4856 + ordered.push_back( mpApply );
4857 + if ( mpAlternate )
4858 + ordered.push_back( mpAlternate );
4860 + ordered.push_back( mpCancel );
4861 + if ( mpAffirmative )
4862 + ordered.push_back( mpAffirmative );
4863 + maChildren = ordered;
4867 +DialogButtonHBox::kdeOrdering()
4869 + std::list< Box_Base::ChildData * > ordered;
4871 + ordered.push_back( mpHelp );
4873 + ordered.push_back( mpReset );
4874 + if ( mpFlow && ( mpHelp || mpReset ) )
4875 + ordered.push_back( mpFlow );
4876 + ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
4878 + ordered.push_back( mpAction );
4879 + if ( mpAffirmative )
4880 + ordered.push_back( mpAffirmative );
4882 + ordered.push_back( mpApply );
4883 + if ( mpAlternate )
4884 + ordered.push_back( mpAlternate );
4886 + ordered.push_back( mpCancel );
4887 + maChildren = ordered;
4891 +DialogButtonHBox::macosOrdering()
4893 + std::list< Box_Base::ChildData * > ordered;
4895 + ordered.push_back( mpHelp );
4897 + ordered.push_back( mpReset );
4899 + ordered.push_back( mpApply );
4901 + ordered.push_back( mpAction );
4902 + ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
4903 + if ( mpFlow ) // Always flow? && ( maOther.size () || mpHelp || mpReset || mpAction ) )
4904 + ordered.push_back( mpFlow );
4905 + if ( mpAlternate )
4906 + ordered.push_back( mpAlternate );
4907 + if ( mpFlow && mpAlternate )
4908 + ordered.push_back( mpFlow );
4910 + ordered.push_back( mpCancel );
4911 + if ( mpAffirmative )
4912 + ordered.push_back( mpAffirmative );
4913 + maChildren = ordered;
4917 +DialogButtonHBox::windowsOrdering()
4919 + std::list< Box_Base::ChildData * > ordered;
4921 + ordered.push_back( mpReset );
4922 + if ( mpReset && mpFlow )
4923 + ordered.push_back( mpFlow );
4924 + if ( mpAffirmative )
4925 + ordered.push_back( mpAffirmative );
4926 + if ( mpAlternate )
4927 + ordered.push_back( mpAlternate );
4929 + ordered.push_back( mpAction );
4931 + ordered.push_back( mpCancel );
4933 + ordered.push_back( mpApply );
4934 + ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
4936 + ordered.push_back( mpHelp );
4937 + maChildren = ordered;
4940 +} // namespace layoutimpl
4941 --- toolkit/source/layout/core/dialogbuttonhbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
4942 +++ toolkit/source/layout/core/dialogbuttonhbox.hxx 2009-04-06 16:42:13.000000000 +0000
4944 +/*************************************************************************
4946 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4948 + * Copyright 2008 by Sun Microsystems, Inc.
4950 + * OpenOffice.org - a multi-platform office productivity suite
4956 + * This file is part of OpenOffice.org.
4958 + * OpenOffice.org is free software: you can redistribute it and/or modify
4959 + * it under the terms of the GNU Lesser General Public License version 3
4960 + * only, as published by the Free Software Foundation.
4962 + * OpenOffice.org is distributed in the hope that it will be useful,
4963 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4964 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4965 + * GNU Lesser General Public License version 3 for more details
4966 + * (a copy is included in the LICENSE file that accompanied this code).
4968 + * You should have received a copy of the GNU Lesser General Public License
4969 + * version 3 along with OpenOffice.org. If not, see
4970 + * <http://www.openoffice.org/license.html>
4971 + * for a copy of the LGPLv3 License.
4973 + ************************************************************************/
4975 +#ifndef LAYOUT_CORE_DIALOGBUTTONHBOX_HXX
4976 +#define LAYOUT_CORE_DIALOGBUTTONHBOX_HXX
4978 +#include <layout/core/box.hxx>
4979 +#include <layout/core/flow.hxx>
4981 +namespace layoutimpl
4984 +class DialogButtonHBox : public HBox
4987 + DialogButtonHBox();
4989 + void setOrdering( rtl::OUString const& ordering );
4990 + void SAL_CALL addChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException, css::awt::MaxChildrenException );
4991 + void SAL_CALL removeChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException );
4994 + enum Ordering { PLATFORM, GNOME, KDE, MACOS, WINDOWS };
4996 + void orderChildren();
4997 + void gnomeOrdering();
4998 + void kdeOrdering();
4999 + void macosOrdering();
5000 + void windowsOrdering();
5002 + static Ordering const DEFAULT_ORDERING;
5003 + Ordering mnOrdering;
5006 + ChildData *mpAction; /* [..]?, [Retry?] */
5007 + ChildData *mpAffirmative; /* OK, Yes, Save */
5008 + ChildData *mpAlternate; /* NO, [Ignore?], Don't save, Quit without saving */
5009 + ChildData *mpApply; /* Deprecated? */
5010 + ChildData *mpCancel; /* Cancel, Close */
5011 + ChildData *mpFlow;
5012 + ChildData *mpHelp;
5013 + ChildData *mpReset;
5015 + std::list< Box_Base::ChildData *> maOther;
5018 +} // namespace layoutimpl
5020 +#endif /* LAYOUT_CORE_DIALOGBUTTONHBOX_HXX */
5021 --- toolkit/source/layout/core/factory.cxx.old 1970-01-01 00:00:00.000000000 +0000
5022 +++ toolkit/source/layout/core/factory.cxx 2009-04-06 16:42:13.000000000 +0000
5024 +/*************************************************************************
5026 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5028 + * Copyright 2008 by Sun Microsystems, Inc.
5030 + * OpenOffice.org - a multi-platform office productivity suite
5036 + * This file is part of OpenOffice.org.
5038 + * OpenOffice.org is free software: you can redistribute it and/or modify
5039 + * it under the terms of the GNU Lesser General Public License version 3
5040 + * only, as published by the Free Software Foundation.
5042 + * OpenOffice.org is distributed in the hope that it will be useful,
5043 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5044 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5045 + * GNU Lesser General Public License version 3 for more details
5046 + * (a copy is included in the LICENSE file that accompanied this code).
5048 + * You should have received a copy of the GNU Lesser General Public License
5049 + * version 3 along with OpenOffice.org. If not, see
5050 + * <http://www.openoffice.org/license.html>
5051 + * for a copy of the LGPLv3 License.
5053 + ************************************************************************/
5055 +#include "factory.hxx"
5057 +#include <com/sun/star/registry/XRegistryKey.hpp>
5058 +#include <com/sun/star/registry/InvalidRegistryException.hpp>
5059 +#include <cppuhelper/factory.hxx>
5061 +#include "root.hxx"
5063 +using namespace ::com::sun::star;
5064 +using namespace layoutimpl;
5066 +void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ )
5070 + ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
5071 + uno::Reference< lang::XSingleServiceFactory > xFactory;
5073 + if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) )
5074 + xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
5075 + LayoutFactory::impl_staticGetImplementationName(),
5076 + LayoutFactory::impl_staticCreateSelfInstance,
5077 + LayoutFactory::impl_staticGetSupportedServiceNames() );
5078 + if ( xFactory.is() )
5080 + xFactory->acquire();
5081 + pRet = xFactory.get();
5087 +sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * /*serviceManager*/, void * pRegistryKey )
5089 + if ( pRegistryKey )
5093 + uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) );
5094 + uno::Reference< registry::XRegistryKey > xNewKey;
5096 + xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
5097 + LayoutFactory::impl_staticGetImplementationName() +
5098 + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
5100 + const uno::Sequence< ::rtl::OUString > aServices = LayoutFactory::impl_staticGetSupportedServiceNames();
5101 + for ( sal_Int32 i = 0; i < aServices.getLength(); i++ )
5102 + xNewKey->createKey( aServices.getConstArray()[i] );
5106 + catch (registry::InvalidRegistryException &)
5108 + OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
5114 +// Component registration
5115 +::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName()
5117 + return ::rtl::OUString::createFromAscii( "com.sun.star.comp.awt.Layout" );
5120 +uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::impl_staticGetSupportedServiceNames()
5122 + uno::Sequence< ::rtl::OUString > aRet(2);
5123 + aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.awt.Layout");
5124 + aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.awt.Layout");
5128 +uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::impl_staticCreateSelfInstance(
5129 + const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
5131 + return uno::Reference< uno::XInterface >( *new LayoutFactory( xServiceManager ) );
5135 +::rtl::OUString SAL_CALL LayoutFactory::getImplementationName()
5136 + throw ( uno::RuntimeException )
5138 + return impl_staticGetImplementationName();
5141 +uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::getSupportedServiceNames()
5142 + throw ( uno::RuntimeException )
5144 + return impl_staticGetSupportedServiceNames();
5147 +sal_Bool SAL_CALL LayoutFactory::supportsService( const ::rtl::OUString& ServiceName )
5148 + throw ( uno::RuntimeException )
5150 + uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
5151 + for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
5152 + if ( ServiceName.compareTo( aSeq[i] ) == 0 )
5158 +// XSingleServiceFactory
5159 +uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstance()
5160 + throw ( uno::Exception,
5161 + uno::RuntimeException )
5163 + return uno::Reference< uno::XInterface >(
5164 + static_cast< OWeakObject* >( new LayoutRoot( m_xFactory ) ),
5168 +uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstanceWithArguments(
5169 + const uno::Sequence< uno::Any >& aArguments )
5170 + throw ( uno::Exception,
5171 + uno::RuntimeException )
5173 + uno::Reference< uno::XInterface > layout = createInstance();
5174 + uno::Reference< lang::XInitialization > xInit( layout, uno::UNO_QUERY );
5175 + xInit->initialize( aArguments );
5178 --- toolkit/source/layout/core/factory.hxx.old 1970-01-01 00:00:00.000000000 +0000
5179 +++ toolkit/source/layout/core/factory.hxx 2009-04-06 16:42:13.000000000 +0000
5181 +/*************************************************************************
5183 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5185 + * Copyright 2008 by Sun Microsystems, Inc.
5187 + * OpenOffice.org - a multi-platform office productivity suite
5193 + * This file is part of OpenOffice.org.
5195 + * OpenOffice.org is free software: you can redistribute it and/or modify
5196 + * it under the terms of the GNU Lesser General Public License version 3
5197 + * only, as published by the Free Software Foundation.
5199 + * OpenOffice.org is distributed in the hope that it will be useful,
5200 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5201 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5202 + * GNU Lesser General Public License version 3 for more details
5203 + * (a copy is included in the LICENSE file that accompanied this code).
5205 + * You should have received a copy of the GNU Lesser General Public License
5206 + * version 3 along with OpenOffice.org. If not, see
5207 + * <http://www.openoffice.org/license.html>
5208 + * for a copy of the LGPLv3 License.
5210 + ************************************************************************/
5212 +#ifndef LAYOUT_CORE_FACTORY_HXX
5213 +#define LAYOUT_CORE_FACTORY_HXX
5215 +#include <com/sun/star/lang/XSingleServiceFactory.hpp>
5216 +#include <com/sun/star/lang/XServiceInfo.hpp>
5217 +#include <cppuhelper/implbase2.hxx>
5218 +#include <toolkit/dllapi.h>
5220 +namespace layoutimpl
5225 +class TOOLKIT_DLLPUBLIC LayoutFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
5226 + ::com::sun::star::lang::XServiceInfo >
5228 + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
5231 + LayoutFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
5232 + : m_xFactory( xFactory )
5234 + OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
5237 + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
5238 + impl_staticGetSupportedServiceNames();
5240 + static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
5242 + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
5243 + impl_staticCreateSelfInstance(
5244 + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
5247 + // XSingleServiceFactory
5248 + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
5249 + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
5252 + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
5253 + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
5254 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
5258 +#endif /* LAYOUT_CORE_FACTORY_HXX */
5259 --- toolkit/source/layout/core/flow.cxx.old 1970-01-01 00:00:00.000000000 +0000
5260 +++ toolkit/source/layout/core/flow.cxx 2009-04-06 16:42:13.000000000 +0000
5262 +/*************************************************************************
5264 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5266 + * Copyright 2008 by Sun Microsystems, Inc.
5268 + * OpenOffice.org - a multi-platform office productivity suite
5274 + * This file is part of OpenOffice.org.
5276 + * OpenOffice.org is free software: you can redistribute it and/or modify
5277 + * it under the terms of the GNU Lesser General Public License version 3
5278 + * only, as published by the Free Software Foundation.
5280 + * OpenOffice.org is distributed in the hope that it will be useful,
5281 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5282 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5283 + * GNU Lesser General Public License version 3 for more details
5284 + * (a copy is included in the LICENSE file that accompanied this code).
5286 + * You should have received a copy of the GNU Lesser General Public License
5287 + * version 3 along with OpenOffice.org. If not, see
5288 + * <http://www.openoffice.org/license.html>
5289 + * for a copy of the LGPLv3 License.
5291 + ************************************************************************/
5293 +#include "flow.hxx"
5295 +#include <sal/macros.h>
5297 +namespace layoutimpl
5300 +using namespace css;
5302 +bool Flow::ChildData::isVisible()
5304 + return xChild.is();
5310 + , mbHomogeneous( false )
5312 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
5313 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
5315 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
5316 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
5321 +Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
5322 + throw (uno::RuntimeException, css::awt::MaxChildrenException)
5324 + if ( xChild.is() )
5326 + ChildData *pData = new ChildData();
5327 + pData->xChild = xChild;
5328 + maChildren.push_back( pData );
5330 + setChildParent( xChild );
5336 +Flow::removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild )
5337 + throw (css::uno::RuntimeException)
5339 + for ( std::list< ChildData * >::iterator it = maChildren.begin();
5340 + it != maChildren.end(); it++ )
5342 + if ( (*it)->xChild == xChild )
5345 + maChildren.erase( it );
5347 + unsetChildParent( xChild );
5354 +css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > SAL_CALL
5355 +Flow::getChildren()
5356 + throw (css::uno::RuntimeException)
5358 + uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
5359 + unsigned int i = 0;
5360 + for ( std::list< ChildData * >::iterator it = maChildren.begin();
5361 + it != maChildren.end(); it++, i++ )
5362 + children[i] = (*it)->xChild;
5367 +uno::Reference< beans::XPropertySet > SAL_CALL
5368 +Flow::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& /*xChild*/ )
5369 + throw (uno::RuntimeException)
5371 + return uno::Reference< beans::XPropertySet >();
5375 +Flow::calculateSize( long nMaxWidth )
5377 + long nNeedHeight = 0;
5379 + std::list<ChildData *>::const_iterator it;
5381 + // first pass, for homogeneous property
5382 + for (it = maChildren.begin(); it != maChildren.end(); it++)
5384 + if ( !(*it)->isVisible() )
5386 + (*it)->aRequisition = (*it)->xChild->getMinimumSize();
5387 + if ( mbHomogeneous )
5388 + mnEachWidth = SAL_MAX( mnEachWidth, (*it)->aRequisition.Width );
5391 + long nRowWidth = 0, nRowHeight = 0;
5392 + for (it = maChildren.begin(); it != maChildren.end(); it++)
5394 + if ( !(*it)->isVisible() )
5397 + awt::Size aChildSize = (*it)->aRequisition;
5398 + if ( mbHomogeneous )
5399 + aChildSize.Width = mnEachWidth;
5401 + if ( nMaxWidth && nRowWidth > 0 && nRowWidth + aChildSize.Width > nMaxWidth )
5404 + nNeedHeight += nRowHeight;
5407 + nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
5408 + nRowWidth += aChildSize.Width;
5410 + nNeedHeight += nRowHeight;
5412 + return awt::Size( nRowWidth, nNeedHeight );
5416 +Flow::getMinimumSize() throw(uno::RuntimeException)
5418 + return maRequisition = calculateSize( 0 );
5422 +Flow::hasHeightForWidth()
5423 + throw(css::uno::RuntimeException)
5429 +Flow::getHeightForWidth( sal_Int32 nWidth )
5430 + throw(css::uno::RuntimeException)
5432 + return calculateSize( nWidth ).Height;
5436 +Flow::allocateArea( const css::awt::Rectangle &rArea )
5437 + throw (css::uno::RuntimeException)
5439 + maAllocation = rArea;
5441 + std::list<ChildData *>::const_iterator it;
5442 + long nX = 0, nY = 0, nRowHeight = 0;
5443 + for (it = maChildren.begin(); it != maChildren.end(); it++)
5445 + ChildData *child = *it;
5446 + if ( !child->isVisible() )
5449 + awt::Size aChildSize( child->aRequisition );
5450 + if ( mbHomogeneous )
5451 + aChildSize.Width = mnEachWidth;
5453 + if ( nX > 0 && nX + aChildSize.Width > rArea.Width )
5459 + nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
5461 + allocateChildAt( child->xChild,
5462 + awt::Rectangle( rArea.X + nX, rArea.Y + nY, aChildSize.Width, aChildSize.Height ) );
5464 + nX += aChildSize.Width;
5468 +} // namespace layoutimpl
5469 --- toolkit/source/layout/core/flow.hxx.old 1970-01-01 00:00:00.000000000 +0000
5470 +++ toolkit/source/layout/core/flow.hxx 2009-04-06 16:42:13.000000000 +0000
5472 +/*************************************************************************
5474 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5476 + * Copyright 2008 by Sun Microsystems, Inc.
5478 + * OpenOffice.org - a multi-platform office productivity suite
5484 + * This file is part of OpenOffice.org.
5486 + * OpenOffice.org is free software: you can redistribute it and/or modify
5487 + * it under the terms of the GNU Lesser General Public License version 3
5488 + * only, as published by the Free Software Foundation.
5490 + * OpenOffice.org is distributed in the hope that it will be useful,
5491 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5492 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5493 + * GNU Lesser General Public License version 3 for more details
5494 + * (a copy is included in the LICENSE file that accompanied this code).
5496 + * You should have received a copy of the GNU Lesser General Public License
5497 + * version 3 along with OpenOffice.org. If not, see
5498 + * <http://www.openoffice.org/license.html>
5499 + * for a copy of the LGPLv3 License.
5501 + ************************************************************************/
5503 +#ifndef LAYOUT_CORE_FLOW_HXX
5504 +#define LAYOUT_CORE_FLOW_HXX
5506 +#include <layout/core/container.hxx>
5510 +namespace layoutimpl
5513 +class Flow : public Container
5516 + // Box properties (i.e. affect all children)
5517 + sal_Int32 mnSpacing;
5518 + sal_Bool mbHomogeneous;
5521 + // Children properties
5524 + css::awt::Size aRequisition;
5525 + css::uno::Reference< css::awt::XLayoutConstrains > xChild;
5526 + css::uno::Reference< css::beans::XPropertySet > xProps;
5531 + std::list< ChildData * > maChildren;
5532 + long mnEachWidth; // on homogeneous, the width of every child
5537 + // css::awt::XLayoutContainer
5538 + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
5539 + throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
5540 + virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
5541 + throw (css::uno::RuntimeException);
5543 + virtual css::uno::Sequence< css::uno::Reference
5544 + < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
5545 + throw (css::uno::RuntimeException);
5547 + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
5548 + const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
5549 + throw (css::uno::RuntimeException);
5551 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
5552 + throw (css::uno::RuntimeException);
5554 + virtual css::awt::Size SAL_CALL getMinimumSize()
5555 + throw(css::uno::RuntimeException);
5556 + virtual sal_Bool SAL_CALL hasHeightForWidth()
5557 + throw(css::uno::RuntimeException);
5558 + virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
5559 + throw(css::uno::RuntimeException);
5561 +PROPHELPER_SET_INFO
5564 + // shared between getMinimumSize() and getHeightForWidth()
5565 + css::awt::Size calculateSize( long nMaxWidth );
5568 +} // namespace layoutimpl
5570 +#endif /* LAYOUT_FLOW_CORE_HXX */
5571 --- toolkit/source/layout/core/helper.cxx.old 1970-01-01 00:00:00.000000000 +0000
5572 +++ toolkit/source/layout/core/helper.cxx 2009-04-06 16:42:13.000000000 +0000
5574 +/*************************************************************************
5576 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5578 + * Copyright 2008 by Sun Microsystems, Inc.
5580 + * OpenOffice.org - a multi-platform office productivity suite
5586 + * This file is part of OpenOffice.org.
5588 + * OpenOffice.org is free software: you can redistribute it and/or modify
5589 + * it under the terms of the GNU Lesser General Public License version 3
5590 + * only, as published by the Free Software Foundation.
5592 + * OpenOffice.org is distributed in the hope that it will be useful,
5593 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5594 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5595 + * GNU Lesser General Public License version 3 for more details
5596 + * (a copy is included in the LICENSE file that accompanied this code).
5598 + * You should have received a copy of the GNU Lesser General Public License
5599 + * version 3 along with OpenOffice.org. If not, see
5600 + * <http://www.openoffice.org/license.html>
5601 + * for a copy of the LGPLv3 License.
5603 + ************************************************************************/
5605 +#include "helper.hxx"
5607 +#include <assert.h>
5609 +#include <com/sun/star/awt/WindowAttribute.hpp>
5610 +#include <com/sun/star/awt/XWindow.hpp>
5611 +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
5612 +#include <toolkit/awt/vclxwindow.hxx>
5613 +#include <tools/debug.hxx>
5615 +#include "proplist.hxx"
5617 +#if TEST_LAYOUT && !defined( DBG_UTIL )
5620 +#define DBG_ERROR printf
5622 +#define DBG_ERROR1 printf
5624 +#define DBG_ERROR2 printf
5625 +#endif /* TEST_LAYOUT && !DBG_UTIL */
5627 +namespace layoutimpl
5629 +using namespace com::sun::star;
5630 +using rtl::OUString;
5632 +uno::Reference< awt::XWindowPeer >
5633 +getParent( uno::Reference< uno::XInterface > xRef )
5637 + uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY );
5641 + uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
5643 + xRef = xCont->getParent();
5645 + while ( xRef.is() );
5647 + return uno::Reference< awt::XWindowPeer >();
5651 +static uno::Reference< awt::XWindowPeer >
5652 +getToplevel( uno::Reference< uno::XInterface > xRef )
5654 + uno::Reference< awt::XWindowPeer > xTop, i;
5655 + while ( ( i = uno::Reference< awt::XWindowPeer >( xRef, uno::UNO_QUERY ) ).is() )
5659 + uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
5661 + xRef = xCont->getParent();
5663 + xRef = uno::Reference< awt::XWindowPeer >();
5674 +#include "dialogbuttonhbox.hxx"
5675 +#include "flow.hxx"
5676 +#include "localized-string.hxx"
5677 +#include "table.hxx"
5679 +namespace layoutimpl
5682 +oslModule WidgetFactory::mSfx2Library = 0;
5683 +WindowCreator WidgetFactory::mSfx2CreateWidget = 0;
5685 +uno::Reference <awt::XLayoutContainer> WidgetFactory::createContainer (OUString const& name)
5687 + uno::Reference< awt::XLayoutContainer > xPeer;
5689 + if ( name.equalsAscii( "hbox" ) )
5690 + xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() );
5691 + else if ( name.equalsAscii( "vbox" ) )
5692 + xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() );
5693 + else if ( name.equalsAscii( "table" ) )
5694 + xPeer = uno::Reference< awt::XLayoutContainer >( new Table() );
5695 + else if ( name.equalsAscii( "flow" ) )
5696 + xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() );
5697 + else if ( name.equalsAscii( "bin" ) )
5698 + xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() );
5699 + else if ( name.equalsAscii( "min-size" ) )
5700 + xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() );
5701 + else if ( name.equalsAscii( "align" ) )
5702 + xPeer = uno::Reference< awt::XLayoutContainer >( new Align() );
5703 + else if ( name.equalsAscii( "dialogbuttonhbox" ) )
5704 + xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() );
5709 +uno::Reference <awt::XLayoutConstrains> WidgetFactory::toolkitCreateWidget (uno::Reference <awt::XToolkit> xToolkit, uno::Reference <uno::XInterface> xParent, OUString const& name, long properties)
5711 + uno::Reference< awt::XLayoutConstrains > xPeer;
5712 + bool bToplevel = !xParent.is();
5714 + // UNO Control Widget
5715 + awt::WindowDescriptor desc;
5717 + desc.Type = awt::WindowClass_TOP;
5720 + desc.Type = awt::WindowClass_SIMPLE;
5723 + // top container -- a wrapper for framewindow -- is de-coupled
5724 + // from awt::XWindowPeer. So, getParent() fails at it.
5725 + uno::Reference< awt::XWindowPeer > xWinParent = getParent( xParent );
5727 + uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY );
5729 + assert( xParent.is() );
5730 + assert( xWinParent.is() );
5732 + With the new three layer instarr/rpath feature, when
5733 + prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to
5734 + LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0
5735 + vclxtoolkit::ImplCreateWindow failing to create any widget;
5736 + although it succeeds here.
5738 + While developing, one now must copy libtlx.so to
5739 + $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so
5742 + VCLXWindow* parentComponent = VCLXWindow::GetImplementation( xWinParent );
5743 + if ( !parentComponent )
5744 + throw uno::RuntimeException(
5745 + OUString::createFromAscii( "parent has no implementation" ),
5746 + uno::Reference< uno::XInterface >() );
5747 + desc.Parent = xWinParent;
5750 + desc.ParentIndex = 0;
5751 + // debugging help ...
5752 + desc.Bounds.X = 0;
5753 + desc.Bounds.Y = 0;
5754 + desc.Bounds.Width = 300;
5755 + desc.Bounds.Height = 200;
5757 + desc.WindowAttributes = properties;
5758 + desc.WindowServiceName = name;
5760 + uno::Reference< awt::XWindowPeer > xWinPeer;
5763 + OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) );
5764 + xWinPeer = xToolkit->createWindow( desc );
5765 + if ( !xWinPeer.is() )
5766 + throw uno::RuntimeException(
5767 + OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ),
5768 + uno::Reference< uno::XInterface >() );
5769 + xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY );
5771 + catch( uno::Exception & )
5773 + DBG_ERROR1( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( name ) );
5774 + return uno::Reference< awt::XLayoutConstrains >();
5777 +#if 0 // This shadows the show="false" property and seems otherwise
5780 + // default to visible, let then people change it on properties
5781 + if ( ! bToplevel )
5783 + uno::Reference< awt::XWindow> xWindow( xPeer, uno::UNO_QUERY );
5784 + if ( xWindow.is() )
5785 + xWindow->setVisible( true );
5792 +uno::Reference< awt::XLayoutConstrains >
5793 +WidgetFactory::createWidget (uno::Reference< awt::XToolkit > xToolkit, uno::Reference< uno::XInterface > xParent, OUString const& name, long properties)
5795 + uno::Reference< awt::XLayoutConstrains > xPeer;
5797 + xPeer = uno::Reference <awt::XLayoutConstrains> (createContainer (name), uno::UNO_QUERY);
5801 + xPeer = implCreateWidget (xParent, name, properties);
5805 +#define FIXED_INFO 1
5807 + OUString tName = name;
5809 + if ( name.equalsAscii( "fixedinfo" ) )
5810 + tName = OUString::createFromAscii( "fixedtext" );
5811 + xPeer = toolkitCreateWidget (xToolkit, xParent, tName, properties);
5813 + xPeer = toolkitCreateWidget (xToolkit, xParent, name, properties);
5819 +PropHelper::PropHelper() : LockHelper()
5820 + , cppu::OPropertySetHelper( maBrdcstHelper )
5826 +PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
5827 + uno::Type aType, void *pPtr)
5829 + // this sucks rocks for effiency ...
5830 + PropDetails aDetails;
5831 + aDetails.aName = rtl::OUString::intern( pName, nNameLen, e );
5832 + aDetails.aType = aType;
5833 + aDetails.pValue = pPtr;
5834 + maDetails.push_back( aDetails );
5837 +cppu::IPropertyArrayHelper & SAL_CALL
5838 +PropHelper::getInfoHelper()
5842 + uno::Sequence< beans::Property > aProps( maDetails.size() );
5843 + for ( unsigned int i = 0; i < maDetails.size(); i++)
5845 + aProps[i].Name = maDetails[i].aName;
5846 + aProps[i].Type = maDetails[i].aType;
5847 + aProps[i].Handle = i;
5848 + aProps[i].Attributes = 0;
5850 + pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ );
5857 +PropHelper::convertFastPropertyValue(
5858 + uno::Any & rConvertedValue,
5859 + uno::Any & rOldValue,
5860 + sal_Int32 nHandle,
5861 + const uno::Any& rValue )
5862 + throw (lang::IllegalArgumentException)
5864 + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
5866 + // FIXME: no Any::getValue ...
5867 + getFastPropertyValue( rOldValue, nHandle );
5868 + if ( rOldValue != rValue )
5870 + rConvertedValue = rValue;
5871 + return sal_True; // changed
5875 + rConvertedValue.clear();
5876 + rOldValue.clear();
5883 +PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
5884 + const uno::Any& rValue )
5885 + throw (uno::Exception)
5887 + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
5889 + const PropDetails &rInfo = maDetails[ nHandle ];
5891 + uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(),
5892 + rValue.pData, rValue.pType,
5896 + mpListener->propertiesChanged();
5900 +PropHelper::getFastPropertyValue( uno::Any& rValue,
5901 + sal_Int32 nHandle ) const
5903 + OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
5904 + const PropDetails &rInfo = maDetails[ nHandle ];
5906 + switch ( rInfo.aType.getTypeClass() )
5908 +#define MAP(classtype,ctype) \
5909 + case uno::TypeClass_##classtype: \
5910 + rValue <<= *(ctype *)(rInfo.pValue); \
5912 + MAP( DOUBLE, double );
5913 + MAP( SHORT, sal_Int16 );
5914 + MAP( LONG, sal_Int32 );
5915 + MAP( UNSIGNED_SHORT, sal_uInt16 );
5916 + MAP( UNSIGNED_LONG, sal_uInt32 );
5917 + MAP( STRING, ::rtl::OUString );
5919 + DBG_ERROR( "ERROR: unknown type to map!" );
5924 + rValue.setValue( rInfo.pValue, rInfo.aType );
5927 +::com::sun::star::uno::Any
5928 +PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5930 + return OPropertySetHelper::queryInterface( rType );
5933 +} // namespace layoutimpl
5935 +#include <awt/vclxbutton.hxx>
5936 +#include <awt/vclxdialog.hxx>
5937 +#include <awt/vclxfixedline.hxx>
5938 +#include <awt/vclxplugin.hxx>
5939 +#include <awt/vclxscroller.hxx>
5940 +#include <awt/vclxsplitter.hxx>
5941 +#include <awt/vclxtabcontrol.hxx>
5942 +#include <awt/vclxtabpage.hxx>
5943 +#include <toolkit/awt/vclxtoolkit.hxx>
5944 +#include <toolkit/awt/vclxwindow.hxx>
5945 +#include <vcl/button.hxx>
5946 +#include <vcl/dialog.hxx>
5947 +#include <vcl/fixed.hxx>
5948 +#include <vcl/tabctrl.hxx>
5949 +#include <vcl/tabpage.hxx>
5950 +#include <vcl/unohelp.hxx>
5952 +#include <layout/layout.hxx>
5953 +#include <toolkit/awt/vclxwindows.hxx>
5954 +#include <vcl/lstbox.hxx>
5957 +#include <typeinfo>
5959 +namespace layoutimpl
5962 +uno::Reference <awt::XLayoutConstrains> WidgetFactory::implCreateWidget (uno::Reference <uno::XInterface> xParent, OUString name, long attributes)
5964 + Window* parent = 0;
5966 + if (VCLXWindow* parentComponent = VCLXWindow::GetImplementation (xParent))
5967 + parent = parentComponent->GetWindow ();
5969 + VCLXWindow* component = 0;
5970 + Window* window = 0; //sfx2CreateWindow (&component, parent, name, attributes);
5972 + window = layoutCreateWindow (&component, parent, name, attributes);
5974 + uno::Reference <awt::XLayoutConstrains> reference;
5977 + window->SetCreatedWithToolkit( sal_True );
5979 + component->SetCreatedWithToolkit( true );
5980 + reference = component;
5981 + window->SetComponentInterface( component );
5982 + if ( attributes & awt::WindowAttribute::SHOW )
5989 +extern "C" { static void SAL_CALL thisModule() {} }
5991 +Window* WidgetFactory::sfx2CreateWindow (VCLXWindow** component, Window* parent, OUString const& name, long& attributes)
5993 + OSL_TRACE("Asking sfx2: %s", OUSTRING_CSTR (name));
5995 + if (!mSfx2Library)
5997 + OUString libraryName = ::vcl::unohelper::CreateLibraryName ("sfx", TRUE);
5998 + mSfx2Library = osl_loadModuleRelative (&thisModule, libraryName.pData, SAL_LOADMODULE_DEFAULT);
6001 + OUString functionName (RTL_CONSTASCII_USTRINGPARAM ("CreateWindow"));
6002 + mSfx2CreateWidget = (WindowCreator) osl_getFunctionSymbol (mSfx2Library, functionName.pData);
6006 + if (mSfx2CreateWidget)
6007 + return mSfx2CreateWidget (component, name, parent, attributes);
6012 +Window* WidgetFactory::layoutCreateWindow (VCLXWindow** component, Window *parent, OUString const& name, long& attributes)
6014 + Window* window = 0;
6020 + if ( name.equalsAscii( "dialog" ) )
6022 + if ( parent == NULL )
6023 + parent = DIALOG_NO_PARENT;
6024 + window = new Dialog( parent, ImplGetWinBits( attributes, 0 ) );
6025 + *component = new layoutimpl::VCLXDialog();
6027 + attributes ^= awt::WindowAttribute::SHOW;
6029 + else if ( name.equalsAscii( "modaldialog" ) )
6031 + if ( parent == NULL )
6032 + parent = DIALOG_NO_PARENT;
6033 + window = new ModalDialog( parent, ImplGetWinBits( attributes, 0 ) );
6034 + *component = new layoutimpl::VCLXDialog();
6036 + attributes ^= awt::WindowAttribute::SHOW;
6038 + else if ( name.equalsAscii( "modelessdialog" ) )
6040 + if ( parent == NULL )
6041 + parent = DIALOG_NO_PARENT;
6042 + window = new ModelessDialog (parent, ImplGetWinBits (attributes, 0));
6043 + *component = new layoutimpl::VCLXDialog();
6045 + attributes ^= awt::WindowAttribute::SHOW;
6047 + else if ( name.equalsAscii( "sfxdialog" ) )
6049 + if ( parent == NULL )
6050 + parent = DIALOG_NO_PARENT;
6051 + window = new ClosingDialog (parent, ImplGetWinBits (attributes, 0));
6052 + *component = new layoutimpl::VCLXDialog();
6054 + attributes ^= awt::WindowAttribute::SHOW;
6056 + else if ( name.equalsAscii( "sfxmodaldialog" ) )
6058 + if ( parent == NULL )
6059 + parent = DIALOG_NO_PARENT;
6060 + window = new ClosingModalDialog( parent,
6061 + ImplGetWinBits( attributes, 0 ) );
6062 + *component = new layoutimpl::VCLXDialog();
6064 + attributes ^= awt::WindowAttribute::SHOW;
6066 + else if ( name.equalsAscii( "sfxmodelessdialog" ) )
6068 + if ( parent == NULL )
6069 + parent = DIALOG_NO_PARENT;
6070 + window = new ClosingModelessDialog (parent, ImplGetWinBits (attributes, 0));
6071 + *component = new layoutimpl::VCLXDialog();
6073 + attributes ^= awt::WindowAttribute::SHOW;
6075 + else if ( name.equalsAscii( "tabcontrol" ) )
6077 + window = new TabControl( parent, ImplGetWinBits( attributes, WINDOW_TABCONTROL ) );
6078 + *component = new layoutimpl::VCLXTabControl();
6080 + else if ( name.equalsAscii( "scroller" ) )
6082 + // used FixedImage because I just want some empty non-intrusive widget
6083 + window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
6084 + *component = new layoutimpl::VCLXScroller();
6086 + else if ( name.equalsAscii( "hsplitter" ) || name.equalsAscii( "vsplitter" ) )
6088 + window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
6089 + *component = new layoutimpl::VCLXSplitter( name.equalsAscii( "hsplitter" ) );
6091 + else if ( name.equalsAscii( "hfixedline" ) || name.equalsAscii( "vfixedline" ) )
6093 + WinBits nStyle = ImplGetWinBits( attributes, 0 );
6094 + nStyle ^= WB_HORZ;
6095 + if ( name.equalsAscii( "hfixedline" ) )
6096 + nStyle |= WB_HORZ;
6098 + nStyle |= WB_VERT;
6099 + window = new FixedLine( parent, nStyle );
6100 + *component = new layoutimpl::VCLXFixedLine();
6102 + else if ( name.equalsAscii( "okbutton" ) )
6104 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6105 + *component = new layoutimpl::VCLXOKButton( window );
6106 + window->SetType (WINDOW_OKBUTTON);
6108 + else if ( name.equalsAscii( "cancelbutton" ) )
6110 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6111 + *component = new layoutimpl::VCLXCancelButton( window );
6112 + window->SetType (WINDOW_CANCELBUTTON);
6114 + else if ( name.equalsAscii( "yesbutton" ) )
6116 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6117 + *component = new layoutimpl::VCLXYesButton( window );
6118 + window->SetType (WINDOW_OKBUTTON);
6120 + else if ( name.equalsAscii( "nobutton" ) )
6122 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6123 + window->SetType (WINDOW_CANCELBUTTON);
6124 + *component = new layoutimpl::VCLXNoButton( window );
6126 + else if ( name.equalsAscii( "retrybutton" ) )
6128 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6129 + *component = new layoutimpl::VCLXRetryButton( window );
6131 + else if ( name.equalsAscii( "ignorebutton" ) )
6133 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6134 + *component = new layoutimpl::VCLXIgnoreButton( window );
6136 + else if ( name.equalsAscii( "resetbutton" ) )
6138 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6139 + *component = new layoutimpl::VCLXResetButton( window );
6141 + else if ( name.equalsAscii( "applybutton" ) )
6143 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6144 + *component = new layoutimpl::VCLXApplyButton( window );
6146 + else if ( name.equalsAscii( "helpbutton" ) )
6148 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6149 + *component = new layoutimpl::VCLXHelpButton( window );
6150 + window->SetType (WINDOW_HELPBUTTON);
6152 + else if ( name.equalsAscii( "morebutton" ) )
6154 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6155 + *component = new layoutimpl::VCLXMoreButton( window );
6156 + window->SetType (WINDOW_MOREBUTTON);
6158 + else if ( name.equalsAscii( "advancedbutton" ) )
6160 + window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
6161 + *component = new layoutimpl::VCLXAdvancedButton( window );
6163 + else if ( name.equalsAscii( "plugin" ) )
6165 + window = new Control( parent, ImplGetWinBits( attributes, 0 ) );
6166 + OSL_TRACE( "%s: parent=%p (%s)\n", __FUNCTION__, parent, typeid( *parent ).name() );
6167 + *component = new layoutimpl::VCLXPlugin( window, ImplGetWinBits( attributes, 0 ) );
6169 + else if ( name.equalsAscii( "tabpage" ) )
6173 + parent = layout::TabPage::global_parent;
6175 + if (layout::TabPage::global_parent)
6176 + parent = layout::TabPage::global_parent;
6177 + layout::TabPage::global_parent = 0;
6179 + //window = new TabPage( parent, ImplGetWinBits( attributes, 0 ) );
6180 + attributes ^= awt::WindowAttribute::SHOW;
6181 + WinBits nStyle = ImplGetWinBits( attributes, 0 );
6182 + nStyle |= WB_HIDE;
6183 + //nStyle |= WB_NODIALOGCONTROL;
6184 + //nStyle |= WB_DIALOGCONTROL;
6185 + //nStyle = 2147483714L;
6186 + OSL_TRACE( "in bits=%lu", nStyle );
6187 + window = new TabPage( parent, nStyle );
6188 + *component = new VCLXTabPage( window );
6190 + else if ( name.equalsAscii( "string" ) )
6192 + // FIXME: move <string>s.text to simple map<string> in root?
6193 + attributes &= ~awt::WindowAttribute::SHOW;
6194 + window = new Window( parent, ImplGetWinBits( attributes, 0 ) );
6195 + *component = new layoutimpl::LocalizedString();
6197 +#if 0 // parent paranoia
6198 + else if ( name.equalsAscii( "listbox" ) )
6200 + attributes |= awt::VclWindowPeerAttribute::DROPDOWN;
6201 + WinBits nStyle = ImplGetWinBits( attributes, 0 );
6202 + nStyle |= WB_DROPDOWN;
6203 + window = new ListBox( parent, nStyle );
6204 + *component = new VCLXListBox ();
6210 +} // namespace layoutimpl
6212 +// Avoid polluting the rest of the code with vcl linkage pieces ...
6214 +#include <vcl/imagerepository.hxx>
6215 +#include <vcl/bitmapex.hxx>
6216 +#include <vcl/graph.hxx>
6218 +namespace layoutimpl
6221 +uno::Reference< graphic::XGraphic > loadGraphic( const char *pName )
6225 + OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US );
6226 + if ( aStr.compareToAscii( ".uno:" ) == 0 )
6227 + aStr = aStr.copy( 5 ).toAsciiLowerCase();
6229 + if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) )
6230 + return uno::Reference< graphic::XGraphic >();
6232 + return Graphic( aBmp ).GetXGraphic();
6235 +} // namespace layoutimpl
6236 --- toolkit/source/layout/core/helper.hxx.old 1970-01-01 00:00:00.000000000 +0000
6237 +++ toolkit/source/layout/core/helper.hxx 2009-04-06 16:42:13.000000000 +0000
6239 +/*************************************************************************
6241 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6243 + * Copyright 2008 by Sun Microsystems, Inc.
6245 + * OpenOffice.org - a multi-platform office productivity suite
6251 + * This file is part of OpenOffice.org.
6253 + * OpenOffice.org is free software: you can redistribute it and/or modify
6254 + * it under the terms of the GNU Lesser General Public License version 3
6255 + * only, as published by the Free Software Foundation.
6257 + * OpenOffice.org is distributed in the hope that it will be useful,
6258 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6259 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6260 + * GNU Lesser General Public License version 3 for more details
6261 + * (a copy is included in the LICENSE file that accompanied this code).
6263 + * You should have received a copy of the GNU Lesser General Public License
6264 + * version 3 along with OpenOffice.org. If not, see
6265 + * <http://www.openoffice.org/license.html>
6266 + * for a copy of the LGPLv3 License.
6268 + ************************************************************************/
6270 +#ifndef LAYOUT_CORE_HELPER_HXX
6271 +#define LAYOUT_CORE_HELPER_HXX
6273 +#include <toolkit/dllapi.h>
6276 +#include <com/sun/star/awt/XLayoutConstrains.hpp>
6277 +#include <com/sun/star/awt/XLayoutContainer.hpp>
6278 +#include <com/sun/star/awt/XVclWindowPeer.hpp>
6279 +#include <com/sun/star/xml/input/XRoot.hpp>
6280 +#include <com/sun/star/graphic/XGraphic.hpp>
6281 +#include <cppuhelper/implbase1.hxx>
6282 +#include <cppuhelper/propshlp.hxx>
6283 +#include <osl/module.h>
6284 +#include <rtl/ustring.hxx>
6290 + typedef Window* (SAL_CALL *WindowCreator) (VCLXWindow** component, rtl::OUString const& name, Window* parent, long& attributes);
6293 +namespace layoutimpl
6296 +namespace css = ::com::sun::star;
6298 +/* ChildProps -- a helper to set child properties for the XLayoutContainer interface. */
6303 + osl::Mutex maGuard;
6304 + cppu::OBroadcastHelper maBrdcstHelper;
6305 + LockHelper() : maBrdcstHelper( maGuard )
6310 +class PropHelper : public LockHelper
6311 + , public cppu::OPropertySetHelper
6312 + , public cppu::OWeakObject
6314 + cppu::OPropertyArrayHelper *pHelper;
6316 + struct PropDetails
6318 + rtl::OUString aName;
6319 + css::uno::Type aType;
6322 + std::vector< PropDetails > maDetails;
6325 + void addProp( char const *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
6326 + css::uno::Type aType, void *pPtr );
6331 + // com::sun::star::uno::XInterface
6332 + void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
6333 + void SAL_CALL release() throw() { OWeakObject::release(); }
6334 + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
6336 + // cppu::OPropertySetHelper
6337 + virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
6338 + virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any &,
6339 + css::uno::Any &, sal_Int32 nHandle, const css::uno::Any & )
6340 + throw(css::lang::IllegalArgumentException);
6341 + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
6342 + const css::uno::Any& rValue ) throw (css::uno::Exception);
6343 + using OPropertySetHelper::getFastPropertyValue;
6344 + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue,
6345 + sal_Int32 nHandle ) const;
6347 + // you -must- use this macro in sub-classes that define new properties.
6348 + // NB. 'static' ...
6349 + // com::sun::star::beans::XMultiPropertySet
6350 +#define PROPHELPER_SET_INFO \
6351 + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL \
6352 + getPropertySetInfo() throw(css::uno::RuntimeException) \
6354 + static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( \
6355 + createPropertySetInfo( getInfoHelper() ) ); \
6358 + PROPHELPER_SET_INFO
6362 + virtual void propertiesChanged() = 0;
6364 + void setChangeListener( Listener *pListener )
6366 + mpListener = pListener;
6370 + Listener *mpListener;
6373 +css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &type);
6375 +// The native widgets wrapper hierarchy may not reflect that of the layout
6376 +// hierarchy as some containers don't have an associated native widget.
6377 +// Use this function to get the native parent of the given peer.
6378 +css::uno::Reference< css::awt::XWindowPeer >
6379 +getParent( css::uno::Reference< css::uno::XInterface > xPeer );
6381 +class TOOLKIT_DLLPUBLIC WidgetFactory
6384 + static oslModule mSfx2Library;
6385 + static WindowCreator mSfx2CreateWidget;
6387 + // Should use UNO services in due course
6388 + 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);
6389 + 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);
6390 + static css::uno::Reference <css::awt::XLayoutContainer> createContainer (rtl::OUString const& name);
6391 + static css::uno::Reference <css::awt::XLayoutConstrains> implCreateWidget (css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString name, long attributes);
6392 + static Window* sfx2CreateWindow (VCLXWindow** component, Window* parent, rtl::OUString const& name, long& attributes);
6393 + static Window* layoutCreateWindow (VCLXWindow** component, Window *parent, rtl::OUString const& name, long& attributes);
6397 +css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName );
6399 +} // end namespace layoutimpl
6401 +#endif /* LAYOUT_CORE_HELPER_HXX */
6402 --- toolkit/source/layout/core/import.cxx.old 1970-01-01 00:00:00.000000000 +0000
6403 +++ toolkit/source/layout/core/import.cxx 2009-04-06 16:42:13.000000000 +0000
6405 +/*************************************************************************
6407 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6409 + * Copyright 2008 by Sun Microsystems, Inc.
6411 + * OpenOffice.org - a multi-platform office productivity suite
6417 + * This file is part of OpenOffice.org.
6419 + * OpenOffice.org is free software: you can redistribute it and/or modify
6420 + * it under the terms of the GNU Lesser General Public License version 3
6421 + * only, as published by the Free Software Foundation.
6423 + * OpenOffice.org is distributed in the hope that it will be useful,
6424 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6425 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6426 + * GNU Lesser General Public License version 3 for more details
6427 + * (a copy is included in the LICENSE file that accompanied this code).
6429 + * You should have received a copy of the GNU Lesser General Public License
6430 + * version 3 along with OpenOffice.org. If not, see
6431 + * <http://www.openoffice.org/license.html>
6432 + * for a copy of the LGPLv3 License.
6434 + ************************************************************************/
6436 +#include "import.hxx"
6438 +#include <com/sun/star/awt/XButton.hpp>
6439 +#include <com/sun/star/awt/XDialog2.hpp>
6440 +#include <vcl/image.hxx>
6441 +#include <tools/debug.hxx>
6442 +#include <layout/layout.hxx>
6444 +#include "root.hxx"
6445 +#include "helper.hxx"
6446 +#include "dialogbuttonhbox.hxx"
6449 +#define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout"
6450 +#define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container"
6452 +namespace layoutimpl
6454 +using namespace css;
6456 +using ::rtl::OUString;
6458 +ElementBase::~ElementBase()
6461 + //delete mpImport;
6466 +WidgetElement::WidgetElement ( sal_Int32 nUid, const OUString &rName,
6467 + uno::Reference <xml::input::XAttributes> const &attributes,
6468 + ElementBase *pParent,
6469 + ImportContext *pImport)
6471 +: ElementBase( nUid, rName, attributes, pParent, pImport )
6473 + OUString name = rName.toAsciiLowerCase();
6476 + propsFromAttributes( attributes, aProps, pImport->XMLNS_LAYOUT_UID );
6479 + findAndRemove( "id", aProps, aId );
6481 + findAndRemove( "xml-lang", aProps, aLang );
6485 + uno::Reference< awt::XLayoutConstrains > xParent;
6487 + xParent = ((WidgetElement *) pParent)->mpWidget->getPeer();
6490 + mpWidget = pImport->mrRoot.create( aId, name,
6491 + getAttributeProps( aProps ), uno::Reference< awt::XLayoutContainer >( xParent, uno::UNO_QUERY ) );
6495 + // TODO: handle with non-existing widgets
6497 + mpWidget->setProperties( aProps );
6499 + uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
6500 + if ( xDialog.is() )
6503 + if ( findAndRemove( "title", aProps, aTitle ) )
6505 + OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) );
6506 + xDialog->setTitle( aTitle );
6509 + if ( findAndRemove( "help-id", aProps, aHelpId ) )
6511 + OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) );
6512 + xDialog->setHelpId( aHelpId.toInt32 () );
6515 + else if ( pParent == NULL )
6517 + DBG_ERROR( "Fatal error: top node isn't a dialog" );
6521 + // Hack moved to proplist.cxx
6522 + OUString aGraphic;
6523 + if ( findAndRemove( "graphic", aProps, aGraphic ) )
6524 + //if ( layout::FixedImage *i = dynamic_cast<layout::FixedImage *> ( mpWidget->getPeer().get() ) )
6525 + // FIXME: huh? XImageProducer::complete( XImageConsumer )
6526 + //i->setImage( Image( loadGraphic( OUSTRING_CSTR( aGraphic ) ) ) );
6527 + mpWidget->setProperty( OUString::createFromAscii( "graphic" ),
6528 + loadGraphic( OUSTRING_CSTR( aGraphic ) ) );
6531 + OUString aOrdering;
6532 + if ( findAndRemove( "ordering", aProps, aOrdering ) )
6533 + if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
6534 + b->setOrdering ( aOrdering );
6536 + bool bSetRadioGroup;
6537 + OUString aRadioGroup;
6538 + bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
6540 + mpWidget->setProperties( aProps );
6542 + // we need to add radio buttons to the group after their properties are
6543 + // set, so we can check if they should be the one selected by default or not.
6544 + // And the state changed event isn't fired when changing properties.
6546 + uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY );
6547 + if ( xRadio.is() )
6549 + if (!bSetRadioGroup)
6550 + aRadioGroup = OUString::createFromAscii ("default");
6551 + pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
6555 +WidgetElement::~WidgetElement()
6557 + //delete mpWidget;
6561 +uno::Reference <xml::input::XElement>
6562 +WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
6563 + uno::Reference <xml::input::XAttributes> const &attributes )
6564 + throw( xml::sax::SAXException, uno::RuntimeException )
6566 + // Adding a child to the widget
6567 + WidgetElement *pChild = new WidgetElement ( nUid, name, attributes, this, mpImport );
6569 + if ( !mpWidget->addChild( pChild->mpWidget ) )
6571 + DBG_ERROR2( "ERROR: cannot add %s to container %s, container full", OUSTRING_CSTR( name ), OUSTRING_CSTR( getLocalName() ) );
6572 + throw xml::sax::SAXException();
6576 + propsFromAttributes( attributes, aProps, mpImport->XMLNS_CONTAINER_UID );
6577 + mpWidget->setChildProperties( pChild->mpWidget, aProps );
6582 +// Support Ivo Hinkelmann's move label/text/title attribute to CONTENT
6585 +WidgetElement::characters( OUString const& rChars )
6586 + throw (xml::sax::SAXException, uno::RuntimeException)
6588 + if ( mpWidget && rChars.trim().getLength() )
6590 + uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
6591 + uno::Reference< awt::XButton > xButton( mpWidget->getPeer(), uno::UNO_QUERY );
6592 + if ( xDialog.is() )
6593 + xDialog->setTitle( rChars );
6594 + else if ( xButton.is() )
6595 + mpWidget->setProperty( OUString::createFromAscii( "label" ), rChars );
6597 + mpWidget->setProperty( OUString::createFromAscii( "text" ), rChars );
6600 +// ---- ElementBase ----
6602 +ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName,
6603 + uno::Reference< xml::input::XAttributes > const & xAttributes,
6604 + ElementBase* pParent,
6605 + ImportContext* pImport )
6607 +: mpImport( pImport )
6608 + , mpParent( pParent )
6610 + , maLocalName( rLocalName )
6611 + , mxAttributes( xAttributes )
6615 +// ---- ImportContext ----
6617 +void ImportContext::startDocument(
6618 + uno::Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
6619 + throw (xml::sax::SAXException, uno::RuntimeException)
6621 + XMLNS_LAYOUT_UID = xNamespaceMapping->getUidByUri(
6622 + OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_LAYOUT_URI ) ) );
6623 + XMLNS_CONTAINER_UID = xNamespaceMapping->getUidByUri(
6624 + OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_CONTAINER_URI ) ) );
6627 +ToplevelElement::ToplevelElement (OUString const &rName,
6628 + uno::Reference <xml::input::XAttributes> const &xAttributes,
6629 + ImportContext *pImport)
6631 +: WidgetElement( 0, rName, xAttributes, NULL, pImport )
6635 +ToplevelElement::~ToplevelElement()
6639 +uno::Reference< xml::input::XElement > ImportContext::startRootElement(
6640 + sal_Int32 nUid, OUString const & rLocalName,
6641 + uno::Reference< xml::input::XAttributes > const & xAttributes )
6642 + throw (xml::sax::SAXException, uno::RuntimeException)
6644 + if ( XMLNS_LAYOUT_UID != nUid )
6645 + throw xml::sax::SAXException(
6646 + OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ),
6647 + uno::Reference< uno::XInterface >(), uno::Any() );
6648 + return new ToplevelElement( rLocalName, xAttributes, this );
6651 +RadioGroups::RadioGroups()
6655 +void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio )
6656 + throw (uno::RuntimeException)
6658 + if ( ! xRadio.is() )
6659 + throw uno::RuntimeException();
6661 + uno::Reference< RadioGroup > group;
6662 + RadioGroupsMap::iterator it = mxRadioGroups.find( id );
6663 + if ( it == mxRadioGroups.end() )
6665 + group = uno::Reference< RadioGroup > ( new RadioGroup() );
6666 + mxRadioGroups [id] = group;
6669 + group = it->second;
6670 + group->addItem( xRadio );
6673 +RadioGroups::RadioGroup::RadioGroup()
6677 +void RadioGroups::RadioGroup::addItem( uno::Reference< awt::XRadioButton > xRadio )
6679 + if ( ! mxSelectedRadio.is() )
6681 + xRadio->setState( true );
6682 + mxSelectedRadio = xRadio;
6684 + else if ( xRadio->getState() )
6687 + xRadio->setState( false );
6688 +#else // huh, why select last added?
6689 + mxSelectedRadio->setState( false );
6690 + mxSelectedRadio = xRadio;
6694 + // TOO late: actionPerformed is called before itemStateChanged.
6695 + // If client code (wrongly?) uses actionPerformed, it will see
6696 + // the previous RadioButtons' state.
6697 + xRadio->addItemListener( this );
6699 + uno::Reference< awt::XButton > xButton = uno::Reference< awt::XButton > ( xRadio, uno::UNO_QUERY );
6700 + xButton->addActionListener( this );
6702 + mxRadios.push_back (xRadio);
6705 +void RadioGroups::RadioGroup::handleSelected ()
6706 + throw (uno::RuntimeException)
6708 + for ( RadioButtonsList::iterator it = mxRadios.begin();
6709 + it != mxRadios.end(); it++ )
6710 + if ( *it != mxSelectedRadio && (*it)->getState() )
6712 + mxSelectedRadio->setState( false );
6713 + mxSelectedRadio = *it;
6718 +// awt::XItemListener
6719 +void RadioGroups::RadioGroup::itemStateChanged( const awt::ItemEvent& e )
6720 + throw (uno::RuntimeException)
6722 + // TOO late: actionPerformed is called before itemStateChanged.
6723 + // If client code (wrongly?) uses actionPerformed, it will see
6724 + // the previous RadioButtons' state.
6726 + // Need this for initialization, though.
6728 + handleSelected ();
6731 +// awt::XActionListener
6732 +void RadioGroups::RadioGroup::actionPerformed( const awt::ActionEvent& )
6733 + throw (uno::RuntimeException)
6735 + handleSelected ();
6738 +// lang::XEventListener
6739 +void SAL_CALL RadioGroups::RadioGroup::disposing( const lang::EventObject& )
6740 + throw (uno::RuntimeException)
6744 +} // namespace layoutimpl
6745 --- toolkit/source/layout/core/import.hxx.old 1970-01-01 00:00:00.000000000 +0000
6746 +++ toolkit/source/layout/core/import.hxx 2009-04-06 16:42:13.000000000 +0000
6748 +/*************************************************************************
6750 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6752 + * Copyright 2008 by Sun Microsystems, Inc.
6754 + * OpenOffice.org - a multi-platform office productivity suite
6760 + * This file is part of OpenOffice.org.
6762 + * OpenOffice.org is free software: you can redistribute it and/or modify
6763 + * it under the terms of the GNU Lesser General Public License version 3
6764 + * only, as published by the Free Software Foundation.
6766 + * OpenOffice.org is distributed in the hope that it will be useful,
6767 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6768 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6769 + * GNU Lesser General Public License version 3 for more details
6770 + * (a copy is included in the LICENSE file that accompanied this code).
6772 + * You should have received a copy of the GNU Lesser General Public License
6773 + * version 3 along with OpenOffice.org. If not, see
6774 + * <http://www.openoffice.org/license.html>
6775 + * for a copy of the LGPLv3 License.
6777 + ************************************************************************/
6779 +#ifndef LAYOUT_CORE_IMPORT_HXX
6780 +#define LAYOUT_CORE_IMPORT_HXX
6784 +#define _BACKWARD_BACKWARD_WARNING_H 1
6785 +#include <hash_map>
6788 +#include <com/sun/star/xml/input/XRoot.hpp>
6789 +#include <cppuhelper/implbase1.hxx>
6790 +#include <com/sun/star/awt/XButton.hpp>
6791 +#include <com/sun/star/awt/XRadioButton.hpp>
6793 +namespace layoutimpl
6796 +class LayoutWidget;
6797 +namespace css = ::com::sun::star;
6804 + void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio )
6805 + throw (css::uno::RuntimeException);
6808 + class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener >
6809 + , public ::cppu::WeakImplHelper1< css::awt::XActionListener >
6813 + void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio );
6816 + typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList;
6817 + RadioButtonsList mxRadios;
6818 + css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio;
6820 + void handleSelected ()
6821 + throw (css::uno::RuntimeException);
6823 + // awt::XItemListener
6824 + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e )
6825 + throw (css::uno::RuntimeException);
6827 + // awt::XActionListener
6828 + void SAL_CALL actionPerformed( const css::awt::ActionEvent& e )
6829 + throw (css::uno::RuntimeException);
6831 + // lang::XEventListener
6832 + void SAL_CALL disposing( const css::lang::EventObject& )
6833 + throw (css::uno::RuntimeException);
6836 + // each RadioGroup will stay alive after RadioGroups die with the ImportContext
6837 + // because they are referenced by every XRadioButton through the listener
6838 + typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap;
6839 + RadioGroupsMap mxRadioGroups;
6847 + Widget( css::uno::Reference< css::awt::XToolkit > xToolkit,
6848 + css::uno::Reference< css::awt::XWindow > xToplevel,
6849 + rtl::OUString unoName, long attrbs );
6850 + virtual ~Widget();
6852 + virtual void setProperties( const PropList &rProps );
6854 + virtual bool addChild( Widget *pChild );
6855 + virtual void setChildProperties( Widget *pChild, const PropList &rProps );
6857 + inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
6858 + { return mxWidget; }
6860 + inline css::uno::Reference< css::awt::XLayoutConstrains > getContainer()
6861 + { return mxContainer; }
6864 + css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
6865 + css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
6871 + Root( css::uno::Reference< css::awt::XToolkit > xToolkit )
6872 + : mxToolkit( xToolkit ) {}
6875 + virtual Widget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs );
6877 + css::uno::Reference< css::awt::XLayoutConstrains > getById( rtl::OUString id );
6878 + inline css::uno::Reference< css::awt::XLayoutConstrains > getToplevel();
6881 + css::uno::Reference< css::awt::XToolkit > mxToolkit;
6882 + Widget *mpToplevel;
6884 + typedef std::hash_map< rtl::OUString, css::uno::Reference< css::awt::XLayoutConstrains >,
6885 + rtl::OUStringHash > ItemHash;
6891 +class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
6894 + sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID;
6895 + LayoutRoot &mrRoot; // switch to XNameContainer ref ?
6896 + RadioGroups mxRadioGroups;
6898 + inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () )
6899 + : mrRoot( rRoot ) {}
6900 + virtual ~ImportContext() {}
6903 + virtual void SAL_CALL startDocument(
6904 + css::uno::Reference< css::xml::input::XNamespaceMapping >
6905 + const & xNamespaceMapping )
6906 + throw (css::xml::sax::SAXException, css::uno::RuntimeException);
6907 + virtual void SAL_CALL endDocument()
6908 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6910 + virtual void SAL_CALL processingInstruction(
6911 + ::rtl::OUString const & /* rTarget */, ::rtl::OUString const & /* rData */ )
6912 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6914 + virtual void SAL_CALL setDocumentLocator(
6915 + css::uno::Reference< css::xml::sax::XLocator > const & /* xLocator */ )
6916 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6918 + virtual css::uno::Reference< css::xml::input::XElement >
6919 + SAL_CALL startRootElement(
6920 + sal_Int32 nUid, ::rtl::OUString const & rLocalName,
6921 + css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
6922 + throw (css::xml::sax::SAXException, css::uno::RuntimeException);
6925 +class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
6928 + ImportContext *mpImport;
6929 +/* TODO: check if all this memebers are needed. */
6930 + ElementBase *mpParent;
6933 + ::rtl::OUString maLocalName;
6934 + css::uno::Reference< css::xml::input::XAttributes > mxAttributes;
6937 + sal_Int32 nUid, ::rtl::OUString const & rLocalName,
6938 + css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
6939 + ElementBase * pParent, ImportContext * pImport )
6941 + virtual ~ElementBase() SAL_THROW(());
6944 + virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
6945 + throw (css::uno::RuntimeException)
6946 + { return static_cast< css::xml::input::XElement * >( mpParent ); }
6947 + virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException)
6948 + { return maLocalName; }
6949 + virtual sal_Int32 SAL_CALL getUid() throw (css::uno::RuntimeException)
6951 + virtual css::uno::Reference< css::xml::input::XAttributes >
6952 + SAL_CALL getAttributes() throw (css::uno::RuntimeException)
6953 + { return mxAttributes; }
6955 + virtual void SAL_CALL ignorableWhitespace(
6956 + ::rtl::OUString const & /* rWhitespaces */ )
6957 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6959 + virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
6960 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6962 + virtual void SAL_CALL processingInstruction(
6963 + ::rtl::OUString const & /* Target */, ::rtl::OUString const & /* Data */ )
6964 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6967 + virtual css::uno::Reference< css::xml::input::XElement >
6968 + SAL_CALL startChildElement(
6969 + sal_Int32 nUid, ::rtl::OUString const & rLocalName,
6970 + css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
6971 + throw (css::xml::sax::SAXException, css::uno::RuntimeException) = 0;
6972 + virtual void SAL_CALL endElement()
6973 + throw (css::xml::sax::SAXException, css::uno::RuntimeException)
6977 +class WidgetElement : public ElementBase
6980 + LayoutWidget *mpWidget;
6983 + WidgetElement( sal_Int32 nUid, rtl::OUString const &name,
6984 + css::uno::Reference< css::xml::input::XAttributes > const &attributes,
6985 + ElementBase *parent, ImportContext *import ) SAL_THROW (());
6990 + virtual css::uno::Reference< css::xml::input::XElement> SAL_CALL
6991 + startChildElement (sal_Int32 id, rtl::OUString const &name,
6992 + css::uno::Reference< css::xml::input::XAttributes > const &attributes)
6993 + throw( css::xml::sax::SAXException, css::uno::RuntimeException );
6994 + virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
6995 + throw (css::xml::sax::SAXException, css::uno::RuntimeException);
6998 +class ToplevelElement : public WidgetElement
7001 + ToplevelElement( rtl::OUString const &name,
7002 + css::uno::Reference< css::xml::input::XAttributes > const &attributes,
7003 + ImportContext *import ) SAL_THROW (());
7004 + ~ToplevelElement();
7008 +} // namespace layoutimpl
7010 +#endif /* LAYOUT_CORE_IMPORT_HXX */
7011 --- toolkit/source/layout/core/localized-string.cxx.old 1970-01-01 00:00:00.000000000 +0000
7012 +++ toolkit/source/layout/core/localized-string.cxx 2009-04-06 16:42:13.000000000 +0000
7014 +/*************************************************************************
7016 + * OpenOffice.org - a multi-platform office productivity suite
7022 + * last change: $Author$ $Date$
7024 + * The Contents of this file are made available subject to
7025 + * the terms of GNU Lesser General Public License Version 2.1.
7028 + * GNU Lesser General Public License Version 2.1
7029 + * =============================================
7030 + * Copyright 2005 by Sun Microsystems, Inc.
7031 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
7033 + * This library is free software; you can redistribute it and/or
7034 + * modify it under the terms of the GNU Lesser General Public
7035 + * License version 2.1, as published by the Free Software Foundation.
7037 + * This library is distributed in the hope that it will be useful,
7038 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7039 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7040 + * Lesser General Public License for more details.
7042 + * You should have received a copy of the GNU Lesser General Public
7043 + * License along with this library; if not, write to the Free Software
7044 + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
7045 + * MA 02110-1301 USA
7047 + ************************************************************************/
7049 +#include "localized-string.hxx"
7051 +#include <toolkit/helper/property.hxx>
7052 +#include <vcl/window.hxx>
7054 +namespace layoutimpl
7057 +namespace css = ::com::sun::star;
7058 +using namespace css;
7059 +using rtl::OUString;
7061 +LocalizedString::LocalizedString()
7066 +void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids )
7068 + PushPropertyIds( ids, BASEPROPERTY_TEXT, 0);
7069 + VCLXWindow::ImplGetPropertyIds( ids );
7073 +uno::Any LocalizedString::queryInterface( uno::Type const& rType )
7074 + throw(uno::RuntimeException)
7076 + uno::Any aRet = ::cppu::queryInterface( rType,
7077 + SAL_STATIC_CAST( awt::XFixedText*, this ) );
7078 + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
7081 +void LocalizedString::setText( OUString const& s )
7082 + throw(uno::RuntimeException)
7084 + ::vos::OGuard aGuard( GetMutex() );
7086 + if ( Window *w = GetWindow() )
7087 + return w->SetText( s );
7090 +OUString LocalizedString::getText()
7091 + throw(uno::RuntimeException)
7093 + ::vos::OGuard aGuard( GetMutex() );
7095 + if ( Window *w = GetWindow() )
7096 + return w->GetText();
7097 + return OUString();
7100 +} // namespace layoutimpl
7101 --- toolkit/source/layout/core/localized-string.hxx.old 1970-01-01 00:00:00.000000000 +0000
7102 +++ toolkit/source/layout/core/localized-string.hxx 2009-04-06 16:42:13.000000000 +0000
7104 +/*************************************************************************
7106 + * OpenOffice.org - a multi-platform office productivity suite
7112 + * last change: $Author$ $Date$
7114 + * The Contents of this file are made available subject to
7115 + * the terms of GNU Lesser General Public License Version 2.1.
7118 + * GNU Lesser General Public License Version 2.1
7119 + * =============================================
7120 + * Copyright 2005 by Sun Microsystems, Inc.
7121 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
7123 + * This library is free software; you can redistribute it and/or
7124 + * modify it under the terms of the GNU Lesser General Public
7125 + * License version 2.1, as published by the Free Software Foundation.
7127 + * This library is distributed in the hope that it will be useful,
7128 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7129 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7130 + * Lesser General Public License for more details.
7132 + * You should have received a copy of the GNU Lesser General Public
7133 + * License along with this library; if not, write to the Free Software
7134 + * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
7135 + * MA 02110-1301 USA
7137 + ************************************************************************/
7139 +#ifndef LAYOUT_CORE_LOCALIZED_STRING_HXX
7140 +#define LAYOUT_CORE_LOCALIZED_STRING_HXX
7142 +#include <com/sun/star/awt/XFixedText.hpp>
7143 +#include <toolkit/awt/vclxwindow.hxx>
7145 +namespace layoutimpl
7147 +namespace css = ::com::sun::star;
7149 +// FIXME: misuse XFixedText interface for simple string
7150 +class LocalizedString : public css::awt::XFixedText
7151 + , public VCLXWindow
7154 + LocalizedString();
7156 + // css::uno::XInterface
7157 + css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType )
7158 + throw(css::uno::RuntimeException);
7159 + void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
7160 + void SAL_CALL release() throw() { OWeakObject::release(); }
7162 + // css::awt::XFixedText
7163 + void SAL_CALL setText( ::rtl::OUString const& s )
7164 + throw(css::uno::RuntimeException);
7165 + ::rtl::OUString SAL_CALL getText()
7166 + throw(css::uno::RuntimeException);
7167 + void SAL_CALL setAlignment( sal_Int16 )
7168 + throw(css::uno::RuntimeException) { }
7169 + sal_Int16 SAL_CALL getAlignment()
7170 + throw(css::uno::RuntimeException) { return 0; }
7172 + // css::awt::XLayoutConstrains
7173 + virtual css::awt::Size SAL_CALL getMinimumSize()
7174 + throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); }
7175 + css::awt::Size SAL_CALL getPreferredSize()
7176 + throw(css::uno::RuntimeException) { return getMinimumSize(); }
7177 + css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size )
7178 + throw(css::uno::RuntimeException) { return size; }
7180 + static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids );
7181 + virtual void GetPropertyIds( std::list< sal_uInt16 > &ids )
7182 + { return ImplGetPropertyIds( ids ); }
7185 +} // namespace layoutimpl
7187 +#endif /* LAYOUT_CORE_LOCALIZED_STRING_HXX */
7188 --- toolkit/source/layout/core/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
7189 +++ toolkit/source/layout/core/makefile.mk 2009-04-06 16:42:13.000000000 +0000
7191 +#*************************************************************************
7193 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7195 +# Copyright 2008 by Sun Microsystems, Inc.
7197 +# OpenOffice.org - a multi-platform office productivity suite
7203 +# This file is part of OpenOffice.org.
7205 +# OpenOffice.org is free software: you can redistribute it and/or modify
7206 +# it under the terms of the GNU Lesser General Public License version 3
7207 +# only, as published by the Free Software Foundation.
7209 +# OpenOffice.org is distributed in the hope that it will be useful,
7210 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
7211 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7212 +# GNU Lesser General Public License version 3 for more details
7213 +# (a copy is included in the LICENSE file that accompanied this code).
7215 +# You should have received a copy of the GNU Lesser General Public License
7216 +# version 3 along with OpenOffice.org. If not, see
7217 +# <http://www.openoffice.org/license.html>
7218 +# for a copy of the LGPLv3 License.
7220 +#*************************************************************************
7225 +ENABLE_EXCEPTIONS=true
7227 +# --- Settings -----------------------------------------------------
7229 +.INCLUDE : settings.mk
7230 +.INCLUDE : $(PRJ)$/util$/makefile.pmk
7232 +# --- Files --------------------------------------------------------
7234 +.IF "$(CCNUMVER)" >= "000400030000" && "$(CCNUMVER)" < "000400040000"
7240 + $(SLO)$/box-base.obj \
7242 + $(SLO)$/byteseq.obj \
7243 + $(SLO)$/container.obj \
7244 + $(SLO)$/dialogbuttonhbox.obj \
7245 + $(SLO)$/factory.obj \
7246 + $(SLO)$/flow.obj \
7247 + $(SLO)$/helper.obj \
7248 + $(SLO)$/import.obj \
7249 + $(SLO)$/localized-string.obj \
7250 + $(SLO)$/proplist.obj \
7251 + $(SLO)$/root.obj \
7252 + $(SLO)$/table.obj \
7253 + $(SLO)$/timer.obj \
7254 + $(SLO)$/translate.obj\
7258 +# --- Targets ------------------------------------------------------
7260 +.INCLUDE : target.mk
7261 --- toolkit/source/layout/core/precompiled_xmlscript.hxx.old 1970-01-01 00:00:00.000000000 +0000
7262 +++ toolkit/source/layout/core/precompiled_xmlscript.hxx 2009-04-06 16:42:13.000000000 +0000
7264 +/*************************************************************************
7266 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7268 + * Copyright 2008 by Sun Microsystems, Inc.
7270 + * OpenOffice.org - a multi-platform office productivity suite
7276 + * This file is part of OpenOffice.org.
7278 + * OpenOffice.org is free software: you can redistribute it and/or modify
7279 + * it under the terms of the GNU Lesser General Public License version 3
7280 + * only, as published by the Free Software Foundation.
7282 + * OpenOffice.org is distributed in the hope that it will be useful,
7283 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7284 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7285 + * GNU Lesser General Public License version 3 for more details
7286 + * (a copy is included in the LICENSE file that accompanied this code).
7288 + * You should have received a copy of the GNU Lesser General Public License
7289 + * version 3 along with OpenOffice.org. If not, see
7290 + * <http://www.openoffice.org/license.html>
7291 + * for a copy of the LGPLv3 License.
7293 + ************************************************************************/
7296 + xmlscript/source/xml_helper/xml_byteseq.cxx compile helper.
7298 + Avoid introducing a toolkit dependency on xmlscript.
7300 + It would be nice to modify xml_byteseq.cxx making it friendlier
7303 --- toolkit/source/layout/core/proplist.cxx.old 1970-01-01 00:00:00.000000000 +0000
7304 +++ toolkit/source/layout/core/proplist.cxx 2009-04-06 16:42:13.000000000 +0000
7306 +/*************************************************************************
7308 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7310 + * Copyright 2008 by Sun Microsystems, Inc.
7312 + * OpenOffice.org - a multi-platform office productivity suite
7318 + * This file is part of OpenOffice.org.
7320 + * OpenOffice.org is free software: you can redistribute it and/or modify
7321 + * it under the terms of the GNU Lesser General Public License version 3
7322 + * only, as published by the Free Software Foundation.
7324 + * OpenOffice.org is distributed in the hope that it will be useful,
7325 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7326 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7327 + * GNU Lesser General Public License version 3 for more details
7328 + * (a copy is included in the LICENSE file that accompanied this code).
7330 + * You should have received a copy of the GNU Lesser General Public License
7331 + * version 3 along with OpenOffice.org. If not, see
7332 + * <http://www.openoffice.org/license.html>
7333 + * for a copy of the LGPLv3 License.
7335 + ************************************************************************/
7337 +#include "proplist.hxx"
7339 +#include <rtl/ustrbuf.hxx>
7340 +#include <toolkit/dllapi.h>
7341 +#include <com/sun/star/awt/WindowAttribute.hpp>
7342 +#include <com/sun/star/beans/XPropertySet.hpp>
7343 +#include <com/sun/star/awt/XVclWindowPeer.hpp>
7344 +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
7345 +#include <tools/debug.hxx>
7347 +#include "helper.hxx"
7349 +#if TEST_LAYOUT && !defined( DBG_UTIL )
7352 +#define DBG_ERROR printf
7354 +#define DBG_ERROR1 printf
7356 +#define DBG_ERROR2 printf
7357 +#endif /* TEST_LAYOUT && !DBG_UTIL */
7359 +namespace layoutimpl
7362 +using namespace com::sun::star;
7363 +using rtl::OString;
7364 +using rtl::OUString;
7365 +using rtl::OUStringBuffer;
7370 +bool TOOLKIT_DLLPUBLIC
7371 +canHandleProps( const uno::Reference< uno::XInterface > &xPeer )
7373 + uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
7374 + if ( xPropSet.is() )
7376 + uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
7377 + uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
7378 + return xInfo.is() && xVclPeer.is();
7381 +uno::Reference< beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC
7383 + const uno::Reference< uno::XInterface > &xPeer )
7385 + uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
7386 + if ( !xInfo.is() )
7388 + uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
7389 + if ( xPropSet.is() )
7390 + xInfo = xPropSet->getPropertySetInfo();
7395 +void TOOLKIT_DLLPUBLIC
7396 +setProperty( const uno::Reference< uno::XInterface > &xPeer,
7397 + const OUString &rName, uno::Any aValue )
7399 + uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
7400 + if ( xVclPeer.is() )
7401 + xVclPeer->setProperty( rName, aValue );
7404 + uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
7405 + xPropSet->setPropertyValue( rName, aValue );
7409 +uno::Any TOOLKIT_DLLPUBLIC
7410 +getProperty( const uno::Reference< uno::XInterface > &xPeer,
7411 + const OUString &rName )
7413 + uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
7414 + if ( xVclPeer.is() )
7415 + return xVclPeer->getProperty( rName );
7417 + uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
7418 + return xPropSet->getPropertyValue( rName );
7421 +} // namespace prophlp
7424 +/* Given a string and a type, it converts the string to the type, and returns
7425 + it encapsulated in Any. */
7426 +uno::Any anyFromString( OUString const& value, uno::Type const& type )
7428 + sal_Int16 radix = 10;
7429 + OUString intval = value;
7430 + if ( value.getLength() > 2 && value[0] == '0' && value[1] == 'x' )
7431 + intval = value.copy( 2 ), radix = 16;
7432 + else if ( value.getLength() > 1 && value[0] == '#' )
7433 + intval = value.copy( 1 ), radix = 16;
7434 + switch ( type.getTypeClass() )
7436 + case uno::TypeClass_CHAR:
7437 + return uno::makeAny( value.toChar() );
7438 + case uno::TypeClass_BOOLEAN:
7439 + if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) )
7440 + return uno::makeAny( true );
7441 + else if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) )
7442 + return uno::makeAny( false );
7443 + break; // ends switch, throws exception
7444 + case uno::TypeClass_BYTE:
7445 + return uno::makeAny( ( sal_uInt8 ) intval.toInt32( radix ) );
7446 + case uno::TypeClass_SHORT:
7447 + return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
7448 + case uno::TypeClass_UNSIGNED_SHORT:
7449 + return uno::makeAny( ( sal_uInt16 ) intval.toInt32( radix ) );
7450 + case uno::TypeClass_ENUM:
7451 + return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
7452 + case uno::TypeClass_LONG:
7453 + return uno::makeAny( ( sal_Int32 ) intval.toInt32( radix ) );
7454 + case uno::TypeClass_UNSIGNED_LONG:
7455 + return uno::makeAny( ( sal_uInt32 ) intval.toInt32( radix ) );
7456 + case uno::TypeClass_HYPER:
7457 + return uno::makeAny( ( sal_Int64 ) intval.toInt64( radix ) );
7458 + case uno::TypeClass_UNSIGNED_HYPER:
7459 + return uno::makeAny( ( sal_uInt16 ) intval.toInt64( radix ) );
7460 + case uno::TypeClass_FLOAT:
7461 + return uno::makeAny( value.toFloat() );
7462 + case uno::TypeClass_DOUBLE:
7463 + return uno::makeAny( value.toDouble() );
7464 + case uno::TypeClass_STRING:
7465 + return uno::makeAny( value );
7466 + case uno::TypeClass_CONSTANT:
7467 + return uno::makeAny( intval.toInt32( radix ) );
7468 + case uno::TypeClass_INTERFACE:
7469 + return uno::makeAny( loadGraphic( OUSTRING_CSTR( value ) ) );
7470 + case uno::TypeClass_SEQUENCE:
7473 + bool escaped = false, first = true;
7474 + OUString item, token;
7475 + std::list< OUString > values;
7478 + token = value.getToken( 0, ':', i );
7480 + if ( !token.getLength() && !escaped )
7483 + item += OUString( ':' );
7485 + else if ( escaped )
7493 + values.push_back( item );
7499 + if ( item.getLength() )
7500 + values.push_back( item );
7502 + uno::Sequence< OUString > seq( values.size() );
7504 + for ( std::list< OUString >::const_iterator it = values.begin();
7505 + it != values.end(); it++, i++ )
7508 + return uno::makeAny( seq );
7512 + DBG_ERROR1( "ERROR: unknown property type of value: `%s'\n", OUSTRING_CSTR( value ) );
7515 + throw uno::RuntimeException();
7518 +/* Converts the XML naming scheme to UNO's, for legacy compatibility
7519 + (so, ergo, "one-two-three-four" -> "OneTwoThreeFour"). */
7520 +static OUString toUnoNaming ( OUString const &string )
7522 + OUStringBuffer buffer( string.getLength() );
7523 + sal_Unicode *str = string.pData->buffer;
7524 + bool capitalize = true;
7526 + for ( int i = 0; i < string.getLength(); i++ )
7528 + if ( i == 0 && str[0] == '_' )
7529 + /* Skip translate-me prefix. */
7531 + if ( str[i] == '-' )
7532 + capitalize = true;
7535 + if ( capitalize && str[i] >= 'a' && str[i] <= 'z' )
7536 + buffer.append( (sal_Unicode ) ( str[i] - 'a' + 'A' ) );
7538 + buffer.append( (sal_Unicode ) str[i] );
7539 + capitalize = false;
7543 + return buffer.makeStringAndClear();
7547 + * convert incoming XML style property names, to AWT style property names.
7548 + * convert the values based on introspection information.
7549 + * apply to either an XPropertySet or an XPropertySetInfo | XVclWindowPeer
7553 +setProperties( uno::Reference< uno::XInterface > const& xPeer,
7554 + PropList const& rProps )
7556 + if ( !prophlp::canHandleProps( xPeer ) )
7558 + DBG_ERROR( "Error: setProperties - bad handle ignoring props:\n" );
7559 + for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
7562 + DBG_ERROR2( "%s=%s\n", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) );
7567 + for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
7569 + setProperty( xPeer, it->first, it->second );
7573 +setProperty( uno::Reference< uno::XInterface > const& xPeer,
7574 + OUString const& attr, OUString const& value )
7576 + OUString unoAttr = toUnoNaming( attr );
7578 + OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) );
7579 + // get a Property object
7580 + beans::Property prop;
7583 + uno::Reference< beans::XPropertySetInfo > xInfo
7584 + = prophlp::queryPropertyInfo( xPeer );
7585 + prop = xInfo->getPropertyByName( unoAttr );
7587 + catch( beans::UnknownPropertyException & )
7589 + DBG_ERROR1( "Warning: unknown attribute: `%s'\n", OUSTRING_CSTR( unoAttr ) );
7593 + if ( prop.Name.getLength() <= 0 )
7595 + DBG_ERROR1( "Warning: missing prop: `%s'\n", OUSTRING_CSTR( unoAttr ) );
7599 + // encapsulates value in an uno::Any
7603 + any = anyFromString( value, prop.Type );
7605 + catch( uno::RuntimeException & )
7607 + DBG_ERROR5( "Warning: %s( %s )( %s ) attribute is of type %s( rejected: %s )\n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ), OUSTRING_CSTR( prop.Name ), OUSTRING_CSTR( prop.Type.getTypeName() ), OUSTRING_CSTR( value ) );
7611 + // sets value on property
7614 + prophlp::setProperty( xPeer, unoAttr, any );
7618 + DBG_ERROR2( "Warning: cannot set attribute %s to %s \n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ) );
7625 +struct AttributesMap
7631 +static const AttributesMap attribsMap[] =
7633 + { "autohscroll", awt::VclWindowPeerAttribute::AUTOHSCROLL, false },
7634 + { "autovscroll", awt::VclWindowPeerAttribute::AUTOVSCROLL, false },
7635 + { "center", awt::VclWindowPeerAttribute::CENTER, false },
7636 + { "clipchildren", awt::VclWindowPeerAttribute::CLIPCHILDREN, false },
7637 + { "closeable", awt::WindowAttribute::CLOSEABLE, true },
7638 + { "defbutton", awt::VclWindowPeerAttribute::DEFBUTTON, false },
7639 + { "dropdown", awt::VclWindowPeerAttribute::DROPDOWN, false },
7640 + { "fullsize", awt::WindowAttribute::FULLSIZE, true }, //FIXME?
7641 + { "group", awt::VclWindowPeerAttribute::GROUP, false },
7642 + { "has_border", awt::WindowAttribute::BORDER, true },
7643 + { "hscroll", awt::VclWindowPeerAttribute::HSCROLL, false },
7644 + { "left", awt::VclWindowPeerAttribute::LEFT, false },
7645 + { "moveable", awt::WindowAttribute::MOVEABLE, true },
7646 + { "noborder", awt::VclWindowPeerAttribute::NOBORDER, false },
7647 + { "nolabel", awt::VclWindowPeerAttribute::NOLABEL, false },
7648 + { "optimumsize", awt::WindowAttribute::OPTIMUMSIZE, false },
7649 + { "readonly", awt::VclWindowPeerAttribute::READONLY, false },
7650 + { "right", awt::VclWindowPeerAttribute::RIGHT, false },
7651 + { "show", awt::WindowAttribute::SHOW, true },
7652 + { "sizeable", awt::WindowAttribute::SIZEABLE, true },
7653 + { "sort", awt::VclWindowPeerAttribute::SORT, false },
7654 + { "spin", awt::VclWindowPeerAttribute::SPIN, false },
7655 + { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false },
7657 + // cutting on OK, YES_NO_CANCEL and related obsite attributes...
7659 +static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap );
7662 +long getAttribute( const OUString &rName, bool bTopWindow )
7665 + int min = 0, max = attribsMapLen - 1, mid, cmp;
7668 + mid = min +( max - min )/2;
7669 + cmp = rName.compareToAscii( attribsMap[ mid ].name );
7672 + else if ( cmp < 0 )
7676 + if ( bTopWindow || attribsMap[ mid ].value )
7677 + return attribsMap[ mid ].windowAttr;
7681 + while ( min <= max );
7686 +void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes,
7687 + PropList &rProps, sal_Int32 nNamespace )
7689 + sal_Int32 nAttrs = xAttributes->getLength();
7690 + for ( sal_Int32 i = 0; i < nAttrs; i++ )
7692 + if ( nNamespace != xAttributes->getUidByIndex( i ) )
7695 + std::pair< OUString, OUString > aElem
7696 + ( xAttributes->getLocalNameByIndex( i ),
7697 + xAttributes->getValueByIndex( i ) );
7699 + if ( aElem.first.getLength() > 0 ) // namespace bits ..
7700 + rProps.push_back( aElem );
7705 +findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue )
7707 + PropList::iterator it;
7708 + OUString aName = OUString::createFromAscii( pAttr );
7710 + for ( it = rProps.begin(); it != rProps.end(); it++ )
7712 + if ( it->first.equalsIgnoreAsciiCase( aName )
7713 + || it->first.equalsIgnoreAsciiCase( OUString::createFromAscii ("_") + aName ) )
7715 + rValue = it->second;
7716 + rProps.erase( it );
7720 + rValue = OUString();
7725 +getAttributeProps( PropList &rProps )
7730 + OUString trueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
7732 + if ( findAndRemove( "show", rProps, aValue ) &&
7733 + aValue.equalsIgnoreAsciiCase(
7734 + OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) )
7737 + nAttrs |= awt::WindowAttribute::SHOW;
7739 + for ( int i = 0; i < attribsMapLen; i++ )
7741 + if ( findAndRemove( attribsMap[i].name, rProps, aValue ) )
7743 + if ( aValue.equalsIgnoreAsciiCase( trueStr ) )
7744 + nAttrs |= attribsMap[i].value;
7748 + if ( findAndRemove( "align", rProps, aValue ) )
7750 + sal_Int32 nVal = aValue.toInt32();
7752 + if ( nVal == 0 /* PROPERTY_ALIGN_LEFT */ )
7753 + nAttrs |= awt::VclWindowPeerAttribute::LEFT;
7754 + else if ( nVal == 1 /* PROPERTY_ALIGN_CENTER */ )
7755 + nAttrs |= awt::VclWindowPeerAttribute::CENTER;
7756 + else if ( nVal == 2 )
7757 + nAttrs |= awt::VclWindowPeerAttribute::RIGHT;
7765 --- toolkit/source/layout/core/proplist.hxx.old 1970-01-01 00:00:00.000000000 +0000
7766 +++ toolkit/source/layout/core/proplist.hxx 2009-04-06 16:42:13.000000000 +0000
7768 +/*************************************************************************
7770 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7772 + * Copyright 2008 by Sun Microsystems, Inc.
7774 + * OpenOffice.org - a multi-platform office productivity suite
7780 + * This file is part of OpenOffice.org.
7782 + * OpenOffice.org is free software: you can redistribute it and/or modify
7783 + * it under the terms of the GNU Lesser General Public License version 3
7784 + * only, as published by the Free Software Foundation.
7786 + * OpenOffice.org is distributed in the hope that it will be useful,
7787 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7788 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7789 + * GNU Lesser General Public License version 3 for more details
7790 + * (a copy is included in the LICENSE file that accompanied this code).
7792 + * You should have received a copy of the GNU Lesser General Public License
7793 + * version 3 along with OpenOffice.org. If not, see
7794 + * <http://www.openoffice.org/license.html>
7795 + * for a copy of the LGPLv3 License.
7797 + ************************************************************************/
7799 +#ifndef LAYOUT_CORE_PROPLIST_HXX
7800 +#define LAYOUT_CORE_PROPLIST_HXX
7802 +#include <com/sun/star/beans/XPropertySetInfo.hpp>
7803 +#include <com/sun/star/xml/input/XAttributes.hpp>
7805 +#include <rtl/ustring.hxx>
7806 +#include <toolkit/dllapi.h>
7808 +namespace layoutimpl
7811 +namespace css = ::com::sun::star;
7813 +typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList;
7815 +void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes,
7816 + PropList &rProps, sal_Int32 nNamespace );
7818 +void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer,
7819 + PropList const& rProps);
7821 +void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer,
7822 + rtl::OUString const& attr, rtl::OUString const& value );
7824 +long getAttributeProps( PropList &rProps );
7825 +bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue);
7827 +// Helpers - unfortunately VCLXWindows don't implement XPropertySet
7828 +// but containers do - these helpers help us to hide this
7832 +// can we set properties on this handle ?
7833 +bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef );
7834 +// if so which properties ?
7835 +css::uno::Reference< css::beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC queryPropertyInfo(
7836 + const css::uno::Reference< css::uno::XInterface > &xRef );
7838 +void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
7839 + const rtl::OUString &rName,
7840 + css::uno::Any aValue );
7841 +css::uno::Any TOOLKIT_DLLPUBLIC getProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
7842 + const rtl::OUString &rName );
7843 +} // namespace prophlp
7845 +} // namespace layoutimpl
7848 +#if !OUSTRING_CSTR_PARANOIA
7849 +#define OUSTRING_CSTR( str ) \
7850 + rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
7853 +inline char const* OUSTRING_CSTR( rtl::OUString const& str )
7855 + rtl::OString *leak
7856 + = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US));
7857 + return leak->getStr();
7862 +#endif /* LAYOUT_CORE_PROPLIST_HXX */
7863 --- toolkit/source/layout/core/root.cxx.old 1970-01-01 00:00:00.000000000 +0000
7864 +++ toolkit/source/layout/core/root.cxx 2009-04-06 16:42:13.000000000 +0000
7866 +/*************************************************************************
7868 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7870 + * Copyright 2008 by Sun Microsystems, Inc.
7872 + * OpenOffice.org - a multi-platform office productivity suite
7878 + * This file is part of OpenOffice.org.
7880 + * OpenOffice.org is free software: you can redistribute it and/or modify
7881 + * it under the terms of the GNU Lesser General Public License version 3
7882 + * only, as published by the Free Software Foundation.
7884 + * OpenOffice.org is distributed in the hope that it will be useful,
7885 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7886 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7887 + * GNU Lesser General Public License version 3 for more details
7888 + * (a copy is included in the LICENSE file that accompanied this code).
7890 + * You should have received a copy of the GNU Lesser General Public License
7891 + * version 3 along with OpenOffice.org. If not, see
7892 + * <http://www.openoffice.org/license.html>
7893 + * for a copy of the LGPLv3 License.
7895 + ************************************************************************/
7897 +#include "root.hxx"
7902 +#include <com/sun/star/awt/WindowAttribute.hpp>
7903 +#include <com/sun/star/awt/XMessageBox.hpp>
7904 +#include <com/sun/star/awt/MessageBoxButtons.hpp>
7905 +#include <com/sun/star/frame/XDesktop.hpp>
7906 +#include <com/sun/star/awt/XMessageBoxFactory.hpp>
7907 +#include <com/sun/star/xml/sax/SAXParseException.hpp>
7908 +#include <com/sun/star/xml/sax/XParser.hpp>
7910 +#include "helper.hxx"
7911 +#include "import.hxx"
7912 +#include "timer.hxx"
7913 +#include "translate.hxx"
7915 +namespace layoutimpl
7918 +using namespace css;
7919 +using ::rtl::OUString;
7921 +LayoutRoot::LayoutRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
7922 + : mbDisposed( sal_False )
7923 + , mxFactory( xFactory )
7924 + , mpListeners( NULL )
7925 + , mpToplevel( NULL )
7927 + if ( !xFactory.is() )
7928 + throw uno::RuntimeException();
7929 + mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() );
7932 +LayoutRoot::~LayoutRoot()
7934 +// TODO: we want to delete the top level LayoutWidget...
7935 + ::osl::MutexGuard aGuard( maMutex );
7936 + if ( !mbDisposed )
7940 + m_refCount++; // inhibit multiple destruction
7943 + catch( uno::Exception& )
7949 +void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactory, uno::Reference< awt::XToolkit > xToolkit, OUString const& aTitle, OUString const& aMessage )
7951 + uno::Reference< uno::XInterface > iDesktop = xFactory->createInstance
7952 + ( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
7953 + uno::Reference< frame::XDesktop > xDesktop ( iDesktop, uno::UNO_QUERY );
7954 + uno::Reference< frame::XFrame > xFrame ( xDesktop->getCurrentFrame() );
7955 + uno::Reference< awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
7956 + uno::Reference< awt::XWindowPeer > xWindowPeer( xContainerWindow, uno::UNO_QUERY_THROW );
7957 + uno::Reference< awt::XMessageBoxFactory > xMessageBoxFactory( xToolkit, uno::UNO_QUERY );
7959 + awt::Rectangle aRectangle;
7960 + uno::Reference< awt::XMessageBox > xMessageBox
7961 + = xMessageBoxFactory->createMessageBox
7962 + ( xWindowPeer, aRectangle, OUString::createFromAscii( "errorbox" ),
7963 + awt::MessageBoxButtons::BUTTONS_OK, aTitle, aMessage );
7965 + if ( xMessageBox.is() )
7966 + xMessageBox->execute();
7967 + //FIXME: exceptions not caught and printed at top level??
7969 + //printf( "%s\n", OUSTRING_CSTR( aMessage ) );
7972 +void LayoutRoot::error( OUString const& message )
7974 + printf( "%s\n", OUSTRING_CSTR( message ) );
7975 + ShowMessageBox( mxFactory, mxToolkit,
7976 + OUString::createFromAscii( "Fatal error" ),
7978 + throw uno::RuntimeException( message, uno::Reference< uno::XInterface >() );
7982 +void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArguments )
7983 + throw ( uno::Exception,
7984 + uno::RuntimeException )
7986 + ::osl::MutexGuard aGuard( maMutex );
7989 + throw lang::DisposedException();
7991 + if ( mxContainer.is() ) // only 1 init ...
7992 + throw uno::Exception();
7994 + if ( !aArguments.getLength() )
7995 + throw lang::IllegalArgumentException();
7997 + OSL_ENSURE( aArguments.getLength() == 1, "Wrong arg count\n" );
7999 + OUString aXMLName;
8000 + if ( !( aArguments[0] >>= aXMLName ) )
8001 + throw lang::IllegalArgumentException();
8003 + uno::Reference< xml::sax::XParser > xParser
8004 + ( mxFactory->createInstance(
8005 + OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) ),
8007 + OSL_ASSERT( xParser.is() );
8008 + if (! xParser.is())
8010 + throw uno::RuntimeException(
8011 + OUString::createFromAscii( "cannot create sax-parser component" ),
8012 + uno::Reference< uno::XInterface >() );
8015 + // FIXME: quite possibly we want to pass this in ...
8016 + uno::Reference< awt::XToolkit > xToolkit;
8018 + mxToolkit = uno::Reference< awt::XToolkit >(
8019 + mxFactory->createInstance(
8020 + OUString::createFromAscii( "com.sun.star.awt.Toolkit" ) ),
8023 + if ( !mxToolkit.is() )
8024 + throw uno::RuntimeException(
8025 + OUString::createFromAscii( "failed to create toolkit!" ),
8026 + uno::Reference< uno::XInterface >() );
8028 + OUString aXMLFile = readRightTranslation( aXMLName );
8029 + uno::Reference< io::XInputStream > xStream = getFileAsStream( aXMLFile );
8030 + if (! xStream.is() )
8031 + error( OUString::createFromAscii( "Installation problem: cannot find XML file:" ) + aXMLName );
8033 + // error handler, entity resolver omitted
8035 + ImportContext *pCtx = new ImportContext( *this );
8037 + uno::Reference< xml::input::XRoot > xRoot( pCtx );
8038 + uno::Sequence < uno::Any > aArgs( 1 );
8039 + aArgs[0] <<= xRoot;
8040 + uno::Reference< xml::sax::XDocumentHandler > xDocHandler
8041 + (mxFactory->createInstanceWithArguments
8042 + ( OUString::createFromAscii( "com.sun.star.xml.input.SaxDocumentHandler" ),
8043 + aArgs ), uno::UNO_QUERY );
8045 + if (! xDocHandler.is() )
8046 + error( OUString::createFromAscii( "cannot find SAx handler for document type of:") + aXMLName );
8048 + xParser->setDocumentHandler( xDocHandler );
8050 + xml::sax::InputSource source;
8051 + source.aInputStream = xStream;
8052 + source.sSystemId = OUString::createFromAscii( "virtual file" );
8056 + xParser->parseStream( source );
8058 + catch ( xml::sax::SAXParseException& e )
8060 + OUString c = OUString::createFromAscii( ":" );
8062 + + c + OUString::valueOf( e.LineNumber )
8063 + + c + OUString::valueOf( e.ColumnNumber )
8064 + + c + OUString::createFromAscii( "Sax parse error" ) );
8068 +// XLayoutContainer
8069 +uno::Reference< awt::XLayoutContainer > LayoutRoot::getLayoutContainer() throw (uno::RuntimeException)
8071 + return uno::Reference< awt::XLayoutContainer >();
8074 +// local helper ...
8075 +void LayoutRoot::addItem( const OUString &rName,
8076 + const uno::Reference< awt::XLayoutConstrains > &xRef )
8078 + maItems[ rName ] = xRef;
8082 +uno::Any SAL_CALL LayoutRoot::getByName( const OUString &rName )
8083 + throw ( container::NoSuchElementException,
8084 + lang::WrappedTargetException,
8085 + uno::RuntimeException )
8087 + ::osl::MutexGuard aGuard( maMutex );
8089 + throw lang::DisposedException();
8091 + uno::Reference< awt::XLayoutConstrains > xItem;
8092 + ItemHash::iterator i = maItems.find( rName );
8093 + if ( i != maItems.end() )
8094 + xItem = i->second;
8095 + return uno::makeAny( xItem );
8098 +sal_Bool SAL_CALL LayoutRoot::hasByName( const OUString &rName )
8099 + throw (uno::RuntimeException)
8101 + ::osl::MutexGuard aGuard( maMutex );
8102 + if ( mbDisposed ) throw lang::DisposedException();
8104 + ItemHash::iterator i = maItems.find( rName );
8105 + return i != maItems.end();
8108 +uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames()
8109 + throw ( uno::RuntimeException )
8111 + ::osl::MutexGuard aGuard( maMutex );
8112 + if ( mbDisposed ) throw lang::DisposedException();
8114 + uno::Sequence< OUString > aNames( maItems.size() );
8115 + sal_Int32 nPos = 0;
8117 + for ( ItemHash::const_iterator it = maItems.begin();
8118 + it != maItems.end(); it++ )
8119 + aNames[ nPos++ ] = it->first;
8124 +uno::Type SAL_CALL LayoutRoot::getElementType()
8125 + throw ( uno::RuntimeException )
8127 + return getCppuType( ( const uno::Reference< awt::XLayoutConstrains >* )NULL );
8130 +sal_Bool SAL_CALL LayoutRoot::hasElements()
8131 + throw ( uno::RuntimeException )
8133 + ::osl::MutexGuard aGuard( maMutex );
8135 + if ( mbDisposed ) throw lang::DisposedException();
8137 + return maItems.size() > 0;
8141 +void SAL_CALL LayoutRoot::dispose()
8142 + throw ( uno::RuntimeException )
8144 + ::osl::MutexGuard aGuard( maMutex );
8146 + if ( mbDisposed ) throw lang::DisposedException();
8148 + if ( mpListeners )
8151 + lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
8152 + mpListeners->disposeAndClear( aSource );
8153 + delete mpListeners;
8154 + mpListeners = NULL;
8158 + mbDisposed = sal_True;
8161 +void SAL_CALL LayoutRoot::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
8162 + throw ( uno::RuntimeException )
8164 + ::osl::MutexGuard aGuard( maMutex );
8166 + if ( mbDisposed ) throw lang::DisposedException();
8168 + if ( !mpListeners )
8169 + mpListeners = new ::cppu::OInterfaceContainerHelper( maMutex );
8170 + mpListeners->addInterface( xListener );
8173 +void SAL_CALL LayoutRoot::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
8174 + throw ( uno::RuntimeException )
8176 + ::osl::MutexGuard aGuard( maMutex );
8178 + if ( mbDisposed ) throw lang::DisposedException();
8180 + if ( mpListeners )
8181 + mpListeners->removeInterface( xListener );
8186 +LayoutWidget *LayoutRoot::create( OUString id, const OUString unoName, long attrbs,uno::Reference< awt::XLayoutContainer > xParent )
8188 + LayoutWidget *pWidget = new LayoutWidget( mxToolkit, xParent, unoName, attrbs );
8189 + if ( !mpToplevel )
8191 + mpToplevel = pWidget;
8192 + mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
8193 + mxContainer = pWidget->mxContainer;
8195 + if ( pWidget->mxContainer.is() )
8196 + pWidget->mxContainer->setLayoutUnit( mxLayoutUnit );
8197 + if ( id.getLength() )
8198 + maItems[ id ] = pWidget->getPeer();
8203 +uno::Reference< awt::XLayoutConstrains > LayoutRoot::getToplevel()
8206 + return mpToplevel->getPeer();
8207 + return uno::Reference< awt::XLayoutConstrains > ();
8210 +uno::Reference< awt::XLayoutConstrains > LayoutRoot::getById( OUString id )
8212 + uno::Reference< awt::XLayoutConstrains > rRef = 0;
8213 + ItemHash::iterator it = maItems.find( id );
8214 + if ( it != maItems.end() )
8215 + rRef = it->second;
8220 +LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit,
8221 + uno::Reference< awt::XLayoutContainer > xParent,
8222 + OUString unoName, long attrbs )
8224 + while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
8226 + uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
8227 + assert( xContainer.is() );
8228 + xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
8231 + mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, attrbs );
8232 + assert( mxWidget.is() );
8233 + mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
8236 +LayoutWidget::~LayoutWidget()
8238 + /* should we dispose of the references...? */
8239 + // at least of its children... Or should root?
8242 +bool LayoutWidget::addChild( LayoutWidget *pChild )
8244 + if ( !mxContainer.is() )
8249 + mxContainer->addChild( pChild->mxWidget );
8251 + catch( awt::MaxChildrenException ex )
8258 +void LayoutWidget::setProperties( PropList const& rProps )
8260 + ::layoutimpl::setProperties( mxWidget, rProps );
8263 +void LayoutWidget::setProperty( OUString const& attr, OUString const& value )
8265 + ::layoutimpl::setProperty( mxWidget, attr, value );
8268 +void LayoutWidget::setChildProperties( LayoutWidget *pChild,
8269 + PropList const& rProps )
8271 + uno::Reference< beans::XPropertySet > xChildPeer;
8272 + xChildPeer = mxContainer->getChildProperties( pChild->mxWidget );
8274 + if ( xChildPeer.is() )
8275 + ::layoutimpl::setProperties( xChildPeer, rProps );
8278 +} // namespace layoutimpl
8280 --- toolkit/source/layout/core/root.hxx.old 1970-01-01 00:00:00.000000000 +0000
8281 +++ toolkit/source/layout/core/root.hxx 2009-04-06 16:42:13.000000000 +0000
8283 +/*************************************************************************
8285 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8287 + * Copyright 2008 by Sun Microsystems, Inc.
8289 + * OpenOffice.org - a multi-platform office productivity suite
8295 + * This file is part of OpenOffice.org.
8297 + * OpenOffice.org is free software: you can redistribute it and/or modify
8298 + * it under the terms of the GNU Lesser General Public License version 3
8299 + * only, as published by the Free Software Foundation.
8301 + * OpenOffice.org is distributed in the hope that it will be useful,
8302 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8303 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8304 + * GNU Lesser General Public License version 3 for more details
8305 + * (a copy is included in the LICENSE file that accompanied this code).
8307 + * You should have received a copy of the GNU Lesser General Public License
8308 + * version 3 along with OpenOffice.org. If not, see
8309 + * <http://www.openoffice.org/license.html>
8310 + * for a copy of the LGPLv3 License.
8312 + ************************************************************************/
8314 +#ifndef LAYOUT_CORE_ROOT_HXX
8315 +#define LAYOUT_CORE_ROOT_HXX
8317 +#define _BACKWARD_BACKWARD_WARNING_H 1
8318 +#include <hash_map>
8320 +#include <com/sun/star/awt/XLayoutRoot.hpp>
8321 +#include <com/sun/star/awt/XToolkit.hpp>
8322 +#include <com/sun/star/awt/XWindow.hpp>
8323 +#include <com/sun/star/io/XInputStream.hpp>
8324 +#include <com/sun/star/lang/XComponent.hpp>
8325 +#include <com/sun/star/lang/XInitialization.hpp>
8326 +#include <cppuhelper/implbase3.hxx>
8327 +#include <cppuhelper/interfacecontainer.h>
8328 +#include <toolkit/dllapi.h>
8330 +#include <layout/core/proplist.hxx>
8332 +namespace layoutimpl
8335 +namespace css = ::com::sun::star;
8337 +css::uno::Reference< css::io::XInputStream > getFileAsStream( const rtl::OUString &rName );
8339 +/* Interface generation code -- to hook to a parser. */
8342 + TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget
8343 + proxy interface (just make it return the root widget). Would even make it easier
8344 + if there was interest to support multiple toplevel widgets in the same file.
8346 + We also need to make sure the code gets diposed well... There is no need to keep
8347 + these objects around after initialization...
8351 +class LayoutWidget;
8353 +class TOOLKIT_DLLPUBLIC LayoutRoot : public ::cppu::WeakImplHelper3<
8354 + css::awt::XLayoutRoot,
8355 + css::lang::XInitialization,
8356 + css::lang::XComponent>
8359 + ::osl::Mutex maMutex;
8361 + typedef std::hash_map< rtl::OUString,
8362 + css::uno::Reference< css::awt::XLayoutConstrains >,
8363 + ::rtl::OUStringHash > ItemHash;
8366 + sal_Bool mbDisposed;
8367 + css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
8368 + ::cppu::OInterfaceContainerHelper *mpListeners;
8370 + css::uno::Reference< css::awt::XWindow > mxWindow;
8371 + css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
8373 + css::uno::Reference< css::awt::XToolkit > mxToolkit;
8374 + LayoutWidget *mpToplevel;
8375 + css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
8377 + void error( rtl::OUString const& message );
8380 + LayoutRoot( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
8381 + virtual ~LayoutRoot();
8383 + void addItem( const rtl::OUString &rName,
8384 + const css::uno::Reference< css::awt::XLayoutConstrains > &xRef );
8386 + void setWindow( css::uno::Reference< css::awt::XLayoutConstrains > xPeer )
8388 + mxWindow = css::uno::Reference< css::awt::XWindow >( xPeer, css::uno::UNO_QUERY );
8391 + // get XLayoutContainer
8392 + virtual css::uno::Reference< css::awt::XLayoutContainer > SAL_CALL getLayoutContainer() throw (css::uno::RuntimeException);
8394 + // XInitialization
8395 + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
8398 + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
8399 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException);
8400 + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
8401 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
8402 + virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
8405 + virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
8406 + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException);
8407 + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
8410 + virtual LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs, css::uno::Reference< css::awt::XLayoutContainer > xParent );
8413 +class TOOLKIT_DLLPUBLIC LayoutWidget
8415 + friend class LayoutRoot;
8419 + LayoutWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
8420 + css::uno::Reference< css::awt::XLayoutContainer > xToplevel,
8421 + rtl::OUString unoName, long attrbs );
8422 + virtual ~LayoutWidget();
8424 + virtual void setProperties( const PropList &rProps );
8425 + virtual void setProperty( rtl::OUString const& attr, rtl::OUString const& value );
8427 + virtual bool addChild( LayoutWidget *pChild );
8428 + virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps );
8430 + inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
8431 + { return mxWidget; }
8432 + inline css::uno::Reference< css::awt::XLayoutContainer > getContainer()
8433 + { return mxContainer; }
8436 + css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
8437 + css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
8440 +} // namespace layoutimpl
8442 +#endif /* LAYOUT_CORE_ROOT_HXX */
8443 --- toolkit/source/layout/core/table.cxx.old 1970-01-01 00:00:00.000000000 +0000
8444 +++ toolkit/source/layout/core/table.cxx 2009-04-06 16:42:13.000000000 +0000
8446 +/*************************************************************************
8448 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8450 + * Copyright 2008 by Sun Microsystems, Inc.
8452 + * OpenOffice.org - a multi-platform office productivity suite
8458 + * This file is part of OpenOffice.org.
8460 + * OpenOffice.org is free software: you can redistribute it and/or modify
8461 + * it under the terms of the GNU Lesser General Public License version 3
8462 + * only, as published by the Free Software Foundation.
8464 + * OpenOffice.org is distributed in the hope that it will be useful,
8465 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8466 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8467 + * GNU Lesser General Public License version 3 for more details
8468 + * (a copy is included in the LICENSE file that accompanied this code).
8470 + * You should have received a copy of the GNU Lesser General Public License
8471 + * version 3 along with OpenOffice.org. If not, see
8472 + * <http://www.openoffice.org/license.html>
8473 + * for a copy of the LGPLv3 License.
8475 + ************************************************************************/
8477 +#include <table.hxx>
8479 +#include <sal/macros.h>
8480 +#include <osl/mutex.hxx>
8481 +#include <cppuhelper/propshlp.hxx>
8482 +#include <cppuhelper/interfacecontainer.h>
8483 +#include <com/sun/star/awt/PosSize.hpp>
8484 +#include <tools/debug.hxx>
8486 +// fixed point precision for distributing error
8487 +#define FIXED_PT 16
8489 +namespace layoutimpl
8492 +using namespace com::sun::star;
8494 +Table::ChildProps::ChildProps( Table::ChildData *pData )
8496 + addProp( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ),
8497 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
8498 + &( pData->mbExpand[ 0 ] ) );
8499 + addProp( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ),
8500 + ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
8501 + &( pData->mbExpand[ 1 ] ) );
8502 + addProp( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ),
8503 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
8504 + &( pData->mnColSpan ) );
8505 + addProp( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ),
8506 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
8507 + &( pData->mnRowSpan ) );
8510 +bool Table::ChildData::isVisible()
8512 + return Box_Base::ChildData::isVisible()
8513 + && ( mnColSpan > 0 ) && ( mnRowSpan > 0 );
8518 + , mnColsLen( 1 )// another default value could be 0xffff for infinite columns( = 1 row )
8520 + addProp( RTL_CONSTASCII_USTRINGPARAM( "Columns" ),
8521 + ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
8525 +Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
8526 + : Box_Base::ChildData( xChild )
8527 +// , mbExpand( { 0, 1 } )
8533 + , mnBottomRow( 0 )
8535 + mbExpand[ 0 ] = 0;
8536 + mbExpand[ 1 ] = 1;
8540 +Table::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
8542 + return new ChildData( xChild );
8546 +Table::createChildProps( Box_Base::ChildData *pData )
8548 + return new ChildProps( static_cast<Table::ChildData*> ( pData ) );
8552 +Table::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
8553 + throw( uno::RuntimeException, awt::MaxChildrenException )
8555 + if ( xChild.is() )
8557 + Box_Base::addChild( xChild );
8558 + // cause of flicker
8559 + allocateChildAt( xChild, awt::Rectangle( 0,0,0,0 ) );
8564 +Table::getMinimumSize() throw( uno::RuntimeException )
8568 + // 1. layout the table -- adjust to cope with row-spans...
8570 + // temporary 1D representation of the table
8571 + std::vector< ChildData *> aTable;
8575 + for ( std::list<Box_Base::ChildData *>::iterator it
8576 + = maChildren.begin(); it != maChildren.end(); it++ )
8578 + ChildData *child = static_cast<Table::ChildData*> ( *it );
8579 + if ( !child->isVisible() )
8582 + while ( col + SAL_MIN( child->mnColSpan, mnColsLen ) > mnColsLen )
8587 + unsigned int i = col +( row*mnColsLen );
8588 + while ( aTable.size() > i && !aTable[ i ] )
8591 + col = i % mnColsLen;
8592 + row = i / mnColsLen;
8595 + child->mnLeftCol = col;
8596 + child->mnRightCol = SAL_MIN( col + child->mnColSpan, mnColsLen );
8597 + child->mnTopRow = row;
8598 + child->mnBottomRow = row + child->mnRowSpan;
8600 + col += child->mnColSpan;
8602 + unsigned int start = child->mnLeftCol +( child->mnTopRow*mnColsLen );
8603 + unsigned int end =( child->mnRightCol-1 ) +( ( child->mnBottomRow-1 )*mnColsLen );
8604 + if ( aTable.size() < end+1 )
8605 + aTable.resize( end+1, NULL );
8606 + for ( unsigned int i = start; i < end; i++ )
8607 + aTable[ i ] = child;
8609 + nRowsLen = SAL_MAX( nRowsLen, child->mnBottomRow );
8613 + // 2. calculate columns/rows sizes
8614 + for ( int g = 0; g < 2; g++ )
8616 + std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
8619 + aGroup.resize( g == 0 ? mnColsLen : nRowsLen );
8621 + // 2.1 base sizes on one-column/row children
8622 + for ( std::list<Box_Base::ChildData *>::iterator it
8623 + = maChildren.begin(); it != maChildren.end(); it++ )
8625 + ChildData *child = static_cast<Table::ChildData*> ( *it );
8626 + if ( !child->isVisible() )
8628 + const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
8629 + const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
8631 + if ( nFirstAttach == nLastAttach-1 )
8633 + child->maRequisition = child->mxChild->getMinimumSize();
8634 + int attach = nFirstAttach;
8635 + int child_size = g == 0 ? child->maRequisition.Width
8636 + : child->maRequisition.Height;
8637 + aGroup[ attach ].mnSize = SAL_MAX( aGroup[ attach ].mnSize,
8639 + if ( child->mbExpand[ g ] )
8640 + aGroup[ attach ].mbExpand = true;
8644 + // 2.2 make sure multiple-columns/rows children fit
8645 + for ( std::list<Box_Base::ChildData *>::iterator it
8646 + = maChildren.begin(); it != maChildren.end(); it++ )
8648 + ChildData *child = static_cast<Table::ChildData*> ( *it );
8649 + if ( !child->isVisible() )
8651 + const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
8652 + const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
8654 + if ( nFirstAttach != nLastAttach-1 )
8656 + child->maRequisition = child->mxChild->getMinimumSize();
8658 + int expandables = 0;
8659 + for ( int i = nFirstAttach; i < nLastAttach; i++ )
8661 + size += aGroup[ i ].mnSize;
8662 + if ( aGroup[ i ].mbExpand )
8666 + int child_size = g == 0 ? child->maRequisition.Width
8667 + : child->maRequisition.Height;
8668 + int extra = child_size - size;
8671 + if ( expandables )
8672 + extra /= expandables;
8674 + extra /= nLastAttach - nFirstAttach;
8676 + for ( int i = nFirstAttach; i < nLastAttach; i++ )
8677 + if ( expandables == 0 || aGroup[ i ].mbExpand )
8678 + aGroup[ i ].mnSize += extra;
8684 + // 3. Sum everything up
8685 + mnColExpandables =( mnRowExpandables = 0 );
8686 + maRequisition.Width =( maRequisition.Height = 0 );
8687 + for ( std::vector<GroupData>::iterator it = maCols.begin();
8688 + it != maCols.end(); it++ )
8690 + maRequisition.Width += it->mnSize;
8691 + if ( it->mbExpand )
8692 + mnColExpandables++;
8694 + for ( std::vector<GroupData>::iterator it = maRows.begin();
8695 + it != maRows.end(); it++ )
8697 + maRequisition.Height += it->mnSize;
8698 + if ( it->mbExpand )
8699 + mnRowExpandables++;
8702 + return maRequisition;
8706 +Table::allocateArea( const awt::Rectangle &rArea )
8707 + throw( uno::RuntimeException )
8709 + maAllocation = rArea;
8710 + if ( maCols.size() == 0 || maRows.size() == 0 )
8713 + int nExtraSize[ 2 ] = { SAL_MAX( rArea.Width - maRequisition.Width, 0 ),
8714 + SAL_MAX( rArea.Height - maRequisition.Height, 0 ) };
8716 + nExtraSize[ 0 ] /= mnColExpandables ? mnColExpandables : mnColsLen;
8717 + nExtraSize[ 1 ] /= mnRowExpandables ? mnRowExpandables : maRows.size();
8719 + for ( std::list<Box_Base::ChildData *>::const_iterator it
8720 + = maChildren.begin(); it != maChildren.end(); it++ )
8722 + ChildData *child = static_cast<Table::ChildData*> ( *it );
8723 + if ( !child->isVisible() )
8726 + awt::Rectangle rChildArea( rArea.X, rArea.Y, 0, 0 );
8728 + for ( int g = 0; g < 2; g++ )
8730 + std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
8731 + const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
8732 + const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
8734 + for ( int i = 0; i < nFirstAttach; i++ )
8736 + int gSize = aGroup[ i ].mnSize;
8737 + if ( aGroup[ i ].mbExpand )
8738 + gSize += nExtraSize[ g ];
8740 + rChildArea.X += gSize;
8742 + rChildArea.Y += gSize;
8744 + for ( int i = nFirstAttach; i < nLastAttach; i++ )
8746 + int gSize = aGroup[ i ].mnSize;
8747 + if ( aGroup[ i ].mbExpand )
8748 + gSize += nExtraSize[ g ];
8750 + rChildArea.Width += gSize;
8752 + rChildArea.Height += gSize;
8756 + allocateChildAt( child->mxChild, rChildArea );
8760 +} // namespace layoutimpl
8761 --- toolkit/source/layout/core/table.hxx.old 1970-01-01 00:00:00.000000000 +0000
8762 +++ toolkit/source/layout/core/table.hxx 2009-04-06 16:42:13.000000000 +0000
8764 +/*************************************************************************
8766 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8768 + * Copyright 2008 by Sun Microsystems, Inc.
8770 + * OpenOffice.org - a multi-platform office productivity suite
8776 + * This file is part of OpenOffice.org.
8778 + * OpenOffice.org is free software: you can redistribute it and/or modify
8779 + * it under the terms of the GNU Lesser General Public License version 3
8780 + * only, as published by the Free Software Foundation.
8782 + * OpenOffice.org is distributed in the hope that it will be useful,
8783 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8784 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8785 + * GNU Lesser General Public License version 3 for more details
8786 + * (a copy is included in the LICENSE file that accompanied this code).
8788 + * You should have received a copy of the GNU Lesser General Public License
8789 + * version 3 along with OpenOffice.org. If not, see
8790 + * <http://www.openoffice.org/license.html>
8791 + * for a copy of the LGPLv3 License.
8793 + ************************************************************************/
8795 +#ifndef LAYOUT_CORE_TABLE_HXX
8796 +#define LAYOUT_CORE_TABLE_HXX
8798 +#include <layout/core/box-base.hxx>
8800 +namespace layoutimpl
8803 +class Table : public Box_Base
8806 + // Children properties
8807 + struct ChildData : public Box_Base::ChildData
8809 + sal_Bool mbExpand[ 2 ];
8810 + sal_Int32 mnColSpan;
8811 + sal_Int32 mnRowSpan;
8817 + ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
8821 + struct ChildProps : public Box_Base::ChildProps
8823 + ChildProps( ChildData *pData );
8828 + // a group of children; either a column or a row
8831 + sal_Bool mbExpand;
8832 + int mnSize; // request size (width or height)
8833 + GroupData() : mbExpand( false ), mnSize( 0 ) {}
8836 + // Table properties
8837 + sal_Int32 mnColsLen;
8838 + std::vector< GroupData > maCols;
8839 + std::vector< GroupData > maRows;
8840 + int mnColExpandables, mnRowExpandables;
8842 + ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
8843 + ChildProps *createChildProps( Box_Base::ChildData* pData );
8848 + // css::awt::XLayoutContainer
8849 + virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
8850 + throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
8852 + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
8853 + throw (css::uno::RuntimeException);
8855 + virtual css::awt::Size SAL_CALL getMinimumSize()
8856 + throw(css::uno::RuntimeException);
8859 + virtual sal_Bool SAL_CALL hasHeightForWidth()
8860 + throw(css::uno::RuntimeException)
8862 + virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
8863 + throw(css::uno::RuntimeException)
8864 + { return maRequisition.Height; }
8866 + PROPHELPER_SET_INFO
8869 +} // namespace layoutimpl
8871 +#endif /* LAYOUT_CORE_TABLE_HXX */
8872 --- toolkit/source/layout/core/timer.cxx.old 1970-01-01 00:00:00.000000000 +0000
8873 +++ toolkit/source/layout/core/timer.cxx 2009-04-06 16:42:13.000000000 +0000
8875 +/*************************************************************************
8877 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8879 + * Copyright 2008 by Sun Microsystems, Inc.
8881 + * OpenOffice.org - a multi-platform office productivity suite
8887 + * This file is part of OpenOffice.org.
8889 + * OpenOffice.org is free software: you can redistribute it and/or modify
8890 + * it under the terms of the GNU Lesser General Public License version 3
8891 + * only, as published by the Free Software Foundation.
8893 + * OpenOffice.org is distributed in the hope that it will be useful,
8894 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8895 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8896 + * GNU Lesser General Public License version 3 for more details
8897 + * (a copy is included in the LICENSE file that accompanied this code).
8899 + * You should have received a copy of the GNU Lesser General Public License
8900 + * version 3 along with OpenOffice.org. If not, see
8901 + * <http://www.openoffice.org/license.html>
8902 + * for a copy of the LGPLv3 License.
8904 + ************************************************************************/
8906 +#include "timer.hxx"
8910 +#include <vcl/timer.hxx>
8911 +#include <com/sun/star/awt/XLayoutContainer.hpp>
8913 +namespace layoutimpl
8915 +using namespace ::com::sun::star;
8917 +class AllocateTimer : public Timer
8919 + typedef std::list< uno::Reference< awt::XLayoutContainer > > ContainerList;
8920 + ContainerList mxContainers;
8921 + uno::Reference< awt::XLayoutContainer > mxLastAdded;
8926 + // timer set to 0 -- just process it as soon as it gets idle
8930 + static inline bool isParentOf( uno::Reference< awt::XLayoutContainer > xParent,
8931 + uno::Reference< awt::XLayoutContainer > xWidget )
8933 + while ( xWidget.is() )
8935 + if ( xWidget == xParent )
8937 + xWidget = uno::Reference< awt::XLayoutContainer >( xWidget->getParent(), uno::UNO_QUERY );
8942 + static inline void eraseChildren( ContainerList::iterator &it, ContainerList &list )
8944 + ContainerList::iterator jt = list.begin();
8945 + while ( jt != list.end() )
8947 + if ( it != jt && isParentOf( *it, *jt ) )
8948 + jt = list.erase( jt );
8954 + static inline bool isContainerDamaged( uno::Reference< awt::XLayoutContainer > xContainer )
8956 + uno::Reference< awt::XLayoutConstrains > xConstrains( xContainer, uno::UNO_QUERY );
8957 + awt::Size lastReq( xContainer->getRequestedSize() );
8958 + awt::Size curReq( xConstrains->getMinimumSize() );
8959 + return lastReq.Width != curReq.Width || lastReq.Height != curReq.Height;
8962 + void add( const uno::Reference< awt::XLayoutContainer > &xContainer )
8964 + // small optimization
8965 + if ( mxLastAdded == xContainer )
8967 + mxLastAdded = xContainer;
8969 + mxContainers.push_back( xContainer );
8972 + virtual void Timeout()
8974 + mxLastAdded = uno::Reference< awt::XLayoutContainer >();
8976 + // 1. remove duplications and children
8977 + for ( ContainerList::iterator it = mxContainers.begin();
8978 + it != mxContainers.end(); it++ )
8979 + eraseChildren( it, mxContainers );
8981 + // 2. check damage extent
8982 + for ( ContainerList::iterator it = mxContainers.begin();
8983 + it != mxContainers.end(); it++ )
8985 + uno::Reference< awt::XLayoutContainer > xContainer = *it;
8986 + while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) )
8988 + xContainer = uno::Reference< awt::XLayoutContainer >(
8989 + xContainer->getParent(), uno::UNO_QUERY );
8992 + if ( *it != xContainer )
8994 + // 2.2 replace it with parent
8997 + // 2.3 remove children of new parent
8998 + eraseChildren( it, mxContainers );
9002 + // 3. force re-calculations
9003 + for ( ContainerList::iterator it = mxContainers.begin();
9004 + it != mxContainers.end(); it++ )
9005 + (*it)->allocateArea( (*it)->getAllocatedArea() );
9009 +static void AddResizeTimeout( const uno::Reference< awt::XLayoutContainer > &xCont )
9011 + static AllocateTimer timer;
9012 + timer.add( xCont );
9016 +LayoutUnit::LayoutUnit() : LayoutUnit_Base()
9020 +void SAL_CALL LayoutUnit::queueResize( const uno::Reference< awt::XLayoutContainer > &xContainer )
9021 + throw( uno::RuntimeException )
9023 + AddResizeTimeout( xContainer );
9027 --- toolkit/source/layout/core/timer.hxx.old 1970-01-01 00:00:00.000000000 +0000
9028 +++ toolkit/source/layout/core/timer.hxx 2009-04-06 16:42:13.000000000 +0000
9030 +/*************************************************************************
9032 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9034 + * Copyright 2008 by Sun Microsystems, Inc.
9036 + * OpenOffice.org - a multi-platform office productivity suite
9042 + * This file is part of OpenOffice.org.
9044 + * OpenOffice.org is free software: you can redistribute it and/or modify
9045 + * it under the terms of the GNU Lesser General Public License version 3
9046 + * only, as published by the Free Software Foundation.
9048 + * OpenOffice.org is distributed in the hope that it will be useful,
9049 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9050 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9051 + * GNU Lesser General Public License version 3 for more details
9052 + * (a copy is included in the LICENSE file that accompanied this code).
9054 + * You should have received a copy of the GNU Lesser General Public License
9055 + * version 3 along with OpenOffice.org. If not, see
9056 + * <http://www.openoffice.org/license.html>
9057 + * for a copy of the LGPLv3 License.
9059 + ************************************************************************/
9061 +#ifndef LAYOUT_CORE_TIMER_HXX
9062 +#define LAYOUT_CORE_TIMER_HXX
9064 +#include <com/sun/star/awt/XLayoutUnit.hpp>
9065 +#include <cppuhelper/implbase1.hxx>
9067 +namespace layoutimpl
9070 +typedef ::cppu::WeakImplHelper1< com::sun::star::awt::XLayoutUnit > LayoutUnit_Base;
9072 +class LayoutUnit : public LayoutUnit_Base
9076 + void SAL_CALL queueResize( const com::sun::star::uno::Reference< com::sun::star::awt::XLayoutContainer > &xContainer )
9077 + throw( com::sun::star::uno::RuntimeException );
9082 +#endif /* LAYOUT_CORE_TIMER_HXX */
9083 --- toolkit/source/layout/core/translate.cxx.old 1970-01-01 00:00:00.000000000 +0000
9084 +++ toolkit/source/layout/core/translate.cxx 2009-04-06 16:42:13.000000000 +0000
9086 +/*************************************************************************
9088 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9090 + * Copyright 2008 by Sun Microsystems, Inc.
9092 + * OpenOffice.org - a multi-platform office productivity suite
9098 + * This file is part of OpenOffice.org.
9100 + * OpenOffice.org is free software: you can redistribute it and/or modify
9101 + * it under the terms of the GNU Lesser General Public License version 3
9102 + * only, as published by the Free Software Foundation.
9104 + * OpenOffice.org is distributed in the hope that it will be useful,
9105 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9106 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9107 + * GNU Lesser General Public License version 3 for more details
9108 + * (a copy is included in the LICENSE file that accompanied this code).
9110 + * You should have received a copy of the GNU Lesser General Public License
9111 + * version 3 along with OpenOffice.org. If not, see
9112 + * <http://www.openoffice.org/license.html>
9113 + * for a copy of the LGPLv3 License.
9115 + ************************************************************************/
9117 +#include "translate.hxx"
9122 +#include "tools/getprocessworkingdir.hxx"
9125 +#include <unotools/bootstrap.hxx>
9126 +#include <unotools/localfilehelper.hxx>
9127 +#include <unotools/ucbhelper.hxx>
9128 +#include <vcl/svapp.hxx>
9130 +#include "proplist.hxx"
9132 +namespace layoutimpl
9134 +namespace css = ::com::sun::star;
9135 +using namespace css;
9136 +using ::rtl::OUString;
9137 +using ::utl::LocalFileHelper;
9138 +using ::utl::UCBContentHelper;
9139 +using ::utl::Bootstrap;
9141 +static std::list<OUString>
9142 +getLocaleSubdirList( lang::Locale const& rLocale )
9144 + std::list<OUString> aSubdirs;
9145 + aSubdirs.push_front( OUString::createFromAscii( "." ) );
9146 + aSubdirs.push_front( OUString::createFromAscii( "en_US" ) );
9147 + if ( rLocale.Language.getLength() )
9148 + aSubdirs.push_front( rLocale.Language );
9149 + if ( rLocale.Country.getLength() )
9151 + OUString aLocaleCountry = rLocale.Language
9152 + + OUString::createFromAscii( "_" )
9153 + + rLocale.Country;
9154 + aSubdirs.push_front( aLocaleCountry );
9155 + if ( rLocale.Variant.getLength() )
9156 + aSubdirs.push_front( aLocaleCountry
9157 + + OUString::createFromAscii( "." )
9158 + + rLocale.Variant );
9164 +fileExists( String const& aFile )
9167 + LocalFileHelper::ConvertPhysicalNameToURL( aFile, aUrl );
9168 + return UCBContentHelper::Exists( aUrl );
9172 +getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs,
9173 + OUString const& aXMLName )
9175 + static OUString const aSlash = OUString::createFromAscii( "/" );
9177 + for ( std::list<OUString>::const_iterator i = aSubDirs.begin();
9178 + i != aSubDirs.end(); i++ )
9180 + String aFile = aDir + aSlash + *i + aSlash + aXMLName;
9181 + OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) );
9182 + if ( fileExists( aFile ) )
9185 + return OUString();
9188 +/* FIXME: IWBN to share code with impimagetree.cxx, also for reading
9189 + from zip files. */
9191 +readRightTranslation( OUString const& aXMLName )
9194 + std::list<OUString> aSubdirs
9195 + = getLocaleSubdirList( Application::GetSettings().GetUILocale() );
9196 +#if TEST_LAYOUT // read from cwd first
9197 + OUString aCurrentWorkingUrl;
9198 + tools::getProcessWorkingDir( &aCurrentWorkingUrl );
9199 + String aCurrentWorkingDir;
9200 + LocalFileHelper::ConvertURLToPhysicalName( aCurrentWorkingUrl, aCurrentWorkingDir );
9201 + aXMLFile = getFirstExisting( aCurrentWorkingDir, aSubdirs, aXMLName );
9202 + if ( aXMLFile.Len() )
9205 +#endif /* TEST_LAYOUT */
9207 + OUString aShareUrl;
9208 + Bootstrap::locateSharedData( aShareUrl );
9209 + OUString aXMLUrl = aShareUrl + OUString::createFromAscii( "/layout" );
9211 + LocalFileHelper::ConvertURLToPhysicalName( aXMLUrl, aXMLDir );
9212 + aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName );
9215 + OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) );
9219 +} // namespace layoutimpl
9220 --- toolkit/source/layout/core/translate.hxx.old 1970-01-01 00:00:00.000000000 +0000
9221 +++ toolkit/source/layout/core/translate.hxx 2009-04-06 16:42:13.000000000 +0000
9223 +/*************************************************************************
9225 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9227 + * Copyright 2008 by Sun Microsystems, Inc.
9229 + * OpenOffice.org - a multi-platform office productivity suite
9235 + * This file is part of OpenOffice.org.
9237 + * OpenOffice.org is free software: you can redistribute it and/or modify
9238 + * it under the terms of the GNU Lesser General Public License version 3
9239 + * only, as published by the Free Software Foundation.
9241 + * OpenOffice.org is distributed in the hope that it will be useful,
9242 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9243 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9244 + * GNU Lesser General Public License version 3 for more details
9245 + * (a copy is included in the LICENSE file that accompanied this code).
9247 + * You should have received a copy of the GNU Lesser General Public License
9248 + * version 3 along with OpenOffice.org. If not, see
9249 + * <http://www.openoffice.org/license.html>
9250 + * for a copy of the LGPLv3 License.
9252 + ************************************************************************/
9254 +#ifndef LAYOUT_CORE_TRANSLATE_HXX
9255 +#define LAYOUT_CORE_TRANSLATE_HXX
9261 +namespace layoutimpl
9263 +::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName );
9264 +} // namespace layoutimpl
9266 +#endif /* LAYOUT_CORE_TRANSLATE_HXX */
9267 --- toolkit/source/layout/core/vcl.cxx.old 1970-01-01 00:00:00.000000000 +0000
9268 +++ toolkit/source/layout/core/vcl.cxx 2009-04-06 16:42:13.000000000 +0000
9270 +/*************************************************************************
9272 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9274 + * Copyright 2008 by Sun Microsystems, Inc.
9276 + * OpenOffice.org - a multi-platform office productivity suite
9282 + * This file is part of OpenOffice.org.
9284 + * OpenOffice.org is free software: you can redistribute it and/or modify
9285 + * it under the terms of the GNU Lesser General Public License version 3
9286 + * only, as published by the Free Software Foundation.
9288 + * OpenOffice.org is distributed in the hope that it will be useful,
9289 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9290 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9291 + * GNU Lesser General Public License version 3 for more details
9292 + * (a copy is included in the LICENSE file that accompanied this code).
9294 + * You should have received a copy of the GNU Lesser General Public License
9295 + * version 3 along with OpenOffice.org. If not, see
9296 + * <http://www.openoffice.org/license.html>
9297 + * for a copy of the LGPLv3 License.
9299 + ************************************************************************/
9303 +#include <sal/types.h>
9304 +#include <vcl/button.hxx>
9306 +static PushButton* get_button (Dialog const* dialog, sal_uInt32 type)
9308 + Window* child = dialog->GetWindow (WINDOW_FIRSTCHILD);
9311 + if (child->GetType () == type)
9312 + return static_cast <PushButton*> (child);
9313 + child = child->GetWindow (WINDOW_NEXT);
9319 +#define IMPLEMENT_CLOSING_DIALOG(cls)\
9320 + Closing##cls::Closing##cls (Window* parent, WinBits bits)\
9321 + : cls (parent, bits)\
9322 + , mClosing (false)\
9325 + BOOL Closing##cls::Close ()\
9328 + EndDialog (false);\
9329 + else if (PushButton *cancel = get_button (this, WINDOW_CANCELBUTTON))\
9330 + cancel->Click ();\
9331 + else if (PushButton *ok = get_button (this, WINDOW_OKBUTTON))\
9337 +IMPLEMENT_CLOSING_DIALOG (Dialog);
9338 +IMPLEMENT_CLOSING_DIALOG (ModelessDialog);
9339 +IMPLEMENT_CLOSING_DIALOG (ModalDialog);
9340 --- toolkit/source/layout/core/vcl.hxx.old 1970-01-01 00:00:00.000000000 +0000
9341 +++ toolkit/source/layout/core/vcl.hxx 2009-04-06 16:42:13.000000000 +0000
9343 +/*************************************************************************
9345 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9347 + * Copyright 2008 by Sun Microsystems, Inc.
9349 + * OpenOffice.org - a multi-platform office productivity suite
9355 + * This file is part of OpenOffice.org.
9357 + * OpenOffice.org is free software: you can redistribute it and/or modify
9358 + * it under the terms of the GNU Lesser General Public License version 3
9359 + * only, as published by the Free Software Foundation.
9361 + * OpenOffice.org is distributed in the hope that it will be useful,
9362 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9363 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9364 + * GNU Lesser General Public License version 3 for more details
9365 + * (a copy is included in the LICENSE file that accompanied this code).
9367 + * You should have received a copy of the GNU Lesser General Public License
9368 + * version 3 along with OpenOffice.org. If not, see
9369 + * <http://www.openoffice.org/license.html>
9370 + * for a copy of the LGPLv3 License.
9372 + ************************************************************************/
9374 +#ifndef LAYOUT_CORE_VCL_HXX
9375 +#define LAYOUT_CORE_VCL_HXX
9377 +#include <vcl/dialog.hxx>
9379 +#define DECLARE_CLOSING_DIALOG(cls)\
9380 + class Closing##cls : public cls\
9384 + Closing##cls (Window* parent, WinBits bits);\
9385 + virtual BOOL Close ();\
9388 +DECLARE_CLOSING_DIALOG (Dialog);
9389 +DECLARE_CLOSING_DIALOG (ModalDialog);
9390 +DECLARE_CLOSING_DIALOG (ModelessDialog);
9392 +#undef DECLARE_CLOSING_DIALOG
9394 +#endif /* LAYOUT_CORE_VCL_HXX */
9395 --- toolkit/source/layout/dialogbuttonhbox.cxx.old 2009-04-06 16:42:11.000000000 +0000
9396 +++ toolkit/source/layout/dialogbuttonhbox.cxx 1970-01-01 00:00:00.000000000 +0000
9398 -/*************************************************************************
9400 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9402 - * Copyright 2008 by Sun Microsystems, Inc.
9404 - * OpenOffice.org - a multi-platform office productivity suite
9406 - * $RCSfile: dialogbuttonhbox.cxx,v $
9408 - * $Revision: 1.3 $
9410 - * This file is part of OpenOffice.org.
9412 - * OpenOffice.org is free software: you can redistribute it and/or modify
9413 - * it under the terms of the GNU Lesser General Public License version 3
9414 - * only, as published by the Free Software Foundation.
9416 - * OpenOffice.org is distributed in the hope that it will be useful,
9417 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9418 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9419 - * GNU Lesser General Public License version 3 for more details
9420 - * (a copy is included in the LICENSE file that accompanied this code).
9422 - * You should have received a copy of the GNU Lesser General Public License
9423 - * version 3 along with OpenOffice.org. If not, see
9424 - * <http://www.openoffice.org/license.html>
9425 - * for a copy of the LGPLv3 License.
9427 - ************************************************************************/
9429 -#include <awt/vclxbutton.hxx>
9430 -#include <tools/debug.hxx>
9431 -#include <toolkit/awt/vclxwindows.hxx>
9432 -#include <vcl/button.hxx>
9434 -#include "dialogbuttonhbox.hxx"
9435 -#include "flow.hxx"
9436 -#include "proplist.hxx"
9438 -#if TEST_LAYOUT && !defined( DBG_UTIL )
9441 -#define DBG_ERROR printf
9443 -#define DBG_ERROR1 printf
9445 -#define DBG_ERROR2 printf
9446 -#endif /* TEST_LAYOUT && !DBG_UTIL */
9448 -namespace layoutimpl
9451 -using namespace css;
9453 -//FIXME: how to set platform-dependant variables?
9454 -DialogButtonHBox::Ordering const DialogButtonHBox::DEFAULT_ORDERING =
9455 -#if defined( MACOSX )
9456 - DialogButtonHBox::MACOS;
9457 -#elif defined( SAL_W32 )
9458 -DialogButtonHBox::WINDOWS;
9459 -#elif defined( ENABLE_KDE )
9460 -DialogButtonHBox::KDE;
9461 -#else /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
9462 -DialogButtonHBox::GNOME;
9463 -#endif /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
9465 -DialogButtonHBox::DialogButtonHBox()
9467 - , mnOrdering( DEFAULT_ORDERING )
9470 - , mpAffirmative( 0 )
9471 - , mpAlternate( 0 )
9474 - , mpFlow( createChild( uno::Reference< awt::XLayoutConstrains > ( &mFlow ) ) )
9478 - mbHomogeneous = true;
9482 -DialogButtonHBox::setOrdering( rtl::OUString const& ordering )
9484 - if ( ordering.equalsIgnoreAsciiCaseAscii( "GNOME" ) )
9485 - mnOrdering = GNOME;
9486 - else if ( ordering.equalsIgnoreAsciiCaseAscii( "KDE" ) )
9488 - else if ( ordering.equalsIgnoreAsciiCaseAscii( "MacOS" ) )
9489 - mnOrdering = MACOS;
9490 - else if ( ordering.equalsIgnoreAsciiCaseAscii( "Windows" ) )
9491 - mnOrdering = WINDOWS;
9494 - DBG_ERROR1( "DialogButtonHBox: no such ordering: %s", OUSTRING_CSTR( ordering ) );
9499 -DialogButtonHBox::addChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
9500 - throw ( uno::RuntimeException, awt::MaxChildrenException )
9502 - if ( !xChild.is() )
9505 - ChildData *p = createChild( xChild );
9507 -#define IS_BUTTON(t) dynamic_cast<VCLX##t##Button *>( xChild.get () )
9509 - /* Sort Retry as Action */
9510 - if ( !mpAction && IS_BUTTON( Retry ) )
9512 - else if ( !mpAffirmative && IS_BUTTON( OK ) )
9513 - mpAffirmative = p;
9514 - else if ( !mpAffirmative && IS_BUTTON( Yes ) )
9515 - mpAffirmative = p;
9516 - else if ( !mpAlternate && IS_BUTTON( No ) )
9518 - /* Sort Ignore as Alternate */
9519 - else if ( !mpAlternate && IS_BUTTON( Ignore ) )
9521 - else if ( !mpApply && IS_BUTTON( Apply ) )
9523 - else if ( !mpCancel && IS_BUTTON( Cancel ) )
9525 - /* Let the user overwrite Flow */
9526 - else if ( /* !mpFlow && */ dynamic_cast<Flow *>( xChild.get () ) )
9528 - else if ( !mpHelp && IS_BUTTON( Help ) )
9530 - else if ( !mpReset && IS_BUTTON( Reset ) )
9533 - maOther.push_back( p );
9535 - setChildParent( xChild );
9540 -DialogButtonHBox::orderChildren()
9542 - if ( mnOrdering == WINDOWS )
9543 - windowsOrdering();
9544 - else if ( mnOrdering == MACOS )
9546 - else if ( mnOrdering == KDE )
9548 - else if ( 1 || mnOrdering == GNOME )
9553 -DialogButtonHBox::removeChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
9554 - throw ( uno::RuntimeException)
9556 - if ( !xChild.is ())
9559 - Box_Base::ChildData *p = 0;
9561 - if ( mpAction && mpAction->mxChild == xChild )
9563 - else if ( mpAffirmative && mpAffirmative->mxChild == xChild )
9564 - p = mpAffirmative;
9565 - else if ( mpAlternate && mpAlternate->mxChild == xChild )
9567 - else if ( mpApply && mpApply->mxChild == xChild )
9569 - else if ( mpCancel && mpCancel->mxChild == xChild )
9571 - else if ( mpFlow && mpFlow->mxChild == xChild )
9573 - else if ( mpReset && mpReset->mxChild == xChild )
9575 - else if ( mpHelp && mpHelp->mxChild == xChild )
9578 - p = removeChildData( maOther, xChild );
9583 - unsetChildParent( xChild );
9589 - DBG_ERROR( "DialogButtonHBox: removeChild: no such child" );
9594 -DialogButtonHBox::gnomeOrdering()
9596 - std::list< Box_Base::ChildData * > ordered;
9598 - ordered.push_back( mpHelp );
9600 - ordered.push_back( mpReset );
9601 - if ( mpFlow && ( mpHelp || mpReset ) )
9602 - ordered.push_back( mpFlow );
9603 - ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
9605 - ordered.push_back( mpAction );
9607 - ordered.push_back( mpApply );
9608 - if ( mpAlternate )
9609 - ordered.push_back( mpAlternate );
9611 - ordered.push_back( mpCancel );
9612 - if ( mpAffirmative )
9613 - ordered.push_back( mpAffirmative );
9614 - maChildren = ordered;
9618 -DialogButtonHBox::kdeOrdering()
9620 - std::list< Box_Base::ChildData * > ordered;
9622 - ordered.push_back( mpHelp );
9624 - ordered.push_back( mpReset );
9625 - if ( mpFlow && ( mpHelp || mpReset ) )
9626 - ordered.push_back( mpFlow );
9627 - ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
9629 - ordered.push_back( mpAction );
9630 - if ( mpAffirmative )
9631 - ordered.push_back( mpAffirmative );
9633 - ordered.push_back( mpApply );
9634 - if ( mpAlternate )
9635 - ordered.push_back( mpAlternate );
9637 - ordered.push_back( mpCancel );
9638 - maChildren = ordered;
9642 -DialogButtonHBox::macosOrdering()
9644 - std::list< Box_Base::ChildData * > ordered;
9646 - ordered.push_back( mpHelp );
9648 - ordered.push_back( mpReset );
9650 - ordered.push_back( mpApply );
9652 - ordered.push_back( mpAction );
9653 - ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
9654 - if ( mpFlow ) // Always flow? && ( maOther.size () || mpHelp || mpReset || mpAction ) )
9655 - ordered.push_back( mpFlow );
9656 - if ( mpAlternate )
9657 - ordered.push_back( mpAlternate );
9658 - if ( mpFlow && mpAlternate )
9659 - ordered.push_back( mpFlow );
9661 - ordered.push_back( mpCancel );
9662 - if ( mpAffirmative )
9663 - ordered.push_back( mpAffirmative );
9664 - maChildren = ordered;
9668 -DialogButtonHBox::windowsOrdering()
9670 - std::list< Box_Base::ChildData * > ordered;
9672 - ordered.push_back( mpReset );
9673 - if ( mpReset && mpFlow )
9674 - ordered.push_back( mpFlow );
9675 - if ( mpAffirmative )
9676 - ordered.push_back( mpAffirmative );
9677 - if ( mpAlternate )
9678 - ordered.push_back( mpAlternate );
9680 - ordered.push_back( mpAction );
9682 - ordered.push_back( mpCancel );
9684 - ordered.push_back( mpApply );
9685 - ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
9687 - ordered.push_back( mpHelp );
9688 - maChildren = ordered;
9691 -} // namespace layoutimpl
9692 --- toolkit/source/layout/dialogbuttonhbox.hxx.old 2009-04-02 10:49:36.000000000 +0000
9693 +++ toolkit/source/layout/dialogbuttonhbox.hxx 1970-01-01 00:00:00.000000000 +0000
9695 -/*************************************************************************
9697 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9699 - * Copyright 2008 by Sun Microsystems, Inc.
9701 - * OpenOffice.org - a multi-platform office productivity suite
9703 - * $RCSfile: dialogbuttonhbox.hxx,v $
9705 - * $Revision: 1.3 $
9707 - * This file is part of OpenOffice.org.
9709 - * OpenOffice.org is free software: you can redistribute it and/or modify
9710 - * it under the terms of the GNU Lesser General Public License version 3
9711 - * only, as published by the Free Software Foundation.
9713 - * OpenOffice.org is distributed in the hope that it will be useful,
9714 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9715 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9716 - * GNU Lesser General Public License version 3 for more details
9717 - * (a copy is included in the LICENSE file that accompanied this code).
9719 - * You should have received a copy of the GNU Lesser General Public License
9720 - * version 3 along with OpenOffice.org. If not, see
9721 - * <http://www.openoffice.org/license.html>
9722 - * for a copy of the LGPLv3 License.
9724 - ************************************************************************/
9726 -#ifndef CORE_DIALOGBUTTONHBOX_HXX
9727 -#define CORE_DIALOGBUTTONHBOX_HXX
9730 -#include "flow.hxx"
9732 -namespace layoutimpl
9735 -class DialogButtonHBox : public HBox
9738 - DialogButtonHBox();
9740 - void setOrdering( rtl::OUString const& ordering );
9741 - void SAL_CALL addChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException, css::awt::MaxChildrenException );
9742 - void SAL_CALL removeChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException );
9745 - enum Ordering { PLATFORM, GNOME, KDE, MACOS, WINDOWS };
9747 - void orderChildren();
9748 - void gnomeOrdering();
9749 - void kdeOrdering();
9750 - void macosOrdering();
9751 - void windowsOrdering();
9753 - static Ordering const DEFAULT_ORDERING;
9754 - Ordering mnOrdering;
9757 - ChildData *mpAction; /* [..]?, [Retry?] */
9758 - ChildData *mpAffirmative; /* OK, Yes, Save */
9759 - ChildData *mpAlternate; /* NO, [Ignore?], Don't save, Quit without saving */
9760 - ChildData *mpApply; /* Deprecated? */
9761 - ChildData *mpCancel; /* Cancel, Close */
9762 - ChildData *mpFlow;
9763 - ChildData *mpHelp;
9764 - ChildData *mpReset;
9766 - std::list< Box_Base::ChildData *> maOther;
9769 -} // namespace layoutimpl
9771 -#endif /* CORE_DIALOGBUTTONHBOX_HXX */
9772 --- toolkit/source/layout/factory.cxx.old 2009-04-02 10:49:36.000000000 +0000
9773 +++ toolkit/source/layout/factory.cxx 1970-01-01 00:00:00.000000000 +0000
9775 -/*************************************************************************
9777 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9779 - * Copyright 2008 by Sun Microsystems, Inc.
9781 - * OpenOffice.org - a multi-platform office productivity suite
9783 - * $RCSfile: factory.cxx,v $
9785 - * $Revision: 1.3 $
9787 - * This file is part of OpenOffice.org.
9789 - * OpenOffice.org is free software: you can redistribute it and/or modify
9790 - * it under the terms of the GNU Lesser General Public License version 3
9791 - * only, as published by the Free Software Foundation.
9793 - * OpenOffice.org is distributed in the hope that it will be useful,
9794 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9795 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9796 - * GNU Lesser General Public License version 3 for more details
9797 - * (a copy is included in the LICENSE file that accompanied this code).
9799 - * You should have received a copy of the GNU Lesser General Public License
9800 - * version 3 along with OpenOffice.org. If not, see
9801 - * <http://www.openoffice.org/license.html>
9802 - * for a copy of the LGPLv3 License.
9804 - ************************************************************************/
9806 -#include "factory.hxx"
9808 -#include <com/sun/star/registry/XRegistryKey.hpp>
9809 -#include <com/sun/star/registry/InvalidRegistryException.hpp>
9810 -#include <cppuhelper/factory.hxx>
9812 -#include "root.hxx"
9814 -using namespace ::com::sun::star;
9815 -using namespace layoutimpl;
9817 -void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ )
9821 - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
9822 - uno::Reference< lang::XSingleServiceFactory > xFactory;
9824 - if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) )
9825 - xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
9826 - LayoutFactory::impl_staticGetImplementationName(),
9827 - LayoutFactory::impl_staticCreateSelfInstance,
9828 - LayoutFactory::impl_staticGetSupportedServiceNames() );
9829 - if ( xFactory.is() )
9831 - xFactory->acquire();
9832 - pRet = xFactory.get();
9838 -sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * /*serviceManager*/, void * pRegistryKey )
9840 - if ( pRegistryKey )
9844 - uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) );
9845 - uno::Reference< registry::XRegistryKey > xNewKey;
9847 - xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
9848 - LayoutFactory::impl_staticGetImplementationName() +
9849 - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
9851 - const uno::Sequence< ::rtl::OUString > aServices = LayoutFactory::impl_staticGetSupportedServiceNames();
9852 - for ( sal_Int32 i = 0; i < aServices.getLength(); i++ )
9853 - xNewKey->createKey( aServices.getConstArray()[i] );
9857 - catch (registry::InvalidRegistryException &)
9859 - OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
9865 -// Component registration
9866 -::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName()
9868 - return ::rtl::OUString::createFromAscii( "com.sun.star.comp.awt.Layout" );
9871 -uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::impl_staticGetSupportedServiceNames()
9873 - uno::Sequence< ::rtl::OUString > aRet(2);
9874 - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.awt.Layout");
9875 - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.awt.Layout");
9879 -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::impl_staticCreateSelfInstance(
9880 - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
9882 - return uno::Reference< uno::XInterface >( *new LayoutFactory( xServiceManager ) );
9886 -::rtl::OUString SAL_CALL LayoutFactory::getImplementationName()
9887 - throw ( uno::RuntimeException )
9889 - return impl_staticGetImplementationName();
9892 -uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::getSupportedServiceNames()
9893 - throw ( uno::RuntimeException )
9895 - return impl_staticGetSupportedServiceNames();
9898 -sal_Bool SAL_CALL LayoutFactory::supportsService( const ::rtl::OUString& ServiceName )
9899 - throw ( uno::RuntimeException )
9901 - uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
9902 - for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
9903 - if ( ServiceName.compareTo( aSeq[i] ) == 0 )
9909 -// XSingleServiceFactory
9910 -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstance()
9911 - throw ( uno::Exception,
9912 - uno::RuntimeException )
9914 - return uno::Reference< uno::XInterface >(
9915 - static_cast< OWeakObject* >( new LayoutRoot( m_xFactory ) ),
9919 -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstanceWithArguments(
9920 - const uno::Sequence< uno::Any >& aArguments )
9921 - throw ( uno::Exception,
9922 - uno::RuntimeException )
9924 - uno::Reference< uno::XInterface > layout = createInstance();
9925 - uno::Reference< lang::XInitialization > xInit( layout, uno::UNO_QUERY );
9926 - xInit->initialize( aArguments );
9929 --- toolkit/source/layout/factory.hxx.old 2009-04-02 10:49:36.000000000 +0000
9930 +++ toolkit/source/layout/factory.hxx 1970-01-01 00:00:00.000000000 +0000
9932 -/*************************************************************************
9934 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9936 - * Copyright 2008 by Sun Microsystems, Inc.
9938 - * OpenOffice.org - a multi-platform office productivity suite
9940 - * $RCSfile: factory.hxx,v $
9942 - * $Revision: 1.3 $
9944 - * This file is part of OpenOffice.org.
9946 - * OpenOffice.org is free software: you can redistribute it and/or modify
9947 - * it under the terms of the GNU Lesser General Public License version 3
9948 - * only, as published by the Free Software Foundation.
9950 - * OpenOffice.org is distributed in the hope that it will be useful,
9951 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9952 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9953 - * GNU Lesser General Public License version 3 for more details
9954 - * (a copy is included in the LICENSE file that accompanied this code).
9956 - * You should have received a copy of the GNU Lesser General Public License
9957 - * version 3 along with OpenOffice.org. If not, see
9958 - * <http://www.openoffice.org/license.html>
9959 - * for a copy of the LGPLv3 License.
9961 - ************************************************************************/
9963 -#ifndef FACTORY_HXX_
9964 -#define FACTORY_HXX_
9966 -#include <com/sun/star/lang/XSingleServiceFactory.hpp>
9967 -#include <com/sun/star/lang/XServiceInfo.hpp>
9968 -#include <cppuhelper/implbase2.hxx>
9969 -#include <toolkit/dllapi.h>
9971 -namespace layoutimpl
9976 -class TOOLKIT_DLLPUBLIC LayoutFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
9977 - ::com::sun::star::lang::XServiceInfo >
9979 - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
9982 - LayoutFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
9983 - : m_xFactory( xFactory )
9985 - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
9988 - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
9989 - impl_staticGetSupportedServiceNames();
9991 - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
9993 - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
9994 - impl_staticCreateSelfInstance(
9995 - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
9998 - // XSingleServiceFactory
9999 - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
10000 - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
10003 - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
10004 - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
10005 - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
10009 -#endif /* FACTORY_HXX */
10010 --- toolkit/source/layout/flow.cxx.old 2009-04-02 10:49:36.000000000 +0000
10011 +++ toolkit/source/layout/flow.cxx 1970-01-01 00:00:00.000000000 +0000
10013 -/*************************************************************************
10015 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10017 - * Copyright 2008 by Sun Microsystems, Inc.
10019 - * OpenOffice.org - a multi-platform office productivity suite
10021 - * $RCSfile: flow.cxx,v $
10023 - * $Revision: 1.3 $
10025 - * This file is part of OpenOffice.org.
10027 - * OpenOffice.org is free software: you can redistribute it and/or modify
10028 - * it under the terms of the GNU Lesser General Public License version 3
10029 - * only, as published by the Free Software Foundation.
10031 - * OpenOffice.org is distributed in the hope that it will be useful,
10032 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10033 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10034 - * GNU Lesser General Public License version 3 for more details
10035 - * (a copy is included in the LICENSE file that accompanied this code).
10037 - * You should have received a copy of the GNU Lesser General Public License
10038 - * version 3 along with OpenOffice.org. If not, see
10039 - * <http://www.openoffice.org/license.html>
10040 - * for a copy of the LGPLv3 License.
10042 - ************************************************************************/
10044 -#include "flow.hxx"
10046 -#include <sal/macros.h>
10048 -namespace layoutimpl
10051 -using namespace css;
10053 -bool Flow::ChildData::isVisible()
10055 - return xChild.is();
10061 - , mbHomogeneous( false )
10063 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
10064 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
10065 - &mbHomogeneous );
10066 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
10067 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
10072 -Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
10073 - throw (uno::RuntimeException, css::awt::MaxChildrenException)
10075 - if ( xChild.is() )
10077 - ChildData *pData = new ChildData();
10078 - pData->xChild = xChild;
10079 - maChildren.push_back( pData );
10081 - setChildParent( xChild );
10087 -Flow::removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild )
10088 - throw (css::uno::RuntimeException)
10090 - for ( std::list< ChildData * >::iterator it = maChildren.begin();
10091 - it != maChildren.end(); it++ )
10093 - if ( (*it)->xChild == xChild )
10096 - maChildren.erase( it );
10098 - unsetChildParent( xChild );
10105 -css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > SAL_CALL
10106 -Flow::getChildren()
10107 - throw (css::uno::RuntimeException)
10109 - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
10110 - unsigned int i = 0;
10111 - for ( std::list< ChildData * >::iterator it = maChildren.begin();
10112 - it != maChildren.end(); it++, i++ )
10113 - children[i] = (*it)->xChild;
10118 -uno::Reference< beans::XPropertySet > SAL_CALL
10119 -Flow::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& /*xChild*/ )
10120 - throw (uno::RuntimeException)
10122 - return uno::Reference< beans::XPropertySet >();
10126 -Flow::calculateSize( long nMaxWidth )
10128 - long nNeedHeight = 0;
10130 - std::list<ChildData *>::const_iterator it;
10132 - // first pass, for homogeneous property
10133 - for (it = maChildren.begin(); it != maChildren.end(); it++)
10135 - if ( !(*it)->isVisible() )
10137 - (*it)->aRequisition = (*it)->xChild->getMinimumSize();
10138 - if ( mbHomogeneous )
10139 - mnEachWidth = SAL_MAX( mnEachWidth, (*it)->aRequisition.Width );
10142 - long nRowWidth = 0, nRowHeight = 0;
10143 - for (it = maChildren.begin(); it != maChildren.end(); it++)
10145 - if ( !(*it)->isVisible() )
10148 - awt::Size aChildSize = (*it)->aRequisition;
10149 - if ( mbHomogeneous )
10150 - aChildSize.Width = mnEachWidth;
10152 - if ( nMaxWidth && nRowWidth > 0 && nRowWidth + aChildSize.Width > nMaxWidth )
10155 - nNeedHeight += nRowHeight;
10158 - nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
10159 - nRowWidth += aChildSize.Width;
10161 - nNeedHeight += nRowHeight;
10163 - return awt::Size( nRowWidth, nNeedHeight );
10166 -awt::Size SAL_CALL
10167 -Flow::getMinimumSize() throw(uno::RuntimeException)
10169 - return maRequisition = calculateSize( 0 );
10173 -Flow::hasHeightForWidth()
10174 - throw(css::uno::RuntimeException)
10179 -sal_Int32 SAL_CALL
10180 -Flow::getHeightForWidth( sal_Int32 nWidth )
10181 - throw(css::uno::RuntimeException)
10183 - return calculateSize( nWidth ).Height;
10187 -Flow::allocateArea( const css::awt::Rectangle &rArea )
10188 - throw (css::uno::RuntimeException)
10190 - maAllocation = rArea;
10192 - std::list<ChildData *>::const_iterator it;
10193 - long nX = 0, nY = 0, nRowHeight = 0;
10194 - for (it = maChildren.begin(); it != maChildren.end(); it++)
10196 - ChildData *child = *it;
10197 - if ( !child->isVisible() )
10200 - awt::Size aChildSize( child->aRequisition );
10201 - if ( mbHomogeneous )
10202 - aChildSize.Width = mnEachWidth;
10204 - if ( nX > 0 && nX + aChildSize.Width > rArea.Width )
10207 - nY += nRowHeight;
10210 - nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
10212 - allocateChildAt( child->xChild,
10213 - awt::Rectangle( rArea.X + nX, rArea.Y + nY, aChildSize.Width, aChildSize.Height ) );
10215 - nX += aChildSize.Width;
10219 -} // namespace layoutimpl
10220 --- toolkit/source/layout/flow.hxx.old 2009-04-02 10:49:36.000000000 +0000
10221 +++ toolkit/source/layout/flow.hxx 1970-01-01 00:00:00.000000000 +0000
10223 -/*************************************************************************
10225 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10227 - * Copyright 2008 by Sun Microsystems, Inc.
10229 - * OpenOffice.org - a multi-platform office productivity suite
10231 - * $RCSfile: flow.hxx,v $
10233 - * $Revision: 1.3 $
10235 - * This file is part of OpenOffice.org.
10237 - * OpenOffice.org is free software: you can redistribute it and/or modify
10238 - * it under the terms of the GNU Lesser General Public License version 3
10239 - * only, as published by the Free Software Foundation.
10241 - * OpenOffice.org is distributed in the hope that it will be useful,
10242 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10243 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10244 - * GNU Lesser General Public License version 3 for more details
10245 - * (a copy is included in the LICENSE file that accompanied this code).
10247 - * You should have received a copy of the GNU Lesser General Public License
10248 - * version 3 along with OpenOffice.org. If not, see
10249 - * <http://www.openoffice.org/license.html>
10250 - * for a copy of the LGPLv3 License.
10252 - ************************************************************************/
10254 -#ifndef CORE_FLOW_HXX
10255 -#define CORE_FLOW_HXX
10257 -#include "container.hxx"
10261 -namespace layoutimpl
10264 -class Flow : public Container
10267 - // Box properties (i.e. affect all children)
10268 - sal_Int32 mnSpacing;
10269 - sal_Bool mbHomogeneous;
10272 - // Children properties
10275 - css::awt::Size aRequisition;
10276 - css::uno::Reference< css::awt::XLayoutConstrains > xChild;
10277 - css::uno::Reference< css::beans::XPropertySet > xProps;
10278 - bool isVisible();
10282 - std::list< ChildData * > maChildren;
10283 - long mnEachWidth; // on homogeneous, the width of every child
10288 - // css::awt::XLayoutContainer
10289 - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
10290 - throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
10291 - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
10292 - throw (css::uno::RuntimeException);
10294 - virtual css::uno::Sequence< css::uno::Reference
10295 - < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
10296 - throw (css::uno::RuntimeException);
10298 - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
10299 - const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
10300 - throw (css::uno::RuntimeException);
10302 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
10303 - throw (css::uno::RuntimeException);
10305 - virtual css::awt::Size SAL_CALL getMinimumSize()
10306 - throw(css::uno::RuntimeException);
10307 - virtual sal_Bool SAL_CALL hasHeightForWidth()
10308 - throw(css::uno::RuntimeException);
10309 - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
10310 - throw(css::uno::RuntimeException);
10312 -PROPHELPER_SET_INFO
10315 - // shared between getMinimumSize() and getHeightForWidth()
10316 - css::awt::Size calculateSize( long nMaxWidth );
10319 -} // namespace layoutimpl
10321 -#endif /*FLOW_CORE_HXX*/
10322 --- toolkit/source/layout/helper.cxx.old 2009-04-06 16:42:11.000000000 +0000
10323 +++ toolkit/source/layout/helper.cxx 1970-01-01 00:00:00.000000000 +0000
10325 -/*************************************************************************
10327 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10329 - * Copyright 2008 by Sun Microsystems, Inc.
10331 - * OpenOffice.org - a multi-platform office productivity suite
10333 - * $RCSfile: helper.cxx,v $
10335 - * $Revision: 1.3 $
10337 - * This file is part of OpenOffice.org.
10339 - * OpenOffice.org is free software: you can redistribute it and/or modify
10340 - * it under the terms of the GNU Lesser General Public License version 3
10341 - * only, as published by the Free Software Foundation.
10343 - * OpenOffice.org is distributed in the hope that it will be useful,
10344 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10345 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10346 - * GNU Lesser General Public License version 3 for more details
10347 - * (a copy is included in the LICENSE file that accompanied this code).
10349 - * You should have received a copy of the GNU Lesser General Public License
10350 - * version 3 along with OpenOffice.org. If not, see
10351 - * <http://www.openoffice.org/license.html>
10352 - * for a copy of the LGPLv3 License.
10354 - ************************************************************************/
10356 -#include "helper.hxx"
10358 -#include <assert.h>
10360 -#include <com/sun/star/awt/WindowAttribute.hpp>
10361 -#include <com/sun/star/awt/XWindow.hpp>
10362 -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
10363 -#include <toolkit/awt/vclxwindow.hxx>
10364 -#include <tools/debug.hxx>
10366 -#include "proplist.hxx"
10367 -#include "layout/layoutcore.hxx"
10369 -#if TEST_LAYOUT && !defined( DBG_UTIL )
10372 -#define DBG_ERROR printf
10374 -#define DBG_ERROR1 printf
10376 -#define DBG_ERROR2 printf
10377 -#endif /* TEST_LAYOUT && !DBG_UTIL */
10379 -namespace layoutimpl
10381 -using namespace com::sun::star;
10382 -using rtl::OUString;
10384 -uno::Reference< awt::XWindowPeer >
10385 -getParent( uno::Reference< uno::XInterface > xRef )
10389 - uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY );
10390 - if ( xPeer.is() )
10393 - uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
10394 - if ( xCont.is() )
10395 - xRef = xCont->getParent();
10397 - while ( xRef.is() );
10399 - return uno::Reference< awt::XWindowPeer >();
10403 -static uno::Reference< awt::XWindowPeer >
10404 -getToplevel( uno::Reference< uno::XInterface > xRef )
10406 - uno::Reference< awt::XWindowPeer > xTop, i;
10407 - while ( ( i = uno::Reference< awt::XWindowPeer >( xRef, uno::UNO_QUERY ) ).is() )
10411 - uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
10412 - if ( xCont.is() )
10413 - xRef = xCont->getParent();
10415 - xRef = uno::Reference< awt::XWindowPeer >();
10424 -#include "bin.hxx"
10425 -#include "box.hxx"
10426 -#include "dialogbuttonhbox.hxx"
10427 -#include "flow.hxx"
10428 -#include "localized-string.hxx"
10429 -#include "table.hxx"
10431 -namespace layoutimpl
10434 -static uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
10435 - uno::Reference< uno::XInterface > xParent,
10436 - OUString aName, long WindowAttributes );
10438 -uno::Reference< awt::XLayoutContainer >
10439 -createContainer( const OUString &rName )
10441 - uno::Reference< awt::XLayoutContainer > xPeer;
10443 - if ( rName.equalsAscii( "hbox" ) )
10444 - xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() );
10445 - else if ( rName.equalsAscii( "vbox" ) )
10446 - xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() );
10447 - else if ( rName.equalsAscii( "table" ) )
10448 - xPeer = uno::Reference< awt::XLayoutContainer >( new Table() );
10449 - else if ( rName.equalsAscii( "flow" ) )
10450 - xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() );
10451 - else if ( rName.equalsAscii( "bin" ) )
10452 - xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() );
10453 - else if ( rName.equalsAscii( "min-size" ) )
10454 - xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() );
10455 - else if ( rName.equalsAscii( "align" ) )
10456 - xPeer = uno::Reference< awt::XLayoutContainer >( new Align() );
10457 - else if ( rName.equalsAscii( "dialogbuttonhbox" ) )
10458 - xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() );
10463 -static uno::Reference< awt::XLayoutConstrains >
10464 -createToolkitWidget( uno::Reference< awt::XToolkit > xToolkit,
10465 - uno::Reference< uno::XInterface > xParent,
10466 - const OUString &rName, long nProps )
10468 - uno::Reference< awt::XLayoutConstrains > xPeer;
10469 - bool bToplevel = !xParent.is();
10471 - // UNO Control Widget
10472 - awt::WindowDescriptor desc;
10474 - desc.Type = awt::WindowClass_TOP;
10477 - desc.Type = awt::WindowClass_SIMPLE;
10480 - // top container -- a wrapper for framewindow -- is de-coupled
10481 - // from awt::XWindowPeer. So, getParent() fails at it.
10482 - uno::Reference< awt::XWindowPeer > xWinParent = getParent( xParent );
10484 - uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY );
10486 - assert( xParent.is() );
10487 - assert( xWinParent.is() );
10489 - With the new three layer instarr/rpath feature, when
10490 - prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to
10491 - LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0
10492 - vclxtoolkit::ImplCreateWindow failing to create any widget;
10493 - although it succeeds here.
10495 - While developing, one now must copy libtlx.so to
10496 - $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so
10499 - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xWinParent );
10500 - if ( !pParentComponent )
10501 - throw uno::RuntimeException(
10502 - OUString::createFromAscii( "parent has no implementation" ),
10503 - uno::Reference< uno::XInterface >() );
10504 - desc.Parent = xWinParent;
10507 - desc.ParentIndex = 0;
10508 - // debugging help ...
10509 - desc.Bounds.X = 0;
10510 - desc.Bounds.Y = 0;
10511 - desc.Bounds.Width = 300;
10512 - desc.Bounds.Height = 200;
10514 - desc.WindowAttributes = nProps;
10515 - desc.WindowServiceName = rName;
10517 - uno::Reference< awt::XWindowPeer > xWinPeer;
10520 - OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) );
10521 - xWinPeer = xToolkit->createWindow( desc );
10522 - if ( !xWinPeer.is() )
10523 - throw uno::RuntimeException(
10524 - OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ),
10525 - uno::Reference< uno::XInterface >() );
10526 - xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY );
10528 - catch( uno::Exception & )
10530 - DBG_ERROR1( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( rName ) );
10531 - return uno::Reference< awt::XLayoutConstrains >();
10534 - // default to visible, let then people change it on properties
10535 - if ( ! bToplevel )
10537 - uno::Reference< awt::XWindow> xWindow( xPeer, uno::UNO_QUERY );
10538 - if ( xWindow.is() )
10539 - xWindow->setVisible( true );
10544 -uno::Reference< awt::XLayoutConstrains >
10545 -createWidget( uno::Reference< awt::XToolkit > xToolkit,
10546 - uno::Reference< uno::XInterface > xParent,
10547 - const OUString &rName, long nProps )
10549 - uno::Reference< awt::XLayoutConstrains > xPeer;
10551 - xPeer = uno::Reference< awt::XLayoutConstrains >(
10552 - createContainer( rName ), uno::UNO_QUERY );
10553 - if ( xPeer.is() )
10556 - xPeer = ImplCreateWindow( xParent, rName, nProps );
10557 - if ( xPeer.is() )
10561 - OUString tName = rName;
10563 - if ( rName.equalsAscii( "fixedinfo" ) )
10564 - tName = OUString::createFromAscii( "fixedtext" );
10565 - xPeer = createToolkitWidget( xToolkit, xParent, tName, nProps );
10567 - xPeer = createToolkitWidget( xToolkit, xParent, rName, nProps );
10573 -PropHelper::PropHelper() : LockHelper()
10574 - , cppu::OPropertySetHelper( maBrdcstHelper )
10575 - , pHelper( NULL )
10580 -PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
10581 - uno::Type aType, void *pPtr)
10583 - // this sucks rocks for effiency ...
10584 - PropDetails aDetails;
10585 - aDetails.aName = rtl::OUString::intern( pName, nNameLen, e );
10586 - aDetails.aType = aType;
10587 - aDetails.pValue = pPtr;
10588 - maDetails.push_back( aDetails );
10591 -cppu::IPropertyArrayHelper & SAL_CALL
10592 -PropHelper::getInfoHelper()
10596 - uno::Sequence< beans::Property > aProps( maDetails.size() );
10597 - for ( unsigned int i = 0; i < maDetails.size(); i++)
10599 - aProps[i].Name = maDetails[i].aName;
10600 - aProps[i].Type = maDetails[i].aType;
10601 - aProps[i].Handle = i;
10602 - aProps[i].Attributes = 0;
10604 - pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ );
10611 -PropHelper::convertFastPropertyValue(
10612 - uno::Any & rConvertedValue,
10613 - uno::Any & rOldValue,
10614 - sal_Int32 nHandle,
10615 - const uno::Any& rValue )
10616 - throw (lang::IllegalArgumentException)
10618 - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
10620 - // FIXME: no Any::getValue ...
10621 - getFastPropertyValue( rOldValue, nHandle );
10622 - if ( rOldValue != rValue )
10624 - rConvertedValue = rValue;
10625 - return sal_True; // changed
10629 - rConvertedValue.clear();
10630 - rOldValue.clear();
10632 - return sal_False;
10637 -PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
10638 - const uno::Any& rValue )
10639 - throw (uno::Exception)
10641 - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
10643 - const PropDetails &rInfo = maDetails[ nHandle ];
10645 - uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(),
10646 - rValue.pData, rValue.pType,
10649 - if ( mpListener )
10650 - mpListener->propertiesChanged();
10654 -PropHelper::getFastPropertyValue( uno::Any& rValue,
10655 - sal_Int32 nHandle ) const
10657 - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
10658 - const PropDetails &rInfo = maDetails[ nHandle ];
10660 - switch ( rInfo.aType.getTypeClass() )
10662 -#define MAP(classtype,ctype) \
10663 - case uno::TypeClass_##classtype: \
10664 - rValue <<= *(ctype *)(rInfo.pValue); \
10666 - MAP( DOUBLE, double );
10667 - MAP( SHORT, sal_Int16 );
10668 - MAP( LONG, sal_Int32 );
10669 - MAP( UNSIGNED_SHORT, sal_uInt16 );
10670 - MAP( UNSIGNED_LONG, sal_uInt32 );
10671 - MAP( STRING, ::rtl::OUString );
10673 - DBG_ERROR( "ERROR: unknown type to map!" );
10678 - rValue.setValue( rInfo.pValue, rInfo.aType );
10681 -::com::sun::star::uno::Any
10682 -PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
10684 - return OPropertySetHelper::queryInterface( rType );
10687 -} // namespace layoutimpl
10689 -#include <awt/vclxbutton.hxx>
10690 -#include <awt/vclxdialog.hxx>
10691 -#include <awt/vclxfixedline.hxx>
10692 -#include <awt/vclxplugin.hxx>
10693 -#include <awt/vclxscroller.hxx>
10694 -#include <awt/vclxsplitter.hxx>
10695 -#include <awt/vclxtabcontrol.hxx>
10696 -#include <awt/vclxtabpage.hxx>
10697 -#include <toolkit/awt/vclxtoolkit.hxx>
10698 -#include <toolkit/awt/vclxwindow.hxx>
10699 -#include <vcl/button.hxx>
10700 -#include <vcl/dialog.hxx>
10701 -#include <vcl/fixed.hxx>
10702 -#include <vcl/tabctrl.hxx>
10703 -#include <vcl/tabpage.hxx>
10705 -#include <typeinfo>
10707 -namespace layoutimpl
10710 -TOOLKIT_DLLPUBLIC Window* global_parent;
10712 -uno::Reference< awt::XLayoutConstrains > ImplCreateWindow(
10713 - uno::Reference< uno::XInterface > xParent,
10714 - OUString aName, long WindowAttributes )
10716 - VCLXWindow *pNewComp = NULL;
10717 - Window *pNewWindow = NULL;
10718 - Window *pParent = NULL;
10719 - uno::Reference< awt::XLayoutConstrains > xRef;
10721 - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xParent );
10722 - if ( pParentComponent )
10723 - pParent = pParentComponent->GetWindow();
10725 - if ( aName.equalsAscii( "dialog" ) )
10727 - if ( pParent == NULL )
10728 - pParent = DIALOG_NO_PARENT;
10729 - pNewWindow = new Dialog( pParent,
10730 - ImplGetWinBits( WindowAttributes, 0 ) );
10731 - pNewComp = new layoutimpl::VCLXDialog();
10733 - WindowAttributes ^= awt::WindowAttribute::SHOW;
10735 - else if ( aName.equalsAscii( "modaldialog" ) )
10737 - if ( pParent == NULL )
10738 - pParent = DIALOG_NO_PARENT;
10739 - pNewWindow = new ModalDialog( pParent,
10740 - ImplGetWinBits( WindowAttributes, 0 ) );
10741 - pNewComp = new layoutimpl::VCLXDialog();
10743 - WindowAttributes ^= awt::WindowAttribute::SHOW;
10745 - else if ( aName.equalsAscii( "tabcontrol" ) )
10747 - pNewWindow = new TabControl( pParent,
10748 - ImplGetWinBits( WindowAttributes, WINDOW_TABCONTROL ) );
10749 - pNewComp = new layoutimpl::VCLXTabControl();
10751 - else if ( aName.equalsAscii( "scroller" ) )
10753 - // used FixedImage because I just want some empty non-intrusive widget
10754 - pNewWindow = new FixedImage( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10755 - pNewComp = new layoutimpl::VCLXScroller();
10757 - else if ( aName.equalsAscii( "hsplitter" ) || aName.equalsAscii( "vsplitter" ) )
10759 - pNewWindow = new FixedImage( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10760 - pNewComp = new layoutimpl::VCLXSplitter( aName.equalsAscii( "hsplitter" ) );
10762 - else if ( aName.equalsAscii( "hfixedline" ) || aName.equalsAscii( "vfixedline" ) )
10764 - WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 );
10765 - nStyle ^= WB_HORZ;
10766 - if ( aName.equalsAscii( "hfixedline" ) )
10767 - nStyle |= WB_HORZ;
10769 - nStyle |= WB_VERT;
10770 - pNewWindow = new FixedLine( pParent, nStyle );
10771 - pNewComp = new layoutimpl::VCLXFixedLine();
10773 - else if ( aName.equalsAscii( "okbutton" ) )
10775 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10776 - pNewComp = new layoutimpl::VCLXOKButton( pNewWindow );
10778 - else if ( aName.equalsAscii( "cancelbutton" ) )
10780 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10781 - pNewComp = new layoutimpl::VCLXCancelButton( pNewWindow );
10783 - else if ( aName.equalsAscii( "yesbutton" ) )
10785 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10786 - pNewComp = new layoutimpl::VCLXYesButton( pNewWindow );
10788 - else if ( aName.equalsAscii( "nobutton" ) )
10790 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10791 - pNewComp = new layoutimpl::VCLXNoButton( pNewWindow );
10793 - else if ( aName.equalsAscii( "retrybutton" ) )
10795 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10796 - pNewComp = new layoutimpl::VCLXRetryButton( pNewWindow );
10798 - else if ( aName.equalsAscii( "ignorebutton" ) )
10800 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10801 - pNewComp = new layoutimpl::VCLXIgnoreButton( pNewWindow );
10803 - else if ( aName.equalsAscii( "resetbutton" ) )
10805 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10806 - pNewComp = new layoutimpl::VCLXResetButton( pNewWindow );
10808 - else if ( aName.equalsAscii( "applybutton" ) )
10810 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10811 - pNewComp = new layoutimpl::VCLXApplyButton( pNewWindow );
10813 - else if ( aName.equalsAscii( "helpbutton" ) )
10815 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10816 - pNewComp = new layoutimpl::VCLXHelpButton( pNewWindow );
10818 - else if ( aName.equalsAscii( "morebutton" ) )
10820 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10821 - pNewComp = new layoutimpl::VCLXMoreButton( pNewWindow );
10823 - else if ( aName.equalsAscii( "advancedbutton" ) )
10825 - pNewWindow = new PushButton( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10826 - pNewComp = new layoutimpl::VCLXAdvancedButton( pNewWindow );
10828 - else if ( aName.equalsAscii( "plugin" ) )
10830 - pNewWindow = new Control( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10831 - OSL_TRACE( "%s: parent=%p (%s)\n", __FUNCTION__, pParent, typeid( *pParent ).name() );
10832 - pNewComp = new layoutimpl::VCLXPlugin( pNewWindow, ImplGetWinBits( WindowAttributes, 0 ) );
10834 - else if ( aName.equalsAscii( "tabpage" ) )
10837 - pParent = layout::TabPage::global_parent;
10839 - //pNewWindow = new TabPage( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10840 - WindowAttributes ^= awt::WindowAttribute::SHOW;
10841 - WinBits nStyle = ImplGetWinBits( WindowAttributes, 0 );
10842 - nStyle |= WB_HIDE;
10843 - //nStyle |= WB_NODIALOGCONTROL;
10844 - //nStyle |= WB_DIALOGCONTROL;
10845 - //nStyle = 2147483714L;
10846 - OSL_TRACE( "in bits=%lu", nStyle );
10847 - pNewWindow = new TabPage( pParent, nStyle );
10848 - pNewComp = new VCLXTabPage( pNewWindow );
10850 - else if ( aName.equalsAscii( "string" ) )
10852 - // FIXME: move <string>s.text to simple map<string> in root?
10853 - WindowAttributes &= ~awt::WindowAttribute::SHOW;
10854 - pNewWindow = new Window( pParent, ImplGetWinBits( WindowAttributes, 0 ) );
10855 - pNewComp = new layoutimpl::LocalizedString();
10858 - if ( !pNewWindow )
10861 - pNewWindow->SetCreatedWithToolkit( sal_True );
10863 - pNewComp->SetCreatedWithToolkit( TRUE );
10865 - pNewWindow->SetComponentInterface( pNewComp );
10866 - if ( WindowAttributes & awt::WindowAttribute::SHOW )
10867 - pNewWindow->Show();
10872 -} // namespace layoutimpl
10874 -// Avoid polluting the rest of the code with vcl linkage pieces ...
10876 -#include <vcl/imagerepository.hxx>
10877 -#include <vcl/bitmapex.hxx>
10878 -#include <vcl/graph.hxx>
10880 -namespace layoutimpl
10883 -uno::Reference< graphic::XGraphic > loadGraphic( const char *pName )
10887 - OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US );
10888 - if ( aStr.compareToAscii( ".uno:" ) == 0 )
10889 - aStr = aStr.copy( 5 ).toAsciiLowerCase();
10891 - if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) )
10892 - return uno::Reference< graphic::XGraphic >();
10894 - return Graphic( aBmp ).GetXGraphic();
10897 -} // namespace layoutimpl
10898 --- toolkit/source/layout/helper.hxx.old 2009-04-02 10:49:36.000000000 +0000
10899 +++ toolkit/source/layout/helper.hxx 1970-01-01 00:00:00.000000000 +0000
10901 -/*************************************************************************
10903 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10905 - * Copyright 2008 by Sun Microsystems, Inc.
10907 - * OpenOffice.org - a multi-platform office productivity suite
10909 - * $RCSfile: helper.hxx,v $
10911 - * $Revision: 1.3 $
10913 - * This file is part of OpenOffice.org.
10915 - * OpenOffice.org is free software: you can redistribute it and/or modify
10916 - * it under the terms of the GNU Lesser General Public License version 3
10917 - * only, as published by the Free Software Foundation.
10919 - * OpenOffice.org is distributed in the hope that it will be useful,
10920 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10921 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10922 - * GNU Lesser General Public License version 3 for more details
10923 - * (a copy is included in the LICENSE file that accompanied this code).
10925 - * You should have received a copy of the GNU Lesser General Public License
10926 - * version 3 along with OpenOffice.org. If not, see
10927 - * <http://www.openoffice.org/license.html>
10928 - * for a copy of the LGPLv3 License.
10930 - ************************************************************************/
10932 -#ifndef HELPER_HXX
10933 -#define HELPER_HXX
10935 -#include <toolkit/dllapi.h>
10938 -#include <com/sun/star/awt/XLayoutConstrains.hpp>
10939 -#include <com/sun/star/awt/XLayoutContainer.hpp>
10940 -#include <com/sun/star/awt/XVclWindowPeer.hpp>
10941 -#include <com/sun/star/xml/input/XRoot.hpp>
10942 -#include <cppuhelper/implbase1.hxx>
10943 -#include <cppuhelper/propshlp.hxx>
10944 -#include <rtl/ustring.hxx>
10946 -namespace layoutimpl
10949 -namespace css = ::com::sun::star;
10951 -/* ChildProps -- a helper to set child properties for the XLayoutContainer interface. */
10956 - osl::Mutex maGuard;
10957 - cppu::OBroadcastHelper maBrdcstHelper;
10958 - LockHelper() : maBrdcstHelper( maGuard )
10963 -class PropHelper : public LockHelper
10964 - , public cppu::OPropertySetHelper
10965 - , public cppu::OWeakObject
10967 - cppu::OPropertyArrayHelper *pHelper;
10969 - struct PropDetails
10971 - rtl::OUString aName;
10972 - css::uno::Type aType;
10975 - std::vector< PropDetails > maDetails;
10978 - void addProp( char const *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
10979 - css::uno::Type aType, void *pPtr );
10984 - // com::sun::star::uno::XInterface
10985 - void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
10986 - void SAL_CALL release() throw() { OWeakObject::release(); }
10987 - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
10989 - // cppu::OPropertySetHelper
10990 - virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
10991 - virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any &,
10992 - css::uno::Any &, sal_Int32 nHandle, const css::uno::Any & )
10993 - throw(css::lang::IllegalArgumentException);
10994 - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
10995 - const css::uno::Any& rValue ) throw (css::uno::Exception);
10996 - using OPropertySetHelper::getFastPropertyValue;
10997 - virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue,
10998 - sal_Int32 nHandle ) const;
11000 - // you -must- use this macro in sub-classes that define new properties.
11001 - // NB. 'static' ...
11002 - // com::sun::star::beans::XMultiPropertySet
11003 -#define PROPHELPER_SET_INFO \
11004 - css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL \
11005 - getPropertySetInfo() throw(css::uno::RuntimeException) \
11007 - static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( \
11008 - createPropertySetInfo( getInfoHelper() ) ); \
11011 - PROPHELPER_SET_INFO
11015 - virtual void propertiesChanged() = 0;
11017 - void setChangeListener( Listener *pListener )
11019 - mpListener = pListener;
11023 - Listener *mpListener;
11026 -css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &type);
11028 -// The native widgets wrapper hierarchy may not reflect that of the layout
11029 -// hierarchy as some containers don't have an associated native widget.
11030 -// Use this function to get the native parent of the given peer.
11031 -css::uno::Reference< css::awt::XWindowPeer >
11032 -getParent( css::uno::Reference< css::uno::XInterface > xPeer );
11035 -struct WidgetFactory
11037 - virtual css::uno::Reference< css::awt::XLayoutConstrains >
11038 - createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
11039 - css::uno::Reference< css::uno::XInterface > xParent,
11040 - const rtl::OUString &rName, long nProps );
11043 -// A local factory method - should use UNO services in due course
11044 -css::uno::Reference< css::awt::XLayoutConstrains > TOOLKIT_DLLPUBLIC
11045 -createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
11046 - css::uno::Reference< css::uno::XInterface > xParent,
11047 - const rtl::OUString &rName, long nProps );
11049 -// Factory for containers (not visible ones)
11050 -css::uno::Reference< css::awt::XLayoutContainer >
11051 -createContainer( const rtl::OUString &rName );
11053 -} // namespace layoutimpl
11055 -#endif /* HELPER_HXX */
11056 --- toolkit/source/layout/import.cxx.old 2009-04-06 16:42:11.000000000 +0000
11057 +++ toolkit/source/layout/import.cxx 1970-01-01 00:00:00.000000000 +0000
11059 -/*************************************************************************
11061 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11063 - * Copyright 2008 by Sun Microsystems, Inc.
11065 - * OpenOffice.org - a multi-platform office productivity suite
11067 - * $RCSfile: import.cxx,v $
11069 - * $Revision: 1.3 $
11071 - * This file is part of OpenOffice.org.
11073 - * OpenOffice.org is free software: you can redistribute it and/or modify
11074 - * it under the terms of the GNU Lesser General Public License version 3
11075 - * only, as published by the Free Software Foundation.
11077 - * OpenOffice.org is distributed in the hope that it will be useful,
11078 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11079 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11080 - * GNU Lesser General Public License version 3 for more details
11081 - * (a copy is included in the LICENSE file that accompanied this code).
11083 - * You should have received a copy of the GNU Lesser General Public License
11084 - * version 3 along with OpenOffice.org. If not, see
11085 - * <http://www.openoffice.org/license.html>
11086 - * for a copy of the LGPLv3 License.
11088 - ************************************************************************/
11090 -#include "import.hxx"
11092 -#include <com/sun/star/awt/XButton.hpp>
11093 -#include <com/sun/star/awt/XDialog2.hpp>
11094 -#include <vcl/image.hxx>
11095 -#include <tools/debug.hxx>
11097 -#include "root.hxx"
11098 -#include "helper.hxx"
11099 -#include "dialogbuttonhbox.hxx"
11102 -#include "layout/layout.hxx"
11103 -#include "layout/layoutcore.hxx"
11105 -#define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout"
11106 -#define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container"
11108 -namespace layoutimpl
11110 -using namespace css;
11112 -using ::rtl::OUString;
11114 -ElementBase::~ElementBase()
11117 - //delete mpImport;
11122 -WidgetElement::WidgetElement ( sal_Int32 nUid, const OUString &rName,
11123 - uno::Reference <xml::input::XAttributes> const &attributes,
11124 - ElementBase *pParent,
11125 - ImportContext *pImport)
11127 -: ElementBase( nUid, rName, attributes, pParent, pImport )
11129 - OUString name = rName.toAsciiLowerCase();
11132 - propsFromAttributes( attributes, aProps, pImport->XMLNS_LAYOUT_UID );
11135 - findAndRemove( "id", aProps, aId );
11137 - findAndRemove( "xml-lang", aProps, aLang );
11141 - uno::Reference< awt::XLayoutConstrains > xParent;
11143 - xParent = ((WidgetElement *) pParent)->mpWidget->getPeer();
11146 - mpWidget = pImport->mrRoot.create( aId, name,
11147 - getAttributeProps( aProps ), uno::Reference< awt::XLayoutContainer >( xParent, uno::UNO_QUERY ) );
11151 - // TODO: handle with non-existing widgets
11153 - mpWidget->setProperties( aProps );
11155 - uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
11156 - if ( xDialog.is() )
11159 - if ( findAndRemove( "title", aProps, aTitle ) )
11160 - xDialog->setTitle( aTitle );
11162 - else if ( pParent == NULL )
11164 - DBG_ERROR( "Fatal error: top node isn't a dialog" );
11168 - // Hack moved to proplist.cxx
11169 - OUString aGraphic;
11170 - if ( findAndRemove( "graphic", aProps, aGraphic ) )
11171 - //if ( layout::FixedImage *i = dynamic_cast<layout::FixedImage *> ( mpWidget->getPeer().get() ) )
11172 - // FIXME: huh? XImageProducer::complete( XImageConsumer )
11173 - //i->setImage( Image( loadGraphic( OUSTRING_CSTR( aGraphic ) ) ) );
11174 - mpWidget->setProperty( OUString::createFromAscii( "graphic" ),
11175 - loadGraphic( OUSTRING_CSTR( aGraphic ) ) );
11178 - OUString aOrdering;
11179 - if ( findAndRemove( "ordering", aProps, aOrdering ) )
11180 - if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
11181 - b->setOrdering ( aOrdering );
11183 -#ifdef IMPORT_RADIOGROUP
11184 - bool bSetRadioGroup, bSetTitle;
11185 - OUString aRadioGroup, aTitle;
11186 - bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
11187 - bSetTitle = findAndRemove( "title", aProps, aTitle );
11189 - setProperties( mxPeer, aProps );
11191 - // we need to add radio buttons to the group after their properties are
11192 - // set, so we can check if they should be the one selected by default or not.
11193 - // And the state changed event isn't fired when changing properties.
11194 - if ( bSetRadioGroup )
11196 - static int i = 0;
11198 - uno::Reference< awt::XRadioButton > xRadio( mxPeer, uno::UNO_QUERY );
11199 - if ( xRadio.is() )
11200 - pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
11204 - uno::Reference< awt::XDialog2 > xDialog( mxPeer, uno::UNO_QUERY );
11205 - if ( xDialog.is() )
11206 - xDialog->setTitle( aTitle );
11211 -WidgetElement::~WidgetElement()
11213 - //delete mpWidget;
11217 -uno::Reference <xml::input::XElement>
11218 -WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
11219 - uno::Reference <xml::input::XAttributes> const &attributes )
11220 - throw( xml::sax::SAXException, uno::RuntimeException )
11222 - // Adding a child to the widget
11223 - WidgetElement *pChild = new WidgetElement ( nUid, name, attributes, this, mpImport );
11225 - if ( !mpWidget->addChild( pChild->mpWidget ) )
11227 - DBG_ERROR2( "ERROR: cannot add %s to container %s, container full", OUSTRING_CSTR( name ), OUSTRING_CSTR( getLocalName() ) );
11228 - throw xml::sax::SAXException();
11232 - propsFromAttributes( attributes, aProps, mpImport->XMLNS_CONTAINER_UID );
11233 - mpWidget->setChildProperties( pChild->mpWidget, aProps );
11238 -// Support Ivo Hinkelmann's move label/text/title attribute to CONTENT
11241 -WidgetElement::characters( OUString const& rChars )
11242 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11244 - if ( mpWidget && rChars.trim().getLength() )
11246 - uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
11247 - uno::Reference< awt::XButton > xButton( mpWidget->getPeer(), uno::UNO_QUERY );
11248 - if ( xDialog.is() )
11249 - xDialog->setTitle( rChars );
11250 - else if ( xButton.is() )
11251 - mpWidget->setProperty( OUString::createFromAscii( "label" ), rChars );
11253 - mpWidget->setProperty( OUString::createFromAscii( "text" ), rChars );
11256 -// ---- ElementBase ----
11258 -ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName,
11259 - uno::Reference< xml::input::XAttributes > const & xAttributes,
11260 - ElementBase* pParent,
11261 - ImportContext* pImport )
11263 -: mpImport( pImport )
11264 - , mpParent( pParent )
11266 - , maLocalName( rLocalName )
11267 - , mxAttributes( xAttributes )
11271 -// ---- ImportContext ----
11273 -void ImportContext::startDocument(
11274 - uno::Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
11275 - throw (xml::sax::SAXException, uno::RuntimeException)
11277 - XMLNS_LAYOUT_UID = xNamespaceMapping->getUidByUri(
11278 - OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_LAYOUT_URI ) ) );
11279 - XMLNS_CONTAINER_UID = xNamespaceMapping->getUidByUri(
11280 - OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_CONTAINER_URI ) ) );
11283 -ToplevelElement::ToplevelElement (OUString const &rName,
11284 - uno::Reference <xml::input::XAttributes> const &xAttributes,
11285 - ImportContext *pImport)
11287 -: WidgetElement( 0, rName, xAttributes, NULL, pImport )
11291 -ToplevelElement::~ToplevelElement()
11295 -uno::Reference< xml::input::XElement > ImportContext::startRootElement(
11296 - sal_Int32 nUid, OUString const & rLocalName,
11297 - uno::Reference< xml::input::XAttributes > const & xAttributes )
11298 - throw (xml::sax::SAXException, uno::RuntimeException)
11300 - if ( XMLNS_LAYOUT_UID != nUid )
11301 - throw xml::sax::SAXException(
11302 - OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ),
11303 - uno::Reference< uno::XInterface >(), uno::Any() );
11304 - return new ToplevelElement( rLocalName, xAttributes, this );
11307 -} // namespace layoutimpl
11308 --- toolkit/source/layout/import.hxx.old 2009-04-06 16:42:11.000000000 +0000
11309 +++ toolkit/source/layout/import.hxx 1970-01-01 00:00:00.000000000 +0000
11311 -/*************************************************************************
11313 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11315 - * Copyright 2008 by Sun Microsystems, Inc.
11317 - * OpenOffice.org - a multi-platform office productivity suite
11319 - * $RCSfile: import.hxx,v $
11321 - * $Revision: 1.3 $
11323 - * This file is part of OpenOffice.org.
11325 - * OpenOffice.org is free software: you can redistribute it and/or modify
11326 - * it under the terms of the GNU Lesser General Public License version 3
11327 - * only, as published by the Free Software Foundation.
11329 - * OpenOffice.org is distributed in the hope that it will be useful,
11330 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11331 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11332 - * GNU Lesser General Public License version 3 for more details
11333 - * (a copy is included in the LICENSE file that accompanied this code).
11335 - * You should have received a copy of the GNU Lesser General Public License
11336 - * version 3 along with OpenOffice.org. If not, see
11337 - * <http://www.openoffice.org/license.html>
11338 - * for a copy of the LGPLv3 License.
11340 - ************************************************************************/
11342 -#ifndef IMPORT_HXX
11343 -#define IMPORT_HXX
11347 -#define _BACKWARD_BACKWARD_WARNING_H 1
11348 -#include <hash_map>
11350 -#include <com/sun/star/xml/input/XRoot.hpp>
11351 -#include <cppuhelper/implbase1.hxx>
11353 -namespace layoutimpl
11356 -class LayoutWidget;
11357 -namespace css = ::com::sun::star;
11359 -/* blocks under IMPORT_RADIOGROUP are marked for deletion.
11360 - The use of it is to synchronize radio buttons into groups.
11361 - But toolkit doesn't fire toggle events when toggled from the code.
11362 - Another approach is to implement our own XRadioButton from our
11363 - internal toolkit. We could have some singleton where they would
11364 - register... We would need to add another attribute...
11367 -#ifdef IMPORT_RADIOGROUP
11368 -#include <com/sun/star/awt/XRadioButton.hpp>
11376 - void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio )
11377 - throw (css::uno::RuntimeException)
11379 - if ( ! xRadio.is() )
11380 - throw css::uno::RuntimeException();
11382 - css::uno::Reference< RadioGroup > group;
11383 - RadioGroupsMap::iterator it = mxRadioGroups.find( id );
11384 - if ( it == mxRadioGroups.end() )
11386 - group = css::uno::Reference< RadioGroup > ( new RadioGroup() );
11387 - mxRadioGroups [id] = group;
11390 - group = it->second;
11391 - group->addItem( xRadio );
11395 - class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener >
11402 - void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio )
11404 - if ( ! mxSelectedRadio.is() )
11406 - xRadio->setState( true );
11407 - mxSelectedRadio = xRadio;
11409 - else if ( xRadio->getState() )
11411 - mxSelectedRadio->setState( false );
11412 - mxSelectedRadio = xRadio;
11415 - xRadio->addItemListener( this );
11416 - mxRadios.push_back (xRadio);
11420 - typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList;
11421 - RadioButtonsList mxRadios;
11422 - css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio;
11424 - // awt::XItemListener
11425 - void itemStateChanged( const com::sun::star::awt::ItemEvent& e)
11426 - throw (css::uno::RuntimeException)
11428 - if ( e.Selected )
11430 - mxSelectedRadio->setState( false );
11431 - // the only radio button selected would be the one that fired the event
11432 - for ( RadioButtonsList::iterator it = mxRadios.begin();
11433 - it != mxRadios.end(); it++ )
11434 - if ( (*it)->getState() )
11436 - mxSelectedRadio = *it;
11442 - // lang::XEventListener
11443 - void SAL_CALL disposing( const css::lang::EventObject& )
11444 - throw (css::uno::RuntimeException)
11449 - // each RadioGroup will stay alive after RadioGroups die with the ImportContext
11450 - // because they are referenced by every XRadioButton through the listener
11451 - typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap;
11452 - RadioGroupsMap mxRadioGroups;
11461 - Widget( css::uno::Reference< css::awt::XToolkit > xToolkit,
11462 - css::uno::Reference< css::awt::XWindow > xToplevel,
11463 - rtl::OUString unoName, long attrbs );
11464 - virtual ~Widget();
11466 - virtual void setProperties( const PropList &rProps );
11468 - virtual bool addChild( Widget *pChild );
11469 - virtual void setChildProperties( Widget *pChild, const PropList &rProps );
11471 - inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
11472 - { return mxWidget; }
11474 - inline css::uno::Reference< css::awt::XLayoutConstrains > getContainer()
11475 - { return mxContainer; }
11478 - css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
11479 - css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
11485 - Root( css::uno::Reference< css::awt::XToolkit > xToolkit )
11486 - : mxToolkit( xToolkit ) {}
11489 - virtual Widget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs );
11491 - css::uno::Reference< css::awt::XLayoutConstrains > getById( rtl::OUString id );
11492 - inline css::uno::Reference< css::awt::XLayoutConstrains > getToplevel();
11495 - css::uno::Reference< css::awt::XToolkit > mxToolkit;
11496 - Widget *mpToplevel;
11498 - typedef std::hash_map< rtl::OUString, css::uno::Reference< css::awt::XLayoutConstrains >,
11499 - rtl::OUStringHash > ItemHash;
11500 - ItemHash maItems;
11505 -class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
11508 - sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID;
11509 - LayoutRoot &mrRoot; // switch to XNameContainer ref ?
11510 -#ifdef IMPORT_RADIOGROUP
11511 - RadioGroups mxRadioGroups;
11514 - inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () )
11515 - : mrRoot( rRoot ) {}
11516 - virtual ~ImportContext() {}
11519 - virtual void SAL_CALL startDocument(
11520 - css::uno::Reference< css::xml::input::XNamespaceMapping >
11521 - const & xNamespaceMapping )
11522 - throw (css::xml::sax::SAXException, css::uno::RuntimeException);
11523 - virtual void SAL_CALL endDocument()
11524 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11526 - virtual void SAL_CALL processingInstruction(
11527 - ::rtl::OUString const & /* rTarget */, ::rtl::OUString const & /* rData */ )
11528 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11530 - virtual void SAL_CALL setDocumentLocator(
11531 - css::uno::Reference< css::xml::sax::XLocator > const & /* xLocator */ )
11532 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11534 - virtual css::uno::Reference< css::xml::input::XElement >
11535 - SAL_CALL startRootElement(
11536 - sal_Int32 nUid, ::rtl::OUString const & rLocalName,
11537 - css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
11538 - throw (css::xml::sax::SAXException, css::uno::RuntimeException);
11541 -class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
11544 - ImportContext *mpImport;
11545 -/* TODO: check if all this memebers are needed. */
11546 - ElementBase *mpParent;
11549 - ::rtl::OUString maLocalName;
11550 - css::uno::Reference< css::xml::input::XAttributes > mxAttributes;
11553 - sal_Int32 nUid, ::rtl::OUString const & rLocalName,
11554 - css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
11555 - ElementBase * pParent, ImportContext * pImport )
11557 - virtual ~ElementBase() SAL_THROW(());
11560 - virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
11561 - throw (css::uno::RuntimeException)
11562 - { return static_cast< css::xml::input::XElement * >( mpParent ); }
11563 - virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException)
11564 - { return maLocalName; }
11565 - virtual sal_Int32 SAL_CALL getUid() throw (css::uno::RuntimeException)
11566 - { return mnUid; }
11567 - virtual css::uno::Reference< css::xml::input::XAttributes >
11568 - SAL_CALL getAttributes() throw (css::uno::RuntimeException)
11569 - { return mxAttributes; }
11571 - virtual void SAL_CALL ignorableWhitespace(
11572 - ::rtl::OUString const & /* rWhitespaces */ )
11573 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11575 - virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
11576 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11578 - virtual void SAL_CALL processingInstruction(
11579 - ::rtl::OUString const & /* Target */, ::rtl::OUString const & /* Data */ )
11580 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11583 - virtual css::uno::Reference< css::xml::input::XElement >
11584 - SAL_CALL startChildElement(
11585 - sal_Int32 nUid, ::rtl::OUString const & rLocalName,
11586 - css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
11587 - throw (css::xml::sax::SAXException, css::uno::RuntimeException) = 0;
11588 - virtual void SAL_CALL endElement()
11589 - throw (css::xml::sax::SAXException, css::uno::RuntimeException)
11593 -class WidgetElement : public ElementBase
11596 - LayoutWidget *mpWidget;
11599 - WidgetElement( sal_Int32 nUid, rtl::OUString const &name,
11600 - css::uno::Reference< css::xml::input::XAttributes > const &attributes,
11601 - ElementBase *parent, ImportContext *import ) SAL_THROW (());
11603 - ~WidgetElement();
11606 - virtual css::uno::Reference< css::xml::input::XElement> SAL_CALL
11607 - startChildElement (sal_Int32 id, rtl::OUString const &name,
11608 - css::uno::Reference< css::xml::input::XAttributes > const &attributes)
11609 - throw( css::xml::sax::SAXException, css::uno::RuntimeException );
11610 - virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
11611 - throw (css::xml::sax::SAXException, css::uno::RuntimeException);
11614 -class ToplevelElement : public WidgetElement
11617 - ToplevelElement( rtl::OUString const &name,
11618 - css::uno::Reference< css::xml::input::XAttributes > const &attributes,
11619 - ImportContext *import ) SAL_THROW (());
11620 - ~ToplevelElement();
11624 -} // namespace layoutimpl
11626 -#endif /* IMPORT_HXX */
11627 --- toolkit/source/layout/localized-string.cxx.old 2009-04-06 16:42:11.000000000 +0000
11628 +++ toolkit/source/layout/localized-string.cxx 1970-01-01 00:00:00.000000000 +0000
11630 -/*************************************************************************
11632 - * OpenOffice.org - a multi-platform office productivity suite
11638 - * last change: $Author$ $Date$
11640 - * The Contents of this file are made available subject to
11641 - * the terms of GNU Lesser General Public License Version 2.1.
11644 - * GNU Lesser General Public License Version 2.1
11645 - * =============================================
11646 - * Copyright 2005 by Sun Microsystems, Inc.
11647 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11649 - * This library is free software; you can redistribute it and/or
11650 - * modify it under the terms of the GNU Lesser General Public
11651 - * License version 2.1, as published by the Free Software Foundation.
11653 - * This library is distributed in the hope that it will be useful,
11654 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11655 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11656 - * Lesser General Public License for more details.
11658 - * You should have received a copy of the GNU Lesser General Public
11659 - * License along with this library; if not, write to the Free Software
11660 - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
11661 - * MA 02110-1301 USA
11663 - ************************************************************************/
11665 -#include "localized-string.hxx"
11667 -#include <toolkit/helper/property.hxx>
11668 -#include <vcl/window.hxx>
11670 -namespace layoutimpl
11673 -namespace css = ::com::sun::star;
11674 -using namespace css;
11675 -using rtl::OUString;
11677 -LocalizedString::LocalizedString()
11682 -void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids )
11684 - PushPropertyIds( ids, BASEPROPERTY_TEXT, 0);
11685 - VCLXWindow::ImplGetPropertyIds( ids );
11689 -uno::Any LocalizedString::queryInterface( uno::Type const& rType )
11690 - throw(uno::RuntimeException)
11692 - uno::Any aRet = ::cppu::queryInterface( rType,
11693 - SAL_STATIC_CAST( awt::XFixedText*, this ) );
11694 - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
11697 -void LocalizedString::setText( OUString const& s )
11698 - throw(uno::RuntimeException)
11700 - ::vos::OGuard aGuard( GetMutex() );
11702 - if ( Window *w = GetWindow() )
11703 - return w->SetText( s );
11706 -OUString LocalizedString::getText()
11707 - throw(uno::RuntimeException)
11709 - ::vos::OGuard aGuard( GetMutex() );
11711 - if ( Window *w = GetWindow() )
11712 - return w->GetText();
11713 - return OUString();
11716 -} // namespace layoutimpl
11717 --- toolkit/source/layout/localized-string.hxx.old 2009-04-06 16:42:11.000000000 +0000
11718 +++ toolkit/source/layout/localized-string.hxx 1970-01-01 00:00:00.000000000 +0000
11720 -/*************************************************************************
11722 - * OpenOffice.org - a multi-platform office productivity suite
11728 - * last change: $Author$ $Date$
11730 - * The Contents of this file are made available subject to
11731 - * the terms of GNU Lesser General Public License Version 2.1.
11734 - * GNU Lesser General Public License Version 2.1
11735 - * =============================================
11736 - * Copyright 2005 by Sun Microsystems, Inc.
11737 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11739 - * This library is free software; you can redistribute it and/or
11740 - * modify it under the terms of the GNU Lesser General Public
11741 - * License version 2.1, as published by the Free Software Foundation.
11743 - * This library is distributed in the hope that it will be useful,
11744 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11745 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11746 - * Lesser General Public License for more details.
11748 - * You should have received a copy of the GNU Lesser General Public
11749 - * License along with this library; if not, write to the Free Software
11750 - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
11751 - * MA 02110-1301 USA
11753 - ************************************************************************/
11755 -#ifndef CORE_LOCALIZED_STRING_HXX
11756 -#define CORE_LOCALIZED_STRING_HXX
11758 -#include <com/sun/star/awt/XFixedText.hpp>
11759 -#include <toolkit/awt/vclxwindow.hxx>
11761 -namespace layoutimpl
11763 -namespace css = ::com::sun::star;
11765 -// FIXME: misuse XFixedText interface for simple string
11766 -class LocalizedString : public css::awt::XFixedText
11767 - , public VCLXWindow
11770 - LocalizedString();
11772 - // css::uno::XInterface
11773 - css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType )
11774 - throw(css::uno::RuntimeException);
11775 - void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
11776 - void SAL_CALL release() throw() { OWeakObject::release(); }
11778 - // css::awt::XFixedText
11779 - void SAL_CALL setText( ::rtl::OUString const& s )
11780 - throw(css::uno::RuntimeException);
11781 - ::rtl::OUString SAL_CALL getText()
11782 - throw(css::uno::RuntimeException);
11783 - void SAL_CALL setAlignment( sal_Int16 )
11784 - throw(css::uno::RuntimeException) { }
11785 - sal_Int16 SAL_CALL getAlignment()
11786 - throw(css::uno::RuntimeException) { return 0; }
11788 - // css::awt::XLayoutConstrains
11789 - virtual css::awt::Size SAL_CALL getMinimumSize()
11790 - throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); }
11791 - css::awt::Size SAL_CALL getPreferredSize()
11792 - throw(css::uno::RuntimeException) { return getMinimumSize(); }
11793 - css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size )
11794 - throw(css::uno::RuntimeException) { return size; }
11796 - static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids );
11797 - virtual void GetPropertyIds( std::list< sal_uInt16 > &ids )
11798 - { return ImplGetPropertyIds( ids ); }
11801 -} // namespace layoutimpl
11803 -#endif /* CORE_LOCALIZED_STRING_HXX */
11804 --- toolkit/source/layout/makefile.mk.old 2009-04-06 16:42:11.000000000 +0000
11805 +++ toolkit/source/layout/makefile.mk 1970-01-01 00:00:00.000000000 +0000
11807 -#*************************************************************************
11809 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11811 -# Copyright 2008 by Sun Microsystems, Inc.
11813 -# OpenOffice.org - a multi-platform office productivity suite
11815 -# $RCSfile: makefile.mk,v $
11817 -# $Revision: 1.3 $
11819 -# This file is part of OpenOffice.org.
11821 -# OpenOffice.org is free software: you can redistribute it and/or modify
11822 -# it under the terms of the GNU Lesser General Public License version 3
11823 -# only, as published by the Free Software Foundation.
11825 -# OpenOffice.org is distributed in the hope that it will be useful,
11826 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
11827 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11828 -# GNU Lesser General Public License version 3 for more details
11829 -# (a copy is included in the LICENSE file that accompanied this code).
11831 -# You should have received a copy of the GNU Lesser General Public License
11832 -# version 3 along with OpenOffice.org. If not, see
11833 -# <http://www.openoffice.org/license.html>
11834 -# for a copy of the LGPLv3 License.
11836 -#*************************************************************************
11841 -ENABLE_EXCEPTIONS=true
11843 -# --- Settings -----------------------------------------------------
11845 -.INCLUDE : settings.mk
11846 -.INCLUDE : $(PRJ)$/util$/makefile.pmk
11848 -# --- Files --------------------------------------------------------
11850 -# FIXME: This is bad, hmkay
11851 -CFLAGS+= -I$(PRJ)/source
11854 - $(SLO)$/bin.obj \
11855 - $(SLO)$/box-base.obj \
11856 - $(SLO)$/box.obj \
11857 - $(SLO)$/byteseq.obj \
11858 - $(SLO)$/container.obj \
11859 - $(SLO)$/dialogbuttonhbox.obj \
11860 - $(SLO)$/factory.obj \
11861 - $(SLO)$/flow.obj \
11862 - $(SLO)$/helper.obj \
11863 - $(SLO)$/import.obj \
11864 - $(SLO)$/localized-string.obj \
11865 - $(SLO)$/proplist.obj \
11866 - $(SLO)$/root.obj \
11867 - $(SLO)$/table.obj \
11868 - $(SLO)$/timer.obj \
11869 - $(SLO)$/translate.obj
11871 -# --- Targets ------------------------------------------------------
11873 -.INCLUDE : target.mk
11874 --- toolkit/source/layout/precompiled_xmlscript.hxx.old 2009-04-02 10:49:36.000000000 +0000
11875 +++ toolkit/source/layout/precompiled_xmlscript.hxx 1970-01-01 00:00:00.000000000 +0000
11877 -/*************************************************************************
11879 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11881 - * Copyright 2008 by Sun Microsystems, Inc.
11883 - * OpenOffice.org - a multi-platform office productivity suite
11885 - * $RCSfile: precompiled_xmlscript.hxx,v $
11887 - * $Revision: 1.3 $
11889 - * This file is part of OpenOffice.org.
11891 - * OpenOffice.org is free software: you can redistribute it and/or modify
11892 - * it under the terms of the GNU Lesser General Public License version 3
11893 - * only, as published by the Free Software Foundation.
11895 - * OpenOffice.org is distributed in the hope that it will be useful,
11896 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11897 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11898 - * GNU Lesser General Public License version 3 for more details
11899 - * (a copy is included in the LICENSE file that accompanied this code).
11901 - * You should have received a copy of the GNU Lesser General Public License
11902 - * version 3 along with OpenOffice.org. If not, see
11903 - * <http://www.openoffice.org/license.html>
11904 - * for a copy of the LGPLv3 License.
11906 - ************************************************************************/
11909 - xmlscript/source/xml_helper/xml_byteseq.cxx compile helper.
11911 - Avoid introducing a toolkit dependency on xmlscript.
11913 - It would be nice to modify xml_byteseq.cxx making it friendlier
11916 --- toolkit/source/layout/proplist.cxx.old 2009-04-06 16:42:11.000000000 +0000
11917 +++ toolkit/source/layout/proplist.cxx 1970-01-01 00:00:00.000000000 +0000
11919 -/*************************************************************************
11921 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11923 - * Copyright 2008 by Sun Microsystems, Inc.
11925 - * OpenOffice.org - a multi-platform office productivity suite
11927 - * $RCSfile: proplist.cxx,v $
11929 - * $Revision: 1.3 $
11931 - * This file is part of OpenOffice.org.
11933 - * OpenOffice.org is free software: you can redistribute it and/or modify
11934 - * it under the terms of the GNU Lesser General Public License version 3
11935 - * only, as published by the Free Software Foundation.
11937 - * OpenOffice.org is distributed in the hope that it will be useful,
11938 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11939 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11940 - * GNU Lesser General Public License version 3 for more details
11941 - * (a copy is included in the LICENSE file that accompanied this code).
11943 - * You should have received a copy of the GNU Lesser General Public License
11944 - * version 3 along with OpenOffice.org. If not, see
11945 - * <http://www.openoffice.org/license.html>
11946 - * for a copy of the LGPLv3 License.
11948 - ************************************************************************/
11950 -#include "proplist.hxx"
11952 -#include <rtl/ustrbuf.hxx>
11953 -#include <toolkit/dllapi.h>
11954 -#include <com/sun/star/awt/WindowAttribute.hpp>
11955 -#include <com/sun/star/beans/XPropertySet.hpp>
11956 -#include <com/sun/star/awt/XVclWindowPeer.hpp>
11957 -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
11958 -#include <tools/debug.hxx>
11960 -#include "layout/layoutcore.hxx"
11962 -#if TEST_LAYOUT && !defined( DBG_UTIL )
11965 -#define DBG_ERROR printf
11967 -#define DBG_ERROR1 printf
11969 -#define DBG_ERROR2 printf
11970 -#endif /* TEST_LAYOUT && !DBG_UTIL */
11972 -namespace layoutimpl
11975 -using namespace com::sun::star;
11976 -using rtl::OString;
11977 -using rtl::OUString;
11978 -using rtl::OUStringBuffer;
11983 -bool TOOLKIT_DLLPUBLIC
11984 -canHandleProps( const uno::Reference< uno::XInterface > &xPeer )
11986 - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
11987 - if ( xPropSet.is() )
11989 - uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
11990 - uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
11991 - return xInfo.is() && xVclPeer.is();
11994 -uno::Reference< beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC
11995 -queryPropertyInfo(
11996 - const uno::Reference< uno::XInterface > &xPeer )
11998 - uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
11999 - if ( !xInfo.is() )
12001 - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
12002 - if ( xPropSet.is() )
12003 - xInfo = xPropSet->getPropertySetInfo();
12008 -void TOOLKIT_DLLPUBLIC
12009 -setProperty( const uno::Reference< uno::XInterface > &xPeer,
12010 - const OUString &rName, uno::Any aValue )
12012 - uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
12013 - if ( xVclPeer.is() )
12014 - xVclPeer->setProperty( rName, aValue );
12017 - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
12018 - xPropSet->setPropertyValue( rName, aValue );
12022 -uno::Any TOOLKIT_DLLPUBLIC
12023 -getProperty( const uno::Reference< uno::XInterface > &xPeer,
12024 - const OUString &rName )
12026 - uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
12027 - if ( xVclPeer.is() )
12028 - return xVclPeer->getProperty( rName );
12030 - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
12031 - return xPropSet->getPropertyValue( rName );
12034 -} // namespace prophlp
12037 -/* Given a string and a type, it converts the string to the type, and returns
12038 - it encapsulated in Any. */
12039 -uno::Any anyFromString( OUString const& value, uno::Type const& type )
12041 - sal_Int16 radix = 10;
12042 - OUString intval = value;
12043 - if ( value.getLength() > 2 && value[0] == '0' && value[1] == 'x' )
12044 - intval = value.copy( 2 ), radix = 16;
12045 - else if ( value.getLength() > 1 && value[0] == '#' )
12046 - intval = value.copy( 1 ), radix = 16;
12047 - switch ( type.getTypeClass() )
12049 - case uno::TypeClass_CHAR:
12050 - return uno::makeAny( value.toChar() );
12051 - case uno::TypeClass_BOOLEAN:
12052 - if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) )
12053 - return uno::makeAny( true );
12054 - else if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) )
12055 - return uno::makeAny( false );
12056 - break; // ends switch, throws exception
12057 - case uno::TypeClass_BYTE:
12058 - return uno::makeAny( ( sal_uInt8 ) intval.toInt32( radix ) );
12059 - case uno::TypeClass_SHORT:
12060 - return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
12061 - case uno::TypeClass_UNSIGNED_SHORT:
12062 - return uno::makeAny( ( sal_uInt16 ) intval.toInt32( radix ) );
12063 - case uno::TypeClass_ENUM:
12064 - return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
12065 - case uno::TypeClass_LONG:
12066 - return uno::makeAny( ( sal_Int32 ) intval.toInt32( radix ) );
12067 - case uno::TypeClass_UNSIGNED_LONG:
12068 - return uno::makeAny( ( sal_uInt32 ) intval.toInt32( radix ) );
12069 - case uno::TypeClass_HYPER:
12070 - return uno::makeAny( ( sal_Int64 ) intval.toInt64( radix ) );
12071 - case uno::TypeClass_UNSIGNED_HYPER:
12072 - return uno::makeAny( ( sal_uInt16 ) intval.toInt64( radix ) );
12073 - case uno::TypeClass_FLOAT:
12074 - return uno::makeAny( value.toFloat() );
12075 - case uno::TypeClass_DOUBLE:
12076 - return uno::makeAny( value.toDouble() );
12077 - case uno::TypeClass_STRING:
12078 - return uno::makeAny( value );
12079 - case uno::TypeClass_CONSTANT:
12080 - return uno::makeAny( intval.toInt32( radix ) );
12081 - case uno::TypeClass_INTERFACE:
12082 - return uno::makeAny( loadGraphic( OUSTRING_CSTR( value ) ) );
12083 - case uno::TypeClass_SEQUENCE:
12086 - bool escaped = false, first = true;
12087 - OUString item, token;
12088 - std::list< OUString > values;
12091 - token = value.getToken( 0, ':', i );
12093 - if ( !token.getLength() && !escaped )
12096 - item += OUString( ':' );
12098 - else if ( escaped )
12106 - values.push_back( item );
12111 - while ( i >= 0 );
12112 - if ( item.getLength() )
12113 - values.push_back( item );
12115 - uno::Sequence< OUString > seq( values.size() );
12117 - for ( std::list< OUString >::const_iterator it = values.begin();
12118 - it != values.end(); it++, i++ )
12121 - return uno::makeAny( seq );
12125 - DBG_ERROR1( "ERROR: unknown property type of value: `%s'\n", OUSTRING_CSTR( value ) );
12128 - throw uno::RuntimeException();
12131 -/* Converts the XML naming scheme to UNO's, for legacy compatibility
12132 - (so, ergo, "one-two-three-four" -> "OneTwoThreeFour"). */
12133 -static OUString toUnoNaming ( OUString const &string )
12135 - OUStringBuffer buffer( string.getLength() );
12136 - sal_Unicode *str = string.pData->buffer;
12137 - bool capitalize = true;
12139 - for ( int i = 0; i < string.getLength(); i++ )
12141 - if ( i == 0 && str[0] == '_' )
12142 - /* Skip translate-me prefix. */
12144 - if ( str[i] == '-' )
12145 - capitalize = true;
12148 - if ( capitalize && str[i] >= 'a' && str[i] <= 'z' )
12149 - buffer.append( (sal_Unicode ) ( str[i] - 'a' + 'A' ) );
12151 - buffer.append( (sal_Unicode ) str[i] );
12152 - capitalize = false;
12156 - return buffer.makeStringAndClear();
12160 - * convert incoming XML style property names, to AWT style property names.
12161 - * convert the values based on introspection information.
12162 - * apply to either an XPropertySet or an XPropertySetInfo | XVclWindowPeer
12166 -setProperties( uno::Reference< uno::XInterface > const& xPeer,
12167 - PropList const& rProps )
12169 - if ( !prophlp::canHandleProps( xPeer ) )
12171 - DBG_ERROR( "Error: setProperties - bad handle ignoring props:\n" );
12172 - for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
12175 - DBG_ERROR2( "%s=%s\n", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) );
12180 - for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
12182 - setProperty( xPeer, it->first, it->second );
12186 -setProperty( uno::Reference< uno::XInterface > const& xPeer,
12187 - OUString const& attr, OUString const& value )
12189 - OUString unoAttr = toUnoNaming( attr );
12191 - OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) );
12192 - // get a Property object
12193 - beans::Property prop;
12196 - uno::Reference< beans::XPropertySetInfo > xInfo
12197 - = prophlp::queryPropertyInfo( xPeer );
12198 - prop = xInfo->getPropertyByName( unoAttr );
12200 - catch( beans::UnknownPropertyException & )
12202 - DBG_ERROR1( "Warning: unknown attribute: `%s'\n", OUSTRING_CSTR( unoAttr ) );
12206 - if ( prop.Name.getLength() <= 0 )
12208 - DBG_ERROR1( "Warning: missing prop: `%s'\n", OUSTRING_CSTR( unoAttr ) );
12212 - // encapsulates value in an uno::Any
12216 - any = anyFromString( value, prop.Type );
12218 - catch( uno::RuntimeException & )
12220 - DBG_ERROR5( "Warning: %s( %s )( %s ) attribute is of type %s( rejected: %s )\n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ), OUSTRING_CSTR( prop.Name ), OUSTRING_CSTR( prop.Type.getTypeName() ), OUSTRING_CSTR( value ) );
12224 - // sets value on property
12227 - prophlp::setProperty( xPeer, unoAttr, any );
12231 - DBG_ERROR2( "Warning: cannot set attribute %s to %s \n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ) );
12238 -struct AttributesMap
12240 - const char *name;
12244 -static const AttributesMap attribsMap[] =
12246 - { "autohscroll", awt::VclWindowPeerAttribute::AUTOHSCROLL, false },
12247 - { "autovscroll", awt::VclWindowPeerAttribute::AUTOVSCROLL, false },
12248 - { "center", awt::VclWindowPeerAttribute::CENTER, false },
12249 - { "clipchildren", awt::VclWindowPeerAttribute::CLIPCHILDREN, false },
12250 - { "closeable", awt::WindowAttribute::CLOSEABLE, true },
12251 - { "defbutton", awt::VclWindowPeerAttribute::DEFBUTTON, false },
12252 - { "dropdown", awt::VclWindowPeerAttribute::DROPDOWN, false },
12253 - { "fullsize", awt::WindowAttribute::FULLSIZE, true }, //FIXME?
12254 - { "group", awt::VclWindowPeerAttribute::GROUP, false },
12255 - { "has_border", awt::WindowAttribute::BORDER, true },
12256 - { "hscroll", awt::VclWindowPeerAttribute::HSCROLL, false },
12257 - { "left", awt::VclWindowPeerAttribute::LEFT, false },
12258 - { "moveable", awt::WindowAttribute::MOVEABLE, true },
12259 - { "noborder", awt::VclWindowPeerAttribute::NOBORDER, false },
12260 - { "nolabel", awt::VclWindowPeerAttribute::NOLABEL, false },
12261 - { "optimumsize", awt::WindowAttribute::OPTIMUMSIZE, false },
12262 - { "readonly", awt::VclWindowPeerAttribute::READONLY, false },
12263 - { "right", awt::VclWindowPeerAttribute::RIGHT, false },
12264 - { "show", awt::WindowAttribute::SHOW, true },
12265 - { "sizeable", awt::WindowAttribute::SIZEABLE, true },
12266 - { "sort", awt::VclWindowPeerAttribute::SORT, false },
12267 - { "spin", awt::VclWindowPeerAttribute::SPIN, false },
12268 - { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false },
12270 - // cutting on OK, YES_NO_CANCEL and related obsite attributes...
12272 -static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap );
12275 -long getAttribute( const OUString &rName, bool bTopWindow )
12278 - int min = 0, max = attribsMapLen - 1, mid, cmp;
12281 - mid = min +( max - min )/2;
12282 - cmp = rName.compareToAscii( attribsMap[ mid ].name );
12285 - else if ( cmp < 0 )
12289 - if ( bTopWindow || attribsMap[ mid ].value )
12290 - return attribsMap[ mid ].windowAttr;
12294 - while ( min <= max );
12299 -void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes,
12300 - PropList &rProps, sal_Int32 nNamespace )
12302 - sal_Int32 nAttrs = xAttributes->getLength();
12303 - for ( sal_Int32 i = 0; i < nAttrs; i++ )
12305 - if ( nNamespace != xAttributes->getUidByIndex( i ) )
12308 - std::pair< OUString, OUString > aElem
12309 - ( xAttributes->getLocalNameByIndex( i ),
12310 - xAttributes->getValueByIndex( i ) );
12312 - if ( aElem.first.getLength() > 0 ) // namespace bits ..
12313 - rProps.push_back( aElem );
12318 -findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue )
12320 - PropList::iterator it;
12321 - OUString aName = OUString::createFromAscii( pAttr );
12323 - for ( it = rProps.begin(); it != rProps.end(); it++ )
12325 - if ( it->first.equalsIgnoreAsciiCase( aName ) )
12327 - rValue = it->second;
12328 - rProps.erase( it );
12332 - rValue = OUString();
12337 -getAttributeProps( PropList &rProps )
12342 - OUString trueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
12344 - if ( findAndRemove( "show", rProps, aValue ) &&
12345 - aValue.equalsIgnoreAsciiCase(
12346 - OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) )
12349 - nAttrs |= awt::WindowAttribute::SHOW;
12351 - for ( int i = 0; i < attribsMapLen; i++ )
12353 - if ( findAndRemove( attribsMap[i].name, rProps, aValue ) )
12355 - if ( aValue.equalsIgnoreAsciiCase( trueStr ) )
12356 - nAttrs |= attribsMap[i].value;
12360 - if ( findAndRemove( "align", rProps, aValue ) )
12362 - sal_Int32 nVal = aValue.toInt32();
12364 - if ( nVal == 0 /* PROPERTY_ALIGN_LEFT */ )
12365 - nAttrs |= awt::VclWindowPeerAttribute::LEFT;
12366 - else if ( nVal == 1 /* PROPERTY_ALIGN_CENTER */ )
12367 - nAttrs |= awt::VclWindowPeerAttribute::CENTER;
12368 - else if ( nVal == 2 )
12369 - nAttrs |= awt::VclWindowPeerAttribute::RIGHT;
12377 --- toolkit/source/layout/proplist.hxx.old 2009-04-06 16:42:11.000000000 +0000
12378 +++ toolkit/source/layout/proplist.hxx 1970-01-01 00:00:00.000000000 +0000
12380 -/*************************************************************************
12382 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12384 - * Copyright 2008 by Sun Microsystems, Inc.
12386 - * OpenOffice.org - a multi-platform office productivity suite
12388 - * $RCSfile: proplist.hxx,v $
12390 - * $Revision: 1.3 $
12392 - * This file is part of OpenOffice.org.
12394 - * OpenOffice.org is free software: you can redistribute it and/or modify
12395 - * it under the terms of the GNU Lesser General Public License version 3
12396 - * only, as published by the Free Software Foundation.
12398 - * OpenOffice.org is distributed in the hope that it will be useful,
12399 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12400 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12401 - * GNU Lesser General Public License version 3 for more details
12402 - * (a copy is included in the LICENSE file that accompanied this code).
12404 - * You should have received a copy of the GNU Lesser General Public License
12405 - * version 3 along with OpenOffice.org. If not, see
12406 - * <http://www.openoffice.org/license.html>
12407 - * for a copy of the LGPLv3 License.
12409 - ************************************************************************/
12411 -#ifndef CORE_PROPLIST_HXX
12412 -#define CORE_PROPLIST_HXX
12415 -#include <com/sun/star/xml/input/XAttributes.hpp>
12417 -#include <rtl/ustring.hxx>
12419 -namespace layoutimpl
12422 -namespace css = ::com::sun::star;
12424 -typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList;
12426 -void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes,
12427 - PropList &rProps, sal_Int32 nNamespace );
12429 -void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer,
12430 - PropList const& rProps);
12432 -void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer,
12433 - rtl::OUString const& attr, rtl::OUString const& value );
12435 -long getAttributeProps( PropList &rProps );
12436 -bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue);
12440 -#if !OUSTRING_CSTR_PARANOIA
12441 -#define OUSTRING_CSTR( str ) \
12442 - rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
12445 -inline char const* OUSTRING_CSTR( rtl::OUString const& str )
12447 - rtl::OString *leak
12448 - = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US));
12449 - return leak->getStr();
12454 -#endif // CORE_PROPLIST_HXX
12455 --- toolkit/source/layout/root.cxx.old 2009-04-06 16:42:11.000000000 +0000
12456 +++ toolkit/source/layout/root.cxx 1970-01-01 00:00:00.000000000 +0000
12458 -/*************************************************************************
12460 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12462 - * Copyright 2008 by Sun Microsystems, Inc.
12464 - * OpenOffice.org - a multi-platform office productivity suite
12466 - * $RCSfile: root.cxx,v $
12468 - * $Revision: 1.3 $
12470 - * This file is part of OpenOffice.org.
12472 - * OpenOffice.org is free software: you can redistribute it and/or modify
12473 - * it under the terms of the GNU Lesser General Public License version 3
12474 - * only, as published by the Free Software Foundation.
12476 - * OpenOffice.org is distributed in the hope that it will be useful,
12477 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12478 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12479 - * GNU Lesser General Public License version 3 for more details
12480 - * (a copy is included in the LICENSE file that accompanied this code).
12482 - * You should have received a copy of the GNU Lesser General Public License
12483 - * version 3 along with OpenOffice.org. If not, see
12484 - * <http://www.openoffice.org/license.html>
12485 - * for a copy of the LGPLv3 License.
12487 - ************************************************************************/
12489 -#include "root.hxx"
12491 -#include <cassert>
12494 -#include <com/sun/star/awt/WindowAttribute.hpp>
12495 -#include <com/sun/star/awt/XMessageBox.hpp>
12496 -#include <com/sun/star/awt/MessageBoxButtons.hpp>
12497 -#include <com/sun/star/frame/XDesktop.hpp>
12498 -#include <com/sun/star/awt/XMessageBoxFactory.hpp>
12499 -#include <com/sun/star/xml/sax/SAXParseException.hpp>
12500 -#include <com/sun/star/xml/sax/XParser.hpp>
12502 -#include "helper.hxx"
12503 -#include "import.hxx"
12504 -#include "timer.hxx"
12505 -#include "translate.hxx"
12508 -namespace layoutimpl
12511 -using namespace css;
12512 -using ::rtl::OUString;
12514 -LayoutRoot::LayoutRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
12515 - : mbDisposed( sal_False )
12516 - , mxFactory( xFactory )
12517 - , mpListeners( NULL )
12518 - , mpToplevel( NULL )
12520 - if ( !xFactory.is() )
12521 - throw uno::RuntimeException();
12522 - mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() );
12525 -LayoutRoot::~LayoutRoot()
12527 -// TODO: we want to delete the top level LayoutWidget...
12528 - ::osl::MutexGuard aGuard( maMutex );
12529 - if ( !mbDisposed )
12533 - m_refCount++; // inhibit multiple destruction
12536 - catch( uno::Exception& )
12542 -void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactory, uno::Reference< awt::XToolkit > xToolkit, OUString const& aTitle, OUString const& aMessage )
12544 - uno::Reference< uno::XInterface > iDesktop = xFactory->createInstance
12545 - ( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
12546 - uno::Reference< frame::XDesktop > xDesktop ( iDesktop, uno::UNO_QUERY );
12547 - uno::Reference< frame::XFrame > xFrame ( xDesktop->getCurrentFrame() );
12548 - uno::Reference< awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
12549 - uno::Reference< awt::XWindowPeer > xWindowPeer( xContainerWindow, uno::UNO_QUERY_THROW );
12550 - uno::Reference< awt::XMessageBoxFactory > xMessageBoxFactory( xToolkit, uno::UNO_QUERY );
12552 - awt::Rectangle aRectangle;
12553 - uno::Reference< awt::XMessageBox > xMessageBox
12554 - = xMessageBoxFactory->createMessageBox
12555 - ( xWindowPeer, aRectangle, OUString::createFromAscii( "errorbox" ),
12556 - awt::MessageBoxButtons::BUTTONS_OK, aTitle, aMessage );
12558 - if ( xMessageBox.is() )
12559 - xMessageBox->execute();
12560 - //FIXME: exceptions not caught and printed at top level??
12562 - //printf( "%s\n", OUSTRING_CSTR( aMessage ) );
12565 -void LayoutRoot::error( OUString const& message )
12567 - printf( "%s\n", OUSTRING_CSTR( message ) );
12568 - ShowMessageBox( mxFactory, mxToolkit,
12569 - OUString::createFromAscii( "Fatal error" ),
12571 - throw uno::RuntimeException( message, uno::Reference< uno::XInterface >() );
12574 -// XInitialization
12575 -void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArguments )
12576 - throw ( uno::Exception,
12577 - uno::RuntimeException )
12579 - ::osl::MutexGuard aGuard( maMutex );
12581 - if ( mbDisposed )
12582 - throw lang::DisposedException();
12584 - if ( mxContainer.is() ) // only 1 init ...
12585 - throw uno::Exception();
12587 - if ( !aArguments.getLength() )
12588 - throw lang::IllegalArgumentException();
12590 - OSL_ENSURE( aArguments.getLength() == 1, "Wrong arg count\n" );
12592 - OUString aXMLName;
12593 - if ( !( aArguments[0] >>= aXMLName ) )
12594 - throw lang::IllegalArgumentException();
12596 - uno::Reference< xml::sax::XParser > xParser
12597 - ( mxFactory->createInstance(
12598 - OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) ),
12599 - uno::UNO_QUERY );
12600 - OSL_ASSERT( xParser.is() );
12601 - if (! xParser.is() )
12603 - throw uno::RuntimeException(
12604 - OUString::createFromAscii( "cannot create sax-parser component" ),
12605 - uno::Reference< uno::XInterface >() );
12608 - // FIXME: quite possibly we want to pass this in ...
12609 - uno::Reference< awt::XToolkit > xToolkit;
12611 - mxToolkit = uno::Reference< awt::XToolkit >(
12612 - mxFactory->createInstance(
12613 - OUString::createFromAscii( "com.sun.star.awt.Toolkit" ) ),
12614 - uno::UNO_QUERY );
12616 - if ( !mxToolkit.is() )
12617 - throw uno::RuntimeException(
12618 - OUString::createFromAscii( "failed to create toolkit!" ),
12619 - uno::Reference< uno::XInterface >() );
12621 - OUString aXMLFile = readRightTranslation( aXMLName );
12622 - uno::Reference< io::XInputStream > xStream = getFileAsStream( aXMLFile );
12623 - if (! xStream.is() )
12624 - error( OUString::createFromAscii( "Installation problem: cannot find XML file:" ) + aXMLName );
12626 - // error handler, entity resolver omitted
12628 - ImportContext *pCtx = new ImportContext( *this );
12630 - uno::Reference< xml::input::XRoot > xRoot( pCtx );
12631 - uno::Sequence < uno::Any > aArgs( 1 );
12632 - aArgs[0] <<= xRoot;
12633 - uno::Reference< xml::sax::XDocumentHandler > xDocHandler
12634 - (mxFactory->createInstanceWithArguments
12635 - ( OUString::createFromAscii( "com.sun.star.xml.input.SaxDocumentHandler" ),
12636 - aArgs ), uno::UNO_QUERY );
12638 - if (! xDocHandler.is() )
12639 - error( OUString::createFromAscii( "cannot find SAx handler for document type of:") + aXMLName );
12641 - xParser->setDocumentHandler( xDocHandler );
12643 - xml::sax::InputSource source;
12644 - source.aInputStream = xStream;
12645 - source.sSystemId = OUString::createFromAscii( "virtual file" );
12649 - xParser->parseStream( source );
12651 - catch ( xml::sax::SAXParseException& e )
12653 - OUString c = OUString::createFromAscii( ":" );
12655 - + c + OUString::valueOf( e.LineNumber )
12656 - + c + OUString::valueOf( e.ColumnNumber )
12657 - + c + OUString::createFromAscii( "Sax parse error" ) );
12661 -// XLayoutContainer
12662 -uno::Reference< awt::XLayoutContainer > LayoutRoot::getLayoutContainer() throw (uno::RuntimeException)
12664 - return uno::Reference< awt::XLayoutContainer >();
12667 -// local helper ...
12668 -void LayoutRoot::addItem( const OUString &rName,
12669 - const uno::Reference< awt::XLayoutConstrains > &xRef )
12671 - maItems[ rName ] = xRef;
12675 -uno::Any SAL_CALL LayoutRoot::getByName( const OUString &rName )
12676 - throw ( container::NoSuchElementException,
12677 - lang::WrappedTargetException,
12678 - uno::RuntimeException )
12680 - ::osl::MutexGuard aGuard( maMutex );
12681 - if ( mbDisposed )
12682 - throw lang::DisposedException();
12684 - uno::Reference< awt::XLayoutConstrains > xItem;
12685 - ItemHash::iterator i = maItems.find( rName );
12686 - if ( i != maItems.end() )
12687 - xItem = i->second;
12688 - return uno::makeAny( xItem );
12691 -sal_Bool SAL_CALL LayoutRoot::hasByName( const OUString &rName )
12692 - throw (uno::RuntimeException)
12694 - ::osl::MutexGuard aGuard( maMutex );
12695 - if ( mbDisposed ) throw lang::DisposedException();
12697 - ItemHash::iterator i = maItems.find( rName );
12698 - return i != maItems.end();
12701 -uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames()
12702 - throw ( uno::RuntimeException )
12704 - ::osl::MutexGuard aGuard( maMutex );
12705 - if ( mbDisposed ) throw lang::DisposedException();
12707 - uno::Sequence< OUString > aNames( maItems.size() );
12708 - sal_Int32 nPos = 0;
12710 - for ( ItemHash::const_iterator i = maItems.begin();
12711 - i != maItems.end(); i++ )
12712 - aNames[ nPos++ ] = i->first;
12717 -uno::Type SAL_CALL LayoutRoot::getElementType()
12718 - throw ( uno::RuntimeException )
12720 - return getCppuType( ( const uno::Reference< awt::XLayoutConstrains >* )NULL );
12723 -sal_Bool SAL_CALL LayoutRoot::hasElements()
12724 - throw ( uno::RuntimeException )
12726 - ::osl::MutexGuard aGuard( maMutex );
12728 - if ( mbDisposed ) throw lang::DisposedException();
12730 - return maItems.size() > 0;
12734 -void SAL_CALL LayoutRoot::dispose()
12735 - throw ( uno::RuntimeException )
12737 - ::osl::MutexGuard aGuard( maMutex );
12739 - if ( mbDisposed ) throw lang::DisposedException();
12741 - if ( mpListeners )
12744 - lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
12745 - mpListeners->disposeAndClear( aSource );
12746 - delete mpListeners;
12747 - mpListeners = NULL;
12751 - mbDisposed = sal_True;
12754 -void SAL_CALL LayoutRoot::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
12755 - throw ( uno::RuntimeException )
12757 - ::osl::MutexGuard aGuard( maMutex );
12759 - if ( mbDisposed ) throw lang::DisposedException();
12761 - if ( !mpListeners )
12762 - mpListeners = new ::cppu::OInterfaceContainerHelper( maMutex );
12763 - mpListeners->addInterface( xListener );
12766 -void SAL_CALL LayoutRoot::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
12767 - throw ( uno::RuntimeException )
12769 - ::osl::MutexGuard aGuard( maMutex );
12771 - if ( mbDisposed ) throw lang::DisposedException();
12773 - if ( mpListeners )
12774 - mpListeners->removeInterface( xListener );
12779 -LayoutWidget *LayoutRoot::create( OUString id, const OUString unoName, long attrbs,uno::Reference< awt::XLayoutContainer > xParent )
12781 - LayoutWidget *pWidget = new LayoutWidget( mxToolkit, xParent, unoName, attrbs );
12782 - if ( !mpToplevel )
12784 - mpToplevel = pWidget;
12785 - mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
12786 - mxContainer = pWidget->mxContainer;
12788 - if ( pWidget->mxContainer.is() )
12789 - pWidget->mxContainer->setLayoutUnit( mxLayoutUnit );
12790 - if ( id.getLength() )
12791 - maItems[ id ] = pWidget->getPeer();
12796 -uno::Reference< awt::XLayoutConstrains > LayoutRoot::getToplevel()
12798 - if ( mpToplevel )
12799 - return mpToplevel->getPeer();
12800 - return uno::Reference< awt::XLayoutConstrains > ();
12803 -uno::Reference< awt::XLayoutConstrains > LayoutRoot::getById( OUString id )
12805 - uno::Reference< awt::XLayoutConstrains > rRef = 0;
12806 - ItemHash::iterator i = maItems.find( id );
12807 - if ( i != maItems.end() )
12808 - rRef = i->second;
12813 -LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit,
12814 - uno::Reference< awt::XLayoutContainer > xParent,
12815 - OUString unoName, long attrbs )
12817 - while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
12819 - uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
12820 - assert( xContainer.is() );
12821 - xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
12824 - mxWidget = createWidget( xToolkit, xParent, unoName, attrbs );
12825 - assert( mxWidget.is() );
12826 - mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
12829 -LayoutWidget::~LayoutWidget()
12831 - /* should we dispose of the references...? */
12832 - // at least of its children... Or should root?
12835 -bool LayoutWidget::addChild( LayoutWidget *pChild )
12837 - if ( !mxContainer.is() )
12842 - mxContainer->addChild( pChild->mxWidget );
12844 - catch( awt::MaxChildrenException ex )
12851 -void LayoutWidget::setProperties( PropList const& rProps )
12853 - ::layoutimpl::setProperties( mxWidget, rProps );
12856 -void LayoutWidget::setProperty( OUString const& attr, OUString const& value )
12858 - ::layoutimpl::setProperty( mxWidget, attr, value );
12861 -void LayoutWidget::setChildProperties( LayoutWidget *pChild,
12862 - PropList const& rProps )
12864 - uno::Reference< beans::XPropertySet > xChildPeer;
12865 - xChildPeer = mxContainer->getChildProperties( pChild->mxWidget );
12867 - if ( xChildPeer.is() )
12868 - ::layoutimpl::setProperties( xChildPeer, rProps );
12871 -} // namespace layoutimpl
12873 --- toolkit/source/layout/root.hxx.old 2009-04-06 16:42:11.000000000 +0000
12874 +++ toolkit/source/layout/root.hxx 1970-01-01 00:00:00.000000000 +0000
12876 -/*************************************************************************
12878 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12880 - * Copyright 2008 by Sun Microsystems, Inc.
12882 - * OpenOffice.org - a multi-platform office productivity suite
12884 - * $RCSfile: root.hxx,v $
12886 - * $Revision: 1.3 $
12888 - * This file is part of OpenOffice.org.
12890 - * OpenOffice.org is free software: you can redistribute it and/or modify
12891 - * it under the terms of the GNU Lesser General Public License version 3
12892 - * only, as published by the Free Software Foundation.
12894 - * OpenOffice.org is distributed in the hope that it will be useful,
12895 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12896 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12897 - * GNU Lesser General Public License version 3 for more details
12898 - * (a copy is included in the LICENSE file that accompanied this code).
12900 - * You should have received a copy of the GNU Lesser General Public License
12901 - * version 3 along with OpenOffice.org. If not, see
12902 - * <http://www.openoffice.org/license.html>
12903 - * for a copy of the LGPLv3 License.
12905 - ************************************************************************/
12907 -#ifndef CORE_ROOT_HXX
12908 -#define CORE_ROOT_HXX
12910 -#define _BACKWARD_BACKWARD_WARNING_H 1
12911 -#include <hash_map>
12913 -#include <com/sun/star/awt/XLayoutRoot.hpp>
12914 -#include <com/sun/star/awt/XToolkit.hpp>
12915 -#include <com/sun/star/awt/XWindow.hpp>
12916 -#include <com/sun/star/io/XInputStream.hpp>
12917 -#include <com/sun/star/lang/XComponent.hpp>
12918 -#include <com/sun/star/lang/XInitialization.hpp>
12919 -#include <cppuhelper/implbase3.hxx>
12920 -#include <cppuhelper/interfacecontainer.h>
12921 -#include <toolkit/dllapi.h>
12923 -#include "proplist.hxx"
12925 -namespace layoutimpl
12928 -namespace css = ::com::sun::star;
12930 -css::uno::Reference< css::io::XInputStream > getFileAsStream( const rtl::OUString &rName );
12932 -/* Interface generation code -- to hook to a parser. */
12935 - TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget
12936 - proxy interface (just make it return the root widget). Would even make it easier
12937 - if there was interest to support multiple toplevel widgets in the same file.
12939 - We also need to make sure the code gets diposed well... There is no need to keep
12940 - these objects around after initialization...
12944 -class LayoutWidget;
12946 -class TOOLKIT_DLLPUBLIC LayoutRoot : public ::cppu::WeakImplHelper3<
12947 - css::awt::XLayoutRoot,
12948 - css::lang::XInitialization,
12949 - css::lang::XComponent>
12952 - ::osl::Mutex maMutex;
12954 - typedef std::hash_map< rtl::OUString,
12955 - css::uno::Reference< css::awt::XLayoutConstrains >,
12956 - ::rtl::OUStringHash > ItemHash;
12957 - ItemHash maItems;
12959 - sal_Bool mbDisposed;
12960 - css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
12961 - ::cppu::OInterfaceContainerHelper *mpListeners;
12963 - css::uno::Reference< css::awt::XWindow > mxWindow;
12964 - css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
12966 - css::uno::Reference< css::awt::XToolkit > mxToolkit;
12967 - LayoutWidget *mpToplevel;
12968 - css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
12970 - void error( rtl::OUString const& message );
12973 - LayoutRoot( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
12974 - virtual ~LayoutRoot();
12976 - void addItem( const rtl::OUString &rName,
12977 - const css::uno::Reference< css::awt::XLayoutConstrains > &xRef );
12979 - void setWindow( css::uno::Reference< css::awt::XLayoutConstrains > xPeer )
12981 - mxWindow = css::uno::Reference< css::awt::XWindow >( xPeer, css::uno::UNO_QUERY );
12984 - // get XLayoutContainer
12985 - virtual css::uno::Reference< css::awt::XLayoutContainer > SAL_CALL getLayoutContainer() throw (css::uno::RuntimeException);
12987 - // XInitialization
12988 - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
12991 - virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
12992 - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException);
12993 - virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
12994 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
12995 - virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
12998 - virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
12999 - virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException);
13000 - virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
13003 - virtual LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs, css::uno::Reference< css::awt::XLayoutContainer > xParent );
13006 -class TOOLKIT_DLLPUBLIC LayoutWidget
13008 - friend class LayoutRoot;
13011 - LayoutWidget() {}
13012 - LayoutWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
13013 - css::uno::Reference< css::awt::XLayoutContainer > xToplevel,
13014 - rtl::OUString unoName, long attrbs );
13015 - virtual ~LayoutWidget();
13017 - virtual void setProperties( const PropList &rProps );
13018 - virtual void setProperty( rtl::OUString const& attr, rtl::OUString const& value );
13020 - virtual bool addChild( LayoutWidget *pChild );
13021 - virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps );
13023 - inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
13024 - { return mxWidget; }
13025 - inline css::uno::Reference< css::awt::XLayoutContainer > getContainer()
13026 - { return mxContainer; }
13029 - css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
13030 - css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
13033 -} // namespace layoutimpl
13035 -#endif // CORE_ROOT_HXX
13036 --- toolkit/source/layout/table.cxx.old 2009-04-02 10:49:36.000000000 +0000
13037 +++ toolkit/source/layout/table.cxx 1970-01-01 00:00:00.000000000 +0000
13039 -/*************************************************************************
13041 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13043 - * Copyright 2008 by Sun Microsystems, Inc.
13045 - * OpenOffice.org - a multi-platform office productivity suite
13047 - * $RCSfile: table.cxx,v $
13049 - * $Revision: 1.3 $
13051 - * This file is part of OpenOffice.org.
13053 - * OpenOffice.org is free software: you can redistribute it and/or modify
13054 - * it under the terms of the GNU Lesser General Public License version 3
13055 - * only, as published by the Free Software Foundation.
13057 - * OpenOffice.org is distributed in the hope that it will be useful,
13058 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13059 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13060 - * GNU Lesser General Public License version 3 for more details
13061 - * (a copy is included in the LICENSE file that accompanied this code).
13063 - * You should have received a copy of the GNU Lesser General Public License
13064 - * version 3 along with OpenOffice.org. If not, see
13065 - * <http://www.openoffice.org/license.html>
13066 - * for a copy of the LGPLv3 License.
13068 - ************************************************************************/
13070 -#include <table.hxx>
13072 -#include <sal/macros.h>
13073 -#include <osl/mutex.hxx>
13074 -#include <cppuhelper/propshlp.hxx>
13075 -#include <cppuhelper/interfacecontainer.h>
13076 -#include <com/sun/star/awt/PosSize.hpp>
13077 -#include <tools/debug.hxx>
13079 -// fixed point precision for distributing error
13080 -#define FIXED_PT 16
13082 -namespace layoutimpl
13085 -using namespace com::sun::star;
13087 -Table::ChildProps::ChildProps( Table::ChildData *pData )
13089 - addProp( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ),
13090 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
13091 - &( pData->mbExpand[ 0 ] ) );
13092 - addProp( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ),
13093 - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
13094 - &( pData->mbExpand[ 1 ] ) );
13095 - addProp( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ),
13096 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
13097 - &( pData->mnColSpan ) );
13098 - addProp( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ),
13099 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
13100 - &( pData->mnRowSpan ) );
13103 -bool Table::ChildData::isVisible()
13105 - return Box_Base::ChildData::isVisible()
13106 - && ( mnColSpan > 0 ) && ( mnRowSpan > 0 );
13111 - , mnColsLen( 1 )// another default value could be 0xffff for infinite columns( = 1 row )
13113 - addProp( RTL_CONSTASCII_USTRINGPARAM( "Columns" ),
13114 - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
13118 -Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
13119 - : Box_Base::ChildData( xChild )
13120 -// , mbExpand( { 0, 1 } )
13124 - , mnRightCol( 0 )
13126 - , mnBottomRow( 0 )
13128 - mbExpand[ 0 ] = 0;
13129 - mbExpand[ 1 ] = 1;
13133 -Table::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
13135 - return new ChildData( xChild );
13138 -Table::ChildProps*
13139 -Table::createChildProps( Box_Base::ChildData *pData )
13141 - return new ChildProps( static_cast<Table::ChildData*> ( pData ) );
13145 -Table::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
13146 - throw( uno::RuntimeException, awt::MaxChildrenException )
13148 - if ( xChild.is() )
13150 - Box_Base::addChild( xChild );
13151 - // cause of flicker
13152 - allocateChildAt( xChild, awt::Rectangle( 0,0,0,0 ) );
13156 -awt::Size SAL_CALL
13157 -Table::getMinimumSize() throw( uno::RuntimeException )
13159 - int nRowsLen = 0;
13161 - // 1. layout the table -- adjust to cope with row-spans...
13163 - // temporary 1D representation of the table
13164 - std::vector< ChildData *> aTable;
13168 - for ( std::list<Box_Base::ChildData *>::iterator it
13169 - = maChildren.begin(); it != maChildren.end(); it++ )
13171 - ChildData *child = static_cast<Table::ChildData*> ( *it );
13172 - if ( !child->isVisible() )
13175 - while ( col + SAL_MIN( child->mnColSpan, mnColsLen ) > mnColsLen )
13180 - unsigned int i = col + ( row*mnColsLen );
13181 - while ( aTable.size() > i && !aTable[ i ] )
13184 - col = i % mnColsLen;
13185 - row = i / mnColsLen;
13188 - child->mnLeftCol = col;
13189 - child->mnRightCol = SAL_MIN( col + child->mnColSpan, mnColsLen );
13190 - child->mnTopRow = row;
13191 - child->mnBottomRow = row + child->mnRowSpan;
13193 - col += child->mnColSpan;
13195 - unsigned int start = child->mnLeftCol +( child->mnTopRow*mnColsLen );
13196 - unsigned int end =( child->mnRightCol-1 ) +( ( child->mnBottomRow-1 )*mnColsLen );
13197 - if ( aTable.size() < end+1 )
13198 - aTable.resize( end+1, NULL );
13199 - for ( unsigned int i = start; i < end; i++ )
13200 - aTable[ i ] = child;
13202 - nRowsLen = SAL_MAX( nRowsLen, child->mnBottomRow );
13206 - // 2. calculate columns/rows sizes
13207 - for ( int g = 0; g < 2; g++ )
13209 - std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
13212 - aGroup.resize( g == 0 ? mnColsLen : nRowsLen );
13214 - // 2.1 base sizes on one-column/row children
13215 - for ( std::list<Box_Base::ChildData *>::iterator it
13216 - = maChildren.begin(); it != maChildren.end(); it++ )
13218 - ChildData *child = static_cast<Table::ChildData*> ( *it );
13219 - if ( !child->isVisible() )
13221 - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
13222 - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
13224 - if ( nFirstAttach == nLastAttach-1 )
13226 - child->maRequisition = child->mxChild->getMinimumSize();
13227 - int attach = nFirstAttach;
13228 - int child_size = g == 0 ? child->maRequisition.Width
13229 - : child->maRequisition.Height;
13230 - aGroup[ attach ].mnSize = SAL_MAX( aGroup[ attach ].mnSize,
13232 - if ( child->mbExpand[ g ] )
13233 - aGroup[ attach ].mbExpand = true;
13237 - // 2.2 make sure multiple-columns/rows children fit
13238 - for ( std::list<Box_Base::ChildData *>::iterator it
13239 - = maChildren.begin(); it != maChildren.end(); it++ )
13241 - ChildData *child = static_cast<Table::ChildData*> ( *it );
13242 - if ( !child->isVisible() )
13244 - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
13245 - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
13247 - if ( nFirstAttach != nLastAttach-1 )
13249 - child->maRequisition = child->mxChild->getMinimumSize();
13251 - int expandables = 0;
13252 - for ( int i = nFirstAttach; i < nLastAttach; i++ )
13254 - size += aGroup[ i ].mnSize;
13255 - if ( aGroup[ i ].mbExpand )
13259 - int child_size = g == 0 ? child->maRequisition.Width
13260 - : child->maRequisition.Height;
13261 - int extra = child_size - size;
13264 - if ( expandables )
13265 - extra /= expandables;
13267 - extra /= nLastAttach - nFirstAttach;
13269 - for ( int i = nFirstAttach; i < nLastAttach; i++ )
13270 - if ( expandables == 0 || aGroup[ i ].mbExpand )
13271 - aGroup[ i ].mnSize += extra;
13277 - // 3. Sum everything up
13278 - mnColExpandables =( mnRowExpandables = 0 );
13279 - maRequisition.Width =( maRequisition.Height = 0 );
13280 - for ( std::vector<GroupData>::iterator it = maCols.begin();
13281 - it != maCols.end(); it++ )
13283 - maRequisition.Width += it->mnSize;
13284 - if ( it->mbExpand )
13285 - mnColExpandables++;
13287 - for ( std::vector<GroupData>::iterator it = maRows.begin();
13288 - it != maRows.end(); it++ )
13290 - maRequisition.Height += it->mnSize;
13291 - if ( it->mbExpand )
13292 - mnRowExpandables++;
13295 - return maRequisition;
13299 -Table::allocateArea( const awt::Rectangle &rArea )
13300 - throw( uno::RuntimeException )
13302 - maAllocation = rArea;
13303 - if ( maCols.size() == 0 || maRows.size() == 0 )
13306 - int nExtraSize[ 2 ] = { SAL_MAX( rArea.Width - maRequisition.Width, 0 ),
13307 - SAL_MAX( rArea.Height - maRequisition.Height, 0 ) };
13309 - nExtraSize[ 0 ] /= mnColExpandables ? mnColExpandables : mnColsLen;
13310 - nExtraSize[ 1 ] /= mnRowExpandables ? mnRowExpandables : maRows.size();
13312 - for ( std::list<Box_Base::ChildData *>::const_iterator it
13313 - = maChildren.begin(); it != maChildren.end(); it++ )
13315 - ChildData *child = static_cast<Table::ChildData*> ( *it );
13316 - if ( !child->isVisible() )
13319 - awt::Rectangle rChildArea( rArea.X, rArea.Y, 0, 0 );
13321 - for ( int g = 0; g < 2; g++ )
13323 - std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
13324 - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
13325 - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
13327 - for ( int i = 0; i < nFirstAttach; i++ )
13329 - int gSize = aGroup[ i ].mnSize;
13330 - if ( aGroup[ i ].mbExpand )
13331 - gSize += nExtraSize[ g ];
13333 - rChildArea.X += gSize;
13335 - rChildArea.Y += gSize;
13337 - for ( int i = nFirstAttach; i < nLastAttach; i++ )
13339 - int gSize = aGroup[ i ].mnSize;
13340 - if ( aGroup[ i ].mbExpand )
13341 - gSize += nExtraSize[ g ];
13343 - rChildArea.Width += gSize;
13345 - rChildArea.Height += gSize;
13349 - allocateChildAt( child->mxChild, rChildArea );
13353 -} // namespace layoutimpl
13354 --- toolkit/source/layout/table.hxx.old 2009-04-02 10:49:36.000000000 +0000
13355 +++ toolkit/source/layout/table.hxx 1970-01-01 00:00:00.000000000 +0000
13357 -/*************************************************************************
13359 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13361 - * Copyright 2008 by Sun Microsystems, Inc.
13363 - * OpenOffice.org - a multi-platform office productivity suite
13365 - * $RCSfile: table.hxx,v $
13367 - * $Revision: 1.3 $
13369 - * This file is part of OpenOffice.org.
13371 - * OpenOffice.org is free software: you can redistribute it and/or modify
13372 - * it under the terms of the GNU Lesser General Public License version 3
13373 - * only, as published by the Free Software Foundation.
13375 - * OpenOffice.org is distributed in the hope that it will be useful,
13376 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13377 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13378 - * GNU Lesser General Public License version 3 for more details
13379 - * (a copy is included in the LICENSE file that accompanied this code).
13381 - * You should have received a copy of the GNU Lesser General Public License
13382 - * version 3 along with OpenOffice.org. If not, see
13383 - * <http://www.openoffice.org/license.html>
13384 - * for a copy of the LGPLv3 License.
13386 - ************************************************************************/
13391 -#include "box-base.hxx"
13393 -namespace layoutimpl
13396 -class Table : public Box_Base
13399 - // Children properties
13400 - struct ChildData : public Box_Base::ChildData
13402 - sal_Bool mbExpand[ 2 ];
13403 - sal_Int32 mnColSpan;
13404 - sal_Int32 mnRowSpan;
13410 - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
13411 - bool isVisible();
13414 - struct ChildProps : public Box_Base::ChildProps
13416 - ChildProps( ChildData *pData );
13421 - // a group of children; either a column or a row
13424 - sal_Bool mbExpand;
13425 - int mnSize; // request size (width or height)
13426 - GroupData() : mbExpand( false ), mnSize( 0 ) {}
13429 - // Table properties
13430 - sal_Int32 mnColsLen;
13431 - std::vector< GroupData > maCols;
13432 - std::vector< GroupData > maRows;
13433 - int mnColExpandables, mnRowExpandables;
13435 - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
13436 - ChildProps *createChildProps( Box_Base::ChildData* pData );
13441 - // css::awt::XLayoutContainer
13442 - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
13443 - throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
13445 - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
13446 - throw (css::uno::RuntimeException);
13448 - virtual css::awt::Size SAL_CALL getMinimumSize()
13449 - throw(css::uno::RuntimeException);
13451 - // unimplemented:
13452 - virtual sal_Bool SAL_CALL hasHeightForWidth()
13453 - throw(css::uno::RuntimeException)
13454 - { return false; }
13455 - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
13456 - throw(css::uno::RuntimeException)
13457 - { return maRequisition.Height; }
13459 - PROPHELPER_SET_INFO
13462 -} // namespace layoutimpl
13464 -#endif /*TABLE_HXX*/
13465 --- toolkit/source/layout/timer.cxx.old 2009-04-02 10:49:36.000000000 +0000
13466 +++ toolkit/source/layout/timer.cxx 1970-01-01 00:00:00.000000000 +0000
13468 -/*************************************************************************
13470 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13472 - * Copyright 2008 by Sun Microsystems, Inc.
13474 - * OpenOffice.org - a multi-platform office productivity suite
13476 - * $RCSfile: timer.cxx,v $
13478 - * $Revision: 1.3 $
13480 - * This file is part of OpenOffice.org.
13482 - * OpenOffice.org is free software: you can redistribute it and/or modify
13483 - * it under the terms of the GNU Lesser General Public License version 3
13484 - * only, as published by the Free Software Foundation.
13486 - * OpenOffice.org is distributed in the hope that it will be useful,
13487 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13488 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13489 - * GNU Lesser General Public License version 3 for more details
13490 - * (a copy is included in the LICENSE file that accompanied this code).
13492 - * You should have received a copy of the GNU Lesser General Public License
13493 - * version 3 along with OpenOffice.org. If not, see
13494 - * <http://www.openoffice.org/license.html>
13495 - * for a copy of the LGPLv3 License.
13497 - ************************************************************************/
13499 -#include "timer.hxx"
13503 -#include <vcl/timer.hxx>
13504 -#include <com/sun/star/awt/XLayoutContainer.hpp>
13506 -namespace layoutimpl
13508 -using namespace ::com::sun::star;
13510 -class AllocateTimer : public Timer
13512 - typedef std::list< uno::Reference< awt::XLayoutContainer > > ContainerList;
13513 - ContainerList mxContainers;
13514 - uno::Reference< awt::XLayoutContainer > mxLastAdded;
13519 - // timer set to 0 -- just process it as soon as it gets idle
13523 - static inline bool isParentOf( uno::Reference< awt::XLayoutContainer > xParent,
13524 - uno::Reference< awt::XLayoutContainer > xWidget )
13526 - while ( xWidget.is() )
13528 - if ( xWidget == xParent )
13530 - xWidget = uno::Reference< awt::XLayoutContainer >( xWidget->getParent(), uno::UNO_QUERY );
13535 - static inline void eraseChildren( ContainerList::iterator &it, ContainerList &list )
13537 - ContainerList::iterator jt = list.begin();
13538 - while ( jt != list.end() )
13540 - if ( it != jt && isParentOf( *it, *jt ) )
13541 - jt = list.erase( jt );
13547 - static inline bool isContainerDamaged( uno::Reference< awt::XLayoutContainer > xContainer )
13549 - uno::Reference< awt::XLayoutConstrains > xConstrains( xContainer, uno::UNO_QUERY );
13550 - awt::Size lastReq( xContainer->getRequestedSize() );
13551 - awt::Size curReq( xConstrains->getMinimumSize() );
13552 - return lastReq.Width != curReq.Width || lastReq.Height != curReq.Height;
13555 - void add( const uno::Reference< awt::XLayoutContainer > &xContainer )
13557 - // small optimization
13558 - if ( mxLastAdded == xContainer )
13560 - mxLastAdded = xContainer;
13562 - mxContainers.push_back( xContainer );
13565 - virtual void Timeout()
13567 - mxLastAdded = uno::Reference< awt::XLayoutContainer >();
13569 - // 1. remove duplications and children
13570 - for ( ContainerList::iterator it = mxContainers.begin();
13571 - it != mxContainers.end(); it++ )
13572 - eraseChildren( it, mxContainers );
13574 - // 2. check damage extent
13575 - for ( ContainerList::iterator it = mxContainers.begin();
13576 - it != mxContainers.end(); it++ )
13578 - uno::Reference< awt::XLayoutContainer > xContainer = *it;
13579 - while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) )
13581 - xContainer = uno::Reference< awt::XLayoutContainer >(
13582 - xContainer->getParent(), uno::UNO_QUERY );
13585 - if ( *it != xContainer )
13587 - // 2.2 replace it with parent
13588 - *it = xContainer;
13590 - // 2.3 remove children of new parent
13591 - eraseChildren( it, mxContainers );
13595 - // 3. force re-calculations
13596 - for( ContainerList::iterator it = mxContainers.begin();
13597 - it != mxContainers.end(); it++ )
13598 - (*it)->allocateArea( (*it)->getAllocatedArea() );
13602 -static void AddResizeTimeout( const uno::Reference< awt::XLayoutContainer > &xCont )
13604 - static AllocateTimer timer;
13605 - timer.add( xCont );
13609 -LayoutUnit::LayoutUnit() : LayoutUnit_Base()
13613 -void SAL_CALL LayoutUnit::queueResize( const uno::Reference< awt::XLayoutContainer > &xContainer )
13614 - throw( uno::RuntimeException )
13616 - AddResizeTimeout( xContainer );
13620 --- toolkit/source/layout/timer.hxx.old 2009-04-02 10:49:36.000000000 +0000
13621 +++ toolkit/source/layout/timer.hxx 1970-01-01 00:00:00.000000000 +0000
13623 -/*************************************************************************
13625 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13627 - * Copyright 2008 by Sun Microsystems, Inc.
13629 - * OpenOffice.org - a multi-platform office productivity suite
13631 - * $RCSfile: timer.hxx,v $
13633 - * $Revision: 1.3 $
13635 - * This file is part of OpenOffice.org.
13637 - * OpenOffice.org is free software: you can redistribute it and/or modify
13638 - * it under the terms of the GNU Lesser General Public License version 3
13639 - * only, as published by the Free Software Foundation.
13641 - * OpenOffice.org is distributed in the hope that it will be useful,
13642 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13643 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13644 - * GNU Lesser General Public License version 3 for more details
13645 - * (a copy is included in the LICENSE file that accompanied this code).
13647 - * You should have received a copy of the GNU Lesser General Public License
13648 - * version 3 along with OpenOffice.org. If not, see
13649 - * <http://www.openoffice.org/license.html>
13650 - * for a copy of the LGPLv3 License.
13652 - ************************************************************************/
13654 -#ifndef CORE_TIMER_HXX
13655 -#define CORE_TIMER_HXX
13657 -#include <com/sun/star/awt/XLayoutUnit.hpp>
13658 -#include <cppuhelper/implbase1.hxx>
13660 -namespace layoutimpl
13663 -typedef ::cppu::WeakImplHelper1< com::sun::star::awt::XLayoutUnit > LayoutUnit_Base;
13665 -class LayoutUnit : public LayoutUnit_Base
13669 - void SAL_CALL queueResize( const com::sun::star::uno::Reference< com::sun::star::awt::XLayoutContainer > &xContainer )
13670 - throw( com::sun::star::uno::RuntimeException );
13675 -#endif /*CORE_TIMER_HXX*/
13676 --- toolkit/source/layout/translate.cxx.old 2009-04-06 16:42:11.000000000 +0000
13677 +++ toolkit/source/layout/translate.cxx 1970-01-01 00:00:00.000000000 +0000
13679 -/*************************************************************************
13681 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13683 - * Copyright 2008 by Sun Microsystems, Inc.
13685 - * OpenOffice.org - a multi-platform office productivity suite
13687 - * $RCSfile: translate.cxx,v $
13689 - * $Revision: 1.4 $
13691 - * This file is part of OpenOffice.org.
13693 - * OpenOffice.org is free software: you can redistribute it and/or modify
13694 - * it under the terms of the GNU Lesser General Public License version 3
13695 - * only, as published by the Free Software Foundation.
13697 - * OpenOffice.org is distributed in the hope that it will be useful,
13698 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13699 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13700 - * GNU Lesser General Public License version 3 for more details
13701 - * (a copy is included in the LICENSE file that accompanied this code).
13703 - * You should have received a copy of the GNU Lesser General Public License
13704 - * version 3 along with OpenOffice.org. If not, see
13705 - * <http://www.openoffice.org/license.html>
13706 - * for a copy of the LGPLv3 License.
13708 - ************************************************************************/
13710 -#include "translate.hxx"
13715 -#include "tools/getprocessworkingdir.hxx"
13718 -#include <unotools/bootstrap.hxx>
13719 -#include <unotools/localfilehelper.hxx>
13720 -#include <unotools/ucbhelper.hxx>
13721 -#include <vcl/svapp.hxx>
13723 -#include "proplist.hxx"
13725 -namespace layoutimpl
13727 -namespace css = ::com::sun::star;
13728 -using namespace css;
13729 -using ::rtl::OUString;
13730 -using ::utl::LocalFileHelper;
13731 -using ::utl::UCBContentHelper;
13732 -using ::utl::Bootstrap;
13734 -static std::list<OUString>
13735 -getLocaleSubdirList( lang::Locale const& rLocale )
13737 - std::list<OUString> aSubdirs;
13738 - aSubdirs.push_front( OUString::createFromAscii( "." ) );
13739 - aSubdirs.push_front( OUString::createFromAscii( "en_US" ) );
13740 - if ( rLocale.Language.getLength() )
13741 - aSubdirs.push_front( rLocale.Language );
13742 - if ( rLocale.Country.getLength() )
13744 - OUString aLocaleCountry = rLocale.Language
13745 - + OUString::createFromAscii( "_" )
13746 - + rLocale.Country;
13747 - aSubdirs.push_front( aLocaleCountry );
13748 - if ( rLocale.Variant.getLength() )
13749 - aSubdirs.push_front( aLocaleCountry
13750 - + OUString::createFromAscii( "." )
13751 - + rLocale.Variant );
13757 -fileExists( String const& aFile )
13760 - LocalFileHelper::ConvertPhysicalNameToURL( aFile, aUrl );
13761 - return UCBContentHelper::Exists( aUrl );
13765 -getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs,
13766 - OUString const& aXMLName )
13768 - static OUString const aSlash = OUString::createFromAscii( "/" );
13770 - for ( std::list<OUString>::const_iterator i = aSubDirs.begin();
13771 - i != aSubDirs.end(); i++ )
13773 - String aFile = aDir + aSlash + *i + aSlash + aXMLName;
13774 - OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) );
13775 - if ( fileExists( aFile ) )
13778 - return OUString();
13781 -/* FIXME: IWBN to share code with impimagetree.cxx, also for reading
13782 - from zip files. */
13784 -readRightTranslation( OUString const& aXMLName )
13787 - std::list<OUString> aSubdirs
13788 - = getLocaleSubdirList( Application::GetSettings().GetUILocale() );
13789 -#if TEST_LAYOUT // read from cwd first
13790 - OUString aCurrentWorkingUrl;
13791 - tools::getProcessWorkingDir( &aCurrentWorkingUrl );
13792 - String aCurrentWorkingDir;
13793 - LocalFileHelper::ConvertURLToPhysicalName( aCurrentWorkingUrl, aCurrentWorkingDir );
13794 - aXMLFile = getFirstExisting( aCurrentWorkingDir, aSubdirs, aXMLName );
13795 - if ( aXMLFile.Len() )
13798 -#endif /* TEST_LAYOUT */
13800 - OUString aShareUrl;
13801 - Bootstrap::locateSharedData( aShareUrl );
13802 - OUString aXMLUrl = aShareUrl + OUString::createFromAscii( "/layout" );
13804 - LocalFileHelper::ConvertURLToPhysicalName( aXMLUrl, aXMLDir );
13805 - aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName );
13808 - OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) );
13812 -} // namespace layoutimpl
13813 --- toolkit/source/layout/translate.hxx.old 2009-04-02 10:49:36.000000000 +0000
13814 +++ toolkit/source/layout/translate.hxx 1970-01-01 00:00:00.000000000 +0000
13816 -/*************************************************************************
13818 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13820 - * Copyright 2008 by Sun Microsystems, Inc.
13822 - * OpenOffice.org - a multi-platform office productivity suite
13824 - * $RCSfile: translate.hxx,v $
13826 - * $Revision: 1.3 $
13828 - * This file is part of OpenOffice.org.
13830 - * OpenOffice.org is free software: you can redistribute it and/or modify
13831 - * it under the terms of the GNU Lesser General Public License version 3
13832 - * only, as published by the Free Software Foundation.
13834 - * OpenOffice.org is distributed in the hope that it will be useful,
13835 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13836 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13837 - * GNU Lesser General Public License version 3 for more details
13838 - * (a copy is included in the LICENSE file that accompanied this code).
13840 - * You should have received a copy of the GNU Lesser General Public License
13841 - * version 3 along with OpenOffice.org. If not, see
13842 - * <http://www.openoffice.org/license.html>
13843 - * for a copy of the LGPLv3 License.
13845 - ************************************************************************/
13847 -#ifndef CORE_TRANSLATE_HXX
13848 -#define CORE_TRANSLATE_HXX
13852 -} // namespace rtl
13854 -namespace layoutimpl
13856 -::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName );
13857 -} // namespace layoutimpl
13859 -#endif /* CORE_TRANSLATE_HXX */
13860 --- toolkit/source/layout/vcl/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
13861 +++ toolkit/source/layout/vcl/makefile.mk 2009-04-06 16:42:13.000000000 +0000
13863 +#*************************************************************************
13865 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13867 +# Copyright 2008 by Sun Microsystems, Inc.
13869 +# OpenOffice.org - a multi-platform office productivity suite
13875 +# This file is part of OpenOffice.org.
13877 +# OpenOffice.org is free software: you can redistribute it and/or modify
13878 +# it under the terms of the GNU Lesser General Public License version 3
13879 +# only, as published by the Free Software Foundation.
13881 +# OpenOffice.org is distributed in the hope that it will be useful,
13882 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
13883 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13884 +# GNU Lesser General Public License version 3 for more details
13885 +# (a copy is included in the LICENSE file that accompanied this code).
13887 +# You should have received a copy of the GNU Lesser General Public License
13888 +# version 3 along with OpenOffice.org. If not, see
13889 +# <http://www.openoffice.org/license.html>
13890 +# for a copy of the LGPLv3 License.
13892 +#*************************************************************************
13897 +ENABLE_EXCEPTIONS=true
13899 +# --- Settings -----------------------------------------------------
13901 +.INCLUDE : settings.mk
13902 +.INCLUDE : $(PRJ)$/util$/makefile.pmk
13904 +.IF "$(COMNAME)" == "gcc3"
13905 +CFLAGS+=-Wall -fno-default-inline
13908 +# --- Files --------------------------------------------------------
13911 + $(SLO)$/wrapper.obj \
13912 + $(SLO)$/wbutton.obj \
13913 + $(SLO)$/wcontainer.obj \
13914 + $(SLO)$/wfield.obj
13916 +# --- Targets ------------------------------------------------------
13918 +.INCLUDE : target.mk
13919 --- toolkit/source/layout/vcl/wbutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
13920 +++ toolkit/source/layout/vcl/wbutton.cxx 2009-04-06 16:42:13.000000000 +0000
13922 +/*************************************************************************
13924 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13926 + * Copyright 2008 by Sun Microsystems, Inc.
13928 + * OpenOffice.org - a multi-platform office productivity suite
13934 + * This file is part of OpenOffice.org.
13936 + * OpenOffice.org is free software: you can redistribute it and/or modify
13937 + * it under the terms of the GNU Lesser General Public License version 3
13938 + * only, as published by the Free Software Foundation.
13940 + * OpenOffice.org is distributed in the hope that it will be useful,
13941 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13942 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13943 + * GNU Lesser General Public License version 3 for more details
13944 + * (a copy is included in the LICENSE file that accompanied this code).
13946 + * You should have received a copy of the GNU Lesser General Public License
13947 + * version 3 along with OpenOffice.org. If not, see
13948 + * <http://www.openoffice.org/license.html>
13949 + * for a copy of the LGPLv3 License.
13951 + ************************************************************************/
13953 +#include "wrapper.hxx"
13955 +#include <com/sun/star/awt/PosSize.hpp>
13956 +#include <com/sun/star/awt/XActionListener.hpp>
13957 +#include <com/sun/star/awt/XButton.hpp>
13958 +#include <com/sun/star/awt/XCheckBox.hpp>
13959 +#include <com/sun/star/awt/XRadioButton.hpp>
13960 +#include <com/sun/star/graphic/XGraphic.hpp>
13961 +#include <cppuhelper/implbase1.hxx>
13962 +#include <toolkit/awt/vclxwindow.hxx>
13963 +#include <toolkit/awt/vclxwindows.hxx>
13964 +#include <toolkit/helper/convert.hxx>
13965 +#include <vcl/button.hxx>
13966 +#include <vcl/event.hxx>
13967 +#include <vcl/msgbox.hxx>
13968 +#include <vcl/svapp.hxx>
13969 +#include <vcl/window.hxx>
13973 +#include <layout/core/helper.hxx>
13975 +using namespace ::com::sun::star;
13977 +using rtl::OUString;
13985 + uno::Reference< graphic::XGraphic > mxGraphic;
13986 + ImageImpl( const char *pName )
13987 + : mxGraphic( layoutimpl::loadGraphic( pName ) )
13989 + if ( !mxGraphic.is() )
13991 + DBG_ERROR1( "ERROR: failed to load image: `%s'\n", pName );
13996 +Image::Image( const char *pName )
13997 + : pImpl( new ImageImpl( pName ) )
14006 +class ButtonImpl : public ControlImpl
14007 + , public ::cppu::WeakImplHelper1< awt::XActionListener >
14012 + uno::Reference< awt::XButton > mxButton;
14013 + ButtonImpl( Context *context, const PeerHandle &peer, Window *window )
14014 + : ControlImpl( context, peer, window )
14015 + , mxButton( peer, uno::UNO_QUERY )
14017 + /* We have default action when clicked, always listen. */
14018 + mxButton->addActionListener( this );
14025 + virtual void Click() { /* make me pure virtual? */ };
14027 + Link& GetClickHdl ()
14029 + return maClickHdl;
14032 + virtual void SetClickHdl( Link const& link )
14034 + maClickHdl = link;
14037 + void SAL_CALL disposing( lang::EventObject const& e )
14038 + throw (uno::RuntimeException)
14040 + mxButton->removeActionListener( this );
14041 + ControlImpl::disposing (e);
14042 + mxButton.clear ();
14045 + virtual void SAL_CALL actionPerformed( const awt::ActionEvent& )
14046 + throw (uno::RuntimeException)
14048 + if ( !maClickHdl )
14051 + maClickHdl.Call( static_cast<Window *>( mpWindow ) );
14054 + bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph )
14056 + setProperty( "Graphic", uno::Any( xGraph ) );
14061 +Button::~Button ()
14065 +String Button::GetStandardText (sal_uInt16 button_type)
14067 + return ::Button::GetStandardText (button_type);
14070 +void Button::SetText( OUString const& rStr )
14072 + if ( !getImpl().mxButton.is() )
14074 + getImpl().mxButton->setLabel( rStr );
14077 +void Button::SetClickHdl( const Link& link )
14079 + if (&getImpl () && getImpl().mxButton.is ())
14080 + getImpl().SetClickHdl( link );
14083 +Link& Button::GetClickHdl ()
14085 + return getImpl().GetClickHdl ();
14088 +bool Button::SetModeImage( const Image& rImage )
14090 + return getImpl().SetModeImage( rImage.getImpl().mxGraphic );
14093 +void Button::SetImageAlign( ImageAlign eAlign )
14095 + getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) );
14098 +void Button::Click()
14102 +IMPL_GET_IMPL( Button );
14103 +IMPL_CONSTRUCTORS( Button, Control, "button" );
14104 +IMPL_GET_WINDOW (Button);
14106 +class PushButtonImpl : public ButtonImpl
14107 + , public ::cppu::WeakImplHelper1< awt::XItemListener >
14109 + Link maToggleHdl;
14111 + PushButtonImpl( Context *context, const PeerHandle &peer, Window *window )
14112 + : ButtonImpl( context, peer, window )
14116 + void SetToggleHdl( const Link& link )
14118 + // XButton doesn't have an explicit event for Toggle. Anyway, it is a
14119 + // superset of the clicks: all clicks, and explicit toggles
14120 + if (!link && !!maToggleHdl)
14121 + mxButton->removeActionListener( this );
14122 + else if (!!link && !maToggleHdl)
14123 + mxButton->addActionListener( this );
14124 + maToggleHdl = link;
14126 + void SAL_CALL disposing( lang::EventObject const& e )
14127 + throw (uno::RuntimeException)
14129 + ButtonImpl::disposing (e);
14131 + virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e )
14132 + throw (uno::RuntimeException)
14134 + ButtonImpl::actionPerformed( e );
14137 + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
14138 + throw (uno::RuntimeException)
14140 + maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
14142 + void fireToggle()
14144 + maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
14149 +PushButton::~PushButton ()
14151 + SetToggleHdl (Link ());
14154 +void PushButton::Check( bool bCheck )
14156 + getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) );
14157 + // XButton doesn't have explicit toggle event
14158 + getImpl().fireToggle();
14161 +bool PushButton::IsChecked() const
14163 + return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() );
14166 +void PushButton::Toggle()
14171 +void PushButton::SetToggleHdl( const Link& link )
14173 + if (&getImpl () && getImpl().mxButton.is ())
14174 + getImpl().SetToggleHdl( link );
14177 +IMPL_GET_IMPL( PushButton );
14178 +IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" );
14179 +IMPL_GET_WINDOW (PushButton);
14181 +class RadioButtonImpl : public ButtonImpl
14182 + , public ::cppu::WeakImplHelper1< awt::XItemListener >
14184 + Link maToggleHdl;
14186 + uno::Reference< awt::XRadioButton > mxRadioButton;
14187 + RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window )
14188 + : ButtonImpl( context, peer, window )
14189 + , mxRadioButton( peer, uno::UNO_QUERY )
14193 + void Check( bool bCheck )
14195 + if ( !mxRadioButton.is() )
14199 + // Have setState fire item event for
14200 + // RadioGroups::RadioGroup::itemStateChanged ()
14201 + ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton ();
14202 + bool state = r->IsRadioCheckEnabled ();
14203 + r->EnableRadioCheck();
14204 + mxRadioButton->setState( !!bCheck );
14205 + r->EnableRadioCheck (state);
14207 + mxRadioButton->setState( !!bCheck );
14214 + if ( !mxRadioButton.is() )
14216 + return mxRadioButton->getState();
14219 + void SetToggleHdl( const Link& link )
14221 + if (!link && !!maToggleHdl)
14222 + mxRadioButton->removeItemListener( this );
14223 + else if (!!link && !maToggleHdl)
14224 + mxRadioButton->addItemListener( this );
14225 + maToggleHdl = link;
14228 + inline void fireToggle()
14230 + maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
14233 + virtual void SetClickHdl( const Link& link )
14235 + // Keep RadioGroups::RadioGroup's actionListener at HEAD
14236 + // of list. This way, it can handle RadioGroup's button
14237 + // states before all other callbacks and make sure the
14238 + // client code has the right state.
14240 + // IWBN to add an XRadioButton2 and layout::VCLXRadioButton
14241 + // with {get,set}RadioGroup() (and a "radiogroup" property
14242 + // even) and handle the grouping here in RadioButtonImpl.
14243 + uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener ();
14244 + uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY );
14245 + mxButton->removeActionListener (a);
14246 + ButtonImpl::SetClickHdl (link);
14247 + mxButton->addActionListener (a);
14250 + void SAL_CALL disposing( lang::EventObject const& e )
14251 + throw (uno::RuntimeException)
14253 + ButtonImpl::disposing (e);
14256 + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
14257 + throw (uno::RuntimeException)
14259 + maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
14263 +RadioButton::~RadioButton ()
14265 + SetToggleHdl (Link ());
14268 +void RadioButton::Check( bool bCheck )
14270 + getImpl().Check( bCheck );
14273 +bool RadioButton::IsChecked() const
14275 + return getImpl().IsChecked();
14278 +void RadioButton::SetToggleHdl( const Link& link )
14280 + if (&getImpl () && getImpl().mxRadioButton.is ())
14281 + getImpl().SetToggleHdl( link );
14284 +IMPL_GET_IMPL( RadioButton );
14285 +IMPL_GET_WINDOW( RadioButton );
14286 +IMPL_GET_VCLXWINDOW( RadioButton );
14287 +IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" );
14289 +class CheckBoxImpl : public ButtonImpl
14290 + , public ::cppu::WeakImplHelper1< awt::XItemListener >
14292 + Link maToggleHdl;
14294 + uno::Reference< awt::XCheckBox > mxCheckBox;
14295 + CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window )
14296 + : ButtonImpl( context, peer, window )
14297 + , mxCheckBox( peer, uno::UNO_QUERY )
14301 + void SetToggleHdl( const Link& link )
14303 + if (!link && !!maToggleHdl)
14304 + mxCheckBox->removeItemListener( this );
14305 + else if (!!link && !maToggleHdl)
14306 + mxCheckBox->addItemListener( this );
14307 + maToggleHdl = link;
14309 + void SAL_CALL disposing( lang::EventObject const& e )
14310 + throw (uno::RuntimeException)
14312 + ButtonImpl::disposing (e);
14314 + virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
14315 + throw (uno::RuntimeException)
14317 + maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
14321 +CheckBox::~CheckBox ()
14323 + SetToggleHdl (Link ());
14326 +void CheckBox::Check( bool bCheck )
14328 + if ( !getImpl().mxCheckBox.is() )
14330 + getImpl().mxCheckBox->setState( !!bCheck );
14333 +bool CheckBox::IsChecked() const
14335 + if ( !getImpl().mxCheckBox.is() )
14337 + return getImpl().mxCheckBox->getState() != 0;
14340 +void CheckBox::SetToggleHdl( const Link& link )
14342 + if (&getImpl () && getImpl().mxCheckBox.is ())
14343 + getImpl().SetToggleHdl( link );
14346 +IMPL_GET_IMPL( CheckBox );
14347 +IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" );
14349 +#define BUTTON_IMPL(t, parent, response) \
14350 + class t##Impl : public parent##Impl \
14353 + t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
14354 + : parent##Impl( context, peer, window ) \
14359 + if (Dialog *d = static_cast<Dialog *> (mpCtx)) \
14360 + d->EndDialog( response ); \
14364 +/* Common button types currently unavailable in OOo: */
14368 +#define RET_RESET 6
14369 +#define RET_APPLY 7
14370 +#define BUTTONID_RESET RET_RESET
14371 +#define BUTTONID_APPLY RET_APPLY
14373 +BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK );
14374 +BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL );
14375 +BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES );
14376 +BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO );
14377 +BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY );
14378 +BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE );
14379 +BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET );
14380 +BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */
14381 +BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP );
14383 +IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" );
14384 +IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" );
14385 +IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" );
14386 +IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" );
14387 +IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" );
14388 +IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" );
14389 +IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" );
14390 +IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */
14391 +IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" );
14393 +class AdvancedButtonImpl : public PushButtonImpl
14396 + bool bAdvancedMode;
14397 + std::list< Window*> maAdvanced;
14398 + std::list< Window*> maSimple;
14401 + rtl::OUString mAdvancedLabel;
14402 + rtl::OUString mSimpleLabel;
14405 + Window* Remove( std::list< Window*> lst, Window* w )
14407 + for ( std::list< Window*>::iterator it = maAdvanced.begin();
14408 + it != maAdvanced.end(); it++ )
14418 + AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window )
14419 + : PushButtonImpl( context, peer, window )
14420 + , bAdvancedMode( false )
14422 + // Button::GetStandardText( BUTTON_ADVANCED );
14423 + // Button::GetStandardText( BUTTON_SIMPLE );
14424 + , mAdvancedLabel( rtl::OUString::createFromAscii( "Advanced..." ) )
14425 + , mSimpleLabel( rtl::OUString::createFromAscii( "Simple..." ) )
14430 + bAdvancedMode = !bAdvancedMode;
14431 + if ( bAdvancedMode )
14438 + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
14439 + b->SetSymbolAlign (SYMBOLALIGN_RIGHT);
14440 + b->SetSmallSymbol ();
14441 + //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER);
14443 + void advancedMode()
14445 + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
14446 + b->SetSymbol (SYMBOL_PAGEUP);
14448 + if (mSimpleLabel.getLength ())
14449 + b->SetText (mSimpleLabel);
14450 + for ( std::list< Window*>::iterator it = maAdvanced.begin();
14451 + it != maAdvanced.end(); it++ )
14453 + for ( std::list< Window*>::iterator it = maSimple.begin();
14454 + it != maSimple.end(); it++ )
14459 + void simpleMode()
14461 + //mxButton->setLabel( mSimpleLabel );
14462 + ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
14463 + b->SetSymbol (SYMBOL_PAGEDOWN);
14464 + if (mAdvancedLabel.getLength ())
14465 + b->SetText (mAdvancedLabel);
14467 + for ( std::list< Window*>::iterator it = maAdvanced.begin();
14468 + it != maAdvanced.end(); it++ )
14470 + for ( std::list< Window*>::iterator it = maSimple.begin();
14471 + it != maSimple.end(); it++ )
14476 + void AddAdvanced( Window* w )
14478 + maAdvanced.push_back( w );
14479 + if ( !bAdvancedMode )
14482 + void AddSimple( Window* w )
14484 + maSimple.push_back( w );
14485 + if ( bAdvancedMode )
14488 + void RemoveAdvanced( Window* w )
14490 + Remove( maAdvanced, w );
14492 + void RemoveSimple( Window* w )
14494 + Remove( maSimple, w );
14498 +void AdvancedButton::AddAdvanced( Window* w )
14500 + getImpl().AddAdvanced( w );
14503 +void AdvancedButton::AddSimple( Window* w )
14505 + getImpl().AddSimple( w );
14508 +void AdvancedButton::RemoveAdvanced( Window* w )
14510 + getImpl().RemoveAdvanced( w );
14513 +void AdvancedButton::RemoveSimple( Window* w )
14515 + getImpl().RemoveSimple( w );
14518 +void AdvancedButton::SetAdvancedText (rtl::OUString const& text)
14520 + if (text.getLength ())
14521 + getImpl ().mAdvancedLabel = text;
14524 +void AdvancedButton::SetSimpleText (rtl::OUString const& text)
14526 + if (text.getLength ())
14527 + getImpl ().mSimpleLabel = text;
14530 +rtl::OUString AdvancedButton::GetAdvancedText () const
14532 + return getImpl ().mAdvancedLabel;
14535 +rtl::OUString AdvancedButton::GetSimpleText () const
14537 + return getImpl ().mSimpleLabel;
14540 +void AdvancedButton::SetDelta (int)
14544 +IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () );
14545 +IMPL_GET_IMPL( AdvancedButton );
14548 +class MoreButtonImpl : public AdvancedButtonImpl
14551 + MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window )
14552 + : AdvancedButtonImpl( context, peer, window)
14554 + mSimpleLabel = Button::GetStandardText( BUTTON_MORE );
14555 + mAdvancedLabel = Button::GetStandardText( BUTTON_LESS );
14557 + void AddWindow( Window* w ) { AddAdvanced( w ); }
14558 + void RemoveWindow( Window* w ) { RemoveAdvanced( w ); }
14562 +//BUTTON_IMPL( MoreButton, PushButton, 0 );
14563 +IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () );
14564 +IMPL_GET_IMPL( MoreButton );
14566 +void MoreButton::AddWindow( Window* w )
14568 + getImpl().AddWindow( w );
14571 +void MoreButton::RemoveWindow( Window* w )
14573 + getImpl().RemoveWindow( w );
14576 +void MoreButton::SetMoreText (rtl::OUString const& text)
14578 + SetAdvancedText (text);
14581 +void MoreButton::SetLessText (rtl::OUString const& text)
14583 + SetSimpleText (text);
14586 +rtl::OUString MoreButton::GetMoreText () const
14588 + return GetAdvancedText ();
14591 +rtl::OUString MoreButton::GetLessText () const
14593 + return GetSimpleText ();
14596 +} // namespace layout
14597 --- toolkit/source/layout/vcl/wcontainer.cxx.old 1970-01-01 00:00:00.000000000 +0000
14598 +++ toolkit/source/layout/vcl/wcontainer.cxx 2009-04-06 16:42:13.000000000 +0000
14600 +/*************************************************************************
14602 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14604 + * Copyright 2008 by Sun Microsystems, Inc.
14606 + * OpenOffice.org - a multi-platform office productivity suite
14612 + * This file is part of OpenOffice.org.
14614 + * OpenOffice.org is free software: you can redistribute it and/or modify
14615 + * it under the terms of the GNU Lesser General Public License version 3
14616 + * only, as published by the Free Software Foundation.
14618 + * OpenOffice.org is distributed in the hope that it will be useful,
14619 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14620 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14621 + * GNU Lesser General Public License version 3 for more details
14622 + * (a copy is included in the LICENSE file that accompanied this code).
14624 + * You should have received a copy of the GNU Lesser General Public License
14625 + * version 3 along with OpenOffice.org. If not, see
14626 + * <http://www.openoffice.org/license.html>
14627 + * for a copy of the LGPLv3 License.
14629 + ************************************************************************/
14631 +#include "wrapper.hxx"
14633 +#include <com/sun/star/awt/XLayoutRoot.hpp>
14634 +#include <com/sun/star/awt/XLayoutContainer.hpp>
14635 +#include <comphelper/processfactory.hxx>
14636 +#include <layout/core/helper.hxx>
14637 +#include <tools/debug.hxx>
14639 +using namespace ::com::sun::star;
14644 +Container::Container( Context const* context, char const* pId )
14645 + : mxContainer( context->GetPeerHandle( pId ), uno::UNO_QUERY )
14647 + if ( !mxContainer.is() )
14649 + DBG_ERROR1( "Error: failed to associate container with '%s'", pId );
14653 +Container::Container( rtl::OUString const& rName, sal_Int32 nBorder )
14655 + mxContainer = layoutimpl::WidgetFactory::createContainer( rName );
14657 + uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
14658 + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ),
14659 + uno::Any( nBorder ) );
14662 +void Container::Add( Window *pChild )
14666 + uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
14667 + mxContainer->addChild( xChild );
14671 +void Container::Add( Container *pChild )
14675 + uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
14676 + mxContainer->addChild( xChild );
14680 +void Container::Remove( Window *pChild )
14684 + uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
14685 + mxContainer->removeChild( xChild );
14689 +void Container::Remove( Container *pChild )
14693 + uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
14694 + mxContainer->removeChild( xChild );
14698 +void Container::Clear()
14700 + css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children;
14701 + children = mxContainer->getChildren();
14702 + for (int i = 0; i < children.getLength(); i++)
14703 + mxContainer->removeChild( children[i] );
14706 +void Container::ShowAll( bool bShow )
14710 + static void setChildrenVisible( uno::Reference < awt::XLayoutContainer > xCont,
14711 + bool bVisible ) /* auxiliary */
14713 + if ( xCont.is() )
14715 + uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
14716 + aChildren = xCont->getChildren();
14717 + for (int i = 0; i < aChildren.getLength(); i++)
14719 + uno::Reference < awt::XLayoutConstrains > xChild( aChildren[ i ] );
14721 + uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY);
14723 + xWin->setVisible( bVisible );
14725 + uno::Reference < awt::XLayoutContainer > xChildCont(
14726 + xChild, uno::UNO_QUERY );
14727 + setChildrenVisible( xChildCont, bVisible );
14733 + inner::setChildrenVisible( mxContainer, bShow );
14736 +void Container::Show()
14741 +void Container::Hide()
14743 + ShowAll( false );
14746 +Table::Table( sal_Int32 nBorder, sal_Int32 nColumns )
14747 + : Container( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ), nBorder )
14749 + uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
14750 + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ) ),
14751 + uno::Any( nColumns ) );
14754 +void Table::Add( Window *window, bool bXExpand, bool bYExpand,
14755 + sal_Int32 nXSpan, sal_Int32 nYSpan )
14759 + WindowImpl &rImpl = window->getImpl();
14760 + uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
14761 + uno::UNO_QUERY );
14762 + mxContainer->addChild( xChild );
14763 + setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
14766 +void Table::Add( Container *pContainer, bool bXExpand, bool bYExpand,
14767 + sal_Int32 nXSpan, sal_Int32 nYSpan )
14769 + if ( !pContainer )
14771 + uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
14772 + uno::UNO_QUERY );
14773 + mxContainer->addChild( xChild );
14774 + setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
14777 +void Table::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
14778 + bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan )
14780 + uno::Reference< beans::XPropertySet > xProps
14781 + ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
14782 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ) ),
14783 + uno::Any( bXExpand ) );
14784 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ) ),
14785 + uno::Any( bYExpand ) );
14786 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ) ),
14787 + uno::Any( nXSpan ) );
14788 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ) ),
14789 + uno::Any( nYSpan ) );
14792 +Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous )
14793 + : Container( rName, nBorder )
14795 + uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
14796 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ) ),
14797 + uno::Any( bHomogeneous ) );
14800 +void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding)
14804 + WindowImpl &rImpl = window->getImpl();
14805 + uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
14806 + uno::UNO_QUERY );
14808 + mxContainer->addChild( xChild );
14809 + setProps( xChild, bExpand, bFill, nPadding );
14812 +void Box::Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding)
14814 + if ( !pContainer )
14817 + uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
14818 + uno::UNO_QUERY );
14819 + mxContainer->addChild( xChild );
14820 + setProps( xChild, bExpand, bFill, nPadding );
14823 +void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
14824 + bool bExpand, bool bFill, sal_Int32 nPadding )
14826 + uno::Reference< beans::XPropertySet > xProps
14827 + ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
14829 + xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Expand" ) ),
14830 + uno::Any( bExpand ) );
14831 + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Fill" ) ),
14832 + uno::Any( bFill ) );
14833 + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Padding" ) ),
14834 + uno::Any( nPadding ) );
14837 +Table::Table( Context const* context, char const* pId )
14838 + : Container( context, pId )
14842 +Box::Box( Context const* context, char const* pId )
14843 + : Container( context, pId )
14847 +HBox::HBox( sal_Int32 nBorder, bool bHomogeneous )
14848 + : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hbox" ) ),
14849 + nBorder, bHomogeneous )
14853 +HBox::HBox( Context const* context, char const* pId )
14854 + : Box( context, pId )
14858 +VBox::VBox( sal_Int32 nBorder, bool bHomogeneous )
14859 + : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vbox" ) ),
14860 + nBorder, bHomogeneous )
14864 +VBox::VBox( Context const* context, char const* pId )
14865 + : Box( context, pId )
14869 +} // namespace layout
14870 --- toolkit/source/layout/vcl/wfield.cxx.old 1970-01-01 00:00:00.000000000 +0000
14871 +++ toolkit/source/layout/vcl/wfield.cxx 2009-04-06 16:42:13.000000000 +0000
14873 +/*************************************************************************
14875 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14877 + * Copyright 2008 by Sun Microsystems, Inc.
14879 + * OpenOffice.org - a multi-platform office productivity suite
14885 + * This file is part of OpenOffice.org.
14887 + * OpenOffice.org is free software: you can redistribute it and/or modify
14888 + * it under the terms of the GNU Lesser General Public License version 3
14889 + * only, as published by the Free Software Foundation.
14891 + * OpenOffice.org is distributed in the hope that it will be useful,
14892 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14893 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14894 + * GNU Lesser General Public License version 3 for more details
14895 + * (a copy is included in the LICENSE file that accompanied this code).
14897 + * You should have received a copy of the GNU Lesser General Public License
14898 + * version 3 along with OpenOffice.org. If not, see
14899 + * <http://www.openoffice.org/license.html>
14900 + * for a copy of the LGPLv3 License.
14902 + ************************************************************************/
14904 +#include "wrapper.hxx"
14906 +#include <comphelper/processfactory.hxx>
14907 +#include <com/sun/star/awt/XMetricField.hpp>
14908 +#include <com/sun/star/awt/XNumericField.hpp>
14909 +#include <com/sun/star/awt/XTextComponent.hpp>
14910 +#include <com/sun/star/awt/XListBox.hpp>
14911 +#include <com/sun/star/awt/XComboBox.hpp>
14912 +#include <cppuhelper/implbase1.hxx>
14913 +#include <com/sun/star/awt/XActionListener.hpp>
14914 +#include <com/sun/star/awt/XItemListener.hpp>
14915 +#include <vcl/combobox.hxx>
14916 +#include <vcl/lstbox.hxx>
14918 +#include <toolkit/awt/vclxwindows.hxx>
14920 +using namespace ::com::sun::star;
14921 +using rtl::OUString;
14926 +class EditImpl : public ControlImpl
14927 + , public ::cppu::WeakImplHelper1< awt::XTextListener >
14930 + Link maModifyHdl;
14932 + uno::Reference< awt::XTextComponent > mxEdit;
14933 + EditImpl( Context *context, const PeerHandle &peer, Window *window )
14934 + : ControlImpl( context, peer, window )
14935 + , mxEdit( peer, uno::UNO_QUERY )
14941 + virtual void SAL_CALL disposing( lang::EventObject const& e )
14942 + throw (css::uno::RuntimeException);
14944 + virtual void SetModifyHdl( Link const& link );
14946 + void SAL_CALL textChanged( const css::awt::TextEvent& /* rEvent */ )
14947 + throw (css::uno::RuntimeException)
14949 + maModifyHdl.Call( mpWindow );
14953 +EditImpl::~EditImpl ()
14957 +void SAL_CALL EditImpl::disposing( lang::EventObject const& e )
14958 + throw (css::uno::RuntimeException)
14960 + ControlImpl::disposing (e);
14964 +void EditImpl::SetModifyHdl( Link const& link )
14966 + if (!link && !!maModifyHdl)
14967 + mxEdit->removeTextListener( this );
14968 + else if (!!link && !maModifyHdl)
14969 + mxEdit->addTextListener( this );
14970 + maModifyHdl = link;
14975 + SetModifyHdl (Link ());
14978 +void Edit::SetSelection( Selection const& rSelection )
14980 + if ( !getImpl().mxEdit.is() )
14982 + getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) );
14985 +void Edit::SetText( OUString const& rStr ) const
14987 + if ( !getImpl().mxEdit.is() )
14989 + getImpl().mxEdit->setText( rStr );
14992 +String Edit::GetText() const
14994 + if ( !getImpl().mxEdit.is() )
14995 + return OUString();
14996 + return OUString( getImpl().mxEdit->getText());
14999 +void Edit::SetModifyHdl( const Link& link )
15001 + if (&getImpl () && getImpl().mxEdit.is ())
15002 + getImpl().SetModifyHdl( link );
15005 +IMPL_CONSTRUCTORS( Edit, Control, "edit" );
15006 +IMPL_GET_IMPL( Edit );
15008 +// Window/Control/Edit/MultiLineEdit
15009 +class MultiLineEditImpl : public EditImpl
15012 + MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window )
15013 + : EditImpl( context, peer, window )
15018 +IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" );
15019 +IMPL_GET_IMPL( MultiLineEdit );
15021 +// Window/Control/Edit/SpinField
15022 +class SpinFieldImpl : public EditImpl
15025 + SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window )
15026 + : EditImpl( context, peer, window )
15031 +IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
15033 +// Window/Control/Edit/SpinField/NumericField
15034 +class NumericFieldImpl : public SpinFieldImpl
15037 + NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window )
15038 + : SpinFieldImpl( context, peer, window )
15043 +// Window/Control/Edit/SpinField/MetricField
15044 +class MetricFieldImpl : public SpinFieldImpl
15047 + MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window )
15048 + : SpinFieldImpl( context, peer, window )
15053 +IMPL_GET_IMPL( SpinField );
15054 +IMPL_GET_IMPL( NumericField );
15055 +IMPL_GET_IMPL( MetricField );
15058 +class FormatterBaseImpl
15061 + PeerHandle mpeer;
15063 + explicit FormatterBaseImpl( const PeerHandle &peer )
15069 +FormatterBase::FormatterBase( FormatterBaseImpl *pFormatImpl )
15070 + : mpFormatImpl( pFormatImpl )
15074 +class NumericFormatterImpl : public FormatterBaseImpl
15077 + uno::Reference< awt::XNumericField > mxField;
15078 + explicit NumericFormatterImpl( const PeerHandle &peer )
15079 + : FormatterBaseImpl( peer )
15080 + , mxField( peer, uno::UNO_QUERY )
15084 + // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
15085 + double valueToDouble( sal_Int64 nValue )
15087 + sal_Int16 nDigits = mxField->getDecimalDigits();
15088 + double n = (double)nValue;
15089 + for ( sal_uInt16 d = 0; d < nDigits; d++ )
15092 + } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
15093 + sal_Int64 doubleToValue( double nValue )
15095 + sal_Int16 nDigits = mxField->getDecimalDigits();
15096 + double n = nValue;
15097 + for ( sal_uInt16 d = 0; d < nDigits; d++ )
15099 + return (sal_Int64) n;
15103 +class MetricFormatterImpl : public FormatterBaseImpl
15106 + uno::Reference< awt::XMetricField > mxField;
15107 + explicit MetricFormatterImpl( const PeerHandle &peer )
15108 + : FormatterBaseImpl( peer )
15109 + , mxField( peer, uno::UNO_QUERY )
15114 +// NumericFormatter
15116 +NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl )
15117 + : FormatterBase( pImpl )
15121 +NumericFormatterImpl& NumericFormatter::getFormatImpl() const
15123 + return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) );
15126 +#define SET_IMPL(vclmethod, idlmethod) \
15127 + void NumericFormatter::vclmethod( sal_Int64 nValue ) \
15129 + if ( !getFormatImpl().mxField.is() ) \
15131 + getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \
15134 +SET_IMPL( SetMin, setMin )
15135 +SET_IMPL( SetMax, setMax )
15136 +SET_IMPL( SetLast, setLast )
15137 +SET_IMPL( SetFirst, setFirst )
15138 +SET_IMPL( SetValue, setValue )
15139 +SET_IMPL( SetSpinSize, setSpinSize )
15141 +sal_Int64 NumericFormatter::GetValue() const
15143 + if ( !getFormatImpl().mxField.is() )
15145 + return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() );
15150 +IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" );
15152 +// MetricFormatter
15154 +MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl )
15155 + : FormatterBase( pImpl )
15158 +MetricFormatterImpl& MetricFormatter::getFormatImpl() const
15159 +{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); }
15161 +#define MetricUnitVclToUno(a) ((sal_uInt16)(a))
15163 +#define SET_IMPL(vclmethod, idlmethod) \
15164 + void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \
15166 + if ( !getFormatImpl().mxField.is() ) \
15168 + getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \
15171 +SET_IMPL( SetMin, setMin )
15172 +SET_IMPL( SetMax, setMax )
15173 +SET_IMPL( SetLast, setLast )
15174 +SET_IMPL( SetFirst, setFirst )
15175 +SET_IMPL( SetValue, setValue )
15179 +void MetricFormatter::SetSpinSize( sal_Int64 nValue )
15181 + if ( !getFormatImpl().mxField.is() )
15183 + getFormatImpl().mxField->setSpinSize( nValue );
15186 +sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
15188 + if ( !getFormatImpl().mxField.is() )
15190 + return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) );
15193 +IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
15195 +// Window/Control/Edit/ComboBox
15196 +class ComboBoxImpl : public EditImpl
15197 + , public ::cppu::WeakImplHelper1< awt::XActionListener >
15198 + , public ::cppu::WeakImplHelper1< awt::XItemListener >
15201 + uno::Reference< awt::XComboBox > mxComboBox;
15204 + Link maSelectHdl;
15208 + ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window )
15209 + : EditImpl( context, peer, window )
15210 + , mxComboBox( peer, uno::UNO_QUERY )
15214 + ~ComboBoxImpl ();
15216 + sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos )
15218 + if ( nPos == COMBOBOX_APPEND )
15219 + nPos = GetEntryCount();
15220 + mxComboBox->addItem( rtl::OUString( rStr ), nPos );
15224 + void RemoveEntry( sal_uInt16 nPos )
15226 + mxComboBox->removeItems( nPos, 1 );
15229 + sal_uInt16 GetEntryPos( const OUString& rStr ) const
15231 + uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
15232 + rtl::OUString rKey( rStr );
15233 + for (unsigned int i = 0; aItems.getLength(); i++)
15235 + if ( aItems[ i ] == rKey )
15236 + return sal::static_int_cast< sal_uInt16 >( i );
15238 + return COMBOBOX_ENTRY_NOTFOUND;
15241 + OUString GetEntry( sal_uInt16 nPos ) const
15243 + return OUString( mxComboBox->getItem( nPos ) );
15246 + sal_uInt16 GetEntryCount() const
15248 + return mxComboBox->getItemCount();
15251 + void SetClickHdl( Link const& link )
15253 + if (!link && !!maClickHdl)
15254 + mxComboBox->removeActionListener( this );
15255 + else if (!!link && !maClickHdl)
15256 + mxComboBox->addActionListener( this );
15257 + maClickHdl = link;
15260 + void SetSelectHdl( Link const& link )
15262 + if (!link && !!maSelectHdl)
15263 + mxComboBox->removeItemListener( this );
15264 + else if (!!link && !maSelectHdl)
15265 + mxComboBox->addItemListener( this );
15266 + maSelectHdl = link;
15269 + virtual void SAL_CALL disposing( lang::EventObject const& e )
15270 + throw (css::uno::RuntimeException);
15272 + virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
15273 + throw (css::uno::RuntimeException)
15275 + ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
15276 + if ( !pComboBox )
15278 + maClickHdl.Call( pComboBox );
15281 + virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
15282 + throw (css::uno::RuntimeException)
15284 + ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
15285 + if ( !pComboBox )
15287 + maSelectHdl.Call( pComboBox );
15291 +ComboBox::~ComboBox ()
15293 + OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ());
15296 +ComboBoxImpl::~ComboBoxImpl ()
15298 + OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0);
15299 + OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this));
15302 +void ComboBoxImpl::disposing( lang::EventObject const& e )
15303 + throw (css::uno::RuntimeException)
15305 + EditImpl::disposing (e);
15306 + mxComboBox.clear ();
15309 +sal_uInt16 ComboBox::InsertEntry( const OUString &rStr, sal_uInt16 nPos )
15311 + return getImpl().InsertEntry( rStr, nPos );
15314 +void ComboBox::RemoveEntry( const OUString& rStr )
15316 + getImpl().RemoveEntry( GetEntryPos( rStr ) );
15319 +void ComboBox::RemoveEntry( sal_uInt16 nPos )
15321 + getImpl().RemoveEntry( nPos );
15324 +void ComboBox::Clear()
15326 + uno::Sequence< rtl::OUString> aNoItems;
15327 + getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
15330 +sal_uInt16 ComboBox::GetEntryPos( const OUString& rStr ) const
15332 + return getImpl().GetEntryPos( rStr );
15335 +String ComboBox::GetEntry( sal_uInt16 nPos ) const
15337 + rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos );
15338 + return OUString( rItem );
15341 +sal_uInt16 ComboBox::GetEntryCount() const
15343 + return getImpl().GetEntryCount();
15346 +void ComboBox::SetClickHdl( const Link& link )
15348 + if (&getImpl () && getImpl().mxComboBox.is ())
15349 + getImpl().SetClickHdl( link );
15352 +void ComboBox::SetSelectHdl( const Link& link )
15354 + if (&getImpl () && getImpl().mxComboBox.is ())
15355 + getImpl().SetSelectHdl( link );
15358 +void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
15360 + GetComboBox ()->EnableAutocomplete (enable, matchCase);
15363 +IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; );
15364 +IMPL_GET_WINDOW (ComboBox);
15365 +/// IMPL_GET_IMPL( ComboBox );
15367 +static ComboBoxImpl& null_combobox_impl = (ComboBoxImpl&)*(ComboBoxImpl*)0;
15369 +ComboBoxImpl &ComboBox::getImpl () const
15371 + if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl))
15373 + return null_combobox_impl;
15377 +// Window/Control/ListBox
15378 +class ListBoxImpl : public ControlImpl
15379 + , public ::cppu::WeakImplHelper1< awt::XActionListener >
15380 + , public ::cppu::WeakImplHelper1< awt::XItemListener >
15383 + Link maSelectHdl;
15385 + uno::Reference< awt::XListBox > mxListBox;
15386 + ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
15387 + : ControlImpl( context, peer, window ),
15388 + mxListBox( peer, uno::UNO_QUERY )
15390 + SelectEntryPos( 0, true );
15393 + sal_uInt16 InsertEntry(const OUString& rStr, sal_uInt16 nPos)
15395 + if ( nPos == LISTBOX_APPEND )
15396 + nPos = mxListBox->getItemCount();
15397 + mxListBox->addItem( rtl::OUString( rStr ), nPos );
15401 + void RemoveEntry( sal_uInt16 nPos )
15403 + mxListBox->removeItems( nPos, 1 );
15406 + sal_uInt16 RemoveEntry(const OUString& rStr, sal_uInt16 nPos)
15408 + if ( nPos == LISTBOX_APPEND )
15409 + nPos = mxListBox->getItemCount();
15410 + mxListBox->addItem( rtl::OUString( rStr ), nPos );
15414 + sal_uInt16 GetEntryPos( const OUString& rStr ) const
15416 + uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
15417 + rtl::OUString rKey( rStr );
15418 + for (unsigned int i = 0; aItems.getLength(); i++)
15420 + if ( aItems[ i ] == rKey )
15421 + return sal::static_int_cast< sal_uInt16 >( i );
15423 + return LISTBOX_ENTRY_NOTFOUND;
15426 + OUString GetEntry( sal_uInt16 nPos ) const
15428 + return mxListBox->getItem( nPos );
15431 + sal_uInt16 GetEntryCount() const
15433 + return mxListBox->getItemCount();
15436 + void SelectEntryPos( sal_uInt16 nPos, bool bSelect )
15438 + mxListBox->selectItemPos( nPos, bSelect );
15441 + sal_uInt16 GetSelectEntryCount() const
15443 + return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() );
15446 + sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const
15448 + sal_uInt16 nSelected = 0;
15449 + if ( mxListBox->isMutipleMode() )
15451 + uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
15452 + if ( nSelIndex < aItems.getLength() )
15453 + nSelected = aItems[ nSelIndex ];
15456 + nSelected = mxListBox->getSelectedItemPos();
15457 + return nSelected;
15460 + void SetClickHdl( Link const& link )
15462 + if (!link && !!maClickHdl)
15463 + mxListBox->removeActionListener( this );
15464 + else if (!!link && !maClickHdl)
15465 + mxListBox->addActionListener( this );
15466 + maClickHdl = link;
15469 + void SetSelectHdl( Link const& link )
15471 + if (!link && !!maSelectHdl)
15472 + mxListBox->removeItemListener( this );
15473 + else if (!!link && !maSelectHdl)
15474 + mxListBox->addItemListener( this );
15475 + maSelectHdl = link;
15478 + virtual void SAL_CALL disposing( lang::EventObject const& e )
15479 + throw (css::uno::RuntimeException)
15481 + ControlImpl::disposing (e);
15482 + mxListBox.clear ();
15485 + void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
15486 + throw (css::uno::RuntimeException)
15488 + maClickHdl.Call( mpWindow );
15491 + void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
15492 + throw (css::uno::RuntimeException)
15494 + ListBox* pListBox = static_cast<ListBox*>( mpWindow );
15497 + maSelectHdl.Call( pListBox );
15501 +ListBox::~ListBox ()
15505 +sal_uInt16 ListBox::InsertEntry(const OUString& rStr, sal_uInt16 nPos)
15507 + return getImpl().InsertEntry(rStr, nPos);
15510 +void ListBox::RemoveEntry( sal_uInt16 nPos )
15512 + return getImpl().RemoveEntry( nPos );
15515 +void ListBox::RemoveEntry( const OUString& rStr )
15517 + return getImpl().RemoveEntry( GetEntryPos( rStr ) );
15520 +void ListBox::Clear()
15522 + uno::Sequence< rtl::OUString> aNoItems;
15523 + getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
15526 +sal_uInt16 ListBox::GetEntryPos( const OUString& rStr ) const
15528 + return getImpl().GetEntryPos( rStr );
15531 +String ListBox::GetEntry( sal_uInt16 nPos ) const
15533 + return getImpl().GetEntry( nPos );
15536 +sal_uInt16 ListBox::GetEntryCount() const
15538 + return getImpl().GetEntryCount();
15541 +void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
15543 + getImpl().SelectEntryPos( nPos, bSelect );
15546 +void ListBox::SelectEntry( const OUString& rStr, bool bSelect )
15548 + SelectEntryPos( GetEntryPos( rStr ), bSelect );
15551 +sal_uInt16 ListBox::GetSelectEntryCount() const
15553 + return getImpl().GetSelectEntryCount();
15556 +sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
15558 + return getImpl().GetSelectEntryPos( nSelIndex );
15561 +String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const
15563 + return GetEntry( GetSelectEntryPos( nSelIndex ) );
15566 +void ListBox::SetSelectHdl( const Link& link )
15568 + getImpl().SetSelectHdl( link );
15571 +void ListBox::SetClickHdl( const Link& link )
15573 + if (&getImpl () && getImpl().mxListBox.is ())
15574 + getImpl().SetClickHdl( link );
15578 +void ListBox::SetEntryData( sal_uInt16 pos, void* data)
15580 + GetListBox ()->SetEntryData (pos, data);
15583 +void* ListBox::GetEntryData( sal_uInt16 pos) const
15585 + return GetListBox ()->GetEntryData (pos);
15589 +void ListBox::SetLanguageList( sal_Int16/*list*/, bool/*hasLangNone*/, bool /*langNoneIsLangAll*/, bool /*checkSpellAvail*/)
15593 +sal_uInt16 ListBox::InsertLanguage( const LanguageType/*type*/, sal_uInt16/*pos*/)
15597 +sal_uInt16 ListBox::InsertLanguage( const LanguageType/*type*/, bool/*checkEntry*/, sal_uInt16 /*pos*/)
15601 +void ListBox::RemoveLanguage( const LanguageType/*type*/)
15604 +void ListBox::SelectLanguage( const LanguageType/*type*/, bool/*select*/)
15607 +LanguageType ListBox::GetSelectLanguage() const
15611 +bool ListBox::IsLanguageSelected( const LanguageType/*type*/) const
15616 +IMPL_CONSTRUCTORS ( ListBox, Control, "listbox" );
15617 +IMPL_GET_IMPL( ListBox );
15618 +IMPL_GET_WINDOW (ListBox);
15620 +// Window/Control/List/MultiListBox
15621 +class MultiListBoxImpl : public ListBoxImpl
15624 + MultiListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
15625 + : ListBoxImpl( context, peer, window )
15630 +IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); );
15631 +IMPL_GET_IMPL( MultiListBox );
15632 +IMPL_GET_WINDOW( MultiListBox );
15634 +} // namespace layout
15635 --- toolkit/source/layout/vcl/wrapper.cxx.old 1970-01-01 00:00:00.000000000 +0000
15636 +++ toolkit/source/layout/vcl/wrapper.cxx 2009-04-06 16:42:13.000000000 +0000
15638 +/*************************************************************************
15640 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
15642 + * Copyright 2008 by Sun Microsystems, Inc.
15644 + * OpenOffice.org - a multi-platform office productivity suite
15650 + * This file is part of OpenOffice.org.
15652 + * OpenOffice.org is free software: you can redistribute it and/or modify
15653 + * it under the terms of the GNU Lesser General Public License version 3
15654 + * only, as published by the Free Software Foundation.
15656 + * OpenOffice.org is distributed in the hope that it will be useful,
15657 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15658 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15659 + * GNU Lesser General Public License version 3 for more details
15660 + * (a copy is included in the LICENSE file that accompanied this code).
15662 + * You should have received a copy of the GNU Lesser General Public License
15663 + * version 3 along with OpenOffice.org. If not, see
15664 + * <http://www.openoffice.org/license.html>
15665 + * for a copy of the LGPLv3 License.
15667 + ************************************************************************/
15669 +#include <tools/rc.h>
15670 +//#define RESOURCE_PUBLISH_PROTECTED 1
15671 +#if RESOURCE_PUBLISH_PROTECTED
15672 +// ugh, override non-helpful proctection
15673 +#define protected public
15674 +#endif /* RESOURCE_PUBLISH_PROTECTED */
15675 +#include <tools/rc.hxx>
15679 +#include "wrapper.hxx"
15681 +#include <awt/vclxplugin.hxx>
15682 +#include <awt/vclxtabcontrol.hxx>
15683 +#include <com/sun/star/awt/PosSize.hpp>
15684 +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
15685 +#include <com/sun/star/awt/WindowAttribute.hpp>
15686 +#include <com/sun/star/awt/XDialog2.hpp>
15687 +#include <com/sun/star/awt/XProgressBar.hpp>
15688 +#include <com/sun/star/awt/XSimpleTabController.hpp>
15689 +#include <com/sun/star/awt/XTabListener.hpp>
15690 +#include <com/sun/star/graphic/XGraphic.hpp>
15691 +#include <comphelper/processfactory.hxx>
15692 +#include <layout/core/factory.hxx>
15693 +#include <layout/core/localized-string.hxx>
15694 +#include <layout/core/root.hxx>
15695 +#include <toolkit/awt/vclxwindow.hxx>
15696 +#include <vcl/ctrl.hxx>
15697 +#include <vcl/dialog.hxx>
15698 +#include <vcl/image.hxx>
15699 +#include <vcl/tabctrl.hxx>
15700 +#include <vcl/tabpage.hxx>
15701 +#include <vcl/window.hxx>
15703 +using namespace ::com::sun::star;
15704 +using rtl::OUString;
15709 +// Context bits ...
15712 + uno::Reference< awt::XLayoutRoot > mxRoot;
15713 + uno::Reference< container::XNameAccess > mxNameAccess;
15714 + PeerHandle mxTopLevel;
15717 + ContextImpl( char const *pPath )
15719 + uno::Sequence< uno::Any > aParams( 1 );
15720 + aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 );
15722 + uno::Reference< lang::XSingleServiceFactory > xFactory(
15723 + comphelper::createProcessComponent(
15724 + OUString::createFromAscii( "com.sun.star.awt.Layout" ) ),
15725 + uno::UNO_QUERY );
15726 + if ( !xFactory.is() )
15728 + throw uno::RuntimeException(
15729 + OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
15730 + uno::Reference< uno::XInterface >() );
15732 + mxRoot = uno::Reference< awt::XLayoutRoot >(
15733 + xFactory->createInstanceWithArguments( aParams ),
15734 + uno::UNO_QUERY );
15736 + mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY );
15743 + PeerHandle getByName( const OUString &rName )
15745 + uno::Any val = mxNameAccess->getByName( rName );
15750 + PeerHandle getTopLevel()
15752 + return mxTopLevel;
15754 + void setTopLevel( PeerHandle xToplevel )
15756 + mxTopLevel = xToplevel;
15758 + PeerHandle getRoot()
15764 +Context::Context( const char *pPath )
15765 + : pImpl( new ContextImpl( pPath ) )
15768 +Context::~Context()
15774 +void Context::setToplevel( PeerHandle xToplevel )
15776 + pImpl->setTopLevel( xToplevel );
15779 +PeerHandle Context::getToplevel()
15781 + return pImpl->getTopLevel();
15783 +PeerHandle Context::getRoot()
15785 + return pImpl->getRoot();
15788 +PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const
15790 + PeerHandle xHandle;
15791 + xHandle = pImpl->getByName( OUString( id, strlen( id ), RTL_TEXTENCODING_UTF8 ) );
15792 + if ( !xHandle.is() )
15794 + DBG_ERROR1( "Failed to fetch widget '%s'", id );
15799 + rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId );
15800 + xHandle = GetPeerHandle( aStr, 0 );
15805 +WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window)
15806 + : mpWindow (window)
15807 + , mpCtx (context)
15808 + , mxWindow (peer, uno::UNO_QUERY)
15809 + , mxVclPeer (peer, uno::UNO_QUERY)
15811 + , bFirstTimeVisible (true)
15815 +WindowImpl::~WindowImpl ()
15818 + mpWindow->mpImpl = 0;
15821 + VCLXWindow *v = mvclWindow->GetWindowPeer ();
15822 + v->SetWindow (0);
15823 + mvclWindow->SetComponentInterface (uno::Reference <awt::XWindowPeer> ());
15824 + mvclWindow->SetWindowPeer (uno::Reference <awt::XWindowPeer> (), 0);
15825 + delete mvclWindow;
15830 +void WindowImpl::wrapperGone ()
15833 + mpWindow->mpImpl = 0;
15836 + if ( mxWindow.is() )
15838 + uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY );
15839 + mxWindow.clear ();
15840 + if ( xComp.is() )
15841 + xComp->dispose();
15845 +void SAL_CALL WindowImpl::disposing (lang::EventObject const&)
15846 + throw (uno::RuntimeException)
15848 + if (mxWindow.is ())
15849 + mxWindow.clear ();
15852 +uno::Any WindowImpl::getProperty (char const* name)
15854 + if ( !this || !mxVclPeer.is() )
15855 + return css::uno::Any();
15856 + return mxVclPeer->getProperty
15857 + ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ) );
15860 +void WindowImpl::setProperty (char const *name, uno::Any any)
15862 + if ( !this || !mxVclPeer.is() )
15864 + mxVclPeer->setProperty
15865 + ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any );
15868 +void WindowImpl::redraw (bool resize)
15870 + uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY);
15871 + ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow ();
15872 + ::Window* parent = window->GetParent();
15873 + ::Rectangle r = Rectangle (parent->GetPosPixel (),
15874 + parent->GetSizePixel ());
15875 + parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
15877 + parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE);
15879 + parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
15880 + awt::PosSize::SIZE);
15883 +Window::Window( WindowImpl *pImpl )
15884 + : mpImpl( pImpl )
15886 + mpImpl->mvclWindow = GetVCLXWindow () ? GetWindow () : 0;
15891 + /* likely to be an UNO object - with floating references */
15893 + mpImpl->wrapperGone ();
15897 +///IMPL_GET_IMPL( Control );
15899 +static ControlImpl& null_control_impl = (ControlImpl&)*(ControlImpl*)0;
15901 +ControlImpl &Control::getImpl () const
15903 + if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl))
15905 + return null_control_impl;
15908 +Control::~Control ()
15910 + SetGetFocusHdl (Link ());
15911 + SetLoseFocusHdl (Link ());
15914 +void Window::setRes (ResId const& res)
15916 +#if RESOURCE_PUBLISH_PROTECTED
15917 + // Resources are shut-off from use. Is that really necessary?
15918 + Resource &r = *GetWindow ();
15920 +#else /* !RESOURCE_PUBLISH_PROTECTED */
15921 + //We *must* derive. Is this also really necessary?
15922 + //Resource r (res);
15924 + // ugh, I wonder which solution is cleaner...
15925 + class Resource_open_up : public Resource
15928 + Resource_open_up (ResId const& r)
15932 + static sal_Int32 GetLongRes (void *p)
15934 + return Resource::GetLongRes (p);
15936 + void* GetClassRes ()
15938 + return Resource::GetClassRes ();
15940 + sal_Int32 ReadLongRes ()
15942 + return Resource::ReadLongRes ();
15944 + UniString ReadStringRes ()
15946 + return Resource::ReadStringRes ();
15950 + Resource_open_up r (res);
15951 +#endif /* !RESOURCE_PUBLISH_PROTECTED */
15952 + if (sal_uInt32 help_id = (sal_uInt32)r.GetLongRes (static_cast<char *> (r.GetClassRes ()) + 12))
15953 + SetHelpId (help_id);
15954 + sal_uInt32 mask = r.ReadLongRes ();
15955 + if ( mask & WINDOW_TEXT )
15956 + SetText( r.ReadStringRes ());
15959 +void Window::SetParent( ::Window *parent )
15961 + uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY );
15962 + if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref ))
15963 + if (::Window *window = vcl->GetWindow())
15964 + window->SetParent( parent );
15967 +void Window::SetParent( Window *parent )
15969 + /* Let's hear it for C++: poor man's dynamic binding. */
15970 + parent->ParentSet (this);
15973 +void Window::ParentSet (Window *window)
15975 + window->SetParent (GetWindow ());
15978 +Context *Window::getContext()
15980 + return this && mpImpl ? mpImpl->mpCtx : NULL;
15983 +PeerHandle Window::GetPeer() const
15986 + return PeerHandle();
15987 + return mpImpl->mxWindow;
15990 +uno::Reference<awt::XWindow> Window::GetRef() const
15992 + return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
15995 +VCLXWindow* Window::GetVCLXWindow() const
15997 + return VCLXWindow::GetImplementation( GetRef() );
16000 +::Window* Window::GetWindow() const
16002 + return GetVCLXWindow()->GetWindow();
16005 +::Window* Window::GetParent() const
16007 + return GetWindow()->GetParent();
16010 +void Window::SetHelpId( sal_uIntPtr id )
16012 + GetWindow()->SetHelpId( id );
16015 +sal_uIntPtr Window::GetHelpId() const
16017 + return GetWindow()->GetHelpId();
16020 +void Window::SetSmartHelpId( SmartId const& id, SmartIdUpdateMode mode )
16022 + GetWindow()->SetSmartHelpId( id, mode );
16025 +SmartId Window::GetSmartHelpId() const
16027 + return GetWindow()->GetSmartHelpId();
16030 +void Window::EnterWait ()
16032 + GetWindow()->EnterWait ();
16034 +void Window::LeaveWait ()
16036 + GetWindow()->LeaveWait ();
16038 +bool Window::IsWait () const
16040 + return GetWindow()->IsWait ();
16043 +bool Window::IsVisible () const
16045 + if (GetWindow ())
16046 + return GetWindow()->IsVisible ();
16050 +bool Window::HasChildPathFocus (bool systemWindow) const
16052 + return GetWindow()->HasChildPathFocus (systemWindow);
16055 +void Window::SetPosPixel (Point const&)
16059 +Point Window::GetPosPixel () const
16064 +void Window::SetSizePixel (Size const&)
16068 +Size Window::GetSizePixel () const
16073 +// void Window::Enable (bool enable, bool child);
16075 +// GetWindow ()->Enable (enable, child);
16078 +// void Window::Disable (bool child)
16080 +// GetWindow ()->Disable (child);
16083 +bool Window::IsEnabled () const
16085 + return GetWindow ()->IsEnabled ();
16086 +// if (getImpl().mxWindow.is ())
16087 +// return getImpl ().mxWindow->isEnabled ();
16091 +void Window::EnableInput (bool enable, bool child)
16093 + GetWindow ()->EnableInput (enable, child);
16096 +bool Window::IsInputEnabled () const
16098 + return GetWindow ()->IsInputEnabled ();
16101 +struct ToolkitVclPropsMap
16103 + WinBits vclStyle;
16105 + const char *propName;
16107 + // the value to give the prop to enable/disable it -- not the most brilliant
16108 + // type declaration and storage, but does the work... properties are
16109 + // either a boolean or a short since they are either a directly wrappers for
16110 + // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER).
16112 + short enableProp, disableProp;
16115 +#define TYPE_BOOL true
16116 +#define TYPE_SHORT false
16118 +static const ToolkitVclPropsMap toolkitVclPropsMap[] =
16120 + { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 },
16121 + { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 },
16122 + { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 },
16123 + { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 },
16124 + { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 },
16126 + { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 },
16127 + { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 },
16128 + { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 },
16129 + { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 },
16130 + { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 },
16131 + { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 },
16132 + { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 },
16133 + { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 },
16134 + { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 },
16135 + { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 },
16136 + { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 },
16137 + { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 },
16139 + { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 },
16140 + { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 },
16141 + { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 },
16142 + { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 },
16143 + { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 },
16144 + { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 },
16145 + { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 },
16146 + { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 },
16147 + { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 },
16148 + { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 },
16150 + { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 },
16151 + { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 },
16153 + { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 },
16154 + { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 },
16155 + { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 },
16156 + { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 },
16157 + { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 },
16163 +static const int toolkitVclPropsMapLen =
16164 + sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap );
16166 +void Window::SetStyle( WinBits nStyle )
16168 + uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
16169 + for (int i = 0; i < toolkitVclPropsMapLen; i++)
16171 + if ( toolkitVclPropsMap[ i ].propName )
16174 + if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
16175 + nValue = toolkitVclPropsMap[ i ].enableProp;
16177 + nValue = toolkitVclPropsMap[ i ].disableProp;
16179 + if ( toolkitVclPropsMap[ i ].isBoolean )
16180 + aValue = uno::makeAny( (bool) nValue );
16182 + aValue = uno::makeAny( (short) nValue );
16183 + mpImpl->setProperty( toolkitVclPropsMap[ i ].propName, aValue );
16188 +WinBits Window::GetStyle()
16190 + uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
16192 + for (int i = 0; i < toolkitVclPropsMapLen; i++)
16194 + if ( toolkitVclPropsMap[ i ].propName )
16196 + short nValue = 0;
16197 + if ( toolkitVclPropsMap[ i ].isBoolean )
16199 + bool bValue = false;
16200 + mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= bValue;
16201 + nValue = bValue ? 1 : 0;
16204 + mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= nValue;
16205 + if ( nValue == toolkitVclPropsMap[ i ].enableProp )
16206 + ret |= toolkitVclPropsMap[i].vclStyle;
16212 +/* Unpleasant way to get an xToolkit pointer ... */
16213 +uno::Reference< awt::XToolkit > getToolkit()
16215 + static uno::Reference< awt::XToolkit > xToolkit;
16216 + if (!xToolkit.is())
16219 + xToolkit = uno::Reference< awt::XToolkit >(
16220 + ::comphelper::getProcessServiceFactory()->createInstance(
16221 + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
16222 + uno::UNO_QUERY );
16223 + if ( !xToolkit.is() )
16224 + throw uno::RuntimeException(
16225 + OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ),
16226 + uno::Reference< uno::XInterface >() );
16231 +PeerHandle Window::CreatePeer( Window *parent, WinBits nStyle, const char *pName)
16233 + long nWinAttrbs = 0;
16234 + for (int i = 0; i < toolkitVclPropsMapLen; i++)
16235 + if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
16236 + nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr;
16238 + return layoutimpl::WidgetFactory::createWidget (getToolkit(), parent->GetPeer(), OUString::createFromAscii( pName ), nWinAttrbs);
16241 +void Window::Enable( bool bEnable )
16243 + if ( !getImpl().mxWindow.is() )
16245 + getImpl().mxWindow->setEnable( bEnable );
16248 +void Window::Show( bool bVisible )
16250 + if ( !getImpl().mxWindow.is() )
16252 + getImpl().mxWindow->setVisible( bVisible );
16253 + if (GetParent() && bVisible && getImpl().bFirstTimeVisible)
16255 + getImpl().redraw ();
16256 + getImpl().bFirstTimeVisible = false;
16260 +void Window::GrabFocus()
16262 + if ( !getImpl().mxWindow.is() )
16264 + getImpl().mxWindow->setFocus();
16267 +void Window::SetUpdateMode(bool mode)
16269 + GetWindow()->SetUpdateMode( mode );
16272 +void Window::SetPointer( Pointer const& pointer )
16274 + GetWindow()->SetPointer( pointer );
16277 +Pointer const& Window::GetPointer() const
16279 + return GetWindow()->GetPointer();
16282 +void Window::SetText( OUString const& str )
16284 + GetWindow()->SetText( str );
16287 +String Window::GetText() const
16289 + return GetWindow()->GetText();
16292 +sal_Int32 Window::GetCtrlTextWidth (OUString const&) const
16297 +sal_Int32 Window::GetTextHeight () const
16302 +Size Window::LogicToPixel( Size const& size, MapMode const&) const
16307 +ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window)
16308 + : WindowImpl( context, peer, window )
16312 +ControlImpl::~ControlImpl ()
16314 + if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ())
16315 + /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear()
16316 + don't do it twice */
16317 + mxWindow.clear ();
16320 +void ControlImpl::SetGetFocusHdl (Link const& link)
16322 + if (!mLoseFocusHdl || !link)
16323 + UpdateListening (link);
16324 + mGetFocusHdl = link;
16327 +Link& ControlImpl::GetGetFocusHdl ()
16329 + return mGetFocusHdl;
16332 +void ControlImpl::SetLoseFocusHdl (Link const& link)
16334 + if (!mGetFocusHdl || !link)
16335 + UpdateListening (link);
16336 + mLoseFocusHdl = link;
16339 +Link& ControlImpl::GetLoseFocusHdl ()
16341 + return mGetFocusHdl;
16344 +void ControlImpl::UpdateListening (Link const& link)
16346 + if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl)
16347 + && (!mGetFocusHdl || !mLoseFocusHdl))
16348 + mxWindow->removeFocusListener (this);
16349 + else if (!!link && !mGetFocusHdl && !mLoseFocusHdl)
16350 + mxWindow->addFocusListener (this);
16353 +void SAL_CALL ControlImpl::disposing (lang::EventObject const&)
16354 + throw (uno::RuntimeException)
16356 +/// mxWindow.clear ();
16359 +void SAL_CALL ControlImpl::focusGained (awt::FocusEvent const&)
16360 + throw (uno::RuntimeException)
16362 + mGetFocusHdl.Call (mpWindow);
16365 +void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&)
16366 + throw (uno::RuntimeException)
16368 + mLoseFocusHdl.Call (mpWindow);
16371 +Link& Control::GetGetFocusHdl ()
16373 + return getImpl ().GetGetFocusHdl ();
16376 +void Control::SetGetFocusHdl (Link const& link)
16378 + if (&getImpl () && getImpl().mxWindow.is ())
16379 + getImpl ().SetGetFocusHdl (link);
16382 +Link& Control::GetLoseFocusHdl ()
16384 + return getImpl ().GetLoseFocusHdl ();
16387 +void Control::SetLoseFocusHdl (Link const& link)
16389 + if (&getImpl () && getImpl().mxWindow.is ())
16390 + getImpl ().SetLoseFocusHdl (link);
16393 +class DialogImpl : public WindowImpl
16396 + uno::Reference< awt::XDialog2 > mxDialog;
16397 + DialogImpl( Context *context, PeerHandle const &peer, Window *window );
16400 +DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window )
16401 + : WindowImpl( context, peer, window )
16402 + , mxDialog( peer, uno::UNO_QUERY )
16406 +Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
16407 + : Context( xml_file )
16408 + , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
16409 + , bConstruct (true)
16412 + SetParent( parent );
16415 +Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
16416 + : Context( xml_file )
16417 + , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
16420 + SetParent( parent );
16423 +Dialog::~Dialog ()
16427 +IMPL_GET_WINDOW (Dialog);
16428 +IMPL_GET_IMPL (Dialog);
16430 +#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog
16431 +#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog
16433 +short Dialog::Execute()
16435 + RETURN_MX_DIALOG->execute ();
16439 +void Dialog::EndDialog( long result )
16441 + MX_DIALOG->endDialog (result);
16444 +void Dialog::SetText( OUString const& str )
16449 +void Dialog::SetTitle( OUString const& str )
16451 + MX_DIALOG->setTitle (str);
16454 +bool Dialog::Close ()
16456 + EndDialog (false);
16460 +long Dialog::Notify (NotifyEvent& event)
16462 + return GetDialog ()->Notify (event);
16465 +void Dialog::Initialize (SfxChildWinInfo*)
16469 +#define MESSAGE_BOX_MEMBER_INIT\
16470 + Dialog (parent, xml_file, id)\
16471 + , imageError (this, "FI_ERROR")\
16472 + , imageInfo (this, "FI_INFO")\
16473 + , imageQuery (this, "FI_QUERY")\
16474 + , imageWarning (this, "FI_WARNING")\
16475 + , messageText (this, "FT_MESSAGE")\
16476 + , cancelButton (this, "BTN_CANCEL")\
16477 + , helpButton (this, "BTN_HELP")\
16478 + , ignoreButton (this, "BTN_IGNORE")\
16479 + , noButton (this, "BTN_NO")\
16480 + , retryButton (this, "BTN_RETRY")\
16481 + , yesButton (this, "BTN_YES")
16483 +MessageBox::MessageBox (::Window *parent, char const* message,
16484 + char const* yes, char const* no, sal_uIntPtr help_id,
16485 + char const* xml_file, char const* id)
16486 + : MESSAGE_BOX_MEMBER_INIT
16488 + ignoreButton.Hide ();
16489 + retryButton.Hide ();
16490 + init (message, yes, no, help_id);
16493 +MessageBox::MessageBox (::Window *parent, OUString const& message,
16494 + OUString yes, OUString no, sal_uIntPtr help_id,
16495 + char const* xml_file, char const* id)
16496 + : MESSAGE_BOX_MEMBER_INIT
16498 + ignoreButton.Hide ();
16499 + retryButton.Hide ();
16500 + init (message, yes, no, help_id);
16503 +#if !defined (__GNUC__)
16504 +#define __PRETTY_FUNCTION__ __FUNCTION__
16505 +#endif /* !__GNUC__ */
16507 +MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message,
16508 + char const* yes, char const* no, sal_uIntPtr help_id,
16509 + char const* xml_file, char const* id)
16510 + : MESSAGE_BOX_MEMBER_INIT
16512 + // HIG suggests using verbs instead of yes/no/retry etc.
16513 + // This constructor provides client-code compatibility: Client code should be fixed.
16514 + OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
16515 + bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
16518 +MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message,
16519 + OUString yes, OUString no, sal_uIntPtr help_id,
16520 + char const* xml_file, char const* id)
16521 + : MESSAGE_BOX_MEMBER_INIT
16523 + // HIG suggests using verbs instead of yes/no/retry etc.
16524 + // This constructor provides client-code compatibility: Client code should be fixed.
16525 + OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
16526 + bits_init (bits, message, yes, no, help_id);
16529 +void MessageBox::bits_init (WinBits bits, OUString const& message,
16530 + OUString yes, OUString no, sal_uIntPtr help_id)
16532 + if ( bits & ( WB_OK_CANCEL | WB_OK ))
16533 + yes = Button::GetStandardText ( BUTTON_OK );
16534 + if ( bits & (WB_YES_NO | WB_YES_NO_CANCEL ))
16536 + yes = Button::GetStandardText ( BUTTON_YES );
16537 + no = Button::GetStandardText ( BUTTON_NO );
16539 + if (! (bits & (WB_RETRY_CANCEL | WB_YES_NO_CANCEL | WB_ABORT_RETRY_IGNORE )))
16540 + cancelButton.Hide ();
16541 + if (! (bits & (WB_RETRY_CANCEL | WB_ABORT_RETRY_IGNORE)))
16542 + retryButton.Hide ();
16543 + if ( bits & WB_ABORT_RETRY_IGNORE )
16544 + cancelButton.SetText ( Button::GetStandardText (BUTTON_ABORT));
16546 + ignoreButton.Hide ();
16547 + if ( !(bits & ( WB_OK | WB_OK_CANCEL | WB_YES_NO | WB_YES_NO_CANCEL)))
16548 + yesButton.Hide ();
16549 + if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL)))
16550 + noButton.Hide ();
16552 + init (message, yes, no, help_id);
16555 +void MessageBox::init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id)
16557 + init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
16560 +void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, sal_uIntPtr help_id)
16562 + imageError.Hide ();
16563 + imageInfo.Hide ();
16564 + imageQuery.Hide ();
16565 + imageWarning.Hide ();
16566 + if (message.getLength ())
16567 + messageText.SetText (message);
16568 + if (yes.getLength ())
16570 + yesButton.SetText (yes);
16571 + if (yes != OUString (Button::GetStandardText (BUTTON_OK))
16572 + && yes != OUString (Button::GetStandardText (BUTTON_YES)))
16574 + if (no.getLength ())
16575 + noButton.SetText (no);
16577 + noButton.Hide ();
16580 + SetHelpId (help_id);
16582 + helpButton.Hide ();
16585 +#undef MESSAGE_BOX_IMPL
16586 +#define MESSAGE_BOX_IMPL(Name)\
16587 + Name##Box::Name##Box (::Window *parent, char const* message,\
16588 + char const* yes, char const* no, sal_uIntPtr help_id,\
16589 + char const* xml_file, char const* id)\
16590 + : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
16592 + image##Name.Show ();\
16594 + Name##Box::Name##Box (::Window *parent, OUString const& message,\
16595 + OUString yes, OUString no, sal_uIntPtr help_id,\
16596 + char const* xml_file, char const* id)\
16597 + : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
16599 + image##Name.Show ();\
16601 + Name##Box::Name##Box (::Window *parent, WinBits bits, char const* message,\
16602 + char const* yes, char const* no, sal_uIntPtr help_id,\
16603 + char const* xml_file, char const* id)\
16604 + : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
16606 + image##Name.Show ();\
16608 + Name##Box::Name##Box (::Window *parent, WinBits bits, OUString const& message,\
16609 + OUString yes, OUString no, sal_uIntPtr help_id,\
16610 + char const* xml_file, char const* id)\
16611 + : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
16613 + image##Name.Show ();\
16616 +MESSAGE_BOX_IMPL (Error);
16617 +MESSAGE_BOX_IMPL (Info);
16618 +MESSAGE_BOX_IMPL (Query);
16619 +MESSAGE_BOX_IMPL (Warning);
16621 +class TabControlImpl
16622 + : public ControlImpl
16623 + , public ::cppu::WeakImplHelper1 <awt::XTabListener>
16625 + Link mActivatePageHdl;
16626 + Link mDeactivatePageHdl;
16629 + uno::Reference <awt::XSimpleTabController> mxTabControl;
16630 + TabControlImpl (Context *context, const PeerHandle &peer, Window *window)
16631 + : ControlImpl (context, peer, window)
16632 + , mxTabControl (peer, uno::UNO_QUERY)
16636 + virtual void SAL_CALL disposing (lang::EventObject const& e)
16637 + throw (uno::RuntimeException)
16639 + ControlImpl::disposing (e);
16640 + mxTabControl.clear ();
16643 + Link& GetActivatePageHdl ()
16645 + return mActivatePageHdl;
16648 + void SetActivatePageHdl (Link const& link)
16650 + if (!mDeactivatePageHdl || !link)
16651 + UpdateListening (link);
16652 + mActivatePageHdl = link;
16655 + Link& GetDeactivatePageHdl ()
16657 + return mDeactivatePageHdl;
16660 + void SetDeactivatePageHdl (Link const& link)
16662 + if (!mActivatePageHdl || !link)
16663 + UpdateListening (link);
16664 + mDeactivatePageHdl = link;
16667 + void UpdateListening (Link const& link)
16669 + if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl))
16670 + mxTabControl->removeTabListener (this);
16671 + else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl)
16672 + mxTabControl->addTabListener (this);
16675 + void SAL_CALL activated (sal_Int32)
16676 + throw (uno::RuntimeException)
16678 + mActivatePageHdl.Call (mpWindow);
16681 + void SAL_CALL deactivated (sal_Int32)
16682 + throw (uno::RuntimeException)
16684 + mDeactivatePageHdl.Call (mpWindow);
16687 + void SAL_CALL inserted (sal_Int32)
16688 + throw (uno::RuntimeException)
16692 + void SAL_CALL removed (sal_Int32)
16693 + throw (uno::RuntimeException)
16697 + void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&)
16698 + throw (uno::RuntimeException)
16703 +IMPL_GET_WINDOW (TabControl);
16704 +IMPL_GET_LAYOUT_VCLXWINDOW (TabControl);
16706 +#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl
16707 +#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl
16709 +TabControl::~TabControl ()
16711 + SetActivatePageHdl (Link ());
16712 + SetDeactivatePageHdl (Link ());
16715 +void TabControl::InsertPage (sal_uInt16 id, OUString const& title, sal_uInt16 pos)
16718 +// GetTabControl ()->InsertPage (id, title, pos);
16719 +// GetTabControl ()->SetTabPage (id, new ::TabPage (GetTabControl ()));
16721 + MX_TABCONTROL->insertTab ();
16722 + SetCurPageId (id);
16724 +#if 1 // colour me loc productive -- NOT
16725 +#define ADD_PROP( seq, i, name, val )\
16727 + beans::NamedValue value; \
16728 + value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
16729 + value.Value = uno::makeAny( val ); \
16730 + seq[i] = value; \
16733 + uno::Sequence< beans::NamedValue > seq (1);
16734 + ADD_PROP ( seq, 0, "Title", OUString (title) );
16735 + MX_TABCONTROL->setTabProps (id, seq);
16737 + GetTabPage (id)->SetText (title);
16741 + /// This so seems the right solution, but it makes the buttons of the
16742 + /// tabdialog move up
16744 + ::TabPage *page = GetTabPage (id);
16745 + if (Window *w = dynamic_cast <Window*> (page))
16747 + w->SetParent (this);
16748 + //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16749 + //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16750 + //GetVCLXTabControl ()->AddChild (w);
16751 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16752 + //uno::Reference <uno::XInterface> x (page->GetWindowPeer());
16753 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->::Window::GetWindowPeer (), uno::UNO_QUERY));
16754 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
16756 + getImpl ().redraw ();
16759 +void TabControl::RemovePage (sal_uInt16 id)
16761 + GetTabControl ()->RemovePage (id);
16763 +sal_uInt16 TabControl::GetPageCount () const
16765 + return GetTabControl ()->GetPageCount ();
16767 +sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const
16769 + return GetTabControl ()->GetPageId (pos);
16771 +sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const
16773 + getImpl ().redraw ();
16774 + return GetTabControl ()->GetPagePos (id);
16776 +void TabControl::SetCurPageId (sal_uInt16 id)
16778 + getImpl ().redraw ();
16779 + GetTabControl ()->SetCurPageId (id);
16781 +sal_uInt16 TabControl::GetCurPageId () const
16783 + return GetTabControl ()->GetCurPageId ();
16785 +void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page)
16787 + GetTabControl ()->SetTabPage (id, page);
16790 + /// This so seems the right solution, but it makes the buttons of the
16791 + /// tabdialog move up
16792 + if (Window *w = dynamic_cast <Window*> (page))
16794 + w->SetParent (this);
16795 + //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16796 + //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16797 + //GetVCLXTabControl ()->AddChild (w);
16798 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
16799 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetWindowPeer (), uno::UNO_QUERY));
16800 + //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
16803 + getImpl ().redraw ();
16805 +::TabPage* TabControl::GetTabPage (sal_uInt16 id) const
16807 + return GetTabControl ()->GetTabPage (id);
16809 +void TabControl::SetActivatePageHdl (Link const& link)
16811 + if (&getImpl () && getImpl().mxTabControl.is ())
16812 + getImpl ().SetActivatePageHdl (link);
16814 +Link& TabControl::GetActivatePageHdl () const
16816 + return getImpl ().GetActivatePageHdl ();
16818 +void TabControl::SetDeactivatePageHdl (Link const& link)
16820 + if (&getImpl () && getImpl().mxTabControl.is ())
16821 + getImpl ().SetDeactivatePageHdl (link);
16823 +Link& TabControl::GetDeactivatePageHdl () const
16825 + return getImpl ().GetDeactivatePageHdl ();
16827 +void TabControl::SetTabPageSizePixel (Size const& size)
16829 + GetTabControl ()->SetTabPageSizePixel (size);
16830 +// GetParent()->SetSizePixel (size);
16831 +// GetWindow()->SetSizePixel (size);
16832 + //GetVCLXTabControl->SetTabSize (size);
16834 +Size TabControl::GetTabPageSizePixel () const
16837 + //return GetTabControl ()->GetTabPageSizePixel ();
16838 + static size_t const tab_page_first_index = 1;
16839 + for (size_t i = 0; i < GetPageCount (); i++)
16841 + ::TabPage *p = GetTabPage (i + tab_page_first_index);
16842 + //if (dynamic_cast<Windowt*> (p))
16844 + return p->GetOptimalSize (WINDOWSIZE_MINIMUM);
16847 + return GetTabControl ()->GetTabPageSizePixel ();
16850 +IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol");
16851 +IMPL_GET_IMPL (TabControl);
16853 +class TabPageImpl : public WindowImpl
16856 + uno::Reference< awt::XWindow > mxTabPage;
16857 + TabPageImpl( Context *context, const PeerHandle &peer, Window *window )
16858 + : WindowImpl( context, peer, window )
16859 + , mxTabPage( peer, uno::UNO_QUERY )
16864 +::Window* TabPage::global_parent = 0;
16865 +TabControl* TabPage::global_tabcontrol = 0;
16867 +IMPL_GET_IMPL( TabPage );
16869 +TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
16870 + : Context( xml_file )
16871 + , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
16874 + SetParent( parent );
16877 +TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
16878 + : Context( xml_file )
16879 + , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
16882 + SetParent( parent );
16885 +TabPage::~TabPage()
16887 + delete GetTabPage();
16890 +IMPL_GET_WINDOW( TabPage );
16892 +void TabPage::ActivatePage()
16896 +void TabPage::DeactivatePage()
16900 +class FixedLineImpl : public ControlImpl
16903 + FixedLineImpl( Context *context, const PeerHandle &peer, Window *window )
16904 + : ControlImpl( context, peer, window )
16909 +IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" );
16910 +IMPL_GET_IMPL( FixedLine );
16912 +bool FixedLine::IsEnabled()
16918 +class FixedTextImpl : public ControlImpl
16921 + uno::Reference< awt::XFixedText > mxFixedText;
16922 + FixedTextImpl( Context *context, const PeerHandle &peer, Window *window )
16923 + : ControlImpl( context, peer, window )
16924 + , mxFixedText( peer, uno::UNO_QUERY )
16928 + ~FixedTextImpl ();
16930 + virtual void SAL_CALL disposing( lang::EventObject const& e )
16931 + throw (uno::RuntimeException);
16934 +FixedTextImpl::~FixedTextImpl ()
16938 +void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e )
16939 + throw (uno::RuntimeException)
16941 + ControlImpl::disposing (e);
16942 + mxFixedText.clear ();
16945 +FixedText::~FixedText ()
16949 +IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" );
16950 +IMPL_GET_IMPL( FixedText );
16952 +void FixedText::SetText( OUString const& rStr )
16954 + if ( !getImpl().mxFixedText.is() )
16956 + getImpl().mxFixedText->setText( rStr );
16959 +class FixedInfoImpl : public FixedTextImpl
16962 + FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window )
16963 + : FixedTextImpl( context, peer, window )
16968 +IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" );
16969 +IMPL_GET_IMPL( FixedInfo );
16971 +class ProgressBarImpl : public ControlImpl
16974 + uno::Reference< awt::XProgressBar > mxProgressBar;
16975 + ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window )
16976 + : ControlImpl( context, peer, window )
16977 + , mxProgressBar( peer, uno::UNO_QUERY )
16981 + virtual void SAL_CALL disposing( lang::EventObject const& e )
16982 + throw (uno::RuntimeException)
16984 + ControlImpl::disposing (e);
16985 + mxProgressBar.clear ();
16990 +class FixedImageImpl: public ControlImpl
16993 + uno::Reference< graphic::XGraphic > mxGraphic;
16994 + FixedImageImpl( Context *context, const PeerHandle &peer, Window *window)
16995 +// const char *pName )
16996 + : ControlImpl( context, peer, window )
16997 + //, mxGraphic( layoutimpl::loadGraphic( pName ) )
16998 + , mxGraphic( peer, uno::UNO_QUERY )
17000 + if ( !mxGraphic.is() )
17002 + DBG_ERROR( "ERROR: failed to load image: `%s'" /*, pName*/ );
17006 + getImpl().mxGraphic->...();
17011 +IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" );
17012 +IMPL_GET_IMPL( FixedImage )
17014 +void FixedImage::setImage( ::Image const& i )
17017 + if ( !getImpl().mxGraphic.is() )
17019 + //FIXME: hack moved to proplist
17020 + //getImpl().mxGraphic =
17025 +FixedImage::FixedImage( const char *pName )
17026 + : pImpl( new FixedImageImpl( pName ) )
17030 +FixedImage::~FixedImage()
17038 +IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
17039 +IMPL_GET_IMPL( ProgressBar );
17041 +void ProgressBar::SetForegroundColor( util::Color color )
17043 + if ( !getImpl().mxProgressBar.is() )
17045 + getImpl().mxProgressBar->setForegroundColor( color );
17048 +void ProgressBar::SetBackgroundColor( util::Color color )
17050 + if ( !getImpl().mxProgressBar.is() )
17052 + getImpl().mxProgressBar->setBackgroundColor( color );
17055 +void ProgressBar::SetValue( sal_Int32 i )
17057 + if ( !getImpl().mxProgressBar.is() )
17059 + getImpl().mxProgressBar->setValue( i );
17062 +void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max )
17064 + if ( !getImpl().mxProgressBar.is() )
17066 + getImpl().mxProgressBar->setRange( min, max );
17069 +sal_Int32 ProgressBar::GetValue()
17071 + if ( !getImpl().mxProgressBar.is() )
17073 + return getImpl().mxProgressBar->getValue();
17076 +class PluginImpl: public ControlImpl
17079 + ::Control *mpPlugin;
17081 + PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin )
17082 + : ControlImpl( context, peer, window )
17083 + , mpPlugin( plugin )
17085 + uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
17086 + layoutimpl::VCLXPlugin *vcl
17087 + = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) );
17088 + ::Window *parent = vcl->mpWindow->GetParent();
17089 + vcl->SetWindow( plugin );
17090 + vcl->SetPlugin( mpPlugin );
17091 + plugin->SetParent( parent );
17092 + plugin->SetStyle( vcl->mStyle );
17093 + plugin->SetCreatedWithToolkit( true );
17094 + plugin->SetComponentInterface( vcl );
17099 +Plugin::Plugin( Context *context, char const *id, ::Control *plugin )
17100 + : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) )
17101 + , mpPlugin( plugin )
17105 +IMPL_GET_IMPL( Plugin );
17107 +class LocalizedStringImpl : public WindowImpl
17110 + layoutimpl::LocalizedString *mpString;
17111 + LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window )
17112 + : WindowImpl( context, peer, window )
17113 + , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) )
17116 + OUString getText()
17119 + return mpString->getText();
17120 + return OUString();
17122 + void setText( OUString const& s )
17125 + mpString->setText( s );
17129 +IMPL_GET_IMPL( LocalizedString );
17131 +LocalizedString::LocalizedString( Context *context, char const* id )
17132 + : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) )
17136 +String LocalizedString::getString ()
17138 + return getImpl ().getText ();
17141 +OUString LocalizedString::getOUString ()
17143 + return getImpl ().getText ();
17146 +LocalizedString::operator OUString ()
17148 + return getOUString ();
17151 +OUString LocalizedString::GetToken (sal_uInt32 i, sal_Char c)
17153 + return getString ().GetToken (i, c);
17156 +OUString LocalizedString::operator= (OUString const& s)
17158 + getImpl().setText( s );
17159 + return getImpl().getText();
17162 +OUString LocalizedString::operator+= (OUString const& b)
17164 + OUString a = getImpl ().getText ();
17166 + getImpl ().setText (a);
17167 + return getImpl ().getText ();
17170 +OUString LocalizedString::operator+= (sal_Unicode const b)
17172 + String a = getImpl ().getText ();
17174 + getImpl ().setText (a);
17175 + return getImpl ().getText ();
17178 +class InPlugImpl : public WindowImpl
17181 + InPlugImpl (Context *context, const PeerHandle &peer, Window *window)
17182 + : WindowImpl (context, peer, window)
17187 +IMPL_GET_IMPL (InPlug);
17189 +static char const *FIXME_set_parent (::Window *parent, char const *xml_file)
17191 + layout::TabPage::global_parent = parent;
17195 +InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
17196 + : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file))
17197 + , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
17200 + SetParent (parent);
17201 + if (::Window *w = dynamic_cast< ::Window* > (this))
17202 + w->SetComponentInterface (GetVCLXWindow ());
17205 +InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
17206 + : Context (FIXME_set_parent (parent, xml_file))
17207 + , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
17210 + layout::Window::SetParent (parent);
17211 + if (::Window *w = dynamic_cast< ::Window* > (this))
17212 + w->SetComponentInterface (GetVCLXWindow ());
17215 +void InPlug::ParentSet (Window *window)
17217 + window->SetParent (dynamic_cast< ::Window* > (this));
17219 + /// FIXME: for standalone run of layout::SfxTabDialog
17220 + SetParent (window->GetParent ());
17223 +} // namespace layout
17224 --- toolkit/source/layout/vcl/wrapper.hxx.old 1970-01-01 00:00:00.000000000 +0000
17225 +++ toolkit/source/layout/vcl/wrapper.hxx 2009-04-06 16:42:13.000000000 +0000
17227 +/*************************************************************************
17229 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17231 + * Copyright 2008 by Sun Microsystems, Inc.
17233 + * OpenOffice.org - a multi-platform office productivity suite
17239 + * This file is part of OpenOffice.org.
17241 + * OpenOffice.org is free software: you can redistribute it and/or modify
17242 + * it under the terms of the GNU Lesser General Public License version 3
17243 + * only, as published by the Free Software Foundation.
17245 + * OpenOffice.org is distributed in the hope that it will be useful,
17246 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17247 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17248 + * GNU Lesser General Public License version 3 for more details
17249 + * (a copy is included in the LICENSE file that accompanied this code).
17251 + * You should have received a copy of the GNU Lesser General Public License
17252 + * version 3 along with OpenOffice.org. If not, see
17253 + * <http://www.openoffice.org/license.html>
17254 + * for a copy of the LGPLv3 License.
17256 + ************************************************************************/
17258 +#ifndef LAYOUT_VCL_WRAPPER_HXX
17259 +#define LAYOUT_VCL_WRAPPER_HXX
17261 +#include <layout/layout.hxx>
17262 +#include <com/sun/star/uno/Reference.hxx>
17263 +#include <com/sun/star/awt/XDialog2.hpp>
17264 +#include <com/sun/star/awt/XFocusListener.hpp>
17265 +#include <com/sun/star/awt/XWindow.hpp>
17266 +#include <com/sun/star/awt/XVclWindowPeer.hpp>
17267 +#include <cppuhelper/implbase1.hxx>
17269 +#include <cstring>
17274 +namespace css = com::sun::star;
17279 + Window *mpWindow;
17281 + css::uno::Reference< css::awt::XWindow > mxWindow;
17282 + css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer;
17283 + ::Window *mvclWindow;
17284 + bool bFirstTimeVisible;
17286 + WindowImpl (Context *context, PeerHandle const &peer, Window *window);
17287 + virtual ~WindowImpl ();
17289 + void wrapperGone();
17290 + css::uno::Any getProperty (char const *name);
17291 + void setProperty (char const *name, css::uno::Any any);
17292 + void redraw (bool resize=false);
17294 + // XFocusListener
17295 + virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
17298 +class ControlImpl : public WindowImpl
17299 + , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener>
17302 + Link mGetFocusHdl;
17303 + Link mLoseFocusHdl;
17305 + ControlImpl( Context *context, PeerHandle const& peer, Window *window );
17308 + virtual void SetGetFocusHdl (Link const& link);
17309 + Link& GetGetFocusHdl ();
17310 + virtual void SetLoseFocusHdl (Link const& link);
17311 + Link& GetLoseFocusHdl ();
17312 + virtual void UpdateListening (Link const& link);
17314 + // XFocusListener
17315 + virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
17316 + void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
17317 + void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
17320 +inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); }
17322 +// Helpers for defining boiler-plate constructors ...
17323 +// Could in-line in top-level but not with safe static_casts.
17324 +#define IMPL_GET_IMPL(t) \
17325 + inline t##Impl &t::getImpl() const \
17327 + return *(static_cast<t##Impl *>(mpImpl)); \
17329 +#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \
17330 + t::t( Context *context, const char *pId, sal_uInt32 nId ) \
17331 + : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
17333 + Window *parent = dynamic_cast<Window*> (context);\
17336 + SetParent (parent);\
17338 + t::t( Window *parent, WinBits bits) \
17339 + : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
17343 + SetParent (parent);\
17345 + t::t( Window *parent, ResId const& res) \
17346 + : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \
17351 + SetParent (parent);\
17353 +#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, )
17354 +#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \
17355 + t::t( Context *context, const char *pId, sal_uInt32 nId ) \
17356 + : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
17357 + , other_par( new other_par##Impl( Window::GetPeer() ) ) \
17360 + t::t( Window *parent, WinBits bits) \
17361 + : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
17362 + , other_par( new other_par##Impl( Window::GetPeer() ) ) \
17366 +} // namespace layout
17368 +#endif /* LAYOUT_VCL_WRAPPER_HXX */
17369 --- toolkit/source/vclcompat/makefile.mk.old 2009-04-02 10:49:35.000000000 +0000
17370 +++ toolkit/source/vclcompat/makefile.mk 1970-01-01 00:00:00.000000000 +0000
17372 -#*************************************************************************
17374 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17376 -# Copyright 2008 by Sun Microsystems, Inc.
17378 -# OpenOffice.org - a multi-platform office productivity suite
17380 -# $RCSfile: makefile.mk,v $
17382 -# $Revision: 1.3 $
17384 -# This file is part of OpenOffice.org.
17386 -# OpenOffice.org is free software: you can redistribute it and/or modify
17387 -# it under the terms of the GNU Lesser General Public License version 3
17388 -# only, as published by the Free Software Foundation.
17390 -# OpenOffice.org is distributed in the hope that it will be useful,
17391 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
17392 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17393 -# GNU Lesser General Public License version 3 for more details
17394 -# (a copy is included in the LICENSE file that accompanied this code).
17396 -# You should have received a copy of the GNU Lesser General Public License
17397 -# version 3 along with OpenOffice.org. If not, see
17398 -# <http://www.openoffice.org/license.html>
17399 -# for a copy of the LGPLv3 License.
17401 -#*************************************************************************
17406 -ENABLE_EXCEPTIONS=true
17408 -# --- Settings -----------------------------------------------------
17410 -.INCLUDE : settings.mk
17411 -.INCLUDE : $(PRJ)$/util$/makefile.pmk
17413 -# --- Files --------------------------------------------------------
17415 -# FIXME: This is bad, hmkay
17416 -CFLAGS+= -I$(PRJ)/source
17419 - $(SLO)$/wrapper.obj \
17420 - $(SLO)$/wbutton.obj \
17421 - $(SLO)$/wcontainer.obj \
17422 - $(SLO)$/wfield.obj
17424 -# --- Targets ------------------------------------------------------
17426 -.INCLUDE : target.mk
17427 --- toolkit/source/vclcompat/wbutton.cxx.old 2009-04-06 16:42:11.000000000 +0000
17428 +++ toolkit/source/vclcompat/wbutton.cxx 1970-01-01 00:00:00.000000000 +0000
17430 -/*************************************************************************
17432 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17434 - * Copyright 2008 by Sun Microsystems, Inc.
17436 - * OpenOffice.org - a multi-platform office productivity suite
17438 - * $RCSfile: wbutton.cxx,v $
17440 - * $Revision: 1.3 $
17442 - * This file is part of OpenOffice.org.
17444 - * OpenOffice.org is free software: you can redistribute it and/or modify
17445 - * it under the terms of the GNU Lesser General Public License version 3
17446 - * only, as published by the Free Software Foundation.
17448 - * OpenOffice.org is distributed in the hope that it will be useful,
17449 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17450 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17451 - * GNU Lesser General Public License version 3 for more details
17452 - * (a copy is included in the LICENSE file that accompanied this code).
17454 - * You should have received a copy of the GNU Lesser General Public License
17455 - * version 3 along with OpenOffice.org. If not, see
17456 - * <http://www.openoffice.org/license.html>
17457 - * for a copy of the LGPLv3 License.
17459 - ************************************************************************/
17461 -#include "wrapper.hxx"
17463 -#include <com/sun/star/awt/PosSize.hpp>
17464 -#include <com/sun/star/awt/XActionListener.hpp>
17465 -#include <com/sun/star/awt/XButton.hpp>
17466 -#include <com/sun/star/awt/XCheckBox.hpp>
17467 -#include <com/sun/star/awt/XRadioButton.hpp>
17468 -#include <com/sun/star/graphic/XGraphic.hpp>
17469 -#include <cppuhelper/implbase1.hxx>
17470 -#include <toolkit/awt/vclxwindow.hxx>
17471 -#include <toolkit/helper/convert.hxx>
17472 -#include <vcl/button.hxx>
17473 -#include <vcl/event.hxx>
17474 -#include <vcl/msgbox.hxx>
17475 -#include <vcl/svapp.hxx>
17476 -#include <vcl/window.hxx>
17480 -#include "layout/layoutcore.hxx"
17482 -using namespace ::com::sun::star;
17490 - css::uno::Reference< css::graphic::XGraphic > mxGraphic;
17491 - ImageImpl( const char *pName )
17492 - : mxGraphic( layoutimpl::loadGraphic( pName ) )
17494 - if ( !mxGraphic.is() )
17496 - DBG_ERROR1( "ERROR: failed to load image: `%s'\n", pName );
17501 -Image::Image( const char *pName )
17502 - : pImpl( new ImageImpl( pName ) )
17511 -class ButtonImpl : public ControlImpl
17512 - , public ::cppu::WeakImplHelper1< awt::XActionListener >
17513 - , public ::cppu::WeakImplHelper1< awt::XItemListener >
17517 - // we add toggle hooks here to cut on code
17518 - Link maToggleHdl;
17520 - uno::Reference< awt::XButton > mxButton;
17521 - ButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
17522 - : ControlImpl( pCtx, xPeer, pWindow )
17523 - , mxButton( xPeer, uno::UNO_QUERY )
17525 - mxButton->addActionListener( this );
17532 - virtual void Click() { /* make me pure virtual? */ };
17534 - void SetClickHdl( const Link& rLink )
17536 - maClickHdl = rLink;
17538 - mxButton->removeActionListener( this );
17540 - mxButton->addActionListener( this );
17543 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
17544 - throw (css::uno::RuntimeException)
17545 - { mxButton.clear(); }
17547 - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
17548 - throw (css::uno::RuntimeException)
17550 - if ( !maClickHdl )
17553 - maClickHdl.Call( static_cast<Window *>( mpWindow ) );
17556 - virtual // HACK: doesn't need to be virtual... remove in future...
17557 - void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
17558 - throw (css::uno::RuntimeException)
17560 - maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
17563 - BOOL SetModeImage( css::uno::Reference< css::graphic::XGraphic > xGraph )
17565 - setProperty( "Graphic", uno::Any( xGraph ) );
17570 -void Button::SetText( String const& rStr )
17572 - if ( !getImpl().mxButton.is() )
17574 - getImpl().mxButton->setLabel( rStr );
17577 -void Button::SetClickHdl( const Link& rLink )
17579 - getImpl().SetClickHdl( rLink );
17582 -BOOL Button::SetModeImage( const Image& rImage )
17584 - return getImpl().SetModeImage( rImage.getImpl().mxGraphic );
17587 -void Button::SetImageAlign( ImageAlign eAlign )
17589 - getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) );
17592 -void Button::Click()
17596 -IMPL_GET_IMPL( Button );
17597 -IMPL_CONSTRUCTORS( Button, Control, "button" );
17599 -class PushButtonImpl : public ButtonImpl
17602 - PushButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
17603 - : ButtonImpl( pCtx, xPeer, pWindow ) {}
17605 - void SetToggleHdl( const Link& rLink )
17607 - // XButton doesn't have an explicit event for Toggle. Anyway, it is a
17608 - // superset of the clicks: all clicks, and explicit toggles
17609 - maToggleHdl = rLink;
17611 - mxButton->removeActionListener( this );
17613 - mxButton->addActionListener( this );
17616 - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& rEvent )
17617 - throw (css::uno::RuntimeException)
17619 - ButtonImpl::actionPerformed( rEvent );
17623 - inline void fireToggle()
17625 - maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
17629 -void PushButton::Check( BOOL bCheck )
17631 - getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) );
17632 - // XButton doesn't have explicit toggle event
17633 - getImpl().fireToggle();
17636 -BOOL PushButton::IsChecked() const
17638 - return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() );
17641 -void PushButton::Toggle()
17646 -void PushButton::SetToggleHdl( const Link& rLink )
17648 - getImpl().SetToggleHdl( rLink );
17651 -IMPL_GET_IMPL( PushButton );
17652 -IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" );
17654 - // HACK: put every radio button into a group :/
17655 -static std::list< RadioButtonImpl*> mpRadioGroup;
17657 -class RadioButtonImpl : public ButtonImpl
17660 - uno::Reference< awt::XRadioButton > mxRadioButton;
17661 - RadioButtonImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
17662 - : ButtonImpl( pCtx, xPeer, pWindow )
17663 - , mxRadioButton( xPeer, uno::UNO_QUERY )
17666 - mpRadioGroup.push_back( this );
17667 - mxRadioButton->addItemListener( this );
17670 - ~RadioButtonImpl()
17672 - //mxRadioButton->removeItemListener( this );
17673 - mpRadioGroup.pop_front();
17676 - void Check( BOOL bCheck )
17678 - if ( !mxRadioButton.is() )
17680 - mxRadioButton->setState( !!bCheck );
17684 - unsetOthersGroup( this );
17689 - if ( !mxRadioButton.is() )
17691 - return mxRadioButton->getState();
17694 - static void unsetOthersGroup( RadioButtonImpl* current )
17696 - // set all others to false
17697 - for ( std::list< RadioButtonImpl*>::iterator i = mpRadioGroup.begin();
17698 - i != mpRadioGroup.end(); i++ )
17700 - if ( *i != current )
17701 - ( *i )->Check( false );
17705 - void SetToggleHdl( const Link& rLink )
17707 - maToggleHdl = rLink;
17710 - mxRadioButton->removeItemListener( this );
17712 - mxRadioButton->addItemListener( this );
17716 - inline void fireToggle()
17718 - maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
17722 - virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent )
17723 - throw (css::uno::RuntimeException)
17725 - if ( !!maToggleHdl )
17726 - ButtonImpl::itemStateChanged( rEvent );
17728 - if ( IsChecked() )
17729 - unsetOthersGroup( this );
17733 -void RadioButton::Check( BOOL bCheck )
17735 - getImpl().Check( bCheck );
17738 -BOOL RadioButton::IsChecked() const
17740 - return getImpl().IsChecked();
17743 -void RadioButton::SetToggleHdl( const Link& rLink )
17745 - getImpl().SetToggleHdl( rLink );
17748 -IMPL_GET_IMPL( RadioButton );
17750 -IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" );
17751 -#else //debugging aid
17752 -RadioButton::RadioButton( Context *pCtx, const char *pId, sal_uInt32 nId )
17753 - : Button( new RadioButtonImpl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) )
17755 - printf( "%s: name=%s\n", __PRETTY_FUNCTION__, pId );
17758 -RadioButton::RadioButton( Window *pParent, WinBits nBits )
17759 - : Button( new RadioButtonImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "radiobutton" ), this ) )
17764 -class CheckBoxImpl : public ButtonImpl
17767 - uno::Reference< awt::XCheckBox > mxCheckBox;
17768 - CheckBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
17769 - : ButtonImpl( pCtx, xPeer, pWindow )
17770 - , mxCheckBox( xPeer, uno::UNO_QUERY ) {}
17772 - void SetToggleHdl( const Link& rLink )
17774 - maToggleHdl = rLink;
17776 - mxCheckBox->removeItemListener( this );
17778 - mxCheckBox->addItemListener( this );
17782 -void CheckBox::Check( BOOL bCheck )
17784 - if ( !getImpl().mxCheckBox.is() )
17786 - getImpl().mxCheckBox->setState( !!bCheck );
17789 -BOOL CheckBox::IsChecked() const
17791 - if ( !getImpl().mxCheckBox.is() )
17793 - return getImpl().mxCheckBox->getState() != 0;
17796 -void CheckBox::SetToggleHdl( const Link& rLink )
17798 - getImpl().SetToggleHdl( rLink );
17801 -IMPL_GET_IMPL( CheckBox );
17802 -IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" );
17804 -#define BUTTON_IMPL(t, parent, response) \
17805 - class t##Impl : public parent##Impl \
17808 - t##Impl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow ) \
17809 - : parent##Impl( pCtx, xPeer, pWindow ) \
17814 - Dialog *d = static_cast<Dialog *>( mpCtx ); \
17815 - d->EndDialog( response ); \
17819 -/* Common button types currently unavailable in OOo: */
17823 -#define RET_RESET 6
17824 -#define RET_APPLY 7
17825 -#define BUTTONID_RESET RET_RESET
17826 -#define BUTTONID_APPLY RET_APPLY
17828 -BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK );
17829 -BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL );
17830 -BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES );
17831 -BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO );
17832 -BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY );
17833 -BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE );
17834 -BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET );
17835 -BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */
17836 -BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP );
17838 -IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" );
17839 -IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" );
17840 -IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" );
17841 -IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" );
17842 -IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" );
17843 -IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" );
17844 -IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" );
17845 -IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */
17846 -IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" );
17848 -class AdvancedButtonImpl : public PushButtonImpl
17851 - bool bAdvancedMode;
17852 - std::list< Window*> maAdvanced;
17853 - std::list< Window*> maSimple;
17854 - rtl::OUString mSimpleLabel;
17855 - rtl::OUString mAdvancedLabel;
17857 - Window* Remove( std::list< Window*> lst, Window* w )
17859 - for ( std::list< Window*>::iterator it = maAdvanced.begin();
17860 - it != maAdvanced.end(); it++ )
17870 - uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
17871 - ::Window* window = VCLXWindow::GetImplementation( ref )->GetWindow();
17872 - ::Window* parent = window->GetParent();
17874 - ::Rectangle r = Rectangle( parent->GetPosPixel(),
17875 - parent->GetSizePixel() );
17877 - parent->Invalidate( r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
17878 - parent->SetPosSizePixel( 0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
17879 - awt::PosSize::SIZE );
17883 - AdvancedButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow )
17884 - : PushButtonImpl( pCtx, xPeer, pWindow )
17885 - , bAdvancedMode( false )
17887 - // Button::GetStandardText( BUTTON_ADVANCED );
17888 - // Button::GetStandardText( BUTTON_SIMPLE );
17889 - , mSimpleLabel( rtl::OUString::createFromAscii( "Advanced..." ) )
17890 - , mAdvancedLabel( rtl::OUString::createFromAscii( "Simple..." ) )
17895 - bAdvancedMode = !bAdvancedMode;
17896 - if ( bAdvancedMode )
17901 - void advancedMode()
17903 - // TODO: set symbol/image?
17904 - // SYMBOL_PAGEUP, SYMBOL_PAGEDOWN
17906 - // How to set images from here?
17907 - // XImageConsumer looks like a disaster
17908 - // Should move all this switching functionality to VCLXAdvancedButton?
17909 - /biek/home/janneke/vc/layout-cws/default_images/res/commandimagelist/
17910 - sc_arrowshapes_down.png
17911 - sch_flowchartshapes.flowchart-extract.png
17912 - sch_flowchartshapes.flowchart-merge.png
17914 - mxButton->setLabel( mAdvancedLabel );
17915 - for ( std::list< Window*>::iterator it = maAdvanced.begin();
17916 - it != maAdvanced.end(); it++ )
17918 - for ( std::list< Window*>::iterator it = maSimple.begin();
17919 - it != maSimple.end(); it++ )
17925 - void simpleMode()
17927 - mxButton->setLabel( mSimpleLabel );
17928 - for ( std::list< Window*>::iterator it = maAdvanced.begin();
17929 - it != maAdvanced.end(); it++ )
17931 - for ( std::list< Window*>::iterator it = maSimple.begin();
17932 - it != maSimple.end(); it++ )
17937 - void AddAdvanced( Window* w )
17939 - maAdvanced.push_back( w );
17940 - if ( !bAdvancedMode )
17943 - void AddSimple( Window* w )
17945 - maSimple.push_back( w );
17946 - if ( bAdvancedMode )
17949 - void RemoveAdvanced( Window* w )
17951 - Remove( maAdvanced, w );
17953 - void RemoveSimple( Window* w )
17955 - Remove( maSimple, w );
17959 -void AdvancedButton::AddAdvanced( Window* w )
17961 - getImpl().AddAdvanced( w );
17964 -void AdvancedButton::AddSimple( Window* w )
17966 - getImpl().AddSimple( w );
17969 -void AdvancedButton::RemoveAdvanced( Window* w )
17971 - getImpl().RemoveAdvanced( w );
17974 -void AdvancedButton::RemoveSimple( Window* w )
17976 - getImpl().RemoveSimple( w );
17979 -IMPL_CONSTRUCTORS( AdvancedButton, PushButton, "advancedbutton" );
17980 -IMPL_GET_IMPL( AdvancedButton );
17983 -class MoreButtonImpl : public AdvancedButtonImpl
17986 - MoreButtonImpl( Context *pCtx, PeerHandle const& xPeer, Window *pWindow )
17987 - : AdvancedButtonImpl( pCtx, xPeer, pWindow)
17989 - mAdvancedLabel = ::Button::GetStandardText( BUTTON_LESS );
17990 - mSimpleLabel = ::Button::GetStandardText( BUTTON_MORE );
17992 - void AddWindow( Window* w ) { AddAdvanced( w ); }
17993 - void RemoveWindow( Window* w ) { RemoveAdvanced( w ); }
17997 -//BUTTON_IMPL( MoreButton, PushButton, 0 );
17998 -IMPL_CONSTRUCTORS( MoreButton, AdvancedButton, "morebutton" );
17999 -IMPL_GET_IMPL( MoreButton );
18001 -void MoreButton::AddWindow( Window* w )
18003 - getImpl().AddWindow( w );
18006 -void MoreButton::RemoveWindow( Window* w )
18008 - getImpl().RemoveWindow( w );
18011 -} // namespace layout
18012 --- toolkit/source/vclcompat/wcontainer.cxx.old 2009-04-02 10:49:35.000000000 +0000
18013 +++ toolkit/source/vclcompat/wcontainer.cxx 1970-01-01 00:00:00.000000000 +0000
18015 -/*************************************************************************
18017 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18019 - * Copyright 2008 by Sun Microsystems, Inc.
18021 - * OpenOffice.org - a multi-platform office productivity suite
18023 - * $RCSfile: wcontainer.cxx,v $
18025 - * $Revision: 1.3 $
18027 - * This file is part of OpenOffice.org.
18029 - * OpenOffice.org is free software: you can redistribute it and/or modify
18030 - * it under the terms of the GNU Lesser General Public License version 3
18031 - * only, as published by the Free Software Foundation.
18033 - * OpenOffice.org is distributed in the hope that it will be useful,
18034 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18035 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18036 - * GNU Lesser General Public License version 3 for more details
18037 - * (a copy is included in the LICENSE file that accompanied this code).
18039 - * You should have received a copy of the GNU Lesser General Public License
18040 - * version 3 along with OpenOffice.org. If not, see
18041 - * <http://www.openoffice.org/license.html>
18042 - * for a copy of the LGPLv3 License.
18044 - ************************************************************************/
18046 -#include "wrapper.hxx"
18048 -#include "layout/layoutcore.hxx"
18049 -#include <com/sun/star/awt/XLayoutRoot.hpp>
18050 -#include <com/sun/star/awt/XLayoutContainer.hpp>
18052 -#include <comphelper/processfactory.hxx>
18054 -#include <tools/debug.hxx>
18056 -using namespace ::com::sun::star;
18061 -Container::Container( Context const* pCtx, char const* pId )
18062 - : mxContainer( pCtx->GetPeerHandle( pId ), uno::UNO_QUERY )
18064 - if ( !mxContainer.is() )
18066 - DBG_ERROR1( "Error: failed to associate container with '%s'", pId );
18070 -Container::Container( rtl::OUString const& rName, sal_Int32 nBorder )
18072 - mxContainer = layoutimpl::createContainer( rName );
18074 - uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
18075 - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ),
18076 - uno::Any( nBorder ) );
18079 -void Container::Add( Window *pChild )
18083 - uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
18084 - mxContainer->addChild( xChild );
18088 -void Container::Add( Container *pChild )
18092 - uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
18093 - mxContainer->addChild( xChild );
18097 -void Container::Remove( Window *pChild )
18101 - uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
18102 - mxContainer->removeChild( xChild );
18106 -void Container::Remove( Container *pChild )
18110 - uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
18111 - mxContainer->removeChild( xChild );
18115 -void Container::Clear()
18117 - css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children;
18118 - children = mxContainer->getChildren();
18119 - for ( int i = 0; i < children.getLength(); i++ )
18120 - mxContainer->removeChild( children[ i ] );
18123 -void Container::ShowAll( bool bShow )
18127 - static void setChildrenVisible( uno::Reference < awt::XLayoutContainer > xCont,
18128 - bool bVisible ) /* auxiliary */
18130 - if ( xCont.is() )
18132 - uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
18133 - aChildren = xCont->getChildren();
18134 - for ( int i = 0; i < aChildren.getLength(); i++ )
18136 - uno::Reference < awt::XLayoutConstrains > xChild( aChildren[ i ] );
18138 - uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY);
18140 - xWin->setVisible( bVisible );
18142 - uno::Reference < awt::XLayoutContainer > xChildCont(
18143 - xChild, uno::UNO_QUERY );
18144 - setChildrenVisible( xChildCont, bVisible );
18150 - inner::setChildrenVisible( mxContainer, bShow );
18153 -void Container::Show()
18158 -void Container::Hide()
18160 - ShowAll( false );
18163 -Table::Table( sal_Int32 nBorder, sal_Int32 nColumns )
18164 - : Container( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ), nBorder )
18166 - uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
18167 - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ) ),
18168 - uno::Any( nColumns ) );
18171 -void Table::Add( Window *pWindow, bool bXExpand, bool bYExpand,
18172 - sal_Int32 nXSpan, sal_Int32 nYSpan )
18176 - WindowImpl &rImpl = pWindow->getImpl();
18177 - uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
18178 - uno::UNO_QUERY );
18179 - mxContainer->addChild( xChild );
18180 - setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
18183 -void Table::Add( Container *pContainer, bool bXExpand, bool bYExpand,
18184 - sal_Int32 nXSpan, sal_Int32 nYSpan )
18186 - if ( !pContainer )
18188 - uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
18189 - uno::UNO_QUERY );
18190 - mxContainer->addChild( xChild );
18191 - setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
18194 -void Table::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
18195 - bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan )
18197 - uno::Reference< beans::XPropertySet > xProps
18198 - ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
18199 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ) ),
18200 - uno::Any( bXExpand ) );
18201 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ) ),
18202 - uno::Any( bYExpand ) );
18203 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ) ),
18204 - uno::Any( nXSpan ) );
18205 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ) ),
18206 - uno::Any( nYSpan ) );
18209 -Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous )
18210 - : Container( rName, nBorder )
18212 - uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
18213 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ) ),
18214 - uno::Any( bHomogeneous ) );
18217 -void Box::Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding)
18221 - WindowImpl &rImpl = pWindow->getImpl();
18222 - uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
18223 - uno::UNO_QUERY );
18225 - mxContainer->addChild( xChild );
18226 - setProps( xChild, bExpand, bFill, nPadding );
18229 -void Box::Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding)
18231 - if ( !pContainer )
18234 - uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
18235 - uno::UNO_QUERY );
18236 - mxContainer->addChild( xChild );
18237 - setProps( xChild, bExpand, bFill, nPadding );
18240 -void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
18241 - bool bExpand, bool bFill, sal_Int32 nPadding )
18243 - uno::Reference< beans::XPropertySet > xProps
18244 - ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
18246 - xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Expand" ) ),
18247 - uno::Any( bExpand ) );
18248 - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Fill" ) ),
18249 - uno::Any( bFill ) );
18250 - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Padding" ) ),
18251 - uno::Any( nPadding ) );
18254 -Table::Table( Context const* pCtx, char const* pId )
18255 - : Container( pCtx, pId )
18259 -Box::Box( Context const* pCtx, char const* pId )
18260 - : Container( pCtx, pId )
18264 -HBox::HBox( sal_Int32 nBorder, bool bHomogeneous )
18265 - : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hbox" ) ),
18266 - nBorder, bHomogeneous )
18270 -HBox::HBox( Context const* pCtx, char const* pId )
18271 - : Box( pCtx, pId )
18275 -VBox::VBox( sal_Int32 nBorder, bool bHomogeneous )
18276 - : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vbox" ) ),
18277 - nBorder, bHomogeneous )
18281 -VBox::VBox( Context const* pCtx, char const* pId )
18282 - : Box( pCtx, pId )
18286 -} // namespace layout
18287 --- toolkit/source/vclcompat/wfield.cxx.old 2009-04-06 16:42:11.000000000 +0000
18288 +++ toolkit/source/vclcompat/wfield.cxx 1970-01-01 00:00:00.000000000 +0000
18290 -/*************************************************************************
18292 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18294 - * Copyright 2008 by Sun Microsystems, Inc.
18296 - * OpenOffice.org - a multi-platform office productivity suite
18298 - * $RCSfile: wfield.cxx,v $
18300 - * $Revision: 1.3 $
18302 - * This file is part of OpenOffice.org.
18304 - * OpenOffice.org is free software: you can redistribute it and/or modify
18305 - * it under the terms of the GNU Lesser General Public License version 3
18306 - * only, as published by the Free Software Foundation.
18308 - * OpenOffice.org is distributed in the hope that it will be useful,
18309 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18310 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18311 - * GNU Lesser General Public License version 3 for more details
18312 - * (a copy is included in the LICENSE file that accompanied this code).
18314 - * You should have received a copy of the GNU Lesser General Public License
18315 - * version 3 along with OpenOffice.org. If not, see
18316 - * <http://www.openoffice.org/license.html>
18317 - * for a copy of the LGPLv3 License.
18319 - ************************************************************************/
18321 -#include "wrapper.hxx"
18323 -#include <comphelper/processfactory.hxx>
18324 -#include <com/sun/star/awt/XMetricField.hpp>
18325 -#include <com/sun/star/awt/XCurrencyField.hpp>
18326 -#include <com/sun/star/awt/XTextComponent.hpp>
18327 -#include <com/sun/star/awt/XListBox.hpp>
18328 -#include <com/sun/star/awt/XComboBox.hpp>
18329 -#include <cppuhelper/implbase1.hxx>
18330 -#include <com/sun/star/awt/XActionListener.hpp>
18331 -#include <com/sun/star/awt/XItemListener.hpp>
18333 -using namespace ::com::sun::star;
18338 -class EditImpl : public ControlImpl,
18339 - public ::cppu::WeakImplHelper1< awt::XTextListener >
18341 - Link maModifyHdl;
18343 - uno::Reference< awt::XTextComponent > mxEdit;
18344 - EditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18345 - : ControlImpl( pCtx, xPeer, pWindow )
18346 - , mxEdit( xPeer, uno::UNO_QUERY )
18350 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
18351 - throw (css::uno::RuntimeException)
18353 - SetModifyHdl( Link() );
18357 - void SetModifyHdl( const Link& rLink )
18359 - if ( !mxEdit.is() )
18361 - maModifyHdl = rLink;
18363 - mxEdit->removeTextListener( this );
18365 - mxEdit->addTextListener( this );
18368 - void SAL_CALL textChanged( const css::awt::TextEvent& /* rEvent */ )
18369 - throw (css::uno::RuntimeException)
18371 - maModifyHdl.Call( mpWindow );
18375 -void Edit::SetSelection( Selection const& rSelection )
18377 - if ( !getImpl().mxEdit.is() )
18379 - getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) );
18382 -void Edit::SetText( XubString const& rStr ) const
18384 - if ( !getImpl().mxEdit.is() )
18386 - getImpl().mxEdit->setText( rStr );
18389 -XubString Edit::GetText() const
18391 - if ( !getImpl().mxEdit.is() )
18392 - return XubString();
18393 - return XubString( getImpl().mxEdit->getText());
18396 -void Edit::SetModifyHdl( const Link& rLink )
18398 - getImpl().SetModifyHdl( rLink );
18401 -IMPL_CONSTRUCTORS( Edit, Control, "edit" );
18402 -IMPL_GET_IMPL( Edit );
18404 -// Window/Control/Edit/MultiLineEdit
18405 -class MultiLineEditImpl : public EditImpl
18408 - MultiLineEditImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18409 - : EditImpl( pCtx, xPeer, pWindow )
18414 -IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" );
18415 -IMPL_GET_IMPL( MultiLineEdit );
18417 -// Window/Control/Edit/SpinField
18418 -class SpinFieldImpl : public EditImpl
18421 - SpinFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18422 - : EditImpl( pCtx, xPeer, pWindow )
18427 -IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
18429 -// Window/Control/Edit/SpinField/NumericField
18430 -class NumericFieldImpl : public SpinFieldImpl
18433 - NumericFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18434 - : SpinFieldImpl( pCtx, xPeer, pWindow )
18439 -// Window/Control/Edit/SpinField/MetricField
18440 -class MetricFieldImpl : public SpinFieldImpl
18443 - MetricFieldImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18444 - : SpinFieldImpl( pCtx, xPeer, pWindow )
18449 -IMPL_GET_IMPL( SpinField );
18450 -IMPL_GET_IMPL( NumericField );
18451 -IMPL_GET_IMPL( MetricField );
18454 -class FormatterBaseImpl
18457 - PeerHandle mxPeer;
18459 - explicit FormatterBaseImpl( const PeerHandle &xPeer )
18460 - : mxPeer( xPeer )
18465 -class NumericFormatterImpl : public FormatterBaseImpl
18468 - uno::Reference< awt::XCurrencyField > mxField;
18469 - explicit NumericFormatterImpl( const PeerHandle &xPeer )
18470 - : FormatterBaseImpl( xPeer )
18471 - , mxField( xPeer, uno::UNO_QUERY )
18475 - // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
18476 - double valueToDouble( sal_Int64 nValue )
18478 - sal_Int16 nDigits = mxField->getDecimalDigits();
18479 - double n = (double)nValue;
18480 - for ( sal_uInt16 d = 0; d < nDigits; d++ )
18483 - } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
18484 - sal_Int64 doubleToValue( double nValue )
18486 - sal_Int16 nDigits = mxField->getDecimalDigits();
18487 - double n = nValue;
18488 - for ( sal_uInt16 d = 0; d < nDigits; d++ )
18490 - return (sal_Int64) n;
18494 -class MetricFormatterImpl : public FormatterBaseImpl
18497 - uno::Reference< awt::XMetricField > mxField;
18498 - explicit MetricFormatterImpl( const PeerHandle &xPeer )
18499 - : FormatterBaseImpl( xPeer )
18500 - , mxField( xPeer, uno::UNO_QUERY )
18505 -// NumericFormatter
18507 -NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl )
18508 - : FormatterBase( pImpl )
18512 -NumericFormatterImpl& NumericFormatter::getFormatImpl() const
18514 - return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) );
18517 -#define SET_IMPL(vclmethod, idlmethod) \
18518 - void NumericFormatter::vclmethod( sal_Int64 nValue ) \
18520 - if ( !getFormatImpl().mxField.is() ) \
18522 - getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \
18525 -SET_IMPL( SetMin, setMin )
18526 -SET_IMPL( SetMax, setMax )
18527 -SET_IMPL( SetLast, setLast )
18528 -SET_IMPL( SetFirst, setFirst )
18529 -SET_IMPL( SetValue, setValue )
18530 -SET_IMPL( SetSpinSize, setSpinSize )
18532 -sal_Int64 NumericFormatter::GetValue() const
18534 - if ( !getFormatImpl().mxField.is() )
18536 - return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() );
18541 -IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" );
18543 -// MetricFormatter
18545 -MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl )
18546 - : FormatterBase( pImpl )
18549 -MetricFormatterImpl& MetricFormatter::getFormatImpl() const
18550 -{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); }
18552 -#define MetricUnitVclToUno(a) ((sal_uInt16)(a))
18554 -#define SET_IMPL(vclmethod, idlmethod) \
18555 - void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \
18557 - if ( !getFormatImpl().mxField.is() ) \
18559 - getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \
18562 -SET_IMPL( SetMin, setMin )
18563 -SET_IMPL( SetMax, setMax )
18564 -SET_IMPL( SetLast, setLast )
18565 -SET_IMPL( SetFirst, setFirst )
18566 -SET_IMPL( SetValue, setValue )
18570 -void MetricFormatter::SetSpinSize( sal_Int64 nValue )
18572 - if ( !getFormatImpl().mxField.is() )
18574 - getFormatImpl().mxField->setSpinSize( nValue );
18577 -sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
18579 - if ( !getFormatImpl().mxField.is() )
18581 - return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) );
18584 -IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
18586 -// Window/Control/Edit/ComboBox
18587 -class ComboBoxImpl : public EditImpl,
18588 - public ::cppu::WeakImplHelper1< awt::XActionListener >,
18589 - public ::cppu::WeakImplHelper1< awt::XItemListener >
18591 - Link maClickHdl, maSelectHdl;
18593 - uno::Reference< awt::XComboBox > mxComboBox;
18594 - ComboBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18595 - : EditImpl( pCtx, xPeer, pWindow ),
18596 - mxComboBox( xPeer, uno::UNO_QUERY )
18600 - USHORT InsertEntry( XubString const& rStr, USHORT nPos )
18602 - if ( nPos == COMBOBOX_APPEND )
18603 - nPos = GetEntryCount();
18604 - mxComboBox->addItem( rtl::OUString( rStr ), nPos );
18608 - void RemoveEntry( USHORT nPos )
18610 - mxComboBox->removeItems( nPos, 1 );
18613 - USHORT GetEntryPos( const XubString& rStr ) const
18615 - uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
18616 - rtl::OUString rKey( rStr );
18617 - for ( unsigned int i = 0; aItems.getLength(); i++ )
18619 - if ( aItems[ i ] == rKey )
18620 - return sal::static_int_cast< USHORT >( i );
18622 - return COMBOBOX_ENTRY_NOTFOUND;
18625 - XubString GetEntry( USHORT nPos ) const
18627 - return XubString( mxComboBox->getItem( nPos ) );
18630 - USHORT GetEntryCount() const
18632 - return mxComboBox->getItemCount();
18635 - void SetClickHdl( const Link& rLink )
18637 - maClickHdl = rLink;
18639 - mxComboBox->removeActionListener( this );
18641 - mxComboBox->addActionListener( this );
18644 - void SetSelectHdl( const Link& rLink )
18646 - maSelectHdl = rLink;
18648 - mxComboBox->removeItemListener( this );
18650 - mxComboBox->addItemListener( this );
18653 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
18654 - throw (css::uno::RuntimeException)
18656 - mxComboBox.clear();
18659 - virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
18660 - throw (css::uno::RuntimeException)
18662 - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
18663 - if ( !pComboBox )
18665 - maClickHdl.Call( pComboBox );
18668 - virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
18669 - throw (css::uno::RuntimeException)
18671 - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
18672 - if ( !pComboBox )
18674 - maSelectHdl.Call( pComboBox );
18678 -USHORT ComboBox::InsertEntry( const XubString &rStr, USHORT nPos )
18680 - return getImpl().InsertEntry( rStr, nPos );
18683 -void ComboBox::RemoveEntry( const XubString& rStr )
18685 - getImpl().RemoveEntry( GetEntryPos( rStr ) );
18688 -void ComboBox::RemoveEntry( USHORT nPos )
18690 - getImpl().RemoveEntry( nPos );
18693 -void ComboBox::Clear()
18695 - uno::Sequence< rtl::OUString> aNoItems;
18696 - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
18699 -USHORT ComboBox::GetEntryPos( const XubString& rStr ) const
18701 - return getImpl().GetEntryPos( rStr );
18704 -XubString ComboBox::GetEntry( USHORT nPos ) const
18706 - rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos );
18707 - return XubString( rItem );
18710 -USHORT ComboBox::GetEntryCount() const
18712 - return getImpl().GetEntryCount();
18715 -void ComboBox::SetClickHdl( const Link& rLink )
18717 - getImpl().SetClickHdl( rLink );
18720 -void ComboBox::SetSelectHdl( const Link& rLink )
18722 - getImpl().SetSelectHdl( rLink );
18725 -IMPL_CONSTRUCTORS( ComboBox, Edit, "combobox" );
18726 -IMPL_GET_IMPL( ComboBox );
18728 -// Window/Control/ListBox
18729 -class ListBoxImpl : public ControlImpl,
18730 - public ::cppu::WeakImplHelper1< awt::XActionListener >,
18731 - public ::cppu::WeakImplHelper1< awt::XItemListener >
18733 - Link maClickHdl, maSelectHdl;
18735 - uno::Reference< awt::XListBox > mxListBox;
18736 - ListBoxImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
18737 - : ControlImpl( pCtx, xPeer, pWindow ),
18738 - mxListBox( xPeer, uno::UNO_QUERY )
18740 - SelectEntryPos( 0, true );
18743 - USHORT InsertEntry(const XubString& rStr, USHORT nPos)
18745 - if ( nPos == LISTBOX_APPEND )
18746 - nPos = mxListBox->getItemCount();
18747 - mxListBox->addItem( rtl::OUString( rStr ), nPos );
18751 - void RemoveEntry( USHORT nPos )
18753 - mxListBox->removeItems( nPos, 1 );
18756 - USHORT RemoveEntry(const XubString& rStr, USHORT nPos)
18758 - if ( nPos == LISTBOX_APPEND )
18759 - nPos = mxListBox->getItemCount();
18760 - mxListBox->addItem( rtl::OUString( rStr ), nPos );
18764 - USHORT GetEntryPos( const XubString& rStr ) const
18766 - uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
18767 - rtl::OUString rKey( rStr );
18768 - for ( unsigned int i = 0; aItems.getLength(); i++ )
18770 - if ( aItems[ i ] == rKey )
18771 - return sal::static_int_cast< USHORT >( i );
18773 - return LISTBOX_ENTRY_NOTFOUND;
18776 - XubString GetEntry( USHORT nPos ) const
18778 - return mxListBox->getItem( nPos );
18781 - USHORT GetEntryCount() const
18783 - return mxListBox->getItemCount();
18786 - void SelectEntryPos( USHORT nPos, BOOL bSelect )
18788 - mxListBox->selectItemPos( nPos, bSelect );
18791 - USHORT GetSelectEntryCount() const
18793 - return sal::static_int_cast< USHORT >( mxListBox->getSelectedItems().getLength() );
18796 - USHORT GetSelectEntryPos( USHORT nSelIndex ) const
18798 - USHORT nSelected = 0;
18799 - if ( mxListBox->isMutipleMode() )
18801 - uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
18802 - if ( nSelIndex < aItems.getLength() )
18803 - nSelected = aItems[ nSelIndex ];
18806 - nSelected = mxListBox->getSelectedItemPos();
18807 - return nSelected;
18810 - void SetClickHdl( const Link& rLink )
18812 - maClickHdl = rLink;
18814 - mxListBox->removeActionListener( this );
18816 - mxListBox->addActionListener( this );
18819 - void SetSelectHdl( const Link& rLink )
18821 - maSelectHdl = rLink;
18823 - mxListBox->removeItemListener( this );
18825 - mxListBox->addItemListener( this );
18828 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
18829 - throw (css::uno::RuntimeException)
18831 - mxListBox.clear();
18834 - void SAL_CALL actionPerformed( const css::awt::ActionEvent& /* rEvent */ )
18835 - throw (css::uno::RuntimeException)
18837 - maClickHdl.Call( mpWindow );
18840 - void SAL_CALL itemStateChanged( const css::awt::ItemEvent& /* rEvent */ )
18841 - throw (css::uno::RuntimeException)
18843 - ListBox* pListBox = static_cast<ListBox*>( mpWindow );
18846 - maSelectHdl.Call( pListBox );
18850 -USHORT ListBox::InsertEntry(const XubString& rStr, USHORT nPos)
18852 - return getImpl().InsertEntry(rStr, nPos);
18855 -void ListBox::RemoveEntry( USHORT nPos )
18857 - return getImpl().RemoveEntry( nPos );
18860 -void ListBox::RemoveEntry( const XubString& rStr )
18862 - return getImpl().RemoveEntry( GetEntryPos( rStr ) );
18865 -void ListBox::Clear()
18867 - uno::Sequence< rtl::OUString> aNoItems;
18868 - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
18871 -USHORT ListBox::GetEntryPos( const XubString& rStr ) const
18873 - return getImpl().GetEntryPos( rStr );
18876 -XubString ListBox::GetEntry( USHORT nPos ) const
18878 - return getImpl().GetEntry( nPos );
18881 -USHORT ListBox::GetEntryCount() const
18883 - return getImpl().GetEntryCount();
18886 -void ListBox::SelectEntryPos( USHORT nPos, BOOL bSelect )
18888 - getImpl().SelectEntryPos( nPos, bSelect );
18891 -void ListBox::SelectEntry( const XubString& rStr, BOOL bSelect )
18893 - SelectEntryPos( GetEntryPos( rStr ), bSelect );
18896 -USHORT ListBox::GetSelectEntryCount() const
18898 - return getImpl().GetSelectEntryCount();
18901 -USHORT ListBox::GetSelectEntryPos( USHORT nSelIndex ) const
18903 - return getImpl().GetSelectEntryPos( nSelIndex );
18906 -XubString ListBox::GetSelectEntry( USHORT nSelIndex ) const
18908 - return GetEntry( GetSelectEntryPos( nSelIndex ) );
18911 -void ListBox::SetSelectHdl( const Link& rLink )
18913 - getImpl().SetSelectHdl( rLink );
18916 -void ListBox::SetClickHdl( const Link& rLink )
18918 - getImpl().SetClickHdl( rLink );
18921 -IMPL_CONSTRUCTORS( ListBox, Control, "listbox" );
18922 -IMPL_GET_IMPL( ListBox );
18924 -} // namespace layout
18925 --- toolkit/source/vclcompat/wrapper.cxx.old 2009-04-06 16:42:11.000000000 +0000
18926 +++ toolkit/source/vclcompat/wrapper.cxx 1970-01-01 00:00:00.000000000 +0000
18928 -/*************************************************************************
18930 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18932 - * Copyright 2008 by Sun Microsystems, Inc.
18934 - * OpenOffice.org - a multi-platform office productivity suite
18936 - * $RCSfile: wrapper.cxx,v $
18938 - * $Revision: 1.3 $
18940 - * This file is part of OpenOffice.org.
18942 - * OpenOffice.org is free software: you can redistribute it and/or modify
18943 - * it under the terms of the GNU Lesser General Public License version 3
18944 - * only, as published by the Free Software Foundation.
18946 - * OpenOffice.org is distributed in the hope that it will be useful,
18947 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18948 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18949 - * GNU Lesser General Public License version 3 for more details
18950 - * (a copy is included in the LICENSE file that accompanied this code).
18952 - * You should have received a copy of the GNU Lesser General Public License
18953 - * version 3 along with OpenOffice.org. If not, see
18954 - * <http://www.openoffice.org/license.html>
18955 - * for a copy of the LGPLv3 License.
18957 - ************************************************************************/
18959 -#include "wrapper.hxx"
18961 -#include <awt/vclxplugin.hxx>
18962 -#include <com/sun/star/awt/PosSize.hpp>
18963 -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
18964 -#include <com/sun/star/awt/WindowAttribute.hpp>
18965 -#include <com/sun/star/awt/XDialog2.hpp>
18966 -#include <com/sun/star/awt/XProgressBar.hpp>
18967 -#include <com/sun/star/graphic/XGraphic.hpp>
18968 -#include <comphelper/processfactory.hxx>
18970 -#include <layout/factory.hxx>
18971 -#include <layout/layoutcore.hxx>
18972 -#include <layout/root.hxx>
18973 -#include <layout/localized-string.hxx>
18974 -#include <toolkit/awt/vclxwindow.hxx>
18975 -#include <vcl/ctrl.hxx>
18976 -#include <vcl/image.hxx>
18977 -#include <vcl/tabpage.hxx>
18978 -#include <vcl/window.hxx>
18982 -/* FIXME: move to sfx2 or svtools/layout.hxx */
18983 -#include <svtools/itempool.hxx>
18984 -#include <svtools/itemset.hxx>
18985 -#include <svtools/poolitem.hxx>
18988 -using namespace ::com::sun::star;
18989 -using rtl::OUString;
18994 -// Context bits ...
18997 - uno::Reference< awt::XLayoutRoot > mxRoot;
18998 - uno::Reference< container::XNameAccess > mxNameAccess;
18999 - PeerHandle mxTopLevel;
19002 - ContextImpl( char const *pPath )
19004 - uno::Sequence< uno::Any > aParams( 1 );
19005 - aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 );
19007 - uno::Reference< lang::XSingleServiceFactory > xFactory(
19008 - comphelper::createProcessComponent(
19009 - OUString::createFromAscii( "com.sun.star.awt.Layout" ) ),
19010 - uno::UNO_QUERY );
19011 - if ( !xFactory.is() )
19013 - throw uno::RuntimeException(
19014 - OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
19015 - uno::Reference< uno::XInterface >() );
19017 - mxRoot = uno::Reference< awt::XLayoutRoot >(
19018 - xFactory->createInstanceWithArguments( aParams ),
19019 - uno::UNO_QUERY );
19021 - mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY );
19028 - PeerHandle getByName( const OUString &rName )
19030 - uno::Any val = mxNameAccess->getByName( rName );
19035 - PeerHandle getTopLevel() { return mxTopLevel; }
19036 - void setTopLevel( PeerHandle xToplevel ) { mxTopLevel = xToplevel; }
19037 - PeerHandle getRoot() { return mxRoot; }
19040 -Context::Context( const char *pPath )
19041 - : pImpl( new ContextImpl( pPath ) )
19044 -Context::~Context()
19050 -void Context::setToplevel( PeerHandle xToplevel )
19052 - pImpl->setTopLevel( xToplevel );
19055 -PeerHandle Context::getToplevel()
19057 - return pImpl->getTopLevel();
19059 -PeerHandle Context::getRoot()
19061 - return pImpl->getRoot();
19064 -PeerHandle Context::GetPeerHandle( const char *pId, sal_uInt32 nId ) const
19066 - PeerHandle xHandle;
19067 - xHandle = pImpl->getByName( OUString( pId, strlen( pId ), RTL_TEXTENCODING_UTF8 ) );
19068 - if ( !xHandle.is() )
19070 - DBG_ERROR1( "Failed to fetch widget '%s'", pId );
19075 - rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId );
19076 - xHandle = GetPeerHandle( aStr, 0 );
19081 -IMPL_GET_IMPL( Control );
19083 -Window::Window( WindowImpl *pImpl )
19084 - : mpImpl( pImpl )
19090 - /* likely to be an UNO object - with floating references */
19091 - mpImpl->wrapperGone();
19095 -void Window::SetParent( ::Window *pParent )
19097 - uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY );
19098 - ::Window *window = VCLXWindow::GetImplementation( ref )->GetWindow();
19099 - window->SetParent( pParent );
19102 -void Window::SetParent( Window *pParent )
19104 - uno::Reference <awt::XWindow> parentRef( pParent->GetPeer(), uno::UNO_QUERY );
19105 - ::Window *parentWindow = VCLXWindow::GetImplementation( parentRef )->GetWindow();
19106 - SetParent( parentWindow );
19109 -Context *Window::getContext()
19111 - return this && mpImpl ? mpImpl->mpCtx : NULL;
19114 -PeerHandle Window::GetPeer()
19117 - return PeerHandle();
19118 - return mpImpl->mxWindow;
19121 -uno::Reference<awt::XWindow> Window::GetRef()
19123 - return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
19126 -VCLXWindow* Window::GetVCLXWindow()
19128 - return VCLXWindow::GetImplementation( GetRef() );
19131 -::Window* Window::GetWindow()
19133 - return GetVCLXWindow()->GetWindow();
19136 -::Window* Window::GetParent()
19138 - return GetWindow()->GetParent();
19141 -struct ToolkitVclPropsMap
19143 - WinBits vclStyle;
19145 - const char *propName;
19147 - // the value to give the prop to enable/disable it -- not the most brilliant
19148 - // type declaration and storage, but does the work... properties are
19149 - // either a boolean or a short since they are either a directly wrappers for
19150 - // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER).
19152 - short enableProp, disableProp;
19155 -#define TYPE_BOOL true
19156 -#define TYPE_SHORT false
19158 -static const ToolkitVclPropsMap toolkitVclPropsMap[] =
19160 - { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 },
19161 - { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 },
19162 - { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 },
19163 - { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 },
19164 - { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 },
19166 - { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 },
19167 - { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 },
19168 - { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 },
19169 - { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 },
19170 - { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 },
19171 - { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 },
19172 - { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 },
19173 - { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 },
19174 - { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 },
19175 - { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 },
19176 - { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 },
19177 - { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 },
19179 - { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 },
19180 - { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 },
19181 - { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 },
19182 - { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 },
19183 - { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 },
19184 - { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 },
19185 - { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 },
19186 - { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 },
19187 - { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 },
19188 - { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 },
19190 - { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 },
19191 - { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 },
19193 - { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 },
19194 - { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 },
19195 - { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 },
19196 - { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 },
19197 - { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 },
19203 -static const int toolkitVclPropsMapLen =
19204 - sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap );
19206 -void Window::SetStyle( WinBits nStyle )
19208 - uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
19209 - for ( int i = 0; i < toolkitVclPropsMapLen; i++ )
19211 - if ( toolkitVclPropsMap[ i ].propName )
19214 - if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
19215 - nValue = toolkitVclPropsMap[ i ].enableProp;
19217 - nValue = toolkitVclPropsMap[ i ].disableProp;
19219 - if ( toolkitVclPropsMap[ i ].isBoolean )
19220 - aValue = uno::makeAny( (bool) nValue );
19222 - aValue = uno::makeAny( (short) nValue );
19223 - mpImpl->setProperty( toolkitVclPropsMap[ i ].propName, aValue );
19228 -WinBits Window::GetStyle()
19230 - uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
19232 - for ( int i = 0; i < toolkitVclPropsMapLen; i++ )
19234 - if ( toolkitVclPropsMap[ i ].propName )
19236 - short nValue = 0;
19237 - if ( toolkitVclPropsMap[ i ].isBoolean )
19239 - bool bValue = false;
19240 - mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= bValue;
19241 - nValue = bValue ? 1 : 0;
19244 - mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= nValue;
19245 - if ( nValue == toolkitVclPropsMap[ i ].enableProp )
19246 - ret |= toolkitVclPropsMap[i].vclStyle;
19252 -/* Unpleasant way to get an xToolkit pointer ... */
19253 -uno::Reference< awt::XToolkit > getToolkit()
19255 - static uno::Reference< awt::XToolkit > xToolkit;
19256 - if (!xToolkit.is())
19259 - xToolkit = uno::Reference< awt::XToolkit >(
19260 - ::comphelper::getProcessServiceFactory()->createInstance(
19261 - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
19262 - uno::UNO_QUERY );
19263 - if ( !xToolkit.is() )
19264 - throw uno::RuntimeException(
19265 - OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ),
19266 - uno::Reference< uno::XInterface >() );
19271 -PeerHandle Window::CreatePeer( Window *pParent, WinBits nStyle, const char *pName)
19274 - long nWinAttrbs = 0;
19275 - for ( int i = 0; i < toolkitVclPropsMapLen; i++ )
19276 - if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
19277 - nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr;
19279 - return layoutimpl::createWidget( getToolkit(), pParent->GetPeer(),
19280 - OUString::createFromAscii( pName ), nWinAttrbs );
19283 -void Window::Enable( bool bEnable )
19285 - if ( !getImpl().mxWindow.is() )
19287 - getImpl().mxWindow->setEnable( bEnable );
19290 -void Window::Show( BOOL bVisible )
19292 - if ( !getImpl().mxWindow.is() )
19294 - getImpl().mxWindow->setVisible( bVisible );
19297 -void Window::GrabFocus()
19299 - if ( !getImpl().mxWindow.is() )
19301 - getImpl().mxWindow->setFocus();
19304 -class DialogImpl : public WindowImpl
19307 - uno::Reference< awt::XDialog2 > mxDialog;
19308 - DialogImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19309 - : WindowImpl( pCtx, xPeer, pWindow )
19310 - , mxDialog( xPeer, uno::UNO_QUERY )
19315 -IMPL_GET_IMPL( Dialog )
19317 -Dialog::Dialog( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId )
19318 - : Context( pXMLPath )
19319 - , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
19322 - SetParent( pParent );
19325 -Dialog::Dialog( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId )
19326 - : Context( pXMLPath )
19327 - , Window( new DialogImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
19330 - SetParent( pParent );
19333 -short Dialog::Execute()
19335 - if ( !getImpl().mxDialog.is() )
19337 - return getImpl().mxDialog->execute();
19340 -void Dialog::EndDialog( long nResult )
19342 - if ( !getImpl().mxDialog.is() )
19344 - getImpl().mxDialog->endDialog( nResult );
19347 -void Dialog::SetText( String const& rStr )
19349 - if ( !getImpl().mxDialog.is() )
19351 - getImpl().mxDialog->setTitle( rStr );
19354 -class TabPageImpl : public WindowImpl
19357 - uno::Reference< awt::XWindow > mxTabPage;
19358 - TabPageImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19359 - : WindowImpl( pCtx, xPeer, pWindow )
19360 - , mxTabPage( xPeer, uno::UNO_QUERY )
19365 -::Window* TabPage::global_parent = 0;
19367 -IMPL_GET_IMPL( TabPage )
19369 -TabPage::TabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
19370 - : Context( pXMLPath )
19371 - , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
19372 - , bHasExchangeSupport( false )
19376 - SetParent( pParent );
19379 -TabPage::TabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
19380 - : Context( pXMLPath )
19381 - , Window( new TabPageImpl( this, Context::GetPeerHandle( pId, nId ), this ) )
19382 - , bHasExchangeSupport( false )
19386 - SetParent( pParent );
19389 -TabPage::~TabPage()
19391 - delete GetTabPage();
19394 -IMPL_GET_WINDOW( TabPage );
19396 -void TabPage::ActivatePage()
19400 -void TabPage::DeactivatePage()
19405 -SfxTabPage::SfxTabPage( Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
19406 - : TabPage( pParent, pXMLPath, pId, nId )
19407 - , bHasExchangeSupport( false )
19412 -SfxTabPage::SfxTabPage( ::Window *pParent, const char *pXMLPath, const char *pId, sal_uInt32 nId, SfxItemSet const* set )
19413 - : TabPage( pParent, pXMLPath, pId, nId )
19417 -/* FIXME: static method, full c&p from sfx2/source/dialog/tabdlg.cxx */
19418 -//const SfxPoolItem* TabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
19419 -const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, USHORT nSlot )
19422 - const SfxItemPool* pPool = rSet.GetPool();
19423 - USHORT nWh = pPool->GetWhich( nSlot );
19424 - const SfxPoolItem* pItem = 0;
19426 - SfxItemState eState;
19429 - rSet.GetItemState( nWh, TRUE, &pItem ); // -Wall required??
19431 - if ( !pItem && nWh != nSlot )
19432 - pItem = &pPool->GetDefaultItem( nWh );
19437 -#define SfxTabPage TabPage
19441 -void SfxTabPage::Reset( SfxItemSet const& )
19445 -class FixedLineImpl : public ControlImpl
19448 - FixedLineImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19449 - : ControlImpl( pCtx, xPeer, pWindow )
19454 -IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" );
19455 -IMPL_GET_IMPL( FixedLine )
19457 -bool FixedLine::IsEnabled()
19463 -class FixedTextImpl : public ControlImpl
19466 - uno::Reference< awt::XFixedText > mxFixedText;
19467 - FixedTextImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19468 - : ControlImpl( pCtx, xPeer, pWindow )
19469 - , mxFixedText( xPeer, uno::UNO_QUERY )
19473 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
19474 - throw (css::uno::RuntimeException)
19476 - mxFixedText.clear();
19480 -IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" );
19481 -IMPL_GET_IMPL( FixedText )
19483 -void FixedText::SetText( String const& rStr )
19485 - if ( !getImpl().mxFixedText.is() )
19487 - getImpl().mxFixedText->setText( rStr );
19490 -class FixedInfoImpl : public FixedTextImpl
19493 - FixedInfoImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19494 - : FixedTextImpl( pCtx, xPeer, pWindow )
19499 -IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" );
19500 -IMPL_GET_IMPL( FixedInfo );
19502 -class ProgressBarImpl : public ControlImpl
19505 - uno::Reference< awt::XProgressBar > mxProgressBar;
19506 - ProgressBarImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19507 - : ControlImpl( pCtx, xPeer, pWindow )
19508 - , mxProgressBar( xPeer, uno::UNO_QUERY )
19512 - virtual void SAL_CALL disposing( const css::lang::EventObject& /* Source */ )
19513 - throw (css::uno::RuntimeException)
19515 - mxProgressBar.clear();
19520 -class FixedImageImpl: public ControlImpl
19523 - uno::Reference< graphic::XGraphic > mxGraphic;
19524 - FixedImageImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow)
19525 -// const char *pName )
19526 - : ControlImpl( pCtx, xPeer, pWindow )
19527 - //, mxGraphic( layoutimpl::loadGraphic( pName ) )
19528 - , mxGraphic( xPeer, uno::UNO_QUERY )
19530 - if ( !mxGraphic.is() )
19532 - DBG_ERROR( "ERROR: failed to load image: `%s'" /*, pName*/ );
19536 - getImpl().mxGraphic->...();
19541 -IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" );
19542 -IMPL_GET_IMPL( FixedImage )
19544 -void FixedImage::setImage( ::Image const& i )
19547 - if ( !getImpl().mxGraphic.is() )
19549 - //FIXME: hack moved to proplist
19550 - //getImpl().mxGraphic =
19555 - FixedImage::FixedImage( const char *pName )
19556 - : pImpl( new FixedImageImpl( pName ) )
19560 -FixedImage::~FixedImage()
19568 -IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
19570 -ProgressBar::ProgressBar( Context *pCtx, const char *pId, sal_uInt32 nId )
19571 - : Control( new ProgressBarImpl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) )
19574 -ProgressBar::ProgressBar( Window *pParent, WinBits nBits)
19575 -// : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "ProgressBar" ), this ) )
19576 - : Control( new ProgressBarImpl( pParent->getContext(), Window::CreatePeer( pParent, nBits, "progressbar" ), this ) )
19581 -IMPL_GET_IMPL( ProgressBar );
19584 -void ProgressBar::SetForegroundColor( css::util::Color color )
19586 - if ( !getImpl().mxProgressBar.is() )
19588 - getImpl().mxProgressBar->setForegroundColor( color );
19591 -void ProgressBar::SetBackgroundColor( css::util::Color color )
19593 - if ( !getImpl().mxProgressBar.is() )
19595 - getImpl().mxProgressBar->setBackgroundColor( color );
19598 -void ProgressBar::SetValue( sal_Int32 i )
19600 - if ( !getImpl().mxProgressBar.is() )
19602 - getImpl().mxProgressBar->setValue( i );
19605 -void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max )
19607 - if ( !getImpl().mxProgressBar.is() )
19609 - getImpl().mxProgressBar->setRange( min, max );
19612 -sal_Int32 ProgressBar::GetValue()
19614 - if ( !getImpl().mxProgressBar.is() )
19616 - return getImpl().mxProgressBar->getValue();
19619 -class PluginImpl: public ControlImpl
19622 - ::Control *mpPlugin;
19624 - PluginImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow, :: Control *plugin )
19625 - : ControlImpl( pCtx, xPeer, pWindow )
19626 - , mpPlugin( plugin )
19628 - uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
19629 - layoutimpl::VCLXPlugin *vcl
19630 - = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) );
19631 - ::Window *parent = vcl->mpWindow->GetParent();
19632 - vcl->SetWindow( plugin );
19633 - vcl->SetPlugin( mpPlugin );
19634 - plugin->SetParent( parent );
19635 - plugin->SetStyle( vcl->mStyle );
19636 - plugin->SetCreatedWithToolkit( TRUE );
19637 - plugin->SetComponentInterface( vcl );
19642 -Plugin::Plugin( Context *pCtx, char const *pId, ::Control *plugin )
19643 - : Control( new PluginImpl( pCtx, pCtx->GetPeerHandle( pId, 0 ), this, plugin ) )
19644 - , mpPlugin( plugin )
19648 -IMPL_GET_IMPL( Plugin );
19650 -class LocalizedStringImpl : public WindowImpl
19653 - layoutimpl::LocalizedString *mpString;
19654 - LocalizedStringImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19655 - : WindowImpl( pCtx, xPeer, pWindow )
19656 - , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) )
19659 - OUString getText()
19662 - return mpString->getText();
19663 - return OUString();
19665 - void setText( OUString const& s )
19668 - mpString->setText( s );
19672 -IMPL_GET_IMPL( LocalizedString );
19674 -LocalizedString::LocalizedString( Context *pCtx, char const* pId )
19675 - : Window( new LocalizedStringImpl( pCtx, pCtx->GetPeerHandle( pId, 0 ), this ) )
19679 -LocalizedString::operator String ()
19681 - return getImpl().getText();
19684 -String LocalizedString::operator= (String const& s)
19686 - getImpl().setText( s );
19687 - return getImpl().getText();
19690 -} // namespace layout
19691 --- toolkit/source/vclcompat/wrapper.hxx.old 2009-04-06 16:42:11.000000000 +0000
19692 +++ toolkit/source/vclcompat/wrapper.hxx 1970-01-01 00:00:00.000000000 +0000
19694 -/*************************************************************************
19696 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19698 - * Copyright 2008 by Sun Microsystems, Inc.
19700 - * OpenOffice.org - a multi-platform office productivity suite
19702 - * $RCSfile: wrapper.hxx,v $
19704 - * $Revision: 1.3 $
19706 - * This file is part of OpenOffice.org.
19708 - * OpenOffice.org is free software: you can redistribute it and/or modify
19709 - * it under the terms of the GNU Lesser General Public License version 3
19710 - * only, as published by the Free Software Foundation.
19712 - * OpenOffice.org is distributed in the hope that it will be useful,
19713 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
19714 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19715 - * GNU Lesser General Public License version 3 for more details
19716 - * (a copy is included in the LICENSE file that accompanied this code).
19718 - * You should have received a copy of the GNU Lesser General Public License
19719 - * version 3 along with OpenOffice.org. If not, see
19720 - * <http://www.openoffice.org/license.html>
19721 - * for a copy of the LGPLv3 License.
19723 - ************************************************************************/
19725 -#ifndef WRAPPER_HXX
19726 -#define WRAPPER_HXX
19728 -#include <layout/layout.hxx>
19729 -#include <com/sun/star/uno/Reference.hxx>
19730 -#include <com/sun/star/awt/XWindow.hpp>
19731 -#include <com/sun/star/awt/XVclWindowPeer.hpp>
19733 -#include <cstring>
19738 -namespace css = com::sun::star;
19743 - Window *mpWindow;
19745 - css::uno::Reference< css::awt::XWindow > mxWindow;
19746 - css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer;
19748 - WindowImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19749 - : mpWindow( pWindow )
19751 - , mxWindow( xPeer, css::uno::UNO_QUERY )
19752 - , mxVclPeer( xPeer, css::uno::UNO_QUERY )
19756 - virtual ~WindowImpl()
19760 - void wrapperGone()
19764 - if ( mxWindow.is() )
19766 - css::uno::Reference< css::lang::XComponent > xComp( mxWindow, css::uno::UNO_QUERY );
19767 - mxWindow.clear();
19768 - if ( xComp.is() )
19769 - xComp->dispose();
19773 - css::uno::Any getProperty( const char *pName )
19775 - if ( !this || !mxVclPeer.is() )
19776 - return css::uno::Any();
19777 - return mxVclPeer->getProperty
19778 - ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ) );
19780 - void setProperty( const char *pName, css::uno::Any aAny )
19782 - if ( !this || !mxVclPeer.is() )
19784 - mxVclPeer->setProperty
19785 - ( rtl::OUString( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ), aAny );
19789 -class ControlImpl : public WindowImpl
19792 - ControlImpl( Context *pCtx, const PeerHandle &xPeer, Window *pWindow )
19793 - : WindowImpl( pCtx, xPeer, pWindow )
19798 -inline WindowImpl &Window::getImpl() const
19799 -{ return *(static_cast< WindowImpl * >( mpImpl )); }
19801 -// Helpers for defining boiler-plate constructors ...
19802 -// Could in-line in top-level but not with safe static_casts.
19803 -#define IMPL_GET_IMPL(t) \
19804 - inline t##Impl &t::getImpl() const \
19806 - return *(static_cast<t##Impl *>(mpImpl)); \
19808 -#define IMPL_CONSTRUCTORS(t,par,unoName) \
19809 - t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
19810 - : par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
19813 - t::t( Window *pParent, WinBits nBits) \
19814 - : par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \
19817 -#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \
19818 - t::t( Context *pCtx, const char *pId, sal_uInt32 nId ) \
19819 - : win_par( new t##Impl( pCtx, pCtx->GetPeerHandle( pId, nId ), this ) ) \
19820 - , other_par( new other_par##Impl( Window::GetPeer() ) ) \
19823 - t::t( Window *pParent, WinBits nBits ) \
19824 - : win_par( new t##Impl( pParent->getContext(), Window::CreatePeer( pParent, nBits, unoName ), this ) ) \
19825 - , other_par( new other_par##Impl( Window::GetPeer() ) ) \
19829 -} // namespace layout
19831 -#endif // WRAPPER_HXX
19832 --- toolkit/src2xml/source/boxer.py.old 2009-04-02 10:49:37.000000000 +0000
19833 +++ toolkit/src2xml/source/boxer.py 2009-04-06 16:42:13.000000000 +0000
19834 @@ -9,11 +9,11 @@ class DlgLayoutBuilder(object):
19836 def addWidget (self, elem):
19837 x, y = int(elem.getAttr('x')), int(elem.getAttr('y'))
19838 - if self.rows.has_key(y):
19839 - self.rows[y][x] = elem
19841 - self.rows[y] = {}
19842 - self.rows[y][x] = elem
19843 + self.rows[y] = self.rows.get (y, {})
19844 + while self.rows[y].has_key(x):
19846 + self.rows[y] = self.rows.get (y, {})
19847 + self.rows[y][x] = elem
19850 root = Element('vbox')
19851 @@ -53,6 +53,8 @@ class Boxer(object):
19853 newnode = Element(dlgnode.name)
19854 newnode.clone(dlgnode)
19855 + if dlgnode.name == 'string':
19857 newnode.setAttr("xmlns", "http://openoffice.org/2007/layout")
19858 newnode.setAttr("xmlns:cnt", "http://openoffice.org/2007/layout/container")
19859 mx = DlgLayoutBuilder(newnode)
19860 --- toolkit/src2xml/source/src2xml.py.old 2009-04-06 16:42:11.000000000 +0000
19861 +++ toolkit/src2xml/source/src2xml.py 2009-04-06 16:42:13.000000000 +0000
19862 @@ -127,7 +127,6 @@ def convert (file_name, options):
19863 lexer.includeDirs = options.include_path
19864 lexer.stopOnHeader = options.stopOnHeader
19865 lexer.debugMacro = options.debug_macro
19866 -# lexer.debug = True
19867 if options.debug_lexer:
19870 @@ -145,8 +144,8 @@ def convert (file_name, options):
19871 if options.debug_parser:
19872 parser.debug = True
19873 root = parser.parse()
19874 - print root.dump()
19879 # Parse the tokens.
19880 root = parser.parse()
19881 @@ -174,9 +173,11 @@ def post_process (s):
19882 """Make output directly usable by layout module."""
19883 s = re.sub ('(</?)([a-z]+)-([a-z]+)-([a-z]+)', r'\1\2\3\4', s)
19884 s = re.sub ('(</?)([a-z]+)-([a-z]+)', r'\1\2\3', s)
19885 - s = re.sub ('(<(checkbox|radiobutton|(fixed(info|text)))[^>]*) text=', r'\1 label=', s)
19886 + s = re.sub ('(<(checkbox|(cancel|help|ignore|ok|push|more|no|radio|reset|retry|yes)button|(fixed(info|text)))[^>]*) text=', r'\1 label=', s)
19887 s = re.sub (' (height|width|x|y)="[0-9]*"', '', s)
19888 s = re.sub (' (label|text|title)="', r' _\1="', s)
19889 + s = re.sub ('&([^m][^p]*[^;]*)', r'&\1', s)
19890 + s = re.sub (' hide="(TRUE|true|1)"', ' show="false"', s)
19892 s = s.replace ('<modaldialog', '<modaldialog sizeable="true"')
19893 s = s.replace (' rid=', ' id=')
19894 --- toolkit/uiconfig/layout/delzip.old 1970-01-01 00:00:00.000000000 +0000
19895 +++ toolkit/uiconfig/layout/delzip 2009-04-06 16:42:13.000000000 +0000
19898 \ No newline at end of file
19899 --- toolkit/uiconfig/layout/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
19900 +++ toolkit/uiconfig/layout/makefile.mk 2009-04-06 16:42:13.000000000 +0000
19902 +#*************************************************************************
19904 +# OpenOffice.org - a multi-platform office productivity suite
19910 +# last change: $Author$ $Date$
19912 +# The Contents of this file are made available subject to
19913 +# the terms of GNU Lesser General Public License Version 2.1.
19916 +# GNU Lesser General Public License Version 2.1
19917 +# =============================================
19918 +# Copyright 2005 by Sun Microsystems, Inc.
19919 +# 901 San Antonio Road, Palo Alto, CA 94303, USA
19921 +# This library is free software; you can redistribute it and/or
19922 +# modify it under the terms of the GNU Lesser General Public
19923 +# License version 2.1, as published by the Free Software Foundation.
19925 +# This library is distributed in the hope that it will be useful,
19926 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
19927 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19928 +# Lesser General Public License for more details.
19930 +# You should have received a copy of the GNU Lesser General Public
19931 +# License along with this library; if not, write to the Free Software
19932 +# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
19933 +# MA 02110-1301 USA
19935 +#*************************************************************************
19941 +.INCLUDE : settings.mk
19943 +.IF "$(ENABLE_LAYOUT)" == "TRUE"
19953 +.INCLUDE : layout.mk
19955 +.ELSE # ENABLE_LAYOUT != TRUE
19957 +.ENDIF # ENABLE_LAYOUT != TRUE
19959 +.INCLUDE : target.mk
19962 + echo '#empty' | cat - > $@
19964 --- toolkit/uiconfig/layout/message-box.xml.old 1970-01-01 00:00:00.000000000 +0000
19965 +++ toolkit/uiconfig/layout/message-box.xml 2009-04-06 16:42:13.000000000 +0000
19967 +<?xml version="1.0" encoding="UTF-8"?>
19968 +<!-- This is a template. i18n translation is not performed in-place;
19969 + i18n translated xml files are generated from this template by
19970 + transex3/layout/tralay. !-->
19972 +<modaldialog xmlns="http://openoffice.org/2007/layout"
19973 + xmlns:cnt="http://openoffice.org/2007/layout/container"
19974 + id="message-box" _title="" optimumsize="true"
19975 + has_border="true" sizeable="true" moveable="true" closeable="true">
19976 + <vbox border="5" spacing="5">
19977 + <hbox border="5" spacing="20">
19978 + <align cnt:expand="false" cnt:fill="true">
19979 + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" />
19981 + <align cnt:expand="false" cnt:fill="true">
19982 + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" />
19984 + <align cnt:expand="false" cnt:fill="true">
19985 + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" />
19987 + <align cnt:expand="false" cnt:fill="true">
19988 + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" />
19990 + <align cnt:expand="false" cnt:fill="true">
19991 + <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" />
19995 + <dialogbuttonhbox border="0" spacing="5">
19997 + <!-- deprecoted vcl/MsgBox compatibility !-->
19998 + <retrybutton id="BTN_RETRY" />
19999 + <ignorebutton id="BTN_IGNORE" />
20001 + <yesbutton id="BTN_YES"/>
20002 + <cancelbutton id="BTN_CANCEL"/>
20003 + <helpbutton id="BTN_HELP"/>
20004 + <nobutton id="BTN_NO" xlabel="~Alternate"/>
20005 + </dialogbuttonhbox>
20008 --- toolkit/uiconfig/layout/tab-dialog.xml.old 1970-01-01 00:00:00.000000000 +0000
20009 +++ toolkit/uiconfig/layout/tab-dialog.xml 2009-04-06 16:42:13.000000000 +0000
20011 +<?xml version="1.0" encoding="UTF-8"?>
20013 +<dialog xmlns="http://openoffice.org/2007/layout"
20014 + xmlns:cnt="http://openoffice.org/2007/layout/container"
20015 + _title="layout::TabDialog" optimumsize="true"
20017 + has_border="true" sizeable="true" moveable="true">
20018 + <vbox spacing="5" border="5">
20019 + <tabcontrol id="ID_TABCONTROL"/>
20020 + <dialogbuttonhbox border="5" spacing="5" cnt:expand="false">
20022 + <okbutton id="BTN_OK" show="false"/>
20023 + <pushbutton id="BTN_USER" _label="<User>" show="false"/>
20024 + <cancelbutton id="BTN_CANCEL" show="false"/>
20025 + <helpbutton id="BTN_HELP" show="false"/>
20026 + <resetbutton id="BTN_RESET" show="false"/>
20027 + <pushbutton id="BTN_BASEFMT" _label="<Base Format>" show="false"/>
20028 + </dialogbuttonhbox>
20031 --- toolkit/util/makefile.mk.old 2009-04-02 10:49:37.000000000 +0000
20032 +++ toolkit/util/makefile.mk 2009-04-06 16:42:13.000000000 +0000
20033 @@ -54,8 +54,8 @@ LIB1FILES= $(SLB)$/awt.lib \
20035 $(SLB)$/controls.lib \
20036 $(SLB)$/helper.lib\
20037 - $(SLB)$/layoutcore.lib \
20038 - $(SLB)$/vclcompat.lib
20039 + $(SLB)$/layout-core.lib \
20040 + $(SLB)$/layout-vcl.lib
20042 SHL1TARGET= tk$(DLLPOSTFIX)
20044 --- toolkit/util/makefile.pmk.old 2009-04-02 10:49:37.000000000 +0000
20045 +++ toolkit/util/makefile.pmk 2009-04-06 16:42:13.000000000 +0000
20047 CDEFS += -DTOOLKIT_DLLIMPLEMENTATION
20048 VISIBILITY_HIDDEN=TRUE
20050 -# FIXME: sprinkle some TOOLKIT_DLLPUBLIC
20051 +CFLAGS+=-I$(PRJ)/source
20053 -CFLAGS+=-I$(PRJ)/inc/layout
20054 .IF "$(ENABLE_LAYOUT)" == "TRUE"
20055 -CFLAGS+=-DENABLE_LAYOUT=1 -DTEST_LAYOUT=1
20057 -CFLAGS+=-DENABLE_LAYOUT=0
20058 +CFLAGS+=-DTEST_LAYOUT=1
20059 .ENDIF # ENABLE_LAYOUT == TRUE
20060 --- toolkit/workben/layout/.gitignore.old 2009-04-06 16:42:11.000000000 +0000
20061 +++ toolkit/workben/layout/.gitignore 2009-04-06 16:42:13.000000000 +0000
20067 \ No newline at end of file
20068 --- toolkit/workben/layout/TEST.old 1970-01-01 00:00:00.000000000 +0000
20069 +++ toolkit/workben/layout/TEST 2009-04-06 16:42:13.000000000 +0000
20071 +export OOO_INSTALL_PREFIX=$(cd ../../../../.. && pwd)/ooo-svn
20072 +test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX
20073 +LD_LIBRARY_PATH=$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib ../../unxlngx6.pro/bin/test "$@"
20074 --- toolkit/workben/layout/editor.cxx.old 2009-04-06 16:42:11.000000000 +0000
20075 +++ toolkit/workben/layout/editor.cxx 2009-04-06 16:42:13.000000000 +0000
20076 @@ -57,10 +57,9 @@ using rtl::OUString;
20080 -// somewhat of a hack unfortunately ...
20081 -#include "layout/layoutcore.hxx"
20082 -#include "root.hxx"
20083 -#include "helper.hxx"
20084 +#include <layout/core/helper.hxx>
20085 +#include <layout/core/root.hxx>
20086 +#include <layout/core/helper.hxx>
20088 // TODO: automatically generated
20089 struct WidgetSpec {
20090 @@ -86,19 +85,6 @@ static const WidgetSpec WIDGETS_SPECS[]
20092 const int WIDGETS_SPECS_LEN = sizeof (WIDGETS_SPECS) / sizeof (WidgetSpec);
20094 -// TEMP: from helper
20095 -namespace layoutimpl {
20097 - typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList;
20099 - css::uno::Reference< css::awt::XLayoutConstrains >
20100 - createWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
20101 - css::uno::Reference< css::uno::XInterface > xParent,
20102 - const rtl::OUString &rName, long nProps, bool bToplevel );
20104 - uno::Any anyFromString (const rtl::OUString &value, const uno::Type &type);
20107 using namespace layout;
20108 using namespace layoutimpl;
20109 namespace css = ::com::sun::star;
20110 @@ -128,9 +114,9 @@ static rtl::OUString anyToString (uno::A
20111 bool val = value.get<sal_Bool>();
20112 return rtl::OUString( val ? "1" : "0", 1, RTL_TEXTENCODING_ASCII_US );
20114 - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
20116 - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/
20117 + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
20119 + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/
20123 @@ -147,8 +133,9 @@ static inline double anyToDecimal (uno::
20125 /* XLayoutContainer/XLayoutConstrains are a bit of a hasle to work with.
20126 Let's wrap them. */
20127 -class Widget : public layoutimpl::LayoutWidget {
20128 -friend class EditorRoot;
20129 +class Widget : public layoutimpl::LayoutWidget
20131 + friend class EditorRoot;
20134 std::vector< Widget *> maChildren;
20135 @@ -165,7 +152,7 @@ public:
20137 // to be used to wrap the root
20138 Widget( uno::Reference< awt::XLayoutConstrains > xImport, const char *label )
20139 - : mpParent( 0 ), mbForeign( true )
20140 + : mpParent( 0 ), mbForeign( true )
20142 mxWidget = xImport;
20143 mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
20144 @@ -189,20 +176,20 @@ public:
20145 Widget( rtl::OUString id, uno::Reference< awt::XToolkit > xToolkit,
20146 uno::Reference< awt::XLayoutContainer > xParent,
20147 rtl::OUString unoName, long nAttrbs )
20148 - : mpParent( 0 ), mbForeign( false ), mrId( id ),
20149 - mnOriAttrbs( nAttrbs )
20150 + : mpParent( 0 ), mbForeign( false ), mrId( id ),
20151 + mnOriAttrbs( nAttrbs )
20153 - while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
20155 - uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
20156 - assert( xContainer.is() );
20157 - xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
20160 - mxWidget = layoutimpl::createWidget( xToolkit, xParent, unoName, nAttrbs );
20161 + while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
20163 + uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
20164 + assert( xContainer.is() );
20165 + xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
20168 + mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs );
20169 assert( mxWidget.is() );
20170 mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
20173 mrLabel = mrUnoName = unoName;
20174 // try to get a nicer label for the widget
20175 for ( int i = 0; i < WIDGETS_SPECS_LEN; i++ )
20176 @@ -212,21 +199,21 @@ public:
20177 mrLabel = rtl::OUString( label, strlen( label ), RTL_TEXTENCODING_UTF8 );
20182 // set default Text property
20183 // TODO: disable editing of text fields, check boxes selected, etc...
20185 uno::Reference< awt::XVclWindowPeer> xVclPeer( mxWidget, uno::UNO_QUERY )
20186 - if ( xVclPeer.is() ) // XVclWindowPeer ignores missing / incorrect properties
20187 + if ( xVclPeer.is() ) // XVclWindowPeer ignores missing / incorrect properties
20189 //FIXME: it looks odd on widgets like NumericField seeing text which is deleted
20190 // when you interact with it... We can avoid it for those widgets, by doing a getProp
20191 // of "Text" and check if it is empty or not.
20193 - xVclPeer->setProperty( rtl::OUString::createFromAscii( "Text" ),
20194 - uno::makeAny( rtl::OUString::createFromAscii( "new widget" ) ) );
20196 + xVclPeer->setProperty( rtl::OUString::createFromAscii( "Text" ),
20197 + uno::makeAny( rtl::OUString::createFromAscii( "new widget" ) ) );
20201 // store original properties
20203 PropertyIterator it( this, WINDOW_PROPERTY );
20204 @@ -394,7 +381,7 @@ public:
20205 std::vector< Widget *> aChildChildren = pChild->maChildren;
20207 for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
20208 - it != aChildChildren.end(); it++ )
20209 + it != aChildChildren.end(); it++ )
20210 pChild->removeChild( *it );
20212 for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
20213 @@ -402,10 +389,10 @@ public:
20214 if ( !addChild( *it ) )
20216 for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
20219 removeChild( *jt );
20220 for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
20221 - jt != aChildChildren.end(); jt++ )
20222 + jt != aChildChildren.end(); jt++ )
20223 pChild->addChild( *jt );
20226 @@ -425,7 +412,7 @@ public:
20229 for ( std::vector< Widget *>::const_iterator it = maChildren.begin();
20230 - it != maChildren.end(); it++, i++ )
20231 + it != maChildren.end(); it++, i++ )
20232 if ( *it == pChild )
20235 @@ -499,7 +486,7 @@ public:
20236 case CONTAINER_PROPERTY:
20238 rValue = anyToString( layoutimpl::prophlp::getProperty(
20239 - mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) );
20240 + mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) );
20242 case WINBITS_PROPERTY:
20244 @@ -546,7 +533,7 @@ public:
20247 PropertyIterator( Widget *pWidget, PropertyKind rKind )
20248 - : mrKind( rKind ), nPropIt( 0 )
20249 + : mrKind( rKind ), nPropIt( 0 )
20253 @@ -588,10 +575,10 @@ public:
20254 beans::Property next()
20256 /* rtl::OUString propName, propValue;
20257 - propName = maProps[ nPropIt ];
20258 - propValue = getProperty( propName, mrKind, false);
20260 - return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/
20261 + propName = maProps[ nPropIt ];
20262 + propValue = getProperty( propName, mrKind, false);
20264 + return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/
20265 return maProps[ nPropIt++ ];
20268 @@ -603,13 +590,13 @@ class EditorRoot : public layoutimpl::La
20270 EditorRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
20272 - : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent )
20273 + : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent )
20278 virtual layoutimpl::LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName,
20279 - long attrbs, uno::Reference< awt::XLayoutContainer > xParent )
20280 + long attrbs, uno::Reference< awt::XLayoutContainer > xParent )
20282 if ( unoName.compareToAscii( "dialog" ) == 0 )
20284 @@ -629,126 +616,126 @@ public:
20285 /* Working with the layout in 1D, as if it was a flat list. */
20286 namespace FlatLayout
20288 - Widget *next( Widget *pWidget )
20291 - pNext = pWidget->down();
20292 - if ( pNext ) return pNext;
20293 - pNext = pWidget->next();
20294 - if ( pNext ) return pNext;
20295 - for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() )
20296 - if ( (pNext = pUp->next()) != NULL )
20300 +Widget *next( Widget *pWidget )
20303 + pNext = pWidget->down();
20304 + if ( pNext ) return pNext;
20305 + pNext = pWidget->next();
20306 + if ( pNext ) return pNext;
20307 + for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() )
20308 + if ( (pNext = pUp->next()) != NULL )
20314 - Widget *prev( Widget *pWidget )
20317 - pPrev = pWidget->prev();
20319 - return pWidget->up();
20321 - Widget *pBottom = pPrev->down();
20324 - while ( pBottom->down() || pBottom->next() )
20326 - for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() )
20328 - Widget *pDown = pBottom->down();
20336 + Widget *prev( Widget *pWidget )
20339 + pPrev = pWidget->prev();
20341 + return pWidget->up();
20343 + Widget *pBottom = pPrev->down();
20346 + while ( pBottom->down() || pBottom->next() )
20348 + for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() )
20350 + Widget *pDown = pBottom->down();
20360 - bool moveWidget( Widget *pWidget, bool up /*or down*/ )
20362 - // Keep child parent&pos for in case of failure
20363 - Widget *pOriContainer = pWidget->up();
20364 - unsigned int oriChildPos = pOriContainer->getChildPos( pWidget );
20366 - // Get parent&sibling before removing it, since relations get cut
20367 - Widget *pSibling = up ? pWidget->prev() : pWidget->next();
20368 - Widget *pContainer = pWidget->up();
20369 - if ( !pContainer )
20371 +bool moveWidget( Widget *pWidget, bool up /*or down*/ )
20373 + // Keep child parent&pos for in case of failure
20374 + Widget *pOriContainer = pWidget->up();
20375 + unsigned int oriChildPos = pOriContainer->getChildPos( pWidget );
20377 + // Get parent&sibling before removing it, since relations get cut
20378 + Widget *pSibling = up ? pWidget->prev() : pWidget->next();
20379 + Widget *pContainer = pWidget->up();
20380 + if ( !pContainer )
20383 - // try to swap with parent or child
20384 - // We need to allow for this at least for the root node...
20386 + // try to swap with parent or child
20387 + // We need to allow for this at least for the root node...
20392 + if ( pContainer->swapWithChild( pWidget ) )
20399 - if ( pContainer->swapWithChild( pWidget ) )
20404 // TODO: this is a nice feature, but we probably want to do it explicitely...
20406 - if ( pWidget->down() && pWidget->swapWithChild( pWidget->down() ) )
20408 + if ( pWidget->down() && pWidget->swapWithChild( pWidget->down() ) )
20415 - pContainer->removeChild( pWidget );
20417 - // if has up sibling -- append to it, else swap with it
20420 - if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) )
20422 + pContainer->removeChild( pWidget );
20424 - unsigned int childPos = pContainer->getChildPos( pSibling );
20425 - if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) )
20426 - return true; // should always be succesful
20428 - // go through parents -- try to get prepended to them
20431 - for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() )
20433 - unsigned int childPos = pContainer->up()->getChildPos( pContainer );
20434 - if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) )
20438 + // if has up sibling -- append to it, else swap with it
20441 + if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) )
20444 - // failed -- try to get it to its old position
20445 - if ( !pOriContainer->addChild( pWidget, oriChildPos ) )
20446 + unsigned int childPos = pContainer->getChildPos( pSibling );
20447 + if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) )
20448 + return true; // should always be succesful
20450 + // go through parents -- try to get prepended to them
20453 + for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() )
20455 - // a parent should never reject a child back. but if it ever
20456 - // happens, just kill it, we don't run an orphanate here ;P
20459 + unsigned int childPos = pContainer->up()->getChildPos( pContainer );
20460 + if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) )
20466 - // NOTE: root is considered to be number -1
20467 - Widget *get( Widget *pRoot, int nb )
20468 + // failed -- try to get it to its old position
20469 + if ( !pOriContainer->addChild( pWidget, oriChildPos ) )
20472 - for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) )
20477 - int get( Widget *pRoot, Widget *pWidget )
20481 - for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) )
20484 + // a parent should never reject a child back. but if it ever
20485 + // happens, just kill it, we don't run an orphanate here ;P
20492 +// NOTE: root is considered to be number -1
20493 +Widget *get( Widget *pRoot, int nb )
20496 + for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) )
20501 +int get( Widget *pRoot, Widget *pWidget )
20505 + for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) )
20511 //** PropertiesList widget
20512 @@ -766,7 +753,7 @@ class PropertiesList : public layout::Ta
20513 DECL_LINK( FlagToggledHdl, layout::CheckBox* );
20515 AnyWidget( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind )
20516 - : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind )
20517 + : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind )
20520 mbBlockFlagCallback = false;
20521 @@ -844,7 +831,7 @@ class PropertiesList : public layout::Ta
20523 AnyEdit( Widget *pWidget, rtl::OUString aPropName,
20524 Widget::PropertyKind aPropKind, layout::Window *pWinParent )
20525 - : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent )
20526 + : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent )
20529 mpExpand = new layout::PushButton( pWinParent, WB_TOGGLE );
20530 @@ -872,7 +859,7 @@ class PropertiesList : public layout::Ta
20533 text = mpEdit->GetText();
20534 -printf("Remove mpEdit and expand\n");
20535 + printf("Remove mpEdit and expand\n");
20537 Remove( mpExpand );
20539 @@ -966,7 +953,7 @@ printf("Remove mpEdit and expand\n");
20541 AnyInteger( Widget *pWidget, rtl::OUString aPropName,
20542 Widget::PropertyKind aPropKind, Window *pWinParent )
20543 - : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER )
20544 + : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER )
20547 SetModifyHdl( LINK( this, AnyInteger, ApplyPropertyHdl ) );
20548 @@ -995,7 +982,7 @@ printf("Remove mpEdit and expand\n");
20550 AnyFloat( Widget *pWidget, rtl::OUString aPropName,
20551 Widget::PropertyKind aPropKind, Window *pWinParent )
20552 - : AnyInteger( pWidget, aPropName, aPropKind, pWinParent )
20553 + : AnyInteger( pWidget, aPropName, aPropKind, pWinParent )
20556 virtual void store()
20557 @@ -1008,7 +995,7 @@ printf("Remove mpEdit and expand\n");
20559 AnyCheckBox( Widget *pWidget, rtl::OUString aPropName,
20560 Widget::PropertyKind aPropKind, layout::Window *pWinParent )
20561 - : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent )
20562 + : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent )
20564 // adding some whitespaces to make the hit area larger
20565 // SetText( String::CreateFromAscii( "" ) );
20566 @@ -1052,7 +1039,7 @@ printf("Remove mpEdit and expand\n");
20568 AnyListBox( Widget *pWidget, rtl::OUString aPropName,
20569 Widget::PropertyKind aPropKind, Window *pWinParent )
20570 - : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN )
20571 + : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN )
20573 SetSelectHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) );
20575 @@ -1076,7 +1063,7 @@ printf("Remove mpEdit and expand\n");
20577 AnyAlign( Widget *pWidget, rtl::OUString aPropName,
20578 Widget::PropertyKind aPropKind, Window *pWinParent )
20579 - : AnyListBox( pWidget, aPropName, aPropKind, pWinParent )
20580 + : AnyListBox( pWidget, aPropName, aPropKind, pWinParent )
20582 InsertEntry( XubString::CreateFromAscii( "Left" ) );
20583 InsertEntry( XubString::CreateFromAscii( "Center" ) );
20584 @@ -1092,7 +1079,7 @@ printf("Remove mpEdit and expand\n");
20586 AnyComboBox( Widget *pWidget, rtl::OUString aPropName,
20587 Widget::PropertyKind aPropKind, Window *pWinParent )
20588 - : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN )
20589 + : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN )
20591 SetModifyHdl( LINK( this, AnyComboBox, ApplyPropertyHdl ) );
20593 @@ -1116,7 +1103,7 @@ printf("Remove mpEdit and expand\n");
20595 AnyFontStyle( Widget *pWidget, rtl::OUString aPropName,
20596 Widget::PropertyKind aPropKind, Window *pWinParent )
20597 - : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent )
20598 + : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent )
20600 InsertEntry( XubString::CreateFromAscii( "Bold" ) );
20601 InsertEntry( XubString::CreateFromAscii( "Italic" ) );
20602 @@ -1130,71 +1117,71 @@ printf("Remove mpEdit and expand\n");
20603 layout::CheckBox *mpFlag;
20604 AnyWidget *mpValue;
20607 - PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget )
20609 + PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget )
20611 + mpLabel = new layout::FixedText( pWinParent );
20613 - mpLabel = new layout::FixedText( pWinParent );
20615 - // append ':' to aPropName
20616 - rtl::OUStringBuffer buf( pAnyWidget->maPropName );
20617 - buf.append( sal_Unicode (':') );
20618 - mpLabel->SetText( buf.makeStringAndClear() );
20620 - mpValue = pAnyWidget;
20621 - mpFlag = new layout::CheckBox( pWinParent );
20622 - mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) );
20623 - mpValue->mpFlag = mpFlag;
20624 + // append ':' to aPropName
20625 + rtl::OUStringBuffer buf( pAnyWidget->maPropName );
20626 + buf.append( sal_Unicode (':') );
20627 + mpLabel->SetText( buf.makeStringAndClear() );
20629 + mpValue = pAnyWidget;
20630 + mpFlag = new layout::CheckBox( pWinParent );
20631 + mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) );
20632 + mpValue->mpFlag = mpFlag;
20640 fprintf(stderr, "REMOVING label, flag and value\n");
20651 - // Use this factory rather than the constructor -- check for NULL
20652 - static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName,
20653 - Widget::PropertyKind aPropKind, sal_uInt16 nType,
20654 - layout::Window *pWinParent )
20656 - AnyWidget *pAnyWidget;
20658 - case uno::TypeClass_STRING:
20659 - if ( aPropName.compareToAscii( "FontStyleName" ) == 0 )
20661 - pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent );
20664 - pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent );
20666 - case uno::TypeClass_SHORT:
20667 - if ( aPropName.compareToAscii( "Align" ) == 0 )
20669 - pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent );
20672 - // otherwise, treat as any other number...
20673 - case uno::TypeClass_LONG:
20674 - case uno::TypeClass_UNSIGNED_LONG:
20675 - pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent );
20677 - case uno::TypeClass_FLOAT:
20678 - case uno::TypeClass_DOUBLE:
20679 - pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent );
20680 + // Use this factory rather than the constructor -- check for NULL
20681 + static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName,
20682 + Widget::PropertyKind aPropKind, sal_uInt16 nType,
20683 + layout::Window *pWinParent )
20685 + AnyWidget *pAnyWidget;
20687 + case uno::TypeClass_STRING:
20688 + if ( aPropName.compareToAscii( "FontStyleName" ) == 0 )
20690 + pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent );
20692 - case uno::TypeClass_BOOLEAN:
20693 - pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent );
20695 + pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent );
20697 + case uno::TypeClass_SHORT:
20698 + if ( aPropName.compareToAscii( "Align" ) == 0 )
20700 + pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent );
20705 - return new PropertyEntry( pWinParent, pAnyWidget );
20707 + // otherwise, treat as any other number...
20708 + case uno::TypeClass_LONG:
20709 + case uno::TypeClass_UNSIGNED_LONG:
20710 + pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent );
20712 + case uno::TypeClass_FLOAT:
20713 + case uno::TypeClass_DOUBLE:
20714 + pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent );
20716 + case uno::TypeClass_BOOLEAN:
20717 + pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent );
20723 + return new PropertyEntry( pWinParent, pAnyWidget );
20727 layout::Window *mpParentWindow;
20729 @@ -1241,12 +1228,12 @@ printf("Remove mpEdit and expand\n");
20731 } while ( min <= max );
20737 PropertiesList( layout::Dialog *dialog )
20738 - : layout::Table( dialog, "properties-box" )
20739 - , mpParentWindow( dialog ), mpSeparator( 0 )
20740 + : layout::Table( dialog, "properties-box" )
20741 + , mpParentWindow( dialog ), mpSeparator( 0 )
20745 @@ -1310,7 +1297,7 @@ public:
20746 Container::Clear();
20748 for ( std::list< PropertyEntry* >::iterator it = maPropertiesList.begin();
20749 - it != maPropertiesList.end(); it++)
20750 + it != maPropertiesList.end(); it++)
20752 maPropertiesList.clear();
20754 @@ -1370,14 +1357,14 @@ IMPL_LINK( PropertiesList::PropertyEntry
20756 { // For a manual sort ListBox; asks for a ListBox and Up/Down/Remove
20758 -DECL_LINK( ItemSelectedHdl, layout::ListBox* );
20759 -DECL_LINK( UpPressedHdl, layout::Button* );
20760 -DECL_LINK( DownPressedHdl, layout::Button* );
20761 -DECL_LINK( RemovePressedHdl, layout::Button* );
20762 -layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton;
20763 + DECL_LINK( ItemSelectedHdl, layout::ListBox* );
20764 + DECL_LINK( UpPressedHdl, layout::Button* );
20765 + DECL_LINK( DownPressedHdl, layout::Button* );
20766 + DECL_LINK( RemovePressedHdl, layout::Button* );
20767 + layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton;
20770 -layout::ListBox *mpListBox;
20771 + layout::ListBox *mpListBox;
20773 virtual void upPressed( USHORT nPos )
20775 @@ -1423,8 +1410,8 @@ layout::ListBox *mpListBox;
20777 SortListBox( layout::ListBox *pListBox, layout::PushButton *pUpButton, layout::PushButton *pDownButton,
20778 layout::PushButton *pRemoveButton )
20779 - : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ),
20780 - mpListBox( pListBox )
20781 + : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ),
20782 + mpListBox( pListBox )
20784 mpListBox->SetSelectHdl( LINK( this, SortListBox, ItemSelectedHdl ) );
20786 @@ -1508,10 +1495,10 @@ public:
20787 Widget *mpRootWidget;
20789 LayoutTree( layout::Dialog *dialog )
20790 - : SortListBox( new layout::ListBox( dialog, "layout-tree" ),
20791 - new layout::PushButton( dialog, "layout-up-button" ),
20792 - new layout::PushButton( dialog, "layout-down-button" ),
20793 - new layout::PushButton( dialog, "layout-remove-button" ) )
20794 + : SortListBox( new layout::ListBox( dialog, "layout-tree" ),
20795 + new layout::PushButton( dialog, "layout-up-button" ),
20796 + new layout::PushButton( dialog, "layout-down-button" ),
20797 + new layout::PushButton( dialog, "layout-remove-button" ) )
20799 layout::PeerHandle handle = dialog->GetPeerHandle( "preview-box" );
20800 uno::Reference< awt::XLayoutConstrains > xWidget( handle, uno::UNO_QUERY );
20801 @@ -1609,7 +1596,7 @@ public:
20802 for ( int kind = 0; kind < 2; kind++ )
20804 Widget::PropertyKind wKind = kind == 0 ? Widget::WINDOW_PROPERTY
20805 - : Widget::CONTAINER_PROPERTY;
20806 + : Widget::CONTAINER_PROPERTY;
20807 Widget::PropertyIterator it( i, wKind );
20808 while ( it.hasNext() )
20810 @@ -1621,16 +1608,16 @@ public:
20811 if ( prop.Type.getTypeClass() == uno::TypeClass_BOOLEAN )
20813 if ( value.compareToAscii( "0" ) )
20814 - value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") );
20815 + value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") );
20817 - value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") );
20818 + value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") );
20821 if ( value.getLength() > 0 )
20822 printf("%s%s=\"%s\" ",
20823 - kind == 0 ? "" : "cnt:",
20824 - OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value )
20826 + kind == 0 ? "" : "cnt:",
20827 + OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value )
20832 @@ -1711,7 +1698,7 @@ class EditorImpl : public LayoutTree::Li
20835 EditorImpl( layout::Dialog *dialog,
20836 - // we should probable open this channel (or whatever its called) ourselves
20837 + // we should probable open this channel (or whatever its called) ourselves
20838 uno::Reference< lang::XMultiServiceFactory > xMSF );
20839 virtual ~EditorImpl();
20841 @@ -1746,7 +1733,7 @@ EditorImpl::EditorImpl( layout::Dialog *
20842 mpLayoutTree->setListener( this );
20844 /* if ( xImport.is() )
20845 - mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/
20846 + mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/
20849 layout::Container aWidgets( dialog, "create-widget" );
20850 @@ -1789,7 +1776,7 @@ EditorImpl::~EditorImpl()
20851 delete mpPropertiesList;
20852 delete mpLayoutTree;
20853 for ( std::list< layout::PushButton * >::const_iterator i = maCreateButtons.begin();
20854 - i != maCreateButtons.end(); i++)
20855 + i != maCreateButtons.end(); i++)
20857 delete pImportButton;
20858 delete pExportButton;
20859 @@ -1869,13 +1856,13 @@ void EditorImpl::widgetSelected( Widget
20860 if ( !pWidget || pWidget->isContainer() )
20862 for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
20863 - it != maCreateButtons.end(); it++)
20864 + it != maCreateButtons.end(); it++)
20869 for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
20870 - it != maCreateButtons.end(); it++)
20871 + it != maCreateButtons.end(); it++)
20875 @@ -1886,7 +1873,7 @@ IMPL_LINK( EditorImpl, CreateWidgetHdl,
20878 for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
20879 - it != maCreateButtons.end(); it++, i++ )
20880 + it != maCreateButtons.end(); it++, i++ )
20884 --- toolkit/workben/layout/insert-sheet.xml.old 1970-01-01 00:00:00.000000000 +0000
20885 +++ toolkit/workben/layout/insert-sheet.xml 2009-04-06 16:42:13.000000000 +0000
20887 +<?xml version="1.0" encoding="UTF-8"?>
20888 +<!-- This is a template. i18n translation is not performed in-place;
20889 + i18n translated XML files are generated from this template by
20890 + transex3/layout/tralay. !-->
20892 +<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">
20893 + <vbox spacing="5" border="5">
20894 + <fixedline id="FL_POSITION" _text="Position"/>
20896 + <vbox cnt:padding="13" spacing="5">
20897 + <radiobutton radiogroup="insert-sheet-position" id="RB_BEFORE" tabstop="true" _label="B~efore current sheet"/>
20898 + <radiobutton radiogroup="insert-sheet-position" id="RB_BEHIND" tabstop="true" _label="~After current sheet"/>
20901 + <fixedline id="FL_TABLE" _text="Sheet"/>
20903 + <vbox cnt:padding="13" spacing="5">
20904 + <radiobutton radiogroup="insert-sheet-source" id="RB_NEW" _label="~New sheet"/>
20906 + <vbox cnt:padding="13" spacing="5" cnt:fill="false" cnt:expand="false">
20907 + <fixedtext id="FT_COUNT" _label="N~o. of sheets"/>
20908 + <fixedtext id="FT_NAME" _label="Na~me"/>
20912 + <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"/>
20914 + <edit has_border="true" id="ED_TABNAME" cnt:fill="true" cnt:expand="true"/>
20920 + <vbox cnt:padding="13" spacing="5">
20921 + <radiobutton radiogroup="insert-sheet-source" id="RB_FROMFILE" _label="~From file"/>
20923 + <vbox cnt:padding="13" spacing="5">
20925 + <multilistbox auto-hscroll="true" has_border="true" id="LB_TABLES" simple-mode="true" string-item-list=" : : : : " cnt:fill="true" cnt:expand="true"/>
20926 + <vbox cnt:fill="false" cnt:expand="false" spacing="5">
20927 + <pushbutton id="BTN_BROWSE" _label="~Browse..." cnt:expand="false"/>
20928 + <checkbox id="CB_LINK" _label="Lin~k" cnt:expand="false"/>
20932 + <fixedtext id="FT_PATH" label="FT-PATH"/>
20937 + <dialogbuttonhbox border="5" spacing="5">
20938 + <okbutton default="true" id="BTN_OK"/>
20939 + <cancelbutton id="BTN_CANCEL"/>
20940 + <helpbutton id="BTN_HELP"/>
20941 + </dialogbuttonhbox>
20944 --- toolkit/workben/layout/makefile.mk.old 2009-04-06 16:42:11.000000000 +0000
20945 +++ toolkit/workben/layout/makefile.mk 2009-04-06 16:42:13.000000000 +0000
20946 @@ -40,15 +40,11 @@ ENABLE_EXCEPTIONS=TRUE
20948 .IF "$(ENABLE_LAYOUT)" == "TRUE"
20950 -CFLAGS += -I$(PRJ)/source/layout
20952 # Allow zoom and wordcount to be built without depending on svx,sv,sfx2
20953 -CFLAGS += -I../$(PRJ)/svx/inc -I../$(PRJ)/svtools/inc -I../$(PRJ)/sfx2/inc -I../$(PRJ)/sc/inc -I../$(PRJ)/sc/source/ui/inc
20954 +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
20956 .INCLUDE : $(PRJ)$/util$/makefile.pmk
20958 -CFLAGS += -DENABLE_LAYOUT=1 -DTEST_LAYOUT=1
20960 .IF "$(COMNAME)" == "gcc3"
20961 CFLAGS+=-Wall -Wno-non-virtual-dtor
20963 @@ -92,15 +88,20 @@ default: ALLTAR
20964 .INCLUDE : target.mk
20967 + insert-sheet.xml\
20969 + move-copy-sheet.xml\
20972 + string-input.xml\
20978 XML_LANGS=$(alllangiso)
20980 -ALLTAR: $(BIN)/testrc $(svtools) $(foreach,i,$(XML_FILES) en-US/$i)
20981 +ALLTAR: localize.sdf $(BIN)/testrc $(svtools) $(foreach,i,$(XML_FILES) en-US/$i)
20983 $(XML_LANGS:f:t"/%.xml ")/%.xml: %.xml
20984 $(TRALAY) -m localize.sdf -o . -l $(XML_LANGS:f:t" -l ") $<
20985 @@ -119,12 +120,16 @@ $(svtools):
20986 ln -sf ..$/$(PRJ)$/svtools$/inc $(INCCOM)$/svtools
20989 + cp -pv message-box.xml $(PRJ)/uiconfig/layout
20990 + cp -pv tab-dialog.xml $(PRJ)/uiconfig/layout
20991 $(SHELL) ./un-test.sh zoom.cxx > ../$(PRJ)/svx/source/dialog/zoom.cxx
20992 $(SHELL) ./un-test.sh zoom.hxx > ../$(PRJ)/svx/source/dialog/zoom.hxx
20993 touch ../$(PRJ)/svx/source/dialog/dlgfact.cxx
20994 + cp -pv zoom.xml ../$(PRJ)/svx/uiconfig/layout
20995 $(SHELL) ./un-test.sh wordcountdialog.cxx > ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.cxx
20996 $(SHELL) ./un-test.sh wordcountdialog.hxx > ../$(PRJ)/sw/source/ui/inc/wordcountdialog.hxx
20997 touch ../$(PRJ)/sw/source/ui/dialog/swdlgfact.cxx
20998 + cp -pv wordcount.xml ../$(PRJ)/sw/uiconfig/layout
20999 # FIXME: broken setup
21000 ln -sf ../inc/wordcountdialog.hxx ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.hxx
21001 $(SHELL) ./un-test.sh tpsort.cxx > ../$(PRJ)/sc/source/ui/dbgui/tpsort.cxx
21002 @@ -133,6 +138,17 @@ dist .PHONY :
21003 $(SHELL) ./un-test.sh sortdlg.hxx > ../$(PRJ)/sc/source/ui/inc/sortdlg.hxx
21004 touch ../$(PRJ)/sc/source/ui/attrdlg/scdlgfact.cxx
21005 touch ../$(PRJ)/sc/source/ui/view/cellsh2.cxx
21006 + cp -pv insert-sheet.xml ../$(PRJ)/sc/uiconfig/layout
21007 + cp -pv move-copy-sheet.xml ../$(PRJ)/sc/uiconfig/layout
21008 + cp -pv sort-options.xml ../$(PRJ)/sc/uiconfig/layout
21009 + cp -pv string-input.xml ../$(PRJ)/sc/uiconfig/layout
21011 +localize.sdf: $(PRJ)/../svx/source/dialog/localize.sdf $(PRJ)/../sw/source/ui/dialog/localize.sdf $(PRJ)/../sc/source/ui/src/localize.sdf
21012 + 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-$@
21013 + 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-$@
21014 + 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-$@
21015 + echo '#empty' | cat - sort-options-$@ wordcount-$@ zoom-$@ > $@
21018 .ELSE # ENABLE_LAYOUT != TRUE
21020 --- toolkit/workben/layout/message-box.xml.old 1970-01-01 00:00:00.000000000 +0000
21021 +++ toolkit/workben/layout/message-box.xml 2009-04-06 16:42:13.000000000 +0000
21023 +<?xml version="1.0" encoding="UTF-8"?>
21024 +<!-- This is a template. i18n translation is not performed in-place;
21025 + i18n translated xml files are generated from this template by
21026 + transex3/layout/tralay. !-->
21028 +<modaldialog xmlns="http://openoffice.org/2007/layout"
21029 + xmlns:cnt="http://openoffice.org/2007/layout/container"
21030 + id="message-box" _title="" optimumsize="true"
21031 + has_border="true" sizeable="true" moveable="true" closeable="true">
21032 + <vbox border="5" spacing="5">
21033 + <hbox border="5" spacing="20">
21034 + <align cnt:expand="false" cnt:fill="true">
21035 + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" />
21037 + <align cnt:expand="false" cnt:fill="true">
21038 + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" />
21040 + <align cnt:expand="false" cnt:fill="true">
21041 + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" />
21043 + <align cnt:expand="false" cnt:fill="true">
21044 + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" />
21046 + <align cnt:expand="false" cnt:fill="true">
21047 + <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" />
21051 + <dialogbuttonhbox border="0" spacing="5">
21053 + <!-- deprecoted vcl/MsgBox compatibility !-->
21054 + <retrybutton id="BTN_RETRY" />
21055 + <ignorebutton id="BTN_IGNORE" />
21057 + <yesbutton id="BTN_YES"/>
21058 + <cancelbutton id="BTN_CANCEL"/>
21059 + <helpbutton id="BTN_HELP"/>
21060 + <nobutton id="BTN_NO" xlabel="~Alternate"/>
21061 + </dialogbuttonhbox>
21064 --- toolkit/workben/layout/move-copy-sheet.xml.old 1970-01-01 00:00:00.000000000 +0000
21065 +++ toolkit/workben/layout/move-copy-sheet.xml 2009-04-06 16:42:13.000000000 +0000
21067 +<?xml version="1.0" encoding="UTF-8"?>
21068 +<!-- This is a template. i18n translation is not performed in-place;
21069 + i18n translated XML files are generated from this template by
21070 + transex3/layout/tralay. !-->
21072 +<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">
21073 + <vbox spacing="5" border="5">
21074 + <string id="STR_NEWDOC" _text="- new document -"/>
21075 + <fixedtext id="FT_DEST" _label="To ~document"/>
21076 + <listbox has_border="true" dropdown="true" id="LB_DEST" tabstop="true"/>
21077 + <fixedtext id="FT_INSERT" _label="~Insert before"/>
21078 + <listbox has_border="true" id="LB_INSERT" tabstop="true" string-item-list=" : : : : " />
21079 + <checkbox id="BTN_COPY" tabstop="true" _label="~Copy"/>
21080 + <dialogbuttonhbox border="5" spacing="5">
21082 + <cancelbutton id="BTN_CANCEL" tabstop="true"/>
21083 + <helpbutton id="BTN_HELP" tabstop="true"/>
21084 + <okbutton default="true" id="BTN_OK" tabstop="true"/>
21085 + </dialogbuttonhbox>
21088 --- toolkit/workben/layout/recover.cxx.old 2009-04-02 10:49:37.000000000 +0000
21089 +++ toolkit/workben/layout/recover.cxx 2009-04-06 16:42:13.000000000 +0000
21090 @@ -55,6 +55,13 @@ using namespace com::sun::star;
21092 #include <layout/layout-pre.hxx>
21096 +#define SVX_RES(x) #x
21097 +#undef SfxModalDialog
21098 +#define SfxModalDialog( parent, id ) Dialog( parent, "recover.xml", id )
21099 +#endif /* ENABLE_LAYOUT */
21102 SvxRecoverDialog::SvxRecoverDialog( Window* pParent )
21103 #else /* !TEST_LAYOUT */
21104 --- toolkit/workben/layout/recover.hxx.old 2009-04-02 10:49:37.000000000 +0000
21105 +++ toolkit/workben/layout/recover.hxx 2009-04-06 16:42:13.000000000 +0000
21107 #include <vcl/button.hxx>
21108 #include <vcl/field.hxx>
21109 #include <vcl/fixed.hxx>
21110 -#include <box.hxx>
21111 +#include <layout/core/box.hxx>
21112 #include <layout/layout-pre.hxx>
21114 class SvxRecoverDialog : public SfxModalDialog
21115 --- toolkit/workben/layout/sort-options.xml.old 2009-04-06 16:42:11.000000000 +0000
21116 +++ toolkit/workben/layout/sort-options.xml 2009-04-06 16:42:13.000000000 +0000
21118 <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
21120 <fixedline id="FL_DIRECTION" _text="Direction"/>
21121 - <radiobutton id="BTN_TOP_DOWN" tabstop="true" _label="~Top to bottom (sort rows)"/>
21122 - <radiobutton id="BTN_LEFT_RIGHT" tabstop="true" _label="L~eft to right (sort columns)"/>
21123 + <radiobutton id="BTN_TOP_DOWN" radiogroup="sort-options" tabstop="true" _label="~Top to bottom (sort rows)"/>
21124 + <radiobutton id="BTN_LEFT_RIGHT" radiogroup="sort-options" tabstop="true" _label="L~eft to right (sort columns)"/>
21128 --- toolkit/workben/layout/sortdlg.cxx.old 2009-04-06 16:42:11.000000000 +0000
21129 +++ toolkit/workben/layout/sortdlg.cxx 2009-04-06 16:42:13.000000000 +0000
21131 #include "scresid.hxx"
21132 #include "sortdlg.hrc"
21135 -//==================================================================
21136 +#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
21137 +#include <layout/layout-pre.hxx>
21140 ScSortDlg::ScSortDlg( Window* pParent,
21141 const SfxItemSet* pArgSet ) :
21142 @@ -54,8 +55,15 @@ ScSortDlg::ScSortDlg( Window* pParent,
21143 bIsByRows ( FALSE )
21146 +#ifdef LAYOUT_SFX_TABDIALOG_BROKEN
21147 AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
21148 AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
21150 + String fields = rtl::OUString::createFromAscii ("fields");
21151 + AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
21152 + String options = rtl::OUString::createFromAscii ("options");
21153 + AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
21158 --- toolkit/workben/layout/sortdlg.hxx.old 2009-04-06 16:42:11.000000000 +0000
21159 +++ toolkit/workben/layout/sortdlg.hxx 2009-04-06 16:42:13.000000000 +0000
21160 @@ -33,11 +33,15 @@
21162 #include <sfx2/tabdlg.hxx>
21166 +#define LAYOUT_SFX_TABDIALOG_BROKEN 1
21167 +#endif /* !TEST_LAYOUT */
21169 +#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
21170 +#include <sfx2/layout.hxx>
21171 +#include <layout/layout-pre.hxx>
21174 -//==================================================================
21176 class ScSortDlg : public SfxTabDialog
21179 @@ -61,7 +65,8 @@ inline void ScSortDlg::SetByRows ( BOOL
21180 inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; }
21181 inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; }
21183 +#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
21184 +#include <layout/layout-post.hxx>
21187 #endif // SC_SORTDLG_HXX
21190 --- toolkit/workben/layout/string-input.xml.old 1970-01-01 00:00:00.000000000 +0000
21191 +++ toolkit/workben/layout/string-input.xml 2009-04-06 16:42:13.000000000 +0000
21193 +<?xml version="1.0" encoding="UTF-8"?>
21194 +<!-- This is a template. i18n translation is not performed in-place;
21195 + i18n translated XML files are generated from this template by
21196 + transex3/layout/tralay. !-->
21198 +<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">
21199 + <vbox spacing="5" border="5">
21200 + <fixedtext id="FT_LABEL" label="FT-LABEL"/>
21201 + <edit has_border="true" id="ED_INPUT" tabstop="true"/>
21202 + <dialogbuttonhbox border="5" spacing="5">
21203 + <okbutton default="true" id="BTN_OK" tabstop="true"/>
21204 + <cancelbutton id="BTN_CANCEL" tabstop="true"/>
21205 + <helpbutton id="BTN_HELP" tabstop="true"/>
21206 + </dialogbuttonhbox>
21209 --- toolkit/workben/layout/tab-dialog.xml.old 1970-01-01 00:00:00.000000000 +0000
21210 +++ toolkit/workben/layout/tab-dialog.xml 2009-04-06 16:42:13.000000000 +0000
21212 +<?xml version="1.0" encoding="UTF-8"?>
21214 +<dialog xmlns="http://openoffice.org/2007/layout"
21215 + xmlns:cnt="http://openoffice.org/2007/layout/container"
21216 + _title="layout::TabDialog" optimumsize="true"
21218 + has_border="true" sizeable="true" moveable="true">
21219 + <vbox spacing="5" border="5">
21220 + <tabcontrol id="ID_TABCONTROL"/>
21221 + <dialogbuttonhbox border="5" spacing="5" cnt:expand="false">
21223 + <okbutton id="BTN_OK" show="false"/>
21224 + <pushbutton id="BTN_USER" _label="<User>" show="false"/>
21225 + <cancelbutton id="BTN_CANCEL" show="false"/>
21226 + <helpbutton id="BTN_HELP" show="false"/>
21227 + <resetbutton id="BTN_RESET" show="false"/>
21228 + <pushbutton id="BTN_BASEFMT" _label="<Base Format>" show="false"/>
21229 + </dialogbuttonhbox>
21232 --- toolkit/workben/layout/tabcontrol.xml.old 2009-04-02 10:49:37.000000000 +0000
21233 +++ toolkit/workben/layout/tabcontrol.xml 2009-04-06 16:42:13.000000000 +0000
21235 <?xml version="1.0" encoding="UTF-8"?>
21237 <dialog xmlns="http://openoffice.org/2007/layout"
21238 - xmlns:cnt="http://openoffice.org/2007/layout/container"
21239 - title="TabControl Test" optimumsize="true"
21240 - has_border="true" sizeable="true" moveable="true">
21243 - <pushbutton label="Child 1" cnt:title="Page 1" />
21244 - <edit has_border="true" text="Child 2" cnt:title="Page 2" />
21245 - <vbox cnt:title="Page 3">
21246 - <pushbutton label="Child 3"/>
21247 - <edit has_border="true" text="Child 4" />
21250 - <okbutton cnt:expand="false" />
21252 + xmlns:cnt="http://openoffice.org/2007/layout/container"
21253 + title="TabControl Test" optimumsize="true"
21254 + has_border="true" sizeable="true" moveable="true">
21257 + <pushbutton label="Child 1" cnt:title="Page 1" />
21258 + <edit has_border="true" text="Child 2" cnt:title="Page 2" />
21259 + <vbox cnt:title="Page 3">
21260 + <pushbutton label="Child 3"/>
21261 + <edit has_border="true" text="Child 4" />
21264 + <okbutton cnt:expand="false" />
21267 --- toolkit/workben/layout/test.cxx.old 2009-04-06 16:42:11.000000000 +0000
21268 +++ toolkit/workben/layout/test.cxx 2009-04-06 16:42:13.000000000 +0000
21269 @@ -238,19 +238,21 @@ void LayoutTest::RunEditor()
21273 -void RunDialog( Dialog& dialog )
21274 +short RunDialog( Dialog& dialog )
21277 - dialog.Execute();
21278 - fprintf( stderr, "Done: dialog execute exited\n" );
21279 + short result = dialog.Execute();
21280 + fprintf( stderr, "Done: dialog execute exited:%d\n", result);
21285 -void RunDialog( ::Dialog& dialog )
21286 +short RunDialog( ::Dialog& dialog )
21289 - dialog.Execute();
21290 - fprintf( stderr, "Done: dialog execute exited\n" );
21291 + short result = dialog.Execute();
21292 + fprintf( stderr, "Done: dialog execute exited:%d\n", result);
21297 @@ -271,6 +273,19 @@ void TestDialog( OUString const& name )
21298 PluginDialog plugin ( 0 );
21299 RunDialog( plugin );
21301 + else if ( name.equalsAscii( "query" ) )
21303 + QueryBox query ( 0, "Do you want to do?", "do");
21304 + RunDialog( query );
21306 + else if ( name.equalsAscii( "query-compat" ) )
21308 + QueryBox query ( 0,
21309 + WinBits( WB_YES_NO | WB_DEF_YES ),
21310 +// WinBits( WB_ABORT_RETRY_IGNORE ),
21311 + OUString::createFromAscii ("Do you want to do?"));
21312 + RunDialog( query );
21314 else if ( name.equalsAscii( "recover" ) )
21316 SvxRecoverDialog recover ( 0 );
21317 @@ -280,7 +295,7 @@ void TestDialog( OUString const& name )
21318 else if ( name.equalsAscii( "sort" ) )
21321 - ScSortDlg sort ( 0, 0 );
21322 + ScSortDlg sort (0, 0);
21325 #endif /* SORT_DLG */
21326 --- toolkit/workben/layout/tpsort.cxx.old 2009-04-06 16:42:11.000000000 +0000
21327 +++ toolkit/workben/layout/tpsort.cxx 2009-04-06 16:42:13.000000000 +0000
21329 * OpenOffice.org - a multi-platform office productivity suite
21331 * $RCSfile: tpsort.cxx,v $
21332 - * $Revision: 1.13 $
21333 + * $Revision: 1.14 $
21335 * This file is part of OpenOffice.org.
21337 @@ -554,7 +554,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHd
21339 #define ScResId(x) #x
21341 -#define SfxTabPage( parent, id, args ) TabPage( parent, "sort-options.xml", id, 0, &args )
21342 +#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
21343 #endif /* ENABLE_LAYOUT */
21345 ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
21346 @@ -584,6 +584,7 @@ ScTabPageSortOptions::ScTabPageSortOptio
21347 // aFtArea ( this, ScResId( FT_AREA ) ),
21352 #define ScResId(x) this, #x
21353 #endif /* ENABLE_LAYOUT */
21354 @@ -748,7 +749,6 @@ USHORT* __EXPORT ScTabPageSortOptions::G
21358 -#define SfxTabPage TabPage
21359 #endif /* ENABLE_LAYOUT */
21360 SfxTabPage* __EXPORT ScTabPageSortOptions::Create(
21362 --- toolkit/workben/layout/tpsort.hxx.old 2009-04-06 16:42:11.000000000 +0000
21363 +++ toolkit/workben/layout/tpsort.hxx 2009-04-06 16:42:13.000000000 +0000
21364 @@ -132,7 +132,7 @@ class ScRangeData;
21365 class CollatorRessource;
21366 class CollatorWrapper;
21368 -#include <layout/layout.hxx>
21369 +#include <sfx2/layout.hxx>
21370 #include <layout/layout-pre.hxx>
21372 class ScTabPageSortOptions : public SfxTabPage
21373 @@ -142,12 +142,10 @@ public:
21374 const SfxItemSet& rArgSet );
21375 ~ScTabPageSortOptions();
21377 -#if !ENABLE_LAYOUT
21379 +#define SfxTabPage ::SfxTabPage
21380 static SfxTabPage* Create ( Window* pParent,
21381 const SfxItemSet& rArgSet );
21382 -#else /* ENABLE_LAYOUT */
21383 - static TabPage* Create ( Window* parent, SfxItemSet const& set );
21384 -#endif /* ENABLE_LAYOUT */
21385 static USHORT* GetRanges ();
21386 virtual BOOL FillItemSet ( SfxItemSet& rArgSet );
21387 virtual void Reset ( const SfxItemSet& rArgSet );
21388 @@ -185,13 +183,9 @@ private:
21390 // FixedText aFtAreaLabel;
21391 // FixedInfo aFtArea;
21393 -#define String layout::LocalizedString
21394 -#endif /* ENABLE_LAYOUT */
21395 - String aStrRowLabel;
21396 - String aStrColLabel;
21397 - String aStrUndefined;
21399 + LocalizedString aStrRowLabel;
21400 + LocalizedString aStrColLabel;
21401 + LocalizedString aStrUndefined;
21403 String aStrAreaLabel;
21405 --- toolkit/workben/layout/uno.hxx.old 2009-04-06 16:42:11.000000000 +0000
21406 +++ toolkit/workben/layout/uno.hxx 2009-04-06 16:42:13.000000000 +0000
21408 #include <com/sun/star/lang/XInitialization.hpp>
21409 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
21411 -#include "root.hxx"
21412 -#include "factory.hxx"
21413 +#include <layout/core/root.hxx>
21414 +#include <layout/core/factory.hxx>
21417 #include <cppuhelper/implbase1.hxx>
21418 --- toolkit/workben/layout/wordcount.xml.old 2009-04-02 10:49:37.000000000 +0000
21419 +++ toolkit/workben/layout/wordcount.xml 2009-04-06 16:42:13.000000000 +0000
21421 xmlns:cnt="http://openoffice.org/2007/layout/container"
21422 help-id="HID_DLG_WORDCOUNT"
21424 - sizeable="true" moveable="true" optimumsize="true"
21425 + sizeable="true" moveable="true" optimumsize="true" closeable="true"
21426 has_border="true" sv-look="true" _title="Word Count">
21427 <vbox border="5" spacing="5">
21428 <fixedline id="FL_CURRENT" _text="Current selection"/>
21432 <!-- if we could do cnt:cnt:padding="-13" here, we would not have to close
21433 - and reope the hbox/vbox thing !-->
21434 + and reopen the hbox/vbox thing !-->
21435 <fixedline id="FL_DOC" _text="Whole document"/>
21437 <vbox cnt:padding="13" spacing="5">
21438 --- toolkit/workben/layout/wordcountdialog.cxx.old 2009-04-06 16:42:11.000000000 +0000
21439 +++ toolkit/workben/layout/wordcountdialog.cxx 2009-04-06 16:42:13.000000000 +0000
21441 * OpenOffice.org - a multi-platform office productivity suite
21443 * $RCSfile: wordcountdialog.cxx,v $
21444 - * $Revision: 1.4 $
21445 + * $Revision: 1.10 $
21447 * This file is part of OpenOffice.org.
21450 #include <wordcountdialog.hrc>
21451 #endif /* !TEST_LAYOUT */
21455 +#define SW_RES(x) #x
21456 +#undef SfxModalDialog
21457 +#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
21458 +#define SW_WORDCOUNTDIALOG_HRC
21459 +#include <helpid.h>
21460 +#endif /* ENABLE_LAYOUT */
21462 /*-- 06.04.2004 16:05:55---------------------------------------------------
21464 -----------------------------------------------------------------------*/
21465 @@ -73,6 +82,9 @@ SwWordCountDialog::SwWordCountDialog(Win
21466 #pragma warning (default : 4355)
21470 + SetHelpId (HID_DLG_WORDCOUNT);
21471 +#endif /* ENABLE_LAYOUT */
21474 /*-- 06.04.2004 16:05:56---------------------------------------------------
21475 --- toolkit/workben/layout/wordcountdialog.hxx.old 2009-04-02 10:49:37.000000000 +0000
21476 +++ toolkit/workben/layout/wordcountdialog.hxx 2009-04-06 16:42:13.000000000 +0000
21478 * OpenOffice.org - a multi-platform office productivity suite
21480 * $RCSfile: wordcountdialog.hxx,v $
21481 - * $Revision: 1.3 $
21482 + * $Revision: 1.5 $
21484 * This file is part of OpenOffice.org.
21486 --- toolkit/workben/layout/zoom.cxx.old 2009-04-06 16:42:11.000000000 +0000
21487 +++ toolkit/workben/layout/zoom.cxx 2009-04-06 16:42:13.000000000 +0000
21489 * OpenOffice.org - a multi-platform office productivity suite
21491 * $RCSfile: zoom.cxx,v $
21492 - * $Revision: 1.4 $
21493 + * $Revision: 1.12 $
21495 * This file is part of OpenOffice.org.
21498 #define _SVX_ZOOM_CXX
21500 #include <svx/dialogs.hrc>
21502 #include "zoom.hrc"
21503 +#endif /* !TEST_LAYOUT */
21505 #include "zoom.hxx"
21507 @@ -112,6 +114,13 @@ struct SvxViewLayoutItem : public LAYOUT
21509 #include <layout/layout-pre.hxx>
21513 +#define SVX_RES(x) #x
21514 +#undef SfxModalDialog
21515 +#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id )
21516 +#endif /* ENABLE_LAYOUT */
21518 // static ----------------------------------------------------------------
21520 static USHORT pRanges[] =
21521 @@ -282,6 +291,9 @@ SvxZoomDialog::SvxZoomDialog( Window* pP
21522 bModified ( FALSE )
21526 + SetHelpId (SID_ATTR_ZOOM);
21527 +#endif /* ENABLE_LAYOUT */
21528 Link aLink = LINK( this, SvxZoomDialog, UserHdl );
21529 a100Btn.SetClickHdl( aLink );
21530 aOptimalBtn.SetClickHdl( aLink );
21531 --- toolkit/workben/layout/zoom.hxx.old 2009-04-06 16:42:11.000000000 +0000
21532 +++ toolkit/workben/layout/zoom.hxx 2009-04-06 16:42:13.000000000 +0000
21534 * OpenOffice.org - a multi-platform office productivity suite
21536 * $RCSfile: zoom.hxx,v $
21537 - * $Revision: 1.4 $
21538 + * $Revision: 1.6 $
21540 * This file is part of OpenOffice.org.
21542 --- toolkit/workben/layout/zoom.xml.old 2009-04-02 10:49:37.000000000 +0000
21543 +++ toolkit/workben/layout/zoom.xml 2009-04-06 16:42:13.000000000 +0000
21545 xmlns:cnt="http://openoffice.org/2007/layout/container"
21546 id="RID_SVXDLG_ZOOM" _title="Zoom & View Layout" optimumsize="true"
21547 help-id="SID_ATTR_ZOOM"
21548 - has_border="true" sizeable="true" moveable="true">
21549 + has_border="true" sizeable="true" moveable="true" closeable="true">
21550 <vbox spacing="5" border="5">
21551 <hbox spacing="0" border="0">
21552 <vbox spacing="5" border="5">
21553 <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="true"/>
21554 - <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" _label="Optimal"/>
21555 - <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
21556 - <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/>
21557 - <radiobutton radiogroup="zoom" id="BTN_100" _label="100 %"/>
21558 + <radiobutton radiogroup="zoom-factor" id="BTN_OPTIMAL" _label="Optimal"/>
21559 + <radiobutton radiogroup="zoom-factor" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
21560 + <radiobutton radiogroup="zoom-factor" id="BTN_PAGE_WIDTH" _label="Page Width"/>
21561 + <radiobutton radiogroup="zoom-factor" id="BTN_100" _label="100 %"/>
21562 <hbox cnt:expand="false" cnt:fill="true">
21563 <align cnt:expand="false" cnt:fill="true">
21564 - <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" _label="Variable"/>
21565 + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-factor" id="BTN_USER" _label="Variable"/>
21567 <flow cnt:padding="10" cnt:expand="false"/>
21568 <metricfield id="ED_USER" value-step="1"
21569 @@ -30,11 +30,11 @@
21571 <vbox spacing="5" border="5">
21572 <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="true"/>
21573 - <radiobutton radiogroup="zoom" id="BTN_AUTOMATIC" _label="~Automatic"/>
21574 - <radiobutton radiogroup="zoom" id="BTN_SINGLE" _label="~Single page"/>
21575 + <radiobutton radiogroup="zoom-layout" id="BTN_AUTOMATIC" _label="~Automatic"/>
21576 + <radiobutton radiogroup="zoom-layout" id="BTN_SINGLE" _label="~Single page"/>
21577 <hbox cnt:expand="false" cnt:fill="true">
21578 <align cnt:expand="false" cnt:fill="true">
21579 - <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_COLUMNS" _label="~Columns"/>
21580 + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-layout" id="BTN_COLUMNS" _label="~Columns"/>
21582 <flow cnt:padding="10" cnt:expand="false"/>
21583 <metricfield id="ED_COLUMNS" value-step="1"