diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
commit | b8c5868b31b52c0ccdcc401342b55c947b19e89d (patch) | |
tree | 9cf9d5b464ec7587bcc76f08932665fa2703849f /sfx2 | |
parent | 79333b34480c401e3a43e3add609db5874d0b1a7 (diff) | |
parent | e03596eaf693b9809cffe86c21658a5ce381d6c3 (diff) |
cws tl74: merge with DEV300_m81
Diffstat (limited to 'sfx2')
83 files changed, 3879 insertions, 1518 deletions
diff --git a/sfx2/inc/imagemgr.hxx b/sfx2/inc/imagemgr.hxx index ead9b6988cea..79dc724210c4 100644 --- a/sfx2/inc/imagemgr.hxx +++ b/sfx2/inc/imagemgr.hxx @@ -33,4 +33,4 @@ #include <rtl/ustring.hxx> #include <vcl/image.hxx> -SFX2_DLLPUBLIC Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); +SFX2_DLLPUBLIC Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index 8cd8f9d8561f..b43dba7d6673 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -566,7 +566,7 @@ #include "svl/svdde.hxx" #include "svl/svstdarr.hxx" #include "svtools/svtdata.hxx" -#include "svl/svtools.hrc" +#include "svtools/svtools.hrc" #include "unotools/syslocale.hxx" #include "unotools/syslocaleoptions.hxx" #include "svl/szitem.hxx" diff --git a/sfx2/inc/sfx2/Metadatable.hxx b/sfx2/inc/sfx2/Metadatable.hxx index 068a6c4a4544..273eb1afef87 100644 --- a/sfx2/inc/sfx2/Metadatable.hxx +++ b/sfx2/inc/sfx2/Metadatable.hxx @@ -98,8 +98,8 @@ public: const bool i_bCopyPrecedesSource = false); /** create an Undo Metadatable, which remembers this' reference */ - ::boost::shared_ptr<MetadatableUndo> CreateUndo( - const bool i_isDelete = false); + ::boost::shared_ptr<MetadatableUndo> CreateUndo() const; + ::boost::shared_ptr<MetadatableUndo> CreateUndoForDelete(); /** restore this from Undo Metadatable */ void RestoreMetadata(::boost::shared_ptr<MetadatableUndo> const& i_pUndo); diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index 17b2dee417cd..8a49fde7b958 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -33,6 +33,7 @@ #include <tools/solar.h> #include <svl/smplhint.hxx> #include <svl/poolitem.hxx> +#include <vcl/image.hxx> #include <tools/ref.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/script/XLibraryContainer.hpp> @@ -316,6 +317,9 @@ public: SAL_DLLPRIVATE SfxModule* GetModule_Impl(); SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl(); //#endif + + /** loads the application logo as used in the about dialog and impress slideshow pause screen */ + static Image GetApplicationLogo(); }; #define SFX_APP() SfxGetpApp() diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx index cac0b72f13cf..fd1eb65d54df 100644 --- a/sfx2/inc/sfx2/childwin.hxx +++ b/sfx2/inc/sfx2/childwin.hxx @@ -87,13 +87,13 @@ struct SfxChildWinInfo }; // Factory-Methode eines ChildWindows -typedef SfxChildWindow* (*SfxChildWinCtor)( Window *pParentWindow, +typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo); // Factory-Methode eines ChildWindowsContexts -typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( Window *pParentWindow, +typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow, SfxBindings *pBindings, SfxChildWinInfo *pInfo); struct SfxChildWinContextFactory @@ -143,8 +143,8 @@ struct SfxChildWindow_Impl; class SFX2_DLLPUBLIC SfxChildWindowContext { friend class SfxChildWindow; - Window* pWindow; - sal_uInt16 nContextId; + ::Window* pWindow; + sal_uInt16 nContextId; protected: SfxChildWindowContext( sal_uInt16 nId ); @@ -152,9 +152,9 @@ protected: public: virtual ~SfxChildWindowContext(); - void SetWindow( Window* pWin ) + void SetWindow( ::Window* pWin ) { pWindow=pWin; } - Window* GetWindow() const + ::Window* GetWindow() const { return pWindow; } sal_uInt16 GetContextId() const { return nContextId; } @@ -169,12 +169,12 @@ public: class SFX2_DLLPUBLIC SfxChildWindow { - Window* pParent; // parent window ( Topwindow ) - sal_uInt16 nType; // ChildWindow-Id + ::Window* pParent; // parent window ( Topwindow ) + sal_uInt16 nType; // ChildWindow-Id protected: SfxChildAlignment eChildAlignment;// aktuelles ::com::sun::star::drawing::Alignment - Window* pWindow; // eigentlicher Inhalt + ::Window* pWindow; // eigentlicher Inhalt SfxChildWindow_Impl* pImp; // Imp-Daten private: @@ -185,14 +185,14 @@ private: { return pContext; } protected: - SfxChildWindow(Window *pParentWindow, sal_uInt16 nId); + SfxChildWindow(::Window *pParentWindow, sal_uInt16 nId); public: virtual ~SfxChildWindow(); void Destroy(); - Window* GetWindow() const + ::Window* GetWindow() const { return pWindow; } - Window* GetParent() const + ::Window* GetParent() const { return pParent; } SfxChildAlignment GetAlignment() const { return eChildAlignment; } @@ -217,17 +217,17 @@ public: sal_uInt16 GetContextId() const { return pContext ? pContext->GetContextId(): 0; } - Window* GetContextWindow() const + ::Window* GetContextWindow() const { return pContext ? pContext->GetWindow(): 0; } - Window* GetContextWindow( SfxModule *pModule ) const; + ::Window* GetContextWindow( SfxModule *pModule ) const; virtual SfxChildWinInfo GetInfo() const; void SaveStatus(const SfxChildWinInfo& rInfo); static void RegisterChildWindow(SfxModule*, SfxChildWinFactory*); - static SfxChildWindow* CreateChildWindow( sal_uInt16, Window*, SfxBindings*, SfxChildWinInfo&); + static SfxChildWindow* CreateChildWindow( sal_uInt16, ::Window*, SfxBindings*, SfxChildWinInfo&); void SetHideNotDelete( sal_Bool bOn ); sal_Bool IsHideNotDelete() const; void SetHideAtToggle( sal_Bool bOn ); @@ -258,19 +258,19 @@ public: //------------------------------------------------------------------ //! demn"achst hinf"allig ! #define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \ - static SfxChildWindowContext* CreateImpl(Window *pParent, \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(SfxModule *pMod=0); \ //! Das Macro der Zukunft ... #define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ - static SfxChildWindowContext* CreateImpl(Window *pParent, \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \ //! demn"achst hinf"allig ! #define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent, \ @@ -290,7 +290,7 @@ public: // CreateImpl mu\s noch als Parameter die Factory mitbekommen wg. ContextId // Solange wird diese Id auf 0 gesetzt und in SfxChildWindow::CreateContext gepatched #define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\ @@ -305,7 +305,7 @@ public: #define SFX_DECL_CHILDWINDOW(Class) \ public : \ - static SfxChildWindow* CreateImpl(Window *pParent, sal_uInt16 nId, \ + static SfxChildWindow* CreateImpl(::Window *pParent, sal_uInt16 nId, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindow (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0); \ static sal_uInt16 GetChildWindowId ();\ @@ -315,7 +315,7 @@ public: SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS) #define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ - SfxChildWindow* __EXPORT Class::CreateImpl( Window *pParent, \ + SfxChildWindow* __EXPORT Class::CreateImpl( ::Window *pParent, \ sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\ diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index d17553e2b2d0..9b775f8e827d 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -102,30 +102,6 @@ class Window; #define FILE_OPEN_SERVICE_NAME_SYSTEM "com.sun.star.ui.dialogs.SystemFilePicker" #define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker" -//***************************************************************************** -// SfxUrlDialog -//***************************************************************************** - -//#if 0 // _SOLAR__PRIVATE -#ifndef DONT_USE_FILE_DIALOG_SERVICE - -class SfxUrlDialog : public ModalDialog -{ -private: - Edit aEdit; - OKButton aOk; - CancelButton aCancel; - -public: - SfxUrlDialog( Window* pParent ); - - String GetUrl() const { return aEdit.GetText(); } - void SetUrl( const String& rUrl ) { aEdit.SetText( rUrl ); } -}; - -#endif -//#endif - //----------------------------------------------------------------------------- namespace sfx2 { diff --git a/sfx2/inc/sfx2/module.hxx b/sfx2/inc/sfx2/module.hxx index 793dd8f76cab..ad83bb4a7418 100644 --- a/sfx2/inc/sfx2/module.hxx +++ b/sfx2/inc/sfx2/module.hxx @@ -93,6 +93,8 @@ public: virtual void Invalidate(USHORT nId = 0); BOOL IsActive() const; + /*virtual*/ bool IsChildWindowAvailable( const USHORT i_nId, const SfxViewFrame* i_pViewFrame ) const; + static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL ); static FieldUnit GetCurrentFieldUnit(); FieldUnit GetFieldUnit() const; diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 5fc5a641fd44..d514235cbfa2 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -398,7 +398,8 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, + bool bRaiseError = true ); static ErrCode CallXScript( @@ -407,7 +408,8 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, + bool bRaiseError = true ); /** adjusts the internal macro mode, according to the current security settings diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 6a740ae78c31..275e5c06a7be 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -870,6 +870,7 @@ #define SID_HYPERLINK_GETLINK (SID_SVX_START + 361) #define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) #define SID_NAVIGATOR (SID_SVX_START + 366) +#define SID_TASKPANE (SID_SVX_START + 370) #define SID_ZOOM_NEXT (SID_SVX_START + 402) #define SID_ZOOM_PREV (SID_SVX_START + 403) #define SID_INET_DLG (SID_SVX_START + 416) diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx new file mode 100644 index 000000000000..69ebd866a50b --- /dev/null +++ b/sfx2/inc/sfx2/taskpane.hxx @@ -0,0 +1,245 @@ +/************************************************************************* + * 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 SFX_TASKPANE_HXX +#define SFX_TASKPANE_HXX + +#include "sfx2/dllapi.h" +#include "sfx2/childwin.hxx" +#include "sfx2/titledockwin.hxx" + +#include <svtools/toolpanel/tabalignment.hxx> +#include <svtools/toolpanel/tabitemcontent.hxx> + +#include <boost/scoped_ptr.hpp> +#include <boost/optional.hpp> + +namespace svt +{ + class ToolPanelDeck; +} + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + //================================================================================================================== + //= ITaskPaneToolPanelAccess + //================================================================================================================== + class SAL_NO_VTABLE ITaskPaneToolPanelAccess + { + public: + virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) = 0; + }; + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow + ,public ITaskPaneToolPanelAccess + { + public: + TaskPaneWrapper( + Window* i_pParent, + USHORT i_nId, + SfxBindings* i_pBindings, + SfxChildWinInfo* i_pInfo + ); + + SFX_DECL_CHILDWINDOW( TaskPaneWrapper ); + + // ITaskPaneToolPanelAccess + virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); + }; + + //================================================================================================================== + //= IToolPanelCompare + //================================================================================================================== + class SFX2_DLLPUBLIC SAL_NO_VTABLE IToolPanelCompare + { + public: + /** compares to tool panel URLs + @return + <ul> + <li>-1 if the tool panel described by i_rLHS should precede the one described by i_rRHS</li> + <li>0 if the two panels have no particular relative order</li> + <li>1 if the tool panel described by i_rLHS should succeed the one described by i_rRHS</li> + + */ + virtual short compareToolPanelsURLs( + const ::rtl::OUString& i_rLHS, + const ::rtl::OUString& i_rRHS + ) const = 0; + }; + + //================================================================================================================== + //= ModuleTaskPane + //================================================================================================================== + class ModuleTaskPane_Impl; + /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective + module's configuration + */ + class SFX2_DLLPUBLIC ModuleTaskPane : public Window + { + public: + /** creates a new instance + @param i_rParentWindow + the parent window + @param i_rDocumentFrame + the frame to which the task pane belongs. Will be passed to any custom tool panels created + via an XUIElementFactory. Also, it is used to determine the module which the task pane is + responsible for, thus controlling which tool panels are actually available. + */ + ModuleTaskPane( + Window& i_rParentWindow, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame + ); + /** creates a new instance + @param i_rParentWindow + the parent window + @param i_rDocumentFrame + the frame to which the task pane belongs. Will be passed to any custom tool panels created + via an XUIElementFactory. Also, it is used to determine the module which the task pane is + responsible for, thus controlling which tool panels are actually available. + @param i_rCompare + a comparator for tool panel URLs, which allows controlling the order in which the panels are + added to the tool panel deck. + */ + ModuleTaskPane( + Window& i_rParentWindow, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame, + const IToolPanelCompare& i_rCompare + ); + ~ModuleTaskPane(); + + /** determines whether a given module has any registered tool panels + */ + static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + /** determines whether a given module has any registered tool panels + */ + static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame ); + + /** provides access to the Window aspect of the PanelDeck + + Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations + into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However, + you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane + itself. + */ + ::svt::ToolPanelDeck& GetPanelDeck(); + const ::svt::ToolPanelDeck& GetPanelDeck() const; + + /** returns the position of the panel with the given resource URL + */ + ::boost::optional< size_t > + GetPanelPos( const ::rtl::OUString& i_rResourceURL ); + + /** returns the resource URL of the panel at the specified position + */ + ::rtl::OUString + GetPanelResourceURL( const size_t i_nPanelPos ) const; + + /// sets the "classical" layout of the tool panel deck, using drawers + void SetDrawersLayout(); + /// sets the new layout of the tool panel deck, using tabs + void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + + protected: + // Window overridables + virtual void Resize(); + virtual void GetFocus(); + + private: + ::boost::scoped_ptr< ModuleTaskPane_Impl > m_pImpl; + }; + + //================================================================================================================== + //= TaskPaneController + //================================================================================================================== + class TaskPaneController_Impl; + /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane + which do not use the TaskPaneDockingWindow + + The controller will add a drop down menu to the docking window which contains one item for each panel in the + panel deck, and allows toggling their visibility. + */ + class SFX2_DLLPUBLIC TaskPaneController + { + public: + TaskPaneController( + ModuleTaskPane& i_rTaskPane, + TitledDockingWindow& i_rDockingWindow + ); + ~TaskPaneController(); + + /** sets the default title to be used for the TitledDockingWindow + + When the controller switches the docking window to "tabbed" mode, then the title of the docking window + will contain the name of the currently active panel (since this name isn't to be seen elsewhere). + When the controller switches the docking window to "drawer" mode, then the title of the docking window + contains the default title as given here (since in this mode, the names of the panels are shown in + the drawers). + */ + void SetDefaultTitle( const String& i_rTitle ); + + /// activates the panel with the given URL + void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); + + private: + ::boost::scoped_ptr< TaskPaneController_Impl > m_pImpl; + }; + + //================================================================================================================== + //= TaskPaneDockingWindow + //================================================================================================================== + class TaskPaneDockingWindow :public TitledDockingWindow + ,public ITaskPaneToolPanelAccess + { + public: + TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, + Window* i_pParent, WinBits i_nBits ); + + // ITaskPaneToolPanelAccess + virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); + + protected: + // Window overridables + virtual void GetFocus(); + + // TitledDockingWindow overridables + virtual void onLayoutDone(); + + private: + ModuleTaskPane m_aTaskPane; + TaskPaneController m_aPaneController; + }; + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... + +#endif // SFX_TASKPANE_HXX diff --git a/sfx2/inc/sfx2/titledockwin.hxx b/sfx2/inc/sfx2/titledockwin.hxx new file mode 100644 index 000000000000..ebb4497a0ba2 --- /dev/null +++ b/sfx2/inc/sfx2/titledockwin.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * 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 SFX_TITLEDOCKWIN_HXX +#define SFX_TITLEDOCKWIN_HXX + +#include "sfx2/dllapi.h" +#include "sfx2/dockwin.hxx" + +#include <vcl/toolbox.hxx> +#include <tools/svborder.hxx> + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + //================================================================================================================== + //= TitledDockingWindow + //================================================================================================================== + class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow + { + public: + TitledDockingWindow( + SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, + Window* i_pParent, WinBits i_nStyle = 0 + ); + + TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, + Window* i_pParent, const ResId& i_rResId + ); + + virtual ~TitledDockingWindow(); + + /** sets a title to be displayed in the docking window + */ + void SetTitle( const String& i_rTitle ); + /** returns the current title displayed in the docking window + + Note that if you never called SetTitle before, then this method will not return an empty string, + but the window text (Window::GetText), since this is what is displayed as title then. + */ + String GetTitle() const; + + /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox. + + @param i_rItemText + the text to display for the item + @param i_nHelpId + the help ID for the new toolbox item + @param i_rCallback + the callback to invoke when the drop item has been clicked + @return + the ID of the newly created toolbox item + */ + USHORT AddDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback ) + { + return impl_addDropDownToolBoxItem( i_rItemText, i_nHelpId, i_rCallback ); + } + + void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { m_aEndDockingHdl = i_rEndDockingHdl; } + const Link& GetEndDockingHdl() const { return m_aEndDockingHdl; } + + /** resets the toolbox. Upon return, the only item in the toolbox is the closer. + */ + void ResetToolBox() + { + impl_resetToolBox(); + } + + /** returns the content window, which is to be used as parent window for any content to be displayed + in the docking window. + */ + ::Window& GetContentWindow() { return m_aContentWindow; } + const ::Window& GetContentWindow() const { return m_aContentWindow; } + + ToolBox& GetToolBox() { return m_aToolbox; } + const ToolBox& GetToolBox() const { return m_aToolbox; } + + protected: + // Window overridables + virtual void Paint( const Rectangle& i_rArea ); + virtual void Resize(); + virtual void StateChanged( StateChangedType i_nType ); + virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent ); + virtual void SetText( const String& i_rText ); + + // DockingWindow overridables + void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + + // own overridables + virtual void onLayoutDone(); + + protected: + /** internal version of ResetToolBox + */ + void impl_resetToolBox(); + + /** internal version of AddDropDownToolBoxItem + */ + USHORT impl_addDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback ); + + /** returns the current title. + + If no title has been set via SetTitle, then the window text (Window::GetText) is returned. + */ + String impl_getTitle() const; + + private: + DECL_LINK( OnToolboxItemSelected, ToolBox* ); + + void impl_construct(); + void impl_layout(); + void impl_scheduleLayout(); + + private: + String m_sTitle; + ToolBox m_aToolbox; + Window m_aContentWindow; + + Link m_aEndDockingHdl; + + /** The border that is painted arround the inner window. The bevel + shadow lines are part of the border, so where the border is 0 no + such line is painted. + */ + SvBorder m_aBorder; + + /** Remember that a layout is pending, i.e. Resize() has been called + since the last Paint(). + */ + bool m_bLayoutPending; + }; + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... + +#endif // SFX_TITLEDOCKWIN_HXX diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 8350bc5f0f9d..d376236bf830 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -40,6 +40,8 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XController2.hpp> +#include <tools/svborder.hxx> + class SfxMacro; class SvBorder; class SfxDispatcher; @@ -70,67 +72,6 @@ SV_DECL_REF(SfxObjectShell) #endif //======================================================================== -#include <tools/gen.hxx> -class SvBorder -{ - long nTop, nRight, nBottom, nLeft; -public: - SvBorder() - { nTop = nRight = nBottom = nLeft = 0; } - SvBorder( const Size & rSz ) - { nTop = nBottom = rSz.Height(); nRight = nLeft = rSz.Width(); } - SvBorder( const Rectangle & rOuter, const Rectangle & rInner ); - SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP ) - { nLeft = nLeftP; nTop = nTopP; nRight = nRightP; nBottom = nBottomP; } - BOOL operator == ( const SvBorder & rObj ) const - { - return nTop == rObj.nTop && nRight == rObj.nRight && - nBottom == rObj.nBottom && nLeft == rObj.nLeft; - } - BOOL operator != ( const SvBorder & rObj ) const - { return !(*this == rObj); } - SvBorder & operator = ( const SvBorder & rBorder ) - { - Left() = rBorder.Left(); - Top() = rBorder.Top(); - Right() = rBorder.Right(); - Bottom() = rBorder.Bottom(); - return *this; - } - SvBorder & operator += ( const SvBorder & rBorder ) - { - Left() += rBorder.Left(); - Top() += rBorder.Top(); - Right() += rBorder.Right(); - Bottom() += rBorder.Bottom(); - return *this; - } - SvBorder & operator -= ( const SvBorder & rBorder ) - { - Left() -= rBorder.Left(); - Top() -= rBorder.Top(); - Right() -= rBorder.Right(); - Bottom() -= rBorder.Bottom(); - return *this; - } - BOOL IsInside( const SvBorder & rInside ) - { - return nTop >= rInside.nTop && nRight >= rInside.nRight && - nBottom >= rInside.nBottom && nLeft >= rInside.nLeft; - } - long & Top() { return nTop; } - long & Right() { return nRight; } - long & Bottom() { return nBottom; } - long & Left() { return nLeft; } - long Top() const { return nTop; } - long Right() const { return nRight; } - long Bottom() const { return nBottom; } - long Left() const { return nLeft; } -}; -Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder ); -Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ); - - DBG_NAMEEX(SfxViewFrame) class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener { @@ -228,6 +169,8 @@ public: String UpdateTitle(); + static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ); + // interne Handler SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const; @@ -304,6 +247,7 @@ public: SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); + SAL_DLLPRIVATE void ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ); //#endif private: diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 0109bbbf602d..8465a238cd5b 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -59,6 +59,7 @@ class SfxTabPage; class SfxPrintMonitor; class SfxFrameSetDescriptor; class PrintDialog; +class Printer; class SfxPrinter; class SfxProgress; class SvStringsDtor; @@ -149,6 +150,7 @@ class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener friend class SfxViewFrame; friend class SfxPlugInFrame; friend class SfxBaseController; +friend class SfxPrinterController; #endif struct SfxViewShell_Impl* pImp; @@ -188,10 +190,6 @@ public: SfxViewShell( SfxViewFrame *pFrame, USHORT nFlags = 0 ); virtual ~SfxViewShell(); - // In-Place - // should be superfluous - //virtual SfxInPlaceClient* CreateIPClient( WorkWindow * pTop, WorkWindow * pDoc, Window * pDraw ); - SfxInPlaceClient* GetIPClient() const; SfxInPlaceClient* GetUIActiveClient() const; SfxInPlaceClient* FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, Window *pObjParentWin ) const; @@ -250,6 +248,7 @@ public: void LockPrinter( BOOL bLock = TRUE ); BOOL IsPrinterLocked() const; virtual JobSetup GetJobSetup() const; + Printer* GetActivePrinter() const; // Workingset virtual void WriteUserData( String&, BOOL bBrowse = FALSE ); diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index 89e618e8fc12..763c60810b3e 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -2,7 +2,6 @@ sf sfx2 : l10n idl basic xmlscript framework shell setup_native sax S sf sfx2 usr1 - all sf_mkout NULL sf sfx2\inc nmake - all sf_inc NULL sf sfx2\prj get - all sf_prj NULL -sf sfx2\win\res get - all sf_wres NULL sf sfx2\mac\res get - all sf_mres NULL sf sfx2\source\inc get - all sf_sinc NULL sf sfx2\sdi nmake - all sf_sdi NULL @@ -20,4 +19,6 @@ sf sfx2\source\statbar nmake - all sf_sbar sf_sdi sf_inc NULL sf sfx2\source\toolbox nmake - all sf_tbox sf_sdi sf_inc NULL sf sfx2\source\inet nmake - all sf_inet sf_sdi sf_inc NULL sf sfx2\source\explorer nmake - all sf_expl sf_sdi sf_inc NULL +sf sfx2\workben\custompanel nmake - all sf_wb_custompanel NULL sf sfx2\util nmake - all sf_util sf_appl sf_bast sf_cnfg sf_ctrl sf_dlg sf_doc sf_expl sf_inet sf_menu sf_layout sf_noti sf_sbar sf_tbox sf_view NULL +sf sfx2\qa\unoapi nmake - all sf_qa_unoapi NULL diff --git a/sfx2/qa/complex/DocumentMetadataAccessTest.java b/sfx2/qa/complex/DocumentMetadataAccessTest.java index 05dc523d6f8b..a61280c45fe5 100644 --- a/sfx2/qa/complex/DocumentMetadataAccessTest.java +++ b/sfx2/qa/complex/DocumentMetadataAccessTest.java @@ -42,6 +42,7 @@ import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.WrappedTargetRuntimeException; import com.sun.star.beans.XPropertySet; import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.Pair; import com.sun.star.beans.StringPair; import com.sun.star.container.XEnumerationAccess; import com.sun.star.container.XEnumeration; @@ -689,23 +690,25 @@ public class DocumentMetadataAccessTest extends ComplexTestCase log.println("Checking RDFa in loaded test document..."); XMetadatable xPara; - Statement[] stmts; + Pair<Statement[], Boolean> result; Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 1", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit1 })); Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 2", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit2 })); @@ -713,37 +716,40 @@ public class DocumentMetadataAccessTest extends ComplexTestCase new Statement(blank1, bar, mkLit("3"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 3", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit3 })); XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); Statement x_BlankBarLit4 = new Statement(blank2, bar, mkLit("4"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 4", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit4 })); XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); Statement x_BlankBarLit5 = new Statement(blank1, bar, mkLit("5"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 5", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_BlankBarLit5 })); XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, stmts[0].Subject); + XBlankNode.class, result.First[0].Subject); assure("RDFa: 3 != 4", !b3.getStringValue().equals(b4.getStringValue())); @@ -754,9 +760,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 6", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit6, x_FooBazLit6 })); @@ -765,9 +772,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 7", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit7, x_FooBazLit7, x_FooFooLit7 })); @@ -776,43 +784,41 @@ public class DocumentMetadataAccessTest extends ComplexTestCase Statement x_FooBarLit = new Statement(foo, bar, lit, null); Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null); - Statement x_FooLabelLit8 = - new Statement(foo, rdfs_label, mkLit("8"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 8", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit8 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); - Statement x_FooLabelLit9 = - new Statement(foo, rdfs_label, mkLit("9"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 9", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit9 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); - Statement x_FooLabelLit10 = - new Statement(foo, rdfs_label, mkLit("10"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 10", - eq(stmts, new Statement[] { - x_FooBarLittype, x_FooLabelLit10 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLittype })); Statement x_FooBarLit11 = new Statement(foo, bar, mkLit("11", bar), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 11", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FooBarLit11 })); @@ -821,66 +827,67 @@ public class DocumentMetadataAccessTest extends ComplexTestCase new Statement(xFile, bar, mkLit("12"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 12", - eq(stmts, new Statement[] { + !result.Second && + eq(result.First, new Statement[] { x_FileBarLit12 })); - Statement x_FooLabelLit13 = - new Statement(foo, rdfs_label, mkLit("13"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 13", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit13 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); Statement x_FooLabelLit14 = new Statement(foo, rdfs_label, mkLit("14"), null); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); + result = xRep.getStatementRDFa(xPara); assure("RDFa: 14", - eq(stmts, new Statement[] { - x_FooBarLit, x_FooLabelLit14 + result.Second && + eq(result.First, new Statement[] { + x_FooBarLit })); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 15", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 15", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 16", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 16", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 17", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 17", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 18", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 18", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 19", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 19", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 20", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 20", eq(result.First, new Statement[] { } )); xPara = (XMetadatable) UnoRuntime.queryInterface( XMetadatable.class, xEnum.nextElement()); - stmts = xRep.getStatementRDFa(xPara); - assure("RDFa: 21", eq(stmts, new Statement[] { } )); + result = xRep.getStatementRDFa(xPara); + assure("RDFa: 21", eq(result.First, new Statement[] { } )); log.println("...done"); diff --git a/sfx2/qa/complex/docinfo/makefile.mk b/sfx2/qa/complex/docinfo/makefile.mk index 18cfdb534450..8c3525541062 100644 --- a/sfx2/qa/complex/docinfo/makefile.mk +++ b/sfx2/qa/complex/docinfo/makefile.mk @@ -53,4 +53,4 @@ JARCOMPRESS = TRUE run: - $(JAVAI) -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) + $(JAVAI) $(JAVAIFLAGS) -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b) diff --git a/sfx2/qa/unoapi/Test.java b/sfx2/qa/unoapi/Test.java new file mode 100644 index 000000000000..4263985c133f --- /dev/null +++ b/sfx2/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* 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. +************************************************************************/ + +package org.openoffice.sfx2.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "sfx.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/sfx2/qa/unoapi/makefile.mk b/sfx2/qa/unoapi/makefile.mk index 3b078237f163..ea91ba4d1c44 100644 --- a/sfx2/qa/unoapi/makefile.mk +++ b/sfx2/qa/unoapi/makefile.mk @@ -1,7 +1,6 @@ #************************************************************************* -# # 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 @@ -22,19 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=sfx2 -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = sfx2 +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/sfx2/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce sfx.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/sfx2/qa/unoapi/sfx.sce b/sfx2/qa/unoapi/sfx.sce index 2aaf12c25950..6176c0668731 100644 --- a/sfx2/qa/unoapi/sfx.sce +++ b/sfx2/qa/unoapi/sfx.sce @@ -2,4 +2,4 @@ -o sfx.DocumentTemplates -o sfx.FrameLoader -o sfx.SfxMacroLoader --o sfx.StandaloneDocumentInfo +#i111283 -o sfx.StandaloneDocumentInfo diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index c4210b801bf6..dbf9267448e1 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -50,6 +50,11 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] + SID_TASKPANE // status(final|play) + [ + ExecMethod = ChildWindowExecute ; + StateMethod = ChildWindowState ; + ] SID_SHOW_BROWSER // ole(no) api(final/play/rec) [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 789a23a3c20b..e4e43c51052f 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3931,6 +3931,33 @@ SfxBoolItem Navigator SID_NAVIGATOR ToolBoxConfig = TRUE, GroupId = GID_NAVIGATOR; ] + +//-------------------------------------------------------------------------- +SfxBoolItem TaskPane SID_TASKPANE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + //-------------------------------------------------------------------------- SfxVoidItem RestoreEditingView SID_RESTORE_EDITING_VIEW diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index d42d203e57f5..6e13894feb49 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -322,6 +322,7 @@ SfxApplication* SfxApplication::GetOrCreate() ::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory ); ::framework::SetDockingWindowCreator( SfxDockingWindowFactory ); ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible ); + ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel ); SfxHelp* pSfxHelp = new SfxHelp; Application::SetHelp( pSfxHelp ); diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index a34a2e0d6a32..08023c5414a6 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <svtools/soerr.hxx> -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #include <unotools/saveopt.hxx> #include <unotools/localisationoptions.hxx> #include <tools/config.hxx> diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 47bf98292316..addace134362 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -42,6 +42,7 @@ #include "inettbc.hxx" #include "stbitem.hxx" #include <sfx2/navigat.hxx> +#include <sfx2/taskpane.hxx> #include <sfx2/module.hxx> #include <sfx2/viewfrm.hxx> #include "partwnd.hxx" diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 8b7e06c231cd..fd33e21ea645 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -144,53 +144,53 @@ using namespace ::com::sun::star::io; #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" -static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); -static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); -static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); -static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); -static const String sViewId = String::CreateFromAscii( "ViewId" ); -static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); -static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); -static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); -static const String sFrameName = String::CreateFromAscii( "FrameName" ); -static const String sMediaType = String::CreateFromAscii( "MediaType" ); -static const String sPostData = String::CreateFromAscii( "PostData" ); -static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); -static const String sInputStream = String::CreateFromAscii( "InputStream" ); -static const String sStream = String::CreateFromAscii( "Stream" ); -static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); -static const String sHidden = String::CreateFromAscii( "Hidden" ); -static const String sPreview = String::CreateFromAscii( "Preview" ); -static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); -static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); -static const String sSilent = String::CreateFromAscii( "Silent" ); -static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); -static const String sFileName = String::CreateFromAscii( "FileName" ); -static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); -static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); -static const String sModel = String::CreateFromAscii( "Model" ); -static const String sFrame = String::CreateFromAscii( "Frame" ); -static const String sViewData = String::CreateFromAscii( "ViewData" ); -static const String sFilterData = String::CreateFromAscii( "FilterData" ); -static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); -static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); -static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); -static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); -static const String sMinimized = String::CreateFromAscii( "Minimized" ); -static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); -static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); -static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); -static const String sComponentData = String::CreateFromAscii( "ComponentData" ); -static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); -static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); -static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); -static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); -static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); -static const String sFolderName = String::CreateFromAscii( "FolderName" ); -static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); -static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); -static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static char const sTemplateRegionName[] = "TemplateRegionName"; +static char const sTemplateName[] = "TemplateName"; +static char const sAsTemplate[] = "AsTemplate"; +static char const sOpenNewView[] = "OpenNewView"; +static char const sViewId[] = "ViewId"; +static char const sPluginMode[] = "PluginMode"; +static char const sReadOnly[] = "ReadOnly"; +static char const sStartPresentation[] = "StartPresentation"; +static char const sFrameName[] = "FrameName"; +static char const sMediaType[] = "MediaType"; +static char const sPostData[] = "PostData"; +static char const sCharacterSet[] = "CharacterSet"; +static char const sInputStream[] = "InputStream"; +static char const sStream[] = "Stream"; +static char const sOutputStream[] = "OutputStream"; +static char const sHidden[] = "Hidden"; +static char const sPreview[] = "Preview"; +static char const sViewOnly[] = "ViewOnly"; +static char const sDontEdit[] = "DontEdit"; +static char const sSilent[] = "Silent"; +static char const sJumpMark[] = "JumpMark"; +static char const sFileName[] = "FileName"; +static char const sSalvageURL[] = "SalvagedFile"; +static char const sStatusInd[] = "StatusIndicator"; +static char const sModel[] = "Model"; +static char const sFrame[] = "Frame"; +static char const sViewData[] = "ViewData"; +static char const sFilterData[] = "FilterData"; +static char const sSelectionOnly[] = "SelectionOnly"; +static char const sFilterFlags[] = "FilterFlags"; +static char const sMacroExecMode[] = "MacroExecutionMode"; +static char const sUpdateDocMode[] = "UpdateDocMode"; +static char const sMinimized[] = "Minimized"; +static char const sInteractionHdl[] = "InteractionHandler"; +static char const sUCBContent[] = "UCBContent"; +static char const sRepairPackage[] = "RepairPackage"; +static char const sDocumentTitle[] = "DocumentTitle"; +static char const sComponentData[] = "ComponentData"; +static char const sComponentContext[] = "ComponentContext"; +static char const sDocumentBaseURL[] = "DocumentBaseURL"; +static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName"; +static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible"; +static char const sNoAutoSave[] = "NoAutoSave"; +static char const sFolderName[] = "FolderName"; +static char const sUseSystemDialog[] = "UseSystemDialog"; +static char const sStandardDir[] = "StandardDir"; +static char const sBlackList[] = "BlackList"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -465,15 +465,15 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque for ( sal_uInt16 n=0; n<nCount; n++ ) { const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; - String aName = rProp.Name; - if ( aName == sFrame ) + rtl::OUString aName = rProp.Name; + if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) { Reference< XFrame > xFrame; OSL_VERIFY( rProp.Value >>= xFrame ); rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); } else - if ( aName == sHidden ) + if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) { sal_Bool bVal = sal_False; if (rProp.Value >>= bVal) @@ -490,18 +490,18 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque ++nFoundArgs; #endif const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; - String aName = rProp.Name; - if ( aName == sModel ) + rtl::OUString aName = rProp.Name; + if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) ) rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); - else if ( aName == sComponentData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) ); } - else if ( aName == sComponentContext ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) ); } - else if ( aName == sStatusInd ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) ) { Reference< ::com::sun::star::task::XStatusIndicator > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -509,7 +509,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) ); } - else if ( aName == sInteractionHdl ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) ) { Reference< ::com::sun::star::task::XInteractionHandler > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -517,11 +517,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) ); } - else if ( aName == sViewData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) ) rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); - else if ( aName == sFilterData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) ) rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); - else if ( aName == sInputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -529,7 +529,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) ); } - else if ( aName == sStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -537,7 +537,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) ); } - else if ( aName == sUCBContent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) ) { Reference< XContent > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -545,7 +545,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) ); } - else if ( aName == sOutputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) ) { Reference< XOutputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -553,7 +553,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) ); } - else if ( aName == sPostData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) ) { Reference< XInputStream > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -561,7 +561,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) ); } - else if ( aName == sFrame ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) { Reference< XFrame > xFrame; sal_Bool bOK = (rProp.Value >>= xFrame); @@ -569,7 +569,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); } - else if ( aName == sAsTemplate ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -577,7 +577,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) ); } - else if ( aName == sOpenNewView ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -585,7 +585,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) ); } - else if ( aName == sViewId ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -593,7 +593,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) ); } - else if ( aName == sPluginMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -601,7 +601,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) ); } - else if ( aName == sReadOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -609,7 +609,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); } - else if ( aName == sStartPresentation ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -617,7 +617,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) ); } - else if ( aName == sSelectionOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -625,7 +625,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) ); } - else if ( aName == sHidden ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -633,7 +633,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); } - else if ( aName == sMinimized ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -641,7 +641,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) ); } - else if ( aName == sSilent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -649,7 +649,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SILENT, bVal ) ); } - else if ( aName == sPreview ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -657,7 +657,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) ); } - else if ( aName == sViewOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -665,7 +665,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) ); } - else if ( aName == sDontEdit ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -673,7 +673,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) ); } - else if ( aName == sUseSystemDialog ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -681,7 +681,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) ); } - else if ( aName == sStandardDir ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -689,7 +689,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); } - else if ( aName == sBlackList ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -701,7 +701,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque rSet.Put( stringList ); } } - else if ( aName == sFileName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -709,7 +709,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); } - else if ( aName == sSalvageURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvageURL)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -717,7 +717,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); } - else if ( aName == sFolderName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -725,7 +725,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_PATH, sVal ) ); } - else if ( aName == sFrameName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -733,7 +733,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK && sVal.getLength()) rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) ); } - else if ( aName == sMediaType ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -741,7 +741,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName == sTemplateName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -749,7 +749,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) ); } - else if ( aName == sTemplateRegionName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -757,7 +757,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); } - else if ( aName == sJumpMark ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -765,7 +765,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) ); } - else if ( aName == sCharacterSet ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -773,7 +773,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CHARSET, sVal ) ); } - else if ( aName == sFilterFlags ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -781,7 +781,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); } - else if ( aName == sMacroExecMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -789,7 +789,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) ); } - else if ( aName == sUpdateDocMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -797,7 +797,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) ); } - else if ( aName == sRepairPackage ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -805,7 +805,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) ); } - else if ( aName == sDocumentTitle ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -813,7 +813,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) ); } - else if ( aName == sDocumentBaseURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) ) { ::rtl::OUString sVal; // the base url can be set to empty ( for embedded objects for example ) @@ -822,7 +822,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) ); } - else if ( aName == sHierarchicalDocumentName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -830,7 +830,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) ); } - else if ( aName == sCopyStreamIfPossible ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -838,7 +838,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) ); } - else if ( aName == sNoAutoSave ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -1320,67 +1320,67 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta const SfxPoolItem *pItem=0; if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentContext; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStatusInd; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInteractionHdl; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFilterData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sModel; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUCBContent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOutputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPostData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrame; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); if ( pItem->ISA( SfxUsrAnyItem ) ) { OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); @@ -1393,82 +1393,82 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sAsTemplate; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOpenNewView; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewId; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPluginMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sReadOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStartPresentation; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSelectionOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHidden; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMinimized; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSilent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPreview; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly)); pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDontEdit; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit)); pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUseSystemDialog; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog)); pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStandardDir; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sBlackList; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList)); com::sun::star::uno::Sequence< rtl::OUString > aList; ((SfxStringListItem*)pItem)->GetStringList( aList ); @@ -1476,83 +1476,83 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrameName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSalvageURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvageURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFolderName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMediaType; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateRegionName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sJumpMark; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCharacterSet; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMacroExecMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUpdateDocMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sRepairPackage; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentTitle; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentBaseURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHierarchicalDocumentName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCopyStreamIfPossible; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sNoAutoSave; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index f7cccf2712b8..3b26eae1858d 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -71,7 +71,7 @@ static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSup static WeakReference< XURLTransformer > m_xURLTransformer; static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap; -Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) +Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) { // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel if ( !rFrame.is() ) diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index c8a9742f49cf..895263ef4783 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -49,6 +49,8 @@ #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> #include <svl/intitem.hxx> +#include "sfx2/taskpane.hxx" +#include <tools/diagnose_ex.h> #define SfxModule #include "sfxslots.hxx" @@ -400,6 +402,17 @@ BOOL SfxModule::IsActive() const return FALSE; } +bool SfxModule::IsChildWindowAvailable( const USHORT i_nId, const SfxViewFrame* i_pViewFrame ) const +{ + if ( i_nId != SID_TASKPANE ) + // by default, assume it is + return true; + + const SfxViewFrame* pViewFrame = i_pViewFrame ? i_pViewFrame : GetFrame(); + ENSURE_OR_RETURN( pViewFrame, "SfxModule::IsChildWindowAvailable: no frame to ask for the module identifier!", false ); + return ::sfx2::ModuleTaskPane::ModuleHasToolPanels( pViewFrame->GetFrame().GetFrameInterface() ); +} + SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) { if ( !pFrame ) diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 9ef635ae4786..b9ff344a1513 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -712,9 +712,6 @@ String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rM return aHelpURL; } -static ::rtl::OUString OFFICE_HELP_TASK = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")); -static ::rtl::OUString OFFICE_HELP = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP" )); - SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , Reference< XFrame >& rHelpContent) { @@ -723,7 +720,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // otherwhise - create new help task Reference< XFrame > xHelpTask = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::TASKS | FrameSearchFlag::CREATE); if (!xHelpTask.is()) return 0; @@ -738,7 +735,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , if (xHelpTask->setComponent( xHelpWindow, Reference< XController >() )) { // Customize UI ... - xHelpTask->setName( OFFICE_HELP_TASK ); + xHelpTask->setName( ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")) ); Reference< XPropertySet > xProps(xHelpTask, UNO_QUERY); if (xProps.is()) @@ -752,13 +749,13 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // This sub frame is created internaly (if we called new SfxHelpWindow_Impl() ...) // It should exist :-) - xHelpContent = xHelpTask->findFrame(OFFICE_HELP, FrameSearchFlag::CHILDREN); + xHelpContent = xHelpTask->findFrame(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); } if (!xHelpContent.is()) delete pHelpWindow; - xHelpContent->setName(OFFICE_HELP); + xHelpContent->setName(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP"))); rHelpTask = xHelpTask; rHelpContent = xHelpContent; @@ -828,10 +825,10 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow ) // in both cases)! Reference< XFrame > xHelp = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::CHILDREN); Reference< XFrame > xHelpContent = xDesktop->findFrame( - OFFICE_HELP, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); SfxHelpWindow_Impl* pHelpWindow = 0; diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1d85552e47ae..3fce25e7e0d6 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -33,6 +33,7 @@ #include <sfx2/app.hxx> #include <vos/mutex.hxx> #include <svtools/imagemgr.hxx> +#include <svtools/miscopt.hxx> // #include <cmdlineargs.hxx> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> @@ -235,6 +236,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), + m_bSystemDialogs( false ), m_pResMgr( NULL ), m_pFileDlg( NULL ), m_xServiceManager( aSMgr ), @@ -243,6 +245,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : m_pPlugin( 0 ), m_bInitialized( false ) { + m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog(); } ShutdownIcon::~ShutdownIcon() @@ -376,6 +379,16 @@ void ShutdownIcon::StartFileDialog() { ::vos::OGuard aGuard( Application::GetSolarMutex() ); + bool bDirty = ( m_bSystemDialogs != static_cast<bool>(SvtMiscOptions().UseSystemFileDialog()) ); + + if ( m_pFileDlg && bDirty ) + { + // Destroy instance as changing the system file dialog setting + // forces us to create a new FileDialogHelper instance! + delete m_pFileDlg; + m_pFileDlg = NULL; + } + if ( !m_pFileDlg ) m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() ); m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); @@ -512,8 +525,14 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR #ifdef WNT // #103346 Destroy dialog to prevent problems with custom controls - delete pThis->m_pFileDlg; - pThis->m_pFileDlg = NULL; + // This fix is dependent on the dialog settings. Destroying the dialog here will + // crash the non-native dialog implementation! Therefore make this dependent on + // the settings. + if ( SvtMiscOptions().UseSystemFileDialog() ) + { + delete pThis->m_pFileDlg; + pThis->m_pFileDlg = NULL; + } #endif LeaveModalMode(); diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 4e7cc6ecc247..d702f2a50977 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -52,6 +52,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase ::osl::Mutex m_aMutex; bool m_bVeto; bool m_bListenForTermination; + bool m_bSystemDialogs; ResMgr* m_pResMgr; sfx2::FileDialogHelper* m_pFileDlg; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index c334fd750fc6..26fd35272a51 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -109,7 +109,7 @@ using namespace ::osl; #define ICON_TEMPLATE 16 #define ICON_MACROLIBRARY 17 #define ICON_CONFIGURATION 18 -#define ICON_OPEN 19 +#define ICON_OPEN 5 // See index of open folder icon in shell32.dll #define ICON_SETUP 500 #define SFX_TASKBAR_NOTIFICATION WM_USER+1 @@ -124,6 +124,7 @@ static void OnDrawItem(HWND hwnd, LPDRAWITEMSTRUCT lpdis); typedef struct tagMYITEM { OUString text; + OUString module; UINT iconId; } MYITEM; @@ -152,7 +153,7 @@ static bool isNT() // ------------------------------- -static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw ) +static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module ) { MENUITEMINFOW mi; memset( &mi, 0, sizeof( MENUITEMINFOW ) ); @@ -175,6 +176,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text MYITEM *pMyItem = new MYITEM; pMyItem->text = text; pMyItem->iconId = iconId; + pMyItem->module = module; mi.dwItemData = (DWORD) pMyItem; } else @@ -245,6 +247,8 @@ static HMENU createSystrayMenu( ) { SvtModuleOptions::E_SMATH, IDM_MATH, ICON_MATH_DOCUMENT, MATH_URL }, }; + OUString aEmpty; + // insert the menu entries for launching the applications for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) { @@ -260,19 +264,21 @@ static HMENU createSystrayMenu( ) continue; addMenuItem( hMenu, aMenuItems[i].nMenuItemID, aMenuItems[i].nMenuIconID, - pShutdownIcon->GetUrlDescription( sURL ), pos, true ); + pShutdownIcon->GetUrlDescription( sURL ), pos, true, aEmpty ); } + + // insert the remaining menu entries addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, - pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); + pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "SHELL32" )); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif - addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false ); + addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false, aEmpty ); // indicate status of autostart folder CheckMenuItem( hMenu, IDM_INSTALL, MF_BYCOMMAND | (ShutdownIcon::GetAutostart() ? MF_CHECKED : MF_UNCHECKED) ); @@ -736,11 +742,25 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) x = aRect.left; y = aRect.top; - int cx = GetSystemMetrics( SM_CXSMICON ); - int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + int cx = GetSystemMetrics( SM_CXSMICON ); + int cy = GetSystemMetrics( SM_CYSMICON ); + HICON hIcon( 0 ); + HMODULE hModule( GetModuleHandle( NULL ) ); + + if ( pMyItem->module.getLength() > 0 ) + { + LPCWSTR pModuleName = reinterpret_cast<LPCWSTR>( pMyItem->module.getStr() ); + hModule = GetModuleHandleW( pModuleName ); + if ( hModule == NULL ) + { + LoadLibraryW( pModuleName ); + hModule = GetModuleHandleW( pModuleName ); + } + } + + hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 24cf7dab8095..f9a388deee5c 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -53,6 +53,7 @@ #include <vcl/taskpanelist.hxx> #include <vcl/toolbox.hxx> #include <tools/rcid.h> +#include <tools/diagnose_ex.h> #include <toolkit/helper/vclunohelper.hxx> #include <svl/itempool.hxx> #include <svl/itemiter.hxx> @@ -1538,6 +1539,16 @@ void SfxWorkWindow::UpdateObjectBars_Impl() } } +bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const +{ + // or checking the availability of child windows, we need access to the module + const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL; + const SfxModule* pModule = pShell ? pShell->GetModule() : NULL; + ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true ); + return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame ); +} + void SfxWorkWindow::UpdateChildWindows_Impl() { // alle vorhandenen oder in den Kontext gekommenen ChildWindows @@ -1550,7 +1561,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl() { // Im Kontext ist ein geeignetes ChildWindow erlaubt; // ist es auch eingeschaltet ? - if ( pChildWin == 0 && pCW->bCreate ) + if ( pChildWin == NULL && pCW->bCreate ) { // Internal docking is only used for embedding into another // container. We force the floating state of all floatable @@ -1571,6 +1582,9 @@ void SfxWorkWindow::UpdateChildWindows_Impl() else bCreate = TRUE; + if ( bCreate ) + bCreate = AllowChildWindowCreation_Impl( *pCW ); + // Momentan kein Fenster da, aber es ist eingeschaltet; Fenster // und ggf. Context erzeugen if ( bCreate ) @@ -1588,19 +1602,25 @@ void SfxWorkWindow::UpdateChildWindows_Impl() if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildsVisible ) { // Updatemode ist kompatibel; auf jeden Fall wieder einschalten - bCreate = TRUE; - if ( pCW->pCli ) + bCreate = AllowChildWindowCreation_Impl( *pCW ); + if ( bCreate ) { - // Fenster ist direktes Child - if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) - pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; + if ( pCW->pCli ) + { + // Fenster ist direktes Child + if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) + pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; + } + else + { + if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) + // Fenster liegt in einem SplitWindow + ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl(); + } + + if ( pCW->nInterfaceId != pChildWin->GetContextId() ) + pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); } - else if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) - // Fenster liegt in einem SplitWindow - ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl(); - - if ( pCW->nInterfaceId != pChildWin->GetContextId() ) - pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); } } } @@ -2225,7 +2245,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus) SfxChildWin_Impl *pCW = (*pChildWins)[n]; SfxChildWindow *pChild = pCW->pWin; - bool bCreationAllowed( sal_True ); + bool bCreationAllowed( true ); if ( !bInternalDockingAllowed ) { // Special case for all non-floatable child windows. We have @@ -2233,43 +2253,51 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus) bCreationAllowed = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK ); } - if ( pChild && pCW->bCreate && bCreationAllowed ) + if ( bCreationAllowed ) { - if ( pChild->QueryClose() ) + if ( pCW->bCreate ) { - if ( pChild && pChild->IsHideAtToggle() ) + if ( pChild ) { - pCW->bCreate = !pCW->bCreate; - ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus ); + if ( pChild->QueryClose() ) + { + pCW->bCreate = FALSE; + if ( pChild->IsHideAtToggle() ) + { + ShowChildWindow_Impl( nId, FALSE, bSetFocus ); + } + else + { + // Fenster soll ausgeschaltet werdem + pChild->SetVisible_Impl( FALSE ); + RemoveChildWin_Impl( pCW ); + } + } } else { - // Fenster soll ausgeschaltet werdem + // no actual Window exists, yet => just remember the "switched off" state pCW->bCreate = FALSE; - pChild->SetVisible_Impl( FALSE ); - RemoveChildWin_Impl( pCW ); } } - } - else if ( pCW->bCreate && bCreationAllowed ) - { - pCW->bCreate = FALSE; - } - else if ( bCreationAllowed ) - { - pCW->bCreate = TRUE; - - if ( pChild ) - { - ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus ); - } else { - // Fenster erzeugen - CreateChildWin_Impl( pCW, bSetFocus ); - if ( !pCW->pWin ) - // Erzeugung war erfolglos - pCW->bCreate = FALSE; + pCW->bCreate = AllowChildWindowCreation_Impl( *pCW ); + if ( pCW->bCreate ) + { + if ( pChild ) + { + ShowChildWindow_Impl( nId, TRUE, bSetFocus ); + } + else + { + // create actual Window + CreateChildWin_Impl( pCW, bSetFocus ); + if ( !pCW->pWin ) + // no success + pCW->bCreate = FALSE; + } + } } } @@ -2488,7 +2516,6 @@ void SfxWorkWindow::ShowChildWindow_Impl(USHORT nId, BOOL bVisible, BOOL bSetFoc SfxChildWindow *pChildWin = pCW->pWin; if ( pChildWin ) { -// pCW->bCreate = bVisible; if ( bVisible ) { if ( pCW->pCli ) diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 66d4146d9e62..4635733b934d 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -109,6 +109,48 @@ static bool impl_loadBitmap( return false; } +/** loads the application logo as used in the about dialog and impress slideshow pause screen */ +Image SfxApplication::GetApplicationLogo() +{ + Image aAppLogo; + + rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); + bool bLoaded = false; + sal_Int32 nIndex = 0; + do + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + aAbouts.getToken( 0, ',', nIndex ), aAppLogo ); + } + while ( !bLoaded && ( nIndex >= 0 ) ); + + // fallback to "about.bmp" + if ( !bLoaded ) + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + } + + if ( !bLoaded ) + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + } + + return aAppLogo; +} + AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerStr ) : SfxModalDialog ( pParent, rId ), @@ -145,39 +187,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS } // load image from module path - rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); - bool bLoaded = false; - sal_Int32 nIndex = 0; - do - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - aAbouts.getToken( 0, ',', nIndex ), aAppLogo ); - } - while ( !bLoaded && ( nIndex >= 0 ) ); - - // fallback to "about.bmp" - if ( !bLoaded ) - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); - if ( !bLoaded ) - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); - } - - if ( !bLoaded ) - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); - if ( !bLoaded ) - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); - } + aAppLogo = SfxApplication::GetApplicationLogo(); // Transparenter Font Font aFont = GetFont(); diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index f1e100e17cf5..7f03bf416431 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -39,54 +39,24 @@ #define RID_DLG_ALIEN_WARNING ( RC_DIALOG_BEGIN + 0) #define STR_RESET ( RC_DIALOG_BEGIN + 0) -#define STR_BASEFMT ( RC_DIALOG_BEGIN + 1) -#define CB_USE_PASSWD ( RC_DIALOG_BEGIN + 2) -#define CB_READ_ONLY ( RC_DIALOG_BEGIN + 3) -#define BTN_MANAGER ( RC_DIALOG_BEGIN + 4) -#define BTN_STANDARD ( RC_DIALOG_BEGIN + 5) #define DLG_PASSWD ( RC_DIALOG_BEGIN + 8) -#define STR_FILEDLG_INSERT ( RC_DIALOG_BEGIN + 10) #define STR_TABPAGE_MANAGESTYLES ( RC_DIALOG_BEGIN + 12) #define MSG_TABPAGE_INVALIDNAME ( RC_DIALOG_BEGIN + 13) #define MSG_TABPAGE_INVALIDSTYLE ( RC_DIALOG_BEGIN + 14) #define DLG_NEW_STYLE_BY_EXAMPLE ( RC_DIALOG_BEGIN + 15) #define MSG_POOL_STYLE_NAME ( RC_DIALOG_BEGIN + 16) -#define MSG_OVERWRITE_STYLE ( RC_DIALOG_BEGIN + 17) #define MSG_TABPAGE_INVALIDPARENT ( RC_DIALOG_BEGIN + 18) #define STR_DELETE_STYLE ( RC_DIALOG_BEGIN + 18) #define STR_DELETE_STYLE_USED ( RC_DIALOG_BEGIN + 20) -#define LOGO_IMAGELIST ( RC_DIALOG_BEGIN + 45) #define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46) -#define MSG_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 49) -#define ACC_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 50) - -#define MSG_ERR_CANT_EDIT_OLD_FORMAT ( RC_DIALOG_BEGIN + 60 ) -#define MSG_ERR_CANT_EDIT_OPEN_DOCS ( RC_DIALOG_BEGIN + 61 ) - -#define RID_URLOPEN ( RC_DIALOG_BEGIN + 62 ) -#define RID_URLOPEN_OK 1 -#define RID_URLOPEN_CANCEL 2 -#define RID_URLOPEN_URL 3 - -#define CB_FILE ( RC_DIALOG_BEGIN + 63 ) -#define CB_URL ( RC_DIALOG_BEGIN + 64 ) - -#define STR_INTERNET ( RC_DIALOG_BEGIN + 65 ) -#define RID_AUTOHIDE ( RC_DIALOG_BEGIN + 66 ) - -#define DLG_ONLINE_REGISTER ( RC_DIALOG_BEGIN + 68 ) #define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 ) #define DLG_COMMENTS ( RC_DIALOG_BEGIN + 70 ) -#define RID_REGISTER_DLG ( RC_DIALOG_BEGIN + 73 ) -#define DLG_PHONE_CONFIGURATION ( RC_DIALOG_BEGIN + 74 ) -#define DLG_RECOGNIZER_ENGINEMODE ( RC_DIALOG_BEGIN + 75 ) #define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 ) -#define DLG_RECOGNIZER_SPEAKER ( RC_DIALOG_BEGIN + 77 ) #define STR_APPLY ( RC_DIALOG_BEGIN + 87 ) @@ -104,7 +74,6 @@ #define RID_DLG_SEARCH ( RC_DIALOG_BEGIN + 109 ) #define STR_PDF_EXPORT_SEND ( RC_DIALOG_BEGIN + 120 ) -#define STR_RECHECK_DOCUMENT ( RC_DIALOG_BEGIN + 121 ) #define IMG_INFO ( RC_DIALOG_BEGIN + 122 ) #define RID_EDIT_DURATIONS ( RC_DIALOG_BEGIN + 123 ) #define SFX_PB_EDIT ( RC_DIALOG_BEGIN + 124 ) diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index a54d2c340d04..c39425510ae2 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -31,30 +31,6 @@ #include "helpid.hrc" #include "sfxlocal.hrc" - // Imageliste fuer die AboutBox -ImageList LOGO_IMAGELIST -{ - Prefix = "an"; - MaskColor = Color - { - Red = 0xFFFF ; - Green = 0x0000 ; - Blue = 0xFFFF ; - }; - IdList = - { - 1 ; - 2 ; - 3 ; - 4 ; - 5 ; - 6 ; - }; - IdCount = - { - 6 ; - }; -}; String STR_RESET { Text [ en-US ] = "~Reset" ; @@ -63,48 +39,6 @@ String STR_APPLY { Text [ en-US ] = "Apply"; }; -String STR_INTERNET -{ - Text [ en-US ] = "(Internet)" ; -}; -String STR_BASEFMT -{ - Text [ en-US ] = "Base format" ; -}; -CheckBox CB_USE_PASSWD -{ - HelpId = HID_FILEDLG_USE_PASSWD ; - Text [ en-US ] = "~Password" ; -}; -CheckBox CB_READ_ONLY -{ - HelpId = HID_FILEDLG_READ_ONLY ; - Text [ en-US ] = "~Read-only" ; -}; -PushButton CB_FILE -{ - HelpId = HID_FILEDLG_FILE ; - Text [ en-US ] = "~File System" ; -}; -PushButton CB_URL -{ - HelpId = HID_FILEDLG_URL ; - Text [ en-US ] = "Int~ernet" ; -}; -PushButton BTN_MANAGER -{ - HelpId = HID_FILEDLG_MANAGER ; - Text [ en-US ] = "~Manager..." ; -}; -PushButton BTN_STANDARD -{ - HelpId = HID_FILEDLG_STANDARD ; - Text [ en-US ] = "~Home" ; -}; -String STR_FILEDLG_INSERT -{ - Text [ en-US ] = "Insert File" ; -}; String STR_TABPAGE_MANAGESTYLES { Text [ en-US ] = "Organizer" ; @@ -131,12 +65,6 @@ InfoBox MSG_POOL_STYLE_NAME { Message [ en-US ] = "Name already exists as a default Style.\nPlease choose another name." ; }; -QueryBox MSG_OVERWRITE_STYLE -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Style already exists. Overwrite?" ; -}; String STR_DELETE_STYLE { Text [ en-US ] = "Do you really want to delete Style $1?" ; @@ -170,87 +98,15 @@ Menu MN_CONTEXT_TEMPLDLG }; }; -InfoBox MSG_LAYOUT_NOT_LOADING -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "Loading document without layout." ; -}; -Accelerator ACC_LAYOUT_NOT_LOADING -{ - ItemList = - { - AcceleratorItem - { - Key = KeyCode - { - Code = KEY_L ; - Shift = FALSE ; Modifier1 = TRUE ; Modifier2 = TRUE ; - }; - Identifier = 1 ; - }; - }; -}; //------------------------------------------------------------------------ -ErrorBox MSG_ERR_CANT_EDIT_OLD_FORMAT -{ - Message [ en-US ] = "Cannot edit document info for documents\n in this file format." ; -}; - //------------------------------------------------------------------------ -ErrorBox MSG_ERR_CANT_EDIT_OPEN_DOCS -{ - Message [ en-US ] = "Document info of documents\n being currently edited cannot be modified from within the document manager." ; -}; -ModalDialog RID_URLOPEN -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 204 , 44 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Enter URL" ; - Moveable = TRUE ; - OKButton RID_URLOPEN_OK - { - Pos = MAP_APPFONT ( 148 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_URLOPEN_CANCEL - { - Pos = MAP_APPFONT ( 148 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Edit RID_URLOPEN_URL - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 16 ) ; - Size = MAP_APPFONT ( 138 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; -}; -Menu RID_AUTOHIDE -{ - ItemList = - { - MenuItem - { - Identifier = SID_AUTOHIDE ; - HelpID = SID_AUTOHIDE ; - Text [ en-US ] = "Hide" ; - }; - }; -}; -String RID_AUTOHIDE -{ - Text [ en-US ] = "Don't Hide" ; -}; String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; }; +String SID_TASKPANE +{ + Text [ en-US ] = "Task Pane"; +}; ErrorBox MSG_ERROR_WRONG_CONFIRM { @@ -264,11 +120,6 @@ String STR_PDF_EXPORT_SEND Text [ en-US ] = "Send" ; }; -String STR_RECHECK_DOCUMENT -{ - Text [ en-US ] = "Recheck Document" ; -}; - Image IMG_INFO { ImageBitmap = Bitmap diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 87ef0f1a7af1..3d0c53cdb932 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -45,7 +45,8 @@ EXCEPTIONSFILES=\ $(SLO)$/recfloat.obj \ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ - $(SLO)$/dockwin.obj + $(SLO)$/dockwin.obj \ + $(SLO)$/taskpane.obj SLOFILES =\ $(EXCEPTIONSFILES) \ @@ -60,7 +61,6 @@ SLOFILES =\ $(SLO)$/passwd.obj \ $(SLO)$/printopt.obj \ $(SLO)$/sfxdlg.obj \ - $(SLO)$/sfxurl.obj \ $(SLO)$/splitwin.obj \ $(SLO)$/srchdlg.obj \ $(SLO)$/styfitem.obj \ @@ -68,7 +68,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/titledockwin.obj SRS1NAME=$(TARGET) SRC1FILES =\ @@ -85,7 +86,9 @@ SRC1FILES =\ templdlg.src \ versdlg.src \ printopt.src \ - srchdlg.src + srchdlg.src \ + titledockwin.src \ + taskpane.src .IF "$(BUILD_VER_STRING)"!="" .IF "$(GUI)"=="UNX" @@ -102,9 +105,9 @@ CFLAGS+=-DBUILD_VER_STRING="$(subst,",\" "$(BUILD_VER_STRING)")" $(INCCOM)$/cuilib.hxx: makefile.mk .IF "$(GUI)"=="UNX" $(RM) $@ - echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@ + @echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@ .ELSE - echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ + @echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ .ENDIF $(SLO)$/sfxdlg.obj : $(INCCOM)$/cuilib.hxx diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx new file mode 100644 index 000000000000..f25485a1401c --- /dev/null +++ b/sfx2/source/dialog/taskpane.cxx @@ -0,0 +1,1283 @@ +/************************************************************************* + * 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/taskpane.hxx" +#include "imagemgr.hxx" +#include "sfx2/sfxsids.hrc" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfxresid.hxx" +#include "sfxlocal.hrc" +#include "helpid.hrc" + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ui/XToolPanel.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/awt/XControl.hpp> +/** === end UNO includes === **/ + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/types.hxx> +#include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/tablayouter.hxx> +#include <svtools/toolpanel/drawerlayouter.hxx> +#include <unotools/confignode.hxx> +#include <vcl/menu.hxx> +#include <vcl/svapp.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +#include <boost/noncopyable.hpp> + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::ui::XToolPanel; + using ::com::sun::star::ui::XUIElementFactory; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::graphic::XGraphicProvider; + using ::com::sun::star::graphic::XGraphic; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::awt::XControl; + /** === end UNO using === **/ + namespace PosSize = ::com::sun::star::awt::PosSize; + + //================================================================================================================== + //= helpers + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier, + const ::rtl::OUString& i_rResourceURL = ::rtl::OUString() ) + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::rtl::OUStringBuffer aPathComposer; + try + { + const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); + + const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); + + aPathComposer.appendAscii( "org.openoffice.Office.UI." ); + aPathComposer.append( sWindowStateRef ); + aPathComposer.appendAscii( "/UIElements/States" ); + if ( i_rResourceURL.getLength() ) + { + aPathComposer.appendAscii( "/" ); + aPathComposer.append( i_rResourceURL ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); + } + + //-------------------------------------------------------------------------------------------------------------- + ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) + { + ::rtl::OUString sModuleName; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XModuleManager > xModuleManager( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + sModuleName = xModuleManager->identify( i_rDocumentFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sModuleName; + } + + //-------------------------------------------------------------------------------------------------------------- + Reference< XFrame > lcl_getFrame( const SfxBindings* i_pBindings ) + { + const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); + const SfxFrame& rFrame = pViewFrame->GetFrame(); + const Reference< XFrame > xFrame( rFrame.GetFrameInterface() ); + return xFrame; + } + + //-------------------------------------------------------------------------------------------------------------- + ::rtl::OUString lcl_getPanelHelpURL( const ::utl::OConfigurationNode& i_rPanelConfigNode ) + { + const ::rtl::OUString sHelpURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "HelpURL" ) ) ); + return sHelpURL; + } + + //-------------------------------------------------------------------------------------------------------------- + Image lcl_getPanelImage( const Reference< XFrame >& i_rDocFrame, const ::utl::OConfigurationNode& i_rPanelConfigNode ) + { + const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) ); + if ( sImageURL.getLength() ) + { + try + { + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", sImageURL ); + + // special handling: if the ImageURL denotes a CommandName, then retrieve the image for that command + const sal_Char* pCommandImagePrefix = "private:commandimage/"; + const sal_Int32 nCommandImagePrefixLen = strlen( pCommandImagePrefix ); + if ( sImageURL.compareToAscii( pCommandImagePrefix, nCommandImagePrefixLen ) == 0 ) + { + ::rtl::OUStringBuffer aCommandName; + aCommandName.appendAscii( ".uno:" ); + aCommandName.append( sImageURL.copy( nCommandImagePrefixLen ) ); + const ::rtl::OUString sCommandName( aCommandName.makeStringAndClear() ); + + const BOOL bHiContrast( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); + const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, FALSE, bHiContrast ) ); + return aPanelImage.GetXGraphic(); + } + + // otherwise, delegate to the GraphicProvider + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + + const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW ); + return Image( xGraphic ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + return Image(); + } + } + + //================================================================================================================== + //= TaskPaneDockingWindow + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) + :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) + ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) ) + ,m_aPaneController( m_aTaskPane, *this ) + { + m_aTaskPane.Show(); + SetText( String( SfxResId( SID_TASKPANE ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneDockingWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + m_aPaneController.ActivateToolPanel( i_rPanelURL ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneDockingWindow::GetFocus() + { + TitledDockingWindow::GetFocus(); + m_aTaskPane.GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneDockingWindow::onLayoutDone() + { + m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); + } + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SFX_IMPL_DOCKINGWINDOW( TaskPaneWrapper, SID_TASKPANE ); + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) + :SfxChildWindow( i_pParent, i_nId ) + { + pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent, + WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); + eChildAlignment = SFX_ALIGN_RIGHT; + + pWindow->SetHelpId( HID_TASKPANE_WINDOW ); + pWindow->SetOutputSizePixel( Size( 300, 450 ) ); + pWindow->Show(); + + dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo ); + SetHideNotDelete( TRUE ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneWrapper::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + TaskPaneDockingWindow* pDockingWindow = dynamic_cast< TaskPaneDockingWindow* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pDockingWindow, "TaskPaneWrapper::ActivateToolPanel: invalid docking window implementation!" ); + pDockingWindow->ActivateToolPanel( i_rPanelURL ); + } + + //================================================================================================================== + //= CustomPanelUIElement + //================================================================================================================== + class CustomPanelUIElement + { + public: + CustomPanelUIElement() + :m_xUIElement() + ,m_xToolPanel() + ,m_xPanelWindow() + { + } + + CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement ) + :m_xUIElement( i_rUIElement, UNO_SET_THROW ) + ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW ) + ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ) + { + } + + bool is() const { return m_xPanelWindow.is(); } + + const Reference< XUIElement >& getUIElement() const { return m_xUIElement; } + const Reference< XToolPanel >& getToolPanel() const { return m_xToolPanel; } + const Reference< XWindow >& getPanelWindow() const { return m_xPanelWindow; } + + private: + Reference< XUIElement > m_xUIElement; + Reference< XToolPanel > m_xToolPanel; + Reference< XWindow > m_xPanelWindow; + }; + + //================================================================================================================== + //= CustomToolPanel + //================================================================================================================== + class CustomToolPanel : public ::svt::ToolPanelBase + { + public: + CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ); + + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual SmartId GetHelpID() const; + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); + virtual void Dispose(); + virtual Reference< XAccessible > + CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ); + + const ::rtl::OUString& + GetResourceURL() const { return m_sResourceURL; } + + protected: + ~CustomToolPanel(); + + private: + bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ); + void impl_updatePanelConfig( const bool i_bVisible ) const; + + private: + const ::rtl::OUString m_sUIName; + const Image m_aPanelImage; + const ::rtl::OUString m_aPanelHelpURL; + const ::rtl::OUString m_sResourceURL; + const ::rtl::OUString m_sPanelConfigPath; + Reference< XFrame > m_xFrame; + CustomPanelUIElement m_aCustomPanel; + bool m_bAttemptedCreation; + }; + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ) + :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) + ,m_aPanelImage( lcl_getPanelImage( i_rFrame, i_rPanelWindowState ) ) + ,m_aPanelHelpURL( lcl_getPanelHelpURL( i_rPanelWindowState ) ) + ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) + ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) + ,m_xFrame( i_rFrame ) + ,m_aCustomPanel() + ,m_bAttemptedCreation( false ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::~CustomToolPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool CustomToolPanel::impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ) + { + if ( m_bAttemptedCreation ) + return m_aCustomPanel.is(); + + m_bAttemptedCreation = true; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW ); + + ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( "Frame", makeAny( m_xFrame ) ); + aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) ); + + const Reference< XUIElement > xElement( + xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ), + UNO_SET_THROW ); + + m_aCustomPanel = CustomPanelUIElement( xElement ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return m_aCustomPanel.is(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::utl::OConfigurationTreeRoot aConfig( aContext, m_sPanelConfigPath, true ); + + aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) ); + aConfig.commit(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString CustomToolPanel::GetDisplayName() const + { + return m_sUIName; + } + + //------------------------------------------------------------------------------------------------------------------ + Image CustomToolPanel::GetImage() const + { + return m_aPanelImage; + } + + //------------------------------------------------------------------------------------------------------------------ + SmartId CustomToolPanel::GetHelpID() const + { + return SmartId( m_aPanelHelpURL ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Activate( Window& i_rParentWindow ) + { + ENSURE_OR_RETURN_VOID( impl_ensureToolPanelWindow( i_rParentWindow ), "no panel to activate!" ); + + // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is + // done now) hidden/shown + m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); + + // update the panel's configuration + impl_updatePanelConfig( true ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Deactivate() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); + + m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); + + // update the panel's configuration + impl_updatePanelConfig( false ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to position!" ); + + try + { + m_aCustomPanel.getPanelWindow()->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), + PosSize::POSSIZE ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::GrabFocus() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to focus!" ); + + m_aCustomPanel.getPanelWindow()->setFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Dispose() + { + if ( !m_bAttemptedCreation ) + // nothing to dispose + return; + + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to destroy!" ); + try + { + Reference< XComponent > xUIElementComponent( m_aCustomPanel.getUIElement(), UNO_QUERY_THROW ); + xUIElementComponent->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( m_aCustomPanel.is(), "no panel to ask!", NULL ); + + Reference< XAccessible > xPanelAccessible; + try + { + xPanelAccessible.set( m_aCustomPanel.getToolPanel()->createAccessible( i_rParentAccessible ), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xPanelAccessible; + } + + //================================================================================================================== + //= ModuleTaskPane_Impl + //================================================================================================================== + class ModuleTaskPane_Impl : public ::boost::noncopyable + { + public: + ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame, + const IToolPanelCompare* i_pPanelCompare ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) + ,m_xFrame( i_rDocumentFrame ) + ,m_aPanelDeck( i_rAntiImpl ) + { + m_aPanelDeck.Show(); + OnResize(); + impl_initFromConfiguration( i_pPanelCompare ); + } + + ~ModuleTaskPane_Impl() + { + } + + void OnResize(); + void OnGetFocus(); + + static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + + ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; } + const ::svt::ToolPanelDeck& GetPanelDeck() const { return m_aPanelDeck; } + + ::boost::optional< size_t > + GetPanelPos( const ::rtl::OUString& i_rResourceURL ); + ::rtl::OUString + GetPanelResourceURL( const size_t i_nPanelPos ) const; + + void SetDrawersLayout(); + void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + + private: + void impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare ); + + static bool + impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); + + DECL_LINK( OnActivatePanel, void* ); + + private: + ModuleTaskPane& m_rAntiImpl; + const ::rtl::OUString m_sModuleIdentifier; + const Reference< XFrame > m_xFrame; + ::svt::ToolPanelDeck m_aPanelDeck; + }; + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnResize() + { + m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnGetFocus() + { + m_aPanelDeck.GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg ) + { + m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); + return 1L; + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) + { + return i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare ) + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return; + + ::rtl::OUString sFirstVisiblePanelResource; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( !impl_isToolPanelResource( *resource ) ) + continue; + + ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); + ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); + + size_t nPanelPos = m_aPanelDeck.GetPanelCount(); + if ( i_pPanelCompare ) + { + // assuming that nobody will insert hundreths of panels, a simple O(n) search should suffice here ... + while ( nPanelPos > 0 ) + { + const short nCompare = i_pPanelCompare->compareToolPanelsURLs( + *resource, + GetPanelResourceURL( --nPanelPos ) + ); + if ( nCompare >= 0 ) + { + ++nPanelPos; + break; + } + } + } + nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos ); + + if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) + sFirstVisiblePanelResource = *resource; + } + + if ( sFirstVisiblePanelResource.getLength() ) + { + ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) ); + OSL_ENSURE( !!aPanelPos, "ModuleTaskPane_Impl::impl_isToolPanelResource: just inserted it, and it's not there?!" ); + if ( !!aPanelPos ) + m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( *aPanelPos ) ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return false; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( impl_isToolPanelResource( *resource ) ) + return true; + } + return false; + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const ::rtl::OUString& i_rResourceURL ) + { + ::boost::optional< size_t > aPanelPos; + for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i ) + { + const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) ); + const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); + ENSURE_OR_CONTINUE( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!" ); + if ( pCustomPanel->GetResourceURL() == i_rResourceURL ) + { + aPanelPos = i; + break; + } + } + return aPanelPos; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString ModuleTaskPane_Impl::GetPanelResourceURL( const size_t i_nPanelPos ) const + { + ENSURE_OR_RETURN( i_nPanelPos < m_aPanelDeck.GetPanelCount(), "ModuleTaskPane_Impl::GetPanelResourceURL: illegal panel position!", ::rtl::OUString() ); + const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i_nPanelPos ) ); + const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); + ENSURE_OR_RETURN( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!", ::rtl::OUString() ); + return pCustomPanel->GetResourceURL(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::SetDrawersLayout() + { + const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); + const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); + if ( pDrawerLayouter != NULL ) + // already have the proper layout + return; + m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); + ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); + if ( ( pTabLayouter != NULL ) + && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) + && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) + ) + // already have the requested layout + return; + + if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) + { + // changing only the item content does not require a new layouter instance + pTabLayouter->SetTabItemContent( i_eTabContent ); + return; + } + + m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) ); + } + + //================================================================================================================== + //= ModuleTaskPane + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame ) + :Window( &i_rParentWindow, WB_DIALOGCONTROL ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, NULL ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame, + const IToolPanelCompare& i_rCompare ) + :Window( &i_rParentWindow, WB_DIALOGCONTROL ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, &i_rCompare ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::~ModuleTaskPane() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( i_rModuleIdentifier ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::Resize() + { + Window::Resize(); + m_pImpl->OnResize(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::GetFocus() + { + Window::GetFocus(); + m_pImpl->OnGetFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() + { + return m_pImpl->GetPanelDeck(); + } + + //------------------------------------------------------------------------------------------------------------------ + const ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() const + { + return m_pImpl->GetPanelDeck(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > ModuleTaskPane::GetPanelPos( const ::rtl::OUString& i_rResourceURL ) + { + return m_pImpl->GetPanelPos( i_rResourceURL ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString ModuleTaskPane::GetPanelResourceURL( const size_t i_nPanelPos ) const + { + return m_pImpl->GetPanelResourceURL( i_nPanelPos ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::SetDrawersLayout() + { + m_pImpl->SetDrawersLayout(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + m_pImpl->SetTabsLayout( i_eTabAlignment, i_eTabContent ); + } + + // ===================================================================================================================== + // = PanelSelectorLayout + // ===================================================================================================================== + enum PanelSelectorLayout + { + LAYOUT_DRAWERS, + LAYOUT_TABS_RIGHT, + LAYOUT_TABS_LEFT, + LAYOUT_TABS_TOP, + LAYOUT_TABS_BOTTOM + }; + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment ) + { + switch ( i_eAlignment ) + { + case SFX_ALIGN_LEFT: + return LAYOUT_TABS_LEFT; + case SFX_ALIGN_TOP: + return LAYOUT_TABS_TOP; + case SFX_ALIGN_BOTTOM: + return LAYOUT_TABS_BOTTOM; + default: + return LAYOUT_TABS_RIGHT; + } + } + } + + // ===================================================================================================================== + // = PanelDescriptor + // ===================================================================================================================== + /** is a helper class for TaskPaneController_Impl, holding the details about a single panel which is not + contained in the IToolPanel implementation itself. + */ + struct PanelDescriptor + { + ::svt::PToolPanel pPanel; + bool bHidden; + + PanelDescriptor() + :pPanel() + ,bHidden( false ) + { + } + + PanelDescriptor( const ::svt::PToolPanel& i_rPanel ) + :pPanel( i_rPanel ) + ,bHidden( false ) + { + } + }; + + //================================================================================================================== + //= TaskPaneController_Impl + //================================================================================================================== + class TaskPaneController_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + TaskPaneController_Impl( + ModuleTaskPane& i_rTaskPane, + TitledDockingWindow& i_rDockingWindow + ); + ~TaskPaneController_Impl(); + + void SetDefaultTitle( const String& i_rTitle ); + void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); + + protected: + // IToolPanelDeckListener overridables + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + private: + DECL_LINK( OnToolboxClicked, ToolBox* ); + DECL_LINK( OnMenuItemSelected, Menu* ); + DECL_LINK( DockingChanged, TitledDockingWindow* ); + ::std::auto_ptr< PopupMenu > impl_createPopupMenu() const; + + /// sets the given layout for the panel selector + void impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false ); + + /// returns the current layout of the panel selector + PanelSelectorLayout + impl_getLayout() const { return m_eCurrentLayout; } + + void impl_updateDockingWindowTitle(); + void impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ); + size_t impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ); + + private: + enum MenuId + { + MID_UNLOCK_TASK_PANEL = 1, + MID_LOCK_TASK_PANEL = 2, + MID_LAYOUT_TABS = 3, + MID_LAYOUT_DRAWERS = 4, + MID_FIRST_PANEL = 5 + }; + + private: + typedef ::std::vector< PanelDescriptor > PanelDescriptors; + + ModuleTaskPane& m_rTaskPane; + TitledDockingWindow& m_rDockingWindow; + USHORT m_nViewMenuID; + PanelSelectorLayout m_eCurrentLayout; + PanelDescriptors m_aPanelRepository; + bool m_bTogglingPanelVisibility; + ::rtl::OUString m_sDefaultTitle; + }; + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController_Impl::TaskPaneController_Impl( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) + :m_rTaskPane( i_rTaskPane ) + ,m_rDockingWindow( i_rDockingWindow ) + ,m_nViewMenuID( 0 ) + ,m_eCurrentLayout( LAYOUT_DRAWERS ) + ,m_aPanelRepository() + ,m_bTogglingPanelVisibility( false ) + ,m_sDefaultTitle() + { + m_rDockingWindow.ResetToolBox(); + m_nViewMenuID = m_rDockingWindow.AddDropDownToolBoxItem( + String( SfxResId( STR_SFX_TASK_PANE_VIEW ) ), + HID_TASKPANE_VIEW_MENU, + LINK( this, TaskPaneController_Impl, OnToolboxClicked ) + ); + m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) ); + impl_setLayout( LAYOUT_DRAWERS, true ); + + m_rTaskPane.GetPanelDeck().AddListener( *this ); + + // initialize the panel repository + for ( size_t i = 0; i < m_rTaskPane.GetPanelDeck().GetPanelCount(); ++i ) + { + ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( i ) ); + m_aPanelRepository.push_back( PanelDescriptor( pPanel ) ); + } + + SetDefaultTitle( String( SfxResId( STR_SFX_TASKS ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController_Impl::~TaskPaneController_Impl() + { + m_rTaskPane.GetPanelDeck().RemoveListener( *this ); + + // remove the panels which are not under the control of the panel deck currently + for ( PanelDescriptors::iterator panelPos = m_aPanelRepository.begin(); + panelPos != m_aPanelRepository.end(); + ++panelPos + ) + { + if ( panelPos->bHidden ) + panelPos->pPanel->Dispose(); + } + m_aPanelRepository.clear(); + } + + // ----------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::SetDefaultTitle( const String& i_rTitle ) + { + m_sDefaultTitle = i_rTitle; + impl_updateDockingWindowTitle(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController_Impl::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + ::boost::optional< size_t > aPanelPos( m_rTaskPane.GetPanelPos( i_rPanelURL ) ); + ENSURE_OR_RETURN_VOID( !!aPanelPos, "TaskPaneController_Impl::ActivateToolPanel: no such panel!" ); + + if ( aPanelPos == m_rTaskPane.GetPanelDeck().GetActivePanel() ) + { + ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( *aPanelPos ) ); + pPanel->GrabFocus(); + } + else + { + m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos ); + } + } + + // ----------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, DockingChanged, TitledDockingWindow*, i_pDockingWindow ) + { + ENSURE_OR_RETURN( i_pDockingWindow && &m_rDockingWindow, "TaskPaneController_Impl::DockingChanged: where does this come from?", 0L ); + + if ( impl_getLayout() == LAYOUT_DRAWERS ) + return 0L; + + impl_setLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) ); + return 1L; + } + + // ----------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, OnToolboxClicked, ToolBox*, i_pToolBox ) + { + if ( i_pToolBox->GetCurItemId() == m_nViewMenuID ) + { + i_pToolBox->EndSelection(); + + ::std::auto_ptr< PopupMenu > pMenu = impl_createPopupMenu(); + pMenu->SetSelectHdl( LINK( this, TaskPaneController_Impl, OnMenuItemSelected ) ); + + // pass toolbox button rect so the menu can stay open on button up + Rectangle aMenuRect( i_pToolBox->GetItemRect( m_nViewMenuID ) ); + aMenuRect.SetPos( i_pToolBox->GetPosPixel() ); + pMenu->Execute( &m_rDockingWindow, aMenuRect, POPUPMENU_EXECUTE_DOWN ); + } + + return 0; + } + + // --------------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, OnMenuItemSelected, Menu*, i_pMenu ) + { + ENSURE_OR_RETURN( i_pMenu, "TaskPaneController_Impl::OnMenuItemSelected: illegal menu!", 0L ); + + i_pMenu->Deactivate(); + switch ( i_pMenu->GetCurItemId() ) + { + case MID_UNLOCK_TASK_PANEL: + m_rDockingWindow.SetFloatingMode( TRUE ); + break; + + case MID_LOCK_TASK_PANEL: + m_rDockingWindow.SetFloatingMode( FALSE ); + break; + + case MID_LAYOUT_DRAWERS: + impl_setLayout( LAYOUT_DRAWERS ); + break; + + case MID_LAYOUT_TABS: + impl_setLayout( lcl_getTabLayoutFromAlignment( m_rDockingWindow.GetAlignment() ) ); + break; + + default: + { + size_t nPanelIndex = size_t( i_pMenu->GetCurItemId() - MID_FIRST_PANEL ); + impl_togglePanelVisibility( nPanelIndex ); + } + break; + } + + return 1L; + } + + // --------------------------------------------------------------------------------------------------------------------- + size_t TaskPaneController_Impl::impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ) + { + size_t nLogicalIndex = 0; + size_t nVisibleIndex( i_nVisibleIndex ); + for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) + { + if ( !m_aPanelRepository[i].bHidden ) + { + if ( !nVisibleIndex ) + break; + --nVisibleIndex; + } + ++nLogicalIndex; + } + return nLogicalIndex; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + if ( m_bTogglingPanelVisibility ) + return; + + const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); + m_aPanelRepository.insert( m_aPanelRepository.begin() + nLogicalIndex, PanelDescriptor( i_pPanel ) ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::PanelRemoved( const size_t i_nPosition ) + { + if ( m_bTogglingPanelVisibility ) + return; + + const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); + m_aPanelRepository.erase( m_aPanelRepository.begin() + nLogicalIndex ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( impl_getLayout() == LAYOUT_DRAWERS ) + // no adjustment of the title when we use the classical "drawers" layout + return; + + impl_updateDockingWindowTitle( ); + (void)i_rOldActive; + (void)i_rNewActive; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::Dying() + { + OSL_ENSURE( false, "TaskPaneController_Impl::Dying: unexpected call!" ); + // We are expected to live longer than the ToolPanelDeck we work with. Since we remove ourself, in our dtor, + // as listener from the panel deck, this method here should never be called. + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ) + { + ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanelRepository.size(), "illegal index" ); + + // get the actual panel index, within the deck + size_t nActualPanelIndex(0); + for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) + { + if ( !m_aPanelRepository[i].bHidden ) + ++nActualPanelIndex; + } + + ::boost::optional< size_t > aActivatePanel; + + m_bTogglingPanelVisibility = true; + if ( m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden ) + { + OSL_VERIFY( m_rTaskPane.GetPanelDeck().InsertPanel( m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); + // if there has not been an active panel before, activate the newly inserted one + ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); + if ( !aActivePanel ) + aActivatePanel = nActualPanelIndex; + } + else + { + OSL_VERIFY( m_rTaskPane.GetPanelDeck().RemovePanel( nActualPanelIndex ).get() == m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel.get() ); + } + m_bTogglingPanelVisibility = false; + m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden = !m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden; + + if ( !!aActivatePanel ) + m_rTaskPane.GetPanelDeck().ActivatePanel( *aActivatePanel ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) + { + if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) + return; + + switch ( i_eLayout ) + { + case LAYOUT_DRAWERS: + m_rTaskPane.SetDrawersLayout(); + break; + case LAYOUT_TABS_TOP: + m_rTaskPane.SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_BOTTOM: + m_rTaskPane.SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_LEFT: + m_rTaskPane.SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_RIGHT: + m_rTaskPane.SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + break; + } + m_eCurrentLayout = i_eLayout; + + impl_updateDockingWindowTitle(); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_updateDockingWindowTitle() + { + ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); + if ( !aActivePanel || ( impl_getLayout() == LAYOUT_DRAWERS ) ) + m_rDockingWindow.SetTitle( m_sDefaultTitle ); + else + { + size_t nNewActive( *aActivePanel ); + for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) + { + if ( m_aPanelRepository[i].bHidden ) + continue; + + if ( !nNewActive ) + { + m_rDockingWindow.SetTitle( m_aPanelRepository[i].pPanel->GetDisplayName() ); + break; + } + --nNewActive; + } + } + } + + // --------------------------------------------------------------------------------------------------------------------- + ::std::auto_ptr< PopupMenu > TaskPaneController_Impl::impl_createPopupMenu() const + { + ::std::auto_ptr<PopupMenu> pMenu( new PopupMenu ); + FloatingWindow* pMenuWindow = static_cast< FloatingWindow* >( pMenu->GetWindow() ); + if ( pMenuWindow != NULL ) + { + pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + } + + // Add one entry for every tool panel element to individually make + // them visible or hide them. + USHORT nIndex = MID_FIRST_PANEL; + for ( size_t i=0; i<m_aPanelRepository.size(); ++i, ++nIndex ) + { + const PanelDescriptor& rPanelDesc( m_aPanelRepository[i] ); + pMenu->InsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); + pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); + } + pMenu->InsertSeparator(); + + #if OSL_DEBUG_LEVEL > 0 + pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_TABS, impl_getLayout() != LAYOUT_DRAWERS ); + pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_DRAWERS, impl_getLayout() == LAYOUT_DRAWERS ); + + pMenu->InsertSeparator(); + #endif + + // Add entry for docking or un-docking the tool panel. + if ( m_rDockingWindow.IsFloatingMode() ) + pMenu->InsertItem( + MID_LOCK_TASK_PANEL, + String( SfxResId( STR_SFX_DOCK ) ) + ); + else + pMenu->InsertItem( + MID_UNLOCK_TASK_PANEL, + String( SfxResId( STR_SFX_UNDOCK ) ) + ); + + pMenu->RemoveDisabledEntries( FALSE, FALSE ); + + return pMenu; + } + + //================================================================================================================== + //= TaskPaneController + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController::TaskPaneController( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) + :m_pImpl( new TaskPaneController_Impl( i_rTaskPane, i_rDockingWindow ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController::~TaskPaneController() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController::SetDefaultTitle( const String& i_rTitle ) + { + m_pImpl->SetDefaultTitle( i_rTitle ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + m_pImpl->ActivateToolPanel( i_rPanelURL ); + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/dialog/sfxurl.cxx b/sfx2/source/dialog/taskpane.src index 47e4062ac350..5a955e8587d1 100644 --- a/sfx2/source/dialog/sfxurl.cxx +++ b/sfx2/source/dialog/taskpane.src @@ -1,5 +1,4 @@ /************************************************************************* - * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. @@ -25,17 +24,24 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#include <sfx2/filedlghelper.hxx> -#include <sfxresid.hxx> -#include <dialog.hrc> +#include <sfx2/sfx.hrc> +#include "sfxlocal.hrc" + +String STR_SFX_DOCK +{ + Text [ en-US ] = "Dock"; +}; + +String STR_SFX_UNDOCK +{ + Text [ en-US ] = "Undock"; +}; -SfxUrlDialog::SfxUrlDialog( Window *pParent ) - : ModalDialog( pParent, SfxResId( RID_URLOPEN ) ), - aEdit( this, SfxResId(RID_URLOPEN_URL) ), - aOk( this, SfxResId(RID_URLOPEN_OK) ), - aCancel( this, SfxResId(RID_URLOPEN_CANCEL) ) +String STR_SFX_TASK_PANE_VIEW +{ + Text [ en-US ] = "View"; +}; +String STR_SFX_TASKS { - FreeResource(); -} + Text [ en-US ] = "Tasks"; +}; diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx new file mode 100644 index 000000000000..58a61d66ba8b --- /dev/null +++ b/sfx2/source/dialog/titledockwin.cxx @@ -0,0 +1,364 @@ +/************************************************************************* + * 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/titledockwin.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfxlocal.hrc" +#include "sfxresid.hxx" + +#include <svl/eitem.hxx> + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + //================================================================================================================== + //= TitledDockingWindow + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent, + WinBits i_nStyle ) + :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle ) + ,m_sTitle() + ,m_aToolbox( this ) + ,m_aContentWindow( this, WB_DIALOGCONTROL ) + ,m_aBorder( 3, 1, 3, 3 ) + ,m_bLayoutPending( false ) + { + impl_construct(); + } + + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent, + const ResId& i_rResId ) + :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_rResId ) + ,m_sTitle() + ,m_aToolbox( this ) + ,m_aContentWindow( this ) + ,m_aBorder( 3, 1, 3, 3 ) + ,m_bLayoutPending( false ) + { + impl_construct(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_construct() + { + SetBackground( Wallpaper() ); + + m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) ); + m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT ); + m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) ); + m_aToolbox.Show(); + impl_resetToolBox(); + + m_aContentWindow.Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::~TitledDockingWindow() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::SetTitle( const String& i_rTitle ) + { + m_sTitle = i_rTitle; + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + String TitledDockingWindow::GetTitle() const + { + return impl_getTitle(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::SetText( const String& i_rText ) + { + SfxDockingWindow::SetText( i_rText ); + if ( m_sTitle.Len() == 0 ) + // our text is used as title, too => repaint + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::Resize() + { + SfxDockingWindow::Resize(); + impl_scheduleLayout(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::onLayoutDone() + { + // not interested in + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_scheduleLayout() + { + m_bLayoutPending = true; + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_layout() + { + m_bLayoutPending = false; + + m_aToolbox.ShowItem( 1, !IsFloatingMode() ); + + const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() ); + Size aWindowSize( GetOutputSizePixel() ); + + // position the tool box + int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() ); + if ( aToolBoxSize.Height() > nTitleBarHeight ) + nTitleBarHeight = aToolBoxSize.Height(); + m_aToolbox.SetPosSizePixel( + Point( + aWindowSize.Width() - aToolBoxSize.Width(), + ( nTitleBarHeight - aToolBoxSize.Height() ) / 2 + ), + aToolBoxSize + ); + + // Place the content window. + if ( nTitleBarHeight < aToolBoxSize.Height() ) + nTitleBarHeight = aToolBoxSize.Height(); + aWindowSize.Height() -= nTitleBarHeight; + m_aContentWindow.SetPosSizePixel( + Point( m_aBorder.Left(), nTitleBarHeight + m_aBorder.Top() ), + Size( + aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(), + aWindowSize.Height() - m_aBorder.Top() - m_aBorder.Bottom() + ) + ); + + onLayoutDone(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::Paint( const Rectangle& i_rArea ) + { + if ( m_bLayoutPending ) + impl_layout(); + + SfxDockingWindow::Paint( i_rArea ); + + Push( PUSH_FONT | PUSH_FILLCOLOR | PUSH_LINECOLOR ); + + int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() ); + const Size aToolBoxSize = m_aToolbox.CalcWindowSizePixel(); + if ( aToolBoxSize.Height() > nTitleBarHeight ) + nTitleBarHeight = aToolBoxSize.Height(); + + SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + SetLineColor(); + + // bold font + Font aFont( GetFont() ); + aFont.SetWeight( WEIGHT_BOLD ); + SetFont( aFont ); + + // Set border values. + Size aWindowSize( GetOutputSizePixel() ); + int nOuterLeft = 0; + int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1; + int nOuterRight = aWindowSize.Width() - 1; + int nInnerRight = nOuterRight - m_aBorder.Right() + 1; + int nInnerTop = nTitleBarHeight + m_aBorder.Top() - 1; + int nOuterBottom = aWindowSize.Height() - 1; + int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1; + + // Paint title bar background. + Rectangle aTitleBarBox( Rectangle( + nOuterLeft, + 0, + nOuterRight, + nInnerTop-1 + ) ); + DrawRect( aTitleBarBox ); + + if ( nInnerLeft > nOuterLeft ) + DrawRect( Rectangle( nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom ) ); + if ( nOuterRight > nInnerRight ) + DrawRect( Rectangle( nInnerRight, nInnerTop, nOuterRight, nInnerBottom ) ); + if ( nInnerBottom < nOuterBottom ) + DrawRect( Rectangle( nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom ) ); + + // Paint bevel border. + SetFillColor(); + SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); + if ( m_aBorder.Top() > 0 ) + DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerLeft, nInnerBottom ) ); + if ( m_aBorder.Left() > 0 ) + DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerRight, nInnerTop ) ); + + SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); + if ( m_aBorder.Bottom() > 0 ) + DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerLeft, nInnerBottom ) ); + if ( m_aBorder.Right() > 0 ) + DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerRight, nInnerTop ) ); + + // Paint title bar text. + SetLineColor( GetSettings().GetStyleSettings().GetActiveTextColor() ); + aTitleBarBox.Left() += 3; + DrawText( aTitleBarBox, impl_getTitle(), TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + + // Restore original values of the output device. + Pop(); + } + + //------------------------------------------------------------------------------------------------------------------ + String TitledDockingWindow::impl_getTitle() const + { + return m_sTitle.Len() ? m_sTitle : GetText(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_resetToolBox() + { + m_aToolbox.Clear(); + + // Get the closer bitmap and set it as right most button. + Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) ); + Image aImageHC( SfxResId( SFX_IMG_CLOSE_DOC_HC ) ); + m_aToolbox.InsertItem( 1, + GetSettings().GetStyleSettings().GetHighContrastMode() + ? aImageHC + : aImage + ); + m_aToolbox.ShowItem( 1 ); + } + + //------------------------------------------------------------------------------------------------------------------ + USHORT TitledDockingWindow::impl_addDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback ) + { + // Add the menu before the closer button. + const USHORT nItemCount( m_aToolbox.GetItemCount() ); + const USHORT nItemId( nItemCount + 1 ); + m_aToolbox.InsertItem( nItemId, i_rItemText, TIB_DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND ); + m_aToolbox.SetHelpId( nItemId, i_nHelpId ); + m_aToolbox.SetClickHdl( i_rCallback ); + m_aToolbox.SetDropdownClickHdl( i_rCallback ); + + // The tool box has likely changed its size. The title bar has to be + // resized. + impl_scheduleLayout(); + Invalidate(); + + return nItemId; + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( TitledDockingWindow, OnToolboxItemSelected, ToolBox*, pToolBox ) + { + const USHORT nId = pToolBox->GetCurItemId(); + + if ( nId == 1 ) + { + // the closer + EndTracking(); + const sal_uInt16 nChildWindowId( GetChildWindow_Impl()->GetType() ); + const SfxBoolItem aVisibility( nChildWindowId, FALSE ); + GetBindings().GetDispatcher()->Execute( + nChildWindowId, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + &aVisibility, + NULL + ); + } + + return 0; + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::StateChanged( StateChangedType i_nType ) + { + switch ( i_nType ) + { + case STATE_CHANGE_INITSHOW: + impl_scheduleLayout(); + break; + } + SfxDockingWindow::StateChanged( i_nType ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::EndDocking( const Rectangle& i_rRect, BOOL i_bFloatMode ) + { + SfxDockingWindow::EndDocking( i_rRect, i_bFloatMode ); + + if ( m_aEndDockingHdl.IsSet() ) + m_aEndDockingHdl.Call( this ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::DataChanged( const DataChangedEvent& i_rDataChangedEvent ) + { + SfxDockingWindow::DataChanged( i_rDataChangedEvent ); + + switch ( i_rDataChangedEvent.GetType() ) + { + case DATACHANGED_SETTINGS: + if ( ( i_rDataChangedEvent.GetFlags() & SETTINGS_STYLE ) == 0) + break; + // else fall through. + case DATACHANGED_FONTS: + case DATACHANGED_FONTSUBSTITUTION: + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + // Font. + Font aFont = rStyleSettings.GetAppFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + // Color. + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = rStyleSettings.GetButtonTextColor(); + SetTextColor( aColor ); + SetTextFillColor(); + + impl_scheduleLayout(); + Invalidate(); + } + break; + } + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/view/view.hxx b/sfx2/source/dialog/titledockwin.src index 20e542d90bc7..3f52e84ab75d 100644 --- a/sfx2/source/view/view.hxx +++ b/sfx2/source/dialog/titledockwin.src @@ -1,5 +1,4 @@ /************************************************************************* - * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. @@ -25,3 +24,16 @@ * ************************************************************************/ +#include <sfx2/sfx.hrc> +#include "sfxlocal.hrc" + +Image SFX_IMG_CLOSE_DOC +{ + ImageBitmap = Bitmap { File = "closedoc.png" ; }; +}; + +Image SFX_IMG_CLOSE_DOC_HC +{ + ImageBitmap = Bitmap { File = "closedochc.png" ; }; +}; + diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b1b69e5ac74f..1a51bee5024f 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -33,6 +33,8 @@ #include <vos/mutex.hxx> #include <vcl/svapp.hxx> // solarmutex +#include <rtl/random.h> + #include <boost/bind.hpp> #include <memory> @@ -401,14 +403,16 @@ template< typename T > /*static*/ ::rtl::OUString create_id(const ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) { + static rtlRandomPool s_Pool( rtl_random_createPool() ); const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) ); typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > ::const_iterator iter; ::rtl::OUString id; do { - const int n( rand() ); - id = prefix + ::rtl::OUString::valueOf(static_cast<sal_Int64>(n)); + sal_Int32 n; + rtl_random_getBytes(s_Pool, & n, sizeof(n)); + id = prefix + ::rtl::OUString::valueOf(static_cast<sal_Int32>(abs(n))); iter = i_rXmlIdMap.find(id); } while (iter != i_rXmlIdMap.end()); @@ -1488,8 +1492,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, } } -::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndo( - const bool i_isDelete) +::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndo() const { OSL_ENSURE(!IsInUndo(), "CreateUndo called for object in undo?"); OSL_ENSURE(!IsInClipboard(), "CreateUndo called for object in clipboard?"); @@ -1503,11 +1506,6 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, pRegDoc->CreateUndo(*this) ); pRegDoc->RegisterCopy(*this, *pUndo, false); pUndo->m_pReg = pRegDoc; - - if (i_isDelete) - { - RemoveMetadataReference(); - } return pUndo; } } @@ -1518,6 +1516,13 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, return ::boost::shared_ptr<MetadatableUndo>(); } +::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndoForDelete() +{ + ::boost::shared_ptr<MetadatableUndo> const pUndo( CreateUndo() ); + RemoveMetadataReference(); + return pUndo; +} + void Metadatable::RestoreMetadata( ::boost::shared_ptr<MetadatableUndo> const& i_pUndo) { @@ -1624,15 +1629,16 @@ MetadatableMixin::getMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->GetMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->GetMetadataReference(); } void SAL_CALL @@ -1641,30 +1647,32 @@ MetadatableMixin::setMetadataReference( throw (uno::RuntimeException, lang::IllegalArgumentException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->SetMetadataReference(i_rReference); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->SetMetadataReference(i_rReference); } void SAL_CALL MetadatableMixin::ensureMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->EnsureMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->EnsureMetadataReference(); } } // namespace sfx2 diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index f46f3583cfd8..14474dd2904d 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -38,7 +38,6 @@ #include "com/sun/star/util/XModifiable.hpp" #include "com/sun/star/xml/sax/XSAXSerializable.hpp" -#include "com/sun/star/lang/NullPointerException.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/EventObject.hpp" #include "com/sun/star/beans/XPropertySet.hpp" @@ -248,25 +247,21 @@ public: const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage > & Storage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); // ::com::sun::star::lang::XInitialization: virtual void SAL_CALL initialize( @@ -1869,8 +1864,7 @@ SfxDocumentMetaData::loadFromStorage( const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" @@ -1882,10 +1876,10 @@ SfxDocumentMetaData::loadFromStorage( xStorage->openStreamElement( ::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::READ) ); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference<css::io::XInputStream> xInStream = xStream->getInputStream(); - if (!xInStream.is()) throw css::lang::NullPointerException(); + if (!xInStream.is()) throw css::uno::RuntimeException(); // create DOM parser service css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( @@ -1949,8 +1943,7 @@ SfxDocumentMetaData::storeToStorage( const css::uno::Reference< css::embed::XStorage > & xStorage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::storeToStorage:" @@ -1966,7 +1959,7 @@ SfxDocumentMetaData::storeToStorage( xStorage->openStreamElement(::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::WRITE | css::embed::ElementModes::TRUNCATE); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference< css::beans::XPropertySet > xStreamProps(xStream, css::uno::UNO_QUERY_THROW); xStreamProps->setPropertyValue( @@ -1980,7 +1973,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::makeAny(static_cast<sal_Bool> (sal_False))); css::uno::Reference<css::io::XOutputStream> xOutStream = xStream->getOutputStream(); - if (!xOutStream.is()) throw css::lang::NullPointerException(); + if (!xOutStream.is()) throw css::uno::RuntimeException(); css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference<css::io::XActiveDataSource> xSaxWriter( @@ -2028,8 +2021,7 @@ void SAL_CALL SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { css::uno::Reference<css::io::XInputStream> xIn; ::comphelper::MediaDescriptor md(Medium); @@ -2063,7 +2055,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, css::uno::makeAny(e)); } if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::loadFromMedium: cannot get Storage"), *this); } @@ -2074,8 +2066,7 @@ void SAL_CALL SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { ::comphelper::MediaDescriptor md(Medium); if (!URL.equalsAscii("")) { @@ -2087,7 +2078,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::storeToMedium: cannot get Storage"), *this); } diff --git a/sfx2/source/doc/commitlistener.cxx b/sfx2/source/doc/commitlistener.cxx deleted file mode 100644 index 9ca11a9eef82..000000000000 --- a/sfx2/source/doc/commitlistener.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * 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 "commitlistener.hxx" - -using namespace ::com::sun::star; - -OChildCommitListen_Impl::OChildCommitListen_Impl( SfxBaseModel& aModel ) -: m_pModel( &aModel ) -{} - -OChildCommitListen_Impl::~OChildCommitListen_Impl() -{} - -void OChildCommitListen_Impl::OwnerIsDisposed() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pModel = NULL; -} - -void SAL_CALL OChildCommitListen_Impl::preCommit( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::commited( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - // StorageIsModified_Impl must not contain any locking! - if ( m_pModel ) - m_pModel->StorageIsModified_Impl(); -} - -void SAL_CALL OChildCommitListen_Impl::preRevert( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::reverted( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - - -void SAL_CALL OChildCommitListen_Impl::disposing( const lang::EventObject& ) - throw ( uno::RuntimeException ) -{ - // not interesting -} - diff --git a/sfx2/source/doc/commitlistener.hxx b/sfx2/source/doc/commitlistener.hxx deleted file mode 100644 index 572da034cef1..000000000000 --- a/sfx2/source/doc/commitlistener.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 __COMMITLISTENER_HXX_ -#define __COMMITLISTENER_HXX_ - -#include <com/sun/star/embed/XTransactionListener.hpp> -#include <cppuhelper/implbase1.hxx> -#include <osl/mutex.hxx> - -#include <sfx2/sfxbasemodel.hxx> - -class OChildCommitListen_Impl : public ::cppu::WeakImplHelper1 < ::com::sun::star::embed::XTransactionListener > -{ - ::osl::Mutex m_aMutex; - SfxBaseModel* m_pModel; - -public: - OChildCommitListen_Impl( SfxBaseModel& aStorage ); - virtual ~OChildCommitListen_Impl(); - - void OwnerIsDisposed(); - - virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif - diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 6696b7670c63..298da13be147 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -133,7 +133,6 @@ using namespace ::com::sun::star::io; #include <unotools/saveopt.hxx> #include <svl/documentlockfile.hxx> -#include "opostponedtruncationstream.hxx" #include "helper.hxx" #include <sfx2/request.hxx> // SFX_ITEMSET_SET #include <sfx2/app.hxx> // GetFilterMatcher diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..24f2f359607f 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -836,9 +836,16 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aAdjustToType; - // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format - if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) && - ( bSetStandardName || GetStorable()->hasLocation() )) + if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) + { + // it is export, set the preselected filter + ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString() ); + pFileDlg->SetCurrentFilter( aFilterUIName ); + } + // it is no export, bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format + else if ( bSetStandardName || GetStorable()->hasLocation() ) { uno::Sequence< beans::PropertyValue > aOldFilterProps; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( @@ -1238,6 +1245,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // parse the slot name sal_Int8 nStoreMode = getStoreModeFromSlotName( aSlotName ); + sal_Int8 nStatusSave = STATUS_NO_ACTION; // handle the special cases if ( nStoreMode & SAVEAS_REQUESTED ) @@ -1259,7 +1267,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& else if ( nStoreMode & SAVE_REQUESTED ) { // if saving is not acceptable by the configuration the warning must be shown - sal_Int8 nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE ); + nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE ); if ( nStatusSave == STATUS_NO_ACTION ) throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT ); @@ -1273,32 +1281,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& { throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT ); } - else if ( nStatusSave == STATUS_SAVE ) - { - // Document properties can contain streams that should be freed before storing - aModelData.FreeDocumentProps(); - - if ( aModelData.GetStorable2().is() ) - { - try - { - aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); - } - catch( lang::IllegalArgumentException& ) - { - OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); - aModelData.GetStorable()->store(); - } - } - else - { - OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" ); - aModelData.GetStorable()->store(); - } - - return sal_False; - } - else + else if ( nStatusSave != STATUS_SAVE ) { // this should be a usual SaveAs operation nStoreMode = SAVEAS_REQUESTED; @@ -1325,6 +1308,32 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& } } + if ( nStoreMode & SAVE_REQUESTED && nStatusSave == STATUS_SAVE ) + { + // Document properties can contain streams that should be freed before storing + aModelData.FreeDocumentProps(); + + if ( aModelData.GetStorable2().is() ) + { + try + { + aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); + } + catch( lang::IllegalArgumentException& ) + { + OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); + aModelData.GetStorable()->store(); + } + } + else + { + OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" ); + aModelData.GetStorable()->store(); + } + + return sal_False; + } + // preselect a filter for the storing process uno::Sequence< beans::PropertyValue > aFilterProps = aModelData.GetPreselectedFilter_Impl( nStoreMode ); @@ -1419,13 +1428,13 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& ::rtl::OUString aSelFilterName = aModelData.GetMediaDescr().getUnpackedValueOrDefault( aFilterNameString, ::rtl::OUString() ); - sal_Int8 nStatusSave = aModelData.CheckFilter( aSelFilterName ); - if ( nStatusSave == STATUS_SAVEAS_STANDARDNAME ) + sal_Int8 nStatusFilterSave = aModelData.CheckFilter( aSelFilterName ); + if ( nStatusFilterSave == STATUS_SAVEAS_STANDARDNAME ) { // switch to best filter bSetStandardName = sal_True; } - else if ( nStatusSave == STATUS_SAVE ) + else if ( nStatusFilterSave == STATUS_SAVE ) { // user confirmed alien filter or "good" filter is used bExit = sal_True; @@ -1570,8 +1579,10 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( uno::Reference< container::XEnumeration > xFilterEnum = xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest ); - // use the first filter that is found + // the first default filter will be taken, + // if there is no filter with flag default the first acceptable filter will be taken if ( xFilterEnum.is() ) + { while ( xFilterEnum->hasMoreElements() ) { uno::Sequence< beans::PropertyValue > aProps; @@ -1582,11 +1593,17 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { - aFilterProps = aProps; - break; + if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT ) + { + aFilterProps = aProps; + break; + } + else if ( !aFilterProps.getLength() ) + aFilterProps = aProps; } } } + } return aFilterProps; } diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 7da456ebaa36..b766921e346b 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -75,7 +75,6 @@ SLOFILES = \ $(SLO)$/objembed.obj\ $(SLO)$/graphhelp.obj \ $(SLO)$/QuerySaveDocument.obj \ - $(SLO)$/opostponedtruncationstream.obj \ $(SLO)$/docinsert.obj \ $(SLO)$/docmacromode.obj \ $(SLO)$/SfxDocumentMetaData.obj \ diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 7d931cb6c640..628c3b020c08 100644..100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1681,7 +1681,7 @@ namespace } ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL, - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError ) { OSL_TRACE( "in CallXScript" ); ErrCode nErr = ERRCODE_NONE; @@ -1722,7 +1722,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon nErr = ERRCODE_BASIC_INTERNAL_ERROR; } - if ( bCaughtException ) + if ( bCaughtException && bRaiseError ) { ::std::auto_ptr< VclAbstractDialog > pScriptErrDlg; SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -1745,10 +1745,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& - aOutParam) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + , bool bRaiseError ) { - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam ); + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError ); } //------------------------------------------------------------------------- diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6d8deb85b687..6e1d89f2a8cd 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2548,6 +2548,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // is a new medium "from scratch", so no version should be stored into it SfxItemSet* pSet = new SfxAllItemSet(*pRetrMedium->GetItemSet()); pSet->ClearItem( SID_VERSION ); + pSet->ClearItem( SID_DOC_BASEURL ); // create a medium as a copy; this medium is only for writingm, because it uses the same name as the original one // writing is done through a copy, that will be transferred to the target ( of course after calling HandsOff ) @@ -2833,6 +2834,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl pMergedParams->ClearItem( SID_STREAM ); pMergedParams->ClearItem( SID_CONTENT ); pMergedParams->ClearItem( SID_DOC_READONLY ); + pMergedParams->ClearItem( SID_DOC_BASEURL ); pMergedParams->ClearItem( SID_REPAIRPACKAGE ); diff --git a/sfx2/source/doc/opostponedtruncationstream.cxx b/sfx2/source/doc/opostponedtruncationstream.cxx deleted file mode 100644 index 84b1d6a3906a..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.cxx +++ /dev/null @@ -1,491 +0,0 @@ -/************************************************************************* - * - * 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 <osl/diagnose.h> - -#include <opostponedtruncationstream.hxx> - -using namespace ::com::sun::star; - -// ======================================================================== -struct PTFStreamData_Impl -{ - uno::Reference< ucb::XSimpleFileAccess > m_xFileAccess; - sal_Bool m_bDelete; - ::rtl::OUString m_aURL; - - // the streams below are not visible from outside so there is no need to remember position - - // original stream related members - uno::Reference< io::XStream > m_xOrigStream; - uno::Reference< io::XTruncate > m_xOrigTruncate; - uno::Reference< io::XSeekable > m_xOrigSeekable; - uno::Reference< io::XInputStream > m_xOrigInStream; - uno::Reference< io::XOutputStream > m_xOrigOutStream; - - sal_Bool m_bInOpen; - sal_Bool m_bOutOpen; - - sal_Bool m_bPostponedTruncate; - - - PTFStreamData_Impl( - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - sal_Bool bDelete, - const ::rtl::OUString& aURL, - const uno::Reference< io::XStream >& xOrigStream, - const uno::Reference< io::XTruncate >& xOrigTruncate, - const uno::Reference< io::XSeekable >& xOrigSeekable, - const uno::Reference< io::XInputStream >& xOrigInStream, - const uno::Reference< io::XOutputStream >& xOrigOutStream ) - : m_xFileAccess( xFileAccess ) - , m_bDelete( bDelete ) - , m_aURL( aURL ) - , m_xOrigStream( xOrigStream ) - , m_xOrigTruncate( xOrigTruncate ) - , m_xOrigSeekable( xOrigSeekable ) - , m_xOrigInStream( xOrigInStream ) - , m_xOrigOutStream( xOrigOutStream ) - , m_bInOpen( sal_False ) - , m_bOutOpen( sal_False ) - , m_bPostponedTruncate( sal_True ) - {} - - void NoPostponing() - { - m_bDelete = sal_False; - m_bPostponedTruncate = sal_False; - } -}; - -// ======================================================================== -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/, - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - const uno::Reference< io::XStream >& xOrigStream, - sal_Bool bDelete ) -: m_pStreamData( NULL ) -{ - if ( !xFileAccess.is() || !xOrigStream.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XTruncate > xOrigTruncate( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XSeekable > xOrigSeekable( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XInputStream > xOrigInStream = xOrigStream->getInputStream(); - uno::Reference< io::XOutputStream > xOrigOutStream = xOrigStream->getOutputStream(); - if ( !xOrigInStream.is() || !xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData = new PTFStreamData_Impl( xFileAccess, bDelete, aURL, - xOrigStream, xOrigTruncate, xOrigSeekable, xOrigInStream, xOrigOutStream ); -} - -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::~OPostponedTruncationFileStream() -{ - CloseAll_Impl(); -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CloseAll_Impl() -{ - if ( m_pStreamData ) - { - sal_Bool bDelete = m_pStreamData->m_bDelete; - ::rtl::OUString aURL = m_pStreamData->m_aURL; - uno::Reference< ucb::XSimpleFileAccess > xFileAccess = m_pStreamData->m_xFileAccess; - - delete m_pStreamData; - m_pStreamData = NULL; - - if ( bDelete && xFileAccess.is() && aURL.getLength() ) - { - // delete the file - try - { - xFileAccess->kill( aURL ); - } catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Could not remove the file!" ); - } - } - } -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CheckScheduledTruncation_Impl() -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - m_pStreamData->NoPostponing(); - } -} - -// com::sun::star::io::XStream -// ------------------------------------------------------------------------ -uno::Reference< io::XInputStream > SAL_CALL OPostponedTruncationFileStream::getInputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bInOpen = sal_True; - return static_cast< io::XInputStream* >( this ); -} - - -// ------------------------------------------------------------------------ -uno::Reference< io::XOutputStream > SAL_CALL OPostponedTruncationFileStream::getOutputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bOutOpen = sal_True; - return static_cast< io::XOutputStream* >( this ); -} - - - -// com::sun::star::io::XInputStream -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nBytesToRead ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nMaxBytesToRead ); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::skipBytes( ::sal_Int32 nBytesToSkip ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - if ( nBytesToSkip > 0 ) - throw io::BufferSizeExceededException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigInStream->skipBytes( nBytesToSkip ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::available( ) - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->available(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeInput() - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bInOpen = sal_False; - if ( !m_pStreamData->m_bOutOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XOutputStream -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - // writing method must check the truncation - CheckScheduledTruncation_Impl(); - - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->writeBytes( aData ); -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::flush( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - { - OSL_ENSURE( sal_False, "flush() call on closed stream!\n" ); - return; - // in future throw exception, for now some code might call flush() on closed stream - // since file ucp implementation allows it - // throw io::NotConnectedException(); - } - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // it is no writing call, thus must be ignored - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->flush(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeOutput( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bOutOpen = sal_False; - if ( !m_pStreamData->m_bInOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XTruncate -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::truncate( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the truncation is already scheduled, ignore - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - } -} - - - -// com::sun::star::io::XSeekable -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::seek( ::sal_Int64 location ) - throw (lang::IllegalArgumentException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - if ( location > 0 ) - throw lang::IllegalArgumentException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigSeekable->seek( location ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getPosition( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getPosition(); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getLength( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getLength(); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::waitForCompletion() - throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - return; - - uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor( m_pStreamData->m_xOrigOutStream, uno::UNO_QUERY ); - if ( asyncOutputMonitor.is() ) - asyncOutputMonitor->waitForCompletion(); -} - diff --git a/sfx2/source/doc/opostponedtruncationstream.hxx b/sfx2/source/doc/opostponedtruncationstream.hxx deleted file mode 100644 index fe67319fbbe0..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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 _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX -#define _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XSeekable.hpp> -#include <com/sun/star/io/XTruncate.hpp> -#include <com/sun/star/io/XStream.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -#include <com/sun/star/io/XAsyncOutputMonitor.hpp> -#include <osl/mutex.hxx> -#include <cppuhelper/implbase6.hxx> -#include "sfx2/dllapi.h" - -//================================================================== -// OPostponedTruncationFileStream -// -// Allows to get stream access to a file, where the first truncation -// of the file is postponed till the first writing. If no writing happens -// after the first truncation/creation, it has no effect. ( The postponing of -// the creation can be switched off during initialization. Here the postponing -// of the creation means that the file will be created immediatelly, but -// if nothing is written into it, it will be removed during destruction -// of the object. ) -// -// On creation of this object the target file is scheduled for -// creation/truncation. But the action happens only during the first -// write access. After the first write access the object behaves -// itself as the original stream. -//================================================================== - -struct PTFStreamData_Impl; -class SFX2_DLLPUBLIC OPostponedTruncationFileStream - : public ::cppu::WeakImplHelper6 < - ::com::sun::star::io::XStream, - ::com::sun::star::io::XInputStream, - ::com::sun::star::io::XOutputStream, - ::com::sun::star::io::XTruncate, - ::com::sun::star::io::XSeekable, - ::com::sun::star::io::XAsyncOutputMonitor > -{ - ::osl::Mutex m_aMutex; - PTFStreamData_Impl* m_pStreamData; - - void CloseAll_Impl(); - - void CheckScheduledTruncation_Impl(); - -public: - - OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, - sal_Bool bDelete ); - - ~OPostponedTruncationFileStream(); - -// com::sun::star::io::XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XInputStream - virtual ::sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( ::sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XOutputStream - virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XTruncate - virtual void SAL_CALL truncate( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XSeekable - virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::io::XAsyncOutputMonitor - virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -}; - -#endif //_SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - - diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 459a142b9129..2cd195976832 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -266,17 +266,23 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // object already disposed? ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // Printer beschaffen - SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; - if ( !pViewFrm ) - return uno::Sequence< beans::PropertyValue >(); + // search for any view of this document that is currently printing + const Printer *pPrinter = NULL; + SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; + SfxViewFrame* pFirst = pViewFrm; + while ( pViewFrm && !pPrinter ) + { + pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, sal_False ); + } + + // if no view is printing currently, use the permanent SfxPrinter instance + if ( !pPrinter && pFirst ) + pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True); - const SfxPrinter *pPrinter = pViewFrm->GetViewShell()->GetPrinter(sal_True); if ( !pPrinter ) return uno::Sequence< beans::PropertyValue >(); - // Printer Eigenschaften uebertragen uno::Sequence< beans::PropertyValue > aPrinter(8); aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" ); diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 29ad461d18da..848446a774e9 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -330,7 +330,8 @@ #define HID_CONFIG_SAVE (HID_SFX_START + 310) #define HID_SEARCHDIALOG (HID_SFX_START + 311) - +#define HID_TASKPANE_WINDOW (HID_SFX_START + 312) +#define HID_TASKPANE_VIEW_MENU (HID_SFX_START + 313) #define HID_XMLSEC_WARNING_BROKENSIGNATURE (HID_SFX_START + 314) #define HID_XMLSEC_QUERY_LOSINGSIGNATURE (HID_SFX_START + 315) #define HID_XMLSEC_QUERY_SAVEBEFORESIGN (HID_SFX_START + 316) diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index fb21cb0ab13c..202ed6f6f00f 100644 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -44,6 +44,10 @@ #define STR_SFX_EXPLORERFILE_BUTTONINSERT (RID_SFX_SFXLOCAL_START + 4) #define STR_SFX_IMPORT_ALL (RID_SFX_SFXLOCAL_START + 5) #define STR_SFX_EXPLORERFILE_EXPORT (RID_SFX_SFXLOCAL_START + 6) +#define STR_SFX_DOCK (RID_SFX_SFXLOCAL_START + 7) +#define STR_SFX_UNDOCK (RID_SFX_SFXLOCAL_START + 8) +#define STR_SFX_TASK_PANE_VIEW (RID_SFX_SFXLOCAL_START + 9) +#define STR_SFX_TASKS (RID_SFX_SFXLOCAL_START + 10) // Controls -------------------------------------------------------------- @@ -55,13 +59,17 @@ #define SFX_PB_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 5) #define SFX_WIN_PROPERTY_YESNO (RID_SFX_SFXLOCAL_START + 6) #define SFX_QB_WRONG_TYPE (RID_SFX_SFXLOCAL_START + 7) -#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 8) -#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 9) #define SFX_FLD_DATE (RID_SFX_SFXLOCAL_START + 10) #define SFX_FLD_TIME (RID_SFX_SFXLOCAL_START + 11) #define SFX_FLD_DURATION (RID_SFX_SFXLOCAL_START + 12) #define SFX_ST_DURATION_FORMAT (RID_SFX_SFXLOCAL_START + 13) +// Images ---------------------------------------------------------------- + +#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 0) +#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 1) +#define SFX_IMG_CLOSE_DOC (RID_SFX_SFXLOCAL_START + 2) +#define SFX_IMG_CLOSE_DOC_HC (RID_SFX_SFXLOCAL_START + 3) #endif diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index ae005d1bad88..a82b72bc2947 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -365,6 +365,7 @@ public: void SetActiveChild_Impl( Window *pChild ); Window* GetActiveChild_Impl(); virtual BOOL ActivateNextChild_Impl( BOOL bForward = TRUE ); + bool AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const; // Methoden f"ur StatusBar void SetTempStatusBar_Impl( BOOL bSet ); diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index 5460d613c7e8..abe4cb6852d9 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -31,6 +31,8 @@ #include <svtools/asynclink.hxx> #include <vcl/window.hxx> +#include <boost/optional.hpp> + struct SfxViewFrame_Impl { SvBorder aBorder; @@ -56,6 +58,8 @@ struct SfxViewFrame_Impl sal_Bool bWindowWasEnabled:1; sal_Bool bActive; String aFactoryName; + ::boost::optional< bool > + aHasToolPanels; SfxViewFrame_Impl( SfxFrame& i_rFrame ) : rFrame( i_rFrame ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 66af0d7ac8ba..189c9a8aae0e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -44,6 +44,7 @@ #endif #include <unotools/moduleoptions.hxx> #include <svl/intitem.hxx> +#include <svl/visitem.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <svl/slstitm.hxx> @@ -94,6 +95,8 @@ #include <svtools/asynclink.hxx> #include <svl/sharecontrolfile.hxx> +#include <boost/optional.hpp> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; @@ -108,6 +111,7 @@ namespace css = ::com::sun::star; // wg. ViewFrame::Current #include "appdata.hxx" +#include <sfx2/taskpane.hxx> #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include "openflag.hxx" @@ -169,6 +173,19 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= //------------------------------------------------------------------------- +namespace +{ + bool moduleHasToolPanels( SfxViewFrame_Impl& i_rViewFrameImpl ) + { + if ( !i_rViewFrameImpl.aHasToolPanels ) + { + i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels( + i_rViewFrameImpl.rFrame.GetFrameInterface() ) ); + } + return *i_rViewFrameImpl.aHasToolPanels; + } +} +//------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { pImp->bIsDowning = sal_True; @@ -3294,6 +3311,22 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); } + else if ( nSID == SID_TASKPANE ) + { + if ( !KnowsChildWindow( nSID ) ) + { + OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); + rState.DisableItem( nSID ); + } + else if ( !moduleHasToolPanels( *pImp ) ) + { + rState.Put( SfxVisibilityItem( nSID, sal_False ) ); + } + else + { + rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); + } + } else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); else @@ -3381,3 +3414,37 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) { SFX_APP()->SetViewFrame_Impl( pFrame ); } + +// --------------------------------------------------------------------------------------------------------------------- +void SfxViewFrame::ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + // look up the SfxFrame for the given XFrame + SfxFrame* pFrame = NULL; + for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) + { + if ( pFrame->GetFrameInterface() == i_rFrame ) + break; + } + SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : NULL; + ENSURE_OR_RETURN_VOID( pViewFrame != NULL, "SfxViewFrame::ActivateToolPanel: did not find an SfxFrame for the given XFrame!" ); + + pViewFrame->ActivateToolPanel_Impl( i_rPanelURL ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ) +{ + // ensure the task pane is visible + ENSURE_OR_RETURN_VOID( KnowsChildWindow( SID_TASKPANE ), "SfxViewFrame::ActivateToolPanel: this frame/module does not allow for a task pane!" ); + if ( !HasChildWindow( SID_TASKPANE ) ) + ToggleChildWindow( SID_TASKPANE ); + + SfxChildWindow* pTaskPaneChildWindow = GetChildWindow( SID_TASKPANE ); + ENSURE_OR_RETURN_VOID( pTaskPaneChildWindow, "SfxViewFrame::ActivateToolPanel_Impl: just switched it on, but it is not there!" ); + + ::sfx2::ITaskPaneToolPanelAccess* pPanelAccess = dynamic_cast< ::sfx2::ITaskPaneToolPanelAccess* >( pTaskPaneChildWindow ); + ENSURE_OR_RETURN_VOID( pPanelAccess, "SfxViewFrame::ActivateToolPanel_Impl: task pane child window does not implement a required interface!" ); + pPanelAccess->ActivateToolPanel( i_rPanelURL ); +} diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 69ce837fb023..1c9e219cf180 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -30,20 +30,16 @@ // include --------------------------------------------------------------- -#ifndef __SBX_SBXOBJ_HXX #include <basic/sbxobj.hxx> -#endif #include <sfx2/viewsh.hxx> #include <sfx2/viewfrm.hxx> // SvBorder #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.hxx> - #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <svtools/acceleratorexecute.hxx> - #include <rtl/ref.hxx> - +#include <vcl/print.hxx> #include <queue> // forward --------------------------------------------------------------- @@ -54,24 +50,6 @@ class SfxBaseController; typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) -// struct SfxViewShell_Impl ---------------------------------------------- -#if 0 -class SfxAsyncPrintExec_Impl : public SfxListener -{ - SfxViewShell* pView; - ::std::queue < SfxRequest*> aReqs; - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -public: - SfxAsyncPrintExec_Impl( SfxViewShell* pShell) - : pView( pShell ) - {} - - void AddRequest( SfxRequest& rReq ); -}; -#endif - class SfxClipboardChangeListener; struct SfxViewShell_Impl @@ -95,9 +73,9 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; -// SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; + vcl::PrinterController* pPrinterController; SfxViewShell_Impl(); }; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 2d5403b72abd..4d9016d81f6b 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -329,6 +329,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt if ( m_bNeedsChange ) mpObjectShell->EnableSetModified( m_bOrigStatus ); + + if ( mpViewShell ) + mpViewShell->pImp->pPrinterController = 0; } } @@ -639,6 +642,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); + pImp->pPrinterController = pController.get(); + SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) ); @@ -653,6 +658,11 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer::PrintJob( pController, aJobSetup ); } +Printer* SfxViewShell::GetActivePrinter() const +{ + return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; +} + void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // USHORT nCopies=1; diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src index 72b178b2d629..bbea19100df9 100644 --- a/sfx2/util/hidother.src +++ b/sfx2/util/hidother.src @@ -165,3 +165,4 @@ hidspecial HID_DID_SAVE_PACKED_XML { HelpID = HID_DID_SAVE_PACKED_X hidspecial HID_HELP_ONHELP { HelpID = HID_HELP_ONHELP; }; hidspecial HID_HELP_TEXT_SELECTION_MODE { HelpID = HID_HELP_TEXT_SELECTION_MODE; }; hidspecial HID_DLG_CHECKFORONLINEUPDATE { HelpID = HID_DLG_CHECKFORONLINEUPDATE; }; +hidspecial HID_TASKPANE_VIEW_MENU { HelpID = HID_TASKPANE_VIEW_MENU; };
\ No newline at end of file diff --git a/sfx2/win/res/expdesk.ico b/sfx2/win/res/expdesk.ico Binary files differdeleted file mode 100644 index 06fb6e712e89..000000000000 --- a/sfx2/win/res/expdesk.ico +++ /dev/null diff --git a/sfx2/win/res/expexp.ico b/sfx2/win/res/expexp.ico Binary files differdeleted file mode 100644 index e0643765f605..000000000000 --- a/sfx2/win/res/expexp.ico +++ /dev/null diff --git a/sfx2/win/res/expfld.ico b/sfx2/win/res/expfld.ico Binary files differdeleted file mode 100644 index aeefecbdad51..000000000000 --- a/sfx2/win/res/expfld.ico +++ /dev/null diff --git a/sfx2/win/res/expftp.ico b/sfx2/win/res/expftp.ico Binary files differdeleted file mode 100644 index e1a442067d35..000000000000 --- a/sfx2/win/res/expftp.ico +++ /dev/null diff --git a/sfx2/win/res/exptrash.ico b/sfx2/win/res/exptrash.ico Binary files differdeleted file mode 100644 index 5c3e956863c3..000000000000 --- a/sfx2/win/res/exptrash.ico +++ /dev/null diff --git a/sfx2/win/res/expwork.ico b/sfx2/win/res/expwork.ico Binary files differdeleted file mode 100644 index 93fe39c7a492..000000000000 --- a/sfx2/win/res/expwork.ico +++ /dev/null diff --git a/sfx2/win/res/frameset.ico b/sfx2/win/res/frameset.ico Binary files differdeleted file mode 100644 index c9546f1e4d40..000000000000 --- a/sfx2/win/res/frameset.ico +++ /dev/null diff --git a/sfx2/win/res/search.ico b/sfx2/win/res/search.ico Binary files differdeleted file mode 100644 index 13e96131e3b8..000000000000 --- a/sfx2/win/res/search.ico +++ /dev/null diff --git a/sfx2/workben/custompanel/CalcWindowState.xcu b/sfx2/workben/custompanel/CalcWindowState.xcu new file mode 100644 index 000000000000..2f224f32aa77 --- /dev/null +++ b/sfx2/workben/custompanel/CalcWindowState.xcu @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<oor:component-data oor:name="CalcWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="UIElements"> + <node oor:name="States"> + <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/0000FF" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Soylent Blue</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ImageURL" oor:type="xs:string"> + <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/sfx2/workben/custompanel/DrawWindowState.xcu b/sfx2/workben/custompanel/DrawWindowState.xcu new file mode 100644 index 000000000000..3c0992bc4871 --- /dev/null +++ b/sfx2/workben/custompanel/DrawWindowState.xcu @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<oor:component-data oor:name="DrawWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="UIElements"> + <node oor:name="States"> + <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FFFF00" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Soylent Yellow</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ImageURL" oor:type="xs:string"> + <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/sfx2/workben/custompanel/Factories.xcu b/sfx2/workben/custompanel/Factories.xcu new file mode 100644 index 000000000000..f8df23e9f40a --- /dev/null +++ b/sfx2/workben/custompanel/Factories.xcu @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<oor:component-data oor:name="Factories" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="Registered"> + <node oor:name="UIElementFactories"> + <node oor:name="org.openoffice.example.CustomToolPanel" oor:op="replace"> + <prop oor:name="Type"> + <value>toolpanel</value> + </prop> + <prop oor:name="Name"> + <value>org.openoffice.example.colorpanel</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="FactoryImplementation"> + <value>org.openoffice.example.colorpanel.ToolPanelFactory</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/sfx2/workben/custompanel/ImpressWindowState.xcu b/sfx2/workben/custompanel/ImpressWindowState.xcu new file mode 100644 index 000000000000..0fc1bb9d40c8 --- /dev/null +++ b/sfx2/workben/custompanel/ImpressWindowState.xcu @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<oor:component-data oor:name="ImpressWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="UIElements"> + <node oor:name="States"> + <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FFCC99" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Soylent Orange</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ImageURL" oor:type="xs:string"> + <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu new file mode 100644 index 000000000000..f1edd4a12881 --- /dev/null +++ b/sfx2/workben/custompanel/WriterWindowState.xcu @@ -0,0 +1,35 @@ +<?xml version='1.0' encoding='UTF-8'?> +<oor:component-data oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="UIElements"> + <node oor:name="States"> + <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/00FF00" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Soylent Green</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ImageURL" oor:type="xs:string"> + <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value> + </prop> + </node> + <node oor:name="private:resource/toolpanel/org.openoffice.example.colorpanel/FF0000" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Soylent Red</value> + </prop> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="ImageURL" oor:type="xs:string"> + <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <value>vnd.sun.star.help://UPDATED_IDENTIFIER/colorpanel</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx new file mode 100644 index 000000000000..54880cc5fcc7 --- /dev/null +++ b/sfx2/workben/custompanel/ctp_factory.cxx @@ -0,0 +1,167 @@ +/************************************************************************* + * 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 "ctp_factory.hxx" +#include "ctp_panel.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/NotInitializedException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/XComponent.hpp> +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::lang::NotInitializedException; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::container::NoSuchElementException; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::awt::XWindow; + /** === end UNO using === **/ + + //================================================================================================================== + //= ToolPanelFactory + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelFactory::~ToolPanelFactory() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.colorpanel/" ) ) ) + throw NoSuchElementException( i_rResourceURL, *this ); + + const ::rtl::OUString sColor( i_rResourceURL.copy( i_rResourceURL.lastIndexOf( '/' ) + 1 ) ); + const sal_Int32 nPanelColor = sColor.toInt32( 16 ); + + // retrieve the parent window + Reference< XWindow > xParentWindow; + const PropertyValue* pArg = i_rArgs.getConstArray(); + const PropertyValue* pArgEnd = i_rArgs.getConstArray() + i_rArgs.getLength(); + for ( ; pArg != pArgEnd; ++pArg ) + { + if ( pArg->Name.equalsAscii( "ParentWindow" ) ) + { + xParentWindow.set( pArg->Value, UNO_QUERY ); + break; + } + } + if ( !xParentWindow.is() ) + { + OSL_ENSURE( false, "ToolPanelFactory::createUIElement: no parent window in the args!" ); + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No parent window provided in the creation arguments. Cannot create tool panel." ) ), + *this, + 2 + ); + } + + /// create the panel + Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, nPanelColor ) ); + return xUIElement; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException) + { + return getImplementationName_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName_static( ) throw (RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.example.custompanel.ToolPanelFactory" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) + { + const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); + for ( const ::rtl::OUString* serviceName = aServiceNames.getConstArray(); + serviceName != aServiceNames.getConstArray() + aServiceNames.getLength(); + ++serviceName + ) + { + if ( i_rServiceName == *serviceName ) + return sal_True; + } + return sal_False; + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames() throw (RuntimeException) + { + return getSupportedServiceNames_static(); + } + + //------------------------------------------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames_static() throw (RuntimeException) + { + Sequence< ::rtl::OUString > aServiceNames(1); + aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.example.colorpanel.ToolPanelFactory" ) ); + return aServiceNames; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL ToolPanelFactory::Create( const Reference< XComponentContext >& i_rContext ) throw (RuntimeException) + { + return *( new ToolPanelFactory( i_rContext ) ); + } + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sfx2/workben/custompanel/ctp_factory.hxx b/sfx2/workben/custompanel/ctp_factory.hxx new file mode 100644 index 000000000000..8a359f59caaf --- /dev/null +++ b/sfx2/workben/custompanel/ctp_factory.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * 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 SD_WORKBENCH_CTP_FACTORY_HXX +#define SD_WORKBENCH_CTP_FACTORY_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/basemutex.hxx> + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + class FactoryGuard; + + //================================================================================================================== + //= ToolPanelFactory + //================================================================================================================== + typedef ::cppu::WeakImplHelper2 < ::com::sun::star::ui::XUIElementFactory + , ::com::sun::star::lang::XServiceInfo + > ToolPanelFactory_Base; + class ToolPanelFactory :public ::cppu::BaseMutex + ,public ToolPanelFactory_Base + { + public: + ToolPanelFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext + ); + ~ToolPanelFactory(); + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& i_rResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rArgs ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::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); + + // XServiceInfo - static versions + static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ) throw (::com::sun::star::uno::RuntimeException); + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_FACTORY_HXX diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx new file mode 100644 index 000000000000..ee94287bedbf --- /dev/null +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -0,0 +1,270 @@ +/************************************************************************* + * 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 "ctp_panel.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/WindowClass.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/awt/XGraphics.hpp> +#include <com/sun/star/ui/UIElementType.hpp> +/** === end UNO includes === **/ + +#include <tools/diagnose_ex.h> + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::awt::XWindowPeer; + using ::com::sun::star::lang::XMultiComponentFactory; + using ::com::sun::star::awt::XToolkit; + using ::com::sun::star::awt::WindowDescriptor; + using ::com::sun::star::awt::WindowClass_SIMPLE; + using ::com::sun::star::awt::Rectangle; + using ::com::sun::star::awt::PaintEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::awt::XDevice; + using ::com::sun::star::awt::XGraphics; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::frame::XFrame; + /** === end UNO using === **/ + namespace WindowAttribute = ::com::sun::star::awt::WindowAttribute; + namespace PosSize = ::com::sun::star::awt::PosSize; + namespace UIElementType = ::com::sun::star::ui::UIElementType; + + //================================================================================================================== + //= helpers + //================================================================================================================== + namespace + { + Reference< XWindow > lcl_createPlainWindow_nothrow( const Reference< XComponentContext >& i_rContext, + const Reference< XWindowPeer >& i_rParentWindow ) + { + try + { + ENSURE_OR_THROW( i_rContext.is(), "illegal component context" ); + Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW ); + Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), + i_rContext + ), UNO_QUERY_THROW ); + + WindowDescriptor aWindow; + aWindow.Type = WindowClass_SIMPLE; + aWindow.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "window" ) ); + aWindow.Parent = i_rParentWindow; + aWindow.WindowAttributes = WindowAttribute::BORDER; + + Reference< XWindowPeer > xWindow( xToolkit->createWindow( aWindow ), UNO_SET_THROW ); + return Reference< XWindow >( xWindow, UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } + } + //================================================================================================================== + //= class SingleColorPanel + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, const ::sal_Int32 i_nPanelColor ) + :SingleColorPanel_Base( m_aMutex ) + ,m_xWindow() + ,m_nPanelColor( i_nPanelColor ) + { + // retrieve the parent window for our to-be-created pane window + Reference< XWindowPeer > xParentPeer( i_rParentWindow, UNO_QUERY ); + + osl_incrementInterlockedCount( &m_refCount ); + if ( xParentPeer.is() ) + { + m_xWindow = lcl_createPlainWindow_nothrow( i_rContext, xParentPeer ); + m_xWindow->addPaintListener( this ); + if ( m_xWindow.is() ) + { + const Rectangle aPanelAnchorSize( i_rParentWindow->getPosSize() ); + m_xWindow->setPosSize( 0, 0, aPanelAnchorSize.Width, aPanelAnchorSize.Height, PosSize::POSSIZE ); + m_xWindow->setVisible( sal_True ); + } + } + osl_decrementInterlockedCount( &m_refCount ); + } + + //------------------------------------------------------------------------------------------------------------------ + SingleColorPanel::~SingleColorPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL SingleColorPanel::getWindow() throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); + return m_xWindow; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL SingleColorPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + throw DisposedException( ::rtl::OUString(), *this ); + + // TODO: the following is wrong, since it doesn't respect i_rParentAccessible. In a real extension, you should + // implement this correctly :) + (void)i_rParentAccessible; + return Reference< XAccessible >( getWindow(), UNO_QUERY ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::windowPaint( const PaintEvent& i_rEvent ) throw (RuntimeException) + { + try + { + const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW ); + const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW ); + xGraphics->setFillColor( m_nPanelColor ); + xGraphics->setLineColor( 0x00FFFFFF ); + + const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW ); + const Rectangle aWindowRect( xWindow->getPosSize() ); + xGraphics->drawRect( 0, 0, aWindowRect.Width - 1, aWindowRect.Height - 1 ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing( const EventObject& i_rSource ) throw (RuntimeException) + { + (void)i_rSource; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SingleColorPanel::disposing() + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() ) + // already disposed + return; + m_xWindow->removePaintListener( this ); + try + { + Reference< XComponent > xWindowComp( m_xWindow, UNO_QUERY_THROW ); + xWindowComp->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + m_xWindow.clear(); + } + + //================================================================================================================== + //= PanelUIElement + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelUIElement::PanelUIElement( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, + const ::rtl::OUString& i_rResourceURL, const ::sal_Int32 i_nPanelColor ) + :PanelUIElement_Base( m_aMutex ) + ,m_sResourceURL( i_rResourceURL ) + ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow, i_nPanelColor ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + PanelUIElement::~PanelUIElement() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XFrame > SAL_CALL PanelUIElement::getFrame() throw (RuntimeException) + { + // TODO + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL PanelUIElement::getResourceURL() throw (RuntimeException) + { + return m_sResourceURL; + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Int16 SAL_CALL PanelUIElement::getType() throw (RuntimeException) + { + return UIElementType::TOOLPANEL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XInterface > SAL_CALL PanelUIElement::getRealInterface( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xToolPanel.is() ) + throw DisposedException(); + return m_xToolPanel; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL PanelUIElement::disposing() + { + Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW ); + m_xToolPanel.clear(); + xPanelComponent->dispose(); + } + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx new file mode 100644 index 000000000000..39c46c9d93a5 --- /dev/null +++ b/sfx2/workben/custompanel/ctp_panel.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * 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 SD_WORKBENCH_CTP_PANEL_HXX +#define SD_WORKBENCH_CTP_PANEL_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/ui/XToolPanel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/awt/XPaintListener.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <boost/scoped_ptr.hpp> + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + //================================================================================================================== + //= SingleColorPanel + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::ui::XToolPanel + , ::com::sun::star::awt::XPaintListener + > SingleColorPanel_Base; + class SingleColorPanel :public ::cppu::BaseMutex + ,public SingleColorPanel_Base + { + public: + SingleColorPanel( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, + const ::sal_Int32 i_nPanelColor + ); + + // XToolPanel + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ) throw (::com::sun::star::uno::RuntimeException); + + // XPaintListener + virtual void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent equivalents + virtual void SAL_CALL disposing(); + + protected: + ~SingleColorPanel(); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; + const sal_Int32 m_nPanelColor; + }; + + //================================================================================================================== + //= PanelUIElement + //================================================================================================================== + typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement + > PanelUIElement_Base; + class PanelUIElement :public ::cppu::BaseMutex + ,public PanelUIElement_Base + { + public: + PanelUIElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow, + const ::rtl::OUString& i_rResourceURL, + const ::sal_Int32 i_nPanelColor + ); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + protected: + ~PanelUIElement(); + + private: + const ::rtl::OUString m_sResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > + m_xToolPanel; + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +#endif // SD_WORKBENCH_CTP_PANEL_HXX diff --git a/sfx2/workben/custompanel/ctp_services.cxx b/sfx2/workben/custompanel/ctp_services.cxx new file mode 100644 index 000000000000..4164e8bc1629 --- /dev/null +++ b/sfx2/workben/custompanel/ctp_services.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * 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 "ctp_factory.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implementationentry.hxx> + +//...................................................................................................................... +namespace sd { namespace colortoolpanel +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + /** === end UNO using === **/ + + //================================================================================================================== + //= descriptors for the services implemented in this component + //================================================================================================================== + static struct ::cppu::ImplementationEntry s_aServiceEntries[] = + { + { + ToolPanelFactory::Create, + ToolPanelFactory::getImplementationName_static, + ToolPanelFactory::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, NULL, 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; + +//...................................................................................................................... +} } // namespace sd::colortoolpanel +//...................................................................................................................... + +extern "C" +{ + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) + { + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::sd::colortoolpanel::s_aServiceEntries ); + } + + //------------------------------------------------------------------------------------------------------------------ + void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + { + return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries ); + } +} diff --git a/sfx2/workben/custompanel/delzip b/sfx2/workben/custompanel/delzip new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sfx2/workben/custompanel/delzip diff --git a/sfx2/workben/custompanel/description.xml b/sfx2/workben/custompanel/description.xml new file mode 100644 index 000000000000..7b85d64eaf69 --- /dev/null +++ b/sfx2/workben/custompanel/description.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<description + xmlns="http://openoffice.org/extensions/description/2006" + xmlns:d="http://openoffice.org/extensions/description/2006" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <identifier value="UPDATED_IDENTIFIER"/> + <version value="0.1" /> + <platform value="UPDATED_SUPPORTED_PLATFORM" /> + <display-name> + <name lang="en-US">Custom Tool Panel Example</name> + </display-name> + <dependencies> + <OpenOffice.org-minimal-version value="3.3" d:name="OpenOffice.org 3.3"/> + </dependencies> +</description> diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk new file mode 100644 index 000000000000..1eb20ceed35d --- /dev/null +++ b/sfx2/workben/custompanel/makefile.mk @@ -0,0 +1,120 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sfx2 + +TARGET=custompanel +ENABLE_EXCEPTIONS=TRUE +LIBTARGET=NO +EXTENSIONNAME:=custom-tool-panel + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +#------------------------------------------------------------------- + +#---- extension version +EXTENSION_VERSION_BASE=0.1 +.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" ) + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) +.ELSE + EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP) +.ENDIF + +#---- extension title package name +EXTENSION_TITLE=Custom Tool Panel Example +EXTENSION_ZIPNAME=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l) + +#-------------------------------------------------- + +SHL1DLLPRE= +SHL1TARGET=$(TARGET).uno +LIB1TARGET=$(SLB)/$(SHL1TARGET).lib +LIB1OBJFILES= \ + $(SLO)/ctp_factory.obj \ + $(SLO)/ctp_services.obj \ + $(SLO)/ctp_panel.obj + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(CPPUHELPERLIB) + +SHL1VERSIONMAP=$(SOLARSRC)/solenv/src/component.map +SHL1LIBS= $(LIB1TARGET) +SHL1DEF= $(MISC)/$(SHL1TARGET).def +SHL1RPATH= OXT +DEF1NAME= $(SHL1TARGET) + +# create Extension ----------------------------- + +COMPONENT_CONFIGDEST=. + +COMPONENT_XCU = \ + $(EXTENSIONDIR)/WriterWindowState.xcu \ + $(EXTENSIONDIR)/CalcWindowState.xcu \ + $(EXTENSIONDIR)/DrawWindowState.xcu \ + $(EXTENSIONDIR)/ImpressWindowState.xcu \ + $(EXTENSIONDIR)/Factories.xcu + +COMPONENT_LIBRARIES = \ + $(EXTENSIONDIR)/$(SHL1TARGET)$(DLLPOST) + +COMPONENT_IMAGES= \ + $(EXTENSIONDIR)/panel.png + +# ........ dependencies for packaging the extension ........ +EXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES) + +# --- Targets ------------------------------------------------------ +.INCLUDE : extension_pre.mk +.INCLUDE : target.mk +.INCLUDE : extension_post.mk + +$(EXTENSIONDIR)/%.png : ./%.png + @@-$(MKDIRHIER) $(@:d) + @$(COPY) $< $@ > $(NULLDEV) + +$(EXTENSIONDIR)/WriterWindowState.xcu: ./WriterWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./WriterWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/WriterWindowState.xcu + +$(EXTENSIONDIR)/CalcWindowState.xcu: ./CalcWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./CalcWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/CalcWindowState.xcu + +$(EXTENSIONDIR)/DrawWindowState.xcu: ./DrawWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./DrawWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/DrawWindowState.xcu + +$(EXTENSIONDIR)/ImpressWindowState.xcu: ./ImpressWindowState.xcu + @@-$(MKDIRHIER) $(@:d) + $(COMMAND_ECHO)$(TYPE) ./ImpressWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/ImpressWindowState.xcu + diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml new file mode 100644 index 000000000000..9122d16a4189 --- /dev/null +++ b/sfx2/workben/custompanel/manifest.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd"> +<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest"> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native" + manifest:full-path="custompanel.unoSHARED_EXTENSION"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="WriterWindowState.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="CalcWindowState.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="DrawWindowState.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="ImpressWindowState.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="Factories.xcu"/> + <!-- <manifest:file-entry manifest:media-type="image/png" + manifest:full-path="panel.png"/>--> +</manifest:manifest> diff --git a/sfx2/workben/custompanel/panel.png b/sfx2/workben/custompanel/panel.png Binary files differnew file mode 100644 index 000000000000..2438714af8a6 --- /dev/null +++ b/sfx2/workben/custompanel/panel.png |