diff options
author | Felix Zhang <fezhang@suse.com> | 2011-11-16 17:27:21 +0800 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-11-17 00:49:48 +0100 |
commit | 38b42cee869c573dcdd9af2538a143edf9f18d33 (patch) | |
tree | a4a44fe2001321efc3fab746d24edfd22ba29ceb | |
parent | 4f11d0aa461537efa2705e7b49bc2c828a700e43 (diff) |
remove obsolete layout code
61 files changed, 0 insertions, 8011 deletions
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index 2d20de4a60ee..2fb233d85787 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -70,7 +70,6 @@ public: }; // ----------------------------------------------------------------------- -#include <sfx2/layout.hxx> class SvxNumberFormatTabPage : public SfxTabPage { diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx index ee75555859dd..11ac633c5ab1 100644 --- a/cui/source/inc/zoom.hxx +++ b/cui/source/inc/zoom.hxx @@ -30,7 +30,6 @@ // include --------------------------------------------------------------- -#include <layout/layout.hxx> #include <sfx2/basedlgs.hxx> #include <vcl/button.hxx> #include <vcl/field.hxx> diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 08760da7e291..bc0b8cbe1c58 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -83,7 +83,6 @@ // ause #include "editutil.hxx" -#include <sfx2/layout.hxx> IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl); diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index cff15f5eb7bf..144fb2a7f381 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -42,8 +42,6 @@ #include <vcl/field.hxx> #include "expftext.hxx" -#include <layout/layout.hxx> - class ScViewData; class ScDocument; class ScDocShell; diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index d8047e0e8c20..c53a59fe7314 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -37,8 +37,6 @@ #include <vcl/fixed.hxx> #include <vcl/edit.hxx> -#include <layout/layout.hxx> - //------------------------------------------------------------------------ class ScMoveTableDlg : public ModalDialog diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx index 03b11a470b00..0ad101713783 100644 --- a/sc/source/ui/inc/strindlg.hxx +++ b/sc/source/ui/inc/strindlg.hxx @@ -35,8 +35,6 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> -#include <layout/layout.hxx> - //------------------------------------------------------------------------ class ScStringInputDlg : public ModalDialog diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index d239591ed29c..a9a2cc39f8c3 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -36,7 +36,6 @@ #include <sfx2/bindings.hxx> #include <sfx2/viewfrm.hxx> #include <basic/sbstar.hxx> -#include <layout/layout.hxx> #include <svl/languageoptions.hxx> #include <svl/stritem.hxx> #include <svl/whiter.hxx> diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk index 67bb1c45d73c..4dd559d4a65f 100644 --- a/sfx2/Package_inc.mk +++ b/sfx2/Package_inc.mk @@ -75,7 +75,6 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/imgmgr.hxx,sfx2/imgmgr.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/ipclient.hxx,sfx2/ipclient.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/itemconnect.hxx,sfx2/itemconnect.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/itemwrapper.hxx,sfx2/itemwrapper.hxx)) -$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/layout.hxx,sfx2/layout.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/linkmgr.hxx,sfx2/linkmgr.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/linksrc.hxx,sfx2/linksrc.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/lnkbase.hxx,sfx2/lnkbase.hxx)) diff --git a/sfx2/inc/sfx2/layout.hxx b/sfx2/inc/sfx2/layout.hxx deleted file mode 100644 index a8540ecbd430..000000000000 --- a/sfx2/inc/sfx2/layout.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ***********************************************************************/ - -#ifndef _SFX2_LAYOUT_HXX -#define _SFX2_LAYOUT_HXX - -#include <layout/layout.hxx> -#include <sfx2/tabdlg.hxx> - -class SfxChildWindow; -class SfxBindings; - -namespace layout -{ - -class SFX2_DLLPUBLIC SfxDialog - : public Dialog -{ -public: - SfxDialog (::Window* parent, char const* xml_file, char const* id, SfxBindings* bindings=0, SfxChildWindow* child=0); -}; - -class SFX2_DLLPUBLIC SfxTabPage - : public ::SfxTabPage - , public InPlug -{ -public: - SfxTabPage (::Window *parent, char const* xml_file, char const* id, SfxItemSet const* set=0); - ::Window* GetParent () const; - using ::Window::GetWindow; - ::Window* GetWindow () const; - Size GetOptimalSize (WindowSizeType eType) const; - void FreeResource (); -}; -} // end namespace layout - -#endif /* _SFX2_LAYOUT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/factory.cxx b/sfx2/source/layout/factory.cxx deleted file mode 100644 index a5a00227eecf..000000000000 --- a/sfx2/source/layout/factory.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <sal/types.h> -#include <sfx2/basedlgs.hxx> -#include <toolkit/awt/vclxtoolkit.hxx> -#include <toolkit/awt/vclxdialog.hxx> - -using rtl::OUString; - -class SfxModelessDialog_unprotect : public SfxModelessDialog -{ -public: - SfxModelessDialog_unprotect (Window *parent, WinBits attributes); -}; - -SFX2_DLLPUBLIC SfxBindings* sfx2_global_bindings; -SFX2_DLLPUBLIC SfxChildWindow* sfx2_global_child; - -SfxModelessDialog_unprotect::SfxModelessDialog_unprotect (Window *parent, WinBits bits) - : SfxModelessDialog (sfx2_global_bindings, sfx2_global_child, parent, bits) -{ -} - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT Window* CreateWindow (VCLXWindow** vcl, OUString const& name, Window* parent, long& attributes) -{ - Window* window = 0; - if (0) - { - ; - } - else if (name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sfxmodelessdialog"))) - { - window = new SfxModelessDialog_unprotect (parent, ImplGetWinBits (attributes, 0)); - *vcl = new layoutimpl::VCLXDialog (); - } - return window; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxdialog.cxx b/sfx2/source/layout/sfxdialog.cxx deleted file mode 100644 index e8eb980c0466..000000000000 --- a/sfx2/source/layout/sfxdialog.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_sfx2.hxx" -#include <sfx2/layout.hxx> - -namespace layout -{ - -SfxDialog::SfxDialog(::Window* parent, char const* xml_file, char const* id, SfxBindings*, SfxChildWindow*) - : Dialog (parent, xml_file, id) -{ -} - -} // end namespace layout - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxtabdialog.cxx b/sfx2/source/layout/sfxtabdialog.cxx deleted file mode 100644 index 2e7d1aa476f3..000000000000 --- a/sfx2/source/layout/sfxtabdialog.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include <limits.h> -#include <stdlib.h> -#include <vcl/msgbox.hxx> -#include <unotools/viewoptions.hxx> - -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> - -#include "appdata.hxx" -#include "sfxtypes.hxx" -#include <sfx2/minarray.hxx> -#include <sfx2/tabdlg.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/app.hxx> -#include "sfx2/sfxresid.hxx" -#include "sfx2/sfxhelp.hxx" -#include <sfx2/ctrlitem.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/sfxdlg.hxx> -#include <sfx2/itemconnect.hxx> -#include <layout/layout.hxx> - -//FIXME -#include <toolkit/awt/vclxwindow.hxx> -#include <com/sun/star/awt/PosSize.hpp> - -using namespace ::com::sun::star; -namespace layout -{ -using namespace ::com::sun::star; -} - -#include <sfx2/layout.hxx> - -#undef TabPage -#undef SfxTabPage -#undef SfxTabDialog - -#define TabDlgCmpUS_Impl layout__TabDlgCmpUS_Impl - -#include "../dialog/tabdlg.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxtabpage.cxx b/sfx2/source/layout/sfxtabpage.cxx deleted file mode 100644 index 7c40d6f0b190..000000000000 --- a/sfx2/source/layout/sfxtabpage.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ***********************************************************************/ - -#include <sfx2/layout.hxx> - -#include <com/sun/star/awt/PosSize.hpp> -#include <toolkit/awt/vclxwindow.hxx> - -namespace layout -{ - -using namespace ::com::sun::star; - -SfxTabPage::SfxTabPage (::Window *parent, char const* xml_file, char const* id, SfxItemSet const* set) - : ::SfxTabPage (parent, 0, *set) - , InPlug (parent, xml_file, id) -{ - dynamic_cast< ::Window* > (this)->SetComponentInterface (GetVCLXWindow ()); -} - -::Window* SfxTabPage::GetParent () const -{ - return Window::GetParent (); -} - -::Window* SfxTabPage::GetWindow () const -{ - return ::layout::Window::GetWindow(); -} - -void SfxTabPage::FreeResource () -{ -} - -Size SfxTabPage::GetOptimalSize (WindowSizeType) const -{ - awt::Size s = GetVCLXWindow()->getMinimumSize (); - return Size (s.Width, s.Height); -} - -} // end namespace layout - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/fontlb.hxx b/svx/inc/svx/fontlb.hxx index 66745fa1cedc..ab6dfe8081c6 100644 --- a/svx/inc/svx/fontlb.hxx +++ b/svx/inc/svx/fontlb.hxx @@ -32,7 +32,6 @@ #include <svtools/svtabbx.hxx> #include <vcl/virdev.hxx> #include "svx/svxdllapi.h" -#include <layout/layout.hxx> // ============================================================================ diff --git a/svx/inc/svx/langbox.hxx b/svx/inc/svx/langbox.hxx index 336ce2250634..1a8f6ef0776c 100644 --- a/svx/inc/svx/langbox.hxx +++ b/svx/inc/svx/langbox.hxx @@ -35,7 +35,6 @@ #include "svx/svxdllapi.h" #include <vcl/image.hxx> #include <tools/solar.h> -#include <layout/layout.hxx> class SvtLanguageTable; diff --git a/svx/inc/svx/srchdlg.hxx b/svx/inc/svx/srchdlg.hxx index b7f19a88962b..b15e3c6f41ee 100644 --- a/svx/inc/svx/srchdlg.hxx +++ b/svx/inc/svx/srchdlg.hxx @@ -100,8 +100,6 @@ public: // class SvxSearchDialogWrapper ------------------------------------------ -#include <sfx2/layout.hxx> - class SvxSearchDialog; class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow { diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index ca9453593dae..a4e0e15a9eca 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -30,7 +30,6 @@ #include <tools/solar.h> #include <tblenum.hxx> -#include <layout/layout.hxx> #include <swdllapi.h> class UniString; diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 063d10798036..45e44051376b 100755 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -41,7 +41,6 @@ #include "swdllapi.h" #include <swtypes.hxx> #include <shellid.hxx> -#include <layout/layout.hxx> #include <IMark.hxx> class SwBaseShell; diff --git a/sw/source/ui/inc/wordcountdialog.hxx b/sw/source/ui/inc/wordcountdialog.hxx index 4317e0b09cb0..43251306220c 100644 --- a/sw/source/ui/inc/wordcountdialog.hxx +++ b/sw/source/ui/inc/wordcountdialog.hxx @@ -30,7 +30,6 @@ #include <sfx2/basedlgs.hxx> #include <svtools/stdctrl.hxx> #include <vcl/button.hxx> -#include <layout/layout.hxx> struct SwDocStat; #include <sfx2/childwin.hxx> #include "swabstdlg.hxx" diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk index 7411f7dd95e5..7164bc90a12a 100644 --- a/toolkit/Library_tk.mk +++ b/toolkit/Library_tk.mk @@ -139,26 +139,6 @@ $(eval $(call gb_Library_add_exception_objects,tk,\ toolkit/source/helper/unopropertyarrayhelper \ toolkit/source/helper/unowrapper \ toolkit/source/helper/vclunohelper \ - toolkit/source/layout/core/bin \ - toolkit/source/layout/core/box \ - toolkit/source/layout/core/box-base \ - toolkit/source/layout/core/byteseq \ - toolkit/source/layout/core/container \ - toolkit/source/layout/core/dialogbuttonhbox \ - toolkit/source/layout/core/factory \ - toolkit/source/layout/core/flow \ - toolkit/source/layout/core/helper \ - toolkit/source/layout/core/import \ - toolkit/source/layout/core/localized-string \ - toolkit/source/layout/core/proplist \ - toolkit/source/layout/core/root \ - toolkit/source/layout/core/table \ - toolkit/source/layout/core/timer \ - toolkit/source/layout/core/translate \ - toolkit/source/layout/core/vcl \ - toolkit/source/layout/vcl/wbutton \ - toolkit/source/layout/vcl/wfield \ - toolkit/source/layout/vcl/wrapper \ )) ifeq ($(GUIBASE),aqua) diff --git a/toolkit/Package_inc.mk b/toolkit/Package_inc.mk index e6fc3006c2ca..64993f80e596 100644 --- a/toolkit/Package_inc.mk +++ b/toolkit/Package_inc.mk @@ -27,7 +27,6 @@ #************************************************************************* $(eval $(call gb_Package_Package,toolkit_inc,$(SRCDIR)/toolkit/inc)) -$(eval $(call gb_Package_add_file,toolkit_inc,inc/layout/layout.hxx,layout/layout.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxaccessiblecomponent.hxx,toolkit/awt/vclxaccessiblecomponent.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxcontainer.hxx,toolkit/awt/vclxcontainer.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxdevice.hxx,toolkit/awt/vclxdevice.hxx)) diff --git a/toolkit/Package_source.mk b/toolkit/Package_source.mk index f84ff8186701..c5bcd970c5e7 100644 --- a/toolkit/Package_source.mk +++ b/toolkit/Package_source.mk @@ -27,24 +27,6 @@ #************************************************************************* $(eval $(call gb_Package_Package,toolkit_source,$(SRCDIR)/toolkit/source)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/bin.hxx,layout/core/bin.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/box-base.hxx,layout/core/box-base.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/box.hxx,layout/core/box.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/container.hxx,layout/core/container.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/dialogbuttonhbox.hxx,layout/core/dialogbuttonhbox.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/factory.hxx,layout/core/factory.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/flow.hxx,layout/core/flow.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/helper.hxx,layout/core/helper.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/import.hxx,layout/core/import.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/localized-string.hxx,layout/core/localized-string.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/precompiled_xmlscript.hxx,layout/core/precompiled_xmlscript.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/proplist.hxx,layout/core/proplist.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/root.hxx,layout/core/root.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/table.hxx,layout/core/table.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/timer.hxx,layout/core/timer.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/translate.hxx,layout/core/translate.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/vcl.hxx,layout/core/vcl.hxx)) -$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/vcl/wrapper.hxx,layout/vcl/wrapper.hxx)) $(eval $(call gb_Package_add_file,toolkit_source,inc/toolkit/awt/vclxdialog.hxx,awt/vclxdialog.hxx)) # vim: set noet sw=4 ts=4: diff --git a/toolkit/inc/layout/layout.hxx b/toolkit/inc/layout/layout.hxx deleted file mode 100644 index d298e0c0a1cf..000000000000 --- a/toolkit/inc/layout/layout.hxx +++ /dev/null @@ -1,405 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _LAYOUT_HXX -#define _LAYOUT_HXX - -#include <com/sun/star/awt/XLayoutContainer.hpp> -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/util/Color.hpp> -#include <i18npool/lang.h> -#include <toolkit/dllapi.h> -#include <tools/gen.hxx> -#include <tools/link.hxx> -#include <tools/string.hxx> -#include <vcl/bitmap.hxx> -#include <tools/fldunit.hxx> -#include <vcl/lstbox.h> -#include <tools/wintypes.hxx> - -class Button; -class Color; -class Control; -class Dialog; -class Edit; -class Font; -class Image; -class ListBox; -class MapMode; -class Pointer; -class PushButton; -class ResId; -struct SfxChildWinInfo; -class TabControl; -class TabPage; -class VCLXWindow; -class Window; - -namespace layoutimpl -{ -class VCLXTabControl; -} - -class VCLXTabControl; - -namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } } - -namespace layout -{ - -namespace css = ::com::sun::star; - -typedef css::uno::Reference< css::uno::XInterface > PeerHandle; -class ContextImpl; -class TOOLKIT_DLLPUBLIC Context -{ - ContextImpl *pImpl; -public: - Context( char const* pPath ); - virtual ~Context(); - PeerHandle GetPeerHandle( char const* id, sal_uInt32 nId = 0 ) const; - PeerHandle getRoot(); -}; - -// make declaring wrappers easier ... -#define DECL_CONSTRUCTORS(t,par,defaultWinBit) \ - protected: \ - explicit t( WindowImpl *pImpl ) : \ - par( pImpl ) {} \ - char const* GetUnoName() const; \ - public: \ - t( Context *context, char const* id, sal_uInt32 nId = 0 ); \ - t( Window *parent, WinBits nStyle = defaultWinBit ); \ - t (Window *parent, ResId const &res) -#define DECL_GET_IMPL(t) \ - inline t##Impl &getImpl() const - -#define DECL_GET_WINDOW( cls ) ::cls* Get##cls() const -#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() const { return dynamic_cast< ::cls*>( GetWindow() ); } - -#define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const -#define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::VCLX##cls*>( GetVCLXWindow() ); } - -#define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const -#define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); } - -// follows the VCL inheritance hierarchy ... - -class WindowImpl; -class TOOLKIT_DLLPUBLIC Window -{ -protected: - friend class WindowImpl; - WindowImpl *mpImpl; - - virtual void setRes (ResId const& res); - -public: - DECL_GET_IMPL( Window ); - explicit Window( WindowImpl *pImpl ); - virtual ~Window(); - - PeerHandle GetPeer() const; - - void Show( bool bVisible = true ); - inline void Hide() { Show( false ); } - void GrabFocus(); - void FreeResource() {} - - void SetParent( ::Window *parent ); - virtual void ParentSet (Window *window); - void SetParent( Window *parent ); - - css::uno::Reference<css::awt::XWindow> GetRef() const; - VCLXWindow* GetVCLXWindow() const; - ::Window* GetWindow() const; - ::Window* GetParent() const; - - void SetPointer( Pointer const& pointer ); - Pointer const& GetPointer() const; - WinBits GetStyle(); - void SetText( rtl::OUString const& str ); - String GetText() const; - void SetStyle( WinBits style ); - void SetUpdateMode( bool mode ); - void SetHelpId( const rtl::OString& id ); - const rtl::OString& GetHelpId() const; - void EnterWait (); - void LeaveWait (); - bool IsWait () const; - bool IsEnabled () const; - void EnableInput (bool enable=true, bool child=true); - bool IsInputEnabled () const; - - bool IsVisible () const; - bool HasChildPathFocus (bool systemWindow=false) const; - void SetPosPixel (Point const&); - Point GetPosPixel () const; - void SetSizePixel (Size const&); - Size GetSizePixel () const; - void SetPosSizePixel (Point const&, Size const&); - sal_Int32 GetCtrlTextWidth (rtl::OUString const& str) const; - sal_Int32 GetTextHeight () const; - - Size LogicToPixel( Size const& size ) const; - Size LogicToPixel( Size const& size, MapMode const& mapMode ) const; - - bool HasFocus () const; - Font& GetFont () const; - void SetFont (Font const& font); - virtual void Invalidate (sal_uInt8 flags=0); -}; - -class ControlImpl; -class TOOLKIT_DLLPUBLIC Control : public Window -{ - DECL_GET_IMPL( Control ); - DECL_CONSTRUCTORS( Control, Window, 0 ); - -public: - ~Control (); - void SetGetFocusHdl (Link const& link); - void SetLoseFocusHdl (Link const& link); -}; - -class FixedTextImpl; -class TOOLKIT_DLLPUBLIC FixedText : public Control -{ - DECL_GET_IMPL( FixedText ); - -public: - FixedText( Context *context, char const* id, sal_uInt32 nId = 0 ); - ~FixedText (); - void SetText( rtl::OUString const& rStr ); -}; - -class FixedImageImpl; -class TOOLKIT_DLLPUBLIC FixedImage : public Control -{ - DECL_GET_IMPL( FixedImage ); - -public: - FixedImage( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; - -class ImageImpl; -class TOOLKIT_DLLPUBLIC Image -{ - ImageImpl *pImpl; -public: - ImageImpl &getImpl() const { return *pImpl; } -}; - -class ButtonImpl; -class TOOLKIT_DLLPUBLIC Button : public Control -{ - DECL_GET_IMPL( Button ); - DECL_CONSTRUCTORS( Button, Control, 0 ); - -public: - ~Button (); - static String GetStandardText (sal_uInt16 button_type); - void SetText( rtl::OUString const& rStr ); - - virtual void Click() /* pure virtual? */; -}; - -class PushButtonImpl; -class TOOLKIT_DLLPUBLIC PushButton : public Button -{ - DECL_GET_IMPL( PushButton ); - -protected: - explicit PushButton( WindowImpl *pImpl ) : Button( pImpl ) {} - -public: - ~PushButton (); - - void SetToggleHdl( Link const& rLink ); -}; - -class TOOLKIT_DLLPUBLIC CancelButton : public PushButton -{ -public: - CancelButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; -class TOOLKIT_DLLPUBLIC YesButton : public PushButton -{ -public: - YesButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; -class TOOLKIT_DLLPUBLIC NoButton : public PushButton -{ -public: - NoButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; -class TOOLKIT_DLLPUBLIC RetryButton : public PushButton -{ -public: - RetryButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; -class TOOLKIT_DLLPUBLIC IgnoreButton : public PushButton -{ -public: - IgnoreButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; -class TOOLKIT_DLLPUBLIC HelpButton : public PushButton -{ -public: - HelpButton( Context *context, char const* id, sal_uInt32 nId = 0 ); -}; - -class EditImpl; -class TOOLKIT_DLLPUBLIC Edit : public Control -{ - DECL_GET_IMPL( Edit ); - DECL_CONSTRUCTORS( Edit, Control, WB_BORDER ); - -public: - ~Edit (); - void SetModifyHdl( Link const& rLink ); -}; - -class ListBoxImpl; -class TOOLKIT_DLLPUBLIC ListBox : public Control -{ - DECL_GET_IMPL( ListBox ); - DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER ); - DECL_GET_WINDOW (ListBox); - -public: - ~ListBox (); - - virtual void SetNoSelection (); -}; - -class DialogImpl; -class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window -{ -public: - DECL_GET_IMPL (Dialog); - Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); - ~Dialog (); - virtual short Execute(); - void EndDialog( long nResult=0 ); - void SetTitle (rtl::OUString const& rStr ); - - // Sxf*Dialog - bool bConstruct; -}; - -#define DECL_MESSAGE_BOX_CTORS(Name)\ - public:\ - Name##Box (::Window *parent, char const* message,\ - char const* yes=0, char const* no=0, const rtl::OString& help_id=rtl::OString(),\ - char const* xml_file="message-box.xml", char const* id="message-box");\ - Name##Box (::Window *parent, rtl::OUString const& message,\ - rtl::OUString yes=String (),\ - rtl::OUString no=String (),\ - const rtl::OString& help_id=rtl::OString(),\ - char const* xml_file="message-box.xml", char const* id="message-box");\ - Name##Box (::Window *parent, WinBits, char const* message,\ - char const* yes=0, char const* no=0, const rtl::OString& help_id=rtl::OString(),\ - char const* xml_file="message-box.xml", char const* id="message-box");\ - Name##Box (::Window *parent, WinBits, rtl::OUString const& message,\ - rtl::OUString yes=String (),\ - rtl::OUString no=String (),\ - const rtl::OString& help_id=rtl::OString(),\ - char const* xml_file="message-box.xml", char const* id="message-box")\ - -class TOOLKIT_DLLPUBLIC MessageBox : public Dialog -{ - DECL_MESSAGE_BOX_CTORS(Message); - -protected: - FixedImage imageError; - FixedImage imageInfo; - FixedImage imageQuery; - FixedImage imageWarning; - FixedText messageText; - CancelButton cancelButton; - HelpButton helpButton; - IgnoreButton ignoreButton; - NoButton noButton; - RetryButton retryButton; - YesButton yesButton; - - void bits_init (WinBits bits, rtl::OUString const& message, - rtl::OUString yes, rtl::OUString, const rtl::OString& help_id); - void init (rtl::OUString const& message, - rtl::OUString const& yes, rtl::OUString const& no, const rtl::OString& help_id); - void init (char const* message, char const* yes, char const* no, const rtl::OString& help_id); -}; - -#undef TAB_APPEND - -class TabControlImpl; -class TOOLKIT_DLLPUBLIC TabControl : public Control -{ -//#ifndef TAB_APPEND -#define TAB_APPEND 0xFFFF -//#endif /* !TAB_APPEND */ - - DECL_GET_IMPL (TabControl); - DECL_GET_WINDOW (TabControl); - -public: - ~TabControl (); - void SetActivatePageHdl (Link const& link); - void SetDeactivatePageHdl (Link const& link); -}; - -class TabPageImpl; -class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window -{ - DECL_GET_IMPL( TabPage ); -public: - static ::Window* global_parent; - static TabControl* global_tabcontrol; - - ~TabPage(); - DECL_GET_WINDOW( TabPage ); - virtual void ActivatePage(); - virtual void DeactivatePage(); -}; - -// ----------------------------------------------------------------- -// layout container / helper wrappers -// ----------------------------------------------------------------- - -class InPlugImpl; -class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window -{ - DECL_GET_IMPL (InPlug); -}; - -} // end namespace layout - -#endif /* _LAYOUT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/bin.cxx b/toolkit/source/layout/core/bin.cxx deleted file mode 100644 index e8b665b73a4a..000000000000 --- a/toolkit/source/layout/core/bin.cxx +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "bin.hxx" - -#include <sal/macros.h> - -namespace layoutimpl -{ - -using namespace css; - -/* Bin */ - -Bin::Bin() : Container() -{ -} - -void SAL_CALL -Bin::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw (uno::RuntimeException, awt::MaxChildrenException) -{ - if ( mxChild.is() ) - throw awt::MaxChildrenException(); - if ( xChild.is() ) - { - mxChild = xChild; - setChildParent( xChild ); - queueResize(); - } -} - -void SAL_CALL -Bin::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw (uno::RuntimeException) -{ - if ( xChild == mxChild ) - { - mxChild = uno::Reference< awt::XLayoutConstrains >(); - unsetChildParent( xChild ); - queueResize(); - } -} - -uno::Sequence< uno::Reference< awt::XLayoutConstrains > > SAL_CALL -Bin::getChildren() - throw (uno::RuntimeException) -{ - return getSingleChild (mxChild); -} - -void SAL_CALL -Bin::allocateArea( const awt::Rectangle &rArea ) - throw (uno::RuntimeException) -{ - maAllocation = rArea; - if ( mxChild.is() ) - allocateChildAt( mxChild, rArea ); -} - -awt::Size SAL_CALL -Bin::getMinimumSize() - throw(uno::RuntimeException) -{ - if ( mxChild.is() ) - return maRequisition = maChildRequisition = mxChild->getMinimumSize(); - return maRequisition = awt::Size( 0, 0 ); -} - -uno::Reference< beans::XPropertySet > SAL_CALL -Bin::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& ) - throw (uno::RuntimeException) -{ - return uno::Reference< beans::XPropertySet >(); -} - -sal_Bool SAL_CALL -Bin::hasHeightForWidth() - throw(uno::RuntimeException) -{ - uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY ); - if ( xChildCont.is() ) - return xChildCont->hasHeightForWidth(); - return false; -} - -sal_Int32 SAL_CALL -Bin::getHeightForWidth( sal_Int32 nWidth ) - throw(uno::RuntimeException) -{ - uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY ); - if ( xChildCont.is() ) - return xChildCont->getHeightForWidth( nWidth ); - return maRequisition.Height; -} - -/* Align */ - -Align::Align() : Bin() -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Halign" ), - ::getCppuType( static_cast< const float* >( NULL ) ), - &fHorAlign ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Valign" ), - ::getCppuType( static_cast< const float* >( NULL ) ), - &fVerAlign ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Hfill" ), - ::getCppuType( static_cast< const float* >( NULL ) ), - &fHorFill ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Vfill" ), - ::getCppuType( static_cast< const float* >( NULL ) ), - &fVerFill ); - - fHorAlign = fVerAlign = 0.5; - fHorFill = fVerFill = 0; -} - -void SAL_CALL -Align::allocateArea( const awt::Rectangle &rArea ) - throw (uno::RuntimeException) -{ - maAllocation = rArea; - if ( !mxChild.is() ) - return; - - awt::Rectangle aChildArea; - aChildArea.Width = SAL_MIN( rArea.Width, maChildRequisition.Width ); - aChildArea.Width += (sal_Int32) SAL_MAX( - 0, (rArea.Width - maChildRequisition.Width) * fHorFill ); - aChildArea.Height = SAL_MIN( rArea.Height, maChildRequisition.Height ); - aChildArea.Height += (sal_Int32) SAL_MAX( - 0, (rArea.Height - maChildRequisition.Height) * fVerFill ); - - aChildArea.X = rArea.X + (sal_Int32)( (rArea.Width - aChildArea.Width) * fHorAlign ); - aChildArea.Y = rArea.Y + (sal_Int32)( (rArea.Height - aChildArea.Height) * fVerAlign ); - - allocateChildAt( mxChild, aChildArea ); -} - -bool -Align::emptyVisible () -{ - return true; -} - -/* MinSize */ - -MinSize::MinSize() : Bin() -{ - mnMinWidth = mnMinHeight = 0; - addProp( RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ), - ::getCppuType( static_cast< const long* >( NULL ) ), - &mnMinWidth ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "MinHeight" ), - ::getCppuType( static_cast< const long* >( NULL ) ), - &mnMinHeight ); -} - -bool -MinSize::emptyVisible () -{ - return true; -} - -awt::Size SAL_CALL MinSize::getMinimumSize() - throw(uno::RuntimeException) -{ - Bin::getMinimumSize(); - maRequisition.Width = SAL_MAX( maRequisition.Width, mnMinWidth ); - maRequisition.Height = SAL_MAX( maRequisition.Height, mnMinHeight ); - return maRequisition; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/bin.hxx b/toolkit/source/layout/core/bin.hxx deleted file mode 100644 index 69e97cebdf40..000000000000 --- a/toolkit/source/layout/core/bin.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* A few simple binary containers */ - -#ifndef LAYOUT_CORE_BIN_HXX -#define LAYOUT_CORE_BIN_HXX - -#include <layout/core/container.hxx> - -namespace layoutimpl -{ - -class Bin : public Container -{ -protected: - // Child - css::awt::Size maChildRequisition; - css::uno::Reference< css::awt::XLayoutConstrains > mxChild; - -public: - Bin(); - virtual ~Bin() {} - - // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException, css::awt::MaxChildrenException); - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); - - virtual css::uno::Sequence< css::uno::Reference - < css::awt::XLayoutConstrains > > SAL_CALL getChildren() - throw (css::uno::RuntimeException); - - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties( - const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); - - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) - throw(css::uno::RuntimeException); - - // css::awt::XLayoutConstrains - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); -}; - -// Align gives control over child position on the allocated space. -class Align : public Bin -{ - friend class AlignChildProps; -protected: - // properties - float fHorAlign, fVerAlign; - float fHorFill, fVerFill; - -public: - Align(); - - bool emptyVisible (); - - // css::awt::XLayoutContainer - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); -}; - -// Makes child request its or a specified size, whatever is larger. -class MinSize : public Bin -{ -protected: - // properties - long mnMinWidth, mnMinHeight; - -public: - MinSize(); - - bool emptyVisible (); - // css::awt::XLayoutContainer - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_BIN_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx deleted file mode 100644 index 93b5f53f4482..000000000000 --- a/toolkit/source/layout/core/box-base.cxx +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "box.hxx" - -#include <tools/debug.hxx> -#include <sal/macros.h> - -#include <com/sun/star/awt/XWindow2.hpp> - -// fixed point precision for distributing error -#define FIXED_PT 16 - -namespace layoutimpl -{ - -using namespace css; - -Box_Base::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) - : mxChild( xChild ) - , mxProps() - , maRequisition() -{ -} - -static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget ) -{ - if ( !xWidget.is() ) - { - OSL_FAIL( "FIXME: invalid child !" ); - return true; - } - - uno::Reference< awt::XWindow2 > xWindow( xWidget, uno::UNO_QUERY ); - if ( xWindow.is() && !xWindow->isVisible() ) - return false; - - uno::Reference< awt::XLayoutContainer > xContainer( xWidget, uno::UNO_QUERY ); - if ( xContainer.is() ) - { - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren - = xContainer->getChildren(); - - if (!aChildren.getLength ()) - if (Container *c = dynamic_cast <Container*> (xWidget.get ())) - return c->emptyVisible (); - - for ( int i = 0; i < aChildren.getLength(); i++ ) - if ( isVisible( aChildren[i] ) ) - return true; - return false; // this would kill flow without workaround above - } - - return true; -} - -bool Box_Base::ChildData::isVisible() -{ - // FIXME: call the 'isVisible' method on it ? - return layoutimpl::isVisible( mxChild ); -} - -void -Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild) -{ - ChildData *pData = createChild (xChild); - maChildren.push_back (pData); - queueResize (); -} - -void SAL_CALL -Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild) - throw (uno::RuntimeException, awt::MaxChildrenException) -{ - if (xChild.is ()) - { - AddChild (xChild); - setChildParent (xChild); - } -} - -Box_Base::ChildData* -Box_Base::removeChildData( std::list< ChildData* >& lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) -{ - for ( std::list< ChildData* >::iterator it = lst.begin(); - it != lst.end(); ++it ) - { - if ( (*it)->mxChild == xChild ) - { - ChildData* pRet = *it; - lst.erase( it ); - return pRet; - } - } - return 0; -} - -void SAL_CALL -Box_Base::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw (uno::RuntimeException) -{ - if ( ChildData* p = removeChildData( maChildren, xChild ) ) - { - delete p; - unsetChildParent( xChild ); - queueResize(); - } - else - { - OSL_FAIL( "Box_Base: removeChild: no such child" ); - } -} - -uno::Sequence< uno::Reference < awt::XLayoutConstrains > > SAL_CALL -Box_Base::getChildren() - throw (uno::RuntimeException) -{ - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() ); - unsigned int index = 0; - for ( std::list< ChildData* >::iterator it = maChildren.begin(); - it != maChildren.end(); ++it, ++index ) - children[index] = ( *it )->mxChild; - - return children; -} - -uno::Reference< beans::XPropertySet > SAL_CALL -Box_Base::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw (uno::RuntimeException) -{ - - for ( std::list< ChildData * >::iterator it = maChildren.begin(); - it != maChildren.end(); ++it) - { - if ( ( *it )->mxChild == xChild ) - { - if ( !( *it )->mxProps.is() ) - { - PropHelper *pProps = createChildProps( *it ); - pProps->setChangeListener( this ); - ( *it )->mxProps = pProps; - } - return (*it)->mxProps; - } - } - return uno::Reference< beans::XPropertySet >(); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx deleted file mode 100644 index 0c0415afe622..000000000000 --- a/toolkit/source/layout/core/box-base.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_BOX_BASE_HXX -#define LAYOUT_CORE_BOX_BASE_HXX - -#include <layout/core/container.hxx> - -#include <list> - -namespace layoutimpl -{ - -class Box_Base : public Container -{ -public: - // Children properties - struct ChildData - { - css::uno::Reference< css::awt::XLayoutConstrains > mxChild; - css::uno::Reference< css::beans::XPropertySet > mxProps; - css::awt::Size maRequisition; - virtual bool isVisible(); - - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - virtual ~ChildData() { }; - }; - - struct ChildProps: public PropHelper - { - //ChildProps( ChildProps* ); - }; - -protected: - std::list< ChildData* > maChildren; - - - virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0; - virtual ChildProps *createChildProps( ChildData* pData ) = 0; - - ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child ); - -public: - void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child); - - // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child) - throw (css::uno::RuntimeException, css::awt::MaxChildrenException); - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); - - virtual css::uno::Sequence< css::uno::Reference - < css::awt::XLayoutConstrains > > SAL_CALL getChildren() - throw (css::uno::RuntimeException); - - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties( - const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_BOX_BASE HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/box.cxx b/toolkit/source/layout/core/box.cxx deleted file mode 100644 index 96a8b798a0ca..000000000000 --- a/toolkit/source/layout/core/box.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "box.hxx" - -#include <tools/debug.hxx> -#include <sal/macros.h> - -// fixed point precision for distributing error -#define FIXED_PT 16 - -namespace layoutimpl -{ - -using namespace css; - -Box::ChildProps::ChildProps( Box::ChildData *pData ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Expand" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &(pData->mbExpand) ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Fill" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &(pData->mbFill) ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Padding" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &(pData->mnPadding) ); -} - -Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) - : Box_Base::ChildData( xChild ) - , mnPadding( 0 ) - , mbExpand( true ) - , mbFill( true ) -{ -} - -Box::ChildData* -Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) - { - return new ChildData( xChild ); - } - -Box::ChildProps* -Box::createChildProps( Box_Base::ChildData *pData ) -{ - return new ChildProps( static_cast<Box::ChildData*> ( pData ) ); -} - -Box::Box( bool horizontal ) - : Box_Base() - , mnSpacing( 0 ) - , mbHomogeneous( false ) - , mbHorizontal( horizontal ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &mbHomogeneous ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &mnSpacing ); - mbHasFlowChildren = false; -} - -awt::Size -Box::calculateSize( long nWidth ) -{ - int nVisibleChildren = 0; - // primary vs secundary axis (instead of a X and Y) - int nPrimSize = 0; - int nSecSize = 0; - int nFlowMinWidth = 0; // in case the box only has flow children - - mbHasFlowChildren = false; - - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Box::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY ); - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth(); - - awt::Size aChildSize = child->maRequisition = child->mxChild->getMinimumSize(); - - if ( !mbHorizontal /*vertical*/ && bFlow ) - { - if ( nFlowMinWidth == 0 || nFlowMinWidth > aChildSize.Width ) - nFlowMinWidth = aChildSize.Width; - mbHasFlowChildren = true; - } - else - { - int size = primDim( aChildSize ) + child->mnPadding * 2; - if ( mbHomogeneous ) - nPrimSize = SAL_MAX( nPrimSize, size ); - else - nPrimSize += size; - - nSecSize = SAL_MAX( nSecSize, secDim( aChildSize ) ); - } - nVisibleChildren++; - } - - if ( nVisibleChildren ) - { - if ( mbHomogeneous ) - nPrimSize *= nVisibleChildren; - nPrimSize += (nVisibleChildren - 1) * mnSpacing; - } - - if ( mbHasFlowChildren ) - { - if ( nWidth == 0 ) - nWidth = nSecSize ? nSecSize : nFlowMinWidth; - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Box::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY ); - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth(); - - if ( bFlow ) - nPrimSize += xChildCont->getHeightForWidth( nWidth ); - } - } - - nPrimSize += mnBorderWidth * 2; - nSecSize += mnBorderWidth * 2; - return awt::Size( mbHorizontal ? nPrimSize : nSecSize, - mbHorizontal ? nSecSize : nPrimSize ); -} - -awt::Size SAL_CALL -Box::getMinimumSize() throw(uno::RuntimeException) -{ - maRequisition = calculateSize(); - return maRequisition; -} - -sal_Bool SAL_CALL -Box::hasHeightForWidth() - throw(uno::RuntimeException) -{ - return mbHasFlowChildren; -} - -sal_Int32 SAL_CALL -Box::getHeightForWidth( sal_Int32 nWidth ) - throw(uno::RuntimeException) -{ - if ( hasHeightForWidth() ) - return calculateSize( nWidth ).Height; - return maRequisition.Height; -} - -void SAL_CALL -Box::allocateArea( const awt::Rectangle &newArea ) - throw (uno::RuntimeException) -{ - maAllocation = newArea; - int nVisibleChildren = 0, nExpandChildren = 0; - - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Box::ChildData*> ( *it ); - if ( child->isVisible() ) - { - nVisibleChildren++; - if ( child->mbExpand ) - nExpandChildren++; - } - } - if ( !nVisibleChildren ) - return; - - // split rectangle for dimension helpers - awt::Point newPoint( newArea.X, newArea.Y ); - awt::Size newSize( newArea.Width, newArea.Height ); - - int nExtraSpace; - if ( mbHomogeneous ) - nExtraSpace = ( ( primDim( newSize ) - mnBorderWidth * 2 - - ( nVisibleChildren - 1 ) * mnSpacing )) / nVisibleChildren; - else if ( nExpandChildren ) - { - int reqSize = primDim( maRequisition ); - if ( !mbHorizontal && hasHeightForWidth() ) - reqSize = getHeightForWidth( newArea.Width ); - nExtraSpace = ( primDim( newSize ) - reqSize ) / nExpandChildren; - } - else - nExtraSpace = 0; - - int nChildPrimPoint, nChildSecPoint, nChildPrimSize, nChildSecSize; - - int nStartPoint = primDim( newPoint ) + mnBorderWidth; - int nBoxSecSize = SAL_MAX( 1, secDim( newSize ) - mnBorderWidth * 2 ); - - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Box::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - - awt::Point aChildPos; - int nBoxPrimSize; // of the available box space - - if ( mbHomogeneous ) - nBoxPrimSize = nExtraSpace; - else - { - uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY ); - bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth(); - if ( !mbHorizontal && bFlow ) - nBoxPrimSize = xChildCont->getHeightForWidth( newArea.Width ); - else - nBoxPrimSize = primDim( child->maRequisition ); - nBoxPrimSize += child->mnPadding; - if ( child->mbExpand ) - nBoxPrimSize += nExtraSpace; - } - - nChildPrimPoint = nStartPoint + child->mnPadding; - nChildSecPoint = secDim( newPoint ) + mnBorderWidth; - - nChildSecSize = nBoxSecSize; - if ( child->mbFill ) - nChildPrimSize = SAL_MAX( 1, nBoxPrimSize - child->mnPadding); - else - { - nChildPrimSize = primDim( child->maRequisition ); - nChildPrimPoint += (nBoxPrimSize - nChildPrimSize) / 2; - - nChildSecPoint += (nBoxSecSize - nChildSecSize) / 2; - } - - awt::Rectangle area; - area.X = mbHorizontal ? nChildPrimPoint : nChildSecPoint; - area.Y = mbHorizontal ? nChildSecPoint : nChildPrimPoint; - area.Width = mbHorizontal ? nChildPrimSize : nChildSecSize; - area.Height = mbHorizontal ? nChildSecSize : nChildPrimSize; - - allocateChildAt( child->mxChild, area ); - - nStartPoint += nBoxPrimSize + mnSpacing + child->mnPadding; - } -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/box.hxx b/toolkit/source/layout/core/box.hxx deleted file mode 100644 index 46309a5d0b1c..000000000000 --- a/toolkit/source/layout/core/box.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_BOX_HXX -#define LAYOUT_CORE_BOX_HXX - -#include <layout/core/box-base.hxx> - -#include <com/sun/star/awt/Point.hpp> - -namespace layoutimpl -{ - -class Box : public Box_Base -{ -protected: - // Box properties (i.e. affect all children) - sal_Int32 mnSpacing; - sal_Bool mbHomogeneous; - sal_Bool mbHorizontal; // false for Vertical - bool mbHasFlowChildren; - -public: - // Children properties - struct ChildData : public Box_Base::ChildData - { - sal_Int32 mnPadding; - sal_Bool mbExpand; - sal_Bool mbFill; - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - }; - - struct ChildProps : public Box_Base::ChildProps - { - ChildProps( ChildData *pData ); - }; - -protected: - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - ChildProps *createChildProps( Box_Base::ChildData* pData ); - -public: - Box( bool horizontal ); - - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) - throw(css::uno::RuntimeException); - - // helper: mix of getMinimumSize() and getHeightForWidth() - css::awt::Size calculateSize( long nWidth = 0 ); - -private: - /* Helpers to deal with the joint Box directions. */ - inline int primDim (const css::awt::Size &size) - { if (mbHorizontal) return size.Width; else return size.Height; } - inline int secDim (const css::awt::Size &size) - { if (mbHorizontal) return size.Height; else return size.Width; } - inline int primDim (const css::awt::Point &point) - { if (mbHorizontal) return point.X; else return point.Y; } - inline int secDim (const css::awt::Point &point) - { if (mbHorizontal) return point.Y; else return point.X; } -}; - -struct VBox : public Box -{ VBox() : Box (false) {} }; - -struct HBox : public Box -{ HBox() : Box (true) {} }; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_BOX_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/byteseq.cxx b/toolkit/source/layout/core/byteseq.cxx deleted file mode 100644 index 641750b52b93..000000000000 --- a/toolkit/source/layout/core/byteseq.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/io/XInputStream.hpp> -#include <osl/file.hxx> -#include <comphelper/oslfile2streamwrap.hxx> - -using osl::File; -using osl::FileBase; -using namespace ::com::sun::star; - -namespace layoutimpl -{ - -uno::Reference< io::XInputStream > getFileAsStream( const rtl::OUString &rName ) -{ - rtl::OUString sFileURL; - if( FileBase::E_None != FileBase::getFileURLFromSystemPath( rName, sFileURL ) ) - sFileURL = rName; // maybe it already was a file url - - File * blobFile = new File(sFileURL); - File::RC errorCode = blobFile->open(osl_File_OpenFlag_Read); - - uno::Reference<io::XInputStream> xResult; - switch (errorCode) - { - case osl::File::E_None: // got it - xResult.set( new comphelper::OSLInputStreamWrapper(blobFile,true) ); - break; - - case osl::File::E_NOENT: // no file => no stream - delete blobFile; - break; - - default: - delete blobFile; -/* { - rtl::OUStringBuffer sMsg; - sMsg.appendAscii("Cannot open output file \""); - sMsg.append(aURL); - sMsg.appendAscii("\" : "); - sMsg.append(configmgr::FileHelper::createOSLErrorString(errorCode)); - - throw io::IOException(sMsg.makeStringAndClear(),NULL); - } -*/ - } - - return xResult; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/container.cxx b/toolkit/source/layout/core/container.cxx deleted file mode 100644 index 2b59ffc0236c..000000000000 --- a/toolkit/source/layout/core/container.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "container.hxx" - -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/PosSize.hpp> -#include <tools/debug.hxx> - -namespace layoutimpl { - -using namespace css; - -Container::Container() - : Container_Base() - , PropHelper() - , mnBorderWidth( 0 ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Border" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &mnBorderWidth ); - setChangeListener( this ); -} - -bool -Container::emptyVisible () -{ - return false; -} - -uno::Any -Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException) -{ - uno::Any aRet = Container_Base::queryInterface( rType ); - return aRet.hasValue() ? aRet : PropHelper::queryInterface( rType ); -} - -void -Container::allocateChildAt( const uno::Reference< awt::XLayoutConstrains > &xChild, - const awt::Rectangle &rArea ) - throw( uno::RuntimeException ) -{ - uno::Reference< awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY ); - if ( xCont.is() ) - xCont->allocateArea( rArea ); - else - { - uno::Reference< awt::XWindow > xWindow( xChild, uno::UNO_QUERY ); - if ( xWindow.is() ) - xWindow->setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, - awt::PosSize::POSSIZE ); - else - { - OSL_FAIL( "Error: non-sizeable child" ); - } - } -} - -uno::Sequence< uno::Reference< awt::XLayoutConstrains > > -Container::getSingleChild ( uno::Reference< awt::XLayoutConstrains >const &xChildOrNil ) -{ - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aSeq( ( xChildOrNil.is() ? 1 : 0 ) ); - if ( xChildOrNil.is() ) - aSeq[0] = xChildOrNil; - return aSeq; -} - -void -Container::queueResize() -{ - if ( mxLayoutUnit.is() ) - mxLayoutUnit->queueResize( uno::Reference< awt::XLayoutContainer >( this ) ); -} - -void -Container::setChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild ) -{ - uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY ); - if ( xContChild.is() ) - { - xContChild->setParent( uno::Reference< awt::XLayoutContainer >( this ) ); - } -} - -void -Container::unsetChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild ) -{ - uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY ); - if ( xContChild.is() ) - { - xContChild->setParent( uno::Reference< awt::XLayoutContainer >() ); - } -} - -void Container::propertiesChanged() -{ - // cl: why this assertion? This is also called to set properties at the top level widget which has no parent!? - // DBG_ASSERT( mxParent.is(), "Properties listener: error container doesn't have parent" ); - - if ( mxLayoutUnit.is() && mxParent.is() ) - mxLayoutUnit->queueResize( mxParent ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/container.hxx b/toolkit/source/layout/core/container.hxx deleted file mode 100644 index 5f53f47b8ece..000000000000 --- a/toolkit/source/layout/core/container.hxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_CONTAINER_HXX -#define LAYOUT_CORE_CONTAINER_HXX - -#include <layout/core/helper.hxx> - -#include <cppuhelper/implbase2.hxx> -#include <com/sun/star/awt/MaxChildrenException.hpp> - -namespace layoutimpl -{ -namespace css = ::com::sun::star; - -typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer, - css::awt::XLayoutConstrains > Container_Base; - -class TOOLKIT_DLLPUBLIC Container : public Container_Base, public PropHelper, public PropHelper::Listener -{ - friend class ChildProps; -protected: - // Widget properties - css::uno::Reference< css::awt::XLayoutContainer > mxParent; - css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit; - css::awt::Size maRequisition; - css::awt::Rectangle maAllocation; - - // Container properties - sal_Int32 mnBorderWidth; - - // Utilities - void allocateChildAt( const css::uno::Reference< css::awt::XLayoutConstrains > &xChild, - const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - static css::uno::Sequence< css::uno::Reference< css::awt::XLayoutConstrains > > - getSingleChild (const css::uno::Reference< css::awt::XLayoutConstrains > &xChildOrNil); - void setChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild ); - void unsetChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild ); - - void queueResize(); - void forceRecalc() { allocateArea( maAllocation ); } - -public: - Container(); - virtual ~Container() {} - - virtual bool emptyVisible (); - - // XInterface - virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); } - virtual void SAL_CALL release() throw() { PropHelper::release(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException, css::awt::MaxChildrenException) = 0; - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException) = 0; - - virtual css::uno::Sequence< css::uno::Reference - < css::awt::XLayoutConstrains > > SAL_CALL getChildren() - throw (css::uno::RuntimeException) = 0; - - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties( - const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException) = 0; - - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException) = 0; - - void SAL_CALL setLayoutUnit( const css::uno::Reference< css::awt::XLayoutUnit > &xUnit ) - throw(css::uno::RuntimeException) - { mxLayoutUnit = xUnit; } - css::uno::Reference< css::awt::XLayoutUnit > SAL_CALL getLayoutUnit() - throw(css::uno::RuntimeException) - { return mxLayoutUnit; } - - css::awt::Size SAL_CALL getRequestedSize() throw(css::uno::RuntimeException) - { return maRequisition; } - com::sun::star::awt::Rectangle SAL_CALL getAllocatedArea() throw(css::uno::RuntimeException) - { return maAllocation; } - - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException) = 0; - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) - throw(css::uno::RuntimeException) = 0; - - // css::awt::XLayoutContainer: css::container::XChild - css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() - throw (css::uno::RuntimeException) - { return mxParent; } - void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface > &xParent ) - throw (css::uno::RuntimeException) - { mxParent = css::uno::Reference< css::awt::XLayoutContainer >( xParent, css::uno::UNO_QUERY ); } - - // css::awt::XLayoutConstrains - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException) = 0; - // (not properly implemented in toolkit, ignore it.) - css::awt::Size SAL_CALL getPreferredSize() - throw(css::uno::RuntimeException) { return getMinimumSize(); } // TODO: use this for flow? - css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) - throw(css::uno::RuntimeException) { return rNewSize; } - -protected: - void propertiesChanged(); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_CONTAINER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/dialogbuttonhbox.cxx b/toolkit/source/layout/core/dialogbuttonhbox.cxx deleted file mode 100644 index 9c1930600c5a..000000000000 --- a/toolkit/source/layout/core/dialogbuttonhbox.cxx +++ /dev/null @@ -1,283 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <awt/vclxbutton.hxx> -#include <tools/debug.hxx> -#include <toolkit/awt/vclxwindows.hxx> -#include <vcl/button.hxx> - -#include "dialogbuttonhbox.hxx" -#include "flow.hxx" -#include "proplist.hxx" - -namespace layoutimpl -{ - -using namespace css; - -//FIXME: how to set platform-dependant variables? -DialogButtonHBox::Ordering const DialogButtonHBox::DEFAULT_ORDERING = -#if defined( MACOSX ) - DialogButtonHBox::MACOS; -#elif defined( SAL_W32 ) -DialogButtonHBox::WINDOWS; -#elif defined( ENABLE_KDE ) -DialogButtonHBox::KDE; -#else /* !MACOSX && !SAL_W32 && !ENABLE_KDE */ -DialogButtonHBox::GNOME; -#endif /* !MACOSX && !SAL_W32 && !ENABLE_KDE */ - -DialogButtonHBox::DialogButtonHBox() - : HBox() - , mnOrdering( DEFAULT_ORDERING ) - , mFlow() - , mpAction( 0 ) - , mpAffirmative( 0 ) - , mpAlternate( 0 ) - , mpApply( 0 ) - , mpCancel( 0 ) - , mpFlow( createChild( uno::Reference< awt::XLayoutConstrains > ( &mFlow ) ) ) - , mpHelp( 0 ) - , mpReset( 0 ) -{ - mbHomogeneous = true; -} - -void -DialogButtonHBox::setOrdering( rtl::OUString const& ordering ) -{ - if ( ordering.equalsIgnoreAsciiCaseAscii( "GNOME" ) ) - mnOrdering = GNOME; - else if ( ordering.equalsIgnoreAsciiCaseAscii( "KDE" ) ) - mnOrdering = KDE; - else if ( ordering.equalsIgnoreAsciiCaseAscii( "MacOS" ) ) - mnOrdering = MACOS; - else if ( ordering.equalsIgnoreAsciiCaseAscii( "Windows" ) ) - mnOrdering = WINDOWS; - else - { - OSL_TRACE( "DialogButtonHBox: no such ordering: %s", OUSTRING_CSTR( ordering ) ); - } -} - -void -DialogButtonHBox::addChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) - throw ( uno::RuntimeException, awt::MaxChildrenException ) -{ - if ( !xChild.is() ) - return; - - ChildData *p = createChild( xChild ); - -#define IS_BUTTON(t) dynamic_cast<VCLX##t##Button *>( xChild.get () ) - - /* Sort Retry as Action */ - if ( !mpAction && IS_BUTTON( Retry ) ) - mpAction = p; - else if ( !mpAffirmative && IS_BUTTON( OK ) ) - mpAffirmative = p; - else if ( !mpAffirmative && IS_BUTTON( Yes ) ) - mpAffirmative = p; - else if ( !mpAlternate && IS_BUTTON( No ) ) - mpAlternate = p; - /* Sort Ignore as Alternate */ - else if ( !mpAlternate && IS_BUTTON( Ignore ) ) - mpAlternate = p; - else if ( !mpApply && IS_BUTTON( Apply ) ) - mpApply = p; - else if ( !mpCancel && IS_BUTTON( Cancel ) ) - mpCancel = p; - /* Let the user overwrite Flow */ - else if ( /* !mpFlow && */ dynamic_cast<Flow *>( xChild.get () ) ) - mpFlow = p; - else if ( !mpHelp && IS_BUTTON( Help ) ) - mpHelp = p; - else if ( !mpReset && IS_BUTTON( Reset ) ) - mpReset = p; - else - maOther.push_back( p ); - orderChildren(); - setChildParent( xChild ); - queueResize(); -} - -void -DialogButtonHBox::orderChildren() -{ - if ( mnOrdering == WINDOWS ) - windowsOrdering(); - else if ( mnOrdering == MACOS ) - macosOrdering(); - else if ( mnOrdering == KDE ) - kdeOrdering(); - else if ( 1 || mnOrdering == GNOME ) - gnomeOrdering(); -} - -void SAL_CALL -DialogButtonHBox::removeChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) - throw ( uno::RuntimeException) -{ - if ( !xChild.is ()) - return; - - Box_Base::ChildData *p = 0; - - if ( mpAction && mpAction->mxChild == xChild ) - p = mpAction; - else if ( mpAffirmative && mpAffirmative->mxChild == xChild ) - p = mpAffirmative; - else if ( mpAlternate && mpAlternate->mxChild == xChild ) - p = mpAlternate; - else if ( mpApply && mpApply->mxChild == xChild ) - p = mpApply; - else if ( mpCancel && mpCancel->mxChild == xChild ) - p = mpCancel; - else if ( mpFlow && mpFlow->mxChild == xChild ) - p = mpFlow; - else if ( mpReset && mpReset->mxChild == xChild ) - p = mpReset; - else if ( mpHelp && mpHelp->mxChild == xChild ) - p = mpHelp; - else - p = removeChildData( maOther, xChild ); - - if ( p ) - { - delete p; - unsetChildParent( xChild ); - orderChildren(); - queueResize(); - } - else - { - OSL_FAIL( "DialogButtonHBox: removeChild: no such child" ); - } -} - -void -DialogButtonHBox::gnomeOrdering() -{ - std::list< Box_Base::ChildData * > ordered; - if ( mpHelp ) - ordered.push_back( mpHelp ); - if ( mpReset ) - ordered.push_back( mpReset ); - if ( mpFlow && ( mpHelp || mpReset ) ) - ordered.push_back( mpFlow ); - ordered.insert( ordered.end(), maOther.begin(), maOther.end() ); - if ( mpAction ) - ordered.push_back( mpAction ); - if ( mpApply ) - ordered.push_back( mpApply ); - if ( mpAlternate ) - ordered.push_back( mpAlternate ); - if ( mpCancel ) - ordered.push_back( mpCancel ); - if ( mpAffirmative ) - ordered.push_back( mpAffirmative ); - maChildren = ordered; -} - -void -DialogButtonHBox::kdeOrdering() -{ - std::list< Box_Base::ChildData * > ordered; - if ( mpHelp ) - ordered.push_back( mpHelp ); - if ( mpReset ) - ordered.push_back( mpReset ); - if ( mpFlow && ( mpHelp || mpReset ) ) - ordered.push_back( mpFlow ); - ordered.insert( ordered.end(), maOther.begin(), maOther.end() ); - if ( mpAction ) - ordered.push_back( mpAction ); - if ( mpAffirmative ) - ordered.push_back( mpAffirmative ); - if ( mpApply ) - ordered.push_back( mpApply ); - if ( mpAlternate ) - ordered.push_back( mpAlternate ); - if ( mpCancel ) - ordered.push_back( mpCancel ); - maChildren = ordered; -} - -void -DialogButtonHBox::macosOrdering() -{ - std::list< Box_Base::ChildData * > ordered; - if ( mpHelp ) - ordered.push_back( mpHelp ); - if ( mpReset ) - ordered.push_back( mpReset ); - if ( mpApply ) - ordered.push_back( mpApply ); - if ( mpAction ) - ordered.push_back( mpAction ); - ordered.insert( ordered.end(), maOther.begin(), maOther.end() ); - if ( mpFlow ) // Always flow? && ( maOther.size () || mpHelp || mpReset || mpAction ) ) - ordered.push_back( mpFlow ); - if ( mpAlternate ) - ordered.push_back( mpAlternate ); - if ( mpFlow && mpAlternate ) - ordered.push_back( mpFlow ); - if ( mpCancel ) - ordered.push_back( mpCancel ); - if ( mpAffirmative ) - ordered.push_back( mpAffirmative ); - maChildren = ordered; -} - -void -DialogButtonHBox::windowsOrdering() -{ - std::list< Box_Base::ChildData * > ordered; - if ( mpReset ) - ordered.push_back( mpReset ); - if ( mpReset && mpFlow ) - ordered.push_back( mpFlow ); - if ( mpAffirmative ) - ordered.push_back( mpAffirmative ); - if ( mpAlternate ) - ordered.push_back( mpAlternate ); - if ( mpAction ) - ordered.push_back( mpAction ); - if ( mpCancel ) - ordered.push_back( mpCancel ); - if ( mpApply ) - ordered.push_back( mpApply ); - ordered.insert( ordered.end(), maOther.begin(), maOther.end() ); - if ( mpHelp ) - ordered.push_back( mpHelp ); - maChildren = ordered; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/dialogbuttonhbox.hxx b/toolkit/source/layout/core/dialogbuttonhbox.hxx deleted file mode 100644 index aead7fc1eb80..000000000000 --- a/toolkit/source/layout/core/dialogbuttonhbox.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_DIALOGBUTTONHBOX_HXX -#define LAYOUT_CORE_DIALOGBUTTONHBOX_HXX - -#include <layout/core/box.hxx> -#include <layout/core/flow.hxx> - -namespace layoutimpl -{ - -class DialogButtonHBox : public HBox -{ -public: - DialogButtonHBox(); - - void setOrdering( rtl::OUString const& ordering ); - void SAL_CALL addChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException, css::awt::MaxChildrenException ); - void SAL_CALL removeChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException ); - -private: - enum Ordering { PLATFORM, GNOME, KDE, MACOS, WINDOWS }; - - void orderChildren(); - void gnomeOrdering(); - void kdeOrdering(); - void macosOrdering(); - void windowsOrdering(); - - static Ordering const DEFAULT_ORDERING; - Ordering mnOrdering; - Flow mFlow; - - ChildData *mpAction; /* [..]?, [Retry?] */ - ChildData *mpAffirmative; /* OK, Yes, Save */ - ChildData *mpAlternate; /* NO, [Ignore?], Don't save, Quit without saving */ - ChildData *mpApply; /* Deprecated? */ - ChildData *mpCancel; /* Cancel, Close */ - ChildData *mpFlow; - ChildData *mpHelp; - ChildData *mpReset; - - std::list< Box_Base::ChildData *> maOther; -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_DIALOGBUTTONHBOX_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/factory.cxx b/toolkit/source/layout/core/factory.cxx deleted file mode 100644 index 4cf442798d42..000000000000 --- a/toolkit/source/layout/core/factory.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "factory.hxx" - -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/registry/InvalidRegistryException.hpp> -#include <cppuhelper/factory.hxx> - -#include "root.hxx" - -using namespace ::com::sun::star; -using namespace layoutimpl; - -void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ ) - { - void * pRet = 0; - - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); - uno::Reference< lang::XSingleServiceFactory > xFactory; - - if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) ) - xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ), - LayoutFactory::impl_staticGetImplementationName(), - LayoutFactory::impl_staticCreateSelfInstance, - LayoutFactory::impl_staticGetSupportedServiceNames() ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; - } - -// Component registration -::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName() -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.awt.Layout")); -} - -uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::impl_staticGetSupportedServiceNames() -{ - uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Layout")); - aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.awt.Layout")); - return aRet; -} - -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::impl_staticCreateSelfInstance( - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) -{ - return uno::Reference< uno::XInterface >( *new LayoutFactory( xServiceManager ) ); -} - -// XServiceInfo -::rtl::OUString SAL_CALL LayoutFactory::getImplementationName() - throw ( uno::RuntimeException ) -{ - return impl_staticGetImplementationName(); -} - -uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::getSupportedServiceNames() - throw ( uno::RuntimeException ) -{ - return impl_staticGetSupportedServiceNames(); -} - -sal_Bool SAL_CALL LayoutFactory::supportsService( const ::rtl::OUString& ServiceName ) - throw ( uno::RuntimeException ) -{ - uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames(); - for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ ) - if ( ServiceName.compareTo( aSeq[i] ) == 0 ) - return sal_True; - - return sal_False; -} - -// XSingleServiceFactory -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstance() - throw ( uno::Exception, - uno::RuntimeException ) -{ - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( new LayoutRoot( m_xFactory ) ), - uno::UNO_QUERY ); -} - -uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstanceWithArguments( - const uno::Sequence< uno::Any >& aArguments ) - throw ( uno::Exception, - uno::RuntimeException ) -{ - uno::Reference< uno::XInterface > layout = createInstance(); - uno::Reference< lang::XInitialization > xInit( layout, uno::UNO_QUERY ); - xInit->initialize( aArguments ); - return layout; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/factory.hxx b/toolkit/source/layout/core/factory.hxx deleted file mode 100644 index 57fca62cdca1..000000000000 --- a/toolkit/source/layout/core/factory.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_FACTORY_HXX -#define LAYOUT_CORE_FACTORY_HXX - -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase2.hxx> -#include <toolkit/dllapi.h> - -namespace layoutimpl -{ -class Layout; -} - -class TOOLKIT_DLLPUBLIC LayoutFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory, - ::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - -public: - LayoutFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory( xFactory ) - { - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); - } - - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - impl_staticGetSupportedServiceNames(); - - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - - // XSingleServiceFactory - 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); - 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); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - -}; - -#endif /* LAYOUT_CORE_FACTORY_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/flow.cxx b/toolkit/source/layout/core/flow.cxx deleted file mode 100644 index 7a43c8137deb..000000000000 --- a/toolkit/source/layout/core/flow.cxx +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "flow.hxx" - -#include <sal/macros.h> - -namespace layoutimpl -{ - -using namespace css; - -bool Flow::ChildData::isVisible() -{ - return xChild.is(); -} - -Flow::Flow() - : Container() - , mnSpacing( 0 ) - , mbHomogeneous( false ) - , mnEachWidth( 0 ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &mbHomogeneous ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &mnSpacing ); -} - -bool -Flow::emptyVisible () -{ - return true; -} - -void SAL_CALL -Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw (uno::RuntimeException, css::awt::MaxChildrenException) -{ - if ( xChild.is() ) - { - ChildData *pData = new ChildData(); - pData->xChild = xChild; - maChildren.push_back( pData ); - - setChildParent( xChild ); - queueResize(); - } -} - -void SAL_CALL -Flow::removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild ) - throw (css::uno::RuntimeException) -{ - for ( std::list< ChildData * >::iterator it = maChildren.begin(); - it != maChildren.end(); ++it ) - { - if ( (*it)->xChild == xChild ) - { - delete *it; - maChildren.erase( it ); - - unsetChildParent( xChild ); - queueResize(); - break; - } - } -} - -css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > SAL_CALL -Flow::getChildren() - throw (css::uno::RuntimeException) -{ - uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() ); - unsigned int i = 0; - for ( std::list< ChildData * >::iterator it = maChildren.begin(); - it != maChildren.end(); ++it, ++i ) - children[i] = (*it)->xChild; - - return children; -} - -uno::Reference< beans::XPropertySet > SAL_CALL -Flow::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& /*xChild*/ ) - throw (uno::RuntimeException) -{ - return uno::Reference< beans::XPropertySet >(); -} - -css::awt::Size -Flow::calculateSize( long nMaxWidth ) -{ - long nNeedHeight = 0; - - std::list<ChildData *>::const_iterator it; - mnEachWidth = 0; - // first pass, for homogeneous property - for (it = maChildren.begin(); it != maChildren.end(); ++it) - { - if ( !(*it)->isVisible() ) - continue; - (*it)->aRequisition = (*it)->xChild->getMinimumSize(); - if ( mbHomogeneous ) - mnEachWidth = SAL_MAX( mnEachWidth, (*it)->aRequisition.Width ); - } - - long nRowWidth = 0, nRowHeight = 0; - for (it = maChildren.begin(); it != maChildren.end(); ++it) - { - if ( !(*it)->isVisible() ) - continue; - - awt::Size aChildSize = (*it)->aRequisition; - if ( mbHomogeneous ) - aChildSize.Width = mnEachWidth; - - if ( nMaxWidth && nRowWidth > 0 && nRowWidth + aChildSize.Width > nMaxWidth ) - { - nRowWidth = 0; - nNeedHeight += nRowHeight; - nRowHeight = 0; - } - nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height ); - nRowWidth += aChildSize.Width; - } - nNeedHeight += nRowHeight; - - return awt::Size( nRowWidth, nNeedHeight ); -} - -awt::Size SAL_CALL -Flow::getMinimumSize() throw(uno::RuntimeException) -{ - return maRequisition = calculateSize( 0 ); -} - -sal_Bool SAL_CALL -Flow::hasHeightForWidth() - throw(css::uno::RuntimeException) -{ - return true; -} - -sal_Int32 SAL_CALL -Flow::getHeightForWidth( sal_Int32 nWidth ) - throw(css::uno::RuntimeException) -{ - return calculateSize( nWidth ).Height; -} - -void SAL_CALL -Flow::allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException) -{ - maAllocation = rArea; - - std::list<ChildData *>::const_iterator it; - long nX = 0, nY = 0, nRowHeight = 0; - for (it = maChildren.begin(); it != maChildren.end(); ++it) - { - ChildData *child = *it; - if ( !child->isVisible() ) - continue; - - awt::Size aChildSize( child->aRequisition ); - if ( mbHomogeneous ) - aChildSize.Width = mnEachWidth; - - if ( nX > 0 && nX + aChildSize.Width > rArea.Width ) - { - nX = 0; - nY += nRowHeight; - nRowHeight = 0; - } - nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height ); - - allocateChildAt( child->xChild, - awt::Rectangle( rArea.X + nX, rArea.Y + nY, aChildSize.Width, aChildSize.Height ) ); - - nX += aChildSize.Width; - } -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/flow.hxx b/toolkit/source/layout/core/flow.hxx deleted file mode 100644 index d1965e1ecb4f..000000000000 --- a/toolkit/source/layout/core/flow.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_FLOW_HXX -#define LAYOUT_CORE_FLOW_HXX - -#include <layout/core/container.hxx> - -#include <list> - -namespace layoutimpl -{ - -class Flow : public Container -{ -protected: - // Box properties (i.e. affect all children) - sal_Int32 mnSpacing; - sal_Bool mbHomogeneous; - -public: - // Children properties - struct ChildData - { - css::awt::Size aRequisition; - css::uno::Reference< css::awt::XLayoutConstrains > xChild; - css::uno::Reference< css::beans::XPropertySet > xProps; - bool isVisible(); - }; - -protected: - std::list< ChildData * > maChildren; - long mnEachWidth; // on homogeneous, the width of every child - -public: - Flow(); - - bool emptyVisible (); - - // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException, css::awt::MaxChildrenException); - virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); - - virtual css::uno::Sequence< css::uno::Reference - < css::awt::XLayoutConstrains > > SAL_CALL getChildren() - throw (css::uno::RuntimeException); - - virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties( - const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException); - - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) - throw(css::uno::RuntimeException); - -private: - // shared between getMinimumSize() and getHeightForWidth() - css::awt::Size calculateSize( long nMaxWidth ); -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_FLOW_CORE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/helper.cxx b/toolkit/source/layout/core/helper.cxx deleted file mode 100644 index eff0838f65d4..000000000000 --- a/toolkit/source/layout/core/helper.cxx +++ /dev/null @@ -1,556 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "helper.hxx" - -#include <assert.h> -#include <list> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <toolkit/awt/vclxwindow.hxx> -#include <tools/debug.hxx> - -#include "proplist.hxx" - -namespace layoutimpl -{ -using namespace com::sun::star; -using rtl::OUString; - -} - -#include "bin.hxx" -#include "box.hxx" -#include "dialogbuttonhbox.hxx" -#include "flow.hxx" -#include "localized-string.hxx" -#include "table.hxx" - -namespace layoutimpl -{ - -oslModule WidgetFactory::mSfx2Library = 0; -WindowCreator WidgetFactory::mSfx2CreateWidget = 0; - -uno::Reference <awt::XLayoutContainer> WidgetFactory::createContainer (OUString const& name) -{ - uno::Reference< awt::XLayoutContainer > xPeer; - - if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hbox" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vbox" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "table" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Table() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "flow" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bin" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "min-size" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "align" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new Align() ); - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dialogbuttonhbox" ) ) ) - xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() ); - - return xPeer; -} - -uno::Reference <awt::XLayoutConstrains> WidgetFactory::toolkitCreateWidget (uno::Reference <awt::XToolkit> xToolkit, uno::Reference <uno::XInterface> xParent, OUString const& name, long properties) -{ - uno::Reference< awt::XLayoutConstrains > xPeer; - bool bToplevel = !xParent.is(); - - // UNO Control Widget - awt::WindowDescriptor desc; - if ( bToplevel ) - desc.Type = awt::WindowClass_TOP; - else - { - desc.Type = awt::WindowClass_SIMPLE; - - uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY ); - assert( xParent.is() ); - assert( xWinParent.is() ); - /* - With the new three layer instarr/rpath feature, when - prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to - LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0 - vclxtoolkit::ImplCreateWindow failing to create any widget; - although it succeeds here. - - While developing, one now must copy libtlx.so to - $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so - each time. - */ - VCLXWindow* parentComponent = VCLXWindow::GetImplementation( xWinParent ); - if ( !parentComponent ) - throw uno::RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("parent has no implementation")), - uno::Reference< uno::XInterface >() ); - desc.Parent = xWinParent; - } - - desc.ParentIndex = 0; - // debugging help ... - desc.Bounds.X = 0; - desc.Bounds.Y = 0; - desc.Bounds.Width = 300; - desc.Bounds.Height = 200; - - desc.WindowAttributes = properties; - desc.WindowServiceName = name; - - uno::Reference< awt::XWindowPeer > xWinPeer; - try - { - OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) ); - xWinPeer = xToolkit->createWindow( desc ); - if ( !xWinPeer.is() ) - throw uno::RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ), - uno::Reference< uno::XInterface >() ); - xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY ); - } - catch( uno::Exception & ) - { - OSL_TRACE( "Warning: %s is not a recognized type", OUSTRING_CSTR( name ) ); - return uno::Reference< awt::XLayoutConstrains >(); - } - - return xPeer; -} - -uno::Reference< awt::XLayoutConstrains > -WidgetFactory::createWidget (uno::Reference< awt::XToolkit > xToolkit, uno::Reference< uno::XInterface > xParent, OUString const& name, long properties) -{ - uno::Reference< awt::XLayoutConstrains > xPeer; - - xPeer = uno::Reference <awt::XLayoutConstrains> (createContainer (name), uno::UNO_QUERY); - if ( xPeer.is() ) - return xPeer; - - xPeer = implCreateWidget (xParent, name, properties); - if (xPeer.is ()) - return xPeer; - -#define FIXED_INFO 1 -#if FIXED_INFO - OUString tName = name; - // FIXME - if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fixedinfo" ) ) ) - tName = OUString(RTL_CONSTASCII_USTRINGPARAM("fixedtext")); - xPeer = toolkitCreateWidget (xToolkit, xParent, tName, properties); -#else - xPeer = toolkitCreateWidget (xToolkit, xParent, name, properties); -#endif - - return xPeer; -} - -PropHelper::PropHelper() : LockHelper() - , cppu::OPropertySetHelper( maBrdcstHelper ) - , pHelper( NULL ) -{ -} - -void -PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e, - uno::Type aType, void *pPtr) -{ - // this sucks rocks for effiency ... - PropDetails aDetails; - aDetails.aName = rtl::OUString::intern( pName, nNameLen, e ); - aDetails.aType = aType; - aDetails.pValue = pPtr; - maDetails.push_back( aDetails ); -} - -cppu::IPropertyArrayHelper & SAL_CALL -PropHelper::getInfoHelper() -{ - if ( ! pHelper ) - { - uno::Sequence< beans::Property > aProps( maDetails.size() ); - for ( unsigned int i = 0; i < maDetails.size(); i++) - { - aProps[i].Name = maDetails[i].aName; - aProps[i].Type = maDetails[i].aType; - aProps[i].Handle = i; - aProps[i].Attributes = 0; - } - pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ ); - - } - return *pHelper; -} - -sal_Bool SAL_CALL -PropHelper::convertFastPropertyValue( - uno::Any & rConvertedValue, - uno::Any & rOldValue, - sal_Int32 nHandle, - const uno::Any& rValue ) - throw (lang::IllegalArgumentException) -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - - // FIXME: no Any::getValue ... - getFastPropertyValue( rOldValue, nHandle ); - if ( rOldValue != rValue ) - { - rConvertedValue = rValue; - return sal_True; // changed - } - else - { - rConvertedValue.clear(); - rOldValue.clear(); - } - return sal_False; -} - - -void SAL_CALL -PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const uno::Any& rValue ) - throw (uno::Exception) -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - - const PropDetails &rInfo = maDetails[ nHandle ]; - - uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(), - rValue.pData, rValue.pType, - 0, 0, 0 ); - - if ( mpListener ) - mpListener->propertiesChanged(); -} - -void SAL_CALL -PropHelper::getFastPropertyValue( uno::Any& rValue, - sal_Int32 nHandle ) const -{ - OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() ); - const PropDetails &rInfo = maDetails[ nHandle ]; - rValue.setValue( rInfo.pValue, rInfo.aType ); -} - -::com::sun::star::uno::Any -PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - return OPropertySetHelper::queryInterface( rType ); -} - -uno::Reference <beans::XPropertySetInfo> SAL_CALL PropHelper::getPropertySetInfo () throw (uno::RuntimeException) -{ - return css::uno::Reference <css::beans::XPropertySetInfo> (createPropertySetInfo (getInfoHelper ())); -} - -} // namespace layoutimpl - -#include <awt/vclxbutton.hxx> -#include <awt/vclxdialog.hxx> -#include <awt/vclxfixedline.hxx> -#include <awt/vclxplugin.hxx> -#include <awt/vclxscroller.hxx> -#include <awt/vclxsplitter.hxx> -#include <awt/vclxtabcontrol.hxx> -#include <awt/vclxtabpage.hxx> -#include <toolkit/awt/vclxtoolkit.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/unohelp.hxx> - -#include <layout/layout.hxx> -#include <toolkit/awt/vclxwindows.hxx> -#include <vcl/lstbox.hxx> -#include <vcl.hxx> - -#include <typeinfo> - -namespace layoutimpl -{ - -uno::Reference <awt::XLayoutConstrains> WidgetFactory::implCreateWidget (uno::Reference <uno::XInterface> xParent, OUString name, long attributes) -{ - Window* parent = 0; - - if (VCLXWindow* parentComponent = VCLXWindow::GetImplementation (xParent)) - parent = parentComponent->GetWindow (); - - VCLXWindow* component = 0; - Window* window = 0; - if (!window) - window = layoutCreateWindow (&component, parent, name, attributes); - - uno::Reference <awt::XLayoutConstrains> reference; - if (window) - { - window->SetCreatedWithToolkit( sal_True ); - if ( component ) - component->SetCreatedWithToolkit( true ); - reference = component; - window->SetComponentInterface( component ); - if ( attributes & awt::WindowAttribute::SHOW ) - window->Show(); - } - - return reference; -} - -Window* WidgetFactory::layoutCreateWindow (VCLXWindow** component, Window *parent, OUString const& name, long& attributes) -{ - Window* window = 0; - - if (0) - { - ; - } - if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new Dialog( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "modaldialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new ModalDialog( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "modelessdialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new ModelessDialog (parent, ImplGetWinBits (attributes, 0)); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxdialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new ClosingDialog (parent, ImplGetWinBits (attributes, 0)); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxmodaldialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new ClosingModalDialog( parent, - ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sfxmodelessdialog" ) ) ) - { - if ( parent == NULL ) - parent = DIALOG_NO_PARENT; - window = new ClosingModelessDialog (parent, ImplGetWinBits (attributes, 0)); - *component = new layoutimpl::VCLXDialog(); - - attributes ^= awt::WindowAttribute::SHOW; - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "tabcontrol" ) ) ) - { - window = new TabControl( parent, ImplGetWinBits( attributes, WINDOW_TABCONTROL ) ); - *component = new layoutimpl::VCLXTabControl(); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "scroller" ) ) ) - { - // used FixedImage because I just want some empty non-intrusive widget - window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXScroller(); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hsplitter" ) ) || name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vsplitter" ) ) ) - { - window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXSplitter( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hsplitter" ) ) ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hfixedline" ) ) || name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "vfixedline" ) ) ) - { - WinBits nStyle = ImplGetWinBits( attributes, 0 ); - nStyle ^= WB_HORZ; - if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hfixedline" ) ) ) - nStyle |= WB_HORZ; - else - nStyle |= WB_VERT; - window = new FixedLine( parent, nStyle ); - *component = new layoutimpl::VCLXFixedLine(); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "okbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXOKButton( window ); - window->SetType (WINDOW_OKBUTTON); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cancelbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXCancelButton( window ); - window->SetType (WINDOW_CANCELBUTTON); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "yesbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXYesButton( window ); - window->SetType (WINDOW_OKBUTTON); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "nobutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - window->SetType (WINDOW_CANCELBUTTON); - *component = new layoutimpl::VCLXNoButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "retrybutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXRetryButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ignorebutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXIgnoreButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "resetbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXResetButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "applybutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXApplyButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "helpbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXHelpButton( window ); - window->SetType (WINDOW_HELPBUTTON); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "morebutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXMoreButton( window ); - window->SetType (WINDOW_MOREBUTTON); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "advancedbutton" ) ) ) - { - window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::VCLXAdvancedButton( window ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "plugin" ) ) ) - { - window = new Control( parent, ImplGetWinBits( attributes, 0 ) ); -#ifndef __SUNPRO_CC - OSL_TRACE( "%s: parent=%p (%s)", __FUNCTION__, parent, typeid( *parent ).name() ); -#endif - *component = new layoutimpl::VCLXPlugin( window, ImplGetWinBits( attributes, 0 ) ); - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "tabpage" ) ) ) - { - if (layout::TabPage::global_parent) - parent = layout::TabPage::global_parent; - layout::TabPage::global_parent = 0; - //window = new TabPage( parent, ImplGetWinBits( attributes, 0 ) ); - attributes ^= awt::WindowAttribute::SHOW; - WinBits nStyle = ImplGetWinBits( attributes, 0 ); - nStyle |= WB_HIDE; - - if (!parent) - { - window = new Dialog( parent, nStyle ); - *component = new VCLXDialog(); - } - else - { - window = new TabPage( parent, nStyle ); - *component = new VCLXTabPage( window ); - } - } - else if ( name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "string" ) ) ) - { - // FIXME: move <string>s.text to simple map<string> in root? - attributes &= ~awt::WindowAttribute::SHOW; - window = new Window( parent, ImplGetWinBits( attributes, 0 ) ); - *component = new layoutimpl::LocalizedString(); - } - else if (name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("svxfontlistbox")) - || name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("svxlanguagebox"))) - { - window = new ListBox (parent, ImplGetWinBits (attributes, 0)); - *component = new VCLXListBox (); - } - return window; -} - -} // namespace layoutimpl - -// Avoid polluting the rest of the code with vcl linkage pieces ... - -#include <vcl/imagerepository.hxx> -#include <vcl/bitmapex.hxx> -#include <vcl/graph.hxx> - -namespace layoutimpl -{ - -uno::Reference< graphic::XGraphic > loadGraphic( const char *pName ) -{ - BitmapEx aBmp; - - OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US ); - if ( aStr.compareToAscii( ".uno:" ) == 0 ) - aStr = aStr.copy( 5 ).toAsciiLowerCase(); - - if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true, true ) ) - return uno::Reference< graphic::XGraphic >(); - - return Graphic( aBmp ).GetXGraphic(); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/helper.hxx b/toolkit/source/layout/core/helper.hxx deleted file mode 100644 index 87ef7b62020d..000000000000 --- a/toolkit/source/layout/core/helper.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_HELPER_HXX -#define LAYOUT_CORE_HELPER_HXX - -#include <toolkit/dllapi.h> -#include <vector> - -#include <com/sun/star/awt/XLayoutConstrains.hpp> -#include <com/sun/star/awt/XLayoutContainer.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <com/sun/star/xml/input/XRoot.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/propshlp.hxx> -#include <osl/module.h> -#include <rtl/ustring.hxx> - -class Window; -class VCLXWindow; -extern "C" -{ - typedef Window* (SAL_CALL *WindowCreator) (VCLXWindow** component, rtl::OUString const& name, Window* parent, long& attributes); -} - -namespace layoutimpl -{ - -namespace css = ::com::sun::star; - -/* ChildProps -- a helper to set child properties for the XLayoutContainer interface. */ - -class LockHelper -{ -public: - osl::Mutex maGuard; - cppu::OBroadcastHelper maBrdcstHelper; - LockHelper() : maBrdcstHelper( maGuard ) - { - } -}; - -class PropHelper : public LockHelper - , public cppu::OPropertySetHelper - , public cppu::OWeakObject -{ - cppu::OPropertyArrayHelper *pHelper; - - struct PropDetails - { - rtl::OUString aName; - css::uno::Type aType; - void *pValue; - }; - std::vector< PropDetails > maDetails; - -protected: - void addProp( char const *pName, sal_Int32 nNameLen, rtl_TextEncoding e, - css::uno::Type aType, void *pPtr ); - -public: - PropHelper(); - - // com::sun::star::uno::XInterface - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - // cppu::OPropertySetHelper - virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any &, - css::uno::Any &, sal_Int32 nHandle, const css::uno::Any & ) - throw(css::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const css::uno::Any& rValue ) throw (css::uno::Exception); - using OPropertySetHelper::getFastPropertyValue; - virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, - sal_Int32 nHandle ) const; - - virtual css::uno::Reference <css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo () throw (css::uno::RuntimeException); - - struct Listener - { - virtual void propertiesChanged() = 0; - }; - - void setChangeListener( Listener *pListener ) - { - mpListener = pListener; - } - -protected: - Listener *mpListener; -}; - -css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &type); - -class TOOLKIT_DLLPUBLIC WidgetFactory -{ -public: - static oslModule mSfx2Library; - static WindowCreator mSfx2CreateWidget; - - // Should use UNO services in due course - static css::uno::Reference <css::awt::XLayoutConstrains> toolkitCreateWidget (css::uno::Reference <css::awt::XToolkit> xToolkit, css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString const& name, long properties); - static css::uno::Reference< css::awt::XLayoutConstrains > createWidget( css::uno::Reference <css::awt::XToolkit > xToolkit, css::uno::Reference< css::uno::XInterface > xParent, rtl::OUString const &name, long properties); - static css::uno::Reference <css::awt::XLayoutContainer> createContainer (rtl::OUString const& name); - static css::uno::Reference <css::awt::XLayoutConstrains> implCreateWidget (css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString name, long attributes); - static Window* layoutCreateWindow (VCLXWindow** component, Window *parent, rtl::OUString const& name, long& attributes); -}; - - -css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName ); - -} // end namespace layoutimpl - -#endif /* LAYOUT_CORE_HELPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/import.cxx b/toolkit/source/layout/core/import.cxx deleted file mode 100644 index 86d65a6072ba..000000000000 --- a/toolkit/source/layout/core/import.cxx +++ /dev/null @@ -1,328 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "import.hxx" - -#include <com/sun/star/awt/XButton.hpp> -#include <com/sun/star/awt/XDialog2.hpp> -#include <vcl/image.hxx> -#include <tools/debug.hxx> -#include <layout/layout.hxx> - -#include "root.hxx" -#include "helper.hxx" -#include "dialogbuttonhbox.hxx" - - -#define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout" -#define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container" - -namespace layoutimpl -{ -using namespace css; - -using ::rtl::OUString; - -ElementBase::~ElementBase() -SAL_THROW( () ) -{ - //delete mpImport; - //mpImport = 0; -} - -//** parser -WidgetElement::WidgetElement ( sal_Int32 nUid, const OUString &rName, - uno::Reference <xml::input::XAttributes> const &attributes, - ElementBase *pParent, - ImportContext *pImport) -SAL_THROW (()) -: ElementBase( nUid, rName, attributes, pParent, pImport ) -{ - OUString name = rName.toAsciiLowerCase(); - - PropList aProps; - propsFromAttributes( attributes, aProps, pImport->XMLNS_LAYOUT_UID ); - - OUString aId; - findAndRemove( "id", aProps, aId ); - OUString aLang; - findAndRemove( "xml-lang", aProps, aLang ); - - { -//DEBUG - uno::Reference< awt::XLayoutConstrains > xParent; - if ( pParent ) - xParent = static_cast<WidgetElement *>(pParent)->mpWidget->getPeer(); - - - mpWidget = pImport->mrRoot.create( aId, name, - getAttributeProps( aProps ), uno::Reference< awt::XLayoutContainer >( xParent, uno::UNO_QUERY ) ); - - } - - // TODO: handle with non-existing widgets - - mpWidget->setProperties( aProps ); - - uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY ); - if ( xDialog.is() ) - { - OUString aTitle; - if ( findAndRemove( "title", aProps, aTitle ) ) - { - OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) ); - xDialog->setTitle( aTitle ); - } - OUString aHelpId; - if ( findAndRemove( "help-id", aProps, aHelpId ) ) - { - OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) ); - xDialog->setHelpId( aHelpId ); - } - } // DEBUG: - else if ( pParent == NULL ) - { - OSL_FAIL( "Fatal error: top node isn't a dialog" ); - } - - OUString aOrdering; - if ( findAndRemove( "ordering", aProps, aOrdering ) ) - if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) ) - b->setOrdering ( aOrdering ); - - bool bSetRadioGroup; - OUString aRadioGroup; - bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup ); - - mpWidget->setProperties( aProps ); - - // we need to add radio buttons to the group after their properties are - // set, so we can check if they should be the one selected by default or not. - // And the state changed event isn't fired when changing properties. - - uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY ); - if ( xRadio.is() ) - { - if (!bSetRadioGroup) - aRadioGroup = OUString(RTL_CONSTASCII_USTRINGPARAM ("default")); - pImport->mxRadioGroups.addItem( aRadioGroup, xRadio ); - } -} - -WidgetElement::~WidgetElement() -{ - //delete mpWidget; - //mpWidget = 0; -} - -uno::Reference <xml::input::XElement> -WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name, - uno::Reference <xml::input::XAttributes> const &attributes ) - throw( xml::sax::SAXException, uno::RuntimeException ) -{ - // Adding a child to the widget - WidgetElement *pChild = new WidgetElement ( nUid, name, attributes, this, mpImport ); - - if ( !mpWidget->addChild( pChild->mpWidget ) ) - { - OSL_TRACE( "ERROR: cannot add %s to container %s, container full", OUSTRING_CSTR( name ), OUSTRING_CSTR( getLocalName() ) ); - throw xml::sax::SAXException(); - } - - PropList aProps; - propsFromAttributes( attributes, aProps, mpImport->XMLNS_CONTAINER_UID ); - mpWidget->setChildProperties( pChild->mpWidget, aProps ); - - return pChild; -} - -// Support Ivo Hinkelmann's move label/text/title attribute to CONTENT -// transex3 hack. -void SAL_CALL -WidgetElement::characters( OUString const& rChars ) - throw (xml::sax::SAXException, uno::RuntimeException) -{ - if ( mpWidget && rChars.trim().getLength() ) - { - uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY ); - uno::Reference< awt::XButton > xButton( mpWidget->getPeer(), uno::UNO_QUERY ); - if ( xDialog.is() ) - xDialog->setTitle( rChars ); - else if ( xButton.is() ) - mpWidget->setProperty( OUString(RTL_CONSTASCII_USTRINGPARAM("label")), rChars ); - else - mpWidget->setProperty( OUString(RTL_CONSTASCII_USTRINGPARAM("text")), rChars ); - } -} -// ---- ElementBase ---- - -ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName, - uno::Reference< xml::input::XAttributes > const & xAttributes, - ElementBase* pParent, - ImportContext* pImport ) -SAL_THROW(()) -: mpImport( pImport ) - , mpParent( pParent ) - , mnUid( nUid ) - , maLocalName( rLocalName ) - , mxAttributes( xAttributes ) -{ -} - -// ---- ImportContext ---- - -void ImportContext::startDocument( - uno::Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) - throw (xml::sax::SAXException, uno::RuntimeException) -{ - XMLNS_LAYOUT_UID = xNamespaceMapping->getUidByUri( - OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_LAYOUT_URI ) ) ); - XMLNS_CONTAINER_UID = xNamespaceMapping->getUidByUri( - OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_CONTAINER_URI ) ) ); -} - -ToplevelElement::ToplevelElement (OUString const &rName, - uno::Reference <xml::input::XAttributes> const &xAttributes, - ImportContext *pImport) -SAL_THROW(()) -: WidgetElement( 0, rName, xAttributes, NULL, pImport ) -{ -} - -ToplevelElement::~ToplevelElement() -{ -} - -uno::Reference< xml::input::XElement > ImportContext::startRootElement( - sal_Int32 nUid, OUString const & rLocalName, - uno::Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, uno::RuntimeException) -{ - if ( XMLNS_LAYOUT_UID != nUid ) - throw xml::sax::SAXException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ), - uno::Reference< uno::XInterface >(), uno::Any() ); - return new ToplevelElement( rLocalName, xAttributes, this ); -} - -RadioGroups::RadioGroups() -{ -} - -void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio ) - throw (uno::RuntimeException) -{ - if ( ! xRadio.is() ) - throw uno::RuntimeException(); - - uno::Reference< RadioGroup > group; - RadioGroupsMap::iterator it = mxRadioGroups.find( id ); - if ( it == mxRadioGroups.end() ) - { - group = uno::Reference< RadioGroup > ( new RadioGroup() ); - mxRadioGroups [id] = group; - } - else - group = it->second; - group->addItem( xRadio ); -} - -RadioGroups::RadioGroup::RadioGroup() -{ -} - -void RadioGroups::RadioGroup::addItem( uno::Reference< awt::XRadioButton > xRadio ) -{ - if ( ! mxSelectedRadio.is() ) - { - xRadio->setState( true ); - mxSelectedRadio = xRadio; - } - else if ( xRadio->getState() ) - { -#if 1 - xRadio->setState( false ); -#else // huh, why select last added? - mxSelectedRadio->setState( false ); - mxSelectedRadio = xRadio; -#endif - } - - // TOO late: actionPerformed is called before itemStateChanged. - // If client code (wrongly?) uses actionPerformed, it will see - // the previous RadioButtons' state. - xRadio->addItemListener( this ); - - uno::Reference< awt::XButton > xButton = uno::Reference< awt::XButton > ( xRadio, uno::UNO_QUERY ); - xButton->addActionListener( this ); - - mxRadios.push_back (xRadio); -} - -void RadioGroups::RadioGroup::handleSelected () - throw (uno::RuntimeException) -{ - for ( RadioButtonsList::iterator it = mxRadios.begin(); - it != mxRadios.end(); ++it ) - if ( *it != mxSelectedRadio && (*it)->getState() ) - { - mxSelectedRadio->setState( false ); - mxSelectedRadio = *it; - break; - } -} - -// awt::XItemListener -void RadioGroups::RadioGroup::itemStateChanged( const awt::ItemEvent& e ) - throw (uno::RuntimeException) -{ - // TOO late: actionPerformed is called before itemStateChanged. - // If client code (wrongly?) uses actionPerformed, it will see - // the previous RadioButtons' state. - - // Need this for initialization, though. - if ( e.Selected ) - handleSelected (); -} - -// awt::XActionListener -void RadioGroups::RadioGroup::actionPerformed( const awt::ActionEvent& ) - throw (uno::RuntimeException) -{ - handleSelected (); -} - -// lang::XEventListener -void SAL_CALL RadioGroups::RadioGroup::disposing( const lang::EventObject& ) - throw (uno::RuntimeException) -{ -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/import.hxx b/toolkit/source/layout/core/import.hxx deleted file mode 100644 index dc86ba006070..000000000000 --- a/toolkit/source/layout/core/import.hxx +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_IMPORT_HXX -#define LAYOUT_CORE_IMPORT_HXX - -#include <map> -#include <list> -#define _BACKWARD_BACKWARD_WARNING_H 1 -#include <boost/unordered_map.hpp> - - -#include <com/sun/star/xml/input/XRoot.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/awt/XButton.hpp> -#include <com/sun/star/awt/XRadioButton.hpp> - -namespace layoutimpl -{ -class LayoutRoot; -class LayoutWidget; -namespace css = ::com::sun::star; - -class RadioGroups -{ -public: - RadioGroups(); - - void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio ) - throw (css::uno::RuntimeException); - -private: - class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener > - , public ::cppu::WeakImplHelper1< css::awt::XActionListener > - { - public: - RadioGroup(); - void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio ); - - private: - typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList; - RadioButtonsList mxRadios; - css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio; - - void handleSelected () - throw (css::uno::RuntimeException); - - // awt::XItemListener - void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e ) - throw (css::uno::RuntimeException); - - // awt::XActionListener - void SAL_CALL actionPerformed( const css::awt::ActionEvent& e ) - throw (css::uno::RuntimeException); - - // lang::XEventListener - void SAL_CALL disposing( const css::lang::EventObject& ) - throw (css::uno::RuntimeException); - }; - - // each RadioGroup will stay alive after RadioGroups die with the ImportContext - // because they are referenced by every XRadioButton through the listener - typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap; - RadioGroupsMap mxRadioGroups; -}; - -// parser -class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot > -{ -public: - sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID; - LayoutRoot &mrRoot; // switch to XNameContainer ref ? - RadioGroups mxRadioGroups; - - inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () ) - : mrRoot( rRoot ) {} - virtual ~ImportContext() {} - - // XRoot - virtual void SAL_CALL startDocument( - css::uno::Reference< css::xml::input::XNamespaceMapping > - const & xNamespaceMapping ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL endDocument() - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - virtual void SAL_CALL processingInstruction( - ::rtl::OUString const & /* rTarget */, ::rtl::OUString const & /* rData */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - virtual void SAL_CALL setDocumentLocator( - css::uno::Reference< css::xml::sax::XLocator > const & /* xLocator */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - virtual css::uno::Reference< css::xml::input::XElement > - SAL_CALL startRootElement( - sal_Int32 nUid, ::rtl::OUString const & rLocalName, - css::uno::Reference<css::xml::input::XAttributes > const & xAttributes ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); -}; - -class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement > -{ -protected: - ImportContext *mpImport; -/* TODO: check if all this memebers are needed. */ - ElementBase *mpParent; - sal_Int32 mnUid; - - ::rtl::OUString maLocalName; - css::uno::Reference< css::xml::input::XAttributes > mxAttributes; -public: - ElementBase( - sal_Int32 nUid, ::rtl::OUString const & rLocalName, - css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, - ElementBase * pParent, ImportContext * pImport ) - SAL_THROW( () ); - virtual ~ElementBase() SAL_THROW(()); - - // XElement - virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent() - throw (css::uno::RuntimeException) - { return static_cast< css::xml::input::XElement * >( mpParent ); } - virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException) - { return maLocalName; } - virtual sal_Int32 SAL_CALL getUid() throw (css::uno::RuntimeException) - { return mnUid; } - virtual css::uno::Reference< css::xml::input::XAttributes > - SAL_CALL getAttributes() throw (css::uno::RuntimeException) - { return mxAttributes; } - - virtual void SAL_CALL ignorableWhitespace( - ::rtl::OUString const & /* rWhitespaces */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - virtual void SAL_CALL processingInstruction( - ::rtl::OUString const & /* Target */, ::rtl::OUString const & /* Data */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } - - virtual css::uno::Reference< css::xml::input::XElement > - SAL_CALL startChildElement( - sal_Int32 nUid, ::rtl::OUString const & rLocalName, - css::uno::Reference<css::xml::input::XAttributes > const & xAttributes ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException) = 0; - virtual void SAL_CALL endElement() - throw (css::xml::sax::SAXException, css::uno::RuntimeException) - { /* ignore */ } -}; - -class WidgetElement : public ElementBase -{ -protected: - LayoutWidget *mpWidget; - -public: - WidgetElement( sal_Int32 nUid, rtl::OUString const &name, - css::uno::Reference< css::xml::input::XAttributes > const &attributes, - ElementBase *parent, ImportContext *import ) SAL_THROW (()); - - ~WidgetElement(); - - - virtual css::uno::Reference< css::xml::input::XElement> SAL_CALL - startChildElement (sal_Int32 id, rtl::OUString const &name, - css::uno::Reference< css::xml::input::XAttributes > const &attributes) - throw( css::xml::sax::SAXException, css::uno::RuntimeException ); - virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); -}; - -class ToplevelElement : public WidgetElement -{ -public: - ToplevelElement( rtl::OUString const &name, - css::uno::Reference< css::xml::input::XAttributes > const &attributes, - ImportContext *import ) SAL_THROW (()); - ~ToplevelElement(); -}; - - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_IMPORT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/localized-string.cxx b/toolkit/source/layout/core/localized-string.cxx deleted file mode 100644 index e555817cef54..000000000000 --- a/toolkit/source/layout/core/localized-string.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "localized-string.hxx" - -#include <toolkit/helper/property.hxx> -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> - -namespace layoutimpl -{ - -namespace css = ::com::sun::star; -using namespace css; -using rtl::OUString; - -LocalizedString::LocalizedString() - : VCLXWindow() -{ -} - -void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids ) -{ - PushPropertyIds( ids, BASEPROPERTY_TEXT, 0); - VCLXWindow::ImplGetPropertyIds( ids ); -} - -// XInterface -uno::Any LocalizedString::queryInterface( uno::Type const& rType ) - throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( awt::XFixedText*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -void LocalizedString::setText( OUString const& s ) - throw(uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( Window *w = GetWindow() ) - return w->SetText( s ); -} - -OUString LocalizedString::getText() - throw(uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if ( Window *w = GetWindow() ) - return w->GetText(); - return OUString(); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/localized-string.hxx b/toolkit/source/layout/core/localized-string.hxx deleted file mode 100644 index d8a4f7a89369..000000000000 --- a/toolkit/source/layout/core/localized-string.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_LOCALIZED_STRING_HXX -#define LAYOUT_CORE_LOCALIZED_STRING_HXX - -#include <com/sun/star/awt/XFixedText.hpp> -#include <toolkit/awt/vclxwindow.hxx> - -namespace layoutimpl -{ -namespace css = ::com::sun::star; - -// FIXME: misuse XFixedText interface for simple string -class LocalizedString : public css::awt::XFixedText - , public VCLXWindow -{ -public: - LocalizedString(); - - // css::uno::XInterface - css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType ) - throw(css::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // css::awt::XFixedText - void SAL_CALL setText( ::rtl::OUString const& s ) - throw(css::uno::RuntimeException); - ::rtl::OUString SAL_CALL getText() - throw(css::uno::RuntimeException); - void SAL_CALL setAlignment( sal_Int16 ) - throw(css::uno::RuntimeException) { } - sal_Int16 SAL_CALL getAlignment() - throw(css::uno::RuntimeException) { return 0; } - - // css::awt::XLayoutConstrains - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); } - css::awt::Size SAL_CALL getPreferredSize() - throw(css::uno::RuntimeException) { return getMinimumSize(); } - css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size ) - throw(css::uno::RuntimeException) { return size; } - - static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids ); - virtual void GetPropertyIds( std::list< sal_uInt16 > &ids ) - { return ImplGetPropertyIds( ids ); } -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_LOCALIZED_STRING_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/precompiled_xmlscript.hxx b/toolkit/source/layout/core/precompiled_xmlscript.hxx deleted file mode 100644 index 0be98395c1ea..000000000000 --- a/toolkit/source/layout/core/precompiled_xmlscript.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* - xmlscript/source/xml_helper/xml_byteseq.cxx compile helper. - - Avoid introducing a toolkit dependency on xmlscript. - - It would be nice to modify xml_byteseq.cxx making it friendlier - to include. -*/ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/proplist.cxx b/toolkit/source/layout/core/proplist.cxx deleted file mode 100644 index 88ba18b7ce68..000000000000 --- a/toolkit/source/layout/core/proplist.cxx +++ /dev/null @@ -1,410 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "proplist.hxx" - -#include <rtl/ustrbuf.hxx> -#include <toolkit/dllapi.h> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <tools/debug.hxx> - -#include "helper.hxx" - -namespace layoutimpl -{ - -using namespace com::sun::star; -using rtl::OString; -using rtl::OUString; -using rtl::OUStringBuffer; - -namespace prophlp -{ - -bool TOOLKIT_DLLPUBLIC -canHandleProps( const uno::Reference< uno::XInterface > &xPeer ) -{ - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY ); - if ( xPropSet.is() ) - return true; - uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY ); - uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY ); - return xInfo.is() && xVclPeer.is(); -} - -uno::Reference< beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC -queryPropertyInfo( - const uno::Reference< uno::XInterface > &xPeer ) -{ - uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY ); - if ( !xInfo.is() ) - { - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY ); - if ( xPropSet.is() ) - xInfo = xPropSet->getPropertySetInfo(); - } - return xInfo; -} - -void TOOLKIT_DLLPUBLIC -setProperty( const uno::Reference< uno::XInterface > &xPeer, - const OUString &rName, uno::Any aValue ) -{ - uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY ); - if ( xVclPeer.is() ) - xVclPeer->setProperty( rName, aValue ); - else - { - uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY ); - xPropSet->setPropertyValue( rName, aValue ); - } -} - -} // namespace prophlp - - -/* Given a string and a type, it converts the string to the type, and returns - it encapsulated in Any. */ -uno::Any anyFromString( OUString const& value, uno::Type const& type ) -{ - sal_Int16 radix = 10; - OUString intval = value; - if ( value.getLength() > 2 && value[0] == '0' && value[1] == 'x' ) - intval = value.copy( 2 ), radix = 16; - else if ( value.getLength() > 1 && value[0] == '#' ) - intval = value.copy( 1 ), radix = 16; - switch ( type.getTypeClass() ) - { - case uno::TypeClass_CHAR: - return uno::makeAny( value.toChar() ); - case uno::TypeClass_BOOLEAN: - if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ) - return uno::makeAny( true ); - else if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) - return uno::makeAny( false ); - break; // ends switch, throws exception - case uno::TypeClass_BYTE: - return uno::makeAny( ( sal_uInt8 ) intval.toInt32( radix ) ); - case uno::TypeClass_SHORT: - return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) ); - case uno::TypeClass_UNSIGNED_SHORT: - return uno::makeAny( ( sal_uInt16 ) intval.toInt32( radix ) ); - case uno::TypeClass_ENUM: - return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) ); - case uno::TypeClass_LONG: - return uno::makeAny( ( sal_Int32 ) intval.toInt32( radix ) ); - case uno::TypeClass_UNSIGNED_LONG: - return uno::makeAny( ( sal_uInt32 ) intval.toInt32( radix ) ); - case uno::TypeClass_HYPER: - return uno::makeAny( ( sal_Int64 ) intval.toInt64( radix ) ); - case uno::TypeClass_UNSIGNED_HYPER: - return uno::makeAny( ( sal_uInt16 ) intval.toInt64( radix ) ); - case uno::TypeClass_FLOAT: - return uno::makeAny( value.toFloat() ); - case uno::TypeClass_DOUBLE: - return uno::makeAny( value.toDouble() ); - case uno::TypeClass_STRING: - return uno::makeAny( value ); - case uno::TypeClass_CONSTANT: - return uno::makeAny( intval.toInt32( radix ) ); - case uno::TypeClass_INTERFACE: - return uno::makeAny( loadGraphic( OUSTRING_CSTR( value ) ) ); - case uno::TypeClass_SEQUENCE: - { - sal_Int32 i = 0; - bool escaped = false, first = true; - OUString item, token; - std::list< OUString > values; - do - { - token = value.getToken( 0, ':', i ); - - if ( !token.getLength() && !escaped ) - { - escaped = true; - item += OUString( ':' ); - } - else if ( escaped ) - { - escaped = false; - item += token; - } - else - { - if ( !first ) - values.push_back( item ); - item = token; - } - first = false; - } - while ( i >= 0 ); - if ( item.getLength() ) - values.push_back( item ); - - uno::Sequence< OUString > seq( values.size() ); - i = 0; - for ( std::list< OUString >::const_iterator it = values.begin(); - it != values.end(); ++it, ++i ) - seq[ i ] = *it; - - return uno::makeAny( seq ); - } - - default: - OSL_TRACE( "ERROR: unknown property type of value: `%s'", OUSTRING_CSTR( value ) ); - break; - } - throw uno::RuntimeException(); -} - -/* Converts the XML naming scheme to UNO's, for legacy compatibility - (so, ergo, "one-two-three-four" -> "OneTwoThreeFour"). */ -static OUString toUnoNaming ( OUString const &string ) -{ - OUStringBuffer buffer( string.getLength() ); - sal_Unicode *str = string.pData->buffer; - bool capitalize = true; - - for ( int i = 0; i < string.getLength(); i++ ) - { - if ( i == 0 && str[0] == '_' ) - /* Skip translate-me prefix. */ - continue; - if ( str[i] == '-' ) - capitalize = true; - else - { - if ( capitalize && str[i] >= 'a' && str[i] <= 'z' ) - buffer.append( (sal_Unicode ) ( str[i] - 'a' + 'A' ) ); - else - buffer.append( (sal_Unicode ) str[i] ); - capitalize = false; - } - } - - return buffer.makeStringAndClear(); -} - -/* - * convert incoming XML style property names, to AWT style property names. - * convert the values based on introspection information. - * apply to either an XPropertySet or an XPropertySetInfo | XVclWindowPeer - * aggregate. - */ -void -setProperties( uno::Reference< uno::XInterface > const& xPeer, - PropList const& rProps ) -{ - if ( !prophlp::canHandleProps( xPeer ) ) - { - OSL_FAIL( "Error: setProperties - bad handle ignoring props:\n" ); - for ( PropList::const_iterator it = rProps.begin(); it != rProps.end(); - ++it ) - { - OSL_TRACE( "%s=%s", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) ); - } - return; - } - - for ( PropList::const_iterator it = rProps.begin(); it != rProps.end(); - ++it ) - setProperty( xPeer, it->first, it->second ); -} - -void -setProperty( uno::Reference< uno::XInterface > const& xPeer, - OUString const& attr, OUString const& value ) -{ - OUString unoAttr = toUnoNaming( attr ); - - OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) ); - // get a Property object - beans::Property prop; - try - { - uno::Reference< beans::XPropertySetInfo > xInfo - = prophlp::queryPropertyInfo( xPeer ); - prop = xInfo->getPropertyByName( unoAttr ); - } - catch( beans::UnknownPropertyException & ) - { - OSL_TRACE( "Warning: unknown attribute: `%s'", OUSTRING_CSTR( unoAttr ) ); - return; - } - - if ( prop.Name.getLength() <= 0 ) - { - OSL_TRACE( "Warning: missing prop: `%s'", OUSTRING_CSTR( unoAttr ) ); - return; - } - - // encapsulates value in an uno::Any - uno::Any any; - try - { - any = anyFromString( value, prop.Type ); - } - catch( uno::RuntimeException & ) - { - OSL_TRACE( "Warning: %s( %s )( %s ) attribute is of type %s( rejected: %s )", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ), OUSTRING_CSTR( prop.Name ), OUSTRING_CSTR( prop.Type.getTypeName() ), OUSTRING_CSTR( value ) ); - return; - } - - // sets value on property - try - { - prophlp::setProperty( xPeer, unoAttr, any ); - } - catch( ... ) - { - OSL_TRACE( "Warning: cannot set attribute %s to %s", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ) ); - } -} - - - - -struct AttributesMap -{ - const char *name; - long value; - bool windowAttr; -}; -static const AttributesMap attribsMap[] = -{ - { "autohscroll", awt::VclWindowPeerAttribute::AUTOHSCROLL, false }, - { "autovscroll", awt::VclWindowPeerAttribute::AUTOVSCROLL, false }, - { "center", awt::VclWindowPeerAttribute::CENTER, false }, - { "clipchildren", awt::VclWindowPeerAttribute::CLIPCHILDREN, false }, - { "closeable", awt::WindowAttribute::CLOSEABLE, true }, - { "defbutton", awt::VclWindowPeerAttribute::DEFBUTTON, false }, - { "dropdown", awt::VclWindowPeerAttribute::DROPDOWN, false }, - { "fullsize", awt::WindowAttribute::FULLSIZE, true }, //FIXME? - { "group", awt::VclWindowPeerAttribute::GROUP, false }, - { "has_border", awt::WindowAttribute::BORDER, true }, - { "hscroll", awt::VclWindowPeerAttribute::HSCROLL, false }, - { "left", awt::VclWindowPeerAttribute::LEFT, false }, - { "moveable", awt::WindowAttribute::MOVEABLE, true }, - { "noborder", awt::VclWindowPeerAttribute::NOBORDER, false }, - { "nolabel", awt::VclWindowPeerAttribute::NOLABEL, false }, - { "optimumsize", awt::WindowAttribute::OPTIMUMSIZE, false }, - { "readonly", awt::VclWindowPeerAttribute::READONLY, false }, - { "right", awt::VclWindowPeerAttribute::RIGHT, false }, - { "show", awt::WindowAttribute::SHOW, true }, - { "sizeable", awt::WindowAttribute::SIZEABLE, true }, - { "sort", awt::VclWindowPeerAttribute::SORT, false }, - { "spin", awt::VclWindowPeerAttribute::SPIN, false }, - { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false }, - - // cutting on OK, YES_NO_CANCEL and related obsite attributes... -}; -static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap ); - -void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes, - PropList &rProps, sal_Int32 nNamespace ) -{ - sal_Int32 nAttrs = xAttributes->getLength(); - for ( sal_Int32 i = 0; i < nAttrs; i++ ) - { - if ( nNamespace != xAttributes->getUidByIndex( i ) ) - continue; - - std::pair< OUString, OUString > aElem - ( xAttributes->getLocalNameByIndex( i ), - xAttributes->getValueByIndex( i ) ); - - if ( aElem.first.getLength() > 0 ) // namespace bits .. - rProps.push_back( aElem ); - } -} - -bool -findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue ) -{ - PropList::iterator it; - OUString aName = OUString::createFromAscii( pAttr ); - - for ( it = rProps.begin(); it != rProps.end(); ++it ) - { - if ( it->first.equalsIgnoreAsciiCase( aName ) - || it->first.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM ("_")) + aName ) ) - { - rValue = it->second; - rProps.erase( it ); - return true; - } - } - rValue = OUString(); - return false; -} - -long -getAttributeProps( PropList &rProps ) -{ - long nAttrs = 0; - OUString aValue; - - OUString trueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) ); - - if ( findAndRemove( "show", rProps, aValue ) && - aValue.equalsIgnoreAsciiCase( - OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) ) - ; - else - nAttrs |= awt::WindowAttribute::SHOW; - - for ( int i = 0; i < attribsMapLen; i++ ) - { - if ( findAndRemove( attribsMap[i].name, rProps, aValue ) ) - { - if ( aValue.equalsIgnoreAsciiCase( trueStr ) ) - nAttrs |= attribsMap[i].value; - } - } - - if ( findAndRemove( "align", rProps, aValue ) ) - { - sal_Int32 nVal = aValue.toInt32(); - - if ( nVal == 0 /* PROPERTY_ALIGN_LEFT */ ) - nAttrs |= awt::VclWindowPeerAttribute::LEFT; - else if ( nVal == 1 /* PROPERTY_ALIGN_CENTER */ ) - nAttrs |= awt::VclWindowPeerAttribute::CENTER; - else if ( nVal == 2 ) - nAttrs |= awt::VclWindowPeerAttribute::RIGHT; - } - - return nAttrs; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/proplist.hxx b/toolkit/source/layout/core/proplist.hxx deleted file mode 100644 index bddd24bd34f8..000000000000 --- a/toolkit/source/layout/core/proplist.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_PROPLIST_HXX -#define LAYOUT_CORE_PROPLIST_HXX - -#include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/xml/input/XAttributes.hpp> -#include <list> -#include <rtl/ustring.hxx> -#include <toolkit/dllapi.h> -\ -namespace layoutimpl -{ - -namespace css = ::com::sun::star; - -typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList; - -void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes, - PropList &rProps, sal_Int32 nNamespace ); - -void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer, - PropList const& rProps); - -void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer, - rtl::OUString const& attr, rtl::OUString const& value ); - -long getAttributeProps( PropList &rProps ); -bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue); - -// Helpers - unfortunately VCLXWindows don't implement XPropertySet -// but containers do - these helpers help us to hide this -namespace prophlp -{ - -// can we set properties on this handle ? -bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef ); -// if so which properties ? -css::uno::Reference< css::beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC queryPropertyInfo( - const css::uno::Reference< css::uno::XInterface > &xRef ); -// set ... -void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterface > &xRef, - const rtl::OUString &rName, - css::uno::Any aValue ); -} // namespace prophlp - -} // namespace layoutimpl - - -#if !OUSTRING_CSTR_PARANOIA -#define OUSTRING_CSTR( str ) \ - rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr() -#else - -inline char const* OUSTRING_CSTR( rtl::OUString const& str ) -{ - rtl::OString *leak - = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US)); - return leak->getStr(); -} - -#endif - -#endif /* LAYOUT_CORE_PROPLIST_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/root.cxx b/toolkit/source/layout/core/root.cxx deleted file mode 100644 index 408b7efa53e6..000000000000 --- a/toolkit/source/layout/core/root.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "root.hxx" - -#include <cassert> - -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/XMessageBox.hpp> -#include <com/sun/star/awt/MessageBoxButtons.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/awt/XMessageBoxFactory.hpp> -#include <com/sun/star/xml/sax/SAXParseException.hpp> -#include <com/sun/star/xml/sax/XParser.hpp> - -#include "helper.hxx" -#include "import.hxx" -#include "timer.hxx" -#include "translate.hxx" - -namespace layoutimpl -{ - -using namespace css; -using ::rtl::OUString; - -LayoutRoot::LayoutRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) - : mbDisposed( sal_False ) - , mxFactory( xFactory ) - , mpListeners( NULL ) - , mpToplevel( NULL ) -{ - if ( !xFactory.is() ) - throw uno::RuntimeException(); - mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() ); -} - -LayoutRoot::~LayoutRoot() -{ -// TODO: we want to delete the top level LayoutWidget... - ::osl::MutexGuard aGuard( maMutex ); - if ( !mbDisposed ) - { - try - { - m_refCount++; // inhibit multiple destruction - dispose(); - } - catch (const uno::Exception&) - { - } - } -} - -void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactory, uno::Reference< awt::XToolkit > xToolkit, OUString const& aTitle, OUString const& aMessage ) -{ - uno::Reference< uno::XInterface > iDesktop = xFactory->createInstance - ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ); - uno::Reference< frame::XDesktop > xDesktop ( iDesktop, uno::UNO_QUERY ); - uno::Reference< frame::XFrame > xFrame ( xDesktop->getCurrentFrame() ); - uno::Reference< awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); - uno::Reference< awt::XWindowPeer > xWindowPeer( xContainerWindow, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XMessageBoxFactory > xMessageBoxFactory( xToolkit, uno::UNO_QUERY ); - - awt::Rectangle aRectangle; - uno::Reference< awt::XMessageBox > xMessageBox - = xMessageBoxFactory->createMessageBox - ( xWindowPeer, aRectangle, OUString(RTL_CONSTASCII_USTRINGPARAM("errorbox")), - awt::MessageBoxButtons::BUTTONS_OK, aTitle, aMessage ); - - if ( xMessageBox.is() ) - xMessageBox->execute(); - //FIXME: exceptions not caught and printed at top level?? - //else - //printf( "%s\n", OUSTRING_CSTR( aMessage ) ); -} - -void LayoutRoot::error( OUString const& message ) -{ - OSL_TRACE( "%s", OUSTRING_CSTR( message ) ); - ShowMessageBox( mxFactory, mxToolkit, - OUString(RTL_CONSTASCII_USTRINGPARAM("Fatal error")), - message ); - throw uno::RuntimeException( message, uno::Reference< uno::XInterface >() ); -} - -// XInitialization -void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArguments ) - throw ( uno::Exception, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - - if ( mbDisposed ) - throw lang::DisposedException(); - - if ( mxContainer.is() ) // only 1 init ... - throw uno::Exception(); - - if ( !aArguments.getLength() ) - throw lang::IllegalArgumentException(); - - OSL_ENSURE( aArguments.getLength() == 1, "Wrong arg count\n" ); - - OUString aXMLName; - if ( !( aArguments[0] >>= aXMLName ) ) - throw lang::IllegalArgumentException(); - - uno::Reference< xml::sax::XParser > xParser - ( mxFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ), - uno::UNO_QUERY ); - OSL_ASSERT( xParser.is() ); - if (! xParser.is()) - { - throw uno::RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("cannot create sax-parser component")), - uno::Reference< uno::XInterface >() ); - } - - // FIXME: quite possibly we want to pass this in ... - uno::Reference< awt::XToolkit > xToolkit; - - mxToolkit = uno::Reference< awt::XToolkit >( - mxFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ), - uno::UNO_QUERY ); - - if ( !mxToolkit.is() ) - throw uno::RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("failed to create toolkit!")), - uno::Reference< uno::XInterface >() ); - - OUString aXMLFile = readRightTranslation( aXMLName ); - uno::Reference< io::XInputStream > xStream = getFileAsStream( aXMLFile ); - if (! xStream.is() ) - error( OUString(RTL_CONSTASCII_USTRINGPARAM("Installation problem: cannot find XML file:")) + aXMLName ); - - // error handler, entity resolver omitted - - ImportContext *pCtx = new ImportContext( *this ); - - uno::Reference< xml::input::XRoot > xRoot( pCtx ); - uno::Sequence < uno::Any > aArgs( 1 ); - aArgs[0] <<= xRoot; - uno::Reference< xml::sax::XDocumentHandler > xDocHandler - (mxFactory->createInstanceWithArguments - ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.input.SaxDocumentHandler")), - aArgs ), uno::UNO_QUERY ); - - if (! xDocHandler.is() ) - error( OUString(RTL_CONSTASCII_USTRINGPARAM("cannot find SAx handler for document type of:")) + aXMLName ); - - xParser->setDocumentHandler( xDocHandler ); - - xml::sax::InputSource source; - source.aInputStream = xStream; - source.sSystemId = OUString(RTL_CONSTASCII_USTRINGPARAM("virtual file")); - - try - { - xParser->parseStream( source ); - } - catch (const xml::sax::SAXParseException& e) - { - OUString c(RTL_CONSTASCII_USTRINGPARAM(":")); - error( aXMLName - + c + OUString::valueOf( e.LineNumber ) - + c + OUString::valueOf( e.ColumnNumber ) - + c + OUString(RTL_CONSTASCII_USTRINGPARAM("Sax parse error")) ); - } -} - -// XLayoutContainer -uno::Reference< awt::XLayoutContainer > LayoutRoot::getLayoutContainer() throw (uno::RuntimeException) -{ - return uno::Reference< awt::XLayoutContainer >(); -} - -// XNameAccess -uno::Any SAL_CALL LayoutRoot::getByName( const OUString &rName ) - throw ( container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - if ( mbDisposed ) - throw lang::DisposedException(); - - uno::Reference< awt::XLayoutConstrains > xItem; - ItemHash::iterator i = maItems.find( rName ); - if ( i != maItems.end() ) - xItem = i->second; - return uno::makeAny( xItem ); -} - -sal_Bool SAL_CALL LayoutRoot::hasByName( const OUString &rName ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( maMutex ); - if ( mbDisposed ) throw lang::DisposedException(); - - ItemHash::iterator i = maItems.find( rName ); - return i != maItems.end(); -} - -uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - if ( mbDisposed ) throw lang::DisposedException(); - - uno::Sequence< OUString > aNames( maItems.size() ); - sal_Int32 nPos = 0; - - for ( ItemHash::const_iterator it = maItems.begin(); - it != maItems.end(); ++it ) - aNames[ nPos++ ] = it->first; - - return aNames; -} - -uno::Type SAL_CALL LayoutRoot::getElementType() - throw ( uno::RuntimeException ) -{ - return getCppuType( ( const uno::Reference< awt::XLayoutConstrains >* )NULL ); -} - -sal_Bool SAL_CALL LayoutRoot::hasElements() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - - if ( mbDisposed ) throw lang::DisposedException(); - - return maItems.size() > 0; -} - -// XComponent -void SAL_CALL LayoutRoot::dispose() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - - if ( mbDisposed ) throw lang::DisposedException(); - - if ( mpListeners ) - { - - lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - mpListeners->disposeAndClear( aSource ); - delete mpListeners; - mpListeners = NULL; - } - - maItems.clear(); - mbDisposed = sal_True; -} - -void SAL_CALL LayoutRoot::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - - if ( mbDisposed ) throw lang::DisposedException(); - - if ( !mpListeners ) - mpListeners = new ::cppu::OInterfaceContainerHelper( maMutex ); - mpListeners->addInterface( xListener ); -} - -void SAL_CALL LayoutRoot::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( maMutex ); - - if ( mbDisposed ) throw lang::DisposedException(); - - if ( mpListeners ) - mpListeners->removeInterface( xListener ); -} - -// builder - -LayoutWidget *LayoutRoot::create( OUString id, const OUString unoName, long attrbs,uno::Reference< awt::XLayoutContainer > xParent ) -{ - LayoutWidget *pWidget = new LayoutWidget( mxToolkit, xParent, unoName, attrbs ); - if ( !mpToplevel ) - { - mpToplevel = pWidget; - mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY ); - mxContainer = pWidget->mxContainer; - } - if ( pWidget->mxContainer.is() ) - pWidget->mxContainer->setLayoutUnit( mxLayoutUnit ); - if ( id.getLength() ) - maItems[ id ] = pWidget->getPeer(); - return pWidget; -} - -LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit, - uno::Reference< awt::XLayoutContainer > xParent, - OUString unoName, long attrbs ) -{ - while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() ) - { - uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY ); - assert( xContainer.is() ); - xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); - } - - mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, attrbs ); - assert( mxWidget.is() ); - mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); -} - -LayoutWidget::~LayoutWidget() -{ - /* should we dispose of the references...? */ - // at least of its children... Or should root? -} - -bool LayoutWidget::addChild( LayoutWidget *pChild ) -{ - if ( !mxContainer.is() ) - return false; - - try - { - mxContainer->addChild( pChild->mxWidget ); - } - catch (const awt::MaxChildrenException&) - { - return false; - } - return true; -} - -void LayoutWidget::setProperties( PropList const& rProps ) -{ - ::layoutimpl::setProperties( mxWidget, rProps ); -} - -void LayoutWidget::setProperty( OUString const& attr, OUString const& value ) -{ - ::layoutimpl::setProperty( mxWidget, attr, value ); -} - -void LayoutWidget::setChildProperties( LayoutWidget *pChild, - PropList const& rProps ) -{ - uno::Reference< beans::XPropertySet > xChildPeer; - xChildPeer = mxContainer->getChildProperties( pChild->mxWidget ); - - if ( xChildPeer.is() ) - ::layoutimpl::setProperties( xChildPeer, rProps ); -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/root.hxx b/toolkit/source/layout/core/root.hxx deleted file mode 100644 index 8110529df183..000000000000 --- a/toolkit/source/layout/core/root.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_ROOT_HXX -#define LAYOUT_CORE_ROOT_HXX - -#define _BACKWARD_BACKWARD_WARNING_H 1 -#include <boost/unordered_map.hpp> - -#include <com/sun/star/awt/XLayoutRoot.hpp> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <toolkit/dllapi.h> - -#include <layout/core/proplist.hxx> - -namespace layoutimpl -{ - -namespace css = ::com::sun::star; - -css::uno::Reference< css::io::XInputStream > getFileAsStream( const rtl::OUString &rName ); - -/* Interface generation code -- to hook to a parser. */ - -/* - TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget - proxy interface (just make it return the root widget). Would even make it easier - if there was interest to support multiple toplevel widgets in the same file. - - We also need to make sure the code gets diposed well... There is no need to keep - these objects around after initialization... -*/ - - -class LayoutWidget; - -class TOOLKIT_DLLPUBLIC LayoutRoot : public ::cppu::WeakImplHelper3< - css::awt::XLayoutRoot, - css::lang::XInitialization, - css::lang::XComponent> -{ -protected: - ::osl::Mutex maMutex; - - typedef boost::unordered_map< rtl::OUString, - css::uno::Reference< css::awt::XLayoutConstrains >, - ::rtl::OUStringHash > ItemHash; - ItemHash maItems; - - sal_Bool mbDisposed; - css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory; - ::cppu::OInterfaceContainerHelper *mpListeners; - - css::uno::Reference< css::awt::XWindow > mxWindow; - css::uno::Reference< css::awt::XLayoutContainer > mxContainer; - - css::uno::Reference< css::awt::XToolkit > mxToolkit; - LayoutWidget *mpToplevel; - css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit; - - void error( rtl::OUString const& message ); - -public: - LayoutRoot( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); - virtual ~LayoutRoot(); - - void setWindow( css::uno::Reference< css::awt::XLayoutConstrains > xPeer ) - { - mxWindow = css::uno::Reference< css::awt::XWindow >( xPeer, css::uno::UNO_QUERY ); - } - - // get XLayoutContainer - virtual css::uno::Reference< css::awt::XLayoutContainer > SAL_CALL getLayoutContainer() throw (css::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException); - - // XNameAccess - virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException); - - // generator - virtual LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs, css::uno::Reference< css::awt::XLayoutContainer > xParent ); -}; - -class TOOLKIT_DLLPUBLIC LayoutWidget -{ - friend class LayoutRoot; - -public: - LayoutWidget() {} - LayoutWidget( css::uno::Reference< css::awt::XToolkit > xToolkit, - css::uno::Reference< css::awt::XLayoutContainer > xToplevel, - rtl::OUString unoName, long attrbs ); - virtual ~LayoutWidget(); - - virtual void setProperties( const PropList &rProps ); - virtual void setProperty( rtl::OUString const& attr, rtl::OUString const& value ); - - virtual bool addChild( LayoutWidget *pChild ); - virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps ); - - inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer() - { return mxWidget; } - inline css::uno::Reference< css::awt::XLayoutContainer > getContainer() - { return mxContainer; } - -protected: - css::uno::Reference< css::awt::XLayoutConstrains > mxWidget; - css::uno::Reference< css::awt::XLayoutContainer > mxContainer; -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_ROOT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/table.cxx b/toolkit/source/layout/core/table.cxx deleted file mode 100644 index 53faefff1271..000000000000 --- a/toolkit/source/layout/core/table.cxx +++ /dev/null @@ -1,314 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <table.hxx> - -#include <sal/macros.h> -#include <osl/mutex.hxx> -#include <cppuhelper/propshlp.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/awt/PosSize.hpp> -#include <tools/debug.hxx> - -// fixed point precision for distributing error -#define FIXED_PT 16 - -namespace layoutimpl -{ - -using namespace com::sun::star; - -Table::ChildProps::ChildProps( Table::ChildData *pData ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &( pData->mbExpand[ 0 ] ) ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ), - ::getCppuType( static_cast< const sal_Bool* >( NULL ) ), - &( pData->mbExpand[ 1 ] ) ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &( pData->mnColSpan ) ); - addProp( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &( pData->mnRowSpan ) ); -} - -bool Table::ChildData::isVisible() -{ - return Box_Base::ChildData::isVisible() - && ( mnColSpan > 0 ) && ( mnRowSpan > 0 ); -} - -Table::Table() - : Box_Base() - , mnColsLen( 1 )// another default value could be 0xffff for infinite columns( = 1 row ) -{ - addProp( RTL_CONSTASCII_USTRINGPARAM( "Columns" ), - ::getCppuType( static_cast< const sal_Int32* >( NULL ) ), - &mnColsLen ); -} - -Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild ) - : Box_Base::ChildData( xChild ) -// , mbExpand( { 1, 1 } ) - , mnColSpan( 1 ) - , mnRowSpan( 1 ) - , mnLeftCol( 0 ) - , mnRightCol( 0 ) - , mnTopRow( 0 ) - , mnBottomRow( 0 ) -{ - mbExpand[ 0 ] = 1; - mbExpand[ 1 ] = 1; -} - -Table::ChildData* -Table::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild ) -{ - return new ChildData( xChild ); -} - -Table::ChildProps* -Table::createChildProps( Box_Base::ChildData *pData ) -{ - return new ChildProps( static_cast<Table::ChildData*> ( pData ) ); -} - -void SAL_CALL -Table::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild ) - throw( uno::RuntimeException, awt::MaxChildrenException ) -{ - if ( xChild.is() ) - { - Box_Base::addChild( xChild ); - // cause of flicker - allocateChildAt( xChild, awt::Rectangle( 0,0,0,0 ) ); - } -} - -awt::Size SAL_CALL -Table::getMinimumSize() throw( uno::RuntimeException ) -{ - int nRowsLen = 0; - - // 1. layout the table -- adjust to cope with row-spans... - { - // temporary 1D representation of the table - std::vector< ChildData *> aTable; - - int col = 0; - int row = 0; - for ( std::list<Box_Base::ChildData *>::iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Table::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - - while ( col + SAL_MIN( child->mnColSpan, mnColsLen ) > mnColsLen ) - { - col = 0; - row++; - - unsigned int i = col +( row*mnColsLen ); - while ( aTable.size() > i && !aTable[ i ] ) - i++; - - col = i % mnColsLen; - row = i / mnColsLen; - } - - child->mnLeftCol = col; - child->mnRightCol = SAL_MIN( col + child->mnColSpan, mnColsLen ); - child->mnTopRow = row; - child->mnBottomRow = row + child->mnRowSpan; - - col += child->mnColSpan; - - unsigned int start = child->mnLeftCol +( child->mnTopRow*mnColsLen ); - unsigned int end =( child->mnRightCol-1 ) +( ( child->mnBottomRow-1 )*mnColsLen ); - if ( aTable.size() < end+1 ) - aTable.resize( end+1, NULL ); - for ( unsigned int i = start; i < end; i++ ) - aTable[ i ] = child; - - nRowsLen = SAL_MAX( nRowsLen, child->mnBottomRow ); - } - } - - // 2. calculate columns/rows sizes - for ( int g = 0; g < 2; g++ ) - { - std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows; - - aGroup.clear(); - aGroup.resize( g == 0 ? mnColsLen : nRowsLen ); - - // 2.1 base sizes on one-column/row children - for ( std::list<Box_Base::ChildData *>::iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Table::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow; - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow; - - if ( nFirstAttach == nLastAttach-1 ) - { - child->maRequisition = child->mxChild->getMinimumSize(); - int attach = nFirstAttach; - int child_size = g == 0 ? child->maRequisition.Width - : child->maRequisition.Height; - aGroup[ attach ].mnSize = SAL_MAX( aGroup[ attach ].mnSize, - child_size ); - if ( child->mbExpand[ g ] ) - aGroup[ attach ].mbExpand = true; - } - } - - // 2.2 make sure multiple-columns/rows children fit - for ( std::list<Box_Base::ChildData *>::iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Table::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow; - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow; - - if ( nFirstAttach != nLastAttach-1 ) - { - child->maRequisition = child->mxChild->getMinimumSize(); - int size = 0; - int expandables = 0; - for ( int i = nFirstAttach; i < nLastAttach; i++ ) - { - size += aGroup[ i ].mnSize; - if ( aGroup[ i ].mbExpand ) - expandables++; - } - - int child_size = g == 0 ? child->maRequisition.Width - : child->maRequisition.Height; - int extra = child_size - size; - if ( extra > 0 ) - { - if ( expandables ) - extra /= expandables; - else - extra /= nLastAttach - nFirstAttach; - - for ( int i = nFirstAttach; i < nLastAttach; i++ ) - if ( expandables == 0 || aGroup[ i ].mbExpand ) - aGroup[ i ].mnSize += extra; - } - } - } - } - - // 3. Sum everything up - mnColExpandables =( mnRowExpandables = 0 ); - maRequisition.Width =( maRequisition.Height = 0 ); - for ( std::vector<GroupData>::iterator it = maCols.begin(); - it != maCols.end(); ++it ) - { - maRequisition.Width += it->mnSize; - if ( it->mbExpand ) - mnColExpandables++; - } - for ( std::vector<GroupData>::iterator it = maRows.begin(); - it != maRows.end(); ++it ) - { - maRequisition.Height += it->mnSize; - if ( it->mbExpand ) - mnRowExpandables++; - } - - return maRequisition; -} - -void SAL_CALL -Table::allocateArea( const awt::Rectangle &rArea ) - throw( uno::RuntimeException ) -{ - maAllocation = rArea; - if ( maCols.size() == 0 || maRows.size() == 0 ) - return; - - int nExtraSize[ 2 ] = { SAL_MAX( rArea.Width - maRequisition.Width, 0 ), - SAL_MAX( rArea.Height - maRequisition.Height, 0 ) }; - // split it - nExtraSize[ 0 ] /= mnColExpandables ? mnColExpandables : mnColsLen; - nExtraSize[ 1 ] /= mnRowExpandables ? mnRowExpandables : maRows.size(); - - for ( std::list<Box_Base::ChildData *>::const_iterator it - = maChildren.begin(); it != maChildren.end(); ++it ) - { - ChildData *child = static_cast<Table::ChildData*> ( *it ); - if ( !child->isVisible() ) - continue; - - awt::Rectangle rChildArea( rArea.X, rArea.Y, 0, 0 ); - - for ( int g = 0; g < 2; g++ ) - { - std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows; - const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow; - const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow; - - for ( int i = 0; i < nFirstAttach; i++ ) - { - int gSize = aGroup[ i ].mnSize; - if ( aGroup[ i ].mbExpand ) - gSize += nExtraSize[ g ]; - if ( g == 0 ) - rChildArea.X += gSize; - else - rChildArea.Y += gSize; - } - for ( int i = nFirstAttach; i < nLastAttach; i++ ) - { - int gSize = aGroup[ i ].mnSize; - if ( aGroup[ i ].mbExpand ) - gSize += nExtraSize[ g ]; - if ( g == 0 ) - rChildArea.Width += gSize; - else - rChildArea.Height += gSize; - } - } - - allocateChildAt( child->mxChild, rChildArea ); - } -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/table.hxx b/toolkit/source/layout/core/table.hxx deleted file mode 100644 index 30e7f24540b7..000000000000 --- a/toolkit/source/layout/core/table.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_TABLE_HXX -#define LAYOUT_CORE_TABLE_HXX - -#include <layout/core/box-base.hxx> - -namespace layoutimpl -{ - -class Table : public Box_Base -{ -public: - // Children properties - struct ChildData : public Box_Base::ChildData - { - sal_Bool mbExpand[ 2 ]; - sal_Int32 mnColSpan; - sal_Int32 mnRowSpan; - int mnLeftCol; - int mnRightCol; - int mnTopRow; - int mnBottomRow; - - ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - bool isVisible(); - }; - - struct ChildProps : public Box_Base::ChildProps - { - ChildProps( ChildData *pData ); - }; - -protected: - - // a group of children; either a column or a row - struct GroupData - { - sal_Bool mbExpand; - int mnSize; // request size (width or height) - GroupData() : mbExpand( false ), mnSize( 0 ) {} - }; - - // Table properties - sal_Int32 mnColsLen; - std::vector< GroupData > maCols; - std::vector< GroupData > maRows; - int mnColExpandables, mnRowExpandables; - - ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); - ChildProps *createChildProps( Box_Base::ChildData* pData ); - -public: - Table(); - - // css::awt::XLayoutContainer - virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) - throw (css::uno::RuntimeException, css::awt::MaxChildrenException); - - virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) - throw (css::uno::RuntimeException); - - virtual css::awt::Size SAL_CALL getMinimumSize() - throw(css::uno::RuntimeException); - - // unimplemented: - virtual sal_Bool SAL_CALL hasHeightForWidth() - throw(css::uno::RuntimeException) - { return false; } - virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) - throw(css::uno::RuntimeException) - { return maRequisition.Height; } -}; - -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_TABLE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/timer.cxx b/toolkit/source/layout/core/timer.cxx deleted file mode 100644 index 279c0ea7f172..000000000000 --- a/toolkit/source/layout/core/timer.cxx +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "timer.hxx" - -#include <vector> -#include <list> -#include <vcl/timer.hxx> -#include <com/sun/star/awt/XLayoutContainer.hpp> - -namespace layoutimpl -{ -using namespace ::com::sun::star; - -class AllocateTimer : public Timer -{ - typedef std::list< uno::Reference< awt::XLayoutContainer > > ContainerList; - ContainerList mxContainers; - uno::Reference< awt::XLayoutContainer > mxLastAdded; - -public: - AllocateTimer() - { - // timer set to 0 -- just process it as soon as it gets idle - SetTimeout( 0 ); - } - - static inline bool isParentOf( uno::Reference< awt::XLayoutContainer > xParent, - uno::Reference< awt::XLayoutContainer > xWidget ) - { - while ( xWidget.is() ) - { - if ( xWidget == xParent ) - return true; - xWidget = uno::Reference< awt::XLayoutContainer >( xWidget->getParent(), uno::UNO_QUERY ); - } - return false; - } - - static inline void eraseChildren( ContainerList::iterator &it, ContainerList &list ) - { - ContainerList::iterator jt = list.begin(); - while ( jt != list.end() ) - { - if ( it != jt && isParentOf( *it, *jt ) ) - jt = list.erase( jt ); - else - ++jt; - } - } - - static inline bool isContainerDamaged( uno::Reference< awt::XLayoutContainer > xContainer ) - { - uno::Reference< awt::XLayoutConstrains > xConstrains( xContainer, uno::UNO_QUERY ); - awt::Size lastReq( xContainer->getRequestedSize() ); - awt::Size curReq( xConstrains->getMinimumSize() ); - return lastReq.Width != curReq.Width || lastReq.Height != curReq.Height; - } - - void add( const uno::Reference< awt::XLayoutContainer > &xContainer ) - { - // small optimization - if ( mxLastAdded == xContainer ) - return; - mxLastAdded = xContainer; - - mxContainers.push_back( xContainer ); - } - - virtual void Timeout() - { - mxLastAdded = uno::Reference< awt::XLayoutContainer >(); - - // 1. remove duplications and children - for ( ContainerList::iterator it = mxContainers.begin(); - it != mxContainers.end(); ++it ) - eraseChildren( it, mxContainers ); - - // 2. check damage extent - for ( ContainerList::iterator it = mxContainers.begin(); - it != mxContainers.end(); ++it ) - { - uno::Reference< awt::XLayoutContainer > xContainer = *it; - while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) ) - { - xContainer = uno::Reference< awt::XLayoutContainer >( - xContainer->getParent(), uno::UNO_QUERY ); - } - - if ( *it != xContainer ) - { - // 2.2 replace it with parent - *it = xContainer; - - // 2.3 remove children of new parent - eraseChildren( it, mxContainers ); - } - } - - // 3. force re-calculations - for ( ContainerList::iterator it = mxContainers.begin(); - it != mxContainers.end(); ++it ) - (*it)->allocateArea( (*it)->getAllocatedArea() ); - } -}; - -static void AddResizeTimeout( const uno::Reference< awt::XLayoutContainer > &xCont ) -{ - static AllocateTimer timer; - timer.add( xCont ); - timer.Start(); -} - -LayoutUnit::LayoutUnit() : LayoutUnit_Base() -{ -} - -void SAL_CALL LayoutUnit::queueResize( const uno::Reference< awt::XLayoutContainer > &xContainer ) - throw( uno::RuntimeException ) -{ - AddResizeTimeout( xContainer ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/timer.hxx b/toolkit/source/layout/core/timer.hxx deleted file mode 100644 index 8be521e634f3..000000000000 --- a/toolkit/source/layout/core/timer.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_TIMER_HXX -#define LAYOUT_CORE_TIMER_HXX - -#include <com/sun/star/awt/XLayoutUnit.hpp> -#include <cppuhelper/implbase1.hxx> - -namespace layoutimpl -{ - -typedef ::cppu::WeakImplHelper1< com::sun::star::awt::XLayoutUnit > LayoutUnit_Base; - -class LayoutUnit : public LayoutUnit_Base -{ -public: - LayoutUnit(); - void SAL_CALL queueResize( const com::sun::star::uno::Reference< com::sun::star::awt::XLayoutContainer > &xContainer ) - throw( com::sun::star::uno::RuntimeException ); -}; - -} - -#endif /* LAYOUT_CORE_TIMER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/translate.cxx b/toolkit/source/layout/core/translate.cxx deleted file mode 100644 index 8cff68364cfa..000000000000 --- a/toolkit/source/layout/core/translate.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "translate.hxx" - -#include <list> -#if TEST_LAYOUT -#include <cstdio> -#include "tools/getprocessworkingdir.hxx" -#endif - -#include <unotools/bootstrap.hxx> -#include <unotools/localfilehelper.hxx> -#include <unotools/ucbhelper.hxx> -#include <vcl/svapp.hxx> - -#include "proplist.hxx" - -namespace layoutimpl -{ -namespace css = ::com::sun::star; -using namespace css; -using ::rtl::OUString; -using ::utl::LocalFileHelper; -using ::utl::UCBContentHelper; -using ::utl::Bootstrap; - -static std::list<OUString> -getLocaleSubdirList( lang::Locale const& rLocale ) -{ - std::list<OUString> aSubdirs; - aSubdirs.push_front( OUString(RTL_CONSTASCII_USTRINGPARAM(".")) ); - aSubdirs.push_front( OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")) ); - if ( rLocale.Language.getLength() ) - aSubdirs.push_front( rLocale.Language ); - if ( rLocale.Country.getLength() ) - { - OUString aLocaleCountry = rLocale.Language - + OUString(RTL_CONSTASCII_USTRINGPARAM("-")) - + rLocale.Country; - aSubdirs.push_front( aLocaleCountry ); - if ( rLocale.Variant.getLength() ) - aSubdirs.push_front( aLocaleCountry - + OUString(RTL_CONSTASCII_USTRINGPARAM(".")) - + rLocale.Variant ); - } - return aSubdirs; -} - -static bool -fileExists( String const& aFile ) -{ - String aUrl; - LocalFileHelper::ConvertPhysicalNameToURL( aFile, aUrl ); - return UCBContentHelper::Exists( aUrl ); -} - -static OUString -getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs, - OUString const& aXMLName ) -{ - static OUString const aSlash(RTL_CONSTASCII_USTRINGPARAM("/")); - String aResult; - for ( std::list<OUString>::const_iterator i = aSubDirs.begin(); - i != aSubDirs.end(); ++i ) - { - String aFile = aDir + aSlash + *i + aSlash + aXMLName; - OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) ); - if ( fileExists( aFile ) ) - return aFile; - } - return OUString(); -} - -/* FIXME: IWBN to share code with impimagetree.cxx, also for reading - from zip files. */ -OUString -readRightTranslation( OUString const& aXMLName ) -{ - String aXMLFile; - std::list<OUString> aSubdirs - = getLocaleSubdirList( Application::GetSettings().GetUILocale() ); -#if TEST_LAYOUT // read from cwd first - OUString aCurrentWorkingUrl; - tools::getProcessWorkingDir( aCurrentWorkingUrl ); - String aCurrentWorkingDir; - LocalFileHelper::ConvertURLToPhysicalName( aCurrentWorkingUrl, aCurrentWorkingDir ); - aXMLFile = getFirstExisting( aCurrentWorkingDir, aSubdirs, aXMLName ); - if ( aXMLFile.Len() ) - ; - else -#endif /* TEST_LAYOUT */ - { - OUString aShareUrl; - Bootstrap::locateSharedData( aShareUrl ); - OUString aXMLUrl = aShareUrl + OUString(RTL_CONSTASCII_USTRINGPARAM("/layout")); - String aXMLDir; - LocalFileHelper::ConvertURLToPhysicalName( aXMLUrl, aXMLDir ); - aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName ); - } - - OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) ); - return aXMLFile; -} - -} // namespace layoutimpl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/translate.hxx b/toolkit/source/layout/core/translate.hxx deleted file mode 100644 index b20166252bd6..000000000000 --- a/toolkit/source/layout/core/translate.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_TRANSLATE_HXX -#define LAYOUT_CORE_TRANSLATE_HXX - -namespace rtl { -class OUString; -} // namespace rtl - -namespace layoutimpl -{ -::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName ); -} // namespace layoutimpl - -#endif /* LAYOUT_CORE_TRANSLATE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/vcl.cxx b/toolkit/source/layout/core/vcl.cxx deleted file mode 100644 index 2b9d2d3c4f5d..000000000000 --- a/toolkit/source/layout/core/vcl.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <vcl.hxx> - -#include <sal/types.h> -#include <vcl/button.hxx> - -static PushButton* get_button (Dialog const* dialog, sal_uInt32 type) -{ - Window* child = dialog->GetWindow (WINDOW_FIRSTCHILD); - while (child) - { - if (child->GetType () == type) - return static_cast <PushButton*> (child); - child = child->GetWindow (WINDOW_NEXT); - } - - return 0; -} - -#define IMPLEMENT_CLOSING_DIALOG(cls)\ - Closing##cls::Closing##cls (Window* parent, WinBits bits)\ - : cls (parent, bits)\ - , mClosing (false)\ - {\ - }\ - sal_Bool Closing##cls::Close ()\ - {\ - if (mClosing)\ - EndDialog (false);\ - else if (PushButton *cancel = get_button (this, WINDOW_CANCELBUTTON))\ - cancel->Click ();\ - else if (PushButton *ok = get_button (this, WINDOW_OKBUTTON))\ - ok->Click ();\ - mClosing = true;\ - return false;\ - } - -IMPLEMENT_CLOSING_DIALOG (Dialog); -IMPLEMENT_CLOSING_DIALOG (ModelessDialog); -IMPLEMENT_CLOSING_DIALOG (ModalDialog); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/core/vcl.hxx b/toolkit/source/layout/core/vcl.hxx deleted file mode 100644 index bcf6cfb700f1..000000000000 --- a/toolkit/source/layout/core/vcl.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_CORE_VCL_HXX -#define LAYOUT_CORE_VCL_HXX - -#include <vcl/dialog.hxx> - -#define DECLARE_CLOSING_DIALOG(cls)\ - class Closing##cls : public cls\ - {\ - public:\ - bool mClosing;\ - Closing##cls (Window* parent, WinBits bits);\ - virtual sal_Bool Close ();\ - } - -DECLARE_CLOSING_DIALOG (Dialog); -DECLARE_CLOSING_DIALOG (ModalDialog); -DECLARE_CLOSING_DIALOG (ModelessDialog); - -#undef DECLARE_CLOSING_DIALOG - -#endif /* LAYOUT_CORE_VCL_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx deleted file mode 100644 index 0cb855192f2f..000000000000 --- a/toolkit/source/layout/vcl/wbutton.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "wrapper.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/XActionListener.hpp> -#include <com/sun/star/awt/XButton.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <cppuhelper/implbase1.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/awt/vclxwindows.hxx> -#include <toolkit/helper/convert.hxx> -#include <vcl/button.hxx> -#include <vcl/event.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <vcl/window.hxx> - -#include <list> - -#include <layout/core/helper.hxx> - -using namespace ::com::sun::star; - -using rtl::OUString; - -namespace layout -{ - -class ImageImpl -{ - public: - uno::Reference< graphic::XGraphic > mxGraphic; - ImageImpl( const char *pName ) - : mxGraphic( layoutimpl::loadGraphic( pName ) ) - { - if ( !mxGraphic.is() ) - { - OSL_TRACE( "ERROR: failed to load image: `%s'", pName ); - } - } -}; - -class ButtonImpl : public ControlImpl - , public ::cppu::WeakImplHelper1< awt::XActionListener > -{ - Link maClickHdl; - -public: - uno::Reference< awt::XButton > mxButton; - ButtonImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - , mxButton( peer, uno::UNO_QUERY ) - { - /* We have default action when clicked, always listen. */ - mxButton->addActionListener( this ); - } - - ~ButtonImpl() - { - } - - virtual void Click() { /* make me pure virtual? */ }; - - Link& GetClickHdl () - { - return maClickHdl; - } - - virtual void SetClickHdl( Link const& link ) - { - maClickHdl = link; - } - - void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - mxButton->removeActionListener( this ); - ControlImpl::disposing (e); - mxButton.clear (); - } - - virtual void SAL_CALL actionPerformed( const awt::ActionEvent& ) - throw (uno::RuntimeException) - { - if ( !maClickHdl ) - Click(); - else - maClickHdl.Call( static_cast<Window *>( mpWindow ) ); - } - - bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph ) - { - setProperty( "Graphic", uno::Any( xGraph ) ); - return true; - } -}; - -Button::~Button () -{ -} - -String Button::GetStandardText (sal_uInt16 button_type) -{ - return ::Button::GetStandardText (button_type); -} - -void Button::SetText( OUString const& rStr ) -{ - if ( !getImpl().mxButton.is() ) - return; - getImpl().mxButton->setLabel( rStr ); -} - -void Button::Click() -{ -} - -IMPL_GET_IMPL( Button ); - -class PushButtonImpl : public ButtonImpl - , public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maToggleHdl; -public: - PushButtonImpl( Context *context, const PeerHandle &peer, Window *window ) - : ButtonImpl( context, peer, window ) - { - } - - void SetToggleHdl( const Link& link ) - { - // XButton doesn't have an explicit event for Toggle. Anyway, it is a - // superset of the clicks: all clicks, and explicit toggles - if (!link && !!maToggleHdl) - mxButton->removeActionListener( this ); - else if (!!link && !maToggleHdl) - mxButton->addActionListener( this ); - maToggleHdl = link; - } - void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - ButtonImpl::disposing (e); - } - virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e ) - throw (uno::RuntimeException) - { - ButtonImpl::actionPerformed( e ); - fireToggle(); - } - virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) - throw (uno::RuntimeException) - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } - void fireToggle() - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } - -}; - -PushButton::~PushButton () -{ - SetToggleHdl (Link ()); -} - -void PushButton::SetToggleHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxButton.is ()) - getImpl().SetToggleHdl( link ); -} - -IMPL_GET_IMPL( PushButton ); - -#define BUTTON_IMPL(t, parent, response) \ - class t##Impl : public parent##Impl \ - { \ - public: \ - t##Impl( Context *context, PeerHandle const& peer, Window *window ) \ - : parent##Impl( context, peer, window ) \ - { \ - } \ - void Click() \ - { \ - if (Dialog *d = static_cast<Dialog *> (mpCtx)) \ - d->EndDialog( response ); \ - } \ - } - -/* Common button types currently unavailable in OOo: */ -/* mpReset */ -/* mpApply */ -/* mpAction */ -#define RET_RESET 6 -#define RET_APPLY 7 -#define BUTTONID_RESET RET_RESET -#define BUTTONID_APPLY RET_APPLY - -BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL ); -BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES ); -BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO ); -BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY ); -BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE ); -BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP ); - -CancelButton::CancelButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new CancelButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -YesButton::YesButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new YesButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -NoButton::NoButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new NoButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -RetryButton::RetryButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new RetryButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -IgnoreButton::IgnoreButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new IgnoreButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -HelpButton::HelpButton ( Context *context, char const* pId, sal_uInt32 nId ) - : PushButton( new HelpButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -} // namespace layout - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wfield.cxx b/toolkit/source/layout/vcl/wfield.cxx deleted file mode 100644 index 78b4484c2298..000000000000 --- a/toolkit/source/layout/vcl/wfield.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "wrapper.hxx" - -#include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/XMetricField.hpp> -#include <com/sun/star/awt/XNumericField.hpp> -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/awt/XListBox.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/awt/XActionListener.hpp> -#include <com/sun/star/awt/XItemListener.hpp> -#include <com/sun/star/awt/XMouseListener.hpp> -#include <vcl/combobox.hxx> -#include <vcl/lstbox.hxx> - -#include <toolkit/awt/vclxwindows.hxx> - -using namespace ::com::sun::star; -using rtl::OUString; - -#define LAYOUT_API_CALLS_HANDLER 0 - -namespace layout -{ - -class EditImpl : public ControlImpl - , public ::cppu::WeakImplHelper1< awt::XTextListener > -{ -public: - Link maModifyHdl; - - uno::Reference< awt::XTextComponent > mxEdit; - EditImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - , mxEdit( peer, uno::UNO_QUERY ) - { - } - - ~EditImpl (); - - virtual void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException); - - virtual void SetModifyHdl( Link const& link ); - - void SAL_CALL textChanged( const awt::TextEvent& /* rEvent */ ) - throw (uno::RuntimeException) - { - maModifyHdl.Call( mpWindow ); - } -}; - -EditImpl::~EditImpl () -{ -} - -void SAL_CALL EditImpl::disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) -{ - ControlImpl::disposing (e); - mxEdit.clear (); -} - -void EditImpl::SetModifyHdl( Link const& link ) -{ - if (!link && !!maModifyHdl) - mxEdit->removeTextListener( this ); - else if (!!link && !maModifyHdl) - mxEdit->addTextListener( this ); - maModifyHdl = link; -} - -Edit::~Edit () -{ - SetModifyHdl (Link ()); -} - -void Edit::SetModifyHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxEdit.is ()) - getImpl().SetModifyHdl( link ); -} - -IMPL_GET_IMPL( Edit ); - -class ListBoxImpl : public ControlImpl - , public ::cppu::WeakImplHelper1< awt::XActionListener > - , public ::cppu::WeakImplHelper1< awt::XItemListener > - , public ::cppu::WeakImplHelper1< awt::XMouseListener > -{ - Link maClickHdl; - Link maSelectHdl; - Link maDoubleClickHdl; - -public: - uno::Reference< awt::XListBox > mxListBox; - ListBoxImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - , mxListBox( peer, uno::UNO_QUERY ) - { - SelectEntryPos (0, true); - } - - sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos) - { - if ( nPos == LISTBOX_APPEND ) - nPos = mxListBox->getItemCount(); - mxListBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - void RemoveEntry( sal_uInt16 nPos ) - { - mxListBox->removeItems( nPos, 1 ); - } - - sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos) - { - if ( nPos == LISTBOX_APPEND ) - nPos = mxListBox->getItemCount(); - mxListBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - sal_uInt16 GetEntryPos( String const& rStr ) const - { - uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() ); - rtl::OUString rKey( rStr ); - sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength()); - for (sal_uInt16 i = 0; i < n; i++) - { - if ( aItems[ i ] == rKey ) - return i; - } - return LISTBOX_ENTRY_NOTFOUND; - } - - OUString GetEntry( sal_uInt16 nPos ) const - { - return mxListBox->getItem( nPos ); - } - - sal_uInt16 GetEntryCount() const - { - return mxListBox->getItemCount(); - } - - void SelectEntryPos( sal_uInt16 nPos, bool bSelect ) - { - mxListBox->selectItemPos( nPos, bSelect ); - } - - sal_uInt16 GetSelectEntryCount() const - { - return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() ); - } - - sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const - { - sal_uInt16 nSelected = 0; - if ( mxListBox->isMutipleMode() ) - { - uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() ); - if ( nSelIndex < aItems.getLength() ) - nSelected = aItems[ nSelIndex ]; - } - else - nSelected = mxListBox->getSelectedItemPos(); - return nSelected; - } - - virtual void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - ControlImpl::disposing (e); - mxListBox.clear (); - } - - Link& GetClickHdl () - { - return maClickHdl; - } - - void SetClickHdl( Link const& link ) - { - if (!link && !!maClickHdl) - mxListBox->removeActionListener( this ); - else if (!!link && !maClickHdl) - mxListBox->addActionListener( this ); - maClickHdl = link; - } - - void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ ) - throw (uno::RuntimeException) - { - maClickHdl.Call( mpWindow ); - } - - Link& GetSelectHdl () - { - return maSelectHdl; - } - - void SetSelectHdl( Link const& link ) - { - if (!link && !!maSelectHdl) - mxListBox->removeItemListener( this ); - else if (!!link && !maSelectHdl) - mxListBox->addItemListener( this ); - maSelectHdl = link; - } - - void SAL_CALL itemStateChanged (awt::ItemEvent const&) - throw (uno::RuntimeException) - { - maSelectHdl.Call (static_cast <ListBox*> (mpWindow)); - } - - Link& GetDoubleClickHdl () - { - return maDoubleClickHdl; - } - - void SetDoubleClickHdl (Link const& link) - { - if (!link && !!maDoubleClickHdl) - mxWindow->removeMouseListener (this); - else if (!!link && !maSelectHdl) - mxWindow->addMouseListener (this); - maDoubleClickHdl = link; - } - - void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException) - { - } - void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException) - { - if (e.ClickCount == 2) - maDoubleClickHdl.Call (mpWindow); - } - void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException) - { - } - void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException) - { - } -}; - -ListBox::~ListBox () -{ -} - -void ListBox::SetNoSelection () -{ - GetListBox ()->SetNoSelection (); -} - -IMPL_GET_IMPL (ListBox); -IMPL_GET_WINDOW (ListBox); - -} // namespace layout - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wrapper.cxx b/toolkit/source/layout/vcl/wrapper.cxx deleted file mode 100644 index 8e437bc874ad..000000000000 --- a/toolkit/source/layout/vcl/wrapper.cxx +++ /dev/null @@ -1,909 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/rc.h> -//#define RESOURCE_PUBLISH_PROTECTED 1 -#if RESOURCE_PUBLISH_PROTECTED -// ugh, override non-helpful proctection -#define protected public -#endif /* RESOURCE_PUBLISH_PROTECTED */ -#include <tools/rc.hxx> -#undef protected - - -#include "wrapper.hxx" - -#include <awt/vclxplugin.hxx> -#include <awt/vclxtabcontrol.hxx> -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <com/sun/star/awt/WindowAttribute.hpp> -#include <com/sun/star/awt/XDialog2.hpp> -#include <com/sun/star/awt/XProgressBar.hpp> -#include <com/sun/star/awt/XSimpleTabController.hpp> -#include <com/sun/star/awt/XTabListener.hpp> -#include <com/sun/star/graphic/XGraphic.hpp> -#include <comphelper/processfactory.hxx> -#include <layout/core/factory.hxx> -#include <layout/core/localized-string.hxx> -#include <layout/core/root.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <vcl/ctrl.hxx> -#include <vcl/dialog.hxx> -#include <vcl/image.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/window.hxx> - -using namespace ::com::sun::star; -using rtl::OUString; - -namespace layout -{ - -// Context bits ... -class ContextImpl -{ - uno::Reference< awt::XLayoutRoot > mxRoot; - uno::Reference< container::XNameAccess > mxNameAccess; - PeerHandle mxTopLevel; - -public: - ContextImpl( char const *pPath ) - { - uno::Sequence< uno::Any > aParams( 1 ); - aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 ); - - uno::Reference< lang::XSingleServiceFactory > xFactory( - comphelper::createProcessComponent( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Layout")) ), - uno::UNO_QUERY ); - if ( !xFactory.is() ) - { - throw uno::RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ), - uno::Reference< uno::XInterface >() ); - } - mxRoot = uno::Reference< awt::XLayoutRoot >( - xFactory->createInstanceWithArguments( aParams ), - uno::UNO_QUERY ); - - mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY ); - } - - ~ContextImpl() - { - } - - PeerHandle getByName( const OUString &rName ) - { - uno::Any val = mxNameAccess->getByName( rName ); - PeerHandle xRet; - val >>= xRet; - return xRet; - } - PeerHandle getTopLevel() - { - return mxTopLevel; - } - void setTopLevel( PeerHandle xToplevel ) - { - mxTopLevel = xToplevel; - } -}; - -Context::Context( const char *pPath ) - : pImpl( new ContextImpl( pPath ) ) -{ -} -Context::~Context() -{ - delete pImpl; - pImpl = NULL; -} - -PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const -{ - PeerHandle xHandle; - xHandle = pImpl->getByName( OUString( id, strlen( id ), RTL_TEXTENCODING_UTF8 ) ); - if ( !xHandle.is() ) - { - OSL_TRACE( "Failed to fetch widget '%s'", id ); - } - - if ( nId != 0 ) - { - rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId ); - xHandle = GetPeerHandle( aStr.getStr(), 0 ); - } - return xHandle; -} - -WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window) - : mpWindow (window) - , mpCtx (context) - , mxWindow (peer, uno::UNO_QUERY) - , mxVclPeer (peer, uno::UNO_QUERY) - , mvclWindow (0) - , bFirstTimeVisible (true) -{ -} - -WindowImpl::~WindowImpl () -{ - if (mpWindow) - mpWindow->mpImpl = 0; - if (mvclWindow) - { - VCLXWindow *v = mvclWindow->GetWindowPeer (); - v->SetWindow (0); - mvclWindow->SetComponentInterface (uno::Reference <awt::XWindowPeer> ()); - mvclWindow->SetWindowPeer (uno::Reference <awt::XWindowPeer> (), 0); - delete mvclWindow; - mvclWindow = 0; - } -} - -void WindowImpl::wrapperGone () -{ - mvclWindow = 0; - mpWindow->mpImpl = 0; - mpWindow = 0; - mpCtx = 0; - if ( mxWindow.is() ) - { - uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY ); - mxWindow.clear (); - if ( xComp.is() ) - xComp->dispose(); - } -} - -void SAL_CALL WindowImpl::disposing (lang::EventObject const&) - throw (uno::RuntimeException) -{ - if (mxWindow.is ()) - mxWindow.clear (); -} - -void WindowImpl::setProperty (char const *name, uno::Any any) -{ - if ( !this || !mxVclPeer.is() ) - return; - mxVclPeer->setProperty - ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any ); -} - -void WindowImpl::redraw (bool resize) -{ - uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY); - ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow (); - ::Window* parent = window->GetParent(); - ::Rectangle r = Rectangle (parent->GetPosPixel (), - parent->GetSizePixel ()); - parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN ); - if (resize) - parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE); - else - parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop, - awt::PosSize::SIZE); -} - -Window::Window( WindowImpl *pImpl ) - : mpImpl( pImpl ) -{ - mpImpl->mvclWindow = GetVCLXWindow () ? GetWindow () : 0; -} - -Window::~Window() -{ - /* likely to be an UNO object - with floating references */ - if (mpImpl) - mpImpl->wrapperGone (); - mpImpl = 0; -} - -///IMPL_GET_IMPL( Control ); - -static ControlImpl* null_control_impl = 0; - -ControlImpl &Control::getImpl () const -{ - if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl)) - return *c; - return *null_control_impl; -} - -Control::~Control () -{ - SetGetFocusHdl (Link ()); - SetLoseFocusHdl (Link ()); -} - -void Window::setRes (ResId const& res) -{ -#if RESOURCE_PUBLISH_PROTECTED - // Resources are shut-off from use. Is that really necessary? - Resource &r = *GetWindow (); - r.GetRes (res); -#else /* !RESOURCE_PUBLISH_PROTECTED */ - //We *must* derive. Is this also really necessary? - //Resource r (res); - - // ugh, I wonder which solution is cleaner... - class Resource_open_up : public Resource - { - public: - Resource_open_up (ResId const& r) - : Resource (r) - { - } - static sal_Int32 GetLongRes (void *p) - { - return Resource::GetLongRes (p); - } - void* GetClassRes () - { - return Resource::GetClassRes (); - } - sal_Int32 ReadLongRes () - { - return Resource::ReadLongRes (); - } - UniString ReadStringRes () - { - return Resource::ReadStringRes (); - } - rtl::OString ReadByteStringRes() - { - return Resource::ReadByteStringRes(); - } - }; - - Resource_open_up r (res); -#endif /* !RESOURCE_PUBLISH_PROTECTED */ - sal_uInt32 mask = r.ReadLongRes (); - if (mask & WINDOW_HELPID) - SetHelpId (r.ReadByteStringRes()); - if ( mask & WINDOW_TEXT ) - SetText( r.ReadStringRes ()); -} - -void Window::SetParent( ::Window *parent ) -{ - uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY ); - if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref )) - if (::Window *window = vcl->GetWindow()) - window->SetParent( parent ); -} - -void Window::SetParent( Window *parent ) -{ - /* Let's hear it for C++: poor man's dynamic binding. */ - parent->ParentSet (this); -} - -void Window::ParentSet (Window *window) -{ - window->SetParent (GetWindow ()); -} - -PeerHandle Window::GetPeer() const -{ - if ( !mpImpl ) - return PeerHandle(); - return mpImpl->mxWindow; -} - -uno::Reference<awt::XWindow> Window::GetRef() const -{ - return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ); -} - -VCLXWindow* Window::GetVCLXWindow() const -{ - return VCLXWindow::GetImplementation( GetRef() ); -} - -::Window* Window::GetWindow() const -{ - return GetVCLXWindow()->GetWindow(); -} - -::Window* Window::GetParent() const -{ - return GetWindow()->GetParent(); -} - -void Window::SetHelpId( const rtl::OString& id ) -{ - GetWindow()->SetHelpId( id ); -} - -void Window::Invalidate (sal_uInt8 flags) -{ - GetWindow ()->Invalidate (flags); -} - -struct ToolkitVclPropsMap -{ - WinBits vclStyle; - long initAttr; - const char *propName; - - // the value to give the prop to enable/disable it -- not the most brilliant - // type declaration and storage, but does the work... properties are - // either a boolean or a short since they are either a directly wrappers for - // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER). - bool isBoolean; - short enableProp, disableProp; -}; - -#define TYPE_BOOL true -#define TYPE_SHORT false -#define NOTYPE 0 -static const ToolkitVclPropsMap toolkitVclPropsMap[] = -{ - { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 }, - { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 }, - { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 }, - { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 }, - { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 }, - - { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 }, - { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 }, - { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 }, - { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 }, - { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 }, - { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 }, - { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 }, - { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 }, - { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 }, - { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 }, - { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 }, - { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 }, - - { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 }, - { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 }, - { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 }, - { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 }, - { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 }, - { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 }, - { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 }, - { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 }, - - { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 }, - { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 }, - - { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 }, - { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 }, - { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 }, - { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 }, - { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 }, -}; -#undef TYPE_BOOL -#undef TYPE_SHORT -#undef NOTYPE - -static const int toolkitVclPropsMapLen = - sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap ); - -/* Unpleasant way to get an xToolkit pointer ... */ -uno::Reference< awt::XToolkit > getToolkit() -{ - static uno::Reference< awt::XToolkit > xToolkit; - if (!xToolkit.is()) - { - // Urgh ... - xToolkit = uno::Reference< awt::XToolkit >( - ::comphelper::getProcessServiceFactory()->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), - uno::UNO_QUERY ); - if ( !xToolkit.is() ) - throw uno::RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ), - uno::Reference< uno::XInterface >() ); - } - return xToolkit; -} - -void Window::Show( bool bVisible ) -{ - if ( !getImpl().mxWindow.is() ) - return; - getImpl().mxWindow->setVisible( bVisible ); - if (!bVisible) - getImpl ().bFirstTimeVisible = true; - else if (GetParent() && getImpl().bFirstTimeVisible) - { - getImpl().redraw (); - getImpl().bFirstTimeVisible = false; - } -} - -void Window::SetText( OUString const& str ) -{ - GetWindow()->SetText( str ); -} - -ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window) - : WindowImpl( context, peer, window ) -{ -} - -ControlImpl::~ControlImpl () -{ - if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ()) - /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear() - don't do it twice */ - mxWindow.clear (); -} - -void ControlImpl::SetGetFocusHdl (Link const& link) -{ - if (!mLoseFocusHdl || !link) - UpdateListening (link); - mGetFocusHdl = link; -} - -void ControlImpl::SetLoseFocusHdl (Link const& link) -{ - if (!mGetFocusHdl || !link) - UpdateListening (link); - mLoseFocusHdl = link; -} - -void ControlImpl::UpdateListening (Link const& link) -{ - if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl) - && (!mGetFocusHdl || !mLoseFocusHdl)) - mxWindow->removeFocusListener (this); - else if (!!link && !mGetFocusHdl && !mLoseFocusHdl) - mxWindow->addFocusListener (this); -} - -void SAL_CALL ControlImpl::disposing (lang::EventObject const&) - throw (uno::RuntimeException) -{ -/// mxWindow.clear (); -} - -void SAL_CALL ControlImpl::focusGained (awt::FocusEvent const&) - throw (uno::RuntimeException) -{ - mGetFocusHdl.Call (mpWindow); -} - -void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&) - throw (uno::RuntimeException) -{ - mLoseFocusHdl.Call (mpWindow); -} - -void Control::SetGetFocusHdl (Link const& link) -{ - if (&getImpl () && getImpl().mxWindow.is ()) - getImpl ().SetGetFocusHdl (link); -} - -void Control::SetLoseFocusHdl (Link const& link) -{ - if (&getImpl () && getImpl().mxWindow.is ()) - getImpl ().SetLoseFocusHdl (link); -} - -class DialogImpl : public WindowImpl -{ -public: - uno::Reference< awt::XDialog2 > mxDialog; - DialogImpl( Context *context, PeerHandle const &peer, Window *window ); -}; - -DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window ) - : WindowImpl( context, peer, window ) - , mxDialog( peer, uno::UNO_QUERY ) -{ -} - -Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId ) - : Context( xml_file ) - , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) ) -{ - if ( parent ) - SetParent( parent ); -} - -Dialog::~Dialog () -{ -} - -IMPL_GET_IMPL (Dialog); - -#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog -#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog - -short Dialog::Execute() -{ - RETURN_MX_DIALOG->execute (); - return -1; -} - -void Dialog::EndDialog( long result ) -{ - MX_DIALOG->endDialog (result); -} - -void Dialog::SetTitle( OUString const& str ) -{ - MX_DIALOG->setTitle (str); -} - -#define MESSAGE_BOX_MEMBER_INIT\ - Dialog (parent, xml_file, id)\ - , imageError (this, "FI_ERROR")\ - , imageInfo (this, "FI_INFO")\ - , imageQuery (this, "FI_QUERY")\ - , imageWarning (this, "FI_WARNING")\ - , messageText (this, "FT_MESSAGE")\ - , cancelButton (this, "BTN_CANCEL")\ - , helpButton (this, "BTN_HELP")\ - , ignoreButton (this, "BTN_IGNORE")\ - , noButton (this, "BTN_NO")\ - , retryButton (this, "BTN_RETRY")\ - , yesButton (this, "BTN_YES") - -MessageBox::MessageBox (::Window *parent, char const* message, - char const* yes, char const* no, const rtl::OString& help_id, - char const* xml_file, char const* id) - : MESSAGE_BOX_MEMBER_INIT -{ - ignoreButton.Hide (); - retryButton.Hide (); - init (message, yes, no, help_id); -} - -MessageBox::MessageBox (::Window *parent, OUString const& message, - OUString yes, OUString no, const rtl::OString& help_id, - char const* xml_file, char const* id) - : MESSAGE_BOX_MEMBER_INIT -{ - ignoreButton.Hide (); - retryButton.Hide (); - init (message, yes, no, help_id); -} - -#if !defined (__GNUC__) -#define __PRETTY_FUNCTION__ __FUNCTION__ -#endif /* !__GNUC__ */ - -MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message, - char const* yes, char const* no, const rtl::OString& help_id, - char const* xml_file, char const* id) - : MESSAGE_BOX_MEMBER_INIT -{ - // HIG suggests using verbs instead of yes/no/retry etc. - // This constructor provides client-code compatibility: Client code should be fixed. -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__); -#endif - bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id); -} - -MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message, - OUString yes, OUString no, const rtl::OString& help_id, - char const* xml_file, char const* id) - : MESSAGE_BOX_MEMBER_INIT -{ - // HIG suggests using verbs instead of yes/no/retry etc. - // This constructor provides client-code compatibility: Client code should be fixed. -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__); -#endif - bits_init (bits, message, yes, no, help_id); -} - -void MessageBox::bits_init (WinBits bits, OUString const& message, - OUString yes, OUString no, const rtl::OString& help_id) -{ - if ( bits & ( WB_OK_CANCEL | WB_OK )) - yes = Button::GetStandardText ( BUTTON_OK ); - if ( bits & (WB_YES_NO | WB_YES_NO_CANCEL )) - { - yes = Button::GetStandardText ( BUTTON_YES ); - no = Button::GetStandardText ( BUTTON_NO ); - } - if (! (bits & (WB_RETRY_CANCEL | WB_YES_NO_CANCEL | WB_ABORT_RETRY_IGNORE ))) - cancelButton.Hide (); - if (! (bits & (WB_RETRY_CANCEL | WB_ABORT_RETRY_IGNORE))) - retryButton.Hide (); - if ( bits & WB_ABORT_RETRY_IGNORE ) - cancelButton.SetText ( Button::GetStandardText (BUTTON_ABORT)); - else - ignoreButton.Hide (); - if ( !(bits & ( WB_OK | WB_OK_CANCEL | WB_YES_NO | WB_YES_NO_CANCEL))) - yesButton.Hide (); - if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL))) - noButton.Hide (); - - init (message, yes, no, help_id); -} - -void MessageBox::init (char const* message, char const* yes, char const* no, const rtl::OString& help_id) -{ - init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id); -} - -void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, const rtl::OString& help_id) -{ - imageError.Hide (); - imageInfo.Hide (); - imageQuery.Hide (); - imageWarning.Hide (); - if (message.getLength ()) - messageText.SetText (message); - if (yes.getLength ()) - { - yesButton.SetText (yes); - if (yes != OUString (Button::GetStandardText (BUTTON_OK)) - && yes != OUString (Button::GetStandardText (BUTTON_YES))) - SetTitle (yes); - if (no.getLength ()) - noButton.SetText (no); - else - noButton.Hide (); - } - if (help_id.getLength() != 0) - SetHelpId (help_id); - else - helpButton.Hide (); -} - -class TabControlImpl - : public ControlImpl - , public ::cppu::WeakImplHelper1 <awt::XTabListener> -{ - Link mActivatePageHdl; - Link mDeactivatePageHdl; - -public: - uno::Reference <awt::XSimpleTabController> mxTabControl; - TabControlImpl (Context *context, const PeerHandle &peer, Window *window) - : ControlImpl (context, peer, window) - , mxTabControl (peer, uno::UNO_QUERY) - { - } - - virtual void SAL_CALL disposing (lang::EventObject const& e) - throw (uno::RuntimeException) - { - ControlImpl::disposing (e); - mxTabControl.clear (); - } - - void SetActivatePageHdl (Link const& link) - { - if (!mDeactivatePageHdl || !link) - UpdateListening (link); - mActivatePageHdl = link; - } - - void SetDeactivatePageHdl (Link const& link) - { - if (!mActivatePageHdl || !link) - UpdateListening (link); - mDeactivatePageHdl = link; - } - - void UpdateListening (Link const& link) - { - if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl)) - mxTabControl->removeTabListener (this); - else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl) - mxTabControl->addTabListener (this); - } - - void SAL_CALL activated (sal_Int32) - throw (uno::RuntimeException) - { - mActivatePageHdl.Call (mpWindow); - } - - void SAL_CALL deactivated (sal_Int32) - throw (uno::RuntimeException) - { - mDeactivatePageHdl.Call (mpWindow); - } - - void SAL_CALL inserted (sal_Int32) - throw (uno::RuntimeException) - { - } - - void SAL_CALL removed (sal_Int32) - throw (uno::RuntimeException) - { - } - - void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&) - throw (uno::RuntimeException) - { - } -}; - -IMPL_GET_WINDOW (TabControl); - -#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl -#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl - -TabControl::~TabControl () -{ - SetActivatePageHdl (Link ()); - SetDeactivatePageHdl (Link ()); -} - -void TabControl::SetActivatePageHdl (Link const& link) -{ - if (&getImpl () && getImpl().mxTabControl.is ()) - getImpl ().SetActivatePageHdl (link); -} -void TabControl::SetDeactivatePageHdl (Link const& link) -{ - if (&getImpl () && getImpl().mxTabControl.is ()) - getImpl ().SetDeactivatePageHdl (link); -} - -IMPL_GET_IMPL (TabControl); - -class TabPageImpl : public WindowImpl -{ -public: - uno::Reference< awt::XWindow > mxTabPage; - TabPageImpl( Context *context, const PeerHandle &peer, Window *window ) - : WindowImpl( context, peer, window ) - , mxTabPage( peer, uno::UNO_QUERY ) - { - } -}; - -::Window* TabPage::global_parent = 0; -TabControl* TabPage::global_tabcontrol = 0; - -IMPL_GET_IMPL( TabPage ); - -TabPage::~TabPage() -{ - delete GetTabPage(); -} - -IMPL_GET_WINDOW( TabPage ); - -void TabPage::ActivatePage() -{ -} - -void TabPage::DeactivatePage() -{ -} - -class FixedTextImpl : public ControlImpl -{ -public: - uno::Reference< awt::XFixedText > mxFixedText; - FixedTextImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - , mxFixedText( peer, uno::UNO_QUERY ) - { - } - - ~FixedTextImpl (); - - virtual void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException); -}; - -FixedTextImpl::~FixedTextImpl () -{ -} - -void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) -{ - ControlImpl::disposing (e); - mxFixedText.clear (); -} - -FixedText::FixedText ( Context *context, char const* pId, sal_uInt32 nId ) - : Control( new FixedTextImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -FixedText::~FixedText () -{ -} - -IMPL_GET_IMPL( FixedText ); - -void FixedText::SetText( OUString const& rStr ) -{ - if ( !getImpl().mxFixedText.is() ) - return; - getImpl().mxFixedText->setText( rStr ); -} - -class ProgressBarImpl : public ControlImpl -{ -public: - uno::Reference< awt::XProgressBar > mxProgressBar; - ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - , mxProgressBar( peer, uno::UNO_QUERY ) - { - } - - virtual void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - ControlImpl::disposing (e); - mxProgressBar.clear (); - } -}; - - -class FixedImageImpl: public ControlImpl -{ -public: - uno::Reference< graphic::XGraphic > mxGraphic; - FixedImageImpl( Context *context, const PeerHandle &peer, Window *window) - : ControlImpl( context, peer, window ) - , mxGraphic( peer, uno::UNO_QUERY ) - { - if ( !mxGraphic.is() ) - { - OSL_FAIL( "ERROR: failed to load image: `%s'" ); - } - } -}; - -FixedImage::FixedImage ( Context *context, char const* pId, sal_uInt32 nId ) - : Control( new FixedImageImpl( context, context->GetPeerHandle( pId, nId ), this ) ) -{ - Window *parent = dynamic_cast<Window*> (context); - if (parent) - SetParent (parent); -} - -IMPL_GET_IMPL( FixedImage ) - -} // namespace layout - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wrapper.hxx b/toolkit/source/layout/vcl/wrapper.hxx deleted file mode 100644 index 3ac89468cfa4..000000000000 --- a/toolkit/source/layout/vcl/wrapper.hxx +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUT_VCL_WRAPPER_HXX -#define LAYOUT_VCL_WRAPPER_HXX - -#include <layout/layout.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/awt/XDialog2.hpp> -#include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <cppuhelper/implbase1.hxx> - -#include <cstring> - -namespace layout -{ - -namespace css = com::sun::star; - -class WindowImpl -{ -public: - Window *mpWindow; - Context *mpCtx; - css::uno::Reference< css::awt::XWindow > mxWindow; - css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer; - ::Window *mvclWindow; - bool bFirstTimeVisible; - - WindowImpl (Context *context, PeerHandle const &peer, Window *window); - virtual ~WindowImpl (); - - void wrapperGone(); - void setProperty (char const *name, css::uno::Any any); - void redraw (bool resize=false); - - // XFocusListener - virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException); -}; - -class ControlImpl : public WindowImpl - , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener> -{ -public: - Link mGetFocusHdl; - Link mLoseFocusHdl; - - ControlImpl( Context *context, PeerHandle const& peer, Window *window ); - ~ControlImpl (); - - virtual void SetGetFocusHdl (Link const& link); - virtual void SetLoseFocusHdl (Link const& link); - virtual void UpdateListening (Link const& link); - - // XFocusListener - virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException); - void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException); - void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException); -}; - -inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); } - -// Helpers for defining boiler-plate constructors ... -// Could in-line in top-level but not with safe static_casts. -#define IMPL_GET_IMPL(t) \ - inline t##Impl &t::getImpl() const \ - { \ - return *(static_cast<t##Impl *>(mpImpl)); \ - } -#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \ - t::t( Context *context, const char *pId, sal_uInt32 nId ) \ - : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \ - { \ - Window *parent = dynamic_cast<Window*> (context);\ - body;\ - if (parent)\ - SetParent (parent);\ - } \ - t::t( Window *parent, WinBits bits) \ - : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \ - { \ - body;\ - if ( parent )\ - SetParent (parent);\ - } \ - t::t( Window *parent, ResId const& res) \ - : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \ - { \ - body;\ - setRes (res);\ - if (parent)\ - SetParent (parent);\ - } -#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, ) -#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \ - t::t( Context *context, const char *pId, sal_uInt32 nId ) \ - : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \ - , other_par( new other_par##Impl( Window::GetPeer() ) ) \ - { \ - } \ - t::t( Window *parent, WinBits bits) \ - : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \ - , other_par( new other_par##Impl( Window::GetPeer() ) ) \ - { \ - } - -#define IMPL_IMPL(t, parent) \ - class t##Impl : public parent##Impl \ - { \ - public: \ - t##Impl( Context *context, PeerHandle const& peer, Window *window ) \ - : parent##Impl( context, peer, window ) \ - { \ - } \ - }; - - -} // namespace layout - -#endif /* LAYOUT_VCL_WRAPPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |