diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/sfx2 | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/sfx2')
116 files changed, 19546 insertions, 0 deletions
diff --git a/include/sfx2/DocumentMetadataAccess.hxx b/include/sfx2/DocumentMetadataAccess.hxx new file mode 100644 index 000000000000..d81401266ac3 --- /dev/null +++ b/include/sfx2/DocumentMetadataAccess.hxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_DOCUMENTMETADATAACCESS_HXX_ +#define _SFX_DOCUMENTMETADATAACCESS_HXX_ + +#include <sal/config.h> + +#include <sfx2/dllapi.h> + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp> +#include <com/sun/star/rdf/XRepositorySupplier.hpp> + +#include <cppuhelper/implbase1.hxx> + +#include <boost/utility.hpp> + +#include <memory> + + +/** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess + + This is not a service only because it needs some kind of XML ID registry + from the document, and i do not like defining an API for that. + Also, the implementation does _no_ locking, so make sure access is + protected externally. + + @author mst + */ + +namespace com { namespace sun { namespace star { namespace embed { + class XStorage; +} } } } + +namespace sfx2 { + + +/** create a base URI for loading metadata from an ODF (sub)document. + + @param i_xContext component context + @param i_xStorage storage for the document; FileSystemStorage is allowed + @param i_rPkgURI the URI for the package + @param i_rSubDocument (optional) path of the subdocument in package + + @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage + */ +::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI> SFX2_DLLPUBLIC +createBaseURI( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> + const & i_xContext, + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> + const & i_xStorage, + OUString const & i_rPkgURI, + OUString const & i_rSubDocument = OUString()); + + +class IXmlIdRegistrySupplier; +struct DocumentMetadataAccess_Impl; + + +class SFX2_DLLPUBLIC DocumentMetadataAccess : + private boost::noncopyable, + public ::cppu::WeakImplHelper1< + ::com::sun::star::rdf::XDocumentMetadataAccess> +{ +public: + explicit DocumentMetadataAccess(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & i_xContext, + IXmlIdRegistrySupplier const & i_rRegistrySupplier, + OUString const & i_rBaseURI); + // N.B.: in contrast to previous, this constructor does _not_ initialize! + // caller must immediately call loadFromStorage/Medium! + explicit DocumentMetadataAccess(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & i_xContext, + IXmlIdRegistrySupplier const & i_rRegistrySupplier); + virtual ~DocumentMetadataAccess(); + + // ::com::sun::star::rdf::XNode: + virtual OUString SAL_CALL getStringValue() + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::rdf::XURI: + virtual OUString SAL_CALL getNamespace() + throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getLocalName() + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::rdf::XRepositorySupplier: + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XRepository > SAL_CALL getRDFRepository() + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::rdf::XDocumentMetadataAccess: + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > SAL_CALL + getElementByMetadataReference( + const ::com::sun::star::beans::StringPair & i_rReference) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > SAL_CALL + getElementByURI(const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > & i_xURI) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > > SAL_CALL getMetadataGraphsWithType( + const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > & i_xType) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI> SAL_CALL + addMetadataFile(const OUString & i_rFileName, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > + > & i_rTypes) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI> SAL_CALL + importMetadataFile(::sal_Int16 i_Format, + const ::com::sun::star::uno::Reference< + ::com::sun::star::io::XInputStream > & i_xInStream, + const OUString & i_rFileName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > & i_xBaseURI, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI > + > & i_rTypes) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::datatransfer::UnsupportedFlavorException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::rdf::ParseException, + ::com::sun::star::io::IOException); + virtual void SAL_CALL removeMetadataFile( + const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > & i_xGraphName) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException); + virtual void SAL_CALL addContentOrStylesFile( + const OUString & i_rFileName) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException); + virtual void SAL_CALL removeContentOrStylesFile( + const OUString & i_rFileName) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException); + + virtual void SAL_CALL loadMetadataFromStorage( + const ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage > & i_xStorage, + const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XURI > & i_xBaseURI, + const ::com::sun::star::uno::Reference< + ::com::sun::star::task::XInteractionHandler> & i_xHandler) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException); + virtual void SAL_CALL storeMetadataToStorage( + const ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage > & i_xStorage) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException); + virtual void SAL_CALL loadMetadataFromMedium( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > & i_rMedium) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException); + virtual void SAL_CALL storeMetadataToMedium( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > & i_rMedium) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException); + +private: + std::auto_ptr<DocumentMetadataAccess_Impl> m_pImpl; +}; + +} // namespace sfx2 + +#endif // _SFX_DOCUMENTMETADATAACCESS_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/Metadatable.hxx b/include/sfx2/Metadatable.hxx new file mode 100644 index 000000000000..70737da920ce --- /dev/null +++ b/include/sfx2/Metadatable.hxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef METADATABLE_HXX +#define METADATABLE_HXX + +#include <sal/config.h> + +#include <sfx2/dllapi.h> + +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/rdf/XMetadatable.hpp> + +#include <boost/utility.hpp> +#include <boost/shared_ptr.hpp> + + +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } +} } } + +namespace sfx2 { + class IXmlIdRegistry; +} + +namespace sfx2 { + +class XmlIdRegistry; +class MetadatableUndo; + + +// XML ID handling --------------------------------------------------- + + +/// create a sfx2::XmlIdRegistryDocument or a sfx2::XmlIdRegistryClipboard +SFX2_DLLPUBLIC ::sfx2::IXmlIdRegistry * +createXmlIdRegistry(const bool i_DocIsClipboard); + + +/** base class for core objects that may have xml:id. + + <p>The interface of this class consists of 3 parts: + <ul><li>implementations that are used by the <type>MetadatableMixin</type> + below</li> + <li>hooks to be called by the sw core whenever actions that are + relevant to the uniqueness of xml:ids are taken (copying, + splitting, merging, deletion, undo, etc.)</li> + <li>abstract methods that are called by the implementation of the + previous hooks</li></ul> + </p> + */ +class SFX2_DLLPUBLIC Metadatable : private boost::noncopyable +{ + +public: + Metadatable() : m_pReg(0) {} + + // destructor calls RemoveMetadataReference + virtual ~Metadatable(); + + // for MetadatableMixin ---------------------------------------------- + + ::com::sun::star::beans::StringPair GetMetadataReference() const; + void SetMetadataReference( + const ::com::sun::star::beans::StringPair & i_rReference); + void EnsureMetadataReference(); + + // hooks ------------------------------------------------------------- + + // called from dtor! + void RemoveMetadataReference(); + + /** register this as a copy of i_rSource */ + void RegisterAsCopyOf(Metadatable const & i_rSource, + const bool i_bCopyPrecedesSource = false); + + /** create an Undo Metadatable, which remembers this' reference */ + ::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); + + /** merge this and i_rOther into this */ + void JoinMetadatable(Metadatable const & i_rOther, + const bool i_isMergedEmpty, const bool i_isOtherEmpty); + + // abstract methods -------------------------------------------------- + + /** get the registry from the SwDoc */ + virtual ::sfx2::IXmlIdRegistry& GetRegistry() = 0; + + /** is this in a clipboard document? */ + virtual bool IsInClipboard() const = 0; + + /** is this in undo array? */ + virtual bool IsInUndo() const = 0; + + /** which stream is this in? true: content.xml; false: styles.xml */ + virtual bool IsInContent() const = 0; + + /** create XMetadatable from this. + note: if IsInUndo or IsInClipboard return true, + MakeUnoObject <em>must not</em> be called! + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > MakeUnoObject() = 0; + +private: + friend class MetadatableClipboard; + friend class MetadatableUndo; + + // note that Reg may be a XmlIdRegistryDocument or a XmlIdRegistryClipboard + XmlIdRegistry* m_pReg; // null => no XmlId +}; + + +/** base class for UNO objects that implement <type>XMetadatable</type>. + + <p>An instance of this base class is associated with an instance of + <type>Metadatable</type>.</p> + */ +class SFX2_DLLPUBLIC MetadatableMixin : + public ::cppu::WeakImplHelper1< + ::com::sun::star::rdf::XMetadatable> +{ + +public: + MetadatableMixin() {}; + + virtual ~MetadatableMixin() {} + + // ::com::sun::star::rdf::XNode: + virtual OUString SAL_CALL getStringValue() + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::rdf::XURI: + virtual OUString SAL_CALL getLocalName() + throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getNamespace() + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::rdf::XMetadatable: + virtual ::com::sun::star::beans::StringPair SAL_CALL getMetadataReference() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMetadataReference( + const ::com::sun::star::beans::StringPair & i_rReference) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL ensureMetadataReference() + throw (::com::sun::star::uno::RuntimeException); + +protected: + /// get the core object corresponding to this UNO object. + virtual Metadatable * GetCoreObject() = 0; + /// get the <type>XModel</type> for the document + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModel() = 0; + +}; + +} // namespace sfx2 + +#endif // METADATABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx new file mode 100644 index 000000000000..e442b482ff53 --- /dev/null +++ b/include/sfx2/QuerySaveDocument.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_QUERYSAVEDOCUMENT_HXX +#define SFX_QUERYSAVEDOCUMENT_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +class Window; +class String; +/** Opens the general query save document dialog. + @param _pParent + The parent window. + @_rTitle + The title of the document. +*/ +SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( + Window* _pParent,const String& _rTitle); + +#endif //SFX_QUERYSAVEDOCUMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/XmlIdRegistry.hxx b/include/sfx2/XmlIdRegistry.hxx new file mode 100644 index 000000000000..a7540dc469b0 --- /dev/null +++ b/include/sfx2/XmlIdRegistry.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_XMLIDREGISTRY_HXX_ +#define _SFX_XMLIDREGISTRY_HXX_ + +#include <sal/config.h> + +#include <sfx2/dllapi.h> + +#include <com/sun/star/beans/StringPair.hpp> + + +namespace com { namespace sun { namespace star { namespace rdf { + class XMetadatable; +} } } } + +namespace sfx2 { + +// XML ID utilities -------------------------------------------------- + +/** is i_rIdref a valid NCName ? */ +bool SFX2_DLLPUBLIC isValidNCName(OUString const & i_rIdref); + +bool SFX2_DLLPUBLIC isValidXmlId(OUString const & i_rStreamName, + OUString const & i_rIdref); + +// XML ID handling --------------------------------------------------- + +/** interface for getElementByMetadataReference; + for use by sfx2::DocumentMetadataAccess + */ +class SFX2_DLLPUBLIC IXmlIdRegistry +{ + +public: + virtual ~IXmlIdRegistry() { } + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > SAL_CALL + GetElementByMetadataReference( + const ::com::sun::star::beans::StringPair & i_rXmlId) const = 0; + +}; + +/** supplier interface for the registry. + + This indirection is unfortunately necessary, because the SwDocShell + is not always connected to a SwDoc, so we cannot guarantee that a + registry given to a SfxBaseModel/DocumentMetadataAccess remains valid; + it has to be retrieved from this supplier interface on access. + */ +class SFX2_DLLPUBLIC IXmlIdRegistrySupplier +{ + +public: + virtual ~IXmlIdRegistrySupplier() { } + + /** override this if you have a XmlIdRegistry. */ + virtual const IXmlIdRegistry* GetXmlIdRegistry() const { return 0; } + +}; + +} // namespace sfx2 + +#endif // _SFX_XMLIDREGISTRY_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx new file mode 100644 index 000000000000..858140d2b8be --- /dev/null +++ b/include/sfx2/app.hxx @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXAPP_HXX +#define _SFXAPP_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/solar.h> +#include <tools/errcode.hxx> +#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> +#include <com/sun/star/task/XStatusIndicator.hpp> + +// too many files including sfx2/app.hxx use VCL Application class but don't include the +// header file because in former times SfxApplication was derived from it +#include <vcl/svapp.hxx> + +#include <sfx2/shell.hxx> +#include <vector> + +class Timer; +class ApplicationEvent; +class WorkWindow; +class ISfxTemplateCommon; +class BasicManager; +class DdeService; +class GenLink; +class PrinterDialog; +class Point; +class Rectangle; +class AppSettings; +struct SfxChildWinContextFactory; +class SfxAppData_Impl; +class SfxBindings; +class SfxChildWinFactArr_Impl; +class SfxChildWindow; +class SfxDispatcher; +class SfxEventConfiguration; +class SfxEventHint; +class SfxItemSet; +class SfxMedium; +class SfxMenuCtrlFactArr_Impl; +class SfxNewFileDialog; +class SfxObjectShell; +class SfxObjectShellArr_Impl; +class SfxProgress; +class SfxSlotPool; +class SfxStbCtrlFactArr_Impl; +class SfxTbxCtrlFactArr_Impl; +class SfxTemplateDialog; +class SfxViewFrame; +class SfxViewFrameArr_Impl; +class SfxViewShell; +class SfxViewShellArr_Impl; +class StarBASIC; +class SfxWorkWindow; +class SfxFilterMatcher; +class SfxModule; +class SfxModule; +typedef ::std::vector<SfxModule*> SfxModuleArr_Impl; +class Window; +class INetURLObject; +struct SfxChildWinFactory; +struct SfxMenuCtrlFactory; +struct SfxStbCtrlFactory; +struct SfxTbxCtrlFactory; +class SimpleResMgr; +class ModalDialog; +class SbxArray; +class SbxValue; + +typedef ::std::vector< SfxMedium* > SfxMediumList; + +namespace sfx2 +{ + class SvLinkSource; +} + +//==================================================================== + +class SfxLinkItem : public SfxPoolItem +{ + Link aLink; +public: + virtual SfxPoolItem* Clone( SfxItemPool* = 0 ) const + { return new SfxLinkItem( *this ); } + virtual int operator==( const SfxPoolItem& rL) const + { return ((SfxLinkItem&)rL).aLink == aLink; } + SfxLinkItem( sal_uInt16 nWhichId, const Link& rValue ) : SfxPoolItem( nWhichId ) + { aLink = rValue; } + const Link& GetValue() const { return aLink; } +}; + +//TODO/CLEANUP +//is apparently used only in SfxPickList/SfxFrameLoader +DECL_OBJHINT( SfxStringHint, String ); + +#ifndef SFX_DECL_OBJECTSHELL_DEFINED +#define SFX_DECL_OBJECTSHELL_DEFINED +SV_DECL_REF(SfxObjectShell) +#endif + +class SfxObjectShellLock; + +class SFX2_DLLPUBLIC SfxApplication: public SfxShell +{ + SAL_DLLPRIVATE static SfxApplication* pApp; + + SfxAppData_Impl* pAppData_Impl; + + DECL_DLLPRIVATE_LINK( GlobalBasicErrorHdl_Impl, StarBASIC* ); + + static SfxApplication* Create(); + void Init(); + void Exit(); + void SettingsChange( sal_uInt16, const AppSettings & ); + void Quit(); + void Deinitialize(); + +public: + TYPEINFO(); + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXAPP) + + SfxApplication(); + ~SfxApplication(); + static SfxApplication* GetOrCreate(); + + // Resource Manager + ResMgr* GetSfxResManager(); + static ResMgr* CreateResManager( const char *pPrefix ); + + // DDE +#if defined( WNT ) + long DdeExecute( const String& rCmd ); +#endif + sal_Bool InitializeDde(); + const DdeService* GetDdeService() const; + DdeService* GetDdeService(); +#if defined( WNT ) + void AddDdeTopic( SfxObjectShell* ); +#endif + void RemoveDdeTopic( SfxObjectShell* ); + + // "static" methods + /** + * @param pArgs Takes ownership + */ + sal_uIntPtr LoadTemplate( SfxObjectShellLock& xDoc, const String& rFileName, sal_Bool bCopy=sal_True, SfxItemSet* pArgs = 0 ); + SfxTemplateDialog* GetTemplateDialog(); + Window* GetTopWindow() const; + + // TODO/CLEANUP: make currently selected family a view property and so we don't need to query the status from the "TemplateCommon" + ISfxTemplateCommon* GetCurrentTemplateCommon( SfxBindings& ); + + // members + SfxFilterMatcher& GetFilterMatcher(); + SfxProgress* GetProgress() const; + const String& GetLastSaveDirectory() const; + sal_uInt16 GetFreeIndex(); + void ReleaseIndex(sal_uInt16 i); + + // Basic/Scripting + static sal_Bool IsXScriptURL( const String& rScriptURL ); + static OUString ChooseScript(); + static void MacroOrganizer( sal_Int16 nTabId ); + static ErrCode CallBasic( const String&, BasicManager*, SbxArray *pArgs, SbxValue *pRet ); + static ErrCode CallAppBasic( const String& i_macroName, SbxArray* i_args = NULL, SbxValue* i_ret = NULL ) + { return CallBasic( i_macroName, SfxApplication::GetOrCreate()->GetBasicManager(), i_args, i_ret ); } + BasicManager* GetBasicManager(); + com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > + GetDialogContainer(); + com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > + GetBasicContainer(); + StarBASIC* GetBasic(); + sal_uInt16 SaveBasicAndDialogContainer() const; + + // misc. + sal_Bool GetOptions(SfxItemSet &); + void SetOptions(const SfxItemSet &); + virtual void Invalidate(sal_uInt16 nId = 0); + void NotifyEvent(const SfxEventHint& rEvent, bool bSynchron = true ); + sal_Bool IsDowning() const; + sal_Bool IsSecureURL( const INetURLObject &rURL, const String *pReferer ) const; + void ResetLastDir(); + + SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;} + SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); + SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); + + SAL_DLLPRIVATE sal_Bool QueryExit_Impl(); + SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &); + SAL_DLLPRIVATE bool Initialize_Impl(); + + SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pAppData_Impl; } + + // Object-Factories/global arrays + SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, SfxChildWinFactory*); + SAL_DLLPRIVATE void RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, SfxChildWinContextFactory*); + SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, SfxStbCtrlFactory*); + SAL_DLLPRIVATE void RegisterMenuControl_Impl(SfxModule*, SfxMenuCtrlFactory*); + SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, SfxTbxCtrlFactory*); + SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl& GetStbCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl& GetMenuCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxChildWinFactArr_Impl& GetChildWinFactories_Impl() const; + SAL_DLLPRIVATE SfxViewFrameArr_Impl& GetViewFrames_Impl() const; + SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const; + SAL_DLLPRIVATE SfxObjectShellArr_Impl& GetObjectShells_Impl() const; + SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame); + + // Slot Methods + // TODO/CLEANUP: still needed? + SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); + SAL_DLLPRIVATE void PropExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void PropState_Impl(SfxItemSet &); + SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); + SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void OfaState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE void SetProgress_Impl(SfxProgress *); + SAL_DLLPRIVATE const String& GetLastDir_Impl() const; + SAL_DLLPRIVATE void SetLastDir_Impl( const String & ); + + SAL_DLLPRIVATE void Registrations_Impl(); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame=0) const; + + // TODO/CLEANUP: still needed? -- unclear whether this comment + // refers to the GetDisabledSlotList_Impl() method which was + // already removed, or the below methods? + SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const; + SAL_DLLPRIVATE SfxModule* GetModule_Impl(); + SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl(); + + static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth); + + /** loads the application logo as used in the impress slideshow pause screen */ + static BitmapEx GetApplicationLogo(long nWidth); +}; + +#define SFX_APP() SfxGetpApp() + +//-------------------------------------------------------------------- + +inline SfxApplication* SfxGetpApp() +{ + return SfxApplication::GetOrCreate(); +} + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/appuno.hxx b/include/sfx2/appuno.hxx new file mode 100644 index 000000000000..90bf2d5edf58 --- /dev/null +++ b/include/sfx2/appuno.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_APPUNO_HXX +#define _SFX_APPUNO_HXX + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XSynchronousDispatch.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> + +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase4.hxx> + +#include <tools/errcode.hxx> +#include <sfx2/sfxuno.hxx> + +class SfxObjectShell; +class SfxMacroLoader : public ::com::sun::star::frame::XDispatchProvider, + public ::com::sun::star::frame::XNotifyingDispatch, + public ::com::sun::star::frame::XSynchronousDispatch, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XInitialization, + public ::cppu::OWeakObject +{ + ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame; + + SfxObjectShell* GetObjectShell_Impl(); + +public: + // XInterface, XTypeProvider, XServiceInfo + SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO + + SfxMacroLoader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) + {} + + static ErrCode loadMacro( const OUString& aURL, ::com::sun::star::uno::Any& rRetval, SfxObjectShell* pDoc=NULL ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL + queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName, + FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL + queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor ) + throw( ::com::sun::star::uno::RuntimeException ) ; + virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); +}; + +class SfxAppDispatchProvider : public ::cppu::WeakImplHelper4< ::com::sun::star::frame::XDispatchProvider, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::frame::XDispatchInformationProvider > +{ + ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame; +public: + SfxAppDispatchProvider( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ) + {} + + SFX_DECL_XSERVICEINFO + virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL + queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName, + FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL + queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor ) + throw( ::com::sun::star::uno::RuntimeException ) ; + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx new file mode 100644 index 000000000000..95278e89e605 --- /dev/null +++ b/include/sfx2/basedlgs.hxx @@ -0,0 +1,238 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _BASEDLGS_HXX +#define _BASEDLGS_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/builder.hxx> +#include <vcl/dialog.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/timer.hxx> + +class TabPage; +class SfxTabPage; +class SfxBindings; +class SfxChildWindow; +struct SfxChildWinInfo; +class SfxItemSet; +class SfxItemPool; +class OKButton; +class CancelButton; +class HelpButton; +class Button; +class FixedLine; + +//There is a hack which hides the HelpId for a Dialog in SfxModelessDialog +//and SfxDockingWindow, where it is changed into a UniqueId and cleared +//This reverses the clear of the HelpId + +SFX2_DLLPUBLIC inline void reverseUniqueHelpIdHack(Window &rWindow) +{ + if (rWindow.GetHelpId().isEmpty()) + rWindow.SetHelpId(rWindow.GetUniqueId()); +} + +// class SfxModalDialog -------------------------------------------------- + +class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog +{ + sal_uInt32 nUniqId; + String aExtraData; + const SfxItemSet* pInputSet; + SfxItemSet* pOutputSet; + +private: + SAL_DLLPRIVATE SfxModalDialog(SfxModalDialog &); // not defined + SAL_DLLPRIVATE void operator =(SfxModalDialog &); // not defined + + SAL_DLLPRIVATE void SetDialogData_Impl(); + SAL_DLLPRIVATE void GetDialogData_Impl(); + SAL_DLLPRIVATE void init(); + +protected: + SfxModalDialog(Window *pParent, const ResId& ); + SfxModalDialog(Window *pParent, const OString& rID, const OUString& rUIXMLDescription); + SfxModalDialog(Window* pParent, sal_uInt32 nUniqueId, WinBits nWinStyle = WB_STDMODAL ); + + String& GetExtraData() { return aExtraData; } + sal_uInt32 GetUniqId() const { return nUniqId; } + void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; } + SfxItemSet* GetItemSet() { return pOutputSet; } + void CreateOutputItemSet( SfxItemPool& rPool ); + void CreateOutputItemSet( const SfxItemSet& rInput ); + void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; } + SfxItemSet* GetOutputSetImpl() { return pOutputSet; } + +public: + ~SfxModalDialog(); + const SfxItemSet* GetOutputItemSet() const { return pOutputSet; } + const SfxItemSet* GetInputItemSet() const { return pInputSet; } +}; + +// class SfxModelessDialog -------------------------------------------------- +class SfxModelessDialog_Impl; +class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog +{ + SfxBindings* pBindings; + Size aSize; + SfxModelessDialog_Impl* pImp; + + SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined + SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined + + void Init(SfxBindings *pBindinx, SfxChildWindow *pCW); + +protected: + SfxModelessDialog( SfxBindings*, SfxChildWindow*, + Window*, const ResId& ); + SfxModelessDialog( SfxBindings*, SfxChildWindow*, + Window*, const OString& rID, const OUString& rUIXMLDescription ); + ~SfxModelessDialog(); + virtual sal_Bool Close(); + virtual void Resize(); + virtual void Move(); + virtual void StateChanged( StateChangedType nStateChange ); + +public: + virtual void FillInfo(SfxChildWinInfo&) const; + void Initialize (SfxChildWinInfo* pInfo); + virtual long Notify( NotifyEvent& rNEvt ); + SfxBindings& GetBindings() + { return *pBindings; } + + DECL_LINK(TimerHdl, void *); + +}; + +// class SfxFloatingWindow -------------------------------------------------- +class SfxFloatingWindow_Impl; +class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow +{ + SfxBindings* pBindings; + Size aSize; + SfxFloatingWindow_Impl* pImp; + + SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined + SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined + +protected: + SfxFloatingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + WinBits nWinBits=WB_STDMODELESS); + SfxFloatingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + const ResId& rResId); + ~SfxFloatingWindow(); + + virtual void StateChanged( StateChangedType nStateChange ); + virtual sal_Bool Close(); + virtual void Resize(); + virtual void Move(); + virtual long Notify( NotifyEvent& rNEvt ); + SfxBindings& GetBindings() + { return *pBindings; } + +public: + virtual void FillInfo(SfxChildWinInfo&) const; + void Initialize (SfxChildWinInfo* pInfo); + + DECL_LINK(TimerHdl, void *); + +}; + +// class SfxNoLayoutSingleTabDialog -------------------------------------------------- + +struct SingleTabDlgImpl +{ + SfxTabPage* m_pSfxPage; + FixedLine* m_pLine; + String m_sInfoURL; + Link m_aInfoLink; + + SingleTabDlgImpl() + : m_pSfxPage(NULL) + , m_pLine(NULL) + { + } +}; + +typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte + +class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog +{ +public: + //layout ctor + SfxSingleTabDialogBase(Window* pParent, const SfxItemSet& rOptionsSet); + + //non-layout ctors + SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); + SfxSingleTabDialogBase( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 ); + + virtual ~SfxSingleTabDialogBase(); + + SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; } + + OKButton* GetOKButton() const { return pOKBtn; } + CancelButton* GetCancelButton() const { return pCancelBtn; } + +protected: + GetTabPageRanges fnGetRanges; + + OKButton* pOKBtn; + CancelButton* pCancelBtn; + HelpButton* pHelpBtn; + + SingleTabDlgImpl* pImpl; + + DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *); +}; + +class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase +{ +public: + SfxSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet) + : SfxSingleTabDialogBase(pParent, rOptionsSet) + { + } + void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0); +}; + +//Old school deprecated non-layout aware version +class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxSingleTabDialogBase +{ +public: + SfxNoLayoutSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId) + : SfxSingleTabDialogBase(pParent, rOptionsSet, nUniqueId) + { + } + SfxNoLayoutSingleTabDialog(Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0) + : SfxSingleTabDialogBase(pParent, nUniqueId, pInSet) + { + } + ~SfxNoLayoutSingleTabDialog(); + void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx new file mode 100644 index 000000000000..664673cf66d5 --- /dev/null +++ b/include/sfx2/bindings.hxx @@ -0,0 +1,248 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_BINDINGS_HXX +#define _SFX_BINDINGS_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include "rtl/strbuf.hxx" +#include <tools/link.hxx> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> +#include <vector> + +//________________________________________________________________________________________________________________ +// some other includes +//________________________________________________________________________________________________________________ + +#include <sfx2/viewfrm.hxx> + +//________________________________________________________________________________________________________________ +// forwards, typedefs, declarations +//________________________________________________________________________________________________________________ + +class SystemWindow; +class SfxSlot; +class SfxSlotServer; +class SfxControllerItem; +class SfxStateCache; +class SfxItemSet; +class SfxDispatcher; +class SfxBindings; +class SfxBindings_Impl; +class Timer; +struct SfxFoundCache_Impl; +class SfxFoundCacheArr_Impl; +class SfxWorkWindow; +class SfxUnoControllerItem; + +typedef std::vector<SfxUnoControllerItem*> SfxUnoControllerArr_Impl; + +#define SFX_CALLMODE_SLOT 0x00 // sync/async from Slot +#define SFX_CALLMODE_SYNCHRON 0x01 // synchronously in the same Stackframe +#define SFX_CALLMODE_ASYNCHRON 0x02 // asynchronously via AppEvent +#define SFX_CALLMODE_RECORD 0x04 // take into accont while recording +#define SFX_CALLMODE_API 0x08 // API call (silent) +#define SFX_CALLMODE_MODAL 0x10 // despite ModalMode + +#define SFX_CALLMODE_STANDARD SFX_CALLMODE_RECORD +typedef sal_uInt16 SfxCallMode; + +enum SfxPopupAction +{ + SFX_POPUP_DELETE, + SFX_POPUP_HIDE, + SFX_POPUP_SHOW +}; + +//==================================================================== +class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster + +/* [Description] + + In each SFx application one instance of the SfxBindings-Class will + exists from <SfxApplication::Init()> until <SfxApplication::Exit()>. + This instance is automatically created and destroyed by SfxApplication. + However these instances will be handled by the Macro <SFX_BINDINGS> + or the associated <SfxViewFrame>. + + The SfxBindings manages all of its Slot-Ids bound by the registerd + controllers and keeps a cache of the <Slot-Server> respectively. + (it is what we call the combination of SfxShell instance and SfxSlot). + In the SfxBindings it is stored, if and in this case which controllers + that are dirty and which Slot-Server-Caches are dirty respectively. + It summarizes status queries (calls to the status methods specified + in the IDL) that are served by the same state methods, and handles + the simulation of <Pseudo-Slots>. +*/ + +{ +friend class SfxApplication; +friend class SfxShell; +friend class SfxBindings_Impl; + + SfxBindings_Impl*pImp; // Data of the Bindings instance + SfxDispatcher* pDispatcher; // Dispatcher, to be used + sal_uInt16 nRegLevel; // Lock-Level while Reconfig + +private: + SAL_DLLPRIVATE const SfxPoolItem* Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, + SfxCallMode nCall, const SfxPoolItem **pInternalArgs, sal_Bool bGlobalOnly=sal_False); + SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* ); + SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer + SAL_DLLPRIVATE SfxItemSet* CreateSet_Impl( SfxStateCache* &pCache, + const SfxSlot* &pRealSlot, + const SfxSlotServer**, + SfxFoundCacheArr_Impl& ); + SAL_DLLPRIVATE sal_uInt16 GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt = 0 ); + SAL_DLLPRIVATE void Update_Impl( SfxStateCache* pCache ); + SAL_DLLPRIVATE void UpdateControllers_Impl( + const SfxInterface* pIF, + const SfxFoundCache_Impl* pFound, + const SfxPoolItem *pItem, + SfxItemState eItemState ); + SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, sal_uInt16 *pPos); + DECL_DLLPRIVATE_LINK( NextJob_Impl, Timer * ); + +public: + SfxBindings(); + ~SfxBindings(); + + void HidePopups( bool bHide = true ); + SAL_DLLPRIVATE void HidePopupCtrls_Impl( bool bHide = true ); + + void SetDispatcher(SfxDispatcher *pDisp); + + void Update( sal_uInt16 nId ); // For example, from Menu::Activate + void Update(); + SAL_DLLPRIVATE void StartUpdate_Impl(sal_Bool bComplete=sal_False); + void Invalidate( sal_uInt16 nId ); + void Invalidate( const sal_uInt16* pIds ); + void InvalidateShell( const SfxShell &rSh, sal_Bool bDeep = sal_False ); + void InvalidateAll( sal_Bool bWithMsg ); + void SetState( const SfxItemSet &rSet ); + void SetState( const SfxPoolItem &rItem ); + void Invalidate( sal_uInt16 nId, sal_Bool bWithItem, sal_Bool bWithMsg=sal_False); + void Invalidate( sal_uInt16 nId, sal_Bool bWithMsg); + sal_Bool IsInUpdate() const; + void SetVisibleState( sal_uInt16 nId, sal_Bool bShow ); + + sal_Bool IsBound( sal_uInt16 nMsgId, sal_uInt16 nStartSearchAt = 0 ); + + const SfxSlot* GetSlot( sal_uInt16 nMsgId ); + SfxStateCache* GetStateCache( sal_uInt16 nId); + SAL_DLLPRIVATE SfxStateCache* GetAnyStateCache_Impl( sal_uInt16 nId ); + /** + * @param rpState the caller has to delete the pointer + */ + SfxItemState QueryState( sal_uInt16 nSID, SfxPoolItem* &rpState ); + + const SfxPoolItem* ExecuteSynchron( sal_uInt16 nSlot, + const SfxPoolItem **pArgs = 0, + sal_uInt16 nModi = 0, + const SfxPoolItem **pInternalArgs = 0); + sal_Bool Execute( sal_uInt16 nSlot, + const SfxPoolItem **pArgs = 0, + sal_uInt16 nModi = 0, + SfxCallMode nCall = SFX_CALLMODE_SLOT, + const SfxPoolItem **pInternalArgs = 0); + + SAL_DLLPRIVATE void SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rFrame ); + SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & GetDispatchProvider_Impl() const; + void SetActiveFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & rFrame ); + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetActiveFrame() const; + // Reconfig + int IsInRegistrations() const; + sal_uInt16 EnterRegistrations(const char *pFile = 0, int nLine = 0); + void LeaveRegistrations( sal_uInt16 nLevel = USHRT_MAX, const char *pFile = 0, int nLine = 0 ); + void Register( SfxControllerItem& rBinding ); + void Release( SfxControllerItem& rBinding ); + SystemWindow* GetSystemWindow() const; + SfxDispatcher* GetDispatcher() const + { return pDispatcher; } + com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetRecorder() const; + com::sun::star::uno::Reference < com::sun::star::frame::XDispatch > + GetDispatch( const SfxSlot*, const com::sun::star::util::URL& aURL, sal_Bool bMasterCommand ); + SAL_DLLPRIVATE void ContextChanged_Impl(); + SAL_DLLPRIVATE void Execute_Impl( SfxRequest& rReq, const SfxSlot* pSlot, SfxShell* pShell ); + SAL_DLLPRIVATE void DeleteControllers_Impl(); + SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() { return pDispatcher; } + SAL_DLLPRIVATE void ClearCache_Impl( sal_uInt16 nSlotId ); + SAL_DLLPRIVATE sal_Bool IsInUpdate_Impl() const{ return IsInUpdate(); } + SAL_DLLPRIVATE void RegisterInternal_Impl( SfxControllerItem& rBinding ); + SAL_DLLPRIVATE void Register_Impl( SfxControllerItem& rBinding, sal_Bool ); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const; + SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* ); + SAL_DLLPRIVATE SfxBindings* GetSubBindings_Impl( sal_Bool bTop = sal_False ) const; + SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); + SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* ); + SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* ); + SAL_DLLPRIVATE sal_Bool ExecuteCommand_Impl( const String& rCommand ); + SAL_DLLPRIVATE void SetRecorder_Impl( com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder >& ); + SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl(); + SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId ); +}; + +#ifdef DBG_UTIL +#define ENTERREGISTRATIONS() EnterRegistrations(__FILE__, __LINE__) +#define LEAVEREGISTRATIONS() LeaveRegistrations(USHRT_MAX, __FILE__, __LINE__) +#define DENTERREGISTRATIONS() \ + EnterRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ ) +#define DLEAVEREGISTRATIONS( ) \ + LeaveRegistrations( USHRT_MAX, OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ ) +#else +#define ENTERREGISTRATIONS() EnterRegistrations() +#define LEAVEREGISTRATIONS() LeaveRegistrations() +#define DENTERREGISTRATIONS() EnterRegistrations() +#define DLEAVEREGISTRATIONS() LeaveRegistrations() +#endif + +//-------------------------------------------------------------------- + +inline int SfxBindings::IsInRegistrations() const + +/* [Description] + + Determines whether the <SfxContollerItems> SfxBindings instance is + registerd or unregisted, i.e. <SfxBindings::EnterRegistrations()> + calls that have not been closed by <SfxBindings::LeaveRegistrations()>. + + [Return value] + + int sal_True + The SfxBindings instance is currently in + Registration-Mode. No status updates . + + int sal_False + The SfxBindings instance is the normal mode. + Status updates can be done. +*/ + +{ + return 0 != nRegLevel; +} + +//-------------------------------------------------------------------- + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/brokenpackageint.hxx b/include/sfx2/brokenpackageint.hxx new file mode 100644 index 000000000000..85cd33402f3c --- /dev/null +++ b/include/sfx2/brokenpackageint.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <com/sun/star/document/BrokenPackageRequest.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionDisapprove.hpp> + +class RequestPackageReparation_Impl; +class SFX2_DLLPUBLIC RequestPackageReparation +{ + RequestPackageReparation_Impl* pImp; +public: + RequestPackageReparation( OUString aName ); + ~RequestPackageReparation(); + sal_Bool isApproved(); + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + +class NotifyBrokenPackage_Impl; +class SFX2_DLLPUBLIC NotifyBrokenPackage +{ + NotifyBrokenPackage_Impl* pImp; +public: + NotifyBrokenPackage( OUString aName ); + ~NotifyBrokenPackage(); + sal_Bool isAborted(); + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/chalign.hxx b/include/sfx2/chalign.hxx new file mode 100644 index 000000000000..f8bf451e2b22 --- /dev/null +++ b/include/sfx2/chalign.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_CHILDALIGN_HXX +#define _SFX_CHILDALIGN_HXX + +#include <tools/solar.h> + +// New order: first, navigation bar, then vertically docked child windows +// (Explorer!), then horizontally docked child windows (Browser!), +// then the format bar, status bar, and at the end of the toolbar. + +enum SfxChildAlignment +{ + SFX_ALIGN_HIGHESTTOP, // for example Navigation bar + SFX_ALIGN_LOWESTBOTTOM, + SFX_ALIGN_FIRSTLEFT, + SFX_ALIGN_LASTRIGHT, + SFX_ALIGN_LEFT, // for example SplitWindow + SFX_ALIGN_RIGHT, + SFX_ALIGN_LASTLEFT, + SFX_ALIGN_FIRSTRIGHT, + SFX_ALIGN_TOP, // for example Hyperlink-Builder, SplitWindow + SFX_ALIGN_BOTTOM, // for example SplitWindow + SFX_ALIGN_TOOLBOXTOP, // for example Objekt bar + SFX_ALIGN_TOOLBOXBOTTOM, + SFX_ALIGN_LOWESTTOP, // for example Calc bar + SFX_ALIGN_HIGHESTBOTTOM, // for example Status bar + SFX_ALIGN_TOOLBOXLEFT, // for example Tool bar + SFX_ALIGN_TOOLBOXRIGHT, + SFX_ALIGN_NOALIGNMENT // all FloatingWindows +}; + +// Verifies that a valid alignment is used +inline sal_Bool SfxChildAlignValid( SfxChildAlignment eAlign ) +{ + return ( eAlign >= SFX_ALIGN_HIGHESTTOP && eAlign <= SFX_ALIGN_NOALIGNMENT ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/checkin.hxx b/include/sfx2/checkin.hxx new file mode 100644 index 000000000000..9a9c20f485d7 --- /dev/null +++ b/include/sfx2/checkin.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef _SFX_CHECKIN_HXX +#define _SFX_CHECKIN_HXX + +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/edit.hxx> + +class SfxCheckinDialog : public ModalDialog +{ + private: + Edit* m_pCommentED; + CheckBox* m_pMajorCB; + + OKButton* m_pOKBtn; + + DECL_DLLPRIVATE_LINK(OKHdl, void *); + + public: + SfxCheckinDialog( Window* pParent ); + + OUString GetComment( ); + bool IsMajor( ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx new file mode 100644 index 000000000000..d0c5e50fce1f --- /dev/null +++ b/include/sfx2/childwin.hxx @@ -0,0 +1,370 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_CHILDWIN_HXX +#define _SFX_CHILDWIN_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/window.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +#include <sfx2/shell.hxx> +#include <sfx2/chalign.hxx> +#include <boost/ptr_container/ptr_vector.hpp> + +class SfxWorkWindow; +class SfxModule; +class SfxBindings; +class SfxShell; +class SfxChildWindow; +class SfxChildWindowContext; + +#define SFX_CHILDWIN_ZOOMIN 0x01 // Fully retracted Float +#define SFX_CHILDWIN_SMALL 0x02 // Half retracted Float +#define SFX_CHILDWIN_FORCEDOCK 0x04 // Float forbidden +#define SFX_CHILDWIN_AUTOHIDE 0x08 // DockingWindow in AutoHide mode +#define SFX_CHILDWIN_TASK 0x10 // ChildWindow inside the Task +#define SFX_CHILDWIN_CANTGETFOCUS 0x20 // ChildWindow can not get focus +#define SFX_CHILDWIN_ALWAYSAVAILABLE 0x40 // ChildWindow is never disabled +#define SFX_CHILDWIN_NEVERHIDE 0x80 // ChildWindow is can always made + // visible/is visible +#define CHILDWIN_NOPOS USHRT_MAX + +// ChildWindow Configuration +struct SfxChildWinInfo +{ + sal_Bool bVisible; + Point aPos; + Size aSize; + sal_uInt16 nFlags; + String aExtraString; + OString aWinState; + + SfxChildWinInfo() + { + bVisible = sal_False; + nFlags = 0; + } + sal_Bool GetExtraData_Impl( SfxChildAlignment *pAlign, + SfxChildAlignment *pLastAlign = 0, + Size *pSize = 0, + sal_uInt16 *pLine = 0, + sal_uInt16 *pPos = 0 ) const; +}; + +// ChildWindow factory methods +typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow, + sal_uInt16 nId, + SfxBindings *pBindings, + SfxChildWinInfo *pInfo); + +// ChildWindowsContexts factory methods +typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow, + SfxBindings *pBindings, + SfxChildWinInfo *pInfo); +struct SfxChildWinContextFactory +{ + SfxChildWinContextCtor pCtor; // Factory method + sal_uInt16 nContextId; // Idenifier for SfxInterface + SfxChildWinInfo aInfo; // Configuration + + SfxChildWinContextFactory( SfxChildWinContextCtor pTheCtor, sal_uInt16 nID ) + : pCtor(pTheCtor) + , nContextId(nID) + {} +}; + +typedef boost::ptr_vector<SfxChildWinContextFactory> SfxChildWinContextArr_Impl; + +struct SfxChildWinFactory +{ + SfxChildWinCtor pCtor; // Factory method + sal_uInt16 nId; // ChildWindow-Id ( SlotId ) + SfxChildWinInfo aInfo; // Configuration + sal_uInt16 nPos; // Position in UI + SfxChildWinContextArr_Impl *pArr; // Array for Contexts + + SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, + sal_uInt16 n ) + : pCtor(pTheCtor) + , nId( nID ) + , nPos(n) + , pArr( NULL ) + {} + + ~SfxChildWinFactory() + { + delete pArr; + } + +}; + +class FloatingWindow; +struct SfxChildWindow_Impl; +class SFX2_DLLPUBLIC SfxChildWindowContext +{ +friend class SfxChildWindow; + ::Window* pWindow; + sal_uInt16 nContextId; + +protected: + SfxChildWindowContext( sal_uInt16 nId ); + +public: + virtual ~SfxChildWindowContext(); + + void SetWindow( ::Window* pWin ) + { pWindow=pWin; } + ::Window* GetWindow() const + { return pWindow; } + sal_uInt16 GetContextId() const + { return nContextId; } + + FloatingWindow* GetFloatingWindow() const; + + virtual void Resizing( Size& rSize ); + virtual sal_Bool Close(); + static void RegisterChildWindowContext(SfxModule*, sal_uInt16, SfxChildWinContextFactory*); +}; + +class SFX2_DLLPUBLIC SfxChildWindow +{ + ::Window* pParent; // parent window ( Topwindow ) + sal_uInt16 nType; // ChildWindow-Id + +protected: + SfxChildAlignment eChildAlignment; // Current ::com::sun::star::drawing::Alignment + ::Window* pWindow; // actual contents + SfxChildWindow_Impl* pImp; // Implementation data + +private: + SfxChildWindowContext* pContext; // With context-sensitive ChildWindows: + // Annother window in pWindow + SAL_DLLPRIVATE SfxChildWindowContext* + GetContext() const + { return pContext; } + +protected: + SfxChildWindow(::Window *pParentWindow, sal_uInt16 nId); + +public: + virtual ~SfxChildWindow(); + void Destroy(); + ::Window* GetWindow() const + { return pWindow; } + ::Window* GetParent() const + { return pParent; } + SfxChildAlignment GetAlignment() const + { return eChildAlignment; } + void SetAlignment(SfxChildAlignment eAlign); + Size GetSizePixel() const + { return pWindow->GetSizePixel(); } + void SetPosSizePixel(const Point& rPoint, const Size& rSize) + { pWindow->SetPosSizePixel(rPoint, rSize); } + Point GetPosPixel() + { return pWindow->GetPosPixel(); } + virtual void Hide(); + virtual void Show( sal_uInt16 nFlags ); + sal_uInt16 GetFlags() const + { return GetInfo().nFlags; } + sal_Bool CanGetFocus() const; + sal_uInt16 GetPosition(); + sal_uInt16 GetType() + { return nType; } + + void CreateContext( sal_uInt16 nContextId, SfxBindings& ); + sal_uInt16 GetContextId() const + { return pContext ? pContext->GetContextId(): 0; } + + ::Window* GetContextWindow() const + { return pContext ? pContext->GetWindow(): 0; } + + ::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&); + void SetHideNotDelete( sal_Bool bOn ); + sal_Bool IsHideNotDelete() const; + sal_Bool IsHideAtToggle() const; + sal_Bool IsVisible() const; + void SetWantsFocus( sal_Bool ); + sal_Bool WantsFocus() const; + + virtual sal_Bool QueryClose(); + virtual com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame(); + void SetFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & ); + + SAL_DLLPRIVATE static void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo&); + SAL_DLLPRIVATE void SetVisible_Impl( sal_Bool bVis ); + SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* ); + SAL_DLLPRIVATE void Activate_Impl(); + SAL_DLLPRIVATE void Deactivate_Impl(); + + SAL_DLLPRIVATE SfxChildWindowContext* + GetContext_Impl() const + { return pContext; } + SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* ); +}; + +//------------------------------------------------------------------ +//! soon obsolete ! +#define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ + static void RegisterChildWindowContext(SfxModule *pMod=0); \ + +//! The Macro of the future ... +#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ + static SfxChildWindowContext* CreateImpl(::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ + static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \ + +//! soon obsolete ! +#define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \ + SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ + { \ + SfxChildWindowContext *pContext = new Class(pParent, \ + /* cast is safe here! */static_cast< sal_uInt16 >(ShellClass::GetInterfaceId()), \ + pBindings,pInfo); \ + return pContext; \ + } \ + void Class::RegisterChildWindowContext(SfxModule* pMod) \ + { \ + SfxChildWinContextFactory *pFact = new SfxChildWinContextFactory( \ + Class::CreateImpl, \ + /* cast is safe here! */static_cast< sal_uInt16 >(ShellClass::GetInterfaceId()) ); \ + SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, pFact); \ + } + +//! The Macro of the future ... +// As a parameter and because of ContextId, CreateImpl must be handed the +// factory. As long as Id is set to 0 and patched in +// SfxChildWindow::CreateContext +#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ + SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ + { \ + SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\ + return pContext; \ + } \ + void Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod) \ + { \ + SfxChildWinContextFactory *pFact = new SfxChildWinContextFactory( \ + Class::CreateImpl, nId ); \ + SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, pFact); \ + } + +#define SFX_DECL_CHILDWINDOW(Class) \ + public : \ + 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); \ + virtual SfxChildWinInfo GetInfo() const + +#define SFX_DECL_CHILDWINDOW_WITHID(Class) \ + SFX_DECL_CHILDWINDOW(Class); \ + static sal_uInt16 GetChildWindowId ()\ + +#define SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS) + +#define SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, CHILDWIN_NOPOS) + +#define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ + SfxChildWindow* Class::CreateImpl( ::Window *pParent, \ + sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ + { \ + SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\ + return pWin; \ + } \ + void Class::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags) \ + { \ + SfxChildWinFactory *pFact = new SfxChildWinFactory( \ + Class::CreateImpl, MyID, Pos ); \ + pFact->aInfo.nFlags |= nFlags; \ + pFact->aInfo.bVisible = bVis; \ + SfxChildWindow::RegisterChildWindow(pMod, pFact); \ + } + +#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \ + SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ + sal_uInt16 Class::GetChildWindowId () \ + { return MyID; } \ + +#define SFX_IMPL_FLOATINGWINDOW(Class, MyID) \ + SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_FLOATINGWINDOW_WITHID(Class, MyID) \ + SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_MODELESSDIALOG_WITHID(Class, MyID) \ + SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxModelessDialog*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + + +#define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \ + SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_DOCKINGWINDOW_WITHID(Class, MyID) \ + SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_TOOLBOX(Class, MyID) \ + SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + ((SfxToolbox*)GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +//------------------------------------------------------------------ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/cntids.hrc b/include/sfx2/cntids.hrc new file mode 100644 index 000000000000..db4c5877afd6 --- /dev/null +++ b/include/sfx2/cntids.hrc @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _CNTIDS_HRC +#define _CNTIDS_HRC + +#include <svl/cntwids.hrc> +#include <svl/solar.hrc> + +// Slot-ID's ----------------------------------------------------------------- + +#ifndef SID_SFX_START +// HACK() - SID's may not change its numerical value just like that, +// sfxsids.hrc may not be included!!! Solution: sfxsids.hrc +// include it on a lower level - for example svtools??? +#define SID_SFX_START 5000 +#endif +#define SID_TITLE (SID_SFX_START + 307) +#define SID_DELETE (SID_SFX_START + 713) +#define SID_INTERNET_ONLINE (SID_SFX_START + 1370) + +// Don't let SID_CHAOS_END grow. Internal docking windows use the range between +// SID_CHAOS_END and SID_LIB_START!! Look into sfxsids.hrc for more information! +#define SID_CHAOS_START 9000 +#define SID_CHAOS_END 9799 + +#define SID_DISTRIBUTION (SID_CHAOS_START + 26) +#define SID_INSERT (SID_CHAOS_START + 90) +#define SID_VIEW_FLD_PIC (SID_CHAOS_START + 185) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx new file mode 100644 index 000000000000..0a429b906638 --- /dev/null +++ b/include/sfx2/controlwrapper.hxx @@ -0,0 +1,644 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX_CONTROLWRAPPER_HXX +#define SFX_CONTROLWRAPPER_HXX + +#include <tools/debug.hxx> +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <memory> + +#include <vcl/button.hxx> +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <svtools/valueset.hxx> +#include <svtools/ctrlbox.hxx> + +// ============================================================================ + +namespace sfx { + +// ============================================================================ + +/** List position type of VCL ListBox. */ +typedef sal_uInt16 ListBoxPosType; +/** List position type of SVTOOLS ValueSet. */ +typedef sal_uInt16 ValueSetPosType; + +// ============================================================================ +// Helpers +// ============================================================================ + +/** A helper class for mapping list positions from/to represented values. + + Deriving from this helper class adds the two functions GetValueFromPos() + and GetPosFromValue(). The constructor receives an array of MapEntryType + structures that represents the table of positions and values. It is + possible to pass a null pointer, this results in a direct mapping between + list positions and values. If the map exists, it MUST be terminated with an + entry containing the special "not found" list position passed to the + constructor. The value contained in this last entry is used as default + value in case of an error. + */ +template< typename PosT, typename ValueT > +class PosValueMapper +{ +public: + typedef PosT PosType; + typedef ValueT ValueType; + typedef PosValueMapper< PosT, ValueT > MapperType; + + /** A helper struct that contains a list position - value pair. */ + struct MapEntryType + { + PosT mnPos; /// Position in the list. + ValueT mnValue; /// Corresponding value. + }; + + /** Constructs the map helper with the passed map. + @param nNFPos This list position is used to represent the + "not found" or "not existing" state. + @param pMap The map of list positions/values. If 0, a direct mapping + is used (simply casting between list position and values). If the map + exists, it *MUST* be terminated by an entry containing the special + "not found" list position. */ + inline explicit PosValueMapper( PosT nNFPos, const MapEntryType* pMap = 0 ) : + mpMap( pMap ), mnNFPos( nNFPos ) {} + + /** Returns the value at the specified list position. + @return The found value, or the value of the last map entry on error. */ + ValueT GetValueFromPos( PosT nPos ) const; + /** Returns the list position of the specified value. + @return The position, or the special "not found" position on error. */ + PosT GetPosFromValue( ValueT nValue ) const; + + /** Returns the special "not found" list position. */ + inline PosT GetNotFoundPos() const { return mnNFPos; } + +private: + const MapEntryType* mpMap; /// The list position/value map. + PosT mnNFPos; /// Special "not found" list position. +}; + +// ============================================================================ +// Base control wrapper classes +// ============================================================================ + +/** Base class for all control wrappers. + + Control wrappers are used to have an equal interface for various functions + used in connections for different types of controls. + + The current tree of base classes/templates and standard control wrappers: + + ControlWrapperBase + | + +- SingleControlWrapper< ControlT, ValueT > + | | + | +- DummyWindowWrapper [1] + | +- CheckBoxWrapper [1] + | +- EditWrapper [1] + | +- ColorListBoxWrapper [1] + | | + | +- NumericFieldWrapper< ValueT > [1] + | | | + | | +- [ValueType]NumericFieldWrapper [1] [2] + | | + | +- MetricFieldWrapper< ValueT > [1] + | | | + | | +- [ValueType]MetricFieldWrapper [1] [2] + | | + | +- ListBoxWrapper< ValueT > [1] + | | | + | | +- [ValueType]ListBoxWrapper [1] [2] + | | + | +- ValueSetWrapper< ValueT > [1] + | | + | +- [ValueType]ValueSetWrapper [1] [2] + | + +- MultiControlWrapperHelper + | + +- MultiControlWrapper< ValueT > + + Notes: + [1] Standard wrappers ready to use. + [2] [ValueType] is one of Int16, UInt16, Int32, UInt32, UShort, ULong. + + See documentation of class ItemConnectionBase (itemconnect.hxx) for more + details. + */ +class SFX2_DLLPUBLIC ControlWrapperBase +{ +public: + inline explicit ControlWrapperBase() {} + virtual ~ControlWrapperBase(); + + /** Derived classes enable, disable, show, or hide control(s). + @descr Will do nothing, if the corresponding parameter is STATE_DONTKNOW. */ + virtual void ModifyControl( TriState eEnable, TriState eShow ) = 0; + + /** Derived classes return true if the control is in "don't know" state. */ + virtual bool IsControlDontKnow() const = 0; + /** Derived classes set the control to "don't know" state. */ + virtual void SetControlDontKnow( bool bSet ) = 0; + +private: + /* Disable copy c'tor and assignment. */ + ControlWrapperBase( const ControlWrapperBase& ); + ControlWrapperBase& operator=( const ControlWrapperBase& ); +}; + +// ============================================================================ +// Single control wrappers +// ============================================================================ + +/** Base class template for control wrappers containing one single control. + + Classes created from this template store the reference to a single control + object. It is not required that the control is derived from VCL's Window + class. Derived classes have to implement the abstract functions + ShowControl(), EnableControl(), IsControlDontKnow(), SetControlDontKnow(), + GetControlValue(), and SetControlValue(). + + As already stated, it is not required for ControlT to be a VCL Window. + Anyway, ControlT must support the following functions: + - void ControlT::Enable( bool ) + - void ControlT::Show( bool ) + */ +template< typename ControlT, typename ValueT > +class SingleControlWrapper : public ControlWrapperBase +{ +public: + typedef ControlT ControlType; + typedef ValueT ControlValueType; + typedef SingleControlWrapper< ControlT, ValueT > SingleControlWrapperType; + + inline explicit SingleControlWrapper( ControlT& rControl ) : mrControl( rControl ) {} + + /** Returns a reference to the control this connection works on. */ + inline const ControlT& GetControl() const { return mrControl; } + /** Returns a reference to the control this connection works on. */ + inline ControlT& GetControl() { return mrControl; } + + /** Enables, disables, shows, or hides the control. + @descr Does nothing, if the corresponding parameter is STATE_DONTKNOW. */ + virtual void ModifyControl( TriState eEnable, TriState eShow ); + + /** Derived classes return the value the control contains. */ + virtual ValueT GetControlValue() const = 0; + /** Derived classes set the contents of the control to the passed value. */ + virtual void SetControlValue( ValueT aValue ) = 0; + +private: + ControlT& mrControl; /// The control of this wrapper. +}; + +// ============================================================================ + +/** A dummy wrapper for a VCL Window that does nothing special. + + This wrapper is used to implement the DummyItemConnection. It does not + connect an item to a control, but handles the special flags to disable or + hide a control, if an item is unknown. + */ +class SFX2_DLLPUBLIC DummyWindowWrapper: + public SingleControlWrapper< Window, void* > +{ +public: + explicit DummyWindowWrapper( Window& rWindow ); + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool ); + + virtual void* GetControlValue() const; + virtual void SetControlValue( void* ); +}; + +// ---------------------------------------------------------------------------- + +/** A wrapper for the VCL CheckBox. */ +class SFX2_DLLPUBLIC CheckBoxWrapper: + public SingleControlWrapper< CheckBox, sal_Bool > +{ +public: + explicit CheckBoxWrapper( CheckBox& rCheckBox ); + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool bSet ); + + virtual sal_Bool GetControlValue() const; + virtual void SetControlValue( sal_Bool bValue ); +}; + +// ---------------------------------------------------------------------------- + +/** A wrapper for the SVTOOLS ColorListBox. */ +class SFX2_DLLPUBLIC ColorListBoxWrapper: + public SingleControlWrapper< ColorListBox, Color > +{ + /* Note: cannot use 'const Color&' as template argument, because the + SVTOOLS ColorListBox returns the color by value and not by reference, + therefore GetControlValue() must return a temporary object too. */ +public: + explicit ColorListBoxWrapper(ColorListBox & rListBox); + + virtual ~ColorListBoxWrapper(); + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool bSet ); + + virtual Color GetControlValue() const; + virtual void SetControlValue( Color aColor ); +}; + +// ============================================================================ + +/** A wrapper for the VCL NumericField. */ +template< typename ValueT > +class NumericFieldWrapper : public SingleControlWrapper< NumericField, ValueT > +{ +public: + inline explicit NumericFieldWrapper( NumericField& rField ) : + SingleControlWrapper< NumericField, ValueT >( rField ) {} + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool bSet ); + + virtual ValueT GetControlValue() const; + virtual void SetControlValue( ValueT nValue ); +}; + +// ---------------------------------------------------------------------------- + +typedef NumericFieldWrapper< sal_Int16 > Int16NumericFieldWrapper; +typedef NumericFieldWrapper< sal_uInt16 > UInt16NumericFieldWrapper; +typedef NumericFieldWrapper< sal_Int32 > Int32NumericFieldWrapper; +typedef NumericFieldWrapper< sal_uInt32 > UInt32NumericFieldWrapper; + +typedef NumericFieldWrapper< sal_uInt16 > UShortNumericFieldWrapper; +typedef NumericFieldWrapper< sal_uIntPtr > ULongNumericFieldWrapper; + +// ============================================================================ + +/** A wrapper for the VCL MetricField. + + Adds support for field units during accessing the control value. The + wrapper respects the field unit set at the control itself and converts it + from/to the field unit passed to the constructor. + */ +template< typename ValueT > +class MetricFieldWrapper : public SingleControlWrapper< MetricField, ValueT > +{ +public: + inline explicit MetricFieldWrapper( MetricField& rField, FieldUnit eUnit = FUNIT_NONE ) : + SingleControlWrapper< MetricField, ValueT >( rField ), meUnit( eUnit ) {} + + virtual bool IsControlDontKnow() const; + virtual void SetControlDontKnow( bool bSet ); + + virtual ValueT GetControlValue() const; + virtual void SetControlValue( ValueT nValue ); + +private: + FieldUnit meUnit; +}; + +// ---------------------------------------------------------------------------- + +typedef MetricFieldWrapper< sal_Int16 > Int16MetricFieldWrapper; +typedef MetricFieldWrapper< sal_uInt16 > UInt16MetricFieldWrapper; +typedef MetricFieldWrapper< sal_Int32 > Int32MetricFieldWrapper; +typedef MetricFieldWrapper< sal_uInt32 > UInt32MetricFieldWrapper; + +typedef MetricFieldWrapper< sal_uInt16 > UShortMetricFieldWrapper; +typedef MetricFieldWrapper< sal_uIntPtr > ULongMetricFieldWrapper; + +// ============================================================================ + +/** A wrapper for the VCL ListBox. + + If a position<->value map is passed to the constructor, it MUST be + terminated with an entry containing LISTBOX_ENTRY_NOTFOUND as list + position. See documentation of the PosValueMapper template for details. + */ +template< typename ValueT > +class ListBoxWrapper : + public SingleControlWrapper< ListBox, ValueT >, + public PosValueMapper< ListBoxPosType, ValueT > +{ + typedef PosValueMapper< ListBoxPosType, ValueT > MapperType; + +public: + typedef typename MapperType::MapEntryType MapEntryType; + + /** @param pMap Optional list position <-> value map. + See PosValueMapper documentation for details. */ + inline explicit ListBoxWrapper( ListBox& rListBox, const MapEntryType* pMap = 0 ) : + SingleControlWrapper< ListBox, ValueT >( rListBox ), MapperType( LISTBOX_ENTRY_NOTFOUND, pMap ) {} + + virtual bool IsControlDontKnow() const + { return this->GetControl().GetSelectEntryCount() == 0; } + virtual void SetControlDontKnow( bool bSet ) + { if( bSet ) this->GetControl().SetNoSelection(); } + + virtual ValueT GetControlValue() const; + virtual void SetControlValue( ValueT nValue ); +}; + +// ---------------------------------------------------------------------------- + +typedef ListBoxWrapper< sal_Int16 > Int16ListBoxWrapper; +typedef ListBoxWrapper< sal_uInt16 > UInt16ListBoxWrapper; +typedef ListBoxWrapper< sal_Int32 > Int32ListBoxWrapper; +typedef ListBoxWrapper< sal_uInt32 > UInt32ListBoxWrapper; + +typedef ListBoxWrapper< sal_uInt16 > UShortListBoxWrapper; +typedef ListBoxWrapper< sal_uIntPtr > ULongListBoxWrapper; + +// ============================================================================ + +/** A wrapper for the SVTOOLS ValueSet. + + If a position<->value map is passed to the constructor, it MUST be + terminated with an entry containing VALUESET_ITEM_NOTFOUND as list + position. See documentation of the PosValueMapper template for details. + */ +template< typename ValueT > +class ValueSetWrapper : + public SingleControlWrapper< ValueSet, ValueT >, + public PosValueMapper< ValueSetPosType, ValueT > +{ + typedef PosValueMapper< ValueSetPosType, ValueT > MapperType; + +public: + typedef typename MapperType::MapEntryType MapEntryType; + + /** @param pMap Optional position <-> value map. + See PosValueMapper documentation for details. */ + inline explicit ValueSetWrapper( ValueSet& rValueSet, const MapEntryType* pMap = 0 ) : + SingleControlWrapper< ValueSet, ValueT >( rValueSet ), MapperType( VALUESET_ITEM_NOTFOUND, pMap ) {} + + virtual bool IsControlDontKnow() const + { return this->GetControl().IsNoSelection(); } + virtual void SetControlDontKnow( bool bSet ) + { if( bSet ) this->GetControl().SetNoSelection(); } + + virtual ValueT GetControlValue() const; + virtual void SetControlValue( ValueT nValue ); +}; + +// ---------------------------------------------------------------------------- + +typedef ValueSetWrapper< sal_Int16 > Int16ValueSetWrapper; +typedef ValueSetWrapper< sal_uInt16 > UInt16ValueSetWrapper; +typedef ValueSetWrapper< sal_Int32 > Int32ValueSetWrapper; +typedef ValueSetWrapper< sal_uInt32 > UInt32ValueSetWrapper; + +typedef ValueSetWrapper< sal_uInt16 > UShortValueSetWrapper; +typedef ValueSetWrapper< sal_uIntPtr > ULongValueSetWrapper; + +// ============================================================================ +// Multi control wrappers +// ============================================================================ + +struct MultiControlWrapperHelper_Impl; + +/** A container of control wrappers. + + Derived classes should define control wrapper members and register them in + their constructor, using the function RegisterControlWrapper(). + + This wrapper implements the abstract functions of the ControlWrapperBase + base class by calling the functions of all registered wrappers. + */ +class SFX2_DLLPUBLIC MultiControlWrapperHelper : public ControlWrapperBase +{ +public: + explicit MultiControlWrapperHelper(); + virtual ~MultiControlWrapperHelper(); + + /** Registers a control wrapper (should be a member of a derived class). */ + void RegisterControlWrapper( ControlWrapperBase& rWrapper ); + + /** Enables, disables, shows, or hides the registered controls. */ + virtual void ModifyControl( TriState eEnable, TriState eShow ); + + /** Returns true if all registered controls are in "don't know" state. */ + virtual bool IsControlDontKnow() const; + /** Sets all registered controls to "don't know" state. */ + virtual void SetControlDontKnow( bool bSet ); + +private: + std::auto_ptr< MultiControlWrapperHelper_Impl > mxImpl; +}; + +// ---------------------------------------------------------------------------- + +/** A multi control wrapper with extended interface. + + This template class extends the MultiControlWrapperHelper class by the + functions GetControlValue() and SetControlValue(), known from the + SingleControlWrapper template. This makes it possible to use this template + in item connections expecting a single control wrapper. The type ValueT + should be able to contain the values of all controls handled in this + wrapper. In most cases, the easiest way to achieve this is to use the + related item type directly, using the IdentItemWrapper template + (itemwrapper.hxx). + */ +template< typename ValueT > +class MultiControlWrapper : public MultiControlWrapperHelper +{ +public: + typedef MultiControlWrapperHelper ControlType; + typedef ValueT ControlValueType; + typedef MultiControlWrapper< ValueT > MultiControlWrapperType; + + MultiControlWrapper() : maDefValue( 0 ){} + + /** Returns the default value that can be used in GetControlValue(). */ + inline const ValueT& GetDefaultValue() const { return maDefValue; } + /** Sets a default value that can be used in GetControlValue(). */ + inline void SetDefaultValue( const ValueT& rDefValue ) { maDefValue = rDefValue; } + + /** Derived classes return the value the control contains. */ + virtual ValueT GetControlValue() const = 0; + /** Derived classes set the contents of the control to the passed value. */ + virtual void SetControlValue( ValueT aValue ) = 0; + +private: + ValueT maDefValue; +}; + +// ============================================================================ + + +// ============================================================================ +// *** Implementation of template functions *** +// ============================================================================ + +// ============================================================================ +// Helpers +// ============================================================================ + +template< typename PosT, typename ValueT > +ValueT PosValueMapper< PosT, ValueT >::GetValueFromPos( PosT nPos ) const +{ + ValueT nValue; + if( mpMap ) + { + const MapEntryType* pEntry = mpMap; + while( (pEntry->mnPos != nPos) && (pEntry->mnPos != mnNFPos) ) + ++pEntry; + nValue = pEntry->mnValue; + } + else /* if( nPos != mnNFPos ) */ + { + DBG_ASSERT( nPos != mnNFPos, "sfx2::PosValueMapper< PosT, ValueT >::GetValueFromPos(), previously uninitialized value found!" ); + nValue = static_cast< ValueT >( nPos ); + } + + return nValue; +} + +template< typename PosT, typename ValueT > +PosT PosValueMapper< PosT, ValueT >::GetPosFromValue( ValueT nValue ) const +{ + PosT nPos = mnNFPos; + if( mpMap ) + { + const MapEntryType* pEntry = mpMap; + while( (pEntry->mnValue != nValue) && (pEntry->mnPos != mnNFPos) ) + ++pEntry; + nPos = pEntry->mnPos; + } + else if( nValue >= 0 ) + nPos = static_cast< PosT >( nValue ); + return nPos; +} + +// ============================================================================ +// Single control wrappers +// ============================================================================ + +template< typename ControlT, typename ValueT > +inline void SingleControlWrapper< ControlT, ValueT >::ModifyControl( TriState eEnable, TriState eShow ) +{ + if( eEnable != STATE_DONTKNOW ) + mrControl.Enable( eEnable == STATE_CHECK ); + if( eShow != STATE_DONTKNOW ) + mrControl.Show( eShow == STATE_CHECK ); +} + +// ============================================================================ + +template< typename ValueT > +bool NumericFieldWrapper< ValueT >::IsControlDontKnow() const +{ + return this->GetControl().GetText().Len() == 0; +} + +template< typename ValueT > +void NumericFieldWrapper< ValueT >::SetControlDontKnow( bool bSet ) +{ + if( bSet ) + this->GetControl().SetText( String() ); +} + +template< typename ValueT > +ValueT NumericFieldWrapper< ValueT >::GetControlValue() const +{ + return static_cast< ValueT >( this->GetControl().Denormalize( this->GetControl().GetValue() ) ); +} + +template< typename ValueT > +void NumericFieldWrapper< ValueT >::SetControlValue( ValueT nValue ) +{ + this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ) ); +} + +// ============================================================================ + +template< typename ValueT > +bool MetricFieldWrapper< ValueT >::IsControlDontKnow() const +{ + return this->GetControl().GetText().isEmpty(); +} + +template< typename ValueT > +void MetricFieldWrapper< ValueT >::SetControlDontKnow( bool bSet ) +{ + if( bSet ) + this->GetControl().SetText( String() ); +} + +template< typename ValueT > +ValueT MetricFieldWrapper< ValueT >::GetControlValue() const +{ + return static_cast< ValueT >( this->GetControl().Denormalize( this->GetControl().GetValue( meUnit ) ) ); +} + +template< typename ValueT > +void MetricFieldWrapper< ValueT >::SetControlValue( ValueT nValue ) +{ + this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ), meUnit ); +} + +// ============================================================================ + +template< typename ValueT > +ValueT ListBoxWrapper< ValueT >::GetControlValue() const +{ + return this->GetValueFromPos( this->GetControl().GetSelectEntryPos() ); +} + +template< typename ValueT > +void ListBoxWrapper< ValueT >::SetControlValue( ValueT nValue ) +{ + sal_uInt16 nPos = this->GetPosFromValue( nValue ); + if( nPos != this->GetNotFoundPos() ) + this->GetControl().SelectEntryPos( nPos ); +} + +// ---------------------------------------------------------------------------- + +template< typename ValueT > +ValueT ValueSetWrapper< ValueT >::GetControlValue() const +{ + return this->GetValueFromPos( this->GetControl().GetSelectItemId() ); +} + +template< typename ValueT > +void ValueSetWrapper< ValueT >::SetControlValue( ValueT nValue ) +{ + sal_uInt16 nPos = this->GetPosFromValue( nValue ); + if( nPos != this->GetNotFoundPos() ) + this->GetControl().SelectItem( nPos ); +} + +// ============================================================================ + + +} // namespace sfx + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx new file mode 100644 index 000000000000..af6288e772e9 --- /dev/null +++ b/include/sfx2/ctrlitem.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXCTRLITEM_HXX +#define _SFXCTRLITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <svl/poolitem.hxx> + +class SfxPoolItem; +class SfxBindings; +class SvStream; + +class SFX2_DLLPUBLIC SfxControllerItem +{ +private: + sal_uInt16 nId; + SfxControllerItem* pNext; // to notify next ControllerItem + SfxBindings* pBindings; + +protected: +#if defined( DBG_UTIL ) + SAL_DLLPRIVATE void CheckConfigure_Impl( sal_uIntPtr nType ); +#endif + +public: + SfxBindings & GetBindings() { + DBG_ASSERT(pBindings, "no Bindings"); + return *pBindings; + } + const SfxBindings & GetBindings() const { + DBG_ASSERT(pBindings, "no Bindings"); + return *pBindings; + } + + SfxControllerItem(); // for arrays + SfxControllerItem( sal_uInt16 nId, SfxBindings & ); + virtual ~SfxControllerItem(); + + void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings + void UnBind(); + void ReBind(); + sal_Bool IsBound() const; + void ClearCache(); + void SetBindings(SfxBindings &rBindings) { pBindings = &rBindings; } + + SfxControllerItem* GetItemLink(); + SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewLink ); + + void SetId( sal_uInt16 nItemId ); + sal_uInt16 GetId() const { return nId; } + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual void DeleteFloatingWindow(); + + SfxMapUnit GetCoreMetric() const; + + static SfxItemState GetItemState( const SfxPoolItem* pState ); + + SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const + { return pBindings != NULL; } + SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* ); +}; + +//==================================================================== + +class SFX2_DLLPUBLIC SfxStatusForwarder: public SfxControllerItem +{ + SfxControllerItem* pMaster; + +protected: + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + +public: + SfxStatusForwarder( sal_uInt16 nSlotId, + SfxControllerItem&rMaster ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dialogs.hrc b/include/sfx2/dialogs.hrc new file mode 100644 index 000000000000..debf4e64c21c --- /dev/null +++ b/include/sfx2/dialogs.hrc @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX2_DIALOGS_HRC +#define _SFX2_DIALOGS_HRC + +#include <sfx2/sfxsids.hrc> +#include <sfx2/tabpage.hrc> + +#define RID_OFA_AUTOCORR_DLG (RID_OFA_START + 101) +#define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx new file mode 100644 index 000000000000..c0758b56bc00 --- /dev/null +++ b/include/sfx2/dinfdlg.hxx @@ -0,0 +1,501 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_DINFDLG_HXX +#define _SFX_DINFDLG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Duration.hpp> + +#include <svl/stritem.hxx> +#include <svl/zforlist.hxx> + +#include <svtools/headbar.hxx> +#include <svtools/stdctrl.hxx> +#include <svtools/svmedit.hxx> + +#include <unotools/syslocale.hxx> + +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <vcl/layout.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/scrbar.hxx> + +#include "tabdlg.hxx" + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } +} } } + +struct CustomProperty; + + +// class SfxDocumentInfoItem --------------------------------------------- + +class SFX2_DLLPUBLIC SfxDocumentInfoItem : public SfxStringItem +{ +private: + sal_Int32 m_AutoloadDelay; + OUString m_AutoloadURL; + sal_Bool m_isAutoloadEnabled; + OUString m_DefaultTarget; + OUString m_TemplateName; + OUString m_Author; + ::com::sun::star::util::DateTime m_CreationDate; + OUString m_ModifiedBy; + ::com::sun::star::util::DateTime m_ModificationDate; + OUString m_PrintedBy; + ::com::sun::star::util::DateTime m_PrintDate; + sal_Int16 m_EditingCycles; + sal_Int32 m_EditingDuration; + OUString m_Description; + OUString m_Keywords; + OUString m_Subject; + OUString m_Title; + sal_Bool m_bHasTemplate; + sal_Bool m_bDeleteUserData; + sal_Bool m_bUseUserData; + std::vector< CustomProperty* > m_aCustomProperties; + +public: + TYPEINFO(); + SfxDocumentInfoItem(); + SfxDocumentInfoItem( const String &rFileName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> & i_xDocProps, + sal_Bool bUseUserData ); + SfxDocumentInfoItem( const SfxDocumentInfoItem& ); + virtual ~SfxDocumentInfoItem(); + + /// update i_xDocProps with the data in this object + void UpdateDocumentInfo( + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> & i_xDocProps, + bool i_bDoNotUpdateUserDefined = false) + const; + + sal_Bool isAutoloadEnabled() const { return m_isAutoloadEnabled; } + void setAutoloadEnabled(sal_Bool i_val) { m_isAutoloadEnabled = i_val; } + sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; } + void setAutoloadDelay(sal_Int32 i_val) { m_AutoloadDelay = i_val; } + OUString getAutoloadURL() const { return m_AutoloadURL; } + void setAutoloadURL(OUString i_val) { m_AutoloadURL = i_val; } + OUString getDefaultTarget() const { return m_DefaultTarget; } + void setDefaultTarget(OUString i_val) { m_DefaultTarget = i_val; } + OUString getTemplateName() const { return m_TemplateName; } + void setTemplateName(OUString i_val) { m_TemplateName = i_val; } + OUString getAuthor() const { return m_Author; } + void setAuthor(OUString i_val) { m_Author = i_val; } + + ::com::sun::star::util::DateTime + getCreationDate() const { return m_CreationDate; } + void setCreationDate(::com::sun::star::util::DateTime i_val) { + m_CreationDate = i_val; + } + OUString getModifiedBy() const { return m_ModifiedBy; } + void setModifiedBy(OUString i_val) { m_ModifiedBy = i_val; } + + ::com::sun::star::util::DateTime + getModificationDate() const { return m_ModificationDate; } + void setModificationDate(::com::sun::star::util::DateTime i_val) { + m_ModificationDate = i_val; + } + OUString getPrintedBy() const { return m_PrintedBy; } + void setPrintedBy(OUString i_val) { m_PrintedBy = i_val; } + ::com::sun::star::util::DateTime + getPrintDate() const { return m_PrintDate; } + void setPrintDate(::com::sun::star::util::DateTime i_val) { + m_PrintDate = i_val; + } + sal_Int16 getEditingCycles() const { return m_EditingCycles; } + void setEditingCycles(sal_Int16 i_val) { m_EditingCycles = i_val; } + sal_Int32 getEditingDuration() const { return m_EditingDuration; } + void setEditingDuration(sal_Int32 i_val) { m_EditingDuration = i_val; } + OUString getDescription() const { return m_Description; } + void setDescription(OUString i_val) { m_Description = i_val; } + OUString getKeywords() const { return m_Keywords; } + void setKeywords(OUString i_val) { m_Keywords = i_val; } + OUString getSubject() const { return m_Subject; } + void setSubject(OUString i_val) { m_Subject = i_val; } + OUString getTitle() const { return m_Title; } + void setTitle(OUString i_val) { m_Title = i_val; } + + /// reset user-specific data (author, modified-by, ...) + void resetUserData(const OUString & i_rAuthor); + + void SetTemplate( sal_Bool b ) { m_bHasTemplate = b; } + sal_Bool HasTemplate() const { return m_bHasTemplate; } + void SetDeleteUserData( sal_Bool bSet ); + void SetUseUserData( sal_Bool bSet ); + sal_Bool IsDeleteUserData() const; + sal_Bool IsUseUserData() const; + + std::vector< CustomProperty* > GetCustomProperties() const; + void ClearCustomProperties(); + void AddCustomProperty( const OUString& sName, + const com::sun::star::uno::Any& rValue ); + + virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const; + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +// class SfxDocumentPage ------------------------------------------------- + +class SfxDocumentPage : public SfxTabPage +{ +private: + FixedImage* m_pBmp; + Edit* m_pNameED; + PushButton* m_pChangePassBtn; + + SelectableFixedText* m_pShowTypeFT; + CheckBox* m_pReadOnlyCB; + SelectableFixedText* m_pFileValFt; + SelectableFixedText* m_pShowSizeFT; + + SelectableFixedText* m_pCreateValFt; + SelectableFixedText* m_pChangeValFt; + SelectableFixedText* m_pSignedValFt; + PushButton* m_pSignatureBtn; + SelectableFixedText* m_pPrintValFt; + SelectableFixedText* m_pTimeLogValFt; + SelectableFixedText* m_pDocNoValFt; + + CheckBox* m_pUseUserDataCB; + PushButton* m_pDeleteBtn; + + FixedText* m_pTemplFt; + SelectableFixedText* m_pTemplValFt; + + OUString m_aUnknownSize; + OUString m_aMultiSignedStr; + + sal_Bool bEnableUseUserData : 1, + bHandleDelete : 1; + + DECL_LINK(DeleteHdl, void *); + DECL_LINK(SignatureHdl, void *); + DECL_LINK(ChangePassHdl, void *); + void ImplUpdateSignatures(); + void ImplCheckPasswordState(); + +protected: + SfxDocumentPage( Window* pParent, const SfxItemSet& ); + + virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); + + void EnableUseUserData(); +}; + +// class SfxDocumentDescPage --------------------------------------------- + +class SfxDocumentDescPage : public SfxTabPage +{ +private: + Edit* m_pTitleEd; + Edit* m_pThemaEd; + Edit* m_pKeywordsEd; + VclMultiLineEdit* m_pCommentEd; + SfxDocumentInfoItem* m_pInfoItem; + +protected: + SfxDocumentDescPage( Window* pParent, const SfxItemSet& ); + + virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); +}; + +// class SfxDocumentInfoDialog ------------------------------------------- + +class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog +{ +private: + sal_uInt16 m_nDocInfoId; +protected: + virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage ); + +public: + SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& ); + void AddFontTabPage(); +}; + +// class CustomPropertiesRemoveButton ------------------------------------ + +struct CustomPropertyLine; + +class CustomPropertiesEdit : public Edit +{ +private: + CustomPropertyLine* m_pLine; + +public: + inline CustomPropertiesEdit( + Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : + Edit( pParent, rResId ), m_pLine( pLine ) {} + + inline CustomPropertyLine* GetLine() const { return m_pLine; } +}; + +class CustomPropertiesTypeBox : public ListBox +{ +private: + CustomPropertyLine* m_pLine; + +public: + inline CustomPropertiesTypeBox( + Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : + ListBox( pParent, rResId ), m_pLine( pLine ) {} + + inline CustomPropertyLine* GetLine() const { return m_pLine; } +}; + +class CustomPropertiesDateField : public DateField +{ +private: + CustomPropertyLine* m_pLine; + +public: + inline CustomPropertiesDateField( + Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : + DateField( pParent, rResId ), m_pLine( pLine ) {} + + inline CustomPropertyLine* GetLine() const { return m_pLine; } +}; +class CustomPropertiesTimeField : public TimeField +{ +private: + CustomPropertyLine* m_pLine; + +public: + inline CustomPropertiesTimeField( + Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : + TimeField( pParent, rResId ), m_pLine( pLine ) {} + + inline CustomPropertyLine* GetLine() const { return m_pLine; } +}; +class CustomPropertiesDurationField : public Edit +{ + CustomPropertyLine* m_pLine; + com::sun::star::util::Duration m_aDuration; +protected: + virtual void RequestHelp(const HelpEvent& rEvt); +public: + CustomPropertiesDurationField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ); + ~CustomPropertiesDurationField(); + + void SetDuration( const com::sun::star::util::Duration& rDuration ); + const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; } +}; + +class CustomPropertiesEditButton : public PushButton +{ + CustomPropertyLine* m_pLine; + +public: + CustomPropertiesEditButton( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ); + ~CustomPropertiesEditButton(); + + DECL_LINK(ClickHdl, void *); +}; + +class CustomPropertiesRemoveButton : public ImageButton +{ +private: + CustomPropertyLine* m_pLine; + +public: + inline CustomPropertiesRemoveButton( + Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : + ImageButton( pParent, rResId ), m_pLine( pLine ) {} + + inline CustomPropertyLine* GetLine() const { return m_pLine; } +}; + +class CustomPropertiesYesNoButton : public Control +{ +private: + RadioButton m_aYesButton; + RadioButton m_aNoButton; + +public: + CustomPropertiesYesNoButton( Window* pParent, const ResId& rResId ); + + virtual void Resize(); + + inline void CheckYes() { m_aYesButton.Check(); } + inline void CheckNo() { m_aNoButton.Check(); } + inline bool IsYesChecked() const { return m_aYesButton.IsChecked() != sal_False; } +}; + +// struct CustomPropertyLine --------------------------------------------- + +struct CustomPropertyLine +{ + ComboBox m_aNameBox; + CustomPropertiesTypeBox m_aTypeBox; + CustomPropertiesEdit m_aValueEdit; + CustomPropertiesDateField m_aDateField; + CustomPropertiesTimeField m_aTimeField; + const String m_sDurationFormat; + CustomPropertiesDurationField m_aDurationField; + CustomPropertiesEditButton m_aEditButton; + CustomPropertiesYesNoButton m_aYesNoButton; + CustomPropertiesRemoveButton m_aRemoveButton; + + Point m_aDatePos; + Point m_aTimePos; + Size m_aDateTimeSize; + + bool m_bIsRemoved; + bool m_bTypeLostFocus; + + CustomPropertyLine( Window* pParent ); + + void SetRemoved(); +}; + +// class CustomPropertiesWindow ------------------------------------------ + +class CustomPropertiesWindow : public Window +{ +private: + ComboBox m_aNameBox; + ListBox m_aTypeBox; + Edit m_aValueEdit; + DateField m_aDateField; + TimeField m_aTimeField; + Edit m_aDurationField; + PushButton m_aEditButton; + CustomPropertiesYesNoButton m_aYesNoButton; + ImageButton m_aRemoveButton; + + sal_Int32 m_nLineHeight; + sal_Int32 m_nScrollPos; + SvtSysLocale m_aSysLocale; + std::vector< CustomPropertyLine* > m_aCustomPropertiesLines; + CustomPropertyLine* m_pCurrentLine; + SvNumberFormatter m_aNumberFormatter; + Timer m_aEditLoseFocusTimer; + Timer m_aBoxLoseFocusTimer; + Link m_aRemovedHdl; + + DECL_LINK( TypeHdl, CustomPropertiesTypeBox* ); + DECL_LINK( RemoveHdl, CustomPropertiesRemoveButton* ); + DECL_LINK( EditLoseFocusHdl, CustomPropertiesEdit* ); + DECL_LINK( BoxLoseFocusHdl, CustomPropertiesTypeBox* ); + //add lose focus handlers of Date/TimeField? + + DECL_LINK(EditTimeoutHdl, void *); + DECL_LINK(BoxTimeoutHdl, void *); + + bool IsLineValid( CustomPropertyLine* pLine ) const; + void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox ); + +public: + CustomPropertiesWindow(Window* pParent, + const OUString &rHeaderAccName, + const OUString &rHeaderAccType, + const OUString &rHeaderAccValue); + ~CustomPropertiesWindow(); + + void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar ); + sal_uInt16 GetVisibleLineCount() const; + inline sal_Int32 GetLineHeight() const { return m_nLineHeight; } + void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny ); + bool AreAllLinesValid() const; + void ClearAllLines(); + void DoScroll( sal_Int32 nNewPos ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GetCustomProperties() const; + void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; } + + void InitRemoveButton(const ScrollBar &rScrollBar); + void updateLineWidth(); +}; + +// class CustomPropertiesControl ----------------------------------------- + +class CustomPropertiesControl : public VclVBox +{ +private: + HeaderBar* m_pHeaderBar; + VclHBox* m_pBody; + CustomPropertiesWindow* m_pPropertiesWin; + ScrollBar* m_pVertScroll; + + sal_Int32 m_nThumbPos; + + DECL_LINK( ScrollHdl, ScrollBar* ); + DECL_LINK( RemovedHdl, void* ); + +public: + CustomPropertiesControl(Window* pParent); + ~CustomPropertiesControl(); + + void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive ); + + inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); } + inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); } + inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GetCustomProperties() const + { return m_pPropertiesWin->GetCustomProperties(); } + void Init(VclBuilderContainer& rParent); + virtual void setAllocation(const Size &rAllocation); +}; + +// class SfxCustomPropertiesPage ----------------------------------------- + +class SfxCustomPropertiesPage : public SfxTabPage +{ +private: + CustomPropertiesControl* m_pPropertiesCtrl; + + DECL_LINK(AddHdl, void *); + + using TabPage::DeactivatePage; + +protected: + SfxCustomPropertiesPage( Window* pParent, const SfxItemSet& ); + + virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + virtual int DeactivatePage( SfxItemSet* pSet = NULL ); + +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); +}; + +#endif // #ifndef _SFX_DINFDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dinfedt.hxx b/include/sfx2/dinfedt.hxx new file mode 100644 index 000000000000..b24908a7d081 --- /dev/null +++ b/include/sfx2/dinfedt.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_DINFEDT_HXX +#define _SFX_DINFEDT_HXX + +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> + +// class InfoEdit_Impl --------------------------------------------------- + +class InfoEdit_Impl : public Edit +{ +public: + InfoEdit_Impl( Window* pParent, const ResId& rResId ) : + Edit( pParent, rResId ) {} + + virtual void KeyInput( const KeyEvent& rKEvent ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx new file mode 100644 index 000000000000..2b02a5e620c6 --- /dev/null +++ b/include/sfx2/dispatch.hxx @@ -0,0 +1,308 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXDISPATCH_HXX +#define _SFXDISPATCH_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" + +#include <stdarg.h> + +#include <sfx2/bindings.hxx> +#include <sfx2/viewfrm.hxx> +#include <map> +#include <vector> + +class SfxSlotServer; +class SfxShell; +class SfxRequest; +class SfxHintPoster; +class SfxViewFrame; +class SfxBindings; +class SfxItemSet; +class SfxPopupMenuManager; +class SfxModule; +struct SfxDispatcher_Impl; + +typedef std::vector<SfxShell*> SfxShellStack_Impl; + +namespace com +{ + namespace sun + { + namespace star + { + namespace frame + { + class XDispatch; + } + } + } +} + +//========================================================================= + +#define SFX_SHELL_POP_UNTIL 4 +#define SFX_SHELL_POP_DELETE 2 +#define SFX_SHELL_PUSH 1 + +//========================================================================= + +// Maps the Which() field to a pointer to a SfxPoolItem +class SfxItemPtrMap : public std::map<sal_uInt16, SfxPoolItem*> +{ +public: + ~SfxItemPtrMap() + { + for(iterator it = begin(); it != end(); ++it) + delete it->second; + } +}; + +class SFX2_DLLPUBLIC SfxDispatcher +{ + SfxDispatcher_Impl* pImp; + sal_Bool bFlushed; + +private: + // Search for temporary evaluated Todos + SAL_DLLPRIVATE sal_Bool CheckVirtualStack( const SfxShell& rShell, sal_Bool bDeep ); + +#ifndef _SFX_HXX + +friend class SfxApplication; +friend class SfxViewFrame; + + DECL_DLLPRIVATE_LINK( EventHdl_Impl, void * ); + DECL_DLLPRIVATE_LINK( PostMsgHandler, SfxRequest * ); + + SAL_DLLPRIVATE int Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, sal_Bool bRecord ); + SAL_DLLPRIVATE void _Update_Impl( sal_Bool,sal_Bool,sal_Bool,SfxWorkWindow*); + SAL_DLLPRIVATE void CollectTools_Impl(SfxWorkWindow*); + +protected: +friend class SfxBindings; +friend class SfxStateCache; +friend class SfxPopupMenuManager; +friend class SfxHelp; + // For bindings: Finding the Message; + // level for re-access + SAL_DLLPRIVATE sal_Bool _TryIntercept_Impl( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal ); + sal_Bool _FindServer( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal ); + sal_Bool _FillState( const SfxSlotServer &rServer, + SfxItemSet &rState, const SfxSlot *pRealSlot ); + void _Execute( SfxShell &rShell, const SfxSlot &rSlot, + SfxRequest &rReq, + SfxCallMode eCall = SFX_CALLMODE_STANDARD); +#endif +protected: + void FlushImpl(); + +public: + SfxDispatcher( SfxDispatcher* pParent ); + SfxDispatcher( SfxViewFrame *pFrame = 0 ); + + SAL_DLLPRIVATE void Construct_Impl( SfxDispatcher* pParent ); + + virtual ~SfxDispatcher(); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall = SFX_CALLMODE_SLOT, + const SfxPoolItem **pArgs = 0, + sal_uInt16 nModi = 0, + const SfxPoolItem **pInternalArgs = 0); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall, + SfxItemSet* pArgs, + SfxItemSet* pInternalArgs, + sal_uInt16 nModi = 0); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall, + const SfxPoolItem *pArg1, ... ); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall, + const SfxItemSet &rArgs ); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall, + sal_uInt16 nModi, + const SfxItemSet &rArgs ); + + const SfxSlot* GetSlot( const String& rCommand ); + + sal_Bool IsActive( const SfxShell& rShell ); + sal_Bool IsOnTop( const SfxShell& rShell ); + sal_uInt16 GetShellLevel( const SfxShell &rShell ); + SfxBindings* GetBindings() const; + + void Push( SfxShell& rShell ); + void Pop( SfxShell& rShell, sal_uInt16 nMode = 0 ); + + SfxShell* GetShell(sal_uInt16 nIdx) const; + SfxViewFrame* GetFrame() const; + SfxModule* GetModule() const; + // caller has to clean up the Manager on his own + static SfxPopupMenuManager* Popup( sal_uInt16 nConfigId,Window *pWin, const Point *pPos ); + + void ExecutePopup( const ResId &rId, + Window *pWin = 0, const Point *pPosPixel = 0 ); + static void ExecutePopup( sal_uInt16 nConfigId = 0, + Window *pWin = 0, const Point *pPosPixel = 0 ); + + sal_Bool IsAppDispatcher() const; + sal_Bool IsFlushed() const; + void Flush(); + void Lock( sal_Bool bLock ); + sal_Bool IsLocked( sal_uInt16 nSID = 0 ) const; + void SetSlotFilter( sal_Bool bEnable = sal_False, + sal_uInt16 nCount = 0, const sal_uInt16 *pSIDs = 0 ); + + void HideUI( sal_Bool bHide = sal_True ); + void ShowObjectBar(sal_uInt16 nId, SfxShell *pShell=0) const; + sal_uInt32 GetObjectBarId( sal_uInt16 nPos ) const; + + SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState ); + SfxItemState QueryState( sal_uInt16 nSID, ::com::sun::star::uno::Any& rAny ); + + ::com::sun::star::frame::XDispatch* GetDispatchInterface( const String& ); + void SetDisableFlags( sal_uInt32 nFlags ); + sal_uInt32 GetDisableFlags() const; + + SAL_DLLPRIVATE void SetMenu_Impl(); + SAL_DLLPRIVATE void Update_Impl( sal_Bool bForce = sal_False ); // ObjectBars etc. + SAL_DLLPRIVATE sal_Bool IsUpdated_Impl() const; + SAL_DLLPRIVATE int GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot, + sal_Bool bOwnShellsOnly, sal_Bool bModal, sal_Bool bRealSlot=sal_True ); + SAL_DLLPRIVATE void SetReadOnly_Impl( sal_Bool bOn ); + SAL_DLLPRIVATE sal_Bool GetReadOnly_Impl() const; + SAL_DLLPRIVATE sal_Bool IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const; + SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool bOn ); + SAL_DLLPRIVATE sal_Bool IsReadOnlyShell_Impl( sal_uInt16 nShell ) const; + SAL_DLLPRIVATE void RemoveShell_Impl( SfxShell& rShell ); + SAL_DLLPRIVATE void DoParentActivate_Impl(); + SAL_DLLPRIVATE void DoParentDeactivate_Impl(); + SAL_DLLPRIVATE void DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* pOld ); + SAL_DLLPRIVATE void DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ); + SAL_DLLPRIVATE void InvalidateBindings_Impl(sal_Bool); + SAL_DLLPRIVATE sal_uInt16 GetNextToolBox_Impl( sal_uInt16 nPos, sal_uInt16 nType, String *pStr ); +}; + +//-------------------------------------------------------------------- + +inline sal_Bool SfxDispatcher::IsFlushed() const + +/* [Description] + + This method checks if the stack of the SfxDispatchers is flushed, or if + push- or pop- commands are pending. +*/ + +{ + return bFlushed; +} + +//-------------------------------------------------------------------- + +inline void SfxDispatcher::Flush() + +/* [Description] + + This method performs outstanding push- and pop- commands. For <SfxShell>s, + which are new on the stack, the <SfxShell::Activate(sal_Bool)> is invoked with + bMDI == sal_True, for SfxShells that are removed from the stack, the + <SfxShell::Deactivate(sal_Bool)> is invoked with bMDI == sal_True +*/ + +{ + if ( !bFlushed ) FlushImpl(); +} + +//-------------------------------------------------------------------- + +inline void SfxDispatcher::Push( SfxShell& rShell ) + +/* [Description] + + With this method, a <SfxShell> pushed on to the SfxDispatcher. + The SfxShell is first marked for push and a timer is set up. + First when the timer has couted down to zero the push + ( <SfxDispatcher::Flush()> ) is actually performed and the + <SfxBindings> is invalidated. While the timer is counting down + the opposing push and pop commands on the same SfxShell are + leveled out. +*/ + +{ + Pop( rShell, SFX_SHELL_PUSH ); +} + +//-------------------------------------------------------------------- + +inline sal_Bool SfxDispatcher::IsActive( const SfxShell& rShell ) + +/* [Description] + + This method checks whether a particular <SfxShell> instance is + on the SfxDispatcher. + + [Return value] + + sal_Bool sal_True + The SfxShell instance is on the SfxDispatcher. + + sal_False + The SfxShell instance is not on the SfxDispatcher. +*/ + +{ + return CheckVirtualStack( rShell, sal_True ); +} +//-------------------------------------------------------------------- + +inline sal_Bool SfxDispatcher::IsOnTop( const SfxShell& rShell ) + +/* [Description] + + This method checks whether a particular <SfxShell> instance is on + top of the SfxDispatcher. + + [Return value] + + sal_Bool sal_True + The SfxShell instance is on the top of + the SfxDispatcher. + + sal_False + The SfxShell instance is not on the top of + the SfxDispatcher. +*/ + +{ + return CheckVirtualStack( rShell, sal_False ); +} + +//-------------------------------------------------------------------- + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dllapi.h b/include/sfx2/dllapi.h new file mode 100644 index 000000000000..95ba80bff9e5 --- /dev/null +++ b/include/sfx2/dllapi.h @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_DLLAPI_H +#define INCLUDED_SFX2_DLLAPI_H + +#include "sal/config.h" +#include "sal/types.h" + +#if defined SFX2_DLLIMPLEMENTATION +#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#define SFX2_DLLPRIVATE SAL_DLLPRIVATE + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx new file mode 100644 index 000000000000..e8d15a8366cd --- /dev/null +++ b/include/sfx2/docfac.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_OBJFAC_HXX +#define _SFX_OBJFAC_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <sal/types.h> +#include <tools/solar.h> +#include <tools/rtti.hxx> + +// SFX_IMPL_MODULE_LIB +#include <osl/module.hxx> +#include <rtl/ustring.hxx> + +#include <sfx2/objsh.hxx> +#include <sfx2/sfxdefs.hxx> + +class SfxMedium; +class SfxFilter; +class SfxViewFactory; +struct SfxObjectFactory_Impl; +class SfxFilterContainer; +class SfxBindings; + +//==================================================================== + +typedef void (*SfxVoidFunc)(); + +#define SDT_SDT_DOCFACTPRIO 10 // Explorer +#define SDT_SW_DOCFACTPRIO 20 // Text Document +#define SDT_SWW_DOCFACTPRIO 21 // Web Document +#define SDT_SC_DOCFACTPRIO 30 // Table Document +#define SDT_SI_DOCFACTPRIO 40 // Impress Document +#define SDT_SD_DOCFACTPRIO 41 // Draw Document +#define SDT_SCH_DOCFACTPRIO 50 // Chart Document +#define SDT_SMA_DOCFACTPRIO 60 // Math Document +#define SDT_SIM_DOCFACTPRIO 70 // Image Document +#define SDT_FRM_DOCFACTPRIO 100 // Frame Document +#define SDT_MSG_DOCFACTPRIO 110 // Message Document +#define SDT_SDB_DOCFACTPRIO 200 // Database Document + +//==================================================================== + +class SFX2_DLLPUBLIC SfxObjectFactory +{ +private: + const char* pShortName; + SfxObjectFactory_Impl* pImpl; // Additional Data + SfxObjectShellFlags nFlags; + SAL_DLLPRIVATE void Construct(); + +public: + SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, const char* pShortName ); + ~SfxObjectFactory(); + + const SvGlobalName& GetClassId() const; + SfxObjectShellFlags GetFlags() { return nFlags; } + const char* GetShortName() const { return pShortName; } + String GetFactoryURL() const; // shortcut for "private:factory/GetShortName()" + String GetFactoryName() const { return OUString::createFromAscii(pShortName); } + String GetModuleName() const; + SfxFilterContainer *GetFilterContainer( sal_Bool bForceLoad = sal_True) const; + + // Views + void RegisterViewFactory(SfxViewFactory &rFactory); + sal_uInt16 GetViewFactoryCount() const; + SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const; + + /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name + SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const; + + // Filter + const SfxFilter* GetTemplateFilter() const; + static String GetStandardTemplate( const String& rServiceName ); + static void SetStandardTemplate( const String& rServiceName, const String& rTemplateName ); + static void SetSystemTemplate( const String& rServiceName, const String& rTemplateName ); + + void SetDocumentServiceName( const OUString& rServiceName ); + const OUString& GetDocumentServiceName() const; + + SfxModule* GetModule() const; + + SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); + SAL_DLLPRIVATE static void UpdateFilterContainers_Impl(); + SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const; + +private: + // Kopieren verboten + SAL_DLLPRIVATE SfxObjectFactory(const SfxObjectFactory&); + SAL_DLLPRIVATE const SfxObjectFactory& operator=(const SfxObjectFactory &); +}; + +//========================================================================= + +#define SFX_DECL_OBJECTFACTORY() \ +public: \ + static SfxObjectFactory& Factory(); \ + virtual SfxObjectFactory& GetFactory() const { return Factory(); } + +#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \ + SfxObjectFactory& ClassName::Factory() \ + { \ + static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \ + return aObjectFactory; \ + } +#endif // #ifndef _SFX_OBJFAC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx new file mode 100644 index 000000000000..fcf7351f9c9f --- /dev/null +++ b/include/sfx2/docfile.hxx @@ -0,0 +1,286 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXDOCFILE_HXX +#define _SFXDOCFILE_HXX + +#include <com/sun/star/io/XSeekable.hpp> +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/util/RevisionTag.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <tools/link.hxx> +#include <tools/stream.hxx> +#include <tools/string.hxx> +#include <svl/lstner.hxx> + +#include <cppuhelper/weak.hxx> +#include <ucbhelper/content.hxx> + +#include <vector> + +class SvKeyValueIterator; +class SfxObjectFactory; +class SfxFilter; +class SfxMedium_Impl; +class INetURLObject; +class SfxObjectShell; +class SfxFrame; +class Timer; +class SfxItemSet; +class DateTime; + +class SFX2_DLLPUBLIC SfxMedium : public SvRefBase +{ + SfxMedium_Impl* pImp; + + SAL_DLLPRIVATE void SetIsRemote_Impl(); + SAL_DLLPRIVATE void CloseInStream_Impl(); + SAL_DLLPRIVATE sal_Bool CloseOutStream_Impl(); + SAL_DLLPRIVATE void CloseStreams_Impl(); + DECL_DLLPRIVATE_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * ); + + SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl(); + +public: + + SfxMedium(); + /** + * @param pSet Takes ownership + */ + SfxMedium( const String &rName, + StreamMode nOpenMode, + const SfxFilter *pFilter = 0, + SfxItemSet *pSet = 0 ); + //TODO: the next, non-defined overload is only there to + // detect uses of the above (String, StreamMode, etc.) + // overload from when it still had an additional third + // parameter sal_Bool bDirect, where now a leftover + // "false" or "sal_False" could be mistaken for a null + // pointer argument for the pFilter parameter; it can be + // removed once we are confident all old uses of the + // original overload have been adapted (in platform + // specific code etc.): + SfxMedium(String const &, StreamMode, void *) + SAL_DELETED_FUNCTION; + + /** + * @param pSet does NOT take ownership + */ + SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage, + const String& rBaseURL, + const SfxItemSet* pSet=0 ); + /** + * @param pSet does NOT take ownership + */ + SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage, + const String& rBaseURL, + const String& rTypeName, + const SfxItemSet* pSet=0 ); + SfxMedium( const css::uno::Sequence< css::beans::PropertyValue >& aArgs ); + + ~SfxMedium(); + + void UseInteractionHandler( sal_Bool ); + css::uno::Reference< css::task::XInteractionHandler > + GetInteractionHandler(); + + void setStreamToLoadFrom( + const css::uno::Reference<css::io::XInputStream>& xInputStream, + sal_Bool bIsReadOnly); + + void SetLoadTargetFrame(SfxFrame* pFrame ); + SfxFrame* GetLoadTargetFrame() const; + + void SetFilter(const SfxFilter *pFlt, sal_Bool bResetOrig = sal_False); + const SfxFilter* GetFilter() const; + const SfxFilter * GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const; + const OUString& GetOrigURL() const; + + SfxItemSet * GetItemSet() const; + void Close(); + void CloseAndRelease(); + void ReOpen(); + void CompleteReOpen(); + const OUString& GetName() const; + const INetURLObject& GetURLObject() const; + + void CheckFileDate( const css::util::DateTime& aInitDate ); + sal_Bool DocNeedsFileDateCheck(); + css::util::DateTime GetInitFileDate( sal_Bool bIgnoreOldValue ); + + css::uno::Reference< css::ucb::XContent > GetContent() const; + const OUString& GetPhysicalName() const; + sal_Bool IsRemote(); + sal_Bool IsOpen() const; // { return aStorage.Is() || pInStream; } + void DownLoad( const Link& aLink = Link()); + void SetDoneLink( const Link& rLink ); + + sal_uInt32 GetErrorCode() const; + sal_uInt32 GetError() const + { return ERRCODE_TOERROR(GetErrorCode()); } + sal_uInt32 GetLastStorageCreationState(); + + void SetError( sal_uInt32 nError, const OUString& aLogMessage ); + + void AddLog( const OUString& aMessage ); + + void CloseInStream(); + sal_Bool CloseOutStream(); + + void CloseStorage(); + + StreamMode GetOpenMode() const; + void SetOpenMode( StreamMode nStorOpen, sal_Bool bDontClose = sal_False ); + + SvStream* GetInStream(); + SvStream* GetOutStream(); + + sal_Bool Commit(); + sal_Bool IsStorage(); + + sal_Int8 ShowLockedDocumentDialog( const css::uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock ); + bool LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ); + void UnlockFile( sal_Bool bReleaseLockStream ); + + css::uno::Reference< css::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True ); + css::uno::Reference< css::embed::XStorage > GetOutputStorage(); + void ResetError(); + sal_Bool UsesCache() const; + void SetUsesCache( sal_Bool ); + sal_Bool IsExpired() const; + void SetName( const String& rName, sal_Bool bSetOrigURL = sal_False ); + sal_Bool IsAllowedForExternalBrowser() const; + long GetFileVersion() const; + + const css::uno::Sequence < css::util::RevisionTag >& + GetVersionList( bool _bNoReload = false ); + sal_Bool IsReadOnly(); + + // Whether the medium had originally been opened r/o, independent of later + // changes via SetOpenMode; used to keep track of the "true" state of the + // medium across toggles via SID_EDITDOC (which do change SetOpenMode): + bool IsOriginallyReadOnly() const; + + css::uno::Reference< css::io::XInputStream > GetInputStream(); + + void CreateTempFile( sal_Bool bReplace = sal_True ); + void CreateTempFileNoCopy(); + OUString SwitchDocumentToTempFile(); + sal_Bool SwitchDocumentToFile( const OUString& aURL ); + + OUString GetBaseURL( bool bForSaving=false ); + void SetInCheckIn( bool bInCheckIn ); + bool IsInCheckIn( ); + + SAL_DLLPRIVATE sal_Bool HasStorage_Impl() const; + + SAL_DLLPRIVATE void StorageBackup_Impl(); + SAL_DLLPRIVATE OUString GetBackup_Impl(); + + SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > GetZipStorageToSign_Impl( sal_Bool bReadOnly = sal_True ); + SAL_DLLPRIVATE void CloseZipStorage_Impl(); + + // the storage that will be returned by the medium on GetStorage request + SAL_DLLPRIVATE void SetStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xNewStorage ); + + SAL_DLLPRIVATE css::uno::Reference< css::io::XInputStream > GetInputStream_Impl(); + SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl(); + SAL_DLLPRIVATE sal_uInt16 AddVersion_Impl( css::util::RevisionTag& rVersion ); + SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium ); + SAL_DLLPRIVATE sal_Bool SaveVersionList_Impl( sal_Bool bUseXML ); + SAL_DLLPRIVATE sal_Bool RemoveVersion_Impl( const OUString& rVersion ); + + SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime ); + SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl(); + + // Diese Protokolle liefern MIME Typen + SAL_DLLPRIVATE sal_Bool SupportsMIME_Impl() const; + + SAL_DLLPRIVATE void Init_Impl(); + SAL_DLLPRIVATE void ForceSynchronStream_Impl( sal_Bool bSynchron ); + + SAL_DLLPRIVATE void GetLockingStream_Impl(); + SAL_DLLPRIVATE void GetMedium_Impl(); + SAL_DLLPRIVATE sal_Bool TryDirectTransfer( const OUString& aURL, SfxItemSet& aTargetSet ); + SAL_DLLPRIVATE void Transfer_Impl(); + SAL_DLLPRIVATE void CreateFileStream(); + SAL_DLLPRIVATE void SetUpdatePickList(sal_Bool); + SAL_DLLPRIVATE sal_Bool IsUpdatePickList() const; + + SAL_DLLPRIVATE void SetLongName(const OUString &rName); + SAL_DLLPRIVATE const OUString & GetLongName() const; + SAL_DLLPRIVATE ErrCode CheckOpenMode_Impl( sal_Bool bSilent, sal_Bool bAllowRO = sal_True ); + SAL_DLLPRIVATE sal_Bool IsPreview_Impl(); + SAL_DLLPRIVATE void ClearBackup_Impl(); + SAL_DLLPRIVATE void Done_Impl( ErrCode ); + SAL_DLLPRIVATE void SetPhysicalName_Impl(const OUString& rName); + SAL_DLLPRIVATE void CanDisposeStorage_Impl( sal_Bool bDisposeStorage ); + SAL_DLLPRIVATE sal_Bool WillDisposeStorageOnClose_Impl(); + + SAL_DLLPRIVATE void DoBackup_Impl(); + SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent ); + SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent, + const String& aPrefix, + const String& aExtension, + const String& aDestDir ); + + SAL_DLLPRIVATE sal_Bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent, + const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv ); + + SAL_DLLPRIVATE sal_Bool StorageCommit_Impl(); + + SAL_DLLPRIVATE sal_Bool TransactedTransferForFS_Impl( const INetURLObject& aSource, + const INetURLObject& aDest, + const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv ); + + SAL_DLLPRIVATE sal_Bool SignContents_Impl( sal_Bool bScriptingContent, const OUString& aODFVersion, sal_Bool bHasValidDocumentSignature ); + + // the following two methods must be used and make sence only during saving currently + // TODO/LATER: in future the signature state should be controlled by the medium not by the document + // in this case the methods will be used generally, and might need to be renamed + SAL_DLLPRIVATE sal_uInt16 GetCachedSignatureState_Impl(); + SAL_DLLPRIVATE void SetCachedSignatureState_Impl( sal_uInt16 nState ); + + static css::uno::Sequence < css::util::RevisionTag > GetVersionList( + const css::uno::Reference< css::embed::XStorage >& xStorage ); + static OUString CreateTempCopyWithExt( const OUString& aURL ); + static sal_Bool CallApproveHandler( const css::uno::Reference< css::task::XInteractionHandler >& xHandler, css::uno::Any aRequest, sal_Bool bAllowAbort ); + + static sal_Bool SetWritableForUserOnly( const OUString& aURL ); + static sal_uInt32 CreatePasswordToModifyHash( const OUString& aPasswd, sal_Bool bWriter ); +}; + +SV_DECL_IMPL_REF( SfxMedium ) + +typedef ::std::vector< SfxMedium* > SfxMediumList; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx new file mode 100644 index 000000000000..cc6f6b8c1971 --- /dev/null +++ b/include/sfx2/docfilt.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_DOCFILT_HACK_HXX +#define _SFX_DOCFILT_HACK_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/plugin/PluginDescription.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/beans/UnknownPropertyException.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <tools/wldcrd.hxx> + +#include <comphelper/documentconstants.hxx> +#define SFX_FILTER_STARTPRESENTATION 0x20000000L + +#include <sfx2/sfxdefs.hxx> + +class SfxFilterContainer; +class SotStorage; + +class SFX2_DLLPUBLIC SfxFilter +{ + friend class SfxFilterContainer; + + WildCard aWildCard; + + OUString aTypeName; + OUString aUserData; + OUString aServiceName; + OUString aMimeType; + OUString maFilterName; + OUString aPattern; + OUString aUIName; + OUString aDefaultTemplate; + + /** + * Custom provider name in case the filter is provided via external + * libraries. Empty for conventional filter types. + */ + OUString maProvider; + + SfxFilterFlags nFormatType; + sal_uIntPtr nVersion; + sal_uIntPtr lFormat; + sal_uInt16 nDocIcon; + +public: + SfxFilter( const OUString& rProvider, const OUString& rFilterName ); + + SfxFilter( const OUString &rName, + const OUString &rWildCard, + SfxFilterFlags nFormatType, + sal_uInt32 lFormat, + const OUString &rTypeName, + sal_uInt16 nDocIcon, + const OUString &rMimeType, + const OUString &rUserData, + const OUString& rServiceName ); + ~SfxFilter(); + + bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; } + bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; } + bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; } + bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; } + bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; } + bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; } + bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; } + SfxFilterFlags GetFilterFlags() const { return nFormatType; } + const OUString& GetFilterName() const { return maFilterName; } + const OUString& GetMimeType() const { return aMimeType; } + const OUString& GetName() const { return maFilterName; } + const WildCard& GetWildcard() const { return aWildCard; } + const OUString& GetRealTypeName() const { return aTypeName; } + sal_uIntPtr GetFormat() const { return lFormat; } + const OUString& GetTypeName() const { return aTypeName; } + const OUString& GetUIName() const { return aUIName; } + sal_uInt16 GetDocIconId() const { return nDocIcon; } + const OUString& GetUserData() const { return aUserData; } + const OUString& GetDefaultTemplate() const { return aDefaultTemplate; } + void SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; } + bool UsesStorage() const { return GetFormat() != 0; } + void SetURLPattern( const OUString& rStr ); + OUString GetURLPattern() const { return aPattern; } + void SetUIName( const String& rName ) { aUIName = rName; } + void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; } + sal_uIntPtr GetVersion() const { return nVersion; } + OUString GetSuffixes() const; + OUString GetDefaultExtension() const; + const OUString& GetServiceName() const { return aServiceName; } + const OUString& GetProviderName() const; + + static const SfxFilter* GetDefaultFilter( const String& rName ); + static const SfxFilter* GetFilterByName( const String& rName ); + static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName ); + + static OUString GetTypeFromStorage( const SotStorage& rStg ); + static OUString GetTypeFromStorage( + const com::sun::star::uno::Reference<com::sun::star::embed::XStorage>& xStorage, + bool bTemplate = false, OUString* pName = NULL ) + throw ( com::sun::star::beans::UnknownPropertyException, + com::sun::star::lang::WrappedTargetException, + com::sun::star::uno::RuntimeException ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docinf.hxx b/include/sfx2/docinf.hxx new file mode 100644 index 000000000000..8ab57ffe2ae4 --- /dev/null +++ b/include/sfx2/docinf.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXDOCINF_HXX +#define _SFXDOCINF_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Reference.hxx> + + +class GDIMetaFile; +class SotStorage; + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } +} } } + + +namespace sfx2 { + +/** load document meta-data from OLE stream + + @param i_xDocProps Document meta-data + @param i_pStorage OLE Storage + */ +sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet( + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> i_xDocProps, + SotStorage* i_pStorage ); + +/** save document meta-data to OLE stream + + @param i_xDocProps Document meta-data + @param i_pStorage OLE Storage + @param i_pThumb Thumbnail: preview bitmap + @param i_pGuid Blob: Guid blob ("_PID_GUID") + @param i_pHyperlinks Blob: Hyperlink blob ("_PID_HLINKS") + */ +bool SFX2_DLLPUBLIC SaveOlePropertySet( + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> i_xDocProps, + SotStorage* i_pStorage, + const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pThumb = 0, + const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pGuid = 0, + const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pHyperlinks = 0); + + +::com::sun::star::uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile( + GDIMetaFile* i_pThumb); + +} // namespace sfx2 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docinsert.hxx b/include/sfx2/docinsert.hxx new file mode 100644 index 000000000000..cefcf034f48e --- /dev/null +++ b/include/sfx2/docinsert.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_DOCINSERT_HXX +#define _SFX_DOCINSERT_HXX + +#include <tools/errcode.hxx> +#include <tools/link.hxx> +#include <tools/string.hxx> +#include <vector> + +#include "sfx2/dllapi.h" + +namespace sfx2 { class FileDialogHelper; } +class SfxMedium; +class SfxItemSet; + +typedef ::std::vector< SfxMedium* > SfxMediumList; + +namespace sfx2 { + +class SFX2_DLLPUBLIC DocumentInserter +{ +private: + String m_sDocFactory; + String m_sFilter; + Link m_aDialogClosedLink; + + sal_Int64 const m_nDlgFlags; + ErrCode m_nError; + + sfx2::FileDialogHelper* m_pFileDlg; + SfxItemSet* m_pItemSet; + std::vector<OUString> m_pURLList; + + DECL_LINK(DialogClosedHdl, void *); + +public: + DocumentInserter(const String& rFactory, + bool const bEnableMultiSelection = false); + ~DocumentInserter(); + + void StartExecuteModal( const Link& _rDialogClosedLink ); + SfxMedium* CreateMedium(); + SfxMediumList* CreateMediumList(); + + inline ErrCode GetError() const { return m_nError; } + inline String GetFilter() const { return m_sFilter; } +}; + +} // namespace sfx2 + +#endif // _SFX_DOCINSERT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx new file mode 100644 index 000000000000..d64b6ed7a6f7 --- /dev/null +++ b/include/sfx2/dockwin.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXDOCKWIN_HXX +#define _SFXDOCKWIN_HXX + +#include "sal/config.h" +#include "sal/types.h" +#include <vcl/dockwin.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include "sfx2/dllapi.h" +#include <sfx2/childwin.hxx> + +class SfxSplitWindow; +class SfxDockingWindow_Impl; + +void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); +bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); + +class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow +{ +private: + Rectangle aInnerRect; + Rectangle aOuterRect; + SfxBindings* pBindings; + Size aFloatSize; + SfxChildWindow* pMgr; + SfxDockingWindow_Impl* pImp; + + SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined + SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined + +protected: + SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect ); + void CalcSplitPosition(const Point rPos, Rectangle& rRect, + SfxChildAlignment eAlign); + virtual Size CalcDockingSize(SfxChildAlignment); + virtual SfxChildAlignment + CheckAlignment(SfxChildAlignment,SfxChildAlignment); + + virtual void Resize(); + virtual sal_Bool PrepareToggleFloatingMode(); + virtual void ToggleFloatingMode(); + virtual void StartDocking(); + virtual sal_Bool Docking( const Point& rPos, Rectangle& rRect ); + virtual void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ); + virtual void Resizing( Size& rSize ); + virtual void Paint( const Rectangle& rRect ); + virtual sal_Bool Close(); + virtual void Move(); + + SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; } + +public: + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + WinBits nWinBits=0); + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + const ResId& rResId); + ~SfxDockingWindow(); + + void Initialize (SfxChildWinInfo* pInfo); + virtual void FillInfo(SfxChildWinInfo&) const; + virtual void StateChanged( StateChangedType nStateChange ); + + void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner) + { aInnerRect = rInner; aOuterRect = rOuter; } + const Rectangle& GetInnerRect() const { return aInnerRect; } + const Rectangle& GetOuterRect() const { return aOuterRect; } + SfxBindings& GetBindings() const { return *pBindings; } + sal_uInt16 GetType() const { return pMgr->GetType(); } + SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); } + void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); } + Size GetFloatingSize() const { return aFloatSize; } + void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; } + + void SetMinOutputSizePixel( const Size& rSize ); + Size GetMinOutputSizePixel() const; + virtual long Notify( NotifyEvent& rNEvt ); + virtual void FadeIn( sal_Bool ); + void AutoShow( sal_Bool bShow = sal_True ); + DECL_LINK(TimerHdl, void *); + + SAL_DLLPRIVATE void Initialize_Impl(); + SAL_DLLPRIVATE sal_uInt16 GetWinBits_Impl() const; + SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize ); + SAL_DLLPRIVATE void Disappear_Impl(); + SAL_DLLPRIVATE void Reappear_Impl(); + SAL_DLLPRIVATE sal_Bool IsAutoHide_Impl() const; + SAL_DLLPRIVATE void AutoShow_Impl( sal_Bool bShow = sal_True ); + SAL_DLLPRIVATE void Pin_Impl( sal_Bool bPinned ); + SAL_DLLPRIVATE void ReleaseChildWindow_Impl(); +}; + +class SfxDockingWrapper : public SfxChildWindow +{ + public: + SfxDockingWrapper( Window* pParent , + sal_uInt16 nId , + SfxBindings* pBindings , + SfxChildWinInfo* pInfo ); + + SFX_DECL_CHILDWINDOW(SfxDockingWrapper); +}; + +#endif // #ifndef _SFXDOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx new file mode 100644 index 000000000000..4e089d7e3d55 --- /dev/null +++ b/include/sfx2/docmacromode.hxx @@ -0,0 +1,328 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX2_DOCMACROMODE_HXX +#define SFX2_DOCMACROMODE_HXX + +#include "sfx2/dllapi.h" + +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/document/XEmbeddedScripts.hpp> + +#include <boost/shared_ptr.hpp> + +//........................................................................ +namespace sfx2 +{ +//........................................................................ + + //==================================================================== + //= IMacroDocumentAccess + //==================================================================== + /** provides access to several settings of a document, which are needed by ->DocumentMacroMode + to properly determine the current macro execution mode of this document + */ + class SAL_NO_VTABLE IMacroDocumentAccess + { + public: + /** retrieves the current MacroExecutionMode. + + Usually, this is initialized from the media descriptor used to load the document, + respectively the one passed into the document's XModel::attachResource call. + + If no such mode was passed there, document implementations should return + MacroExecMode::NEVER_EXECUTE. + + @see ::com::sun::star::document::MediaDescriptor::MacroExecutionMode + @see ::com::sun::star::frame::XComponentLoader::loadComponentFromURL + @see ::com::sun::star::frame::XModel::attachResource + + @see setCurrentMacroExecMode + + @todo + Effectively, this is the MacroExecutionMode of the MediaDescriptor of + the document. Thus, this setting could be obtained from the XModel + directly. We should introduce a getDocumentModel method here, which + can be used for this and other purposes. + */ + virtual sal_Int16 + getCurrentMacroExecMode() const = 0; + + /** sets the MacroExecutionMode of the document, as calculated by the DocumentMacroMode + class. + + Effectively, the existence of this method means that the responsibility + to store the current macro execution mode is not with the DocumentMacroMode + instance, but with the document instance itself. + + Usually, a document implementation will simply put the macro execution mode + into its media descriptor, as returned by XModel::getArgs. + + @see ::com::sun::star::document::MediaDescriptor::MacroExecutionMode + @see ::com::sun::star::frame::XComponentLoader::loadComponentFromURL + @see ::com::sun::star::frame::XModel::attachResource + + see getCurrentMacroExecMode + */ + virtual sal_Bool + setCurrentMacroExecMode( sal_uInt16 ) = 0; + + /** returns the origin of the document + + This usually is the document's location, or, if the document has been + newly created from a template, then the location of the template. Location + here means the complete path of the document, including the file name. + + @todo + This probably can also be obtained from the XModel, by calling getURL + or getLocation. If both are empty, then we need an UNO way to obtain + the URL of the underlying template document - if any. If we have this, + we could replace this method with a newly introduced method + getDocumentModel and some internal code. + */ + virtual OUString + getDocumentLocation() const = 0; + + /** returns a zip-storage based on the last commited version of the document, + for readonly access + + The storage is intended to be used for signing. An implementation is + allowed to return <NULL/> here if and only if the document + does not support signing the script storages. + + @todo + UNOize this, too. Once we have a getDocumentModel, we should be able to + obtain the "last commit" storage via UNO API, provided it's an + XStorageBasedDocument. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + getZipStorageToSign() = 0; + + /** checks whether the document's storage contains sub storages with macros or scripts + + A default implementation of this method will simply cann DocumentMacroMode::storageHasMacros + with the document's root storage. However, there might be document types where this + isn't sufficient (e.g. database documents which contain sub documents which can also + contain macro/script storages). + */ + virtual sal_Bool + documentStorageHasMacros() const = 0; + + /** provides access to the XEmbeddedScripts interface of the document + + Implementations are allowed to return <NULL/> here if and only if they + do not (yet) support embedding scripts. + + @todo + can also be replaced with a call to the (to be introduced) getDocumentModel + method, and a queryInterface. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > + getEmbeddedDocumentScripts() const = 0; + + /** returns the state of the signatures for the scripts embedded in the document + + Note: On the medium run, the signature handling of a document should be outsourced + into a dedicated class, instead of being hard-wired into the SfxObjectShell. This + class could then be used outside the SfxObjectShell (e.g. in Base documents), too. + When this happens, this method here becomes should be replaced by a method at this + new class. + + @seealso <sfx2/signaturestate.hxx> + */ + virtual sal_Int16 + getScriptingSignatureState() = 0; + + /** allows to detect whether there is a trusted scripting signature + + Note: On the medium run, the signature handling of a document should be outsourced + into a dedicated class, instead of being hard-wired into the SfxObjectShell. This + class could then be used outside the SfxObjectShell (e.g. in Base documents), too. + When this happens, this method here should be replaced by a method at this + new class. + + @seealso <sfx2/signaturestate.hxx> + */ + virtual sal_Bool + hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor ) = 0; + + /** shows a warning that the document's signature is broken + + Here, a similar note applies as to getScriptingSignatureState: This method doesn't + really belong here. It's just there because SfxObjectShell_Impl::bSignatureErrorIsShown + is not accessible where the method is called. + So, once the signature handling has been oursourced from SfxObjectShell/_Impl, so it + is re-usable in non-SFX contexts as well, this method here is also unneeded, probably. + + @param _rxInteraction + the interaction handler to use for showing the warning. It is exactly the same + as passed to DocumentMacroMode::adjustMacroMode, so it is <NULL/> if and + only if the instance passed to that method was <NULL/>. + */ + virtual void + showBrokenSignatureWarning( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction + ) const = 0; + + protected: + ~IMacroDocumentAccess() {} + }; + + //==================================================================== + //= DocumentMacroMode + //==================================================================== + struct DocumentMacroMode_Data; + + /** encapsulates handling the macro mode of a document + + @see com::sun::star::document::MacroExecMode + */ + class SFX2_DLLPUBLIC DocumentMacroMode + { + public: + /** creates an instance + + @param _rDocumentAccess + access to the document which this instance works for. Must live as long as the + DocumentMacroMode instance lives, at least + */ + DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess ); + ~DocumentMacroMode(); + + /** allows macro execution in the document + + Effectively, the macro mode is set to MacroExecMode::ALWAYS_EXECUTE_NO_WARN. + + @return + <TRUE/>, always + */ + sal_Bool allowMacroExecution(); + + /** disallows macro execution in the document + + Effectively, the macro mode is set to MacroExecMode::NEVER_EXECUTE. + + @return + <TRUE/>, always + */ + sal_Bool disallowMacroExecution(); + + /** checks whether the document allows executing contained macros. + + The method transforms the current macro execution mode into either + ALWAYS_EXECUTE_NO_WARN or NEVER_EXECUTE, depending on the current value, + possible configuration settings, and possible user interaction. + + @param _rxInteraction + A handler for interactions which might become necessary. + This includes + <ul><li>Asking the user for confirmation for macro execution.</li> + <li>Telling the user that macro execution is disabled.</li> + </ul> + + If the user needs to be asked for macro execution confirmation, and if + this parameter is <NULL/>, the most defensive assumptions will be made, + effectively disabling macro execution. + + @return + <TRUE/> if and only if macro execution in this document is allowed. + */ + sal_Bool adjustMacroMode( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction + ); + + /** determines whether macro execution is disallowed + + There's a number of reasons why macro execution could be disallowed: + <ul><li>Somebody called ->disallowMacroExecution</li> + <li>Macro execution is disabled globally, via the security options</li> + <li>Macro execution mode was not defined initially, and the user denied + executing macros for this particular document.</li> + </ul> + + Note that if this method returns <FALSE/>, then subsequent calls of + ->adjustMacroMode can still return <FALSE/>. + That is, if the current macro execution mode for the document is not yet known + (and inparticular <em>not</em> MacroExecMode::NEVER_EXECUTE), then ->isMacroExecutionDisallowed + will return <FALSE/>. + However, a subsequent call to ->adjustMacroMode can result in the user + denying macro execution, in which ->adjustMacroMode will return <FALSE/>, + and the next call to isMacroExecutionDisallowed will return <TRUE/>. + */ + sal_Bool isMacroExecutionDisallowed() const; + + /** determines whether the document actually has a macros library + + Effectively, this method checks the Basic library container (as returned by + IMacroDocumentAccess::getEmbeddedDocumentScripts().getBasicLibraries) for + content. + */ + sal_Bool hasMacroLibrary() const; + + /** determines whether the given document storage has sub storages containing scripts + or macros. + + Effectively, the method checks for the presence of a sub-storage name "Scripts" (where + BeanShell-/JavaScript-/Python-Scripts are stored, and a sub storage named "Basic" (where + Basic scripts are stored). + */ + static sal_Bool + storageHasMacros( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage ); + + static sal_Bool containerHasBasicMacros( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xContainter ); + /** checks the macro execution mode while loading the document. + + This must be called when the loading is effectively finished, but before any macro action + happened. + + The method will disallow macro execution for this document if it is disabled + globally (SvtSecurityOptions::IsMacroDisabled). Otherwise, it will check whether + the document contains a macro storage or macro libraries. If so, it will + properly calculate the MacroExecutionMode by calling adjustMacroMode. + + If the document doesn't contain macros, yet, then the macro execution for this + document will be allowed (again: unless disabled globally), since in this case + macros which later are newly created by the user should be allowed, of course. + + @return + <TRUE/> if and only if macro execution is allowed in the document + + @see isMacroExecutionDisallowed + @see IMacroDocumentAccess::documentStorageHasMacros + @see hasMacroLibrary + @see IMacroDocumentAccess::checkForBrokenScriptingSignatures + */ + sal_Bool + checkMacrosOnLoading( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction + ); + + private: + ::boost::shared_ptr< DocumentMacroMode_Data > m_pData; + }; + +//........................................................................ +} // namespace sfx2 +//........................................................................ + +#endif // SFX2_DOCMACROMODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docstoragemodifylistener.hxx b/include/sfx2/docstoragemodifylistener.hxx new file mode 100644 index 000000000000..c361b8768260 --- /dev/null +++ b/include/sfx2/docstoragemodifylistener.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX2_DOCSTORAGEMODIFYLISTENER_HXX +#define SFX2_DOCSTORAGEMODIFYLISTENER_HXX + +#include "sfx2/dllapi.h" + +#include <com/sun/star/util/XModifyListener.hpp> + +#include <cppuhelper/implbase1.hxx> + + +//........................................................................ +namespace sfx2 +{ +//........................................................................ + + //==================================================================== + //= IModifiableDocument + //==================================================================== + /** callback for the DocumentStorageModifyListener class + */ + class SAL_NO_VTABLE IModifiableDocument + { + public: + /// indicates the root or a sub storage of the document has been modified + virtual void storageIsModified() = 0; + + protected: + ~IModifiableDocument() {} + }; + + //==================================================================== + //= DocumentStorageModifyListener + //==================================================================== + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::util::XModifyListener > DocumentStorageModifyListener_Base; + + class SFX2_DLLPUBLIC DocumentStorageModifyListener : public DocumentStorageModifyListener_Base + { + IModifiableDocument* m_pDocument; + ::osl::SolarMutex& m_rMutex; + + public: + DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex ); + + void dispose(); + + // XModifyListener + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) 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); + + protected: + virtual ~DocumentStorageModifyListener(); + + private: + DocumentStorageModifyListener(); // never implemented + DocumentStorageModifyListener( const DocumentStorageModifyListener& ); // never implemented + DocumentStorageModifyListener& operator=( const DocumentStorageModifyListener& ); // never implemented + }; + +//........................................................................ +} // namespace sfx2 +//........................................................................ + +#endif // SFX2_DOCSTORAGEMODIFYLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx new file mode 100644 index 000000000000..a5b24cf81993 --- /dev/null +++ b/include/sfx2/doctempl.hxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXDOCTEMPL_HXX +#define _SFXDOCTEMPL_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/ref.hxx> +#include <tools/string.hxx> + +// CLASS ----------------------------------------------------------------- + +class SfxObjectShell; + +#ifndef SFX_DECL_OBJECTSHELL_DEFINED +#define SFX_DECL_OBJECTSHELL_DEFINED +SV_DECL_REF(SfxObjectShell) +#endif + +class SfxDocTemplate_Impl; + +#ifndef SFX_DECL_DOCTEMPLATES_DEFINED +#define SFX_DECL_DOCTEMPLATES_DEFINED +SV_DECL_REF(SfxDocTemplate_Impl) +#endif + +// class SfxDocumentTemplates -------------------------------------------- + +class SFX2_DLLPUBLIC SfxDocumentTemplates +{ +private: + SfxDocTemplate_ImplRef pImp; + + SAL_DLLPRIVATE sal_Bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, sal_Bool bMove ); +public: + SfxDocumentTemplates(); + SfxDocumentTemplates(const SfxDocumentTemplates &); + ~SfxDocumentTemplates(); + + sal_Bool IsConstructed() { return pImp != NULL; } + void Construct(); + + const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &); + + void ReInitFromComponent(); + + sal_uInt16 GetRegionCount() const; + const String& GetRegionName(sal_uInt16 nIdx) const; //dv! + String GetFullRegionName(sal_uInt16 nIdx) const; + + sal_uInt16 GetCount(sal_uInt16 nRegion) const; + const String& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv! + String GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const; + + // Allows to retrieve the target template URL from the UCB + OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName, + const OUString& aTitle ); + + // Convert a resource string - a template name - to its localised pair + // if it exists in templatelocnames.src + static OUString ConvertResourceString(int nSourceResIds, + int nDestResIds, + int nCount, + const OUString& rString); + + sal_Bool Copy(sal_uInt16 nTargetRegion, + sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, + sal_uInt16 nSourceIdx); + sal_Bool Move(sal_uInt16 nTargetRegion, + sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, + sal_uInt16 nSourceIdx); + sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx); + sal_Bool InsertDir(const String &rText, sal_uInt16 nRegion); + + sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath); + + /** Change the name of an entry or a directory + + \param rName + The new name to set + \param nRegion + The id of the region to rename or containing the template to rename + \param nIdx + The id of the template to rename or USHRT_MAX to rename the region. + + \return + sal_True if the action could be performed, sal_False otherwise + + */ + sal_Bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx); + + sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const; + sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName); + + sal_Bool GetFull( const String& rRegion, const String& rName, String& rPath ); + sal_Bool GetLogicNames( const String& rPath, String& rRegion, String& rName ) const; + + /** updates the configuration where the document templates structure is stored. + + <p>The info about the document templates (which files, which groups etc.) is stored in the + configuration. This means that just by copying files into OOo's template directories, this + change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with + the file system. This can be enforced with this method.</p> + + @param _bSmart + The update of the configuration is rather expensive - nothing you want to do regulary if you don't really + need it. So you have the possibility to do a smart update - it first checks if the update if necessary. + In case the update is needed, the additional check made it somewhat more expensive. In case it's not + necessary (which should be the usual case), the check alone is (much) less expensive than the real update. + <br/> + So set <arg>_bSmart</arg> to <TRUE/> to do a check for necessity first. + */ + void Update( sal_Bool _bSmart = sal_True ); +}; + +#endif // #ifndef _SFXDOCTEMPL_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx new file mode 100644 index 000000000000..bcdc88ec2edb --- /dev/null +++ b/include/sfx2/event.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXEVENT_HXX +#define _SFXEVENT_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <tools/string.hxx> +#include <svl/hint.hxx> +#include <unotools/eventcfg.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XController2.hpp> + +class SfxObjectShell; + +//------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SfxEventHint : public SfxHint +{ + SfxObjectShell* pObjShell; + OUString aEventName; + sal_uInt16 nEventId; + +public: + TYPEINFO(); + SfxEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj = 0 ) + : pObjShell(pObj), + aEventName(aName), + nEventId(nId) + {} + + sal_uInt16 GetEventId() const + { return nEventId; } + + OUString GetEventName() const + { return aEventName; } + + SfxObjectShell* GetObjShell() const + { return pObjShell; } +}; + +//------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > xViewController; + +public: + TYPEINFO(); + + SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) + : SfxEventHint( nId, aName, pObj ) + , xViewController( xController, ::com::sun::star::uno::UNO_QUERY ) + {} + + SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& xController ) + : SfxEventHint( nId, aName, pObj ) + , xViewController( xController ) + {} + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > GetController() const + { return xViewController; } +}; + +//------------------------------------------------------------------- + +class SfxNamedHint : public SfxHint +{ + String _aEventName; + SfxObjectShell* _pObjShell; + String _aArgs; + +public: + TYPEINFO(); + + SfxNamedHint( const String& rName, + const String& rArgs, + SfxObjectShell *pObj = 0 ) + : _aEventName( rName ), + _pObjShell( pObj), + _aArgs( rArgs ) + {} + + SfxNamedHint( const String& rName, + SfxObjectShell *pObj = 0 ) + : _aEventName( rName ), + _pObjShell( pObj ) + {} + + const String& GetArgs() const { return _aArgs;} + const String& GetName() const { return _aEventName; } + SfxObjectShell* GetObjShell() const { return _pObjShell; } +}; + +class Printer; +class SfxPrintingHint : public SfxHint +{ + sal_Int32 nWhich; + com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts; +public: + TYPEINFO(); + SfxPrintingHint( sal_Int32 nEvent, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts ) + : nWhich( nEvent ) + , aOpts( rOpts ) + {} + + SfxPrintingHint( sal_Int32 nEvent ) + : nWhich( nEvent ) + {} + + sal_Int32 GetWhich() const { return nWhich; } + const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& GetOptions() { return aOpts; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx new file mode 100644 index 000000000000..2f181ad820b1 --- /dev/null +++ b/include/sfx2/evntconf.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_EVENTCONF_HXX +#define _SFX_EVENTCONF_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/rtti.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> + +#include <sfx2/event.hxx> + +#include <sfx2/sfxsids.hrc> +#ifdef ITEMID_MACRO +#undef ITEMID_MACRO +#endif +#define ITEMID_MACRO SID_ATTR_MACROITEM +#include <svl/macitem.hxx> +#include <vector> + +class SfxObjectShell; +class SvxMacroTableDtor; + +struct SFX2_DLLPUBLIC SfxEventName +{ + sal_uInt16 mnId; + String maEventName; + String maUIName; + + SfxEventName( sal_uInt16 nId, + const String& rEventName, + const String& rUIName ) + : mnId( nId ) + , maEventName( rEventName ) + , maUIName( rUIName ) {} +}; + +typedef ::std::vector< SfxEventName* > _SfxEventNamesList; + +class SFX2_DLLPUBLIC SfxEventNamesList +{ +private: + _SfxEventNamesList aEventNamesList; + void DelDtor(); + +public: + SfxEventNamesList() {} + SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; } + ~SfxEventNamesList() { DelDtor(); } + SfxEventNamesList& operator=( const SfxEventNamesList &rCpy ); + + size_t size() const { return aEventNamesList.size(); }; + + SfxEventName* at( size_t Index ) const + { return Index < aEventNamesList.size() ? aEventNamesList[ Index ] : NULL; } + + void push_back( SfxEventName* Item ) { aEventNamesList.push_back( Item ); } +}; + +class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem +{ + SfxEventNamesList aEventsList; + +public: + TYPEINFO(); + + SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {} + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; + + const SfxEventNamesList& GetEvents() const { return aEventsList;} + void SetEvents( const SfxEventNamesList& rList ) { aEventsList = rList; } + void AddEvent( const String&, const String&, sal_uInt16 ); +}; + +// ----------------------------------------------------------------------- + +#define PROP_EVENT_TYPE "EventType" +#define PROP_LIBRARY "Library" +#define PROP_SCRIPT "Script" +#define PROP_MACRO_NAME "MacroName" +#define STAR_BASIC "StarBasic" + +class SFX2_DLLPUBLIC SfxEventConfiguration +{ +public: + static void ConfigureEvent( OUString aName, const SvxMacro&, SfxObjectShell* pObjSh); + static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, sal_Bool bBlowUp ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx new file mode 100644 index 000000000000..de7d9a961de4 --- /dev/null +++ b/include/sfx2/fcontnr.hxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_FCONTNR_HXX +#define _SFX_FCONTNR_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <svl/poolitem.hxx> +#include <vcl/window.hxx> + +#include <sfx2/docfilt.hxx> +#include <sfx2/sfxdefs.hxx> + +#include <tools/ref.hxx> + +#include <boost/utility.hpp> + +class Window; +class SfxFilter; +class SfxObjectFactory; +class SfxMedium; +class SfxFilterContainer_Impl; +class SfxFrame; + +//#define SFX_FILTER_CONTAINER_FACTORY 1 +typedef sal_uInt16 SfxFilterContainerFlags; + +class SfxRefItem : public SfxPoolItem +{ + SvRefBaseRef aRef; +public: + virtual SfxPoolItem* Clone( SfxItemPool* = 0 ) const + { return new SfxRefItem( *this ); } + virtual int operator==( const SfxPoolItem& rL) const + { return ((SfxRefItem&)rL).aRef == aRef; } + SfxRefItem( sal_uInt16 nWhichId, const SvRefBaseRef& rValue ) : SfxPoolItem( nWhichId ) + { aRef = rValue; } + const SvRefBaseRef& GetValue() const { return aRef; } + +}; + +class SfxFrameWindow +{ + Window* pWindow; +public: + SfxFrameWindow( Window *pWin ) + : pWindow( pWin ) + {} + + virtual ~SfxFrameWindow() + { delete pWindow; } + Window* GetWindow() const + { return pWindow; } + void SetWindow( Window *pWin ) + { pWindow = pWin; } +}; + +typedef sal_uIntPtr (*SfxDetectFilter)( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust, SfxFilterFlags nDont ); + +class SFX2_DLLPUBLIC SfxFilterContainer +{ + SfxFilterContainer_Impl *pImpl; + +public: + SfxFilterContainer( const String& rName ); + ~SfxFilterContainer(); + + + const String GetName() const; + + const SfxFilter* GetAnyFilter( SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + + SAL_DLLPRIVATE static void ReadFilters_Impl( sal_Bool bUpdate=sal_False ); + SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xTypeCFG, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG, + sal_Bool bUpdate ); + SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const String& ); +}; + +class SfxFilterMatcher_Impl; + +class SFX2_DLLPUBLIC SfxFilterMatcher : private boost::noncopyable +{ + friend class SfxFilterMatcherIter; + SfxFilterMatcher_Impl &m_rImpl; +public: + SfxFilterMatcher( const OUString& rFact ); + SfxFilterMatcher(); + ~SfxFilterMatcher(); + + SAL_DLLPRIVATE static sal_Bool IsFilterInstalled_Impl( const SfxFilter* pFilter ); + DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String* ); + + sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + sal_uInt32 GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const; + sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const; + + const SfxFilter* GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const; + const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetFilterForProps( const com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue >& aSeq, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + const SfxFilter* GetAnyFilter( SfxFilterFlags nMust=0, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const; +}; + +class SfxFilterContainer_Impl; +class SFX2_DLLPUBLIC SfxFilterMatcherIter : private boost::noncopyable + +{ + SfxFilterFlags nOrMask; + SfxFilterFlags nAndMask; + sal_uInt16 nCurrent; + const SfxFilterMatcher_Impl &m_rMatch; + + SAL_DLLPRIVATE const SfxFilter* Find_Impl(); + +public: + SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED ); + const SfxFilter* First(); + const SfxFilter* Next(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx new file mode 100644 index 000000000000..304fd5cdff58 --- /dev/null +++ b/include/sfx2/filedlghelper.hxx @@ -0,0 +1,262 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _FILEDLGHELPER_HXX +#define _FILEDLGHELPER_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> +#include <tools/solar.h> +#include <tools/string.hxx> +#include <tools/errcode.hxx> +#include <vcl/dialog.hxx> +#include <vcl/edit.hxx> +#include <vcl/button.hxx> +#include <vcl/graph.hxx> +#include <sfx2/sfxdefs.hxx> +#include <sfx2/sfxuno.hxx> +#include <sfx2/docfilt.hxx> + +//----------------------------------------------------------------------------- + +namespace com +{ + namespace sun + { + namespace star + { + namespace ui + { + namespace dialogs + { + class XFilePicker; + class XFilePickerListener; + struct FilePickerEvent; + struct DialogClosedEvent; + } + } + } + } +} + +class SfxItemSet; +class Window; + +// the SFXWB constants are for the nFlags parameter of the constructor +#define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog +#define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog +#define SFXWB_SAVEACOPY 0x00400000L // turn Save into Save a Copy dialog +#define SFXWB_MULTISELECTION 0x20000000L +#define SFXWB_GRAPHIC 0x00800000L // register graphic formats + +#define FILEDIALOG_FILTER_ALL "*.*" + +#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker" + +namespace sfx2 { + +class FileDialogHelper_Impl; + +class SFX2_DLLPUBLIC FileDialogHelper +{ +public: + enum Context // context where the FileDialogHelper is used + { + UNKNOWN_CONTEXT, // unknown context + SW_INSERT_GRAPHIC, // insert graphic in writer + SW_INSERT_SOUND, // insert sound in writer + SW_INSERT_VIDEO, // insert video in writer + SC_INSERT_GRAPHIC, // insert graphic in calc + SC_INSERT_SOUND, // insert sound in calc + SC_INSERT_VIDEO, // insert video in calc + SD_INSERT_GRAPHIC, // insert graphic in draw + SD_INSERT_SOUND, // insert sound in draw + SD_INSERT_VIDEO, // insert video in draw + SD_EXPORT, // export in draw + SI_EXPORT, // export in impress + SW_EXPORT // export in writer + }; + +private: + Link m_aDialogClosedLink; + ErrCode m_nError; + + ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePickerListener > mxImp; + FileDialogHelper_Impl *mpImp; + + +public: + FileDialogHelper( sal_Int16 nDialogType, + sal_Int64 nFlags, + Window* _pPreferredParent = NULL ); + + FileDialogHelper( sal_Int16 nDialogType, + sal_Int64 nFlags, + const String& rFactory, + SfxFilterFlags nMust = 0, + SfxFilterFlags nDont = 0 ); + + FileDialogHelper( sal_Int16 nDialogType, + sal_Int64 nFlags, + const String& rFactory, + sal_Int16 nDialog, + SfxFilterFlags nMust, + SfxFilterFlags nDont, + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< OUString >& rBlackList); + + FileDialogHelper( sal_Int16 nDialogType, + sal_Int64 nFlags, + const OUString& aFilterUIName, + const OUString& aExtName, + const OUString& rStandardDir, + const ::com::sun::star::uno::Sequence< OUString >& rBlackList, + Window* _pPreferredParent = NULL ); + + + virtual ~FileDialogHelper(); + + ErrCode Execute(); + void StartExecuteModal( const Link& rEndDialogHdl ); + inline ErrCode GetError() const { return m_nError; } + sal_Int16 GetDialogType() const; + sal_Bool IsPasswordEnabled() const; + String GetRealFilter() const; + + void SetTitle( const String& rNewTitle ); + String GetPath() const; + + /** @deprected: Don't use this method to retrieve the selected files + There are file picker which can provide multiple selected file which belong + to different folders. As this method always provides the root folder for all selected + files this cannot work. + */ + ::com::sun::star::uno::Sequence< OUString > GetMPath() const; + + /** Provides the selected files with full path information */ + ::com::sun::star::uno::Sequence< OUString > GetSelectedFiles() const; + + void AddFilter( const String& rFilterName, const String& rExtension ); + void SetCurrentFilter( const String& rFilter ); + + /** sets an initial display directory/file name + + @deprecated + don't use this method. It contains a lot of magic in determining whether the + last segment of the given path/URL denotes a file name or a folder, and by + definition, it cannot succeed with this magic *all* the time - there will + always be scenarios where it fails. + + Use SetDisplayFolder and SetFileName. + */ + void SetDisplayDirectory( const String& rPath ); + + /** sets a new folder whose content is to be displayed in the file picker + + @param _rURL + specifies the URL of the folder whose content is to be displayed.<br/> + If the URL doesn't denote a valid (existent and accessible) folder, the + request is silently dropped. + @throws ::com::sun::star::uno::RuntimeException + if the invocation of any of the file picker or UCB methods throws a RuntimeException. + */ + void SetDisplayFolder( const String& _rURL ); + + /** sets an initial file name to display + + This method is usually used in "save-as" contexts, where the application should + suggest an initial name for the file to save. + + Calling this method is nearly equivalent to calling <code>GetFilePicker().setDefaultName( _rFileName )</code>, + with the following differences: + <ul><li>The FileDialogHelper remembers the given file name, and upon execution, + strips its extension if the dialog is set up for "automatic file name extension".</li> + <li>Exceptions thrown from the <code>XFilePicker</code> are caught and silenced.</li> + </ul> + */ + void SetFileName( const String& _rFileName ); + + String GetCurrentFilter() const; + String GetDisplayDirectory() const; + ErrCode GetGraphic( Graphic& rGraphic ) const; + + ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > GetFilePicker() const; + + // XFilePickerListener methods + virtual void SAL_CALL FileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ); + virtual void SAL_CALL DirectoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ); + virtual void SAL_CALL ControlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ); + virtual void SAL_CALL DialogSizeChanged(); + virtual OUString SAL_CALL HelpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ); + + // XDialogClosedListener methods + virtual void SAL_CALL DialogClosed( const ::com::sun::star::ui::dialogs::DialogClosedEvent& _rEvent ); + + /** sets help ids for the controls in the dialog + @param _pControlId + Pointer to a 0-terminated array of control ids. They must be recruited from the + CommonFilePickerElementIds and ExtendedFilePickerElementIds values. + @param _pHelpId + Pointer to an array of help ids. For each element in _pControlId, there must be + a corresponding element herein. + */ + void SetControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId ); + void CreateMatcher( const String& rName ); + + /** sets the context of the dialog and trigger necessary actions e.g. loading config, setting help id + @param _eNewContext + New context for the dialog. + */ + void SetContext( Context _eNewContext ); + + DECL_LINK( ExecuteSystemFilePicker, void* ); + + ErrCode Execute( std::vector<OUString>& rpURLList, + SfxItemSet *& rpSet, + String& rFilter, + const String& rDirPath ); + ErrCode Execute( SfxItemSet *& rpSet, + String& rFilter ); +}; + +#define SFX2_IMPL_DIALOG_CONFIG 0 +#define SFX2_IMPL_DIALOG_SYSTEM 1 +#define SFX2_IMPL_DIALOG_OOO 2 + +ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, + sal_Int64 nFlags, + const String& rFact, + std::vector<OUString>& rpURLList, + String& rFilter, + SfxItemSet *& rpSet, + const String* pPath = NULL, + sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG, + const String& rStandardDir = OUString(), + const ::com::sun::star::uno::Sequence< OUString >& rBlackList = ::com::sun::star::uno::Sequence< OUString >()); + + +ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItemSet* pSet); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx new file mode 100644 index 000000000000..63220cae1325 --- /dev/null +++ b/include/sfx2/frame.hxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXFRAME_HXX +#define _SFXFRAME_HXX + +#ifndef TF_NEWDESKTOP +#define TF_NEWDESKTOP 1 +#endif + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +namespace com +{ + namespace sun + { + namespace star + { + namespace awt + { + class XWindow; + } + namespace frame + { + class XFrame; + class XFrameLoader; + class XController; + class XDispatchProviderInterceptor; + } + namespace beans + { + struct PropertyValue; + } + } + } +} +#include <tools/ref.hxx> +#include <tools/string.hxx> +#include <svl/brdcst.hxx> +#include <svl/poolitem.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vector> + +class SvBorder; +class SfxWorkWindow; +class Window; +class SfxFrame; +class SfxFrame_Impl; +class SfxObjectShell; +class SfxObjectFactory; +class SfxViewFrame; +class SfxFrameDescriptor; +class SfxFrameSetDescriptor; +class SfxDispatcher; +class Rectangle; +class SfxRequest; +class SfxUnoControllerItem; +class SvCompatWeakHdl; +class SystemWindow; + +class SfxFrame; +typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl; + +typedef ::std::vector< String* > TargetList; + +#define SFXFRAME_HASTITLE 0x0001 + +//========================================================================== +// SfxFrame is a management class for windows and their content. +// A SfxApplication represent a hierarchy of SfxFrames, with which the actual +// content in the derived classes is defined. The base class SfxFrame +// implements two aspects of frames: naming and control of its lifespan. +// Inside a frame hierarchy the parent frame always controls the lifespan of +// its child frames, even though they usually are not even produced by the +// parent. By calling DoCloser() on any frame in the hierarchy, +// a part of the "framework" can be removed, where frames unsubscribe +// from their parent frames. +//========================================================================== + +class SFX2_DLLPUBLIC SfxFrame +{ + friend class SfxFrameIterator; + friend class SfxFrameWindow_Impl; + +private: + SfxFrame* pParentFrame; + SfxFrameArr_Impl* pChildArr; + SfxFrame_Impl* pImp; + Window* pWindow; + +protected: + sal_Bool Close(); + virtual ~SfxFrame(); + + SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); + + SfxFrame( ); // not implemented + SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden ); + +public: + TYPEINFO(); + + static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + CreateBlankFrame(); + static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden ); + + SvCompatWeakHdl* GetHdl(); + Window& GetWindow() const; + void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True ); + sal_Bool DoClose(); + sal_uInt16 GetChildFrameCount() const; + SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; + SfxFrame* GetParentFrame() const + { return pParentFrame; } + + void SetPresentationMode( sal_Bool bSet ); + SystemWindow* GetSystemWindow() const; + + static SfxFrame* GetFirst(); + static SfxFrame* GetNext( SfxFrame& ); + + static const SfxPoolItem* + OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame ); + + SfxObjectShell* GetCurrentDocument() const; + SfxViewFrame* GetCurrentViewFrame() const; + SfxFrame& GetTopFrame() const; + sal_Bool IsParent( SfxFrame* ) const; + + sal_uInt32 GetFrameType() const; + void GetTargetList( TargetList& ) const; + SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf ); + void UpdateDescriptor( SfxObjectShell *pDoc ); + void Resize(); + sal_Bool HasComponent() const; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > + GetComponent() const; + void ReleaseComponent(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + GetFrameInterface() const; + void Appear(); + void AppearWithUpdate(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > + GetController() const; + + sal_Bool IsInPlace() const; + + SAL_DLLPRIVATE sal_Bool DoClose_Impl(); + SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); + SAL_DLLPRIVATE void GetViewData_Impl(); + SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); + SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False ); + SAL_DLLPRIVATE sal_Bool DocIsModified_Impl(); + SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); + SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; + SAL_DLLPRIVATE void SetIsClosing_Impl(); + + // Methods for accessing the current set + SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; + + SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock ); + SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const; + SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const; + + SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); + SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); + SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet ); + SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const; + SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); + SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* ); + SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* ); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const; + SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& ); + SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const; + SAL_DLLPRIVATE void CreateWorkWindow_Impl(); + SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); + SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); + + SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc ); + SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock ); + SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn ); + SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const; + SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; + SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; +private: + SAL_DLLPRIVATE void Construct_Impl(); +}; + +SV_DECL_COMPAT_WEAK( SfxFrame ) + +class SfxFrameIterator +{ + const SfxFrame* pFrame; + sal_Bool bRecursive; + + SfxFrame* NextSibling_Impl( SfxFrame& rPrev ); + +public: + SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True ); + SfxFrame* FirstFrame(); + SfxFrame* NextFrame( SfxFrame& rPrev ); +}; + +//-------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem +{ + SfxFrame* pFrame; + SfxFrameWeak wFrame; + SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; } + +public: + TYPEINFO(); + + SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p ); + SfxFrameItem( SfxFrame *p=0 ); + SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p ); + + virtual int operator==( const SfxPoolItem& ) const; + virtual String GetValueText() const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + sal_Bool FrameKilled() const { return &wFrame != pFrame; } + + SfxFrame* GetFrame() const + { return wFrame; } +}; + +class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem +{ + ::com::sun::star::uno::Any aValue; +public: + TYPEINFO(); + SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny ); + ::com::sun::star::uno::Any GetValue() const + { return aValue; } + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + m_xFrame; + +public: + TYPEINFO(); + SfxUnoFrameItem(); + SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& + GetFrame() const + { return m_xFrame; } + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +typedef SfxUsrAnyItem SfxUnoAnyItem; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmdescr.hxx b/include/sfx2/frmdescr.hxx new file mode 100644 index 000000000000..2c0c178a3795 --- /dev/null +++ b/include/sfx2/frmdescr.hxx @@ -0,0 +1,259 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_FRMDESCRHXX +#define _SFX_FRMDESCRHXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <sfx2/sfxsids.hrc> +#include <svl/poolitem.hxx> +#include <tools/urlobj.hxx> +#include <tools/string.hxx> +#include <tools/gen.hxx> + +class SvStream; +struct SfxFrameDescriptor_Impl; +class SfxFrameDescriptor; +class Wallpaper; + +//=========================================================================== +// The SfxFrame descriptors build a recursive structure, that covers all the +// required data in-order to display the frame document. +// Through a SfxFrameSetDescriptor access is given to the whole underlying +// structure. Due to the nature of the SfxFrames document, the +// SfxFramesSetDescriptor is not only the content of this document, but also +// describes the view on it. The FrameSet is made up of lines, which in turn, +// contains the actual window . A line can be horizontally or vertically +// aligned, from which also the alignment of the FrameSet is given. +//=========================================================================== + +enum ScrollingMode +{ + ScrollingYes, + ScrollingNo, + ScrollingAuto +}; + +enum SizeSelector +{ + SIZE_ABS, + SIZE_PERCENT, + SIZE_REL +}; + +#define BORDER_SET 2 +#define BORDER_YES 1 +#define BORDER_NO 0 +#define SPACING_NOT_SET -1L +#define SIZE_NOT_SET -1L + +class SfxItemSet; +struct SfxFrameProperties; + +class SFX2_DLLPUBLIC SfxFrameDescriptor +{ + INetURLObject aURL; + INetURLObject aActualURL; + String aName; + Size aMargin; + long nWidth; + ScrollingMode eScroll; + SizeSelector eSizeSelector; + sal_uInt16 nHasBorder; + sal_uInt16 nItemId; + sal_Bool bResizeHorizontal; + sal_Bool bResizeVertical; + sal_Bool bHasUI; + sal_Bool bReadOnly; + SfxFrameDescriptor_Impl* pImp; + +public: + SfxFrameDescriptor(); + ~SfxFrameDescriptor(); + + // FileName/URL + SfxItemSet* GetArgs(); + const INetURLObject& GetURL() const + { return aURL; } + void SetURL( const String& rURL ); + const INetURLObject& GetActualURL() const + { return aActualURL; } + void SetActualURL( const INetURLObject& rURL ); + void SetActualURL( const String& rURL ); + void SetReadOnly( sal_Bool bSet ) { bReadOnly = bSet;} + sal_Bool IsReadOnly( ) const { return bReadOnly;} + void SetEditable( sal_Bool bSet ); + sal_Bool IsEditable() const; + + // Size + void SetWidth( long n ) + { nWidth = n; } + void SetWidthPercent( long n ) + { nWidth = n; eSizeSelector = SIZE_PERCENT; } + void SetWidthRel( long n ) + { nWidth = n; eSizeSelector = SIZE_REL; } + void SetWidthAbs( long n ) + { nWidth = n; eSizeSelector = SIZE_ABS; } + long GetWidth() const + { return nWidth; } + SizeSelector GetSizeSelector() const + { return eSizeSelector; } + sal_Bool IsResizable() const + { return bResizeHorizontal && bResizeVertical; } + void SetResizable( sal_Bool bRes ) + { bResizeHorizontal = bResizeVertical = bRes; } + + // FrameName + const String& GetName() const + { return aName; } + void SetName( const String& rName ) + { aName = rName; } + + // Margin, Scrolling + const Size& GetMargin() const + { return aMargin; } + void SetMargin( const Size& rMargin ) + { aMargin = rMargin; } + ScrollingMode GetScrollingMode() const + { return eScroll; } + void SetScrollingMode( ScrollingMode eMode ) + { eScroll = eMode; } + + // FrameBorder + void SetWallpaper( const Wallpaper& rWallpaper ); + sal_Bool HasFrameBorder() const; + + sal_Bool IsFrameBorderOn() const + { return ( nHasBorder & BORDER_YES ) != 0; } + + void SetFrameBorder( sal_Bool bBorder ) + { + nHasBorder = bBorder ? + BORDER_YES | BORDER_SET : + BORDER_NO | BORDER_SET; + } + sal_Bool IsFrameBorderSet() const + { return (nHasBorder & BORDER_SET) != 0; } + void ResetBorder() + { nHasBorder = 0; } + + sal_Bool HasUI() const + { return bHasUI; } + void SetHasUI( sal_Bool bOn ) + { bHasUI = bOn; } + + // Attribute for Splitwindow + sal_uInt16 GetItemId() const + { return nItemId; } + void SetItemId( sal_uInt16 nId ) + { nItemId = nId; } + + // Copy for example for Views + SfxFrameDescriptor* Clone( sal_Bool bWithIds = sal_True ) const; +}; + +// No block to implement a =operator +struct SfxFrameProperties +{ + String aURL; + String aName; + long lMarginWidth; + long lMarginHeight; + long lSize; + long lSetSize; + long lFrameSpacing; + long lInheritedFrameSpacing; + ScrollingMode eScroll; + SizeSelector eSizeSelector; + SizeSelector eSetSizeSelector; + sal_Bool bHasBorder; + sal_Bool bBorderSet; + sal_Bool bResizable; + sal_Bool bSetResizable; + sal_Bool bIsRootSet; + sal_Bool bIsInColSet; + sal_Bool bHasBorderInherited; + SfxFrameDescriptor* pFrame; + +private: + SfxFrameProperties( SfxFrameProperties& ) {} +public: + SfxFrameProperties() + : lMarginWidth( SIZE_NOT_SET ), + lMarginHeight( SIZE_NOT_SET ), + lSize( 1L ), + lSetSize( 1L ), + lFrameSpacing( SPACING_NOT_SET ), + lInheritedFrameSpacing( SPACING_NOT_SET ), + eScroll( ScrollingAuto ), + eSizeSelector( SIZE_REL ), + eSetSizeSelector( SIZE_REL ), + bHasBorder( sal_True ), + bBorderSet( sal_True ), + bResizable( sal_True ), + bSetResizable( sal_True ), + bIsRootSet( sal_False ), + bIsInColSet( sal_False ), + bHasBorderInherited( sal_True ), + pFrame( 0 ) {} + + ~SfxFrameProperties() { delete pFrame; } + + int operator ==( const SfxFrameProperties& ) const; + SfxFrameProperties& operator =( const SfxFrameProperties &rProp ); +}; + +class SfxFrameDescriptorItem : public SfxPoolItem +{ + SfxFrameProperties aProperties; +public: + TYPEINFO(); + + SfxFrameDescriptorItem ( const sal_uInt16 nId = SID_FRAMEDESCRIPTOR ) + : SfxPoolItem( nId ) + {} + + SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy ) + : SfxPoolItem( rCpy ) + { + aProperties = rCpy.aProperties; + } + + virtual ~SfxFrameDescriptorItem(); + + virtual int operator ==( const SfxPoolItem& ) const; + SfxFrameDescriptorItem& operator =( const SfxFrameDescriptorItem & ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const SfxFrameProperties& GetProperties() const + { return aProperties; } + void SetProperties( const SfxFrameProperties& rProp ) + { aProperties = rProp; } +}; + +#endif // #ifndef _SFX_FRMDESCRHXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmhtml.hxx b/include/sfx2/frmhtml.hxx new file mode 100644 index 000000000000..d1eb1c4054c0 --- /dev/null +++ b/include/sfx2/frmhtml.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _FRMHTML_HXX +#define _FRMHTML_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <sfx2/frmdescr.hxx> +#include <sfx2/sfxhtml.hxx> + +class SfxFrameHTMLParser; +class SfxMedium; +namespace svtools { class AsynchronLink; } + +class SFX2_DLLPUBLIC SfxFrameHTMLParser : public SfxHTMLParser +{ +protected: + SfxFrameHTMLParser( SvStream& rStream, sal_Bool bIsNewDoc=sal_True, SfxMedium *pMediumPtr=0 ): + SfxHTMLParser( rStream, bIsNewDoc, pMediumPtr ) {}; + +public: + // These methods can also be used by other parsers. + static void ParseFrameOptions(SfxFrameDescriptor*, const HTMLOptions&, const String& ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx new file mode 100644 index 000000000000..3abdfbee3107 --- /dev/null +++ b/include/sfx2/frmhtmlw.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _FRMHTMLW_HXX +#define _FRMHTMLW_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" + +#include <sfx2/frmdescr.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <tools/stream.hxx> +#include <svtools/parhtml.hxx> +#include <svtools/htmlout.hxx> +#include <svtools/htmlkywd.hxx> + +class SfxFrame; + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } +} } } + +class SFX2_DLLPUBLIC SfxFrameHTMLWriter +{ + SAL_DLLPRIVATE static const sal_Char sNewLine[]; + SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm, + const sal_Char *pIndent, const String& rName, + const String& rContent, sal_Bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + String *pNonConvertableChars = 0 ); + SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm, + const sal_Char *pIndent, const sal_Char *pName, + const String& rContent, sal_Bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + String *pNonConvertableChars = 0 ); + +public: + static void Out_DocInfo( SvStream& rStrm, const String& rBaseURL, + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>&, + const sal_Char *pIndent, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + String *pNonConvertableChars = 0 ); + + static void Out_FrameDescriptor( + SvStream&, const String& rBaseURL, const com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet >& xSet, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + String *pNonConvertableChars = 0 ); +}; + +inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, + const sal_Char *pIndent, const sal_Char *pName, + const String& rContent, sal_Bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + String *pNonConvertableChars ) +{ + String sTmp = OUString::createFromAscii(pName); + OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, eDestEnc, pNonConvertableChars ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/genlink.hxx b/include/sfx2/genlink.hxx new file mode 100644 index 000000000000..045047d9d0c7 --- /dev/null +++ b/include/sfx2/genlink.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXGENLINK_HXX +#define _SFXGENLINK_HXX + + +#include <tools/link.hxx> +typedef long (*CFuncPtr)(void*); + +class GenLink +{ + Link aLink; + CFuncPtr pFunc; + +public: + GenLink(): pFunc(0) {} + GenLink( CFuncPtr pCFunc ): pFunc(pCFunc) {} + GenLink( const Link& rLink ): aLink(rLink), pFunc(0) {} + GenLink( const GenLink& rOrig ): + aLink(rOrig.aLink), pFunc(rOrig.pFunc) {} + + GenLink& operator = ( const GenLink& rOrig ) + { pFunc = rOrig.pFunc; aLink = rOrig.aLink; return *this; } + + sal_Bool operator!() const { return !aLink && !pFunc; } + sal_Bool IsSet() const { return aLink.IsSet() || pFunc; } + + long Call( void* pCaller ) + { return pFunc ? (*pFunc)(pCaller) : aLink.Call(pCaller); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/hintpost.hxx b/include/sfx2/hintpost.hxx new file mode 100644 index 000000000000..25adb3ea3d58 --- /dev/null +++ b/include/sfx2/hintpost.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXHINTPOST_HXX +#define _SFXHINTPOST_HXX + +#include <sfx2/genlink.hxx> +#include <tools/ref.hxx> + +//=================================================================== + +class SfxHint; + +//------------------------------------------------------------------- + +class SfxHintPoster: public SvRefBase + +/* [Description] + + With instances of this class unique events per PostUserEvent can be sent + using the StarView-application. If the User-Event is triggered often, + the handler <Event()> is called, the base implementation with the + <SetEventHdl()> line is making these link calls. + + The instance are held via Ref-Count at least as long as a possible sent + event has not arrived yet. Should be killed before the goal, before the + connection is SetEventHdl (GenLink ()) . +*/ + +{ + GenLink aLink; + +private: + DECL_LINK( DoEvent_Impl, SfxHint * ); + +protected: + virtual ~SfxHintPoster(); + virtual void Event( SfxHint* pPostedHint ); + +public: + SfxHintPoster( const GenLink& rLink ); + + void Post( SfxHint* pHint = 0 ); + void SetEventHdl( const GenLink& rLink ); +}; + +//------------------------------------------------------------------- + +SV_DECL_IMPL_REF(SfxHintPoster); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/htmlmode.hxx b/include/sfx2/htmlmode.hxx new file mode 100644 index 000000000000..0ce8e430869e --- /dev/null +++ b/include/sfx2/htmlmode.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_HTMLMODE_HXX_ +#define _SFX_HTMLMODE_HXX_ + +#define HTMLMODE_ON 0x0001 +#define HTMLMODE_PARA_DISTANCE 0x0004 +#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */ +#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */ +#define HTMLMODE_PARA_BLOCK 0x0100 +#define HTMLMODE_RESERVED1 0x4000 +#define HTMLMODE_RESERVED0 0x8000 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/imagemgr.hxx b/include/sfx2/imagemgr.hxx new file mode 100644 index 000000000000..92df8e70c573 --- /dev/null +++ b/include/sfx2/imagemgr.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +#include <rtl/ustring.hxx> +#include <vcl/image.hxx> + +SFX2_DLLPUBLIC Image SAL_CALL GetImage( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const OUString& aURL, + bool bBig +); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/imgmgr.hxx b/include/sfx2/imgmgr.hxx new file mode 100644 index 000000000000..7ef278023336 --- /dev/null +++ b/include/sfx2/imgmgr.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXIMGMGR_HXX +#define _SFXIMGMGR_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <sal/types.h> +#include <vcl/image.hxx> + +class ToolBox; +class SfxModule; +class SfxImageManager_Impl; +class SFX2_DLLPUBLIC SfxImageManager +{ + SfxImageManager_Impl* pImp; + +public: + static SfxImageManager* GetImageManager( SfxModule* ); + + SfxImageManager( SfxModule* pModule = 0 ); + ~SfxImageManager(); + + void RegisterToolBox( ToolBox *pBox, sal_uInt16 nFlags=0xFFFF); + void ReleaseToolBox( ToolBox *pBox ); + + Image GetImage( sal_uInt16 nId, bool bLarge ) const; + Image GetImage( sal_uInt16 nId) const; + Image SeekImage( sal_uInt16 nId, bool bLarge ) const; + Image SeekImage( sal_uInt16 nId ) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx new file mode 100644 index 000000000000..b91d01ad4927 --- /dev/null +++ b/include/sfx2/infobar.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef _SFX2_MESSAGEBAR_HXX_ +#define _SFX2_MESSAGEBAR_HXX_ + +#include <vector> + +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> + +#include <sfx2/dllapi.h> +#include <sfx2/childwin.hxx> + +/** SfxChildWindow for positioning the InfoBar in the view. + */ +class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow +{ + private: + SfxBindings* m_pBindings; + + public: + SfxInfoBarContainerChild( Window* pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ); + virtual ~SfxInfoBarContainerChild(); + + SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild ); + + void Update( ); +}; + +/** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow. + */ +class SfxInfoBarWindow : public Window +{ + private: + OUString m_sId; + FixedText* m_pMessage; + Button* m_pCloseBtn; + std::vector< PushButton* > m_aActionBtns; + + public: + SfxInfoBarWindow( Window* parent, const OUString& sId, + const OUString& sMessage, + std::vector< PushButton* > aButtons ); + ~SfxInfoBarWindow( ); + + virtual const OUString& getId() const { return m_sId; } + virtual void Paint( const Rectangle& ); + virtual void Resize( ); + + private: + DECL_LINK( CloseHandler, void* ); +}; + +class SfxInfoBarContainerWindow : public Window +{ + private: + SfxInfoBarContainerChild* m_pChildWin; + std::vector< SfxInfoBarWindow* > m_pInfoBars; + + public: + SfxInfoBarContainerWindow( SfxInfoBarContainerChild* pChildWin ); + ~SfxInfoBarContainerWindow( ); + + void appendInfoBar( const OUString& sId, const OUString& sMessage, std::vector< PushButton* > aButtons ); + SfxInfoBarWindow* getInfoBar( const OUString& sId ); + void removeInfoBar( SfxInfoBarWindow* pInfoBar ); + + virtual void Resize( ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx new file mode 100644 index 000000000000..e97b628d4b1a --- /dev/null +++ b/include/sfx2/ipclient.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_IPCLIENT_HXX +#define _SFX_IPCLIENT_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/XEmbeddedObject.hpp> + +#include <tools/gen.hxx> + +#include <sfx2/objsh.hxx> + +class SfxInPlaceClient_Impl; +class SfxViewShell; +class SfxObjectShell; +class Window; +class Fraction; + +//========================================================================= + +class SFX2_DLLPUBLIC SfxInPlaceClient +{ +friend class SfxInPlaceClient_Impl; + + SfxInPlaceClient_Impl* m_pImp; + SfxViewShell* m_pViewSh; + Window* m_pEditWin; + + // called after the requested new object area was negotiated + SAL_DLLPRIVATE virtual void ObjectAreaChanged(); + + // an active object was resized by the user and now asks for the new space + SAL_DLLPRIVATE virtual void RequestNewObjectArea( Rectangle& ); + + // notify the client that an active object has changed its VisualAreaSize + SAL_DLLPRIVATE virtual void ViewChanged(); + + // an object wants to become visible + SAL_DLLPRIVATE virtual void MakeVisible(); + +public: + SfxInPlaceClient( SfxViewShell* pViewShell, Window* pDraw, sal_Int64 nAspect = com::sun::star::embed::Aspects::MSOLE_CONTENT ); + virtual ~SfxInPlaceClient(); + + SfxViewShell* GetViewShell() const { return m_pViewSh; } + Window* GetEditWin() const { return m_pEditWin; } + com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject() const; + void SetObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rObject ); + void SetObjectState( sal_Int32 ); + Size GetObjectVisAreaSize() const; + sal_Bool IsObjectUIActive() const; + sal_Bool IsObjectInPlaceActive() const; + void DeactivateObject(); + sal_Bool SetObjArea( const Rectangle & ); + Rectangle GetObjArea() const; + Rectangle GetScaledObjArea() const; + void SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight ); + sal_Bool SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& ); + const Fraction& GetScaleWidth() const; + const Fraction& GetScaleHeight() const; + void Invalidate(); + static SfxInPlaceClient* GetClient( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject ); + sal_Int64 GetAspect() const; + sal_Int64 GetObjectMiscStatus() const; + ErrCode DoVerb( long nVerb ); + void VisAreaChanged(); + void ResetObject(); + sal_Bool IsUIActive(); + + virtual void FormatChanged(); // object format was changed (used for StarMath formulas aligning) +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx new file mode 100644 index 000000000000..95a545e3dad4 --- /dev/null +++ b/include/sfx2/itemconnect.hxx @@ -0,0 +1,578 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX_ITEMCONNECT_HXX +#define SFX_ITEMCONNECT_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <memory> +#include <sfx2/itemwrapper.hxx> +#include <sfx2/controlwrapper.hxx> + +// ============================================================================ + +namespace sfx { + +// ============================================================================ + +typedef int ItemConnFlags; + +/** No special state for the connection. */ +const ItemConnFlags ITEMCONN_NONE = 0x0000; + +/** Connection is inactive - virtual functions will not be called. */ +const ItemConnFlags ITEMCONN_INACTIVE = 0x0001; + +/** Enable control(s), if the item is known. */ +const ItemConnFlags ITEMCONN_ENABLE_KNOWN = 0x0010; +/** Disable control(s), if the item is unknown. */ +const ItemConnFlags ITEMCONN_DISABLE_UNKNOWN = 0x0020; +/** Show control(s), if the item is known. */ +const ItemConnFlags ITEMCONN_SHOW_KNOWN = 0x0040; +/** Hide control(s), if the item is unknown. */ +const ItemConnFlags ITEMCONN_HIDE_UNKNOWN = 0x0080; + +/** Default value for constructors. */ +const ItemConnFlags ITEMCONN_DEFAULT = ITEMCONN_NONE; + +// ============================================================================ +// Base connection classes +// ============================================================================ + +/** A helper for SfxTabPages to connect controls to items. + + This is the base class of all control connection classes. Their purpose is + to connect one or more controls from an SfxTabPage with an item from an + item set. The goal is to omit any additional code in the virtual functions + Reset() and FillItemSet() in classes derived from SfxTabPage. + + Examples of connections: + - A check box with an SfxBoolItem, + - A metric (spin) field with an SfxInt32Item. + - A group of radio buttons with an SfxEnumItem. + + Each SfxTabPage will contain a list of connection objects (derived from + this class). The connection objects remember the item and control(s) they + have to work on. The SfxTabPage will call the DoApplyFlags(), DoReset(), + and DoFillItemSet() functions of all connection objects it knows. The code + to initialize control(s) from the item value and fill the item from + control(s) has to be written only once for each control type. + + Additional flags passed in the constructor allow to control the behaviour + of the control(s) if the item is supported/unsupported in the currently + used item set. For example, it is possible to specify that a control will + be disabled or hidden if the item is not supported. This is done before + each call of Reset(). + + The special flag ITEMCONN_CLONE_ITEM controls how to create new items in + the DoFillItemSet() function. The standard (and faster) method is to create + a temporary item on the stack and put it into the item set. But this does + not work if the item set expects a special item type derived from a common + item class, i.e. a Boolean item derived from SfxBoolItem providing special + item representation text. As this code does not know the item type, the + item cannot be created on the stack. For this case the flag specifies to + use the virtual Clone() method of the pool default item. This will create + an item of the correct type but can still be used in conjunction with i.e. + the standard BoolItemWrapper. + + How to use the item connection feature: + + A) Single item <-> single control connection + + Example: An SfxBoolItem and a check box. + + A1) Create a new item wrapper class derived from the SingleItemWrapper + template, or use the template directly, or use one of the + predefined item wrappers. See documentation of the + SingleItemWrapper template for details (itemwrapper.hxx). + A2) Create a new control wrapper class derived from the + SingleControlWrapper template and implement the abstract functions, + or use one of the predefined control wrappers. See documentation of + the SingleControlWrapper template for details (controlwrapper.hxx). + A3) Create a new connection class derived from one of the following + base classes, and implement the abstract functions, or use the + ItemControlConnection template directly, or use one of the + predefined connections. + A4) Create connection objects in the constructor of the tab page, and + insert them into the tab page with SfxTabPage::AddItemConnection(). + A5) Remove old code from the tab page's Reset() and FillItemSet() + functions, if necessary. + + B) Single item <-> multiple controls connections + + B1) See step A1. If the item contains multiple values (and not a + structure that contains all the values for the different controls), + the best way is to use the IdentItemWrapper template, that works + with the item itself. This way it is possible to provide a 'data + type' that contains the values for all controls. + B2) Create a new control wrapper class derived from the + MultiControlWrapper template. Add single control wrapper members + for all controls to this class and register them in the + constructor, using the RegisterControlWrapper() function. Implement + the abstract functions GetControlValue() and SetControlValue(). + These functions should call the respective functions of the own + single control wrappers and either fill a new data object (the item + itself in most cases, see step B1) with all the values from the + controls, or fill all the controls from the data object. + B3) Create a new connection class derived from ItemControlConnection, + or use the ItemControlConnection template directly. The multiple + control wrapper from step B2 acts like a single control, therefore + it is possible to use the ItemControlConnection. + B4) See steps A4 and A5. + + C) Multiple items <-> single control connections + + todo + + D) Multiple items <-> multiple controls connections + + todo + + The current tree of base classes/templates and standard connections: + + ItemConnectionBase + | + +- DummyItemConnection [1] + | + +- ItemControlConnection< ItemWrpT, ControlWrpT > + | | + | +- CheckBoxConnection [1] + | | + | +- NumericConnection< ItemWrpT > [1] + | | | + | | +- [ValueType]NumericConnection [1] [2] + | | + | +- MetricConnection< ItemWrpT > [1] + | | | + | | +- [ValueType]MetricConnection [1] [2] + | | + | +- ListBoxConnection< ItemWrpT > [1] + | | | + | | +- [ValueType]ListBoxConnection [1] [2] + | | + | +- ValueSetConnection< ItemWrpT > [1] + | | + | +- [ValueType]ValueSetConnection [1] [2] + | + +- ItemConnectionArray [1] + + Notes: + [1] Standard connections ready to use. + [2] [ValueType] is one of Int16, UInt16, Int32, UInt32. + */ +class SFX2_DLLPUBLIC ItemConnectionBase +{ +public: + virtual ~ItemConnectionBase(); + + /** Returns the flags passed in the constructor. */ + inline ItemConnFlags GetFlags() const { return mnFlags; } + + /** Returns true if this connection is active. */ + bool IsActive() const; + + /** Calls the virtual ApplyFlags() function, if connection is active. */ + void DoApplyFlags( const SfxItemSet& rItemSet ); + /** Calls the virtual Reset() function, if connection is active. */ + void DoReset( const SfxItemSet& rItemSet ); + /** Calls the virtual FillItemSet() function, if connection is active. */ + bool DoFillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ); + +protected: + explicit ItemConnectionBase( ItemConnFlags nFlags = ITEMCONN_DEFAULT ); + + /** Derived classes implement actions according to current flags here. */ + virtual void ApplyFlags( const SfxItemSet& rItemSet ) = 0; + /** Derived classes implement initializing controls from item sets here. */ + virtual void Reset( const SfxItemSet& rItemSet ) = 0; + /** Derived classes implement filling item sets from controls here. */ + virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) = 0; + + /** Returns whether to enable a control, according to current flags. */ + TriState GetEnableState( bool bKnown ) const; + /** Returns whether to show a control, according to current flags. */ + TriState GetShowState( bool bKnown ) const; + +private: + /* Disable copy c'tor and assignment. */ + ItemConnectionBase( const ItemConnectionBase& ); + ItemConnectionBase& operator=( const ItemConnectionBase& ); + + ItemConnFlags mnFlags; /// Flags for additional options. +}; + +// ---------------------------------------------------------------------------- + +/** Base class template for single item <-> single control connection objects. + + This template uses functions provided by the SingleItemWrapper and the + SingleControlWrapper template classes. The virtual functions ApplyFlags(), + Reset(), and FillItemSet() are implemented here in a generic way using the + virtual functions of the wrapper classes. Derived classes only have to + create or otherwise provide appropriate wrappers. + */ +template< typename ItemWrpT, typename ControlWrpT > +class ItemControlConnection : public ItemConnectionBase +{ +public: + typedef ItemWrpT ItemWrapperType; + typedef ControlWrpT ControlWrapperType; + typedef ItemControlConnection< ItemWrpT, ControlWrpT > ItemControlConnectionType; + typedef typename ItemWrpT::ItemType ItemType; + typedef typename ItemWrpT::ItemValueType ItemValueType; + typedef typename ControlWrpT::ControlType ControlType; + typedef typename ControlWrpT::ControlValueType ControlValueType; + + typedef std::auto_ptr< ItemWrpT > ItemWrapperRef; + typedef std::auto_ptr< ControlWrpT > ControlWrapperRef; + + /** Receives pointer to a newly created control wrapper. + @descr Takes ownership of the control wrapper. */ + explicit ItemControlConnection( sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, + ItemConnFlags nFlags = ITEMCONN_DEFAULT ); + + /** Convenience constructor. Receives reference to a control directly. + @descr May only be used, if ControlWrpT::ControlWrpT( ControlType& ) + constructor exists. */ + explicit ItemControlConnection( sal_uInt16 nSlot, ControlType& rControl, + ItemConnFlags nFlags = ITEMCONN_DEFAULT ); + + virtual ~ItemControlConnection(); + +protected: + /** Actions according to current flags for the control. */ + virtual void ApplyFlags( const SfxItemSet& rItemSet ); + /** Resets the control according to the item contents. */ + virtual void Reset( const SfxItemSet& rItemSet ); + /** Fills the item set according to the control's state. */ + virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ); + + ItemWrapperType maItemWrp; + ControlWrapperRef mxCtrlWrp; +}; + +// ============================================================================ +// Standard connections +// ============================================================================ + +/** This is a helper class to enable/disable/show/hide a control only. + + This class does nothing special in the Reset() and FillItemSet() functions. + It can be used to control the visibility of i.e. fixed lines or fixed texts + related to the availability of an item by passing the appropriate flags to + the constructor of this connection. + */ +class SFX2_DLLPUBLIC DummyItemConnection: + public ItemConnectionBase, public DummyWindowWrapper +{ +public: + explicit DummyItemConnection( sal_uInt16 nSlot, Window& rWindow, + ItemConnFlags nFlags = ITEMCONN_DEFAULT ); + +protected: + virtual void ApplyFlags( const SfxItemSet& rItemSet ); + virtual void Reset( const SfxItemSet& rItemSet ); + virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ); + +private: + sal_uInt16 mnSlot; +}; + +// ---------------------------------------------------------------------------- + +/** Connection between an SfxBoolItem and a VCL CheckBox. */ +typedef ItemControlConnection< BoolItemWrapper, CheckBoxWrapper > CheckBoxConnection; + +// ============================================================================ + +/** Connection between an item and the VCL NumericField. */ +template< typename ItemWrpT > +class NumericConnection : public ItemControlConnection< ItemWrpT, + NumericFieldWrapper< typename ItemWrpT::ItemValueType > > +{ + typedef ItemControlConnection< ItemWrpT, + NumericFieldWrapper< typename ItemWrpT::ItemValueType > > + ItemControlConnectionType; + +public: + typedef typename ItemControlConnectionType::ControlWrapperType NumericFieldWrapperType; + + explicit NumericConnection( sal_uInt16 nSlot, NumericField& rField, + ItemConnFlags nFlags = ITEMCONN_DEFAULT ); +}; + +// ---------------------------------------------------------------------------- + +typedef NumericConnection< Int16ItemWrapper > Int16NumericConnection; +typedef NumericConnection< UInt16ItemWrapper > UInt16NumericConnection; +typedef NumericConnection< Int32ItemWrapper > Int32NumericConnection; +typedef NumericConnection< UInt32ItemWrapper > UInt32NumericConnection; + +// ============================================================================ + +/** Connection between an item and the VCL MetricField. + + Adds support of different field units during control value <-> item value + conversion. The field unit passed to the constructor applies for the item + values, while the field unit used in the control has to be set at the + control itself. + */ +template< typename ItemWrpT > +class MetricConnection : public ItemControlConnection< ItemWrpT, + MetricFieldWrapper< typename ItemWrpT::ItemValueType > > +{ + typedef ItemControlConnection< ItemWrpT, + MetricFieldWrapper< typename ItemWrpT::ItemValueType > > + ItemControlConnectionType; + +public: + typedef typename ItemControlConnectionType::ControlWrapperType MetricFieldWrapperType; + + explicit MetricConnection( sal_uInt16 nSlot, MetricField& rField, + FieldUnit eItemUnit = FUNIT_NONE, ItemConnFlags nFlags = ITEMCONN_DEFAULT ); +}; + +// ---------------------------------------------------------------------------- + +typedef MetricConnection< Int16ItemWrapper > Int16MetricConnection; +typedef MetricConnection< UInt16ItemWrapper > UInt16MetricConnection; +typedef MetricConnection< Int32ItemWrapper > Int32MetricConnection; +typedef MetricConnection< UInt32ItemWrapper > UInt32MetricConnection; + +// ============================================================================ + +/** Connection between an item and a VCL ListBox. + + Optionally a map can be passed that maps list box positions to item values. + This map MUST be terminated with an entry containing LISTBOX_ENTRY_NOTFOUND + as list box position. The item value contained in this last entry is used + as default item value in case of an error. + */ +template< typename ItemWrpT > +class ListBoxConnection : public ItemControlConnection< ItemWrpT, + ListBoxWrapper< typename ItemWrpT::ItemValueType > > +{ + typedef ItemControlConnection< ItemWrpT, + ListBoxWrapper< typename ItemWrpT::ItemValueType > > + ItemControlConnectionType; + +public: + typedef typename ItemControlConnectionType::ControlWrapperType ListBoxWrapperType; + typedef typename ListBoxWrapperType::MapEntryType MapEntryType; + + explicit ListBoxConnection( sal_uInt16 nSlot, ListBox& rListBox, + const MapEntryType* pMap = 0, ItemConnFlags nFlags = ITEMCONN_DEFAULT ); +}; + +// ---------------------------------------------------------------------------- + +typedef ListBoxConnection< Int16ItemWrapper > Int16ListBoxConnection; +typedef ListBoxConnection< UInt16ItemWrapper > UInt16ListBoxConnection; +typedef ListBoxConnection< Int32ItemWrapper > Int32ListBoxConnection; +typedef ListBoxConnection< UInt32ItemWrapper > UInt32ListBoxConnection; + +// ============================================================================ + +/** Connection between an item and an SVTOOLS ValueSet. + + Optionally a map can be passed that maps value set identifiers to item + values. This map MUST be terminated with an entry containing + VALUESET_ITEM_NOTFOUND as value set identifier. The item value contained in + this last entry is used as default item value in case of an error. + */ +template< typename ItemWrpT > +class ValueSetConnection : public ItemControlConnection< ItemWrpT, + ValueSetWrapper< typename ItemWrpT::ItemValueType > > +{ + typedef ItemControlConnection< ItemWrpT, + ValueSetWrapper< typename ItemWrpT::ItemValueType > > + ItemControlConnectionType; + +public: + typedef typename ItemControlConnectionType::ControlWrapperType ValueSetWrapperType; + typedef typename ValueSetWrapperType::MapEntryType MapEntryType; + + explicit ValueSetConnection( sal_uInt16 nSlot, ValueSet& rValueSet, + const MapEntryType* pMap = 0, ItemConnFlags nFlags = ITEMCONN_DEFAULT ); +}; + +// ---------------------------------------------------------------------------- + +typedef ValueSetConnection< Int16ItemWrapper > Int16ValueSetConnection; +typedef ValueSetConnection< UInt16ItemWrapper > UInt16ValueSetConnection; +typedef ValueSetConnection< Int32ItemWrapper > Int32ValueSetConnection; +typedef ValueSetConnection< UInt32ItemWrapper > UInt32ValueSetConnection; + +// ============================================================================ +// Array of connections +// ============================================================================ + +class ItemConnectionArrayImpl; + +/** A container of connection objects. + + This is a connection with the only purpose to contain other connection + objects. This way it is possible to create a tree structure of connections + for a convenient connection management. This class is used by the class + SfxTabPage to store all connections. + */ +class ItemConnectionArray : public ItemConnectionBase +{ +public: + explicit ItemConnectionArray(); + virtual ~ItemConnectionArray(); + + /** Adds a new connection to the list. + @descr Takes ownership of the connection! */ + void AddConnection( ItemConnectionBase* pConnection ); + +protected: + virtual void ApplyFlags( const SfxItemSet& rItemSet ); + virtual void Reset( const SfxItemSet& rItemSet ); + virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ); + +private: + std::auto_ptr< ItemConnectionArrayImpl > mxImpl; +}; + +// ============================================================================ + +// ============================================================================ +// *** Implementation of template functions *** +// ============================================================================ + +// ============================================================================ +// Base connection classes +// ============================================================================ + +template< typename ItemWrpT, typename ControlWrpT > +ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( + sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, ItemConnFlags nFlags ) : + ItemConnectionBase( nFlags ), + maItemWrp( nSlot ), + mxCtrlWrp( pNewCtrlWrp ) +{ +} + +template< typename ItemWrpT, typename ControlWrpT > +ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( + sal_uInt16 nSlot, ControlType& rControl, ItemConnFlags nFlags ) : + ItemConnectionBase( nFlags ), + maItemWrp( nSlot ), + mxCtrlWrp( new ControlWrpT( rControl ) ) +{ +} + +template< typename ItemWrpT, typename ControlWrpT > +ItemControlConnection< ItemWrpT, ControlWrpT >::~ItemControlConnection() +{ +} + +template< typename ItemWrpT, typename ControlWrpT > +void ItemControlConnection< ItemWrpT, ControlWrpT >::ApplyFlags( const SfxItemSet& rItemSet ) +{ + bool bKnown = ItemWrapperHelper::IsKnownItem( rItemSet, maItemWrp.GetSlotId() ); + mxCtrlWrp->ModifyControl( GetEnableState( bKnown ), GetShowState( bKnown ) ); +} + +template< typename ItemWrpT, typename ControlWrpT > +void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet& rItemSet ) +{ + const ItemType* pItem = maItemWrp.GetUniqueItem( rItemSet ); + mxCtrlWrp->SetControlDontKnow( pItem == 0 ); + if( pItem ) + mxCtrlWrp->SetControlValue( maItemWrp.GetItemValue( *pItem ) ); +} + +template< typename ItemWrpT, typename ControlWrpT > +bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( + SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) +{ + const ItemType* pOldItem = maItemWrp.GetUniqueItem( rOldSet ); + bool bChanged = false; + if( !mxCtrlWrp->IsControlDontKnow() ) + { + // first store the control value in a local variable + ControlValueType aCtrlValue( mxCtrlWrp->GetControlValue() ); + // convert to item value type -> possible to convert i.e. from 'T' to 'const T&' + ItemValueType aNewValue( aCtrlValue ); + // do not rely on existence of ItemValueType::operator!= + if( !pOldItem || !(maItemWrp.GetItemValue( *pOldItem ) == aNewValue) ) + { + sal_uInt16 nWhich = ItemWrapperHelper::GetWhichId( rDestSet, maItemWrp.GetSlotId() ); + std::auto_ptr< ItemType > xItem( + static_cast< ItemType* >( maItemWrp.GetDefaultItem( rDestSet ).Clone() ) ); + xItem->SetWhich( nWhich ); + maItemWrp.SetItemValue( *xItem, aNewValue ); + rDestSet.Put( *xItem ); + bChanged = true; + } + } + if( !bChanged ) + ItemWrapperHelper::RemoveDefaultItem( rDestSet, rOldSet, maItemWrp.GetSlotId() ); + return bChanged; +} + +// ============================================================================ +// Standard connections +// ============================================================================ + +template< typename ItemWrpT > +NumericConnection< ItemWrpT >::NumericConnection( + sal_uInt16 nSlot, NumericField& rField, ItemConnFlags nFlags ) : + ItemControlConnectionType( nSlot, rField, nFlags ) +{ +} + +// ============================================================================ + +template< typename ItemWrpT > +MetricConnection< ItemWrpT >::MetricConnection( + sal_uInt16 nSlot, MetricField& rField, FieldUnit eItemUnit, ItemConnFlags nFlags ) : + ItemControlConnectionType( nSlot, new MetricFieldWrapperType( rField, eItemUnit ), nFlags ) +{ +} + +// ============================================================================ + +template< typename ItemWrpT > +ListBoxConnection< ItemWrpT >::ListBoxConnection( + sal_uInt16 nSlot, ListBox& rListBox, const MapEntryType* pMap, ItemConnFlags nFlags ) : + ItemControlConnectionType( nSlot, new ListBoxWrapperType( rListBox, pMap ), nFlags ) +{ +} + +// ============================================================================ + +template< typename ItemWrpT > +ValueSetConnection< ItemWrpT >::ValueSetConnection( + sal_uInt16 nSlot, ValueSet& rValueSet, const MapEntryType* pMap, ItemConnFlags nFlags ) : + ItemControlConnectionType( nSlot, new ValueSetWrapperType( rValueSet, pMap ), nFlags ) +{ +} + +// ============================================================================ + +} // namespace sfx + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/itemwrapper.hxx b/include/sfx2/itemwrapper.hxx new file mode 100644 index 000000000000..7143fadf092f --- /dev/null +++ b/include/sfx2/itemwrapper.hxx @@ -0,0 +1,206 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX_ITEMWRAPPER_HXX +#define SFX_ITEMWRAPPER_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/itemset.hxx> + +// ============================================================================ + +namespace sfx { + +// ============================================================================ +// Helpers +// ============================================================================ + +class SFX2_DLLPUBLIC ItemWrapperHelper +{ +public: + /** Returns the WID of the passed SID in the item set. */ + static sal_uInt16 GetWhichId( const SfxItemSet& rItemSet, sal_uInt16 nSlot ); + + /** Returns true, if the passed item set supports the SID. */ + static bool IsKnownItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot ); + + /** Returns an item from an item set, if it is not in "don't know" state. + @return Pointer to item, or 0 if it has "don't know" state. */ + static const SfxPoolItem* GetUniqueItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot ); + + /** Returns the default item from the pool of the passed item set. */ + static const SfxPoolItem& GetDefaultItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot ); + + /** Removes an item from rDestSet, if it is default in rOldSet. */ + static void RemoveDefaultItem( SfxItemSet& rDestSet, const SfxItemSet& rOldSet, sal_uInt16 nSlot ); +}; + +// ============================================================================ +// Item wrappers +// ============================================================================ + +/** Base class wrapping a single item. + + Objects of this class store the SID of an item. Exchanging data with the + item is done with the virtual functions GetItemValue() and SetItemValue(). + Derived classes implement these functions according to the item type they + work on. + + The current tree of base classes/templates and standard item wrappers: + + SingleItemWrapper< ItemT, ValueT > + | + +- ValueItemWrapper< ItemT, ValueT > [1] + | | + | +- BoolItemWrapper [1] + | +- Int16ItemWrapper [1] + | +- UInt16ItemWrapper [1] + | +- Int32ItemWrapper [1] + | +- UInt32ItemWrapper [1] + | +- StringItemWrapper [1] + | + +- IdentItemWrapper< ItemT > [1] + + Notes: + [1] Standard wrappers ready to use. + + See documentation of class ItemConnectionBase for more details. + */ +template< typename ItemT, typename ValueT > +class SingleItemWrapper +{ +public: + typedef ItemT ItemType; + typedef ValueT ItemValueType; + typedef SingleItemWrapper< ItemT, ValueT > SingleItemWrapperType; + + inline explicit SingleItemWrapper( sal_uInt16 nSlot ) : mnSlot( nSlot ) {} + + virtual ~SingleItemWrapper() {} + + /** Returns the SID this wrapper works on. */ + inline sal_uInt16 GetSlotId() const { return mnSlot; } + + /** Returns the item from an item set, if it is not in "don't know" state. + @descr Similar to ItemWrapperHelper::GetUniqueItem(), but works always + with the own SID and returns the correct item type. + @return Pointer to item, or 0 if it has "don't know" state. */ + const ItemT* GetUniqueItem( const SfxItemSet& rItemSet ) const; + /** Returns the default item from the pool of the passed item set. + @descr Similar to ItemWrapperHelper::GetDefaultItem(), but works + always with the own SID and returns the correct item type. */ + const ItemT& GetDefaultItem( const SfxItemSet& rItemSet ) const; + + /** Derived classes return the value of the passed item. */ + virtual ValueT GetItemValue( const ItemT& rItem ) const = 0; + /** Derived classes set the value at the passed item. */ + virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const = 0; + +private: + sal_uInt16 mnSlot; /// The SID of this item wrapper. +}; + +// ============================================================================ + +/** An item wrapper usable for most types of items. + + The item type must support the following functions: + - ValueT ItemT::GetValue() const + - void ItemT::SetValue( ValueT ) + + The template parameter InternalValueT can be used to specify the internal + value type of the item, if it differs from ValueT. This parameter has to be + used to prevent compiler warnings. + */ +template< typename ItemT, typename ValueT, typename InternalValueT = ValueT > +class ValueItemWrapper : public SingleItemWrapper< ItemT, ValueT > +{ +public: + inline explicit ValueItemWrapper( sal_uInt16 nSlot ) : + SingleItemWrapper< ItemT, ValueT >( nSlot ) {} + + virtual ~ValueItemWrapper() {} + + virtual ValueT GetItemValue( const ItemT& rItem ) const + { return static_cast< ValueT >( rItem.GetValue() ); } + virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const + { rItem.SetValue( static_cast< InternalValueT >( aValue ) ); } +}; + +// ---------------------------------------------------------------------------- + +typedef ValueItemWrapper< SfxBoolItem, sal_Bool > BoolItemWrapper; +typedef ValueItemWrapper< SfxInt16Item, sal_Int16 > Int16ItemWrapper; +typedef ValueItemWrapper< SfxUInt16Item, sal_uInt16 > UInt16ItemWrapper; +typedef ValueItemWrapper< SfxInt32Item, sal_Int32 > Int32ItemWrapper; +typedef ValueItemWrapper< SfxUInt32Item, sal_uInt32 > UInt32ItemWrapper; +typedef ValueItemWrapper< SfxStringItem, const String& > StringItemWrapper; + +// ============================================================================ + +/** An item wrapper that uses the item itself as value. */ +template< typename ItemT > +class IdentItemWrapper : public SingleItemWrapper< ItemT, const ItemT& > +{ +public: + inline explicit IdentItemWrapper( sal_uInt16 nSlot ) : + SingleItemWrapper< ItemT, const ItemT& >( nSlot ) {} + + virtual ~IdentItemWrapper() {} + + virtual const ItemT& GetItemValue( const ItemT& rItem ) const + { return rItem; } + virtual void SetItemValue( ItemT& rItem, const ItemT& rValue ) const + { rItem = rValue; } +}; + +// ============================================================================ + + +// ============================================================================ +// *** Implementation of template functions *** +// ============================================================================ + +// ============================================================================ +// Item wrappers +// ============================================================================ + +template< typename ItemT, typename ValueT > +const ItemT* SingleItemWrapper< ItemT, ValueT >::GetUniqueItem( const SfxItemSet& rItemSet ) const +{ + return static_cast< const ItemT* >( ItemWrapperHelper::GetUniqueItem( rItemSet, mnSlot ) ); +} + +template< typename ItemT, typename ValueT > +const ItemT& SingleItemWrapper< ItemT, ValueT >::GetDefaultItem( const SfxItemSet& rItemSet ) const +{ + return static_cast< const ItemT& >( ItemWrapperHelper::GetDefaultItem( rItemSet, mnSlot ) ); +} + +// ============================================================================ + +} // namespace sfx + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx new file mode 100644 index 000000000000..24a5f6315edb --- /dev/null +++ b/include/sfx2/linkmgr.hxx @@ -0,0 +1,195 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _LINKMGR_HXX +#define _LINKMGR_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <sfx2/linksrc.hxx> +#include <tools/string.hxx> + +#include <vector> +#include <set> + +class SfxObjectShell; +class Graphic; +class Size; + +namespace com { namespace sun { namespace star { + namespace lang { + class XComponent; + } +}}} + +namespace sfx2 +{ + // For the link to receive information about the status of graphics that + // will be loaded the FileObject sends a SvData, which contains the + // FormatID "RegisterStatusInfoId" and a string as the data container. + // This contains the following enum. + +class SvBaseLink; +class SvBaseLinkRef; + +typedef std::vector<SvBaseLinkRef*> SvBaseLinks; + +typedef std::set<SvLinkSource*> SvLinkSources; + +class SFX2_DLLPUBLIC LinkManager +{ + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > + CompVector; + CompVector maCachedComps; + + SvBaseLinks aLinkTbl; + SvLinkSources aServerTbl; + + SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell +protected: + sal_Bool InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, sal_uInt16 nUpdateType, + const String* pName = 0 ); +public: + + enum LinkState + { + STATE_LOAD_OK, + STATE_LOAD_ERROR, + STATE_LOAD_ABORT + }; + + LinkManager( SfxObjectShell * pCacheCont ); + ~LinkManager(); + + /** + * Insert a component loaded during link update, which needs to be closed + * when the update is complete. + * + * @param xComp component loaded during link update. + */ + void InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp); + + void CloseCachedComps(); + + SfxObjectShell* GetPersist() const { return pPersist; } + void SetPersist( SfxObjectShell * p ) { pPersist = p; } + + void Remove( SvBaseLink *pLink ); + void Remove( sal_uInt16 nPos, sal_uInt16 nCnt = 1 ); + sal_Bool Insert( SvBaseLink* pLink ); + + // the links connect to a SvLinkSource and adds to the list + sal_Bool InsertDDELink( SvBaseLink*, + const String& rServer, + const String& rTopic, + const String& rItem ); + + // if everything is already set at the link! + sal_Bool InsertDDELink( SvBaseLink* ); + + // Connect the links to a pseudo-object and add to the list + bool InsertFileLink( sfx2::SvBaseLink&, + sal_uInt16 nFileType, + const String& rFileNm, + const String* pFilterNm = 0, + const String* pRange = 0 ); + + bool InsertFileLink( + sfx2::SvBaseLink& rLink, sal_uInt16 nFileType, const OUString& rFileNm, + const OUString* pFilterNm = NULL, const OUString* pRange = NULL); + + void ReconnectDdeLink(SfxObjectShell& rServer); + + /** + * Reconnect the server document shell to a DDE link object. + * + * @param rPath path to the server document + * @param rServer server document shell instance + * @param rLink link object of the client document + */ + void LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const; + + // Obtain the string for the dialog + bool GetDisplayNames( const SvBaseLink *, + String* pType, + String* pFile = 0, + String* pLink = 0, + String* pFilter = 0 ) const; + + bool GetDisplayNames( + const SvBaseLink* pLink, OUString* pType, OUString* pFile = NULL, + OUString* pLinkStr = NULL, OUString* pFilter = NULL) const; + + SvLinkSourceRef CreateObj( SvBaseLink* ); + + void UpdateAllLinks( bool bAskUpdate = true, + bool bCallErrHdl = true, + bool bUpdateGrfLinks = false, + Window* pParentWin = 0 ); + + // Call for list of links (eg for link-dialog) + const SvBaseLinks& GetLinks() const { return aLinkTbl; } + + // ----------------- Server-side management -------------------- + + // Call with list of links to server + const SvLinkSources& GetServers() const { return aServerTbl; } + // Link register/delete + sal_Bool InsertServer( SvLinkSource* rObj ); + void RemoveServer( SvLinkSource* rObj ); + + // A transfer is aborted, so cancel all download media + // (for the time beeing this is only of interest for the FileLinks!) + void CancelTransfers(); + + // To send status information from the FileObject to the Baselink, + // for this there exist a separate ClipBoardId. The SvData-object has + // got the appropriate information as a string. + // Is now required for FileObject in conjunction with JavaScript + // this needs information about Load/Abort/Error + static sal_uIntPtr RegisterStatusInfoId(); + + // if the mimetype says graphic/bitmap/gdimetafile then get the + // graphic from the Any. Return says no errors + static sal_Bool GetGraphicFromAny( const String& rMimeType, + const ::com::sun::star::uno::Any & rValue, + Graphic& rGrf ); + +private: + LinkManager( const LinkManager& ); + LinkManager& operator=( const LinkManager& ); +}; + +// Separator in the link name for the DDE-/File-/Graphics- links +// (only those who need to construct a SvLinkName) +const sal_Unicode cTokenSeperator = 0xFFFF; + +// create a string for the SvLinkName. For: +// - DDE the first 3 Strings, (Server, Topic, Item) +// - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter) +SFX2_DLLPUBLIC void MakeLnkName( String& rName, + const String* pType, // Can also be null!! + const String& rFile, + const String& rLink, + const String* pFilter = 0 ); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/linksrc.hxx b/include/sfx2/linksrc.hxx new file mode 100644 index 000000000000..4ff77b6afa54 --- /dev/null +++ b/include/sfx2/linksrc.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _LINKSRC_HXX +#define _LINKSRC_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <tools/link.hxx> +#include <tools/ref.hxx> +#include <tools/rtti.hxx> +#include <com/sun/star/io/XInputStream.hpp> + +#include <sal/config.h> + +namespace com { namespace sun { namespace star { namespace uno +{ + class Any; +}}}} +class Window; +class String; + +#ifndef ADVISEMODE_NODATA +// Must be the same value as Ole2 ADVF_* +#define ADVISEMODE_NODATA 0x01 +#define ADVISEMODE_PRIMEFIRST 0x02 +#define ADVISEMODE_ONLYONCE 0x04 +#define ADVISEMODE_DATAONSTOP 0x40 +#endif + +namespace sfx2 +{ + +class SvBaseLink; +struct SvLinkSource_Impl; + +class SFX2_DLLPUBLIC SvLinkSource : public SvRefBase +{ +private: + SvLinkSource_Impl* pImpl; // compatible area + +public: + TYPEINFO(); + + SvLinkSource(); + virtual ~SvLinkSource(); + + sal_Bool HasDataLinks( const SvBaseLink* = 0 ) const; + + void Closed(); + + sal_uIntPtr GetUpdateTimeout() const; + void SetUpdateTimeout( sal_uIntPtr nTime ); + // notify the sink, the mime type is not + // a selection criterion + void DataChanged( const String & rMimeType, + const ::com::sun::star::uno::Any & rVal ); + void SendDataChanged(); + void NotifyDataChanged(); + + virtual sal_Bool Connect( SvBaseLink* ); + virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData /*out param*/, + const String & rMimeType, + sal_Bool bSynchron = sal_False ); + + // sal_True => waitinmg for data + virtual sal_Bool IsPending() const; + // sal_True => data complete loaded + virtual sal_Bool IsDataComplete() const; + + // Link impl: DECL_LINK( MyEndEditHdl, sfx2::FileDialogHelper* ); <= param is the dialog + virtual void Edit( Window *, SvBaseLink *, const Link& rEndEditHdl ); + + + void AddDataAdvise( SvBaseLink *, const String & rMimeType, + sal_uInt16 nAdviceMode ); + void RemoveAllDataAdvise( SvBaseLink * ); + + void AddConnectAdvise( SvBaseLink * ); + void RemoveConnectAdvise( SvBaseLink * ); + + struct StreamToLoadFrom{ + StreamToLoadFrom( + const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly ) + :m_xInputStreamToLoadFrom(xInputStream), + m_bIsReadOnly(bIsReadOnly) + { + } + + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> + m_xInputStreamToLoadFrom; + sal_Bool m_bIsReadOnly; + }; + + StreamToLoadFrom getStreamToLoadFrom(); + void setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly ); + void clearStreamToLoadFrom(); +}; + +SV_DECL_IMPL_REF(SvLinkSource); + +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx new file mode 100644 index 000000000000..ebd76db400d0 --- /dev/null +++ b/include/sfx2/lnkbase.hxx @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _LNKBASE_HXX +#define _LNKBASE_HXX + +#include <com/sun/star/io/XInputStream.hpp> +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <sot/exchange.hxx> +#include <tools/ref.hxx> +#include <sfx2/linksrc.hxx> + +namespace com { namespace sun { namespace star { namespace uno +{ + class Any; +}}}} + +namespace sfx2 +{ + +struct ImplBaseLinkData; +class LinkManager; +class SvLinkSource; +class FileDialogHelper; + +#ifndef OBJECT_DDE_EXTERN +#define OBJECT_INTERN 0x00 +//#define OBJECT_SO_EXTERN 0x01 +#define OBJECT_DDE_EXTERN 0x02 +#endif + +#define OBJECT_CLIENT_SO 0x80 // a Link +#define OBJECT_CLIENT_DDE 0x81 +//#define OBJECT_CLIENT_OLE 0x82 // a Ole-Link +//#define OBJECT_CLIENT_OLE_CACHE 0x83 // a Ole-Link with SvEmbeddedObject +#define OBJECT_CLIENT_FILE 0x90 +#define OBJECT_CLIENT_GRF 0x91 +#define OBJECT_CLIENT_OLE 0x92 // embedded link + +enum sfxlink { + // Ole2 compatibel and persistent + LINKUPDATE_ALWAYS = 1, + LINKUPDATE_ONCALL = 3, + + LINKUPDATE_END // dummy! +}; + +struct BaseLink_Impl; + +class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase +{ +private: + friend class LinkManager; + friend class SvLinkSource; + + SvLinkSourceRef xObj; + String aLinkName; + BaseLink_Impl* pImpl; + sal_uInt16 nObjType; + sal_Bool bVisible : 1; + sal_Bool bSynchron : 1; + sal_Bool bUseCache : 1; // for Graphics Links! + sal_Bool bWasLastEditOK : 1; + + DECL_LINK( EndEditHdl, String* ); + + bool ExecuteEdit( const String& _rNewName ); + +protected: + void SetObjType( sal_uInt16 ); + + // Set LinkSourceName without action + void SetName( const String & rLn ); + + ImplBaseLinkData* pImplData; + + sal_Bool m_bIsReadOnly; + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> + m_xInputStreamToLoadFrom; + + SvBaseLink(); + SvBaseLink( sal_uInt16 nLinkType, sal_uIntPtr nContentType = FORMAT_STRING ); + virtual ~SvBaseLink(); + + void _GetRealObject( sal_Bool bConnect = sal_True ); + + SvLinkSource* GetRealObject() + { + if( !xObj.Is() ) + _GetRealObject(); + return xObj; + } + +public: + TYPEINFO(); + + virtual void Closed(); + SvBaseLink( const String& rNm, sal_uInt16 nObjectType, + SvLinkSource* ); + + sal_uInt16 GetObjType() const { return nObjType; } + + void SetObj( SvLinkSource * pObj ); + SvLinkSource* GetObj() const { return xObj; } + + void SetLinkSourceName( const String & rName ); + String GetLinkSourceName() const; + + enum UpdateResult { + SUCCESS = 0, + ERROR_GENERAL = 1 + }; + + virtual UpdateResult DataChanged( + const String & rMimeType, const ::com::sun::star::uno::Any & rValue ); + + void SetUpdateMode( sal_uInt16 ); + sal_uInt16 GetUpdateMode() const; + sal_uIntPtr GetContentType() const; + sal_Bool SetContentType( sal_uIntPtr nType ); + + LinkManager* GetLinkManager(); + const LinkManager* GetLinkManager() const; + void SetLinkManager( LinkManager* _pMgr ); + + sal_Bool Update(); + void Disconnect(); + + // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this + virtual void Edit( Window*, const Link& rEndEditHdl ); + + // should the link appear in the dialog? (to the left in the link in the...) + sal_Bool IsVisible() const { return bVisible; } + void SetVisible( sal_Bool bFlag ) { bVisible = bFlag; } + // should the Link be loaded synchronous or asynchronous? + sal_Bool IsSynchron() const { return bSynchron; } + void SetSynchron( sal_Bool bFlag ) { bSynchron = bFlag; } + + sal_Bool IsUseCache() const { return bUseCache; } + void SetUseCache( sal_Bool bFlag ) { bUseCache = bFlag; } + + void setStreamToLoadFrom( + const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, + sal_Bool bIsReadOnly ) + { m_xInputStreamToLoadFrom = xInputStream; + m_bIsReadOnly = bIsReadOnly; } + // #i88291# + void clearStreamToLoadFrom(); + + inline sal_Bool WasLastEditOK() const { return bWasLastEditOK; } + FileDialogHelper & GetInsertFileDialog(const String& rFactory) const; +}; + +SV_DECL_IMPL_REF(SvBaseLink); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/macropg.hxx b/include/sfx2/macropg.hxx new file mode 100644 index 000000000000..1a6c87198f41 --- /dev/null +++ b/include/sfx2/macropg.hxx @@ -0,0 +1,137 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _MACROPG_HXX +#define _MACROPG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <sfx2/basedlgs.hxx> +#include <sfx2/tabdlg.hxx> +#include <svl/macitem.hxx> +#include <vcl/lstbox.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +class _SfxMacroTabPage; +class SvTabListBox; +class Edit; +class String; +class SfxObjectShell; + +class SfxConfigFunctionListBox_Impl; + +class _HeaderTabListBox; +class _SfxMacroTabPage_Impl; + +class SFX2_DLLPUBLIC _SfxMacroTabPage : public SfxTabPage +{ + SvxMacroTableDtor aTbl; + + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox * ); + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox * ); + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox * ); + + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, DoubleClickHdl_Impl, Control* ); + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton * ); + + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton * ); + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit* ); + DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer* ); + +protected: + _SfxMacroTabPage_Impl* mpImpl; + + _SfxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet ); + + void InitAndSetHandler(); + void FillEvents(); + void FillMacroList(); + void EnableButtons( const String& rLanguage ); + +public: + + virtual ~_SfxMacroTabPage(); + + void AddEvent( const String & rEventName, sal_uInt16 nEventId ); + + const SvxMacroTableDtor& GetMacroTbl() const; + void SetMacroTbl( const SvxMacroTableDtor& rTbl ); + void ClearMacroTbl(); + + virtual void ScriptChanged( const String& rLanguage ); + + // zum setzen / abfragen der Links + void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn ); + FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const; + + // --------- Erben aus der Basis ------------- + virtual sal_Bool FillItemSet( SfxItemSet& rSet ); + virtual void Reset( const SfxItemSet& rSet ); + + void SetReadOnly( sal_Bool bSet ); + sal_Bool IsReadOnly() const; + void SelectEvent( const String& rEventName, sal_uInt16 nEventId ); +}; + +inline const SvxMacroTableDtor& _SfxMacroTabPage::GetMacroTbl() const +{ + return aTbl; +} + +inline void _SfxMacroTabPage::SetMacroTbl( const SvxMacroTableDtor& rTbl ) +{ + aTbl = rTbl; +} + +inline void _SfxMacroTabPage::ClearMacroTbl() +{ + aTbl.DelDtor(); +} + +class SFX2_DLLPUBLIC SfxMacroTabPage : public _SfxMacroTabPage +{ +public: + SfxMacroTabPage( + Window* pParent, + const ResId& rId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, + const SfxItemSet& rSet + ); + + // --------- Erben aus der Basis ------------- + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); +}; + +class SFX2_DLLPUBLIC SfxMacroAssignDlg : public SfxNoLayoutSingleTabDialog +{ +public: + SfxMacroAssignDlg( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, + SfxItemSet& rSet ); + SfxMacroAssignDlg( + Window* pParent, + const SfxObjectShell* _pShell, + SfxItemSet& rSet ); + virtual ~SfxMacroAssignDlg(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mailmodelapi.hxx b/include/sfx2/mailmodelapi.hxx new file mode 100644 index 000000000000..042a364e2b5a --- /dev/null +++ b/include/sfx2/mailmodelapi.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX_MAILMODEL_HXX +#define INCLUDED_SFX_MAILMODEL_HXX + +#include <vector> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "tools/link.hxx" +#include <tools/string.hxx> +#include "sfx2/dllapi.h" + +// class AddressList_Impl ------------------------------------------------ +typedef String* AddressItemPtr_Impl; +typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl; + +// class SfxMailModel_Impl ----------------------------------------------- + +class SFX2_DLLPUBLIC SfxMailModel +{ +public: + enum MailPriority + { + PRIO_HIGHEST, + PRIO_HIGH, + PRIO_NORMAL, + PRIO_LOW, + PRIO_LOWEST + }; + + enum AddressRole + { + ROLE_TO, + ROLE_CC, + ROLE_BCC + }; + + enum MailDocType + { + TYPE_SELF, + TYPE_ASPDF + }; + +protected: + enum SaveResult + { + SAVE_SUCCESSFULL, + SAVE_CANCELLED, + SAVE_ERROR + }; + ::std::vector< OUString > maAttachedDocuments; + SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel, + const OUString& rType, + OUString& rFileNamePath ); + +private: + AddressList_Impl* mpToList; + AddressList_Impl* mpCcList; + AddressList_Impl* mpBccList; + String maFromAddress; + String maSubject; + MailPriority mePriority; + + sal_Bool mbLoadDone; + + void ClearList( AddressList_Impl* pList ); + SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel, + const OUString& rFilterName, + const OUString& rType, + bool bModified, + sal_Int32& rNumArgs, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + + DECL_LINK( DoneHdl, void* ); + +public: + enum SendMailResult + { + SEND_MAIL_OK, + SEND_MAIL_CANCELLED, + SEND_MAIL_ERROR + }; + + SfxMailModel(); + ~SfxMailModel(); + + void AddAddress( const String& rAddress, AddressRole eRole ); + void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; } + void SetSubject( const String& rSubject ) { maSubject = rSubject; } + void SetPriority( MailPriority ePrio ) { mePriority = ePrio; } + + /** attaches a document to the current attachment list, can be called more than once. + * at the moment there will be a dialog for export executed for every model which is going to be attached. + * + * \param sDocumentType + The doc type to export. PDF will be at the moment only a direct export (no dialog). + * \param xModel + The current model to attach + * \param sAttachmentTitle + The title which will be used as attachment title + * \return @see error code + */ + SendMailResult AttachDocument( const OUString& sDocumentType, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel, + const OUString& sAttachmentTitle ); + + SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + const OUString& rType ); + SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); + + sal_Bool IsEmpty() const; +}; + +sal_Bool CreateFromAddress_Impl( String& rFrom ); + +#endif // INCLUDED_SFX_MAILMODEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx new file mode 100644 index 000000000000..553c5bd745f3 --- /dev/null +++ b/include/sfx2/mgetempl.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_MGETEMPL_HXX +#define _SFX_MGETEMPL_HXX + +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/vclmedit.hxx> +#include <sfx2/tabdlg.hxx> + +/* expected: + SID_TEMPLATE_NAME : In: StringItem, Name of Template + SID_TEMPLATE_FAMILY : In: Family of Template +*/ + +class SfxStyleFamilies; +class SfxStyleFamilyItem; +class SfxStyleSheetBase; + +class SfxManageStyleSheetPage : public SfxTabPage +{ + VclMultiLineEdit* m_pNameRo; + Edit* m_pNameRw; + + CheckBox* m_pAutoCB; + + FixedText* m_pFollowFt; + ListBox* m_pFollowLb; + + FixedText* m_pBaseFt; + ListBox* m_pBaseLb; + + FixedText* m_pFilterFt; + ListBox* m_pFilterLb; + + FixedText *m_pDescFt; + + SfxStyleSheetBase *pStyle; + SfxStyleFamilies *pFamilies; + const SfxStyleFamilyItem *pItem; + String aBuf; + sal_Bool bModified; + + // initial data for the style + String aName; + String aFollow; + String aParent; + sal_uInt16 nFlags; + +private: +friend class SfxStyleDialog; + + DECL_LINK( GetFocusHdl, Edit * ); + DECL_LINK( LoseFocusHdl, Edit * ); + + void UpdateName_Impl(ListBox *, const String &rNew); + void SetDescriptionText_Impl(); + + SfxManageStyleSheetPage(Window *pParent, const SfxItemSet &rAttrSet ); + ~SfxManageStyleSheetPage(); + + static SfxTabPage* Create(Window *pParent, const SfxItemSet &rAttrSet ); + +protected: + virtual sal_Bool FillItemSet(SfxItemSet &); + virtual void Reset(const SfxItemSet &); + + using TabPage::ActivatePage; + virtual void ActivatePage(const SfxItemSet &); + using TabPage::DeactivatePage; + virtual int DeactivatePage(SfxItemSet * = 0); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mieclip.hxx b/include/sfx2/mieclip.hxx new file mode 100644 index 000000000000..6b616607b38f --- /dev/null +++ b/include/sfx2/mieclip.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _MIECLIP_HXX +#define _MIECLIP_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/solar.h> +#include <tools/string.hxx> + +class SvStream; +class SotDataObject; +class SvData; + +class SFX2_DLLPUBLIC MSE40HTMLClipFormatObj +{ + SvStream* pStrm; + String sBaseURL; + +public: + MSE40HTMLClipFormatObj() : pStrm(0) {} + ~MSE40HTMLClipFormatObj(); + +//JP 31.01.2001: old interfaces + SAL_DLLPRIVATE sal_Bool GetData( SotDataObject& ); + SAL_DLLPRIVATE sal_Bool GetData( SvData& ); +//JP 31.01.2001: the new one + SvStream* IsValid( SvStream& ); + + const SvStream* GetStream() const { return pStrm; } + SvStream* GetStream() { return pStrm; } + const String& GetBaseURL() const { return sBaseURL; } +}; + + +#endif //_MIECLIP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/minfitem.hxx b/include/sfx2/minfitem.hxx new file mode 100644 index 000000000000..fb06ffc1e979 --- /dev/null +++ b/include/sfx2/minfitem.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_MINFITEM_HXX +#define _SFX_MINFITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <tools/string.hxx> +#include <svl/poolitem.hxx> +class BasicManager; + +class SFX2_DLLPUBLIC SfxMacroInfoItem: public SfxPoolItem +{ + const BasicManager* pBasicManager; + String aLibName; + String aModuleName; + String aMethodName; + String aCommentText; + +public: + TYPEINFO(); + SfxMacroInfoItem( sal_uInt16 nWhich, + const BasicManager* pMgr, + const String &rLibName, + const String &rModuleName, + const String &rMethodName, + const String &rComment); + + SfxMacroInfoItem( const SfxMacroInfoItem& ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual int operator==( const SfxPoolItem& ) const; + String GetComment() const + { return aCommentText; } + void SetComment( const String& r ) + { aCommentText = r; } + String GetMethod() const + { return aMethodName; } + void SetMethod( const String& r ) + { aMethodName = r; } + String GetModule() const + { return aModuleName; } + void SetModule( const String& r ) + { aModuleName = r; } + String GetLib() const + { return aLibName; } + void SetLib( const String& r ) + { aLibName = r; } + const BasicManager* GetBasicManager() const + { return pBasicManager; } + String GetQualifiedName() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mnuitem.hxx b/include/sfx2/mnuitem.hxx new file mode 100644 index 000000000000..e65220be2a13 --- /dev/null +++ b/include/sfx2/mnuitem.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXMNUITEM_HXX +#define _SFXMNUITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +class SfxVirtualMenu; +class SfxBindings; +class SfxModule; +class Menu; +class PopupMenu; +class SfxUnoMenuControl; +class SfxUnoControllerItem; +struct SfxMenuCtrlFactory; +#include <tools/string.hxx> +#include <sfx2/ctrlitem.hxx> + +class SFX2_DLLPUBLIC SfxMenuControl: public SfxControllerItem +{ + String aTitle; + SfxVirtualMenu* pOwnMenu; + SfxVirtualMenu* pSubMenu; + sal_Bool b_ShowStrings; + +public: + SfxMenuControl(); + SfxMenuControl( sal_Bool bShowStrings ); + SfxMenuControl( sal_uInt16, SfxBindings&); + + static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); + static void RegisterControl( sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL ); + + ~SfxMenuControl(); + + using SfxControllerItem::Bind; + void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, + const String& rTitle, SfxBindings& rBindings ); + void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, + SfxVirtualMenu& rSubMenu, + const String& rTitle, SfxBindings& rBindings ); + + String GetTitle() const; + SfxVirtualMenu* GetPopupMenu() const; + virtual PopupMenu* GetPopup() const; + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + + static SfxMenuControl* CreateControl( sal_uInt16 nId, Menu &, SfxBindings & ); + static SfxUnoMenuControl* CreateControl( const String&, sal_uInt16, Menu&, const String& sItemText, SfxBindings&, SfxVirtualMenu* ); + static void RegisterMenuControl(SfxModule*, SfxMenuCtrlFactory*); + +}; + +class SfxUnoMenuControl : public SfxMenuControl +{ + SfxUnoControllerItem* pUnoCtrl; +public: + SfxUnoMenuControl( const String&, sal_uInt16 nId, Menu&, + const String&, + SfxBindings&, SfxVirtualMenu* ); + ~SfxUnoMenuControl(); +}; + +typedef SfxMenuControl* (*SfxMenuControlCtor)( sal_uInt16 nId, Menu &, SfxBindings & ); + +struct SfxMenuCtrlFactory +{ + SfxMenuControlCtor pCtor; + TypeId nTypeId; + sal_uInt16 nSlotId; + + SfxMenuCtrlFactory( SfxMenuControlCtor pTheCtor, + TypeId nTheTypeId, sal_uInt16 nTheSlotId ): + pCtor(pTheCtor), + nTypeId(nTheTypeId), + nSlotId(nTheSlotId) + {} +}; + +inline String SfxMenuControl::GetTitle() const +{ + return aTitle; +} + +inline SfxVirtualMenu* SfxMenuControl::GetPopupMenu() const +{ + return pSubMenu; +} + +#define SFX_DECL_MENU_CONTROL() \ + static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); \ + static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) + +#define SFX_IMPL_MENU_CONTROL(Class, nItemClass) \ + SfxMenuControl* Class::CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) \ + { return new Class(nId, rMenu, rBindings); } \ + void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ + { SfxMenuControl::RegisterMenuControl( pMod, new SfxMenuCtrlFactory( \ + Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mnumgr.hxx b/include/sfx2/mnumgr.hxx new file mode 100644 index 000000000000..4624026a059e --- /dev/null +++ b/include/sfx2/mnumgr.hxx @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXMNUMGR_HXX +#define _SFXMNUMGR_HXX + +#include <vcl/menu.hxx> +#include <tools/wintypes.hxx> +#include <tools/link.hxx> +#include <com/sun/star/embed/VerbDescriptor.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <tools/stream.hxx> +#include <tools/resid.hxx> +#include <sfx2/sfx.hrc> + +class SfxVirtualMenu; +class SfxPoolItem; +class SfxBindings; +class ResMgr; +class Menu; +class PopupMenu; +class SfxBindings; +class ResId; +class Point; +class SfxObjectShell; +class SfxModule; +class SfxViewFrame; + +class SfxMenuManager +{ +friend class SfxPopupMenuManager; + + SfxVirtualMenu* pMenu; // the actual Menu + SfxVirtualMenu* pOldMenu; // only while reconfiguring + sal_Bool bMenuBar; // Popup or MenuBar + SfxBindings* pBindings; + ResMgr* pResMgr; + sal_uInt32 nType; + sal_Bool bAddClipboardFuncs : 1; + + void Construct( SfxVirtualMenu& rMenu ); + +protected: + SfxMenuManager( Menu*, SfxBindings& ); + ~SfxMenuManager(); + sal_uInt16 GetItemPos( sal_uInt16 nId ); + sal_uInt32 GetType() { return nType; } +public: + + DECL_LINK( Select, Menu* ); + + SfxVirtualMenu* GetMenu() const + { return pMenu; } + + SfxBindings& GetBindings() { return *pBindings; } + const SfxBindings& GetBindings() const { return *pBindings; } + void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; } + ResMgr* GetResMgr() const { return pResMgr; } + void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu ); +}; + +//-------------------------------------------------------------------- + +class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager +{ +private: + Menu* pSVMenu; + + // when #i107205 gets fixed this one should be superfluous. + // But right now we want to avoid the memory leak that would otherwise occur, + // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup + static PopupMenu * pStaticThesSubMenu; + + // only declared, but not defined: don't allow copying + SfxPopupMenuManager( const SfxPopupMenuManager& ); + SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ); + +public: + SfxPopupMenuManager( PopupMenu*, SfxBindings& ); + ~SfxPopupMenuManager(); + static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, Window* pWindow ); + // @deprecated!! + // Don't use this method any longer. The whole class will be removed in the future. + // Changing code which relies on Popup would need much more effort. + static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow ); + + sal_uInt16 Execute( const Point& rPos, Window *pWindow ); + + void RemoveDisabledEntries(); + Menu* GetSVMenu(); +}; + +#endif // #ifndef _SFXMNUMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx new file mode 100644 index 000000000000..3b285faf6593 --- /dev/null +++ b/include/sfx2/module.hxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXMODULE_HXX +#define _SFXMODULE_HXX // internal +#define _SFXMOD_HXX // external + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <sfx2/shell.hxx> +#include <svtools/imgdef.hxx> +#include <sal/types.h> +#include <tools/fldunit.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <vector> + +class ImageList; + +class SfxBindings; +class SfxObjectFactory; +class ModalDialog; +class SfxObjectFactory; +class SfxModule; +typedef ::std::vector<SfxModule*> SfxModuleArr_Impl; +class SfxModule_Impl; +class SfxSlotPool; +struct SfxChildWinContextFactory; +struct SfxChildWinFactory; +struct SfxMenuCtrlFactory; +struct SfxStbCtrlFactory; +struct SfxTbxCtrlFactory; +class SfxTbxCtrlFactArr_Impl; +class SfxChildWinFactArr_Impl; +class SfxMenuCtrlFactArr_Impl; +class SfxStbCtrlFactArr_Impl; +class SfxTabPage; +class Window; + +namespace com { namespace sun { namespace star { namespace frame { + class XFrame; +} } } } +//==================================================================== + +class SFX2_DLLPUBLIC SfxModule : public SfxShell +{ +private: + ResMgr* pResMgr; + sal_Bool bDummy : 1; + SfxModule_Impl* pImpl; + + SAL_DLLPRIVATE void Construct_Impl(); + +public: + TYPEINFO(); + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE) + + SfxModule( ResMgr* pMgrP, sal_Bool bDummy, + SfxObjectFactory* pFactoryP, ... ); + ~SfxModule(); + + ResMgr* GetResMgr() const { return SfxShell::GetResMgr(); } + virtual ResMgr* GetResMgr(); + SfxSlotPool* GetSlotPool() const; + + void RegisterToolBoxControl(SfxTbxCtrlFactory*); + void RegisterChildWindow(SfxChildWinFactory*); + void RegisterStatusBarControl(SfxStbCtrlFactory*); + void RegisterMenuControl(SfxMenuCtrlFactory*); + + virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, + Window* pParent, + const SfxItemSet& rSet ); + virtual void Invalidate(sal_uInt16 nId = 0); + + /*virtual*/ bool IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const; + + static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL ); + static FieldUnit GetCurrentFieldUnit(); + /** retrieves the field unit of the module belonging to the document displayed in the given frame + + Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to + the document in this frame, then this module's field unit. + + Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned. + */ + static FieldUnit GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame ); + FieldUnit GetFieldUnit() const; + + SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl(); + SAL_DLLPRIVATE static void DestroyModules_Impl(); + SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const; + SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx new file mode 100644 index 000000000000..eca6618cc118 --- /dev/null +++ b/include/sfx2/msg.hxx @@ -0,0 +1,333 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXMSG_HXX +#define _SFXMSG_HXX + +#include <tools/rtti.hxx> +#include <sfx2/shell.hxx> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <sfx2/dllapi.h> + +//-------------------------------------------------------------------- + +#define SFX_SLOT_CACHABLE 0x0001L // exclusiv to VOLATILE, default +#define SFX_SLOT_VOLATILE 0x0002L // per Timer every 2s get new, + // exclusiv to CACHABLE +#define SFX_SLOT_TOGGLE 0x0004L // inverted for Execute old value +#define SFX_SLOT_AUTOUPDATE 0x0008L // invalidated the status automatically + // after execute + +#define SFX_SLOT_SYNCHRON 0x0010L // exclusiv to ASYNCHRON, default +#define SFX_SLOT_ASYNCHRON 0x0020L // via Post-Message, exclusiv + // to SYNCHRON + +#define SFX_SLOT_HASCOREID 0x0040L // Slot-ID/Which-ID execute mapping +#define SFX_SLOT_HASDIALOG 0x0080L // Coordinates for dialogue after recofig + +#define SFX_SLOT_NORECORD 0x0100L // no recording +#define SFX_SLOT_RECORDPERITEM 0x0200L // each item, one statement +#define SFX_SLOT_RECORDPERSET 0x0400L // The whole Set is a Statement, default +#define SFX_SLOT_RECORDMANUAL 0x0800L // Recording by the application + // developer is default + +#define SFX_SLOT_RECORDABSOLUTE 0x1000000L // Recording with absolute Target +#define SFX_SLOT_STANDARD ( SFX_SLOT_CACHABLE | \ + SFX_SLOT_SYNCHRON | \ + SFX_SLOT_RECORDPERSET ) + +#define SFX_SLOT_PROPGET 0x1000L // get property +#define SFX_SLOT_PROPSET 0x2000L // set property, exclusiv to + // SFX_SLOT_METHOD +#define SFX_SLOT_METHOD 0x4000L // Method, exclusiv to SFX_SLOT_PROPSET + +#define SFX_SLOT_FASTCALL 0x8000L // No test if disabled before Execute + +#define SFX_SLOT_STATUSBARCONFIG 0x10000L // configurable status row +#define SFX_SLOT_MENUCONFIG 0x20000L // configurable Menu +#define SFX_SLOT_TOOLBOXCONFIG 0x40000L // configurable Toolboxen +#define SFX_SLOT_ACCELCONFIG 0x80000L // configurable keys + +#define SFX_SLOT_CONTAINER 0x100000L // Operated by the container at + // InPlace +#define SFX_SLOT_READONLYDOC 0x200000L // also available for + // read-only Documents +#define SFX_SLOT_IMAGEROTATION 0x400000L // Rotate image on Vertical/ + // Bi-directional writing +#define SFX_SLOT_IMAGEREFLECTION 0x800000L // Mirror image on Vertical/ + // Bi-directional writing + +//-------------------------------------------------------------------- + +class SfxRequest; +class SfxItemSet; + +#define SFX_EXEC_STUB( aShellClass, aExecMethod) \ + void SfxStub##aShellClass##aExecMethod( \ + SfxShell *pShell, SfxRequest& rReq) \ + { \ + (( aShellClass* ) pShell )->aExecMethod( rReq ); \ + } + +#define SFX_STATE_STUB( aShellClass, aStateMethod) \ + void SfxStub##aShellClass##aStateMethod( \ + SfxShell *pShell, SfxItemSet& rSet) \ + { \ + (( aShellClass* ) pShell )->aStateMethod( rSet ); \ + } + +#define SFX_STUB_PTR( aShellClass, aMethod ) \ + &SfxStub##aShellClass##aMethod + +#define SFX_STUB_PTR_EXEC_NONE &SfxShell::EmptyExecStub + +#define SFX_STUB_PTR_STATE_NONE &SfxShell::EmptyStateStub + +//-------------------------------------------------------------------- + +enum SfxSlotKind +{ + SFX_KIND_STANDARD, + SFX_KIND_ENUM, + SFX_KIND_ATTR +}; + +//========================================================================= + +struct SfxTypeAttrib +{ + sal_uInt16 nAID; + const char* pName; +}; + +struct SfxType +{ + TypeId aTypeId; + sal_uInt16 nAttribs; + SfxTypeAttrib aAttrib[16]; + + const TypeId& Type() const + { return aTypeId; } + SfxPoolItem* CreateItem() const + { return (SfxPoolItem*) aTypeId(); } +}; + +struct SfxType0 +{ + TypeId aTypeId; + sal_uInt16 nAttribs; + + const TypeId& Type() const + { return aTypeId; } + SfxPoolItem* CreateItem() const + { return (SfxPoolItem*) aTypeId(); } +}; + +#define SFX_DECL_TYPE(n) struct SfxType##n \ + { \ + TypeId aTypeId; \ + sal_uInt16 nAttribs; \ + SfxTypeAttrib aAttrib[n]; \ + } + +#define SFX_TYPE(Class) &a##Class##_Impl + +SFX_DECL_TYPE(1); +SFX_DECL_TYPE(2); +SFX_DECL_TYPE(3); +SFX_DECL_TYPE(4); +SFX_DECL_TYPE(5); +SFX_DECL_TYPE(6); +SFX_DECL_TYPE(7); +SFX_DECL_TYPE(8); +SFX_DECL_TYPE(10); // for SfxDocInfoItem +SFX_DECL_TYPE(11); + +SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd... +SFX_DECL_TYPE(14); +SFX_DECL_TYPE(16); // for SwDocDisplayItem +SFX_DECL_TYPE(17); // for SvxAddressItem +SFX_DECL_TYPE(18); // for SvxSearchItem + +// all SfxTypes must be in this header +#undef SFX_DECL_TYPE + +#define SFX_SLOT_ARG( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass, nArg0, nArgs, Name, Prop ) \ + { id, GroupId, id, Flags | Prop, \ + USHRT_MAX, 0, \ + ExecMethodPtr, \ + StateMethodPtr, \ + (const SfxType*) &a##ItemClass##_Impl, \ + Name, Name, 0, 0, \ + &a##aShellClass##Args_Impl[nArg0], nArgs, 0, Name \ + } + +#define SFX_SLOT( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass ) \ + { id, GroupId, id, Flags, \ + 0, 0, \ + ExecMethodPtr, \ + StateMethodPtr, \ + (const SfxType*) &a##ItemClass##_Impl, \ + 0, 0, 0, 0, 0, 0, 0 \ + } + +#define SFX_NEW_SLOT_ARG( aShellClass, id, hid, GroupId, pLinked, pNext, ExecMethodPtr, StateMethodPtr, Flags, DisableFlags, ItemClass, nArg0, nArgs, Name, Prop, UnoName ) \ + { id, GroupId, hid, Flags | Prop, \ + USHRT_MAX, 0, \ + ExecMethodPtr, \ + StateMethodPtr, \ + (const SfxType*) &a##ItemClass##_Impl, \ + Name, Name, \ + pLinked, pNext, \ + &a##aShellClass##Args_Impl[nArg0], nArgs, DisableFlags, UnoName \ + } + +#define SFX_NEW_SLOT_ENUM( SlaveId, hid, GroupId, pMaster, pNext, MasterId, Value, Flags, DisableFlags, UnoName ) \ + { SlaveId, GroupId, hid, Flags, \ + MasterId, Value, \ + 0, \ + 0, \ + (const SfxType*) &aSfxBoolItem_Impl, \ + 0, 0, \ + pMaster, \ + pNext, \ + 0, 0, DisableFlags, UnoName \ + } + +#define SFX_ARGUMENT( ArgSlotId, ArgName, ArgTypeId ) \ + { (const SfxType*) &a##ArgTypeId##_Impl, ArgName, ArgSlotId } + +//-------------------------------------------------------------------- + +class SfxPoolItem; + +struct SfxFormalArgument +{ + const SfxType* pType; // Type of the parameter (SfxPoolItem subclass) + const char* pName; // Name of the sParameters + sal_uInt16 nSlotId; // Slot-Id for identification of the Parameters + + const TypeId& Type() const + { return pType->aTypeId; } + SfxPoolItem* CreateItem() const + { return (SfxPoolItem*) pType->aTypeId(); } +}; + +//-------------------------------------------------------------------- + +class SfxSlot +{ +public: + sal_uInt16 nSlotId; // Unique slot-ID in Shell + sal_uInt16 nGroupId; // for configuration region + sal_uIntPtr nHelpId; // Usually == nSlotId + sal_uIntPtr nFlags; // artihmetic ordered Flags + + sal_uInt16 nMasterSlotId; // Enum-Slot for example Which-Id + sal_uInt16 nValue; // Value, in case of Enum-Slot + + SfxExecFunc fnExec; // Function to be excecuted + SfxStateFunc fnState; // Function for Status + + const SfxType* pType; // SfxPoolItem-Type (Status) + const char* pName; // Name of the Slots + const char* pMethodName; // Name of the Method if different + + const SfxSlot* pLinkedSlot; // Master-Slot for Enum value + const SfxSlot* pNextSlot; // with the same Status-Method + + const SfxFormalArgument* pFirstArgDef; // first formal Argument-Definition + sal_uInt16 nArgDefCount; // Number of formal Argumentents + long nDisableFlags; // DisableFlags that need to be + // present, so that the Slot + // can be enabled + const char* pUnoName; // UnoName for the Slots + +public: + + SfxSlotKind GetKind() const; + sal_uInt16 GetSlotId() const; + sal_uIntPtr GetHelpId() const; + sal_uIntPtr GetMode() const; + sal_Bool IsMode( sal_uIntPtr nMode ) const; + sal_uInt16 GetGroupId() const; + sal_uInt16 GetMasterSlotId() const { return nMasterSlotId; } + sal_uInt16 GetWhich( const SfxItemPool &rPool ) const; + sal_uInt16 GetValue() const { return nValue; } + const SfxType* GetType() const { return pType; } + const char* GetUnoName() const { return pUnoName; } + SFX2_DLLPUBLIC OString GetCommand() const; + SFX2_DLLPUBLIC OUString GetCommandString() const; + + sal_uInt16 GetFormalArgumentCount() const { return nArgDefCount; } + const SfxFormalArgument& GetFormalArgument( sal_uInt16 nNo ) const + { return pFirstArgDef[nNo]; } + + SfxExecFunc GetExecFnc() const { return fnExec; } + SfxStateFunc GetStateFnc() const { return fnState; } + + const SfxSlot* GetLinkedSlot() const { return pLinkedSlot; } + const SfxSlot* GetNextSlot() const { return pNextSlot; } +}; + +//========================================================================= + +// returns the id of the function + +inline sal_uInt16 SfxSlot::GetSlotId() const +{ + return nSlotId; +} +//-------------------------------------------------------------------- +// returns the help-id of the slot + +inline sal_uIntPtr SfxSlot::GetHelpId() const +{ + return nHelpId; +} + +//-------------------------------------------------------------------- + +// returns a bitfield with flags + +inline sal_uIntPtr SfxSlot::GetMode() const +{ + return nFlags; +} +//-------------------------------------------------------------------- + +// determines if the specified mode is assigned + +inline sal_Bool SfxSlot::IsMode( sal_uIntPtr nMode ) const +{ + return (nFlags & nMode) != 0; +} +//-------------------------------------------------------------------- + +// returns the id of the associated group + +inline sal_uInt16 SfxSlot::GetGroupId() const +{ + return nGroupId; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx new file mode 100644 index 000000000000..500912ff3f5b --- /dev/null +++ b/include/sfx2/msgpool.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXMSGPOOL_HXX +#define _SFXMSGPOOL_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" + +#include <sfx2/msg.hxx> +#include <tools/string.hxx> + +#include <string> +#include <vector> + +class SfxInterface; +class SfxSlot; + +typedef std::basic_string< sal_uInt16 > SfxSlotGroupArr_Impl; +typedef std::vector<SfxInterface*> SfxInterfaceArr_Impl; + +class SFX2_DLLPUBLIC SfxSlotPool +{ + SfxSlotGroupArr_Impl* _pGroups; + SfxSlotPool* _pParentPool; + ResMgr* _pResMgr; + SfxInterfaceArr_Impl* _pInterfaces; + sal_uInt16 _nCurGroup; + sal_uInt16 _nCurInterface; + sal_uInt16 _nCurMsg; + +private: + const SfxSlot* SeekSlot( sal_uInt16 nObject ); + +public: + SfxSlotPool( SfxSlotPool* pParent=0, ResMgr* pMgr=0); + ~SfxSlotPool(); + + void RegisterInterface( SfxInterface& rFace ); + void ReleaseInterface( SfxInterface& rFace ); + SfxInterface* FirstInterface(); + + static SfxSlotPool& GetSlotPool( SfxViewFrame *pFrame=NULL ); + + sal_uInt16 GetGroupCount(); + String SeekGroup( sal_uInt16 nNo ); + const SfxSlot* FirstSlot(); + const SfxSlot* NextSlot(); + const SfxSlot* GetSlot( sal_uInt16 nId ); + const SfxSlot* GetUnoSlot( sal_uInt16 nId ); + const SfxSlot* GetUnoSlot( const String& rUnoName ); + TypeId GetSlotType( sal_uInt16 nSlotId ) const; +}; + +//-------------------------------------------------------------------- + +// seeks to the first func in the current group + +inline const SfxSlot* SfxSlotPool::FirstSlot() +{ + return SeekSlot(0); +} + +#define SFX_SLOTPOOL() SfxSlotPool::GetSlotPool() + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/navigat.hxx b/include/sfx2/navigat.hxx new file mode 100644 index 000000000000..b1cada954d2b --- /dev/null +++ b/include/sfx2/navigat.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXNAVI_HXX +#define _SFXNAVI_HXX + +#include <sfx2/childwin.hxx> +#include <sfx2/dockwin.hxx> + +class SfxNavigatorWrapper : public SfxChildWindow +{ + +public: + SfxNavigatorWrapper( Window* pParent , + sal_uInt16 nId , + SfxBindings* pBindings , + SfxChildWinInfo* pInfo ); + + SFX_DECL_CHILDWINDOW(SfxNavigatorWrapper); +}; + +class SfxNavigator : public SfxDockingWindow +{ + SfxChildWindow* pWrapper; + +public: + SfxNavigator( SfxBindings* pBindings , + SfxChildWindow* pChildWin , + Window* pParent , + WinBits nBits ); + + virtual void Resize(); + virtual void Resizing( Size& rSize ); + virtual sal_Bool Close(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx new file mode 100644 index 000000000000..a7534580f1cd --- /dev/null +++ b/include/sfx2/new.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXNEW_HXX +#define _SFXNEW_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <vcl/button.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <sfx2/basedlgs.hxx> + +//========================================================================= + +class SfxObjectShellLock; +class SfxObjectShell; +class MoreButton; + +//========================================================================= + +#define SFXWB_PREVIEW 0x0003 +#define SFXWB_LOAD_TEMPLATE 0x0004 + +#define SFX_LOAD_TEXT_STYLES 0x0001 +#define SFX_LOAD_FRAME_STYLES 0x0002 +#define SFX_LOAD_PAGE_STYLES 0x0004 +#define SFX_LOAD_NUM_STYLES 0x0008 +#define SFX_MERGE_STYLES 0x0010 + +#define RET_TEMPLATE_LOAD 100 + +class SfxNewFileDialog_Impl; +class SFX2_DLLPUBLIC SfxNewFileDialog : public SfxModalDialog +{ + friend class SfxNewFileDialog_Impl; + +private: + SfxNewFileDialog_Impl* pImpl; + +public: + + SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags = 0); + ~SfxNewFileDialog(); + + // Returns sal_False, when '- No -' is set as Template + // Template names can only be obtained when IsTemplate() returns sal_True. + sal_Bool IsTemplate() const; + String GetTemplateFileName() const; + + // load template methods + sal_uInt16 GetTemplateFlags()const; + void SetTemplateFlags(sal_uInt16 nSet); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx new file mode 100644 index 000000000000..2c7999f9923c --- /dev/null +++ b/include/sfx2/newstyle.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _NEWSTYLE_HXX +#define _NEWSTYLE_HXX + +#include <comphelper/string.hxx> +#include <sal/config.h> +#include <sfx2/dllapi.h> +#include <vcl/button.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/combobox.hxx> +#include <vcl/dialog.hxx> +#include <vcl/fixed.hxx> + +class SfxStyleSheetBasePool; + +class SFX2_DLLPUBLIC SfxNewStyleDlg : public ModalDialog +{ +private: + FixedLine aColFL; + ComboBox aColBox; + OKButton aOKBtn; + CancelButton aCancelBtn; + + QueryBox aQueryOverwriteBox; + SfxStyleSheetBasePool& rPool; + + DECL_DLLPRIVATE_LINK( OKHdl, Control * ); + DECL_DLLPRIVATE_LINK( ModifyHdl, ComboBox * ); + +public: + SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& ); + ~SfxNewStyleDlg(); + + String GetName() const { return comphelper::string::stripStart(aColBox.GetText(), ' '); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx new file mode 100644 index 000000000000..8e1f772e3791 --- /dev/null +++ b/include/sfx2/objface.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXOBJFACE_HXX +#define _SFXOBJFACE_HXX + +#include "sal/config.h" + +#include "rtl/ustring.hxx" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/string.hxx> +#include <tools/resid.hxx> + +#include <sfx2/msg.hxx> + +struct SfxFormalArgument; +struct SfxInterface_Impl; +class SfxConfigItem; +class SfxModule; +class SvStream; + +class SFX2_DLLPUBLIC SfxInterface +{ +friend class SfxSlotPool; + + const char* pName; // Sfx-internal name of interface + const SfxInterface* pGenoType; // base interface + SfxSlot* pSlots; // SlotMap + sal_uInt16 nCount; // number of slots in SlotMap + SfxInterfaceId nClassId; // Id of interface + ResId aNameResId; // ResId of external interface name + SfxInterface_Impl* pImpData; + + SfxSlot* operator[]( sal_uInt16 nPos ) const; + +public: + SfxInterface( const char *pClass, + const ResId& rResId, + SfxInterfaceId nClassId, + const SfxInterface* pGeno, + SfxSlot &rMessages, sal_uInt16 nMsgCount ); + virtual ~SfxInterface(); + + void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount ); + inline sal_uInt16 Count() const; + + const SfxSlot* GetRealSlot( const SfxSlot * ) const; + const SfxSlot* GetRealSlot( sal_uInt16 nSlotId ) const; + virtual const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const; + const SfxSlot* GetSlot( const String& rCommand ) const; + + const char* GetClassName() const { return pName; } + bool HasName() const { return 0 != aNameResId.GetId(); } + OUString GetName() const + { return HasName() ? aNameResId.toString() : OUString(); } + ResMgr* GetResMgr() const + { return aNameResId.GetResMgr(); } + + const SfxInterface* GetGenoType() const { return pGenoType; } + const SfxInterface* GetRealInterfaceForSlot( const SfxSlot* ) const; + + void RegisterObjectBar( sal_uInt16, const ResId&, const String* pST=0 ); + void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 ); + void RegisterChildWindow( sal_uInt16, sal_Bool bContext, const String* pST=0 ); + void RegisterChildWindow( sal_uInt16, sal_Bool bContext, sal_uInt32 nFeature, const String* pST=0 ); + void RegisterStatusBar( const ResId& ); + const ResId& GetObjectBarResId( sal_uInt16 nNo ) const; + sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const; + sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const; + sal_uInt16 GetObjectBarCount() const; + void SetObjectBarPos( sal_uInt16 nPos, sal_uInt16 nId ); + const String* GetObjectBarName( sal_uInt16 nNo ) const; + sal_Bool IsObjectBarVisible( sal_uInt16 nNo) const; + sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const; + sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const; + sal_uInt16 GetChildWindowCount() const; + void RegisterPopupMenu( const ResId& ); + const ResId& GetPopupMenuResId() const; + const ResId& GetStatusBarResId() const; + + void Register( SfxModule* ); + + SAL_DLLPRIVATE int ContainsSlot_Impl( const SfxSlot *pSlot ) const + { return pSlot >= pSlots && pSlot < pSlots + Count(); } + SAL_DLLPRIVATE ResMgr* GetResManager_Impl() const + { return aNameResId.GetResMgr(); } +}; + +//-------------------------------------------------------------------- + +// returns the number of functions in this cluster + +inline sal_uInt16 SfxInterface::Count() const +{ + return nCount; +} + +//-------------------------------------------------------------------- + +// returns a function by position in the array + +inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const +{ + return nPos < nCount? pSlots+nPos: 0; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/objitem.hxx b/include/sfx2/objitem.hxx new file mode 100644 index 000000000000..8e607c9f0ce5 --- /dev/null +++ b/include/sfx2/objitem.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_OBJITEM_HXX +#define _SFX_OBJITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <svl/poolitem.hxx> + +#include <sfx2/shell.hxx> + +//------------------------------------------------------------------------ + +class SFX2_DLLPUBLIC SfxObjectItem: public SfxPoolItem +{ + SfxShell* _pSh; + +public: + TYPEINFO(); + SfxObjectItem( sal_uInt16 nWhich=0, SfxShell *pSh=0 ); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + SfxShell* GetShell() const + { return _pSh; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx new file mode 100644 index 000000000000..4c366a56710f --- /dev/null +++ b/include/sfx2/objsh.hxx @@ -0,0 +1,824 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_OBJSH_HXX +#define _SFX_OBJSH_HXX + +#include <config_features.h> + +#include "sal/config.h" + +#include "tools/solar.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/security/DocumentSignatureInformation.hpp> +#include <com/sun/star/security/XDocumentDigitalSignatures.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <boost/shared_ptr.hpp> + +//________________________________________________________________________________________________________________ +// include something else +//________________________________________________________________________________________________________________ + +#include <vcl/timer.hxx> +#include <svl/poolitem.hxx> +#include <vcl/bitmap.hxx> +#include <sot/storage.hxx> +#include <rsc/rscsfx.hxx> + +#include <sfx2/XmlIdRegistry.hxx> +#include <sfx2/shell.hxx> +#include <comphelper/embeddedobjectcontainer.hxx> +#include <com/sun/star/frame/XModel.hpp> + +class SbxValue; +class SvxMacro; +class SbxArray; +class BasicManager; +class SfxMedium; +class SfxObjectFactory; +class SfxDocumentInfoDialog; +class SfxStyleSheetBasePool; +class INote; +class SfxStyleSheetPool; +class SfxFrame; +class SbMethod; +class StarBASIC; +class Printer; +class SvKeyValueIterator; +class SfxBaseModel; +class SfxModule; +class SvData; +class SfxProgress; +class GDIMetaFile; +class Bitmap; +class INetURLObject; +class IndexBitSet; +class JobSetup; +class Size; +class Point; + +// From embobj.hxx +#define ASPECT_CONTENT 1 +#define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */ +#define ASPECT_ICON 4 +#define ASPECT_DOCPRINT 8 +#define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT) + +// from pseudo.hxx; must be the same as in OLE2 +#define SVOBJ_MISCSTATUS_SERVERRESIZE 1 +#define SVOBJ_MISCSTATUS_NOTREPLACE 4 +#define SVOBJ_MISCSTATUS_CANTLINKINSIDE 16 +#define SVOBJ_MISCSTATUS_LINK 64 +#define SVOBJ_MISCSTATUS_INSIDEOUT 128 +#define SVOBJ_MISCSTATUS_ACTIVATEWHENVISIBLE 256 +#define SVOBJ_MISCSTATUS_NOTRESIZEABLE 512 +#define SVOBJ_MISCSTATUS_ALWAYSACTIVATE 1024 +#define SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE 2048 +#define SVOBJ_MISCSTATUS_SPECIALOBJECT 4096 + + +namespace sfx2 +{ + class SvLinkSource; +} + +namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } } + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } + namespace lang { + class XComponent; + } +} } } + +typedef sal_uInt32 SfxObjectShellFlags; +#define SFXOBJECTSHELL_HASOPENDOC 0x01L +#define SFXOBJECTSHELL_DONTREPLACE 0x02L +#define SFXOBJECTSHELL_HASMENU 0x04L +#define SFXOBJECTSHELL_DONTLOADFILTERS 0x08L +#define SFXOBJECTSHELL_DONTCLOSE 0x10L +#define SFXOBJECTSHELL_NODOCINFO 0x20L +#define SFXOBJECTSHELL_STD_NORMAL ( SFXOBJECTSHELL_HASOPENDOC ) +#define SFXOBJECTSHELL_STD_SPECIAL ( SFXOBJECTSHELL_DONTLOADFILTERS ) +#define SFXOBJECTSHELL_UNDEFINED 0xf000000 + +//-------------------------------------------------------------------- + +#define SFX_TITLE_TITLE 0 +#define SFX_TITLE_FILENAME 1 +#define SFX_TITLE_FULLNAME 2 +#define SFX_TITLE_APINAME 3 +#define SFX_TITLE_DETECT 4 +#define SFX_TITLE_CAPTION 5 +#define SFX_TITLE_PICKLIST 6 +#define SFX_TITLE_HISTORY 7 +#define SFX_TITLE_MAXLEN 10 // this gives the limits on length + +#define SFX_LOADED_MAINDOCUMENT 1 +#define SFX_LOADED_IMAGES 2 +#define SFX_LOADED_ALL 3 + +//-------------------------------------------------------------------- + +#define HIDDENINFORMATION_RECORDEDCHANGES 0x0001 +#define HIDDENINFORMATION_NOTES 0x0002 +#define HIDDENINFORMATION_DOCUMENTVERSIONS 0x0004 + +enum HiddenWarningFact +{ + WhenSaving = 0, + WhenPrinting, + WhenSigning, + WhenCreatingPDF +}; + +//-------------------------------------------------------------------- + +enum SfxObjectCreateMode +{ + SFX_CREATE_MODE_EMBEDDED, + SFX_CREATE_MODE_STANDARD, + SFX_CREATE_MODE_PREVIEW, + SFX_CREATE_MODE_ORGANIZER, + SFX_CREATE_MODE_PLUGIN, + SFX_CREATE_MODE_INTERNAL +}; + +/*==================================================================== + +The class SfxObjectShell is the base class for SFx-objects, ie documents +and parts of documents that can be integrated as separate objects +into foreign objects. + +----------------------------------------------------------------------*/ + +class SfxToolBoxConfig; +struct TransferableObjectDescriptor; + +class SFX2_DLLPUBLIC SfxObjectShell : + public SfxShell, virtual public SotObject, + public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier +{ +friend struct ModifyBlocker_Impl; +friend class SfxObjectShellLock; + +private: + struct SfxObjectShell_Impl* pImp; // internal data + + SfxMedium * pMedium; // Description of the file for example + // storage that contains the object + SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets + SfxObjectCreateMode eCreateMode; // Purpose of the object + sal_Bool bHasName :1, // sal_True := existing object, + // sal_False := new object + bIsTmp :1; // temporary Storage + +private: + SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> & i_xDocProps); + + SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet ); + +protected: + SfxObjectShell(SfxObjectCreateMode); + SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx + virtual ~SfxObjectShell(); + + virtual void ModifyChanged(); + virtual sal_Bool Close(); + + /** declares the document to have capabilities to contain basic/dialog libraries + */ + void SetHasNoBasic(); + + /// template method, called by FlushDocInfo; this implementation is empty + virtual void DoFlushDocInfo(); + + // helper method + void AddToRecentlyUsedList(); + +public: + TYPEINFO(); + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH) + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + /* Stampit disable/enable cancel button for print jobs + default = true = enable! */ + void Stamp_SetPrintCancelState(sal_Bool bState); + sal_Bool Stamp_GetPrintCancelState() const; + + using SotObject::GetInterface; + + // Document-Shell Iterator + static SfxObjectShell* GetFirst( const TypeId* pType = 0, + sal_Bool bOnlyVisible = sal_True ); + static SfxObjectShell* GetNext( const SfxObjectShell& rPrev, + const TypeId* pType = 0, + sal_Bool bOnlyVisible = sal_True ); + static SfxObjectShell* Current(); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + GetCurrentComponent(); + static void SetCurrentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); + + virtual void Invalidate(sal_uInt16 nId = 0); + + SfxObjectShellFlags GetFlags( ) const ; + + SfxModule* GetModule() const; + + virtual SfxObjectFactory& GetFactory() const=0; + SfxMedium * GetMedium() const { return pMedium; } + void ForgetMedium() { pMedium = 0; } + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties > getDocProperties(); + void UpdateDocInfoForSave( ); + void FlushDocInfo(); + sal_Bool HasName() const { return bHasName; } + virtual String GetAPIName() const; + void SetReadOnly(); + sal_Bool IsReadOnly() const; + sal_Bool IsReadOnlyMedium() const; + bool IsOriginallyReadOnlyMedium() const; + void SetReadOnlyUI( sal_Bool bReadOnly = sal_True ); + sal_Bool IsReadOnlyUI() const; + void SetNoName(); + sal_Bool IsInModalMode() const; + sal_Bool IsInPrepareClose() const; + virtual sal_Bool AcceptStateUpdate() const; + sal_Bool IsHelpDocument() const; + +#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT + sal_Bool IsDocShared() const; + OUString GetSharedFileURL() const; + sal_Bool SwitchToShared( sal_Bool bShared, sal_Bool bSave ); + SAL_DLLPRIVATE void FreeSharedFile(); + SAL_DLLPRIVATE void FreeSharedFile( const OUString& aTempFileURL ); + SAL_DLLPRIVATE void DoNotCleanShareControlFile(); + void SetSharedXMLFlag( sal_Bool bFlag ) const; + sal_Bool HasSharedXMLFlagSet() const; +#else + sal_Bool IsDocShared() const + { return sal_False; }; + OUString GetSharedFileURL() const + { return OUString(); }; +#endif + + SAL_DLLPRIVATE void SetModalMode_Impl(sal_Bool bModal=sal_True); + SAL_DLLPRIVATE void SetMacroMode_Impl(sal_Bool bModal=sal_True); + + void ResetError(); + sal_uInt32 GetError() const; + sal_uInt32 GetErrorCode() const; + void SetError( sal_uInt32 rErr, const OUString& aLogMessage ); + + void AddLog( const OUString& aMessage ); + void StoreLog(); + + /** + * Initialize bare minimum just enough for unit test runs. + * + * @return true if the initialization is successful, false otherwise. + */ + bool DoInitUnitTest(); + sal_Bool DoInitNew( SfxMedium* pMedium=0 ); + sal_Bool DoLoad( SfxMedium* pMedium ); + bool DoLoadExternal( SfxMedium* pMed ); + sal_Bool DoSave(); + sal_Bool DoSaveAs( SfxMedium &rNewStor ); + sal_Bool DoSaveObjectAs( SfxMedium &rNewStor, sal_Bool bCommit ); + + // TODO/LATER: currently only overloaded in Calc, should be made non-virtual + virtual sal_Bool DoSaveCompleted( SfxMedium* pNewStor=0 ); + + virtual sal_Bool LoadOwnFormat( SfxMedium& pMedium ); + virtual sal_Bool SaveAsOwnFormat( SfxMedium& pMedium ); + virtual sal_Bool ConvertFrom( SfxMedium &rMedium ); + virtual sal_Bool ConvertTo( SfxMedium &rMedium ); + virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + virtual sal_Bool Load( SfxMedium &rMedium ); + virtual sal_Bool LoadFrom( SfxMedium& rMedium ); + virtual sal_Bool Save(); + virtual sal_Bool SaveAs( SfxMedium &rMedium ); + virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + virtual sal_Bool SwitchPersistance( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + virtual void UpdateLinks(); + virtual bool LoadExternal( SfxMedium& rMedium ); + /** + * Called when the Options dialog is dismissed with the OK button, to + * handle potentially conflicting option settings. + */ + virtual void CheckConfigOptions(); + sal_Bool IsConfigOptionsChecked() const; + void SetConfigOptionsChecked( sal_Bool bChecked ); + + // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action + virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId ); + + sal_Bool SaveChildren(sal_Bool bObjectsOnly=sal_False); + sal_Bool SaveAsChildren( SfxMedium &rMedium ); + sal_Bool SwitchChildrenPersistance( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, + sal_Bool bForceNonModified = sal_False ); + sal_Bool SaveCompletedChildren( sal_Bool bSuccess ); + + virtual sal_Bool ImportFrom( SfxMedium &rMedium, bool bInsert ); + sal_Bool ExportTo( SfxMedium &rMedium ); + + // xmlsec05, check with SFX team + sal_uInt16 GetDocumentSignatureState(); + void SignDocumentContent(); + sal_uInt16 GetScriptingSignatureState(); + void SignScriptingContent(); + + virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( + Window *pParent, const SfxItemSet& ); + + ErrCode CallBasic( const String& rMacro, const String& rBasicName, + SbxArray* pArgs = 0, SbxValue* pRet = 0 ); + + ErrCode CallXScript( + const String& rScriptURL, + 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, + bool bRaiseError = true, + const ::com::sun::star::uno::Any* aCaller = 0 ); + + static ErrCode CallXScript( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext, + const OUString& rScriptURL, + 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, + bool bRaiseError = true, + const ::com::sun::star::uno::Any* aCaller = 0 + ); + + /** adjusts the internal macro mode, according to the current security settings + + Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN. + + @return + whether macros from this document should be executed + */ + bool AdjustMacroMode( const String& rScriptType, bool _bSuppressUI = false ); + + SvKeyValueIterator* GetHeaderAttributes(); + void ClearHeaderAttributesForSourceViewHack(); + void SetHeaderAttributesForSourceViewHack(); + + sal_Bool IsTemplate() const; + + sal_Bool IsQueryLoadTemplate() const; + sal_Bool IsUseUserData() const; + sal_Bool IsLoadReadonly() const; + sal_Bool IsSaveVersionOnClose() const; + void SetQueryLoadTemplate( sal_Bool b ); + void SetUseUserData( sal_Bool bNew ); + void SetLoadReadonly( sal_Bool _bReadonly ); + void SetSaveVersionOnClose( sal_Bool bSet ); + void ResetFromTemplate( const String& rTemplateName, const String& rFileName ); + + // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future + sal_uInt32 GetModifyPasswordHash() const; + sal_Bool SetModifyPasswordHash( sal_uInt32 nHash ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const; + sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo ); + + static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); + + virtual void ViewAssigned(); + virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); + virtual sal_Bool IsInformationLost(); + virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ); + sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent ); + virtual sal_Bool HasSecurityOptOpenReadOnly() const; + sal_Bool IsSecurityOptOpenReadOnly() const; + void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly = sal_True ); + + virtual Size GetFirstPageSize(); + virtual sal_Bool DoClose(); + virtual void PrepareReload(); + virtual ::boost::shared_ptr<GDIMetaFile> GetPreviewMetaFile( sal_Bool bFullContent = sal_False ) const; + virtual void CancelTransfers(); + + sal_Bool GenerateAndStoreThumbnail( + sal_Bool bEncrypted, + sal_Bool bSigned, + sal_Bool bIsTemplate, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor ); + + sal_Bool WriteThumbnail( + sal_Bool bEncrypted, + sal_Bool bSigned, + sal_Bool bIsTemplate, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream ); + + // Transfer IFace + void AbortImport(); + sal_Bool IsAbortingImport() const; + sal_Bool IsReloading() const; + void FinishedLoading( sal_uInt16 nWhich = SFX_LOADED_ALL ); + void TemplateDisconnectionAfterLoad(); + sal_Bool IsLoading() const; + sal_Bool IsLoadingFinished() const; + void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, sal_Bool bReload = sal_True ); + sal_Bool IsAutoLoadLocked() const; + void NotifyReloadAvailable(); + + // Misc + sal_Bool IsPreview() const; + SfxObjectCreateMode GetCreateMode() const { return eCreateMode; } + SfxProgress* GetProgress() const; + void SetWaitCursor( sal_Bool bSet ) const; + + // Naming Interface + void SetTitle( const String& rTitle ); + String GetTitle( sal_uInt16 nMaxLen = 0 ) const; + void InvalidateName(); // Re-set to unnamed + + // DDE-Interface + virtual long DdeExecute( const String& rCmd ); + virtual long DdeGetData( const String& rItem, + const String& rMimeType, + ::com::sun::star::uno::Any & rValue ); + virtual long DdeSetData( const String& rItem, + const String& rMimeType, + const ::com::sun::star::uno::Any & rValue ); + virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); + virtual void ReconnectDdeLink(SfxObjectShell& rServer); + + static void ReconnectDdeLinks(SfxObjectShell& rServer); + + // Contents + virtual SfxStyleSheetBasePool* GetStyleSheetPool(); + void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) { + pStyleSheetPool = pBasePool; } + + // Determine the position of the "Automatic" filter in the stylist + void SetAutoStyleFilterIndex(sal_uInt16 nSet); + sal_uInt16 GetAutoStyleFilterIndex(); + virtual sal_Bool HasBasic() const; + BasicManager* GetBasicManager() const; + com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > + GetBasicContainer(); + com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > + GetDialogContainer(); + StarBASIC* GetBasic() const; + + // Interface Document content, Organizer +#define INDEX_IGNORE USHRT_MAX + +#define CONTENT_STYLE 0 +#define CONTENT_CONFIG 1 +#define CONTENT_MACRO 2 +#define DEF_CONTENT_COUNT 1 + + + virtual void SetOrganizerSearchMask( + SfxStyleSheetBasePool* ) const; + + virtual sal_Bool CanHaveChildren( + sal_uInt16 nIdx1, + sal_uInt16 nIdx2 = INDEX_IGNORE + ); + + virtual void GetContent( String &, + Bitmap &rClosedBitmap, + Bitmap &rOpenedBitmap, + sal_Bool &bCanDelete, + sal_uInt16 nPos, + sal_uInt16 nIdx1 + ); + + virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily); + + virtual sal_Bool Insert( SfxObjectShell &rSource, + sal_uInt16 nSourceIdx1, + sal_uInt16 nSourceIdx2, + sal_uInt16 nSourceIdx3, + sal_uInt16 &nIdx1, + sal_uInt16 &nIdx2, + sal_uInt16 &nIdx3, + sal_uInt16 &rIdxDeleted); + + virtual sal_Bool Remove( sal_uInt16 nIdx1, + sal_uInt16 nIdx2 = INDEX_IGNORE, + sal_uInt16 nIdx3 = INDEX_IGNORE); + + virtual void LoadStyles( SfxObjectShell &rSource ); + void ReadNote( INote * ); + void UpdateNote( INote * ); + + // Documents, for which to format the view size + + virtual SfxObjectShell* GetObjectShell(); + + virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModel() const; + // Only temporarily for the applications! + void SetBaseModel( SfxBaseModel* pModel ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; + // Only temporarily for the applications! + + virtual ::com::sun::star::uno::Sequence< OUString > GetEventNames(); + + Window* GetDialogParent( SfxMedium* pMedium=0 ); + static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); + static SfxObjectShell* CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL ); + static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp ); + static String GetServiceNameFromFactory( const String& rFact ); + sal_Bool IsInPlaceActive(); + sal_Bool IsUIActive(); + virtual void InPlaceActivate( sal_Bool ); + virtual void UIActivate( sal_Bool ); + + static sal_Bool CopyStoragesOfUnknownMediaType( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget ); + + // ==== The functions from SvPersist + void EnableSetModified( sal_Bool bEnable = sal_True ); + sal_Bool IsEnableSetModified() const; + virtual void SetModified( sal_Bool bModified = sal_True ); + sal_Bool IsModified(); + + /** + * @param bChart true if the file is a chart doc and FillClass should not be called + */ + void SetupStorage( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, + sal_Int32 nVersion, sal_Bool bTemplate, bool bChart = false ) const; + + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage(); + + SvGlobalName GetClassName() const; + + // comphelper::IEmbeddedHelper + virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const; + virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const + { + return const_cast<SfxObjectShell*>(this)->GetStorage(); + } + virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const + { + return GetEmbeddedObjectContainer(); + } + bool isEnableSetModified() const + { + return IsEnableSetModified(); + } + comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const; + void ClearEmbeddedObjects(); + + // ==== The functions from SvEmbeddedObject + virtual Printer * GetDocumentPrinter(); + virtual OutputDevice* GetDocumentRefDev(); + virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ); + virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const; + virtual void SetVisArea( const Rectangle & rVisArea ); + const Rectangle & GetVisArea() const; + void SetVisAreaSize( const Size & rVisSize ); + virtual sal_uIntPtr GetMiscStatus() const; + + MapUnit GetMapUnit() const; + void SetMapUnit( MapUnit nMUnit ); + + void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const; + void DoDraw( OutputDevice *, const Point & rObjPos, + const Size & rSize, + const JobSetup & rSetup, + sal_uInt16 nAspect = ASPECT_CONTENT ); + virtual void Draw( OutputDevice *, const JobSetup & rSetup, + sal_uInt16 nAspect = ASPECT_CONTENT ) = 0; + + + virtual void FillClass( SvGlobalName * pClassName, + sal_uInt32 * pFormat, + OUString * pAppName, + OUString * pFullTypeName, + OUString * pShortTypeName, + sal_Int32 nVersion, + sal_Bool bTemplate = sal_False) const = 0; + + // change recording and respective passwword protection for Writer and Calc + // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON + // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT + virtual bool IsChangeRecording() const; + virtual bool HasChangeRecordProtection() const; + virtual void SetChangeRecording( bool bActivate ); + virtual bool SetProtectionPassword( const String &rPassword ); + virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); + + // ================================= + + SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const; + + SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const; + + SAL_DLLPRIVATE sal_Bool IsPackageStorageFormat_Impl(const SfxMedium &) const; + + SAL_DLLPRIVATE sal_Bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium ); + SAL_DLLPRIVATE sal_Bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium ); + + SAL_DLLPRIVATE sal_Bool PutURLContentsToVersionStream_Impl( + OUString aURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage, + OUString aStreamName ); + + SAL_DLLPRIVATE OUString CreateTempCopyOfStorage_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + + SAL_DLLPRIVATE void InitOwnModel_Impl(); + SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing ); + SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl(); + SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation( + const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); + SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True ); + SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered(); + + SAL_DLLPRIVATE void InitBasicManager_Impl(); + SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; } + + SAL_DLLPRIVATE static sal_Bool UseInteractionToHandleError( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, + sal_uInt32 nError ); + SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; } + + SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode ); + + SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev, + const Point & rViewPos, + const Fraction & rScaleX, + const Fraction & rScaleY, + const JobSetup & rSetup, + sal_uInt16 nAspect ); + + // Shell Interface + SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &); + SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&); + SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&); + SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &); + SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &); + SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &); + SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &); + + // Load/Save public internals + SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr ); + SAL_DLLPRIVATE void PositionView_Impl(); + SAL_DLLPRIVATE void UpdateFromTemplate_Impl(); + SAL_DLLPRIVATE sal_Bool CanReload_Impl(); + SAL_DLLPRIVATE void SetNamedVisibility_Impl(); + SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 ); + SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 ); + SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *); + SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams ); + SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams ); + SAL_DLLPRIVATE sal_Bool GeneralInit_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, + sal_Bool bTypeMustBeSetAlready ); + SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl(); + SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew ); + + // public-internals + SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); + SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress ); + SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); + SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); + SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); + + // configuration items + SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl(); + SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = sal_False ); + + SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > + ImplAnalyzeSignature( + sal_Bool bScriptingContent, + const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner + = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() ); + + SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False ); + SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + + SAL_DLLPRIVATE void CheckOut( ); + SAL_DLLPRIVATE void CancelCheckOut( ); + SAL_DLLPRIVATE void CheckIn( ); +}; + +#define SFX_GLOBAL_CLASSID \ + 0x9eaba5c3, 0xb232, 0x4309, \ + 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74 + + struct ModifyBlocker_Impl + { + SfxObjectShell* pPersist; + sal_Bool bWasEnabled; + ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP ) + { + bWasEnabled = pPersistP->IsEnableSetModified(); + if ( bWasEnabled ) + pPersistP->EnableSetModified( sal_False ); + } + ~ModifyBlocker_Impl() + { + if ( bWasEnabled ) + pPersist->EnableSetModified( bWasEnabled ); + } + }; + + +//-------------------------------------------------------------------- +#ifndef SFX_DECL_OBJECTSHELL_DEFINED +#define SFX_DECL_OBJECTSHELL_DEFINED +SV_DECL_REF(SfxObjectShell) +#endif +SV_DECL_LOCK(SfxObjectShell) +SV_IMPL_LOCK(SfxObjectShell) +SV_IMPL_REF(SfxObjectShell) + +//-------------------------------------------------------------------- +class AutoReloadTimer_Impl : public Timer +{ + String aUrl; + SfxObjectShell* pObjSh; + +public: + AutoReloadTimer_Impl( const String& rURL, sal_uInt32 nTime, + SfxObjectShell* pSh ); + virtual void Timeout(); +}; + +//------------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem +{ + SfxObjectShell* pObjSh; + +public: + TYPEINFO(); + SfxObjectShellItem() : + SfxPoolItem( 0 ), + pObjSh( 0 ) + {} + SfxObjectShellItem( SfxObjectShell *pObjShell ): + SfxPoolItem( 0 ), + pObjSh( pObjShell ) + {} + SfxObjectShellItem( sal_uInt16 nWhichId, + SfxObjectShell *pObjShell ): + SfxPoolItem( nWhichId ), + pObjSh( pObjShell ) + {} + + virtual int operator==( const SfxPoolItem& ) const; + virtual String GetValueText() const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + SfxObjectShell* GetObjectShell() const + { return pObjSh; } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx new file mode 100644 index 000000000000..70dce688e9a8 --- /dev/null +++ b/include/sfx2/opengrf.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX2_OPENGRF_HXX +#define _SFX2_OPENGRF_HXX + +#include <memory> // auto_ptr +#include <vcl/graphicfilter.hxx> +#include <sfx2/dllapi.h> + +struct SvxOpenGrf_Impl; + +class SFX2_DLLPUBLIC SvxOpenGraphicDialog +{ +public: + SvxOpenGraphicDialog ( const String& rTitle ); + ~SvxOpenGraphicDialog (); + + short Execute(); + + void SetPath( const String& rPath ); + void SetPath( const String& rPath, sal_Bool bLinkState ); + String GetPath() const; + + int GetGraphic(Graphic&) const; + + void EnableLink(sal_Bool); + void AsLink(sal_Bool); + sal_Bool IsAsLink() const; + + String GetCurrentFilter() const; + void SetCurrentFilter(const String&); +private: + // disable copy and assignment + SFX2_DLLPRIVATE SvxOpenGraphicDialog (const SvxOpenGraphicDialog&); + SFX2_DLLPRIVATE SvxOpenGraphicDialog& operator = ( const SvxOpenGraphicDialog & ); + + const std::auto_ptr< SvxOpenGrf_Impl > mpImpl; +}; + +#endif // _SVX_OPENGRF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx new file mode 100644 index 000000000000..1f10c7416b98 --- /dev/null +++ b/include/sfx2/passwd.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_PASSWD_HXX +#define _SFX_PASSWD_HXX + +#include "sal/config.h" +#include <sfx2/dllapi.h> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/layout.hxx> +#include <sfx2/app.hxx> + +// defines --------------------------------------------------------------- + +#define SHOWEXTRAS_NONE ((sal_uInt16)0x0000) +#define SHOWEXTRAS_USER ((sal_uInt16)0x0001) +#define SHOWEXTRAS_CONFIRM ((sal_uInt16)0x0002) +#define SHOWEXTRAS_PASSWORD2 ((sal_uInt16)0x0004) +#define SHOWEXTRAS_CONFIRM2 ((sal_uInt16)0x0008) +#define SHOWEXTRAS_ALL ((sal_uInt16)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM)) + +// class SfxPasswordDialog ----------------------------------------------- + +class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog +{ +private: + VclFrame* mpPassword1Box; + FixedText* mpUserFT; + Edit* mpUserED; + FixedText* mpPassword1FT; + Edit* mpPassword1ED; + FixedText* mpConfirm1FT; + Edit* mpConfirm1ED; + + VclFrame* mpPassword2Box; + FixedText* mpPassword2FT; + Edit* mpPassword2ED; + FixedText* mpConfirm2FT; + Edit* mpConfirm2ED; + + FixedText* mpMinLengthFT; + + OKButton* mpOKBtn; + + String maMinLenPwdStr; + String maEmptyPwdStr; + String maMainPwdStr; + sal_uInt16 mnMinLen; + sal_uInt16 mnExtras; + + bool mbAsciiOnly; + DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*); + DECL_DLLPRIVATE_LINK(OKHdl, void *); + + void SetPasswdText(); + +public: + SfxPasswordDialog(Window* pParent, const String* pGroupText = NULL); + + String GetUser() const + { + return mpUserED->GetText(); + } + String GetPassword() const + { + return mpPassword1ED->GetText(); + } + String GetConfirm() const + { + return mpConfirm1ED->GetText(); + } + String GetPassword2() const + { + return mpPassword2ED->GetText(); + } + String GetConfirm2() const + { + return mpConfirm2ED->GetText(); + } + void SetGroup2Text(const String& i_rText) + { + mpPassword2Box->set_label(i_rText); + } + void SetMinLen(sal_uInt16 Len); + void SetEditHelpId(const OString& rId) + { + mpPassword1ED->SetHelpId( rId ); + } + void ShowExtras(sal_uInt16 nExtras) + { + mnExtras = nExtras; + } + void AllowAsciiOnly(bool i_bAsciiOnly = true) + { + mbAsciiOnly = i_bAsciiOnly; + } + + void ShowMinLengthText(bool bShow); + + virtual short Execute(); +}; + +#endif // #ifndef _SFX_PASSWD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx new file mode 100644 index 000000000000..aac11a3bf4dc --- /dev/null +++ b/include/sfx2/printer.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_PRINTER_HXX +#define _SFX_PRINTER_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/print.hxx> + +class SfxTabPage; +class SfxItemSet; + +struct SfxPrinter_Impl; + +// class SfxPrinter ------------------------------------------------------ + +class SFX2_DLLPUBLIC SfxPrinter : public Printer +{ +private: + JobSetup aOrigJobSetup; + SfxItemSet* pOptions; + SfxPrinter_Impl* pImpl; + sal_Bool bKnown; + + SAL_DLLPRIVATE void operator =(SfxPrinter &); // not defined + + SAL_DLLPRIVATE void UpdateFonts_Impl(); + +public: + SfxPrinter( SfxItemSet *pTheOptions ); + SfxPrinter( SfxItemSet *pTheOptions, + const String &rPrinterName ); + SfxPrinter( SfxItemSet *pTheOptions, + const JobSetup &rTheOrigJobSetup ); + SfxPrinter( SfxItemSet *pTheOptions, + const String &rPrinterName, + const JobSetup &rTheOrigJobSetup ); + SfxPrinter( const SfxPrinter &rPrinter ); + ~SfxPrinter(); + + SfxPrinter* Clone() const; + + static SfxPrinter* Create( SvStream &rStream, SfxItemSet *pOptions ); + SvStream& Store( SvStream &rStream ) const; + + const JobSetup& GetOrigJobSetup() const { return aOrigJobSetup; } + void SetOrigJobSetup( const JobSetup &rNewJobSetup ); + + const SfxItemSet& GetOptions() const { return *pOptions; } + void SetOptions( const SfxItemSet &rNewOptions ); + + sal_Bool IsKnown() const { return bKnown; } + sal_Bool IsOriginal() const { return bKnown; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx new file mode 100644 index 000000000000..44d37d0a4558 --- /dev/null +++ b/include/sfx2/printopt.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_PRINTOPT_HXX +#define _SFX_PRINTOPT_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/print.hxx> + +#include <sfx2/tabdlg.hxx> + +// -------------------------------- +// - SfxCommonPrintOptionsTabPage - +// -------------------------------- + +class SvtBasePrintOptions; + +class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage : public SfxTabPage +{ +private: + + RadioButton* m_pPrinterOutputRB; + RadioButton* m_pPrintFileOutputRB; + + CheckBox* m_pReduceTransparencyCB; + RadioButton* m_pReduceTransparencyAutoRB; + RadioButton* m_pReduceTransparencyNoneRB; + + CheckBox* m_pReduceGradientsCB; + RadioButton* m_pReduceGradientsStripesRB; + RadioButton* m_pReduceGradientsColorRB; + NumericField* m_pReduceGradientsStepCountNF; + + CheckBox* m_pReduceBitmapsCB; + RadioButton* m_pReduceBitmapsOptimalRB; + RadioButton* m_pReduceBitmapsNormalRB; + RadioButton* m_pReduceBitmapsResolutionRB; + ListBox* m_pReduceBitmapsResolutionLB; + CheckBox* m_pReduceBitmapsTransparencyCB; + + CheckBox* m_pConvertToGreyscalesCB; + + CheckBox* m_pPDFCB; + + CheckBox* m_pPaperSizeCB; + CheckBox* m_pPaperOrientationCB; + CheckBox* m_pTransparencyCB; + +private: + + PrinterOptions maPrinterOptions; + PrinterOptions maPrintFileOptions; + + DECL_DLLPRIVATE_LINK( ToggleOutputPrinterRBHdl, RadioButton* pButton ); + DECL_DLLPRIVATE_LINK( ToggleOutputPrintFileRBHdl, RadioButton* pButton ); + + DECL_DLLPRIVATE_LINK( ClickReduceTransparencyCBHdl, CheckBox* pBox ); + DECL_DLLPRIVATE_LINK( ClickReduceGradientsCBHdl, CheckBox* pBox ); + DECL_DLLPRIVATE_LINK( ClickReduceBitmapsCBHdl, CheckBox* pBox ); + + DECL_DLLPRIVATE_LINK( ToggleReduceGradientsStripesRBHdl, RadioButton* pButton ); + DECL_DLLPRIVATE_LINK( ToggleReduceBitmapsResolutionRBHdl, RadioButton* pButton ); + + SAL_DLLPRIVATE void ImplUpdateControls( const PrinterOptions* pCurrentOptions ); + SAL_DLLPRIVATE void ImplSaveControls( PrinterOptions* pCurrentOptions ); + +protected: + + using TabPage::DeactivatePage; + virtual int DeactivatePage( SfxItemSet* pSet = NULL ); + +public: + + SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); + ~SfxCommonPrintOptionsTabPage(); + + virtual sal_Bool FillItemSet( SfxItemSet& rSet ); + virtual void Reset( const SfxItemSet& rSet ); + virtual Window* GetParentLabeledBy( const Window* pLabel ) const; + virtual Window* GetParentLabelFor( const Window* pLabel ) const; + + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); +}; + +#endif // #ifndef _SFX_PRINTOPT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx new file mode 100644 index 000000000000..0d14c616a7bc --- /dev/null +++ b/include/sfx2/prnmon.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_PRNMON_HXX +#define _SFX_PRNMON_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <sfx2/printer.hxx> + + +class SfxViewShell; + +// ------------------------------------------------------------------------ + +struct SfxPrintOptDlg_Impl; +class SfxPrintOptionsDialog : public ModalDialog +{ +private: + SfxPrintOptDlg_Impl* pDlgImpl; + SfxViewShell* pViewSh; + SfxItemSet* pOptions; + SfxTabPage* pPage; + +public: + SfxPrintOptionsDialog( Window *pParent, + SfxViewShell *pViewShell, + const SfxItemSet *rOptions ); + virtual ~SfxPrintOptionsDialog(); + + sal_Bool Construct(); + virtual short Execute(); + virtual long Notify( NotifyEvent& rNEvt ); + + SfxTabPage* GetTabPage() const { return pPage; } + const SfxItemSet& GetOptions() const { return *pOptions; } + void DisableHelp(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/progress.hxx b/include/sfx2/progress.hxx new file mode 100644 index 000000000000..285360272d30 --- /dev/null +++ b/include/sfx2/progress.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_PROGRESS_HXX +#define _SFX_PROGRESS_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/solar.h> +#include <tools/link.hxx> +#include <rtl/ustring.hxx> + +class String; +class SfxObjectShell; +struct SfxProgress_Impl; +struct PlugInLoadStatus; +struct SvProgressArg; + +//======================================================================= + +class SFX2_DLLPUBLIC SfxProgress +{ + SfxProgress_Impl* pImp; + sal_uIntPtr nVal; + sal_Bool bSuspended; + +public: + SfxProgress( SfxObjectShell* pObjSh, + const String& rText, + sal_uIntPtr nRange, sal_Bool bAllDocs = sal_False, + sal_Bool bWait = sal_True ); + virtual ~SfxProgress(); + + virtual void SetText( const OUString& rText ); + sal_Bool SetStateText( sal_uIntPtr nVal, const String &rVal, sal_uIntPtr nNewRange = 0 ); + virtual sal_Bool SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 ); + sal_uIntPtr GetState() const { return nVal; } + + void Resume(); + void Suspend(); + sal_Bool IsSuspended() const { return bSuspended; } + + void UnLock(); + void Reschedule(); + + void Stop(); + + static SfxProgress* GetActiveProgress( SfxObjectShell *pDocSh = 0 ); + static void EnterLock(); + static void LeaveLock(); + + DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus* ); + DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, DefaultBindingProgress, SvProgressArg* ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/querystatus.hxx b/include/sfx2/querystatus.hxx new file mode 100644 index 000000000000..475d3cd00765 --- /dev/null +++ b/include/sfx2/querystatus.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXQUERYSTATUS_HXX +#define _SFXQUERYSTATUS_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <svl/poolitem.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/conditn.hxx> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> + +#include <sfx2/sfxuno.hxx> + +class SfxQueryStatus_Impl; +class SFX2_DLLPUBLIC SfxQueryStatus +{ + public: + SfxQueryStatus( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand ); + ~SfxQueryStatus(); + + // Query method + SfxItemState QueryState( SfxPoolItem*& pPoolItem ); + + private: + SfxQueryStatus( const SfxQueryStatus& ); + SfxQueryStatus(); + SfxQueryStatus& operator=( const SfxQueryStatus& ); + + com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > m_xStatusListener; + SfxQueryStatus_Impl* m_pSfxQueryStatusImpl; +}; + +#endif // _SFXQUERYSTATUS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx new file mode 100644 index 000000000000..590fd7bffeaf --- /dev/null +++ b/include/sfx2/request.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXREQUEST_HXX +#define _SFXREQUEST_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <svl/itemset.hxx> +#include <svl/hint.hxx> + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XDispatchRecorder.hpp> + +class SfxPoolItem; +class SfxAllItemSet; +class SfxItemSet; +class SfxItemPool; +class SfxShell; +class SfxSlot; +class String; +class SfxViewFrame; +struct SfxRequest_Impl; + +//================================================================== + +class SFX2_DLLPUBLIC SfxRequest: public SfxHint +{ +friend struct SfxRequest_Impl; + + sal_uInt16 nSlot; + SfxAllItemSet* pArgs; + SfxRequest_Impl* pImp; + + //--------------------------------------------------------------------- +public: + SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot, + com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, + SfxViewFrame* ); +private: + SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet ); + + //--------------------------------------------------------------------- + +public: + SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId ); + SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, SfxItemPool &rPool ); + SfxRequest( const SfxSlot* pSlot, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs, + sal_uInt16 nCallMode, SfxItemPool &rPool ); + SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, const SfxAllItemSet& rSfxArgs ); + SfxRequest( const SfxRequest& rOrig ); + ~SfxRequest(); + + sal_uInt16 GetSlot() const { return nSlot; } + void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; } + + sal_uInt16 GetModifier() const; + void SetModifier( sal_uInt16 nModi ); + SAL_DLLPRIVATE void SetInternalArgs_Impl( const SfxAllItemSet& rArgs ); + SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const; + const SfxItemSet* GetArgs() const { return pArgs; } + void SetArgs( const SfxAllItemSet& rArgs ); + void AppendItem(const SfxPoolItem &); + void RemoveItem( sal_uInt16 nSlotId ); + + static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId, + bool bDeep = false, + TypeId aType = 0 ); + const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const; + void ReleaseArgs(); + void SetReturnValue(const SfxPoolItem &); + const SfxPoolItem* GetReturnValue() const; + + static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL ); + static sal_Bool HasMacroRecorder( SfxViewFrame* pFrame=NULL ); + sal_uInt16 GetCallMode() const; + void AllowRecording( sal_Bool ); + sal_Bool AllowsRecording() const; + sal_Bool IsAPI() const; + sal_Bool IsSynchronCall() const; + void SetSynchronCall( sal_Bool bSynchron ); + + sal_Bool IsDone() const; + void Done( sal_Bool bRemove = sal_False ); + + void Ignore(); + void Cancel(); + sal_Bool IsCancelled() const; + void Done(const SfxItemSet &, bool bKeep = true ); + + void ForgetAllArgs(); + +private: + const SfxRequest& operator=(const SfxRequest &); // n.i.!! +}; + +//------------------------------------------------------------------------ + +#define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \ + const ItemType *pItem = (const ItemType*) \ + rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) ) +#define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \ + const ItemType *pItem = (const ItemType*) \ + SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx new file mode 100644 index 000000000000..994fd0befa41 --- /dev/null +++ b/include/sfx2/securitypage.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SECURITYPAGE_HXX_ +#define _SECURITYPAGE_HXX_ + +#include "sfx2/tabdlg.hxx" +#include "sfx2/htmlmode.hxx" + +#include <memory> + + + +struct SfxSecurityPage_Impl; + +class SfxSecurityPage : public SfxTabPage +{ + std::auto_ptr< SfxSecurityPage_Impl > m_pImpl; + +protected: + SfxSecurityPage( Window* pParent, const SfxItemSet& ); + virtual ~SfxSecurityPage(); + + virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); +}; + + +#endif // #ifndef _SECURITYPAGE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc new file mode 100644 index 000000000000..245daa2f062a --- /dev/null +++ b/include/sfx2/sfx.hrc @@ -0,0 +1,289 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_HRC +#define _SFX_HRC + +#include <svl/solar.hrc> +#include <svl/memberid.hrc> + +#define RID_GROUPS_OFFSET 32000 +#define RID_GROUPS_SFXOFFSET 32700 +#define RID_GROUPS_END 32767 + +//-------------------------------------------------------------------- + +#define EVENT_SFX_START 5000 +// EVENT_SFX_END 9999 + +// EVENT_LIB_START 10000 +// EVENT_LIB_END 19999 + +#define EVENT_APP_START 20000 +// EVENT_APP_END 29999 + +#define EVENT_OBJ_START 30000 + +#define EVENT_SVX_START (EVENT_OBJ_START+0x0400) + +// Warning: the following are simultaneously SID_ON_ ... +#define SFX_EVENT_CLOSEAPP (EVENT_SFX_START + 1) +#define SFX_EVENT_CREATEDOC (EVENT_SFX_START + 2) +#define SFX_EVENT_OPENDOC (EVENT_SFX_START + 3) +#define SFX_EVENT_CLOSEDOC (EVENT_SFX_START + 4) +#define SFX_EVENT_SAVEDOC (EVENT_SFX_START + 5) +#define SFX_EVENT_SAVEASDOC (EVENT_SFX_START + 6) +#define SFX_EVENT_ACTIVATEDOC (EVENT_SFX_START + 7) +#define SFX_EVENT_DEACTIVATEDOC (EVENT_SFX_START + 8) +#define SFX_EVENT_PRINTDOC (EVENT_SFX_START + 9) +#define SFX_EVENT_SAVEACOPY (EVENT_SFX_START + 10) + +#define SFX_EVENT_LOADFINISHED (EVENT_SFX_START + 11) + +#define SFX_EVENT_MODIFYCHANGED (EVENT_SFX_START + 13) +#define SFX_EVENT_PREPARECLOSEDOC (EVENT_SFX_START + 14) +#define SFX_EVENT_TOGGLEFULLSCREENMODE (EVENT_SFX_START + 16) +#define SFX_EVENT_SAVEDOCDONE (EVENT_SFX_START + 17) +#define SFX_EVENT_SAVEASDOCDONE (EVENT_SFX_START + 18) + +#define SFX_EVENT_SAVETODOC (EVENT_SFX_START + 19) +#define SFX_EVENT_SAVETODOCDONE (EVENT_SFX_START + 20) + +#define SFX_EVENT_VIEWCREATED (EVENT_SFX_START + 21) +#define SFX_EVENT_PREPARECLOSEVIEW (EVENT_SFX_START + 22) +#define SFX_EVENT_CLOSEVIEW (EVENT_SFX_START + 23) + +#define SFX_EVENT_STORAGECHANGED (EVENT_SFX_START + 24) +#define SFX_EVENT_VISAREACHANGED (EVENT_SFX_START + 25) + +#define SFX_EVENT_DOCCREATED (EVENT_SFX_START + 26) + +#define SFX_EVENT_SAVEASDOCFAILED (EVENT_SFX_START + 27) +#define SFX_EVENT_SAVEDOCFAILED (EVENT_SFX_START + 28) +#define SFX_EVENT_SAVETODOCFAILED (EVENT_SFX_START + 29) + + +// Events for Controls etc. +#define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 ) +#define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 ) +#define SFX_EVENT_MOUSEOUT_OBJECT ( EVENT_SFX_START + 102 ) + +//-------------------------------------------------------------------- + +#define RID_SFX_APP_START (RID_SFX_START + 256) +#define RID_SFX_MENU_START (RID_SFX_START + 768) +// RID_SFX_CONFIG_START (RID_SFX_START + 1536) +#define RID_SFX_DOC_START (RID_SFX_START + 1792) +#define RID_SFX_DIALOG_START (RID_SFX_START + 2048) +#define RID_SFX_BASTYP_START (RID_SFX_START + 2304) +#define RID_SFX_EXPLORER_START (RID_SFX_START + 2816) + +// RID_CNT_START (RID_SFX_START + 3072) + +#define RID_SFX_SFXLOCAL_START (RID_SFX_START + 3082) +#define RID_SFX_VIEW_START (RID_SFX_START + 4096) +// RID_CNT_START2 (RID_SFX_START + 4500) +// RID_SFX_CHAOSDOC_START (RID_SFX_START + 5120) +// RID_SFX_TPLCOMPONENT_START (RID_SFX_START + 6800) +// RID_SFX_HELPCOMPONENT_START (RID_SFX_START + 7000) + +//-------------------------------------------------------------------- + +#define SFX_OBJECTBAR_APPLICATION 0 +#define SFX_OBJECTBAR_OBJECT 1 +#define SFX_OBJECTBAR_TOOLS 2 +#define SFX_OBJECTBAR_MACRO 3 +#define SFX_OBJECTBAR_FULLSCREEN 4 +#define SFX_OBJECTBAR_RECORDING 5 +#define SFX_OBJECTBAR_COMMONTASK 6 +#define SFX_OBJECTBAR_OPTIONS 7 +#define SFX_OBJECTBAR_NAVIGATION 12 +#define SFX_OBJECTBAR_MAX 13 + +// temporary due to compatibility + + +#define MSG_QUERY_LASTVERSION RID_SFX_START + +#define RID_APPLICATION RID_SFX_START +#define RID_DEFAULTIMAGELIST_SC (RID_SFX_START+15) +#define RID_DEFAULTIMAGELIST_LC (RID_SFX_START+17) + +#define RID_STYLECATALOG (RID_SFX_START+1201) + +#define RID_DEFAULTABOUT (RID_SFX_START+0) + +#define RID_APPTITLE (RID_SFX_START+4) + +#define DLG_DOCINFO_EDT (RID_SFX_START+6) + +#define DLG_STYLE_DESIGNER (RID_SFX_START+8) + +#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+216) + +#define STR_STYLE_FILTER_AUTO (RID_SFX_START+9) +#define STR_STYLE_FILTER_USED (RID_SFX_START+10) +#define STR_STYLE_FILTER_USERDEF (RID_SFX_START+11) +#define STR_STYLE_FILTER_ALL (RID_SFX_START+12) +// +13 already used! +#define STR_STYLE_FILTER_HIERARCHICAL (RID_SFX_START+1200) + +#define STR_NONAME (RID_SFX_START+100) +#define STR_NONE (RID_SFX_START+101) +#define STR_CLOSE (RID_SFX_START+103) +#define STR_STANDARD (RID_SFX_START+104) +#define STR_READONLY (RID_SFX_START+105) + +#define STR_SFX_FILTERNAME_ALL (RID_SFX_START+106) +#define STR_EDIT (RID_SFX_START+108) +#define STR_QUERY_SAVE_DOCUMENT (RID_SFX_START+110) +#define STR_BYTES (RID_SFX_START+111) +#define STR_KB (RID_SFX_START+112) +#define STR_MB (RID_SFX_START+113) +#define STR_GB (RID_SFX_START+114) +#define STR_QUERY_SAVE_DOCUMENT_TITLE (RID_SFX_START+115) + +#define STR_STANDARD_SHORTCUT (RID_SFX_START+117) +#define STR_REPAIREDDOCUMENT (RID_SFX_START+118) +#define STR_ERRUNOEVENTBINDUNG (RID_SFX_START+119) +#define STR_SHARED (RID_SFX_START+120) +#define RID_XMLSEC_DOCUMENTSIGNED (RID_SFX_START+121) +#define STR_PASSWD (RID_SFX_START+122) +#define STR_PASSWD_EMPTY (RID_SFX_START+123) +#define STR_PASSWD_MIN_LEN (RID_SFX_START+124) +#define STR_NONCHECKEDOUT_DOCUMENT (RID_SFX_START+125) +#define BT_CHECKOUT (RID_SFX_START+126) +#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157) + +#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158) +#define SFX_THUMBNAIL_SHEET (RID_SFX_START+159) +#define SFX_THUMBNAIL_PRESENTATION (RID_SFX_START+160) +#define SFX_THUMBNAIL_DRAWING (RID_SFX_START+161) + +//========================================================================= + +// group ids +//========================================================================= +// !! If you add a new group, please change sfxbasecontroller.cxx and +// !! com.sun.star.frame.CommandGroup accordingly! +//========================================================================= + +#define GID_INTERN (RID_GROUPS_SFXOFFSET+ 0) +#define GID_APPLICATION (RID_GROUPS_SFXOFFSET+ 1) +#define GID_DOCUMENT (RID_GROUPS_SFXOFFSET+ 2) +#define GID_VIEW (RID_GROUPS_SFXOFFSET+ 3) +#define GID_EDIT (RID_GROUPS_SFXOFFSET+ 4) +#define GID_MACRO (RID_GROUPS_SFXOFFSET+ 5) +#define GID_OPTIONS (RID_GROUPS_SFXOFFSET+ 6) +#define GID_MATH (RID_GROUPS_SFXOFFSET+ 7) +#define GID_NAVIGATOR (RID_GROUPS_SFXOFFSET+ 8) +#define GID_INSERT (RID_GROUPS_SFXOFFSET+ 9) +#define GID_FORMAT (RID_GROUPS_SFXOFFSET+10) +#define GID_TEMPLATE (RID_GROUPS_SFXOFFSET+11) +#define GID_TEXT (RID_GROUPS_SFXOFFSET+12) +#define GID_FRAME (RID_GROUPS_SFXOFFSET+13) +#define GID_GRAPHIC (RID_GROUPS_SFXOFFSET+14) +#define GID_TABLE (RID_GROUPS_SFXOFFSET+15) +#define GID_ENUMERATION (RID_GROUPS_SFXOFFSET+16) +#define GID_DATA (RID_GROUPS_SFXOFFSET+17) +#define GID_SPECIAL (RID_GROUPS_SFXOFFSET+18) +#define GID_IMAGE (RID_GROUPS_SFXOFFSET+19) +#define GID_CHART (RID_GROUPS_SFXOFFSET+20) +#define GID_EXPLORER (RID_GROUPS_SFXOFFSET+21) +#define GID_CONNECTOR (RID_GROUPS_SFXOFFSET+22) +#define GID_MODIFY (RID_GROUPS_SFXOFFSET+23) +#define GID_DRAWING (RID_GROUPS_SFXOFFSET+24) +#define GID_CONTROLS (RID_GROUPS_SFXOFFSET+25) +#define GID_NAVIGATION (RID_GROUPS_SFXOFFSET+26) + +// ========================================================================= + +#define RID_OPTIONS_START (SID_LIB_START + 2000) +// RID_OPTIONS_END (RID_OPTIONS_START + 100) + +// ResId's ------------------------------------------------------------------ + +#define RID_SFXPAGE_SAVE (RID_OPTIONS_START + 0) +#define RID_SFXPAGE_GENERAL (RID_OPTIONS_START + 1) +#define RID_SFXDLG_NEWDICT (RID_OPTIONS_START + 3) +#define RID_SFXDLG_EDITDICT (RID_OPTIONS_START + 4) +#define RID_SFXQB_DELDICT (RID_OPTIONS_START + 5) +#define RID_SFXPAGE_PATH (RID_OPTIONS_START + 6) +#define RID_SFXPAGE_LINGU (RID_OPTIONS_START + 7) +#define RID_SFXQB_SET_LANGUAGE (RID_OPTIONS_START + 10) +#define RID_SFXPAGE_PRINTOPTIONS (RID_OPTIONS_START + 12) + +#define RID_STR_NEW_TASK (RID_SFX_DOC_START+ 76) + +// Member-Ids ------------------------------------------------------------ + +#define MID_DOCINFO_DESCRIPTION 0x13 +#define MID_DOCINFO_KEYWORDS 0x17 +#define MID_DOCINFO_SUBJECT 0x1b +#define MID_DOCINFO_TITLE 0x1d +#define MID_DOCINFO_AUTOLOADENABLED 0x2d +#define MID_DOCINFO_AUTOLOADURL 0x2e +#define MID_DOCINFO_AUTOLOADSECS 0x2f +#define MID_DOCINFO_DEFAULTTARGET 0x30 +#define MID_DOCINFO_USEUSERDATA 0x31 +#define MID_DOCINFO_DELETEUSERDATA 0x32 + +// only for FastPropertySet +#define MID_DOCINFO_REVISION 0x15 +#define MID_DOCINFO_EDITTIME 0x16 +#define MID_DOCINFO_MODIFICATIONAUTHOR 0x18 +#define MID_DOCINFO_TEMPLATE 0x1c +#define MID_DOCINFO_PRINTDATE 0x28 +#define MID_DOCINFO_PRINTEDBY 0x2a +#define MID_DOCINFO_TEMPLATEDATE 0x2b +#define MID_DOCINFO_STATISTIC 0x33 +#define MID_DOCINFO_CHARLOCALE 0x34 +#define MID_CATEGORY 0x35 +#define MID_COMPANY 0x36 +#define MID_MANAGER 0x37 +#define MID_TYPE 0x38 +#define MID_VALUE 0x39 +#define MID_VALUESET 0x40 + +// Config-Ids ----------------------------------------------------------- + +#define SFX_ITEMTYPE_SW_BEGIN 20000 +// SFX_ITEMTYPE_SW_END 22999 + +#define SFX_ITEMTYPE_SD_BEGIN 23000 +// SFX_ITEMTYPE_SD_END 25999 + +#define SFX_ITEMTYPE_SC_BEGIN 26000 +// SFX_ITEMTYPE_SC_END 27999 + +// free: 28000-32767 + +// Slot-Ids ------------------------------------------------------------- + +#include <sfx2/sfxsids.hrc> + +#define HID_INTERFACE_SFXHELP_VIEWSH 24 + +#define RET_NEWTASK 200 + +#endif // #ifndef _SFX_HRC + +// ******************************************************************* EOF + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx new file mode 100644 index 000000000000..df2635f711ed --- /dev/null +++ b/include/sfx2/sfxbasecontroller.hxx @@ -0,0 +1,386 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_SFXBASECONTROLLER_HXX_ +#define _SFX_SFXBASECONTROLLER_HXX_ + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/frame/XController2.hpp> +#include <com/sun/star/frame/XControllerBorder.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <cppuhelper/implbase9.hxx> +#include <cppuhelper/basemutex.hxx> +#include <osl/mutex.hxx> +#include <com/sun/star/task/XStatusIndicatorSupplier.hpp> +#include <com/sun/star/ui/XContextMenuInterception.hpp> +#include <com/sun/star/ui/XContextMenuInterceptor.hpp> +#include <com/sun/star/awt/XMouseClickHandler.hpp> +#include <com/sun/star/awt/XKeyHandler.hpp> +#include <com/sun/star/awt/XUserInputInterception.hpp> +#include <tools/link.hxx> +#include <vcl/button.hxx> + +#include <sfx2/viewsh.hxx> +#include <sfx2/sfxuno.hxx> + +struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController + +class SfxViewFrame; + +sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID ); + +//________________________________________________________________________________________________________ +// class declarations +//________________________________________________________________________________________________________ + +typedef ::cppu::WeakImplHelper9 < css::frame::XController2 + , css::frame::XControllerBorder + , css::frame::XDispatchProvider + , css::task::XStatusIndicatorSupplier + , css::ui::XContextMenuInterception + , css::awt::XUserInputInterception + , css::frame::XDispatchInformationProvider + , css::frame::XTitle + , css::frame::XTitleChangeBroadcaster + > SfxBaseController_Base; + +class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base + ,public ::cppu::BaseMutex +{ +//________________________________________________________________________________________________________ +// public methods +//________________________________________________________________________________________________________ + +public: + + //____________________________________________________________________________________________________ + // constructor/destructor + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + SfxBaseController( SfxViewShell* pView ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + ~SfxBaseController() ; + + SAL_DLLPRIVATE void ReleaseShell_Impl(); + SAL_DLLPRIVATE void BorderWidthsChanged_Impl(); + + css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XController2 + //____________________________________________________________________________________________________ + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getViewControllerName() throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XController + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + css::uno::Any SAL_CALL getViewData() throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + void SAL_CALL restoreViewData( const css::uno::Any& aValue ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + css::uno::Reference< css::frame::XModel > SAL_CALL getModel() throw( css::uno::RuntimeException ) ; + + //____________________________________________________________________________________________________ + // XDispatchProvider + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL , + const OUString & sTargetFrameName, + FrameSearchFlags eSearchFlags ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) throw( css::uno::RuntimeException ) ; + + //____________________________________________________________________________________________________ + // XControllerBorder + //____________________________________________________________________________________________________ + + virtual css::frame::BorderWidths SAL_CALL getBorder() throw (css::uno::RuntimeException); + virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException); + virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XComponent + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL dispose() throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ; + virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + + virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException); + virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XDispatchInformationProvider + //____________________________________________________________________________________________________ + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException); + + // css::frame::XTitle + virtual OUString SAL_CALL getTitle( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setTitle( const OUString& sTitle ) throw (css::uno::RuntimeException); + + // css::frame::XTitleChangeBroadcaster + virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException); + + // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now; + // either the _Impl name should vanish or there should be an "official" API + SfxViewShell* GetViewShell_Impl() const; + SAL_DLLPRIVATE sal_Bool HandleEvent_Impl( NotifyEvent& rEvent ); + SAL_DLLPRIVATE sal_Bool HasKeyListeners_Impl(); + SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl(); + SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs ); + SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); +private: + enum ConnectSfxFrame + { + E_CONNECT, + E_DISCONNECT, + E_RECONNECT + }; + SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ); + SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const; + SAL_DLLPRIVATE void ShowInfoBars( ); + + DECL_LINK( CheckOutHandler, void * ); + +//________________________________________________________________________________________________________ +// private variables +//________________________________________________________________________________________________________ + +private: + + IMPL_SfxBaseController_DataContainer* m_pData ; + +} ; // class SfxBaseController + +#endif // _SFX_SFXBASECONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx new file mode 100644 index 000000000000..524c86b0b99d --- /dev/null +++ b/include/sfx2/sfxbasemodel.hxx @@ -0,0 +1,1554 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_SFXBASEMODEL_HXX_ +#define _SFX_SFXBASEMODEL_HXX_ + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XModule.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/frame/XController2.hpp> +#include <com/sun/star/document/XCmisDocument.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentRecovery.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> +#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/document/EventObject.hpp> +#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XScriptInvocationContext.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/NotInitializedException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/DoubleInitializationException.hpp> +#include <com/sun/star/util/XModifiable2.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XCloseBroadcaster.hpp> +#include <com/sun/star/util/XCloseListener.hpp> +#include <com/sun/star/util/CloseVetoException.hpp> +#include <com/sun/star/view/XPrintable.hpp> +#include <com/sun/star/view/XPrintJobBroadcaster.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XStorable2.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager2.hpp> +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <com/sun/star/script/XStarBasicAccess.hpp> +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> + +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> + +#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32 +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32 +#include <comphelper/implbase_var.hxx> +#endif + +#include <svl/lstner.hxx> + +class SfxMedium; +class SfxPrinter; +class SfxViewShell; +class SfxObjectShell ; +class SfxEventHint; +class SfxViewFrame; +struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel + +namespace sfx { namespace intern { + class ViewCreationGuard; +} } +//________________________________________________________________________________________________________ +// class declarations +//________________________________________________________________________________________________________ + +/**_______________________________________________________________________________________________________ + @short - + + @descr - + + @implements XChild + XComponent + document::XDocumentPropertiesSupplier + rdf::XDocumentMetadataAccess + XEventListener + XModel + XModifiable2 + XPrintable + XStorable2 + document::XEventBroadcaster + document::XEventsSupplier + document::XEmbeddedScripts + document::XScriptInvocationContext + XCloseable + XCloseBroadcaster + + @base cppu::BaseMutex + SfxListener +*/ + +typedef ::comphelper::WeakImplHelper32 < css::container::XChild + , css::document::XDocumentPropertiesSupplier + , css::document::XCmisDocument + , css::rdf::XDocumentMetadataAccess + , css::document::XDocumentRecovery + , css::document::XUndoManagerSupplier + , css::document::XEventBroadcaster + , css::document::XDocumentEventBroadcaster + , css::lang::XEventListener + , css::document::XEventsSupplier + , css::document::XEmbeddedScripts + , css::document::XScriptInvocationContext + , css::frame::XModel2 + , css::util::XModifiable2 + , css::view::XPrintable + , css::view::XPrintJobBroadcaster + , css::frame::XStorable2 + , css::frame::XLoadable + , css::script::XStarBasicAccess + , css::document::XViewDataSupplier + , css::util::XCloseable // => css::util::XCloseBroadcaster + , css::datatransfer::XTransferable + , css::document::XDocumentSubStorageSupplier + , css::document::XStorageBasedDocument + , css::script::provider::XScriptProviderSupplier + , css::ui::XUIConfigurationManagerSupplier + , css::embed::XVisualObject + , css::lang::XUnoTunnel + , css::frame::XModule + , css::frame::XTitle + , css::frame::XTitleChangeBroadcaster + , css::frame::XUntitledNumbers + > SfxBaseModel_Base; + +class SFX2_DLLPUBLIC SfxBaseModel : protected ::cppu::BaseMutex + , public SfxBaseModel_Base + , public SfxListener +{ + +//________________________________________________________________________________________________________ +// public methods +//________________________________________________________________________________________________________ + +public: + + //____________________________________________________________________________________________________ + // constructor/destructor + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + SfxBaseModel( SfxObjectShell *pObjektShell = NULL ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual ~SfxBaseModel() ; + + //____________________________________________________________________________________________________ + // XInterface + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short give answer, if interface is supported + @descr The interfaces are searched by type. + + @seealso XInterface + + @param "rType" is the type of searched interface. + + @return Any information about found interface + + @onerror A RuntimeException is thrown. + */ + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short increment refcount + @descr - + + @seealso XInterface + @seealso release() + + @param - + + @return - + + @onerror A RuntimeException is thrown. + */ + + virtual void SAL_CALL acquire() throw() ; + + /**___________________________________________________________________________________________________ + @short decrement refcount + @descr - + + @seealso XInterface + @seealso acquire() + + @param - + + @return - + + @onerror A RuntimeException is thrown. + */ + + virtual void SAL_CALL release() throw() ; + + //____________________________________________________________________________________________________ + // XTypeProvider + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short get information about supported interfaces + @descr - + + @seealso XTypeProvider + + @param - + + @return Sequence of types of all supported interfaces + + @onerror A RuntimeException is thrown. + */ + + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short get implementation id + @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled. + Another way, cache is enabled. + + @seealso XTypeProvider + + @param - + + @return ID as Sequence of byte + + @onerror A RuntimeException is thrown. + */ + + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException ) ; + + + //____________________________________________________________________________________________________ + // XStarBasicAccess + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @seealso XStarBasicAccess + */ + virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getLibraryContainer() throw( css::uno::RuntimeException ); + + /**___________________________________________________________________________________________________ + @seealso XStarBasicAccess + */ + virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password, + const OUString& ExternalSourceURL, const OUString& LinkTargetURL ) + throw(css::container::ElementExistException, css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @seealso XStarBasicAccess + */ + virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName, + const OUString& Language, const OUString& Source ) + throw( css::container::NoSuchElementException, css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @seealso XStarBasicAccess + */ + virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName, + const css::uno::Sequence< sal_Int8 >& Data ) + throw(css::container::NoSuchElementException, css::uno::RuntimeException); + + + //____________________________________________________________________________________________________ + // XChild + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) throw(css::lang::NoSupportException, + css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XComponent + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException); + + // XDocumentPropertiesSupplier + virtual css::uno::Reference< css::document::XDocumentProperties > + SAL_CALL getDocumentProperties() + throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XEventListener + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XModel + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL attachResource(const OUString& sURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs) + throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual OUString SAL_CALL getURL() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL lockControllers() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL unlockControllers() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL hasControllersLocked() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) + throw (css::container::NoSuchElementException, css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XModel2 + //____________________________________________________________________________________________________ + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL getControllers() + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< OUString > SAL_CALL getAvailableViewControllerNames() + throw (css::uno::RuntimeException); + + virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& Frame ) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ); + + virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController(const OUString& ViewName , + const css::uno::Sequence< css::beans::PropertyValue >& Arguments , + const css::uno::Reference< css::frame::XFrame >& Frame ) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ); + + //____________________________________________________________________________________________________ + // XModifiable2 + //____________________________________________________________________________________________________ + + virtual ::sal_Bool SAL_CALL disableSetModified( ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL enableSetModified( ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSetModifiedEnabled( ) throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setModified( sal_Bool bModified ) + throw (css::beans::PropertyVetoException, css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) throw( css::uno::RuntimeException ) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & xListener) throw( css::uno::RuntimeException ) ; + + //____________________________________________________________________________________________________ + // XCloseable + //____________________________________________________________________________________________________ + + virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XCloseBroadcaster + //____________________________________________________________________________________________________ + + virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XPrintJobBroadcaster + //____________________________________________________________________________________________________ + + virtual void SAL_CALL addPrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removePrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XPrintable + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPrinter() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setPrinter( const css::uno::Sequence< css::beans::PropertyValue >& seqPrinter ) + throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL print( const css::uno::Sequence< css::beans::PropertyValue >& seqOptions ) + throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XStorable2 + //____________________________________________________________________________________________________ + + virtual void SAL_CALL storeSelf( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) + throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XStorable + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL hasLocation() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual OUString SAL_CALL getLocation() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL isReadonly() throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL store() throw (css::io::IOException, css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL storeAsURL( const OUString& sURL, + const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) + throw (css::io::IOException, css::uno::RuntimeException) ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL storeToURL( const OUString& sURL, + const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) + throw (css::io::IOException, css::uno::RuntimeException); + + + + //____________________________________________________________________________________________________ + // XLoadable + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL initNew() + throw (css::frame::DoubleInitializationException, + css::io::IOException, + css::uno::RuntimeException, + css::uno::Exception); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL load( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ) + throw (css::frame::DoubleInitializationException, + css::io::IOException, + css::uno::RuntimeException, + css::uno::Exception); + + //____________________________________________________________________________________________________ + // XDocumentSubStorageSupplier + //____________________________________________________________________________________________________ + + virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode ) + throw ( css::uno::RuntimeException ); + + virtual css::uno::Sequence< OUString > SAL_CALL getDocumentSubStoragesNames() + throw ( css::io::IOException, css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XStorageBasedDocument + //____________________________________________________________________________________________________ + + virtual void SAL_CALL loadFromStorage( const css::uno::Reference< css::embed::XStorage >& xStorage, + const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) + throw ( css::lang::IllegalArgumentException, + com::sun::star::frame::DoubleInitializationException, + css::io::IOException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage, + const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor ) + throw ( css::lang::IllegalArgumentException, + css::io::IOException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual void SAL_CALL switchToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage ) + throw ( css::lang::IllegalArgumentException, + css::io::IOException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentStorage() + throw ( css::io::IOException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual void SAL_CALL addStorageChangeListener( + const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) + throw ( css::uno::RuntimeException ); + + virtual void SAL_CALL removeStorageChangeListener( + const css::uno::Reference< css::document::XStorageChangeListener >& xListener ) + throw ( css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XVisualObject + //____________________________________________________________________________________________________ + + virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) + throw ( css::lang::IllegalArgumentException, + css::embed::WrongStateException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) + throw ( css::lang::IllegalArgumentException, + css::embed::WrongStateException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) + throw ( css::lang::IllegalArgumentException, + css::embed::WrongStateException, + css::uno::Exception, + css::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) + throw ( css::uno::Exception, + css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XScriptProviderSupplier + //____________________________________________________________________________________________________ + + virtual css::uno::Reference< css::script::provider::XScriptProvider > SAL_CALL getScriptProvider() throw ( css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XUIConfigurationManagerSupplier + //____________________________________________________________________________________________________ + virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager() throw ( css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XTransferable + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) + throw (css::datatransfer::UnsupportedFlavorException, + css::io::IOException, + css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + + virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() + throw (css::uno::RuntimeException); + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) + throw (css::uno::RuntimeException); + + + //____________________________________________________________________________________________________ + // XEventsSupplier + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - offers a list of event handlers which are be bound to events of + this object. + @seealso - + + @param - + + @return - an <type>Events</type> object. + + @onerror - + */ + + virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() throw( css::uno::RuntimeException ); + + + //____________________________________________________________________________________________________ + // XEmbeddedScripts + //____________________________________________________________________________________________________ + + virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAllowMacroExecution() throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XScriptInvocationContext + //____________________________________________________________________________________________________ + + virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XEventBroadcaster + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - registers the given <type>XEventListener</type>. + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + /**___________________________________________________________________________________________________ + @short - + @descr - unregisters the given <type>XEventListener</type>. + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XDocumentEventBroadcaster + //____________________________________________________________________________________________________ + + virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL notifyDocumentEvent( const OUString& _EventName, const css::uno::Reference< css::frame::XController2 >& _ViewController, const css::uno::Any& _Supplement ) throw (css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + // XUnoTunnel + //____________________________________________________________________________________________________ + + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException); + + // css.frame.XModule + virtual void SAL_CALL setIdentifier(const OUString& sIdentifier) + throw (css::uno::RuntimeException); + + // css.frame.XModule + virtual OUString SAL_CALL getIdentifier() + throw (css::uno::RuntimeException); + + // css.frame.XTitle + virtual OUString SAL_CALL getTitle() + throw (css::uno::RuntimeException); + + // css.frame.XTitle + virtual void SAL_CALL setTitle( const OUString& sTitle ) + throw (css::uno::RuntimeException); + + // css.frame.XTitleChangeBroadcaster + virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) + throw (css::uno::RuntimeException); + + // css.frame.XTitleChangeBroadcaster + virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) + throw (css::uno::RuntimeException); + + // css.frame.XUntitledNumbers + virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual OUString SAL_CALL getUntitledPrefix() + throw (css::uno::RuntimeException); + + // css.document.XDocumentRecovery + virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() + throw ( css::uno::RuntimeException ); + virtual void SAL_CALL storeToRecoveryFile( const OUString& i_TargetLocation, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) + throw ( css::uno::RuntimeException, + css::io::IOException, + css::lang::WrappedTargetException ); + virtual void SAL_CALL recoverFromFile( const OUString& i_SourceLocation, const OUString& i_SalvagedFile, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor ) + throw ( css::uno::RuntimeException, + css::io::IOException, + css::lang::WrappedTargetException ); + + // css.document.XUndoManagerSupplier + virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager( ) throw (css::uno::RuntimeException); + + //____________________________________________________________________________________________________ + + // css::rdf::XNode: + virtual OUString SAL_CALL getStringValue() + throw (css::uno::RuntimeException); + + // css::rdf::XURI: + virtual OUString SAL_CALL getNamespace() + throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getLocalName() + throw (css::uno::RuntimeException); + + // css::rdf::XRepositorySupplier: + virtual css::uno::Reference< + css::rdf::XRepository > SAL_CALL getRDFRepository() + throw (css::uno::RuntimeException); + + // css::rdf::XDocumentMetadataAccess: + virtual css::uno::Reference< + css::rdf::XMetadatable > SAL_CALL + getElementByMetadataReference( + const css::beans::StringPair & i_rReference) + throw (css::uno::RuntimeException); + virtual css::uno::Reference< + css::rdf::XMetadatable > SAL_CALL + getElementByURI(const css::uno::Reference< + css::rdf::XURI > & i_xURI) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException); + virtual css::uno::Sequence< css::uno::Reference< + css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType( + const css::uno::Reference< + css::rdf::XURI > & i_xType) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException); + virtual css::uno::Reference< + css::rdf::XURI> SAL_CALL + addMetadataFile(const OUString & i_rFileName, + const css::uno::Sequence< + css::uno::Reference< css::rdf::XURI > + > & i_rTypes) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::container::ElementExistException); + virtual css::uno::Reference< + css::rdf::XURI> SAL_CALL + importMetadataFile(::sal_Int16 i_Format, + const css::uno::Reference< + css::io::XInputStream > & i_xInStream, + const OUString & i_rFileName, + const css::uno::Reference< + css::rdf::XURI > & i_xBaseURI, + const css::uno::Sequence< + css::uno::Reference< css::rdf::XURI > + > & i_rTypes) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::datatransfer::UnsupportedFlavorException, + css::container::ElementExistException, + css::rdf::ParseException, + css::io::IOException); + virtual void SAL_CALL removeMetadataFile( + const css::uno::Reference< + css::rdf::XURI > & i_xGraphName) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::container::NoSuchElementException); + virtual void SAL_CALL addContentOrStylesFile( + const OUString & i_rFileName) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::container::ElementExistException); + virtual void SAL_CALL removeContentOrStylesFile( + const OUString & i_rFileName) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::container::NoSuchElementException); + + virtual void SAL_CALL loadMetadataFromStorage( + const css::uno::Reference< + css::embed::XStorage > & i_xStorage, + const css::uno::Reference< + css::rdf::XURI > & i_xBaseURI, + const css::uno::Reference< + css::task::XInteractionHandler> & i_xHandler) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::lang::WrappedTargetException); + virtual void SAL_CALL storeMetadataToStorage( + const css::uno::Reference< + css::embed::XStorage > & i_xStorage) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::lang::WrappedTargetException); + virtual void SAL_CALL loadMetadataFromMedium( + const css::uno::Sequence< + css::beans::PropertyValue > & i_rMedium) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::lang::WrappedTargetException); + virtual void SAL_CALL storeMetadataToMedium( + const css::uno::Sequence< + css::beans::PropertyValue > & i_rMedium) + throw (css::uno::RuntimeException, + css::lang::IllegalArgumentException, + css::lang::WrappedTargetException); + + // XCmisDocument + + virtual css::uno::Sequence< css::beans::PropertyValue > + SAL_CALL getCmisPropertiesValues() + throw (css::uno::RuntimeException); + virtual void SAL_CALL setCmisPropertiesValues( + const css::uno::Sequence< + css::beans::PropertyValue >& _cmispropertiesvalues ) + throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::beans::PropertyValue > + SAL_CALL getCmisPropertiesDisplayNames() + throw (css::uno::RuntimeException); + virtual void SAL_CALL setCmisPropertiesDisplayNames( + const css::uno::Sequence< + css::beans::PropertyValue >& _cmispropertiesdisplaynames ) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL checkOut( ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL cancelCheckOut( ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage ) + throw ( css::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isVersionable( ) throw ( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCheckOut( ) throw ( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCancelCheckOut( ) throw ( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCheckIn( ) throw ( css::uno::RuntimeException ); + + sal_Bool getBoolPropertyValue( const OUString& rName ) throw ( css::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // SfxListener + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + void Notify( SfxBroadcaster& aBC , + const SfxHint& aHint ) ; + + //____________________________________________________________________________________________________ + // public IMPL? + //____________________________________________________________________________________________________ + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + void changing() ; + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + SfxObjectShell* GetObjectShell() const ; + + SAL_DLLPRIVATE sal_Bool impl_isDisposed() const ; + sal_Bool IsInitialized() const; + sal_Bool IsDisposed() const { return impl_isDisposed(); } + void MethodEntryCheck( const bool i_mustBeInitialized ) const; + ::osl::Mutex& getMutex() const { return m_aMutex; } + + css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() throw (css::uno::RuntimeException); + void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) throw (css::uno::RuntimeException); + + /** calls all XEventListeners */ + void notifyEvent( const css::document::EventObject& aEvent ) const; + + /** returns true if someone added a XEventListener to this XEventBroadcaster */ + sal_Bool hasEventListeners() const; + +protected: + + /* returns a unique id for the model that is valid as long as the document + is loaded. The id is not saved across document close/reload. */ + OUString getRuntimeUID() const; + + /* returns true if the document signatures are valid, otherwise false */ + sal_Bool hasValidSignatures() const; + +//________________________________________________________________________________________________________ +// private methods +//________________________________________________________________________________________________________ + +private: + + /**___________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2() throw ( css::uno::RuntimeException ); + bool impl_getPrintHelper(); + SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage ); + SAL_DLLPRIVATE OUString GetMediumFilterName_Impl(); + + SAL_DLLPRIVATE void impl_store( const OUString& sURL, + const css::uno::Sequence< css::beans::PropertyValue >& seqArguments , + sal_Bool bSaveTo ) ; + + SAL_DLLPRIVATE void postEvent_Impl( const OUString& aName, const css::uno::Reference< css::frame::XController2 >& xController = css::uno::Reference< css::frame::XController2 >() ); + + SAL_DLLPRIVATE String getEventName_Impl( long nID ); + SAL_DLLPRIVATE bool QuerySaveSizeExceededModules( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler ); + + SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); + SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper (); + + SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl( + const css::uno::Reference< css::frame::XFrame >& i_rFrame, + ::sfx::intern::ViewCreationGuard& i_rGuard + ) const; + + SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const; + + SAL_DLLPRIVATE void loadCmisProperties(); + + SAL_DLLPRIVATE void handleLoadError( sal_uInt32 nError, SfxMedium* pMedium ); + +//________________________________________________________________________________________________________ +// private variables and methods +//________________________________________________________________________________________________________ + +private: + + IMPL_SfxBaseModel_DataContainer* m_pData ; + // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context + const bool m_bSupportEmbeddedScripts; + const bool m_bSupportDocRecovery; + +} ; // class SfxBaseModel + +/** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel +*/ +class SFX2_DLLPUBLIC SfxModelSubComponent +{ +public: + /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed + */ + void MethodEntryCheck() + { + m_rModel.MethodEntryCheck( true ); + } + + // called when the SfxBaseModel which the component is superordinate of is being disposed + virtual void disposing(); + +protected: + SfxModelSubComponent( SfxBaseModel& i_model ) + :m_rModel( i_model ) + { + } + virtual ~SfxModelSubComponent(); + + // helpers for implementing XInterface - delegates ref counting to the SfxBaseModel + void acquire() { m_rModel.acquire(); } + void release() { m_rModel.release(); } + + bool isDisposed() const { return m_rModel.IsDisposed(); } + +protected: + const SfxBaseModel& getBaseModel() const { return m_rModel; } + SfxBaseModel& getBaseModel() { return m_rModel; } + + ::osl::Mutex& getMutex() { return m_rModel.getMutex(); } + +private: + SfxBaseModel& m_rModel; +}; + +class SFX2_DLLPUBLIC SfxModelGuard +{ +public: + enum AllowedModelState + { + // not yet initialized + E_INITIALIZING, + // fully alive, i.e. initialized, and not yet disposed + E_FULLY_ALIVE + }; + + SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) + : m_aGuard() + { + i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING ); + } + SfxModelGuard( SfxModelSubComponent& i_rSubComponent ) + :m_aGuard() + { + i_rSubComponent.MethodEntryCheck(); + } + ~SfxModelGuard() + { + } + + void reset() + { + m_aGuard.reset(); + } + + void clear() + { + m_aGuard.clear(); + } + +private: + SolarMutexResettableGuard m_aGuard; +}; + +#endif // _SFX_SFXBASEMODEL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxcommands.h b/include/sfx2/sfxcommands.h new file mode 100644 index 000000000000..3f4df5cb5220 --- /dev/null +++ b/include/sfx2/sfxcommands.h @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX2_SFXCOMMANDS_HRC +#define SFX2_SFXCOMMANDS_HRC + +#define CMD_SID_ABOUT ".uno:About" +#define CMD_SID_NEWDOC ".uno:NewDoc" +#define CMD_SID_BROWSE_BACKWARD ".uno:BrowseBackward" +#define CMD_SID_BROWSE_FORWARD ".uno:BrowseForward" +#define CMD_SID_CLOSEWIN ".uno:CloseWin" +#define CMD_SID_COPY ".uno:Copy" +#define CMD_SID_CUT ".uno:Cut" +#define CMD_SID_DELETE ".uno:Delete" +#define CMD_SID_BASICIDE_DELETECURRENT ".uno:DeleteCurrent" +#define CMD_SID_STYLE_DESIGNER ".uno:DesignerDialog" +#define CMD_SID_EDITDOC ".uno:EditDoc" +#define CMD_SID_STYLE_EDIT ".uno:EditStyle" +#define CMD_SID_WIN_FULLSCREEN ".uno:FullScreen" +#define CMD_SID_BASICIDE_HIDECURPAGE ".uno:HideCurPage" +#define CMD_SID_HYPERLINK_DIALOG ".uno:HyperlinkDialog" +#define CMD_SID_BASICIDE_MODULEDLG ".uno:ModuleDialog" +#define CMD_SID_NAVIGATOR ".uno:Navigator" +#define CMD_SID_BASICIDE_NEWDIALOG ".uno:NewDialog" +#define CMD_SID_BASICIDE_NEWMODULE ".uno:NewModule" +#define CMD_SID_OBJECT ".uno:ObjectMenue" +#define CMD_SID_OPENDOC ".uno:Open" +#define CMD_SID_WEBHTML ".uno:WebHtml" +#define CMD_SID_OPENHYPERLINK ".uno:OpenHyperlink" +#define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle" +#define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate" +#define CMD_SID_CHECKOUT ".uno:CheckOut" +#define CMD_SID_CANCELCHECKOUT ".uno:CancelCheckOut" +#define CMD_SID_CHECKIN ".uno:CheckIn" +#define CMD_SID_OPENURL ".uno:OpenUrl" +#define CMD_SID_OPTIONS ".uno:Options" +#define CMD_SID_ORGANIZER ".uno:Organizer" +#define CMD_SID_PASTE ".uno:Paste" +#define CMD_SID_PASTE_SPECIAL ".uno:PasteSpecial" +#define CMD_SID_PASTE_ONLY ".uno:PasteOnly" +#define CMD_SID_PASTE_ONLY_VALUE ".uno:PasteOnlyValue" +#define CMD_SID_PASTE_ONLY_TEXT ".uno:PasteOnlyText" +#define CMD_SID_PASTE_ONLY_FORMULA ".uno:PasteOnlyFormula" +#define CMD_SID_PRINTPREVIEW ".uno:PrintPreview" +#define CMD_SID_RELOAD ".uno:Reload" +#define CMD_SID_BASICIDE_RENAMECURRENT ".uno:RenameCurrent" +#define CMD_SID_DOCTEMPLATE ".uno:SaveAsTemplate" +#define CMD_SID_SEARCH_DLG ".uno:SearchDialog" +#define CMD_SID_SHOW_BROWSER ".uno:ShowBrowser" +#define CMD_SID_STYLE_NEW_BY_EXAMPLE ".uno:StyleNewByExample" +#define CMD_SID_INET_DLG ".uno:InternetDialog" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxdefs.hxx b/include/sfx2/sfxdefs.hxx new file mode 100644 index 000000000000..cca545f7e2f7 --- /dev/null +++ b/include/sfx2/sfxdefs.hxx @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXDEFS_HXX +#define _SFXDEFS_HXX + +#define SfxFilterFlags sal_uLong + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx new file mode 100644 index 000000000000..a994c7dfa77a --- /dev/null +++ b/include/sfx2/sfxdlg.hxx @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX2_DIALOG_HXX +#define _SFX2_DIALOG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <vcl/abstdlg.hxx> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <sot/exchange.hxx> +#include <sfx2/lnkbase.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.h> + +class SfxTabPage; +class SfxViewFrame; +class SfxBindings; +class SfxItemSet; +class ResId; +class Window; +class String; +class SfxItemPool; +class SvObjectServerList; +class TransferableDataHelper; +struct TransferableObjectDescriptor; + +#include <sfx2/tabdlg.hxx> + +namespace sfx2 +{ + class LinkManager; +} + +namespace com { namespace sun { namespace star { namespace frame { + class XModel; +} } } } + +class SfxAbstractDialog : virtual public VclAbstractDialog +{ +public: + virtual const SfxItemSet* GetOutputItemSet() const = 0; + virtual void SetText( const OUString& rStr ) = 0; + virtual OUString GetText() const = 0; +}; + +class SfxAbstractTabDialog : virtual public SfxAbstractDialog +{ +public: + virtual void SetCurPageId( sal_uInt16 nId ) = 0; + virtual void SetCurPageId( const OString &rName ) = 0; + virtual const sal_uInt16* GetInputRanges( const SfxItemPool& ) = 0; + virtual void SetInputSet( const SfxItemSet* pInSet ) = 0; +}; + +class SfxAbstractApplyTabDialog : virtual public SfxAbstractTabDialog +{ +public: + virtual void SetApplyHdl( const Link& rLink ) = 0; +}; + +class SfxAbstractInsertObjectDialog : virtual public VclAbstractDialog +{ +public: + virtual com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject()=0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( OUString* pGraphicMediaType )=0; + virtual sal_Bool IsCreateNew()=0; +}; + +class SfxAbstractPasteDialog : virtual public VclAbstractDialog +{ +public: + virtual void Insert( SotFormatStringId nFormat, const String & rFormatName ) = 0; + virtual void SetObjName( const SvGlobalName & rClass, const String & rObjName ) = 0; + virtual sal_uIntPtr GetFormat( const TransferableDataHelper& aHelper, + const DataFlavorExVector* pFormats=0, + const TransferableObjectDescriptor* pDesc=0 ) = 0; +}; + +class SfxAbstractLinksDialog : virtual public VclAbstractDialog +{ +}; + +class AbstractScriptSelectorDialog : virtual public VclAbstractDialog +{ +public: + virtual String GetScriptURL() const = 0; + virtual void SetRunLabel() = 0; +}; + +namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } } + +class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialogFactory +{ +public: + virtual ~SfxAbstractDialogFactory(); // needed for export of vtable + static SfxAbstractDialogFactory* Create(); + virtual VclAbstractDialog* CreateSfxDialog( Window* pParent, const SfxBindings& rBindings, sal_uInt32 nResId ) = 0; + virtual VclAbstractDialog* CreateFrameDialog( Window* pParent, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, sal_uInt32 nResId, const String& rParameter ) = 0; + virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId, + Window* pParent, + const SfxItemSet* pAttrSet, + SfxViewFrame* pViewFrame, + bool bEditFmt=false, + const String *pUserButtonText=0 ) = 0; + virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId, + Window* pParent, + const SfxItemSet* pAttrSet, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame, + bool bEditFmt=false, + const String *pUserButtonText=0 ) = 0; + virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0; + virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0; + virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( Window* pParent, const OUString& rCommand, + const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStor, + const SvObjectServerList* pList = 0 )=0; + virtual VclAbstractDialog* CreateEditObjectDialog( Window* pParent, const OUString& rCommand, + const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj )=0; + virtual SfxAbstractPasteDialog* CreatePasteDialog( Window* pParent )=0; + virtual SfxAbstractLinksDialog* CreateLinksDialog( Window* pParent, sfx2::LinkManager* pMgr, sal_Bool bHTML=sal_False, sfx2::SvBaseLink* p=0 )=0; + virtual VclAbstractDialog * CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage ) = 0; + + virtual AbstractScriptSelectorDialog* + CreateScriptSelectorDialog( + Window* pParent, + sal_Bool bShowSlots, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame + ) = 0; + + virtual VclAbstractDialog* CreateScriptErrorDialog( + Window* pParent, com::sun::star::uno::Any aException ) = 0; + + virtual VclAbstractDialog* CreateOptionsDialog( + Window* pParent, const OUString& rExtensionId, const OUString& rApplicationContext ) = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxhelp.hxx b/include/sfx2/sfxhelp.hxx new file mode 100644 index 000000000000..9de00f008736 --- /dev/null +++ b/include/sfx2/sfxhelp.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_HELP_HXX +#define _SFX_HELP_HXX + +#include <rtl/ustring.hxx> +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/help.hxx> + +class SfxHelp_Impl; +class SfxFrame; +class SFX2_DLLPUBLIC SfxHelp : public Help +{ + OUString aTicket; // for Plugins + OUString aUser; + OUString aLanguageStr; + OUString aCountryStr; + sal_Bool bIsDebug; + SfxHelp_Impl* pImp; + +private: + SAL_DLLPRIVATE sal_Bool Start_Impl( const OUString& rURL, const Window* pWindow, const OUString& rKeyword ); + SAL_DLLPRIVATE virtual sal_Bool SearchKeyword( const OUString& rKeyWord ); + SAL_DLLPRIVATE virtual sal_Bool Start( const OUString& rURL, const Window* pWindow ); + SAL_DLLPRIVATE virtual void OpenHelpAgent( const OString& sHelpId ); + SAL_DLLPRIVATE OUString GetHelpModuleName_Impl(); + SAL_DLLPRIVATE OUString CreateHelpURL_Impl( const OUString& aCommandURL, const OUString& rModuleName ); + +public: + SfxHelp(); + ~SfxHelp(); + + inline void SetTicket( const OUString& rTicket ) { aTicket = rTicket; } + inline void SetUser( const OUString& rUser ) { aUser = rUser; } + + virtual OUString GetHelpText( const OUString&, const Window* pWindow ); + + static OUString CreateHelpURL( const OUString& aCommandURL, const OUString& rModuleName ); + using Help::OpenHelpAgent; + static void OpenHelpAgent( SfxFrame* pFrame, const OString& sHelpId ); + static OUString GetDefaultHelpModule(); + static OUString GetCurrentModuleIdentifier(); +}; + +#endif // #ifndef _SFX_HELP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxhtml.hxx b/include/sfx2/sfxhtml.hxx new file mode 100644 index 000000000000..7569afe483c2 --- /dev/null +++ b/include/sfx2/sfxhtml.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXHTML_HXX +#define _SFXHTML_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <i18nlangtag/lang.h> +#include <svtools/parhtml.hxx> +#include <svl/macitem.hxx> + + +class ImageMap; +class SfxMedium; +class SfxObjectShell; + +class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser +{ + String aScriptType; + + SfxMedium* pMedium; + SfxMedium *pDLMedium; // Medium for Download Files + + ScriptType eScriptType; + + SAL_DLLPRIVATE void GetScriptType_Impl( SvKeyValueIterator* ); + +protected: + + SfxHTMLParser( SvStream& rStream, sal_Bool bNewDoc=sal_True, SfxMedium *pMedium=0 ); + + virtual ~SfxHTMLParser(); + +public: + // Read the options of an image map + // <MAP>: sal_True = Image-Map has a name + // <AREA>: sal_True = Image-Map has now one Region more + static bool ParseMapOptions(ImageMap* pImageMap, const HTMLOptions& rOptions); + bool ParseMapOptions(ImageMap * pImageMap) + { return ParseMapOptions(pImageMap, GetOptions()); } + static bool ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL, + const HTMLOptions& rOptions, + sal_uInt16 nEventMouseOver = 0, + sal_uInt16 nEventMouseOut = 0 ); + inline sal_Bool ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL, + sal_uInt16 nEventMouseOver = 0, + sal_uInt16 nEventMouseOut = 0); + + // <TD SDVAL="..." SDNUM="..."> + static double GetTableDataOptionsValNum( sal_uInt32& nNumForm, + LanguageType& eNumLang, const String& aValStr, + const String& aNumStr, SvNumberFormatter& rFormatter ); + +protected: + // Start a file download. This is done asynchronously or synchronously. + // In the synchronous case, the parser is in the working state after + // it has been called. The read file can then be picked up directly with + // FinishFileDownload. In the asynchronous case, the parser is in the + // pending state after it hs been called. The parser then has to leave + // over the Continue (without Reschedule!). If the file is loaded, + // a Continue is called with passed on token. The file can then be picked + // up by FinishFileDownload. To cancel the download should a shell be + // left. It can only exist a single download at the same time, For every + // started download FinshFileDownload must be called. + void StartFileDownload(const OUString& rURL); + + // End of an asynchronous file download. Returns TRUE if the download + // was successful. The read file is then passed into String. + sal_Bool FinishFileDownload( String& rStr ); + + // Returns TRUE if a file was downloaded and if FileDownloadFinished + // has not yet been called + sal_Bool ShouldFinishFileDownload() const { return pDLMedium != 0; } + + SfxMedium *GetMedium() { return pMedium; } + const SfxMedium *GetMedium() const { return pMedium; } + + // Default (without iterator) is JavaScript + ScriptType GetScriptType( SvKeyValueIterator* ) const; + const String& GetScriptTypeString( SvKeyValueIterator* ) const; +}; + +inline sal_Bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL, + sal_uInt16 nEventMouseOver, + sal_uInt16 nEventMouseOut) +{ + return ParseAreaOptions( pImageMap, rBaseURL, GetOptions(), + nEventMouseOver, nEventMouseOut ); +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxmodelfactory.hxx b/include/sfx2/sfxmodelfactory.hxx new file mode 100644 index 000000000000..612aea61d07e --- /dev/null +++ b/include/sfx2/sfxmodelfactory.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX2_SFXMODELFACTORY_HXX +#define SFX2_SFXMODELFACTORY_HXX + +#include "sfx2/dllapi.h" + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> + +//........................................................................ +namespace sfx2 +{ +//........................................................................ + + #define SFXMODEL_STANDARD (sal_uInt64)(0x0000) + #define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001) + #define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0002) + #define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0004) + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ( SAL_CALL * SfxModelFactoryFunc ) ( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, + const sal_uInt64 _nCreationFlags + ); + + //==================================================================== + //= createSfxModelFactory + //==================================================================== + /** creates a XSingleServiceFactory which can be used to created instances + of classes derived from SfxBaseModel + + In opposite to the default implementations from module cppuhelper, this + factory evaluates certain creation arguments (passed to createInstanceWithArguments) + and passes them to the factory function of the derived class. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > + SFX2_DLLPUBLIC createSfxModelFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory, + const OUString& _rImplementationName, + const SfxModelFactoryFunc _pComponentFactoryFunc, + const ::com::sun::star::uno::Sequence< OUString >& _rServiceNames + ); + +//........................................................................ +} // namespace sfx2 +//........................................................................ + +#endif // SFX2_SFXMODELFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxresid.hxx b/include/sfx2/sfxresid.hxx new file mode 100644 index 000000000000..f90221847579 --- /dev/null +++ b/include/sfx2/sfxresid.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_SFXRESID_HXX +#define _SFX_SFXRESID_HXX + +#include "sfx2/dllapi.h" +#include <tools/resid.hxx> + +class SFX2_DLLPUBLIC SfxResId: public ResId +{ +public: + SfxResId( sal_uInt16 nId ); + static ResMgr* GetResMgr(); + static void DeleteResMgr(); +}; + +#define SFX2_RESSTR(x) SfxResId(x).toString() + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc new file mode 100644 index 000000000000..00923ffdc6a8 --- /dev/null +++ b/include/sfx2/sfxsids.hrc @@ -0,0 +1,753 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXSIDS_HRC +#define _SFXSIDS_HRC + +#include <svl/solar.hrc> +#include <sfx2/cntids.hrc> +#include <svl/memberid.hrc> + +// Please be careful: +// Changing just one part here doesn't add new +// docking windows automatically! +// + +#define SID_DOCKWIN_0 SID_DOCKWIN_START +#define SID_DOCKWIN_1 SID_DOCKWIN_START+1 +#define SID_DOCKWIN_2 SID_DOCKWIN_START+2 +#define SID_DOCKWIN_3 SID_DOCKWIN_START+3 +#define SID_DOCKWIN_4 SID_DOCKWIN_START+4 +#define SID_DOCKWIN_5 SID_DOCKWIN_START+5 +#define SID_DOCKWIN_6 SID_DOCKWIN_START+6 +#define SID_DOCKWIN_7 SID_DOCKWIN_START+7 +#define SID_DOCKWIN_8 SID_DOCKWIN_START+8 +#define SID_DOCKWIN_9 SID_DOCKWIN_START+9 + +//========================================================================= + +#define SID_UNKNOWN SID_SFX_START + +//------------------------------------------------------------------------- + +// default-ids for application +#define SID_QUITAPP (SID_SFX_START + 300) +#define SID_ABOUT (SID_SFX_START + 301) +#define SID_SETUPPRINTER (SID_SFX_START + 302) +#define SID_EXITANDRETURN (SID_SFX_START + 303) + +#define SID_CONTEXT (SID_SFX_START + 310) + +#define SID_PASTE_SPECIAL (SID_SFX_START + 311) +#define SID_CLIPBOARD_FORMAT_ITEMS (SID_SFX_START + 312) + +#define SID_VERSION_VISIBLE (SID_SFX_START + 313) +#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314) +#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320) +#define SID_PRINTER_NAME (SID_SFX_START + 322) +#define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324) +#define SID_PRINTPREVIEW (SID_SFX_START + 325) + +#define SID_MAIL_SUBJECT (SID_SFX_START + 328) +#define SID_MAIL_NOTIFY (SID_SFX_START + 330) +#define SID_MAIL_SENDDOC (SID_SFX_START + 331) +#define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672) + +#define SID_MAIL_RECIPIENT (SID_SFX_START + 334) +#define SID_MAIL_TEXT (SID_SFX_START + 335) +#define SID_MAIL_ATTACH (SID_SFX_START + 336) +#define SID_MAIL_PRIORITY (SID_SFX_START + 337) + +#define SID_MAIL_ATTACH_FILE (SID_SFX_START + 375) +#define SID_MAIL_PREPAREEXPORT (SID_SFX_START + 385) + +#define SID_MAIL_EXPORT_FINISHED (SID_SFX_START + 388) +#define SID_WEBHTML (SID_SFX_START + 393) +#define SID_MAIL_SCROLLBODY_PAGEDOWN (SID_SFX_START + 1588) + +#define SID_PROGRESS_STATUSBAR_CONTROL (SID_SFX_START + 1597) + +#define SID_APPLICATION (SID_SFX_START + 340) +#define SID_PROGNAME (SID_SFX_START + 341) +#define SID_PROGFILENAME (SID_SFX_START + 342) +#define SID_SELECTION (SID_SFX_START + 346) + +// 360-400 see SID_MAIL_... + +// default-ids for help +#define SID_HELPONHELP (SID_SFX_START + 400) +#define SID_HELPINDEX (SID_SFX_START + 401) +#define SID_EXTENDEDHELP (SID_SFX_START + 402) +#define SID_HELPBALLOONS (SID_SFX_START + 403) +#define SID_HELPTIPS (SID_SFX_START + 404) +#define SID_HELPMENU (SID_SFX_START + 410) +#define SID_HELP_INDEX (SID_SFX_START + 411) +#define SID_HELP_SEARCH (SID_SFX_START + 412) +#define SID_HELP_ANNOTATE (SID_SFX_START + 413) +#define SID_HELP_BOOKMARK (SID_SFX_START + 414) +#define SID_HELP_DOWNLOAD (SID_SFX_START + 415) +#define SID_HELP_ZOOMIN (SID_SFX_START + 417) +#define SID_HELP_ZOOMOUT (SID_SFX_START + 418) +#define SID_HELP_HELPFILEBOX (SID_SFX_START + 419) +#define SID_SEND_FEEDBACK (SID_SFX_START + 421) +#define SID_SHOW_LICENSE (SID_SFX_START + 1683) +#define SID_SHOW_CREDITS (SID_SFX_START + 1711) +#define SID_HELP_TUTORIALS (SID_SFX_START + 1695) + +// default-ids for document +#define SID_NEWDOC (SID_SFX_START + 500) +#define SID_OPENDOC (SID_SFX_START + 501) +#define SID_OPENURL (SID_SFX_START + 596) +#define SID_SAVEASURL (SID_SFX_START + 643) +#define SID_JUMPTOMARK (SID_SFX_START + 598) +#define SID_OPENTEMPLATE (SID_SFX_START + 594) +#define SID_SAVEASDOC (SID_SFX_START + 502) +#define SID_SAVEACOPY (SID_SFX_START + 999) +#define SID_CLOSING (SID_SFX_START +1539) +#define SID_CLOSEDOC (SID_SFX_START + 503) +#define SID_CLOSEDOCS (SID_SFX_START + 595) +#define SID_CLOSEDOC_SAVE (SID_SFX_START + 1) +#define SID_CLOSEDOC_FILENAME (SID_SFX_START + 2) +#define SID_PRINTDOC (SID_SFX_START + 504) +#define SID_PRINT_FIRST_PAGE (SID_SFX_START + 1) +#define SID_PRINT_LAST_PAGE (SID_SFX_START + 2) +#define SID_PRINT_COPIES (SID_SFX_START + 3) +#define SID_PRINT_PAGES (SID_SFX_START +1589) +#define SID_PRINT_COLLATE (SID_SFX_START +1590) +#define SID_PRINT_SORT (SID_SFX_START +1591) +#define SID_SAVEDOC (SID_SFX_START + 505) +#define SID_UPDATEDOC (SID_SFX_START + 506) +#define SID_FILE_NAME (SID_SFX_START + 507) +#define SID_DOCINFO_TITLE (SID_SFX_START + 557) +#define SID_FILE_FILTEROPTIONS (SID_SFX_START + 527) +#define SID_RELOAD (SID_SFX_START + 508) +#define SID_PRINTDOCDIRECT (SID_SFX_START + 509) +#define SID_PICKLIST (SID_SFX_START + 510) +#define SID_DOC_SERVICE (SID_SFX_START + 511) +#define SID_ATTR_XWINDOW (SID_SFX_START + 777) +#define SID_PLUGIN_MODE (SID_SFX_START + 827) +#define SID_EXPORTDOC (SID_SFX_START + 829) +#define SID_EXPORTDOCASPDF (SID_SFX_START + 1673) +#define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674) +#define SID_UPDATEDOCMODE (SID_SFX_START + 1668) +#define SID_CHECKOUT (SID_SFX_START + 512) +#define SID_CANCELCHECKOUT (SID_SFX_START + 513) +#define SID_CHECKIN (SID_SFX_START + 514) +#define SID_FILTER_PROVIDER (SID_SFX_START + 515) + +#define SID_FORCERELOAD (SID_SFX_START + 1502) +#define SID_FILE_DIALOG (SID_SFX_START + 304) +#define SID_PATH (SID_SFX_START + 308) +#define SID_SAVEDOCS (SID_SFX_START + 309) +#define SID_STANDARD_DIR (SID_SFX_START + 450) +#define SID_BLACK_LIST (SID_SFX_START + 451) + +// browse-ids +#define SID_BROWSE_FORWARD (SID_SFX_START + 1300) +#define SID_BROWSE_BACKWARD (SID_SFX_START + 1301) +#define SID_CREATELINK (SID_SFX_START + 1309) +#define SID_BOOKMARK_TITLE (SID_SFX_START + 1310) +#define SID_BOOKMARK_URL (SID_SFX_START + 1311) +#define SID_EDITDOC (SID_SFX_START + 1312) +#define SID_BROWSER_MODE (SID_SFX_START + 1313) +#define SID_PLUGINS_ACTIVE (SID_SFX_START + 1314) +#define SID_BROWSER (SID_SFX_START + 1318) +#define SID_MACROEXECMODE (SID_SFX_START + 1319) + +#define SID_FILTER_DATA (SID_SFX_START + 1375) + +#define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390) +// SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399) + +#define ID_FILETP_START SID_EXPLORER_FILEPROPS_START +#define ID_FILETP_READONLY (ID_FILETP_START + 0) +#define ID_FILETP_TITLE (ID_FILETP_START + 1) + +#define SID_ATTR_ZOOM (SID_SVX_START + 0) + +#define SID_EXPLORER_PROPS_START (SID_SFX_START + 1410) +// SID_EXPLORER_PROPS_END (SID_SFX_START + 1499) + +#define SID_AUTOLOAD (SID_SFX_START + 1509) +#define SID_FILLFRAME (SID_SFX_START + 1516) +#define SID_BASEURL (SID_SFX_START + 1518) +#define SID_TEMPLATE (SID_SFX_START + 1519) + +#define SID_CONTENTTYPE (SID_SFX_START + 1541) + +#define SID_SAVETO (SID_SFX_START + 1546) + +#define SID_CREATE_BASICOBJECT (SID_SFX_START + 1555) +#define SID_DELETE_BASICOBJECT (SID_SFX_START + 1556) + +#define SID_UPDATE_VERSION (SID_SFX_START + 1568) +#define SID_BUILD_VERSION (SID_SFX_START + 1569) + +#define SID_VERSION (SID_SFX_START + 1583) + +#define SID_DOCUMENT_COMPARE (SID_SFX_START + 1586) +#define SID_DOCUMENT_MERGE (SID_SFX_START + 1587) + +#define SID_OFFICE_CUSTOMERNUMBER (SID_SFX_START + 1608) +#define SID_OFFICE_CHECK_PLZ (SID_SFX_START + 1610) +#define SID_CURRENT_URL (SID_SFX_START + 1613) + +#define SID_TIPWINDOW (SID_SFX_START + 1632) +#define SID_CHARSET (SID_SFX_START + 1633) +#define SID_OVERWRITE (SID_SFX_START + 1634) +#define SID_RENAME (SID_SFX_START + 1653) +#define SID_PARTWIN (SID_SFX_START + 1640) +#define SID_CRASH (SID_SFX_START + 1645) +#define SID_FAIL_ON_WARNING (SID_SFX_START + 1646) +#define SID_INPUTSTREAM (SID_SFX_START + 1648) +#define SID_LOGOUT (SID_SFX_START + 1652) +#define SID_JUMPMARK (SID_SFX_START + 1654) +#define SID_BROWSE (SID_SFX_START + 1658) + // FREE (was: SID_BACKTOWEBTOP) +#define SID_SEGMENTSIZE (SID_SFX_START + 1659) +#define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660) +#define SID_TOGGLE_MENUBAR (SID_SFX_START + 1661) +#define SID_UNPACK (SID_SFX_START + 1662) +// (SID_SFX_START + 1663) used further down +#define SID_MACRO_WARNING (SID_SFX_START + 1664) +#define SID_MACRO_CONFIRMATION (SID_SFX_START + 1665) +#define SID_OUTPUTSTREAM (SID_SFX_START + 1666) +#define SID_IMAGE_ORIENTATION (SID_SFX_START + 1667) + +#define SID_SAVE_VERSION_ON_CLOSE (SID_SFX_START + 1670) +#define SID_STOP_RECORDING (SID_SFX_START + 1671) +#define SID_INTERACTIONHANDLER (SID_SFX_START + 1675) +#define SID_OPENHYPERLINK (SID_SFX_START + 1676) +#define SID_ADDONLIST (SID_SFX_START + 1677) +#define SID_ADDONS (SID_SFX_START + 1678) +#define SID_CONTENT (SID_SFX_START + 1679) +#define SID_SHOW_IME_STATUS_WINDOW (SID_SFX_START + 1680) +#define SID_UPDATE_CONFIG (SID_SFX_START + 1681) +#define SID_VIEWONLY (SID_SFX_START + 1682) +#define SID_REPAIRPACKAGE (SID_SFX_START + 1683) +#define SID_ADDONHELP (SID_SFX_START + 1684) +#define SID_MINIMIZED (SID_SFX_START + 1687) +#define SID_COMPONENTDATA (SID_SFX_START + 1688) +#define SID_COMPONENTCONTEXT (SID_SFX_START + 1689) +#define SID_SCRIPTORGANIZER (SID_SFX_START + 1690) +#define SID_MACROORGANIZER (SID_SFX_START + 1691) +#define SID_RUNMACRO (SID_SFX_START + 1692) +#define SID_AVMEDIA_TOOLBOX (SID_SFX_START + 1693) +#define SID_AVMEDIA_PLAYER (SID_SFX_START + 1694) +#define SID_INSERT_AVMEDIA (SID_SFX_START + 1696) +#define SID_RECENTFILELIST (SID_SFX_START + 1697) +#define SID_AVAILABLE_TOOLBARS (SID_SFX_START + 1698) +#define SID_STREAM (SID_SFX_START + 1699) +#define SID_DOC_BASEURL (SID_SFX_START + 1700) +#define SID_DOC_HIERARCHICALNAME (SID_SFX_START + 1701) +#define SID_TERMINATE_INPLACEACTIVATION (SID_SFX_START + 1702) +#define SID_APPLY_STYLE (SID_SFX_START + 1703) +#define SID_MACRO_SIGNATURE (SID_SFX_START + 1704) +#define SID_ATTR_WARNALIENFORMAT (SID_SFX_START + 1705) +#define SID_COPY_STREAM_IF_POSSIBLE (SID_SFX_START + 1706) +#define SID_MAIL_SENDDOCASFORMAT (SID_SFX_START + 1707) +#define SID_MAIL_SENDDOCASMS (SID_SFX_START + 1708) +#define SID_MAIL_SENDDOCASOOO (SID_SFX_START + 1709) +#define SID_NOAUTOSAVE (SID_SFX_START + 1711) +#define SID_PRINT_SELECTEDSHEET (SID_SFX_START + 1712) +#define SID_OPTIONS_PAGEURL (SID_SFX_START + 1713) +#define SID_MORE_DICTIONARIES (SID_SFX_START + 1714) +#define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) +#define SID_FONT_NAME (SID_SFX_START + 1716) +#define SID_DEFAULTFILENAME (SID_SFX_START + 1717) +#define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718) +#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) +#define SID_SUGGESTEDSAVEASDIR (SID_SFX_START + 1720) +#define SID_SUGGESTEDSAVEASNAME (SID_SFX_START + 1721) +#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722) +#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723) +#define SID_GOTOLINE (SID_SFX_START + 1724) +#define SID_SHOWLINES (SID_SFX_START + 1725) +#define SID_BLUETOOTH_SENDDOC (SID_SFX_START + 1726) +#define SID_TEMPLATE_MANAGER (SID_SFX_START + 1727) + +// SID_SFX_free_START (SID_SFX_START + 1728) +// SID_SFX_free_END (SID_SFX_START + 3999) + +#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) + // FREE, was SID_VIEW_ZOOM_MODE + // FREE, was SID_VIEW_POS_SIZE +#define SID_VIEW_ID (SID_SFX_START + 523) + // FREE, was SID_USER_DATA +#define SID_VIEW_DATA (SID_SFX_START + 1582) +#define SID_SILENT (SID_SFX_START + 528) +#define SID_HIDDEN (SID_SFX_START + 534) +#define SID_PREVIEW (SID_SFX_START + 1404) + +#define SID_FOCUSURLBOX (SID_SFX_START + 1406) + +#define SID_ACTIVATE (SID_SFX_START + 525) +#define SID_PRINTOUT (SID_SFX_START + 526) + +#define SID_FILE_LONGNAME (SID_SFX_START + 529) +#define SID_FILTER_NAME (SID_SFX_START + 530) +#define SID_DOC_SALVAGE (SID_SFX_START + 531) +#define SID_INSERTDOC (SID_SFX_START + 532) +#define SID_TYPE_NAME (SID_SFX_START + 533) + +#define SID_DOC_READONLY (SID_SFX_START + 590) +#define SID_DOC_MODIFIED (SID_SFX_START + 584) +#define SID_DOC_LOADING (SID_SFX_START + 585) +#define SID_IMG_LOADING (SID_SFX_START + 586) +#define SID_DOC_SAVED (SID_SFX_START + 599) +#define SID_DOCINFO (SID_SFX_START + 535) +#define SID_DOCINFO_KEYWORDS (SID_SFX_START + 591) +#define SID_DOCINFO_COMMENTS (SID_SFX_START + 592) +#define SID_DOCINFO_AUTHOR (SID_SFX_START + 593) +#define SID_DOCINFO_MAJOR (SID_SFX_START + 594) +#define SID_NEWDOCDIRECT (SID_SFX_START + 537) +#define SID_DOCFRAME (SID_SFX_START + 598) +#define SID_TARGETNAME (SID_SFX_START + 560) +#define SID_ORIGURL (SID_SFX_START + 644) +#define SID_POSTDATA (SID_SFX_START + 1536) +#define SID_DONELINK (SID_SFX_START + 646) +#define SID_REFERER (SID_SFX_START + 654) +#define SID_MODIFIER (SID_SFX_START + 669) +#define SID_SETOPTIONS (SID_SFX_START + 670) +#define SID_SOURCEVIEW (SID_SFX_START + 675) +#define SID_DOC_STARTPRESENTATION (SID_SFX_START + 695) +#define SID_DDE_RECONNECT_ONLOAD (SID_SFX_START + 696) + +#define SID_NEWWINDOWFOREDIT (SID_SFX_START + 667) + +#define SID_DOCTEMPLATE (SID_SFX_START + 538) +#define SID_AUTOPILOTMENU (SID_SFX_START + 1381) + +// Floating Window Template +#define SID_STYLE_DESIGNER (SID_SFX_START + 539) + +#define SID_TEMPLATE_ADDRESSBOKSOURCE (SID_SFX_START + 1655) + +// Ruby dialog +#define SID_RUBY_DIALOG (SID_SFX_START + 1656) + +#define SID_STYLE_FAMILY_START (SID_SFX_START + 541) +#define SID_STYLE_FAMILY1 (SID_STYLE_FAMILY_START) +#define SID_STYLE_FAMILY2 (SID_STYLE_FAMILY_START + 1) +#define SID_STYLE_FAMILY3 (SID_STYLE_FAMILY_START + 2) +#define SID_STYLE_FAMILY4 (SID_STYLE_FAMILY_START + 3) +#define SID_STYLE_FAMILY5 (SID_STYLE_FAMILY_START + 4) + +#define SID_STYLE_NEW (SID_SFX_START + 549) +#define SID_STYLE_EDIT (SID_SFX_START + 550) +#define SID_STYLE_DELETE (SID_SFX_START + 551) +#define SID_STYLE_APPLY (SID_SFX_START + 552) +#define SID_STYLE_FAMILY (SID_SFX_START + 553) +#define SID_STYLE_FAMILYNAME (SID_SFX_START + 566) +#define SID_STYLE_WATERCAN (SID_SFX_START + 554) +#define SID_STYLE_NEW_BY_EXAMPLE (SID_SFX_START + 555) +#define SID_STYLE_UPDATE_BY_EXAMPLE (SID_SFX_START + 556) +#define SID_STYLE_DRAGHIERARCHIE (SID_SFX_START + 565) +#define SID_STYLE_MASK (SID_SFX_START + 562) +#define SID_STYLE_HIDE (SID_SFX_START + 1603) +#define SID_STYLE_SHOW (SID_SFX_START + 1604) +#define SID_STYLE_UPD_BY_EX_NAME (SID_SFX_START + 1585) +#define SID_STYLE_REFERENCE (SID_SFX_START + 1602) + +#define SID_TEMPLATE_NAME (SID_SFX_START + 660) +#define SID_TEMPLATE_REGION (SID_SFX_START + 661) +#define SID_TEMPLATE_REGIONNAME (SID_SFX_START + 662) +#define SID_TEMPLATE_LOAD (SID_SFX_START + 663) + +#define SID_INSERT_OBJECT (SID_SFX_START + 561) +#define SID_INSERT_FLOATINGFRAME (SID_SFX_START + 563) +#define SID_INSERT_PLUGIN (SID_SFX_START + 672) +#define SID_INSERT_SOUND (SID_SFX_START + 676) +#define SID_INSERT_VIDEO (SID_SFX_START + 677) + +#define SID_HYPERLINK_DIALOG (SID_SFX_START + 678) + +#define SID_ACTIVEDOCUMENT (SID_SFX_START + 570) +#define SID_DEFAULTFILEPATH (SID_SFX_START + 571) +#define SID_OBJECT (SID_SFX_START + 575) + +// Doc-Properties +#define SID_DOCFULLNAME (SID_SFX_START + 581) +#define SID_DOCPATH (SID_SFX_START + 582) +#define SID_DOCTITLE (SID_SFX_START + 583) + +#define SID_DOCUMENT (SID_SFX_START + 588) + +// default-ids for windows + +#define SID_CLOSEWINS (SID_SFX_START + 605) +#define SID_MDIWINDOWLIST (SID_SFX_START + 610) +#define SID_NEWWINDOW (SID_SFX_START + 620) +#define SID_CLOSEWIN (SID_SFX_START + 621) +#define SID_VIEWSHELL (SID_SFX_START + 623) +#define SID_WIN_FULLSCREEN (SID_SFX_START + 627) + // FREE, was SID_WIN_POSSIZE +#define SID_WIN_VISIBLE (SID_SFX_START + 629) + +#define SID_VIEWSHELL0 (SID_SFX_START + 630) +#define SID_VIEWSHELL1 (SID_SFX_START + 631) +#define SID_VIEWSHELL2 (SID_SFX_START + 632) +#define SID_VIEWSHELL3 (SID_SFX_START + 633) +#define SID_VIEWSHELL4 (SID_SFX_START + 634) + +#define SID_CAPTION (SID_SFX_START + 641) + +// id for thesaurs entry in context menu +#define SID_THES (SID_SFX_START + 698) + +// default-ids for editing, cursor travellung and selection +#define SID_REDO (SID_SFX_START + 700) +#define SID_UNDO (SID_SFX_START + 701) +#define SID_REPEAT (SID_SFX_START + 702) +#define SID_CLEARHISTORY (SID_SFX_START + 703) +#define SID_CUT (SID_SFX_START + 710) +#define SID_COPY (SID_SFX_START + 711) +#define SID_PASTE (SID_SFX_START + 712) + +#define SID_BACKSPACE (SID_SFX_START + 714) +#define SID_FORMATPAINTBRUSH (SID_SFX_START + 715) +#define SID_SELECT (SID_SFX_START + 720) +#define SID_SELECTALL (SID_SFX_START + 723) +#define SID_CURSORDOWN (SID_SFX_START + 731) +#define SID_CURSORUP (SID_SFX_START + 732) +#define SID_CURSORLEFT (SID_SFX_START + 733) +#define SID_CURSORRIGHT (SID_SFX_START + 734) +#define SID_CURSORPAGEDOWN (SID_SFX_START + 735) +#define SID_CURSORPAGEUP (SID_SFX_START + 736) +#define SID_CURSORPAGERIGHT (SID_SFX_START + 737) +#define SID_CURSORPAGELEFT (SID_SFX_START + 738) +#define SID_CURSORENDOFFILE (SID_SFX_START + 741) +#define SID_CURSORTOPOFFILE (SID_SFX_START + 742) +#define SID_CURSORENDOFSCREEN (SID_SFX_START + 743) +#define SID_CURSORTOPOFSCREEN (SID_SFX_START + 744) +#define SID_CURSORHOME (SID_SFX_START + 745) +#define SID_CURSOREND (SID_SFX_START + 746) +#define SID_FORMATMENU (SID_SFX_START + 780) +#define SID_OBJECTMENU0 SID_FORMATMENU +#define SID_OBJECTMENU3 (SID_SFX_START + 783) +#define SID_OBJECTMENU_LAST SID_OBJECTMENU3 +#define SID_FORMATMENUSTATE (SID_SFX_START + 791) + +// default-ids for macros +#define SID_RECORDING_FLOATWINDOW (SID_SFX_START + 800) +#define SID_RECORDMACRO (SID_SFX_START + 1669) +#define SID_PASTE_ONLY (SID_SFX_START + 801) +#define SID_PASTE_ONLY_TEXT (SID_SFX_START + 802) +#define SID_PASTE_ONLY_FORMULA (SID_SFX_START + 803) +#define SID_PASTE_ONLY_VALUE (SID_SFX_START + 804) + // FREE: SID_SFX_START + 805 + // FREE: SID_SFX_START + 806 + // FREE: SID_SFX_START + 807 + // FREE: SID_SFX_START + 808 + // FREE: SID_SFX_START + 809 + // FREE: SID_SFX_START + 810 +#define SID_ASYNCHRON (SID_SFX_START + 811) + +// default-ids for configuration +#define SID_CONFIG (SID_SFX_START + 904) +#define SID_TOGGLECOMMONTASKBAR (SID_SFX_START + 928) +#define SID_TOOLBOXOPTIONS (SID_SFX_START + 907) +#define SID_TOGGLEFUNCTIONBAR (SID_SFX_START + 910) +#define SID_CONFIGITEMID (SID_SFX_START + 919) +#define SID_MACROINFO (SID_SFX_START + 919) +#define SID_TOGGLESTATUSBAR (SID_SFX_START + 920) +#define SID_CONFIGSTATUSBAR (SID_SFX_START + 921) +#define SID_CONFIGMENU (SID_SFX_START + 924) +#define SID_CONFIGACCEL (SID_SFX_START + 925) +#define SID_CONFIGEVENT (SID_SFX_START + 926) +#define SID_CFGFILE (SID_SFX_START + 927) +#define SID_SHOWPOPUPS (SID_SFX_START + 929) +#define SID_TASKBAR (SID_SFX_START + 931) +#define SID_AUTOHIDE (SID_SFX_START + 932) + +// Item-Id for the assinged event Tabpage +#define SID_ATTR_MACROITEM (SID_SFX_START + 934) + +#define SID_SAVECONFIG (SID_SFX_START + 930) +#define SID_LOADCONFIG (SID_SFX_START + 933) +#define SID_OPTIONS (SID_SFX_START + 940) +#define SID_BASICLOAD (SID_SFX_START + 951) +#define SID_BASICSAVEAS (SID_SFX_START + 953) +#define SID_BASICCOMPILE (SID_SFX_START + 954) +#define SID_BASICRUN (SID_SFX_START + 955) +#define SID_BASICSTEPINTO (SID_SFX_START + 956) +#define SID_BASICSTEPOVER (SID_SFX_START + 957) +#define SID_BASICSTEPOUT (SID_SFX_START + 963) +#define SID_BASICSTOP (SID_SFX_START + 958) +#define SID_BASICCHOOSER (SID_SFX_START + 959) +#define SID_GALLERY (SID_SFX_START + 960) +#define SID_SEARCH_DLG (SID_SFX_START + 961) +#define SID_SEARCH_QUIET (SID_SFX_START + 1684) +#define SID_HELP_PI (SID_SFX_START + 962) +#define SID_BASIC_ENABLED (SID_SFX_START + 964) +#define SID_EXPORT_DIALOG (SID_SFX_START + 965) +#define SID_IMPORT_DIALOG (SID_SFX_START + 966) + +#define SID_BASICBREAK (SID_SFX_START +1521) + +#define SID_OBJECTRESIZE (SID_SFX_START + 1000) + +#define SID_EVENTCONFIG (SID_SFX_START + 1101) +#define SID_VERB_START (SID_SFX_START + 1100) +#define SID_VERB_END (SID_SFX_START + 1121) + +#define SID_SIGNATURE (SID_SFX_START + 1643) + +#define SID_FRAMEDESCRIPTOR (SID_SFX_START + 1229) + +// SaveTabPage +#define SID_ATTR_DOCINFO (SID_OPTIONS_START + 0) +#define SID_ATTR_BACKUP (SID_OPTIONS_START + 1) +#define SID_ATTR_AUTOSAVE (SID_OPTIONS_START + 2) +#define SID_ATTR_AUTOSAVEPROMPT (SID_OPTIONS_START + 3) +#define SID_ATTR_USERAUTOSAVE (SID_OPTIONS_START + 4) +#define SID_ATTR_AUTOSAVEMINUTE (SID_OPTIONS_START + 5) +#define SID_ATTR_WORKINGSET (SID_OPTIONS_START + 13) +#define SID_ATTR_UNDO_COUNT (SID_OPTIONS_START + 16) + // unused +#define SID_ATTR_SAVEDOCVIEW (SID_OPTIONS_START + 18) + +// GeneralTabPage + +#define SID_ATTR_METRIC (SID_OPTIONS_START + 8) +#define SID_ATTR_DEFTABSTOP (SID_OPTIONS_START + 14) +#define SID_ATTR_BUTTON_OUTSTYLE3D (SID_OPTIONS_START + 62) +#define SID_ATTR_BUTTON_BIGSIZE (SID_OPTIONS_START + 63) +#define SID_ATTR_AUTOHELPAGENT (SID_OPTIONS_START + 67) +#define SID_HELPAGENT_TIMEOUT (SID_OPTIONS_START + 93) +#define SID_ATTR_WELCOMESCREEN (SID_OPTIONS_START + 81) +#define SID_WELCOMESCREEN_RESET (SID_OPTIONS_START + 82) +#define SID_ATTR_QUICKLAUNCHER (SID_OPTIONS_START + 74) +#define SID_ATTR_YEAR2000 (SID_OPTIONS_START + 87) +#define SID_ATTR_APPLYCHARUNIT (SID_OPTIONS_START + 88) + + +// PathTabPage +#define SID_ATTR_PATHGROUP (SID_OPTIONS_START + 10) +#define SID_ATTR_PATHNAME (SID_OPTIONS_START + 11) + +// LinguTabPage +#define SID_ATTR_LANGUAGE (SID_OPTIONS_START + 7) +#define SID_ATTR_SPELL (SID_OPTIONS_START + 9) +#define SID_ATTR_HYPHENREGION (SID_OPTIONS_START + 12) +#define SID_SPELL_MODIFIED (SID_OPTIONS_START + 15) +#define SID_AUTOSPELL_CHECK (SID_OPTIONS_START + 21) + +// InetTabPage + +#define SID_INET_PROXY_TYPE (SID_OPTIONS_START + 23) +#define SID_INET_PROXY_PORT (SID_OPTIONS_START + 25) + +#define SID_INET_SMTPSERVER (SID_OPTIONS_START + 33) +#define SID_PASSWORD (SID_OPTIONS_START + 36) + +#define SID_INET_NOPROXY (SID_OPTIONS_START + 37) + +#define SID_INET_HTTP_PROXY_NAME (SID_OPTIONS_START + 38) +#define SID_INET_HTTP_PROXY_PORT (SID_OPTIONS_START + 39) +#define SID_INET_FTP_PROXY_NAME (SID_OPTIONS_START + 40) +#define SID_INET_FTP_PROXY_PORT (SID_OPTIONS_START + 41) +#define SID_INET_SOCKS_PROXY_PORT (SID_OPTIONS_START + 43) + +#define SID_INET_EXE_PLUGIN (SID_OPTIONS_START + 52) + +#define SID_INET_DNS_AUTO (SID_OPTIONS_START + 57) +#define SID_INET_DNS_SERVER (SID_OPTIONS_START + 58) + +#define SID_SAVEREL_INET (SID_OPTIONS_START + 30) +#define SID_SAVEREL_FSYS (SID_OPTIONS_START + 31) + +// Automatic update of Styles - manage TabPage +#define SID_ATTR_AUTO_STYLE_UPDATE (SID_OPTIONS_START + 65) + +#define SID_SECURE_URL (SID_OPTIONS_START + 66) + +// configured locale changed +#define SID_OPT_LOCALE_CHANGED (SID_OPTIONS_START + 94) +//middle mouse button +#define SID_ATTR_PRETTYPRINTING (SID_OPTIONS_START + 98) +#define SID_HELP_STYLESHEET (SID_OPTIONS_START + 99) + +// slot IDs from SVX (svxids.hrc) --------------------------------------------- + +#define SID_ZOOM_TOOLBOX (SID_SVX_START + 96) +#define SID_ZOOM_OUT (SID_SVX_START + 97) +#define SID_ZOOM_IN (SID_SVX_START + 98) +#define SID_SIZE_REAL (SID_SVX_START + 99) +#define SID_SIZE_PAGE (SID_SVX_START + 100) +#define SID_SHOW_BROWSER (SID_SVX_START + 163) +#define SID_GALLERY_BG_BRUSH (SID_SVX_START + 279) +#define SID_SEARCH_OPTIONS (SID_SVX_START + 281) +#define SID_ZOOM (SID_SVX_START + 289) +#define SID_SEARCH_ITEM (SID_SVX_START + 291) +#define SID_HYPERLINK_GETLINK (SID_SVX_START + 361) +#define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) +#define SID_INFOBARCONTAINER (SID_SVX_START + 365) +#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) +#define SID_AUTO_CORRECT_DLG (SID_SVX_START + 424) +#define SID_SD_AUTOPILOT (SID_SVX_START + 425) +#define SID_ATTR_CHAR_COLOR_EXT (SID_SVX_START + 488) +#define SID_ATTR_CHAR_COLOR_BACKGROUND (SID_SVX_START + 489) +#define SID_ATTR_CHAR_COLOR_BACKGROUND_EXT (SID_SVX_START + 490) +#define SID_ATTR_CHAR_COLOR2 (SID_SVX_START + 537) +#define SID_COMP_BIBLIOGRAPHY (SID_SVX_START + 880) +#define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934) + +#define FID_SVX_START (SID_LIB_START + 500) +#define FID_SEARCH_NOW (FID_SVX_START + 2) + +// SlotIds for Basic ------------------------------------------------------- +#define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 ) +#define SID_BASICIDE_ADDWATCH ( SID_BASICIDE_START + 1 ) +#define SID_BASICIDE_APPEAR ( SID_BASICIDE_START + 15 ) +#define SID_BASICIDE_BRKPNTSCHANGED ( SID_BASICIDE_START + 36 ) +#define SID_BASICIDE_CHOOSEMACRO ( SID_BASICIDE_START + 2 ) +#define SID_BASICIDE_CREATEMACRO ( SID_BASICIDE_START + 4 ) +#define SID_BASICIDE_DELETECURRENT ( SID_BASICIDE_START + 22 ) +#define SID_BASICIDE_EDITMACRO ( SID_BASICIDE_START + 3 ) +#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 ) +#define SID_BASICIDE_LIBLOADED ( SID_BASICIDE_START + 27 ) +#define SID_BASICIDE_LIBSELECTOR ( SID_BASICIDE_START + 19 ) +#define SID_BASICIDE_LIBSELECTED ( SID_BASICIDE_START + 18 ) +#define SID_BASICIDE_LIBREMOVED ( SID_BASICIDE_START + 28 ) +#define SID_BASICIDE_ARG_LIBNAME ( SID_BASICIDE_START + 34 ) +#define SID_BASICIDE_MATCHGROUP ( SID_BASICIDE_START + 14 ) +#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 ) +#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 ) +#define SID_BASICIDE_ARG_TABID ( SID_BASICIDE_START + 30 ) +#define SID_BASICIDE_ARG_MACROINFO ( SID_BASICIDE_START + 32 ) +#define SID_BASICIDE_ARG_MODULENAME ( SID_BASICIDE_START + 35 ) +#define SID_BASICIDE_ARG_SBX ( SID_BASICIDE_START + 31 ) +#define SID_BASICIDE_NEWMODULE ( SID_BASICIDE_START + 21 ) +#define SID_BASICIDE_NEWDIALOG ( SID_BASICIDE_START + 20 ) +#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 ) +#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 ) +#define SID_BASICIDE_RENAMECURRENT ( SID_BASICIDE_START + 23 ) +#define SID_BASICIDE_SBXDELETED ( SID_BASICIDE_START + 24 ) +#define SID_BASICIDE_SBXINSERTED ( SID_BASICIDE_START + 25 ) +#define SID_BASICIDE_SBXRENAMED ( SID_BASICIDE_START + 26 ) +#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 ) +#define SID_BASICIDE_STAT_POS ( SID_BASICIDE_START + 38 ) +#define SID_BASICIDE_STAT_DATE ( SID_BASICIDE_START + 39 ) +#define SID_BASICIDE_STAT_TITLE ( SID_BASICIDE_START + 40 ) +#define SID_BASICIDE_STOREMODULESOURCE ( SID_BASICIDE_START + 13 ) +#define SID_BASICIDE_STOREALLMODULESOURCES ( SID_BASICIDE_START + 16 ) +#define SID_BASICIDE_UPDATEALLMODULESOURCES ( SID_BASICIDE_START + 17 ) +#define SID_BASICIDE_UPDATEMODULESOURCE ( SID_BASICIDE_START + 12 ) +#define SID_BASICIDE_MANAGEBRKPNTS ( SID_BASICIDE_START + 42 ) +#define SID_BASICIDE_TOGGLEBRKPNTENABLED ( SID_BASICIDE_START + 43 ) +#define SID_BASICIDE_SHOWWINDOW ( SID_BASICIDE_START + 44 ) +#define SID_BASICIDE_ARG_DOCUMENT ( SID_BASICIDE_START + 45 ) +#define SID_BASICIDE_ARG_NAME ( SID_BASICIDE_START + 46 ) +#define SID_BASICIDE_ARG_TYPE ( SID_BASICIDE_START + 47 ) +#define SID_BASICIDE_ARG_LINE ( SID_BASICIDE_START + 48 ) +#define SID_BASICIDE_ARG_COLUMN1 ( SID_BASICIDE_START + 49 ) +#define SID_BASICIDE_ARG_COLUMN2 ( SID_BASICIDE_START + 50 ) +#define SID_BASICIDE_ARG_DOCUMENT_MODEL ( SID_BASICIDE_START + 51 ) +#define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 ) +#define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 ) + +// SlotIds for Apps -------------------------------------------------------- +#define FN_PARAM (SID_SW_START + 1100) +#define FN_PARAM_1 (FN_PARAM+60) +#define FN_PARAM_2 (FN_PARAM+61) +#define FN_PARAM_3 (FN_PARAM+62) +#define FN_PARAM_4 (FN_PARAM+63) +#define FN_PARAM_5 (FN_PARAM+64) +#define FN_PARAM_6 (FN_PARAM+65) +#define FN_FAX (SID_SW_START + 28) /* Fax */ + +#define SID_KEYFUNC_START (SID_SC_START + 521) +#define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0) +#define SID_CURSORUP_SEL (SID_KEYFUNC_START + 1) +#define SID_CURSORLEFT_SEL (SID_KEYFUNC_START + 2) +#define SID_CURSORRIGHT_SEL (SID_KEYFUNC_START + 3) +#define SID_CURSORPAGEDOWN_SEL (SID_KEYFUNC_START + 4) +#define SID_CURSORPAGEUP_SEL (SID_KEYFUNC_START + 5) +#define SID_CURSORPAGELEFT_SEL (SID_KEYFUNC_START + 7) +#define SID_CURSORPAGERIGHT_SEL (SID_KEYFUNC_START + 9) +#define SID_CURSORTOPOFFILE_SEL (SID_KEYFUNC_START + 10) +#define SID_CURSORENDOFFILE_SEL (SID_KEYFUNC_START + 11) +#define SID_CURSORHOME_SEL (SID_KEYFUNC_START + 12) +#define SID_CURSOREND_SEL (SID_KEYFUNC_START + 13) +#define SID_REPAINT (SID_SC_START + 12) + +#define SID_MODIFIED (SID_SD_START+89) +#define ID_VAL_DUMMY0 (SID_SD_START+230) +#define ID_VAL_ZOOM (SID_SD_START+234) +#define SID_SIZE_OPTIMAL (SID_SD_START+99) + +//----------------------------------------------------------------------- + +#define SID_ZOOM_OPTIMAL (SID_SIZE_OPTIMAL) +#define SID_ZOOM_ENTIRE_PAGE (SID_SIZE_PAGE) +#define SID_ZOOM_PAGE_WIDTH (SID_SVX_START + 1420) +#define SID_ZOOM_50_PERCENT (SID_SVX_START + 1421) +#define SID_ZOOM_75_PERCENT (SID_SVX_START + 1422) +#define SID_ZOOM_100_PERCENT (SID_SIZE_REAL) +#define SID_ZOOM_150_PERCENT (SID_SVX_START + 1423) +#define SID_ZOOM_200_PERCENT (SID_SVX_START + 1424) + +//----------------------------------------------------------------------- + +// SfxScriptOrganizerItem +#define MID_SCRIPT_ORGANIZER_LANGUAGE 1 // Don't use zero for MID's. It's forbidden to do it! + +#define SID_NEWSD (SID_SFX_START + 1686) +#define FN_LABEL (SID_SW_START + 1051 ) +#define FN_BUSINESS_CARD (SID_SW_START + 1052) +#define FN_XFORMS_INIT (SID_SW_START + 1053) +#define SID_OPTIONS_TREEDIALOG ( SID_BASICIDE_START + 862) + + +#define SID_RESTORE_EDITING_VIEW (SID_SFX_START + 1663) + +#endif // #ifndef _SFXSIDS_HRC + +//----------------------------------------------------------------------- +// SfxSecurityPage related stuff + +#define FN_EDIT2 (SID_SW_START + 1800) +#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) +#define FN_REDLINE_ON (FN_EDIT2 + 25) + +#define SID_HTML_MODE (SID_SVX_START + 414) + +// Calc-Id's used for SfxSecurityPage +#ifndef SC_FUNCTION_START +#define SC_FUNCTION_START (SID_SC_START + 200) +#endif +#ifndef FILE_MENU_END +#define FILE_MENU_END (SC_FUNCTION_START + 20) +#endif +#ifndef EDIT_MENU_START +#define EDIT_MENU_START (FILE_MENU_END) +#endif +#ifndef SC_VIEW_START +#define SC_VIEW_START (SID_SC_START) +#endif +#define FID_CHG_RECORD (EDIT_MENU_START + 18) +#define SID_CHG_PROTECT (SC_VIEW_START + 84) + +// eof ------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxstatuslistener.hxx b/include/sfx2/sfxstatuslistener.hxx new file mode 100644 index 000000000000..9e6be020db10 --- /dev/null +++ b/include/sfx2/sfxstatuslistener.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFXSTATUSLISTENER_HXX +#define _SFXSTATUSLISTENER_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <svl/poolitem.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/conditn.hxx> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> + +#include <sfx2/sfxuno.hxx> + +// Interface for implementations which needs to get notifications about state changes +class SfxStatusListenerInterface +{ + public: + virtual void StateChanged( sal_uInt16 nSlotId, SfxItemState eState, const SfxPoolItem* pState ) = 0; + + protected: + ~SfxStatusListenerInterface() {} +}; + +class SFX2_DLLPUBLIC SfxStatusListener : + public ::com::sun::star::frame::XStatusListener , + public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::lang::XComponent , + public ::cppu::OWeakObject +{ + public: + SFX_DECL_XINTERFACE_XTYPEPROVIDER + + SfxStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand ); + virtual ~SfxStatusListener(); + + // old methods from SfxControllerItem + sal_uInt16 GetId() const { return m_nSlotID; } + void UnBind(); + void ReBind(); + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + + // XComponent + virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) 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 ); + + // XStatusListener + virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException ); + + private: + SfxStatusListener( const SfxStatusListener& ); + SfxStatusListener(); + SfxStatusListener& operator=( const SfxStatusListener& ); + + sal_uInt16 m_nSlotID; + ::com::sun::star::util::URL m_aCommand; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xDispatch; +}; + +#endif // _SFXSTATUSLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/sfxuno.hxx b/include/sfx2/sfxuno.hxx new file mode 100644 index 000000000000..6b0a2763497e --- /dev/null +++ b/include/sfx2/sfxuno.hxx @@ -0,0 +1,638 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SFX_SFXUNO_HXX +#define _SFX_SFXUNO_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/task/ErrorCodeIOException.hpp> +#include <com/sun/star/beans/NamedValue.hpp> + +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/factory.hxx> + +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> + + +inline sal_Bool operator==( const css::util::URL& aURL1, const css::util::URL& aURL2 ) +{ + return aURL1.Complete == aURL2.Complete; +} + +class SfxAllItemSet ; +class SfxItemSet ; +class SfxSlot ; + +SFX2_DLLPUBLIC void TransformParameters( sal_uInt16 nSlotId , + const css::uno::Sequence< css::beans::PropertyValue >& seqArgs , + SfxAllItemSet& aSet , + const SfxSlot* pSlot = 0 ); + +SFX2_DLLPUBLIC void TransformItems( sal_uInt16 nSlotId , + const SfxItemSet& aSet , + css::uno::Sequence< css::beans::PropertyValue >& seqArgs , + const SfxSlot* pSlot = 0 ); + +bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< css::beans::NamedValue >& aEncryptionData ); + +#define FrameSearchFlags sal_Int32 + +// Macros to convert string -> unicode and unicode -> string. +// We use UTF8 everytime. Its the best way to do this! +#define S2U(STRING) OStringToOUString(STRING, RTL_TEXTENCODING_UTF8) +#define U2S(STRING) OUStringToOString(STRING, RTL_TEXTENCODING_UTF8) + +//________________________________________________________________________________________________________________________ +// macros for declaration and definition of uno-services +//________________________________________________________________________________________________________________________ + +//************************************************************************************************************************ +// declaration of XInterface::queryInterface() +// XInterface::aquire() +// XInterface::release() +// XTypeProvider::getTypes() +// XTypeProvider::getImplementationId() +//************************************************************************************************************************ +#define SFX_DECL_XINTERFACE \ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ); \ + virtual void SAL_CALL acquire() throw(); \ + virtual void SAL_CALL release() throw(); + +#define SFX_DECL_XTYPEPROVIDER \ + /* XTypeProvider */ \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException ); \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException ); + +#define SFX_DECL_XINTERFACE_XTYPEPROVIDER \ + SFX_DECL_XINTERFACE \ + SFX_DECL_XTYPEPROVIDER + +//************************************************************************************************************************ +// declaration of XInterface::queryInterface() +// XInterface::aquire() +// XInterface::release() +// XTypeProvider::getTypes() +// XTypeProvider::getImplementationId() +// XServiceInfo::getImplementationName() +// XServiceInfo::supportsService() +// XServiceInfo::getSupportedServiceNames() +// static xxx::impl_getStaticSupportedServiceNames() +// static xxx::impl_getStaticImplementationName() +// static xxx::impl_createInstance() +//************************************************************************************************************************ +#define SFX_DECL_XSERVICEINFO_NOFACTORY \ + /* XServiceInfo */ \ + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); \ + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ); \ + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); \ + \ + /* Helper for XServiceInfo */ \ + static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); \ + static OUString impl_getStaticImplementationName(); \ + \ + /* Helper for registry */ \ + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); + +//************************************************************************************************************************ +// declaration of XInterface::queryInterface() +// XInterface::aquire() +// XInterface::release() +// XTypeProvider::getTypes() +// XTypeProvider::getImplementationId() +// XServiceInfo::getImplementationName() +// XServiceInfo::supportsService() +// XServiceInfo::getSupportedServiceNames() +// static xxx::impl_getStaticSupportedServiceNames() +// static xxx::impl_getStaticImplementationName() +// static xxx::impl_createInstance() +// static xxx::impl_createFactory() +//************************************************************************************************************************ +#define SFX_DECL_XSERVICEINFO \ + SFX_DECL_XSERVICEINFO_NOFACTORY \ + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + +#define SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO \ + \ + /* XInterface + XTypeProvider */ \ + SFX_DECL_XINTERFACE_XTYPEPROVIDER \ + SFX_DECL_XSERVICEINFO + +//************************************************************************************************************************ +// implementation of XInterface::queryInterface() +// XInterface::aquire() +// XInterface::release() +//************************************************************************************************************************ +/*_________________________________________________________________________________________________________________________*/ +// DON'T USE FOLLOW MACROS DIRECTLY!!! +#define SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, IMPLINTERFACES ) \ + \ + void SAL_CALL IMPLCLASS::acquire() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::acquire(); \ + } \ + \ + void SAL_CALL IMPLCLASS::release() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::release(); \ + } \ + \ + css::uno::Any SAL_CALL IMPLCLASS::queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + css::uno::Any aReturn ( ::cppu::queryInterface( rType, \ + IMPLINTERFACES \ + ) \ + ); \ + /* If searched interface supported by this class ... */ \ + if ( aReturn.hasValue() == sal_True ) \ + { \ + /* ... return this information. */ \ + return aReturn ; \ + } \ + else \ + { \ + /* Else; ... ask baseclass for interfaces! */ \ + return BASECLASS::queryInterface( rType ); \ + } \ + } + +#define SFX_IMPL_INTERFACE_0 \ + static_cast< css::lang::XTypeProvider* >( this ) + +#define SFX_IMPL_INTERFACE_1( INTERFACE1 ) \ + SFX_IMPL_INTERFACE_0, \ + static_cast< INTERFACE1* >( this ) + +#define SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) \ + SFX_IMPL_INTERFACE_1( INTERFACE1 ), \ + static_cast< INTERFACE2* >( this ) + +#define SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \ + SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ), \ + static_cast< INTERFACE3* >( this ) + +#define SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \ + static_cast< INTERFACE4* >( this ) + +#define SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \ + static_cast< INTERFACE5* >( this ) + +#define SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \ + static_cast< INTERFACE6* >( this ) + +#define SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \ + static_cast< INTERFACE7* >( this ) + +#define SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \ + static_cast< INTERFACE8* >( this ) + +#define SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \ + static_cast< INTERFACE9* >( this ) + +#define SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \ + static_cast< INTERFACE10* >( this ) + +#define SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \ + static_cast< INTERFACE11* >( this ) + +#define SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \ + SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ), \ + static_cast< INTERFACE12* >( this ) + +#define SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \ + SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ), \ + static_cast< INTERFACE13* >( this ) +/*_________________________________________________________________________________________________________________________*/ + +// Follow macros can used directly :-) +// implementation of XInterface with 0 additional interface for queryInterface() +#define SFX_IMPL_XINTERFACE_0( IMPLCLASS, BASECLASS ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_0 ) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define SFX_IMPL_XINTERFACE_1( IMPLCLASS, BASECLASS, INTERFACE1 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_1( INTERFACE1 ) ) + +// implementation of XInterface with 2 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_2( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) ) + +// implementation of XInterface with 3 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_3( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) ) + +// implementation of XInterface with 4 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_4( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) ) + +// implementation of XInterface with 5 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_5( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) ) + +// implementation of XInterface with 6 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_6( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) ) + +// implementation of XInterface with 7 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_7( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) ) + +// implementation of XInterface with 8 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_8( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) ) + +// implementation of XInterface with 9 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_9( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) ) + +// implementation of XInterface with 10 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_10( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_11( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_12( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XINTERFACE_13( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \ + SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) ) + +//************************************************************************************************************************ +// implementation of XTypeProvider::getTypes() +// XTypeProvider::getImplementationId() +//************************************************************************************************************************ +/*_________________________________________________________________________________________________________________________*/ +// DON'T USE FOLLOW MACROS DIRECTLY!!! +#define SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, IMPLTYPES ) \ + \ + css::uno::Sequence< sal_Int8 > SAL_CALL IMPLCLASS::getImplementationId() throw( css::uno::RuntimeException ) \ + { \ + /* Create one Id for all instances of this class. */ \ + /* Use ethernet address to do this! (sal_True) */ \ + /* Optimize this method */ \ + /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \ + /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \ + static ::cppu::OImplementationId* pID = NULL ; \ + if ( pID == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pID == NULL ) \ + { \ + /* Create a new static ID ... */ \ + static ::cppu::OImplementationId aID( sal_False ); \ + /* ... and set his address to static pointer! */ \ + pID = &aID ; \ + } \ + } \ + return pID->getImplementationId(); \ + } \ + \ + css::uno::Sequence< css::uno::Type > SAL_CALL IMPLCLASS::getTypes() throw( css::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!*/ \ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create a static typecollection ... */ \ + static ::cppu::OTypeCollection aTypeCollection( IMPLTYPES ); \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &aTypeCollection ; \ + } \ + } \ + return pTypeCollection->getTypes(); \ + } + +#define SFX_IMPL_TYPE_0 \ + ::getCppuType(( const css::uno::Reference< css::lang::XTypeProvider >*)NULL ) + +#define SFX_IMPL_TYPE_1( TYPE1 ) \ + SFX_IMPL_TYPE_0, \ + ::getCppuType(( const css::uno::Reference< TYPE1 >*)NULL ) + +#define SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) \ + SFX_IMPL_TYPE_1( TYPE1 ), \ + ::getCppuType(( const css::uno::Reference< TYPE2 >*)NULL ) + +#define SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) \ + SFX_IMPL_TYPE_2( TYPE1, TYPE2 ), \ + ::getCppuType(( const css::uno::Reference< TYPE3 >*)NULL ) + +#define SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \ + SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ), \ + ::getCppuType(( const css::uno::Reference< TYPE4 >*)NULL ) + +#define SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \ + ::getCppuType(( const css::uno::Reference< TYPE5 >*)NULL ) + +#define SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \ + ::getCppuType(( const css::uno::Reference< TYPE6 >*)NULL ) + +#define SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \ + ::getCppuType(( const css::uno::Reference< TYPE7 >*)NULL ) + +#define SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \ + ::getCppuType(( const css::uno::Reference< TYPE8 >*)NULL ) + +#define SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \ + ::getCppuType(( const css::uno::Reference< TYPE9 >*)NULL ) + +#define SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \ + ::getCppuType(( const css::uno::Reference< TYPE10 >*)NULL ) + +#define SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \ + ::getCppuType(( const css::uno::Reference< TYPE11 >*)NULL ) + +#define SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \ + ::getCppuType(( const css::uno::Reference< TYPE12 >*)NULL ) + +#define SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ + SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ), \ + ::getCppuType(( const css::uno::Reference< TYPE13 >*)NULL ) +/*_________________________________________________________________________________________________________________________*/ + +// FOLLOW MACROS CAN USED DIRECTLY :-) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_0( IMPLCLASS ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_0 ) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_1( IMPLCLASS, TYPE1 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_1( TYPE1 ) ) + +// implementation of XInterface with 2 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_2( IMPLCLASS, TYPE1, TYPE2 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) ) + +// implementation of XInterface with 3 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_3( IMPLCLASS, TYPE1, TYPE2, TYPE3 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) ) + +// implementation of XInterface with 4 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_4( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) ) + +// implementation of XInterface with 5 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_5( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) ) + +// implementation of XInterface with 6 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_6( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) ) + +// implementation of XInterface with 7 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_7( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) ) + +// implementation of XInterface with 8 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_8( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) ) + +// implementation of XInterface with 9 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_9( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) ) + +// implementation of XInterface with 10 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_10( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_11( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_12( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define SFX_IMPL_XTYPEPROVIDER_13( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ + SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) ) + +//************************************************************************************************************************ +// implementation of XServiceInfo::getImplementationName() +// XServiceInfo::supportsService() +// XServiceInfo::getSupportedServiceNames() +// static xxx::impl_getStaticSupportedServiceNames() +// static xxx::impl_getStaticImplementationName() +// static xxx::impl_createInstance() +//************************************************************************************************************************ +#define SFX_IMPL_XSERVICEINFO( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \ + \ + /* XServiceInfo */ \ + OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /* XServiceInfo */ \ + sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \ + { \ + css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \ + const OUString* pArray = seqServiceNames.getConstArray(); \ + for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \ + { \ + if ( pArray[nCounter] == sServiceName ) \ + { \ + return sal_True ; \ + } \ + } \ + return sal_False ; \ + } \ + \ + /* XServiceInfo */ \ + css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /* Helper for XServiceInfo */ \ + css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \ + { \ + css::uno::Sequence< OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \ + return seqServiceNames ; \ + } \ + \ + /* Helper for XServiceInfo */ \ + OUString IMPLCLASS::impl_getStaticImplementationName() \ + { \ + return OUString::createFromAscii( IMPLNAME ); \ + } \ + \ + /* Helper for registry */ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \ + { \ + return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( xServiceManager ) ); \ + } + +//************************************************************************************************************************ +// implementation of XServiceInfo::getImplementationName() +// XServiceInfo::supportsService() +// XServiceInfo::getSupportedServiceNames() +// static xxx::impl_getStaticSupportedServiceNames() +// static xxx::impl_getStaticImplementationName() +// static xxx::impl_createInstance() +//************************************************************************************************************************ +#define SFX_IMPL_XSERVICEINFO_CTX( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \ + \ + /* XServiceInfo */ \ + OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /* XServiceInfo */ \ + sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \ + { \ + css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \ + const OUString* pArray = seqServiceNames.getConstArray(); \ + for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \ + { \ + if ( pArray[nCounter] == sServiceName ) \ + { \ + return sal_True ; \ + } \ + } \ + return sal_False ; \ + } \ + \ + /* XServiceInfo */ \ + css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /* Helper for XServiceInfo */ \ + css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \ + { \ + css::uno::Sequence< OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \ + return seqServiceNames ; \ + } \ + \ + /* Helper for XServiceInfo */ \ + OUString IMPLCLASS::impl_getStaticImplementationName() \ + { \ + return OUString::createFromAscii( IMPLNAME ); \ + } \ + \ + /* Helper for registry */ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \ + { \ + return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( comphelper::getComponentContext(xServiceManager) ) ); \ + } + +//************************************************************************************************************************ +// definition of createFactory() for MultiServices +//************************************************************************************************************************ +#define SFX_IMPL_SINGLEFACTORY( IMPLCLASS ) \ + \ + css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( \ + cppu::createSingleFactory( xServiceManager , \ + IMPLCLASS::impl_getStaticImplementationName() , \ + IMPLCLASS::impl_createInstance , \ + IMPLCLASS::impl_getStaticSupportedServiceNames() ) \ + ); \ + return xReturn ; \ + } + +//************************************************************************************************************************ +// definition of createFactory() for OneInstance-Services +//************************************************************************************************************************ +#define SFX_IMPL_ONEINSTANCEFACTORY( IMPLCLASS ) \ + \ + css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn( \ + cppu::createOneInstanceFactory( xServiceManager , \ + IMPLCLASS::impl_getStaticImplementationName() , \ + IMPLCLASS::impl_createInstance , \ + IMPLCLASS::impl_getStaticSupportedServiceNames() ) \ + ); \ + return xReturn ; \ + } + +//************************************************************************************************************************ +// definition for "extern c sfx_component_getFactory()" +//************************************************************************************************************************ +#define CREATEFACTORY(CLASS) \ + \ + /* Create right factory ... */ \ + xFactory = CLASS::impl_createFactory( xServiceManager ); + +//************************************************************************************************************************ +// definition for "extern c sfx_component_getFactory()" +//************************************************************************************************************************ +#define IF_NAME_CREATECOMPONENTFACTORY(CLASS) \ + \ + if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + CREATEFACTORY ( CLASS ) \ + } + +#endif // _SFX_SFXUNO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx new file mode 100644 index 000000000000..cba6efaf8e36 --- /dev/null +++ b/include/sfx2/shell.hxx @@ -0,0 +1,371 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_SHELL_HXX +#define _SFX_SHELL_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/embed/VerbDescriptor.hpp> +#include <tools/debug.hxx> +#include <tools/rtti.hxx> +#include <svl/brdcst.hxx> + +#include <tools/string.hxx> + +#include <sfx2/sfxuno.hxx> + +class ResMgr; +class Window; +class ToolBox; +class SfxItemPool; +class SfxPoolItem; +class SfxRequest; +class SfxItemSet; +struct SfxFormalArgument; +class StatusBar; +class SfxInterface; +class SfxViewShell; +class SfxObjectShell; +class SfxSlotPool; +class SvGlobalName; + +class SfxShellObject; +class SfxShell; +struct SfxShell_Impl; +class SfxShellObject; +class SfxDispatcher; +class SfxViewFrame; +class SfxSlot; +class SfxRepeatTarget; +class SbxVariable; +class SbxBase; +class SfxBindings; + +namespace svl +{ + class IUndoManager; +} + +//==================================================================== + +enum SfxInterfaceId + +/* [Description] + + Id for <SfxInterface>s, gives a quasi-static access to the interface + through an array to <SfxApplication>. +*/ + +{ + SFX_INTERFACE_NONE, + SFX_INTERFACE_SFXAPP, + SFX_INTERFACE_SFXDOCSH, + SFX_INTERFACE_SFXIPFRM, + SFX_INTERFACE_SFXVIEWSH, + SFX_INTERFACE_SFXVIEWFRM, + SFX_INTERFACE_SFXPLUGINFRM, + SFX_INTERFACE_SFXPLUGINOBJ, + SFX_INTERFACE_SFXPLUGINVIEWSH, + SFX_INTERFACE_SFXFRAMESETOBJ, + SFX_INTERFACE_SFXFRAMESETVIEWSH, + SFX_INTERFACE_SFXINTERNALFRM, + SFX_INTERFACE_SFXCOMPONENTDOCSH, + SFX_INTERFACE_SFXGENERICOBJ, + SFX_INTERFACE_SFXGENERICVIEWSH, + SFX_INTERFACE_SFXEXPLOBJ, + SFX_INTERFACE_SFXEXPLVIEWSH, + SFX_INTERFACE_SFXPLUGINVIEWSHDYNAMIC, + SFX_INTERFACE_SFXEXTERNALVIEWFRM, + SFX_INTERFACE_SFXMODULE, + SFX_INTERFACE_SFXFRAMESETVIEW, + SFX_INTERFACE_SFXFRAMESETSOURCEVIEW, + SFX_INTERFACE_SFXHELP_DOCSH, + SFX_INTERFACE_SFXHELP_VIEWSH, + SFX_INTERFACE_SFXTASK, + SFX_INTERFACE_OFA_START = 100, + SFX_INTERFACE_OFA_END = 100, + SFX_INTERFACE_SC_START = 150, + SFX_INTERFACE_SC_END = 199, + SFX_INTERFACE_SD_START = 200, + SFX_INTERFACE_SD_END = 249, + SFX_INTERFACE_SW_START = 250, + SFX_INTERFACE_SW_END = 299, + SFX_INTERFACE_SIM_START = 300, + SFX_INTERFACE_SIM_END = 319, + SFX_INTERFACE_SCH_START = 320, + SFX_INTERFACE_SCH_END = 339, + SFX_INTERFACE_SMA_START = 340, + SFX_INTERFACE_SMA_END = 359, + SFX_INTERFACE_SBA_START = 360, + SFX_INTERFACE_SBA_END = 399, + SFX_INTERFACE_IDE_START = 400, + SFX_INTERFACE_IDE_END = 409, + //-if one is still needed + SFX_INTERFACE_APP = SFX_INTERFACE_SW_START, + SFX_INTERFACE_LIB = 450 +}; + +//TODO/CLEANUP: replace by UNO constant +#define SVVERB_SHOW -1 + +//==================================================================== + +typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq); +typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet); + +class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster + +/* [Description] + + The class SfxShell is the base class for all classes, which provide + the functionality of the form <Slot>s. + + Each instance has a reference to an interface description, which is + obtainable through <SfxShell::GetInterface()const>. This interface + provides the connection to specific methods and contains some other + descriptive data for controllers like menus and toolboxes, but also + for the various APIs. The main part of the interface description is in + the form of a <Type-Library>, which is generated from an IDL-file by + the <SVIDL-Compiler>. For each SfxShell Subclass-File there is one + such IDL-file to write. +*/ + +{ + friend class SfxObjectItem; + + SfxShell_Impl* pImp; + SfxItemPool* pPool; + ::svl::IUndoManager* pUndoMgr; + +private: + SfxShell( const SfxShell & ); // internal + SfxShell& operator = ( const SfxShell & ); // internal + +protected: + SfxShell(); + SfxShell( SfxViewShell *pViewSh ); + +#ifndef _SFXSH_HXX + SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell* pView ); + SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ); + SAL_DLLPRIVATE SfxShellObject* GetShellObj_Impl() const; + SAL_DLLPRIVATE void SetShellObj_Impl( SfxShellObject* pObj ); +#endif + +public: + TYPEINFO(); + virtual ~SfxShell(); + + virtual SfxInterface* GetInterface() const; + static SfxInterface* GetStaticInterface() { return 0; } + + void SetName( const String &rName ); + const String& GetName() const; + + SfxViewShell* GetViewShell() const; + + void CallExec( SfxExecFunc pFunc, SfxRequest &rReq ) + { (*pFunc)(this, rReq); } + void CallState( SfxStateFunc pFunc, SfxItemSet &rSet ) + { (*pFunc)(this, rSet); } + + static void EmptyExecStub(SfxShell *pShell, SfxRequest &); + static void EmptyStateStub(SfxShell *pShell, SfxItemSet &); + + const SfxPoolItem* GetSlotState( sal_uInt16 nSlotId, const SfxInterface *pIF = 0, SfxItemSet *pStateSet = 0 ); + const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = 0 ); + const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, sal_Bool bAsync ); + sal_uIntPtr ExecuteSlot( sal_uInt16 nSlot, sal_uInt16 nMemberId, SbxVariable& rRet, SbxBase* pArgs = 0 ); + + inline SfxItemPool& GetPool() const; + inline void SetPool( SfxItemPool *pNewPool ) ; + + virtual ::svl::IUndoManager* + GetUndoManager(); + void SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ); + + SfxRepeatTarget* GetRepeatTarget() const; + void SetRepeatTarget( SfxRepeatTarget *pTarget ); + + virtual void Invalidate(sal_uInt16 nId = 0); + + sal_Bool IsActive() const; + virtual void Activate(sal_Bool bMDI); + virtual void Deactivate(sal_Bool bMDI); + virtual void ParentActivate(); + virtual void ParentDeactivate(); + + SfxDispatcher* GetDispatcher() const; + SfxViewFrame* GetFrame() const; + ResMgr* GetResMgr() const; + virtual sal_Bool HasUIFeature( sal_uInt32 nFeature ); + void UIFeatureChanged(); + + // Items + const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const; + void PutItem( const SfxPoolItem& rItem ); + + // TODO/CLEANUP: still needed?! + void SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& aVerbs); + const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbs() const; + void VerbExec (SfxRequest&); + void VerbState (SfxItemSet&); + SAL_DLLPRIVATE const SfxSlot* GetVerbSlot_Impl(sal_uInt16 nId) const; + + void SetHelpId(sal_uIntPtr nId); + sal_uIntPtr GetHelpId() const; + virtual SfxObjectShell* GetObjectShell(); + void SetDisableFlags( sal_uIntPtr nFlags ); + sal_uIntPtr GetDisableFlags() const; + + virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); + virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); + +#ifndef _SFXSH_HXX + SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); + SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); + SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); +#endif +}; + +//-------------------------------------------------------------------- +SfxItemPool& SfxShell::GetPool() const +/* + [Description] + + Each Subclass of SfxShell must reference a pool. This is partly set by + SFx's own set of subclasses (eg <SfxViewShell>). In particular however + this must be set directly from one derived SfxShell class and ny + derivatives of SfxObjectShell. + + The SfxShell class itself does not have any SfxItemPool, therfore a + null-pointer is returned. +*/ + +{ + DBG_ASSERT( pPool, "no pool" ); + return *pPool; +} +//------------------------------------------------------------------- +inline void SfxShell::SetPool +( + SfxItemPool* pNewPool // Pointer to the new Pool or null +) + +/* [Description] + + With this method, the subclasses register their special <SfxItemPool> + in the SfxShell. Each SfxShell instance must have access to a SfxItemPool. + Usually this is the SfxItemPool of the SfxDocumentShell. The SfxShell + subclass does not take ownership of the orphaned pool. Before it is + deleted it has to be deregisted with SetPool(0). +*/ + +{ + pPool = pNewPool; +} + +//===================================================================== + +#define SFX_ARGUMENTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[] = + +#define SFX_SLOTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[1]; \ + static SfxSlot a##ShellClass##Slots_Impl[] = + +#define SFX_SLOTMAP_ARG(ShellClass) static SfxSlot a##ShellClass##Slots_Impl[] = + +#define SFX_DECL_INTERFACE(nId) \ + static SfxInterface* pInterface; \ + private: \ + static void InitInterface_Impl(); \ + public: \ + static const SfxFormalArgument* pSfxFormalArgs_Impl; \ + static SfxInterface* GetStaticInterface(); \ + static SfxInterfaceId GetInterfaceId() {return SfxInterfaceId(nId);} \ + static void RegisterInterface(SfxModule* pMod=NULL); \ + virtual SfxInterface* GetInterface() const; + +#define SFX_IMPL_INTERFACE(Class,SuperClass,NameResId) \ + \ + SfxInterface* Class::pInterface = 0; \ + const SfxFormalArgument* Class::pSfxFormalArgs_Impl = a##Class##Args_Impl;\ + SfxInterface* Class::GetStaticInterface() \ + { \ + if ( !pInterface ) \ + { \ + pInterface = \ + new SfxInterface( \ + #Class, NameResId, GetInterfaceId(), \ + SuperClass::GetStaticInterface(), \ + a##Class##Slots_Impl[0], \ + (sal_uInt16) (sizeof(a##Class##Slots_Impl) / sizeof(SfxSlot) ) ); \ + InitInterface_Impl(); \ + } \ + return pInterface; \ + } \ + \ + SfxInterface* Class::GetInterface() const \ + { \ + return GetStaticInterface(); \ + } \ + \ + void Class::RegisterInterface(SfxModule* pMod) \ + { \ + GetStaticInterface()->Register(pMod); \ + } \ + \ + void Class::InitInterface_Impl() + +#define SFX_POSITION_MASK 0x000F +#define SFX_VISIBILITY_MASK 0xFFF0 +#define SFX_VISIBILITY_UNVISIBLE 0x0000 // Never visible +#define SFX_VISIBILITY_VIEWER 0x0040 +#define SFX_VISIBILITY_READONLYDOC 0x0400 +#define SFX_VISIBILITY_DESKTOP 0x0800 +#define SFX_VISIBILITY_STANDARD 0x1000 +#define SFX_VISIBILITY_FULLSCREEN 0x2000 +#define SFX_VISIBILITY_CLIENT 0x4000 +#define SFX_VISIBILITY_SERVER 0x8000 +#define SFX_VISIBILITY_NOCONTEXT 0xFFFF // Always visable + +#define SFX_OBJECTBAR_REGISTRATION(nPos,rResId) \ + GetStaticInterface()->RegisterObjectBar( nPos, rResId ) + +#define SFX_FEATURED_OBJECTBAR_REGISTRATION(nPos,rResId,nFeature) \ + GetStaticInterface()->RegisterObjectBar( nPos, rResId, nFeature ) + +#define SFX_CHILDWINDOW_REGISTRATION(nId) \ + GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_False ) + +#define SFX_FEATURED_CHILDWINDOW_REGISTRATION(nId,nFeature) \ + GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_False, nFeature ) + +#define SFX_CHILDWINDOW_CONTEXT_REGISTRATION(nId) \ + GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_True ) + +#define SFX_POPUPMENU_REGISTRATION(rResId) \ + GetStaticInterface()->RegisterPopupMenu( rResId ) + +#define SFX_STATUSBAR_REGISTRATION(rResId) \ + GetStaticInterface()->RegisterStatusBar( rResId ) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/signaturestate.hxx b/include/sfx2/signaturestate.hxx new file mode 100644 index 000000000000..ff17355d2f48 --- /dev/null +++ b/include/sfx2/signaturestate.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SFX2_SIGNATURESTATE_HXX +#define SFX2_SIGNATURESTATE_HXX + +// xmlsec05, check with SFX team +#define SIGNATURESTATE_UNKNOWN (sal_Int16)(-1) +#define SIGNATURESTATE_NOSIGNATURES (sal_Int16)0 +#define SIGNATURESTATE_SIGNATURES_OK (sal_Int16)1 +#define SIGNATURESTATE_SIGNATURES_BROKEN (sal_Int16)2 +// State was SIGNATURES_OK, but doc is modified now +#define SIGNATURESTATE_SIGNATURES_INVALID (sal_Int16)3 +// signature is OK, but certificate could not be validated +#define SIGNATURESTATE_SIGNATURES_NOTVALIDATED (sal_Int16)4 +//signatur and certificate are ok,but not al files are signed, as was the case in +//OOo 2.x - OOo 3.1.1. This state is only used together with document signatures. +#define SIGNATURESTATE_SIGNATURES_PARTIAL_OK (sal_Int16)5 + +#endif // SFX2_SIGNATURESTATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx new file mode 100644 index 000000000000..d94e76841045 --- /dev/null +++ b/include/sfx2/stbitem.hxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXSTBITEM_HXX +#define _SFXSTBITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <svl/poolitem.hxx> +#include <svtools/statusbarcontroller.hxx> + +//------------------------------------------------------------------ + +class SfxModule; +class StatusBar; +class SfxStatusBarControl; +class SfxBindings; + +svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + StatusBar* pStatusBar, + unsigned short nID, + const OUString& aCommandURL ); +typedef SfxStatusBarControl* (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); + +struct SfxStbCtrlFactory +{ + SfxStatusBarControlCtor pCtor; + TypeId nTypeId; + sal_uInt16 nSlotId; + + SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor, + TypeId nTheTypeId, sal_uInt16 nTheSlotId ): + pCtor(pTheCtor), + nTypeId(nTheTypeId), + nSlotId(nTheSlotId) + {} +}; + +//------------------------------------------------------------------ + +class CommandEvent; +class MouseEvent; +class UserDrawEvent; + +class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController +{ + sal_uInt16 nSlotId; + sal_uInt16 nId; + StatusBar* pBar; + +protected: + // new controller API + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + // Old sfx2 interface + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual void Click(); + virtual void DoubleClick(); + virtual void Command( const CommandEvent& rCEvt ); + virtual sal_Bool MouseButtonDown( const MouseEvent & ); + virtual sal_Bool MouseMove( const MouseEvent & ); + virtual sal_Bool MouseButtonUp( const MouseEvent & ); + virtual void Paint( const UserDrawEvent &rUDEvt ); + + static sal_uInt16 convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons ); + +public: + SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar ); + virtual ~SfxStatusBarControl(); + + sal_uInt16 GetSlotId() const { return nSlotId; } + sal_uInt16 GetId() const { return nId; } + StatusBar& GetStatusBar() const { return *pBar; } + void CaptureMouse(); + void ReleaseMouse(); + + static SfxStatusBarControl* CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule* ); + static void RegisterStatusBarControl(SfxModule*, SfxStbCtrlFactory*); + +}; + +//------------------------------------------------------------------ + +#define SFX_DECL_STATUSBAR_CONTROL() \ + static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \ + static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) + +#define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \ + SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \ + { return new Class( nSlotId, nId, rStb ); } \ + void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ + { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \ + Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx new file mode 100644 index 000000000000..b728be448a49 --- /dev/null +++ b/include/sfx2/styfitem.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_STYFITEM_HXX +#define _SFX_STYFITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <vcl/bitmap.hxx> +#include <vcl/image.hxx> +#include <tools/rc.hxx> +#include <rsc/rscsfx.hxx> +#include <vector> + +struct SfxFilterTupel { + String aName; + sal_uInt16 nFlags; +}; +typedef ::std::vector< SfxFilterTupel* > SfxStyleFilter; + +// CLASS ----------------------------------------------------------------- + +class SfxStyleFamilyItem: public Resource +{ + Image aImage; + Bitmap aBitmap; + String aText; + String aHelpText; + sal_uInt16 nFamily; + SfxStyleFilter aFilterList; + +public: + SfxStyleFamilyItem( const ResId &rId ); + ~SfxStyleFamilyItem(); + + const Bitmap& GetBitmap() const { return aBitmap; } + const String& GetText() const { return aText; } + const String& GetHelpText() const { return aHelpText; } + SfxStyleFamily GetFamily() const { return (SfxStyleFamily)nFamily; } + const SfxStyleFilter& GetFilterList() const { return aFilterList; } + const Image& GetImage() const { return aImage; } + + // -------------------------------------------------------------------- + class GrantAccess { friend class SfxStyleFamilies; }; + void SetImage( const Image& _rImg ) { aImage = _rImg; } +}; + +typedef ::std::vector< SfxStyleFamilyItem* > SfxStyleFamilyList; + +class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource +{ + SfxStyleFamilyList aEntryList; + +public: + /** ctor + <p>Will automatically call updateImages with BMP_COLOR_NORMAL.</p> + */ + SfxStyleFamilies( const ResId &); + SfxStyleFamilies( ) {}; + ~SfxStyleFamilies(); + + size_t size() const + { return aEntryList.size(); } + + const SfxStyleFamilyItem* at(size_t nIdx) const + { return (SfxStyleFamilyItem*)(aEntryList.empty() ? NULL : aEntryList[nIdx]); } + + /** updates the images of all single SfxStyleFamilyItems with new images from the given resource + + <p>The resource must contain a local image lists, with the id beeing the integer equivalent for the + requested bitmap mode, incremented by 1.</p> + + <p>Usually, you will use the same resource which originally constructed the object.</p> + + @return + <TRUE/> if an image list for the requested mode could be found in the given resource. + */ + sal_Bool updateImages( const ResId& _rId ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx new file mode 100644 index 000000000000..0580e4cae25c --- /dev/null +++ b/include/sfx2/styledlg.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_STYLEDLG_HXX +#define _SFX_STYLEDLG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <sfx2/tabdlg.hxx> + +class SfxStyleSheetBase; + +class SFX2_DLLPUBLIC SfxStyleDialog: public SfxTabDialog +{ +private: + SfxStyleSheetBase* pStyle; + DECL_DLLPRIVATE_LINK( CancelHdl, Button * ); +protected: + virtual const SfxItemSet* GetRefreshedSet(); + +public: +#define ID_TABPAGE_MANAGESTYLES 1 + SfxStyleDialog( Window* pParent, const ResId& rResId, SfxStyleSheetBase&, + sal_Bool bFreeRes = sal_True, const String* pUserBtnTxt = 0 ); + + ~SfxStyleDialog(); + + SfxStyleSheetBase& GetStyleSheet() { return *pStyle; } + const SfxStyleSheetBase& GetStyleSheet() const { return *pStyle; } + + virtual short Ok(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx new file mode 100644 index 000000000000..17016489e917 --- /dev/null +++ b/include/sfx2/tabdlg.hxx @@ -0,0 +1,306 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXTABDLG_HXX +#define _SFXTABDLG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/button.hxx> +#include <vcl/layout.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabdlg.hxx> +#include <vcl/tabpage.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +class SfxPoolItem; +class SfxTabDialog; +class SfxViewFrame; +class SfxTabPage; +class SfxBindings; + +typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet); +typedef sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value +struct TabPageImpl; + +struct TabDlg_Impl; + +#define ID_TABCONTROL 1 +#define RET_USER 100 +#define RET_USER_CANCEL 101 + +class SFX2_DLLPUBLIC SfxTabDialogItem: public SfxSetItem +{ +public: + TYPEINFO(); + SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ); + SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool=NULL); + virtual SfxPoolItem* Clone(SfxItemPool* pToPool) const; + virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const; +}; + +class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog +{ +private: +friend class SfxTabPage; +friend class SfxTabDialogController; + + SfxViewFrame* pFrame; + + VclBox *m_pBox; + TabControl *m_pTabCtrl; + + OKButton *m_pOKBtn; + PushButton* m_pApplyBtn; + PushButton* m_pUserBtn; + CancelButton* m_pCancelBtn; + HelpButton* m_pHelpBtn; + PushButton* m_pResetBtn; + PushButton* m_pBaseFmtBtn; + + bool m_bOwnsVBox; + bool m_bOwnsTabCtrl; + bool m_bOwnsActionArea; + bool m_bOwnsOKBtn; + bool m_bOwnsApplyBtn; + bool m_bOwnsUserBtn; + bool m_bOwnsCancelBtn; + bool m_bOwnsHelpBtn; + bool m_bOwnsResetBtn; + bool m_bOwnsBaseFmtBtn; + + const SfxItemSet* pSet; + SfxItemSet* pOutSet; + TabDlg_Impl* pImpl; + sal_uInt16* pRanges; + sal_uInt32 nResId; + sal_uInt16 nAppPageId; + sal_Bool bItemsReset; + sal_Bool bFmt; + + DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); + DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); + DECL_DLLPRIVATE_LINK(OkHdl, void *); + DECL_DLLPRIVATE_LINK(ResetHdl, void *); + DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *); + DECL_DLLPRIVATE_LINK(UserHdl, void *); + DECL_DLLPRIVATE_LINK(CancelHdl, void *); + SAL_DLLPRIVATE void Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId* pResId ); + +protected: + virtual short Ok(); + // Is deleted in Sfx! + virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId ); + // Is not deleted in Sfx! + virtual const SfxItemSet* GetRefreshedSet(); + virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); + virtual long Notify( NotifyEvent& rNEvt ); + + VclButtonBox* m_pActionArea; + SfxItemSet* pExampleSet; + SfxItemSet* GetInputSetImpl(); + SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const; + + /** prepare to leace the current page. Calls the DeactivatePage method of the current page, (if necessary), + handles the item sets to copy. + @return sal_True if it is allowed to leave the current page, sal_False otherwise + */ + bool PrepareLeaveCurrentPage(); + + /** save the position of the TabDialog and which tab page is the currently active one + */ + void SavePosAndId(); + +public: + SfxTabDialog( Window* pParent, + const OString& rID, const OUString& rUIXMLDescription, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False ); + SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, + const OString& rID, const OUString& rUIXMLDescription, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False ); + + + SfxTabDialog( Window* pParent, const ResId &rResId, const SfxItemSet * = 0, + sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 ); + SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId, + const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False, + const String *pUserButtonText = 0 ); + ~SfxTabDialog(); + + sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui + CreateTabPage pCreateFunc, // != 0 + GetTabPageRanges pRangesFunc, // can be 0 + sal_Bool bItemsOnDemand = sal_False); + + sal_uInt16 AddTabPage ( const OString &rName, // Name of the label for the page in the notebook .ui + sal_uInt16 nPageCreateId ); // Identifier of the Factory Method to create the page + + void AddTabPage( sal_uInt16 nId, + CreateTabPage pCreateFunc, // != 0 + GetTabPageRanges pRangesFunc, // can be 0 + sal_Bool bItemsOnDemand = sal_False); + + + void AddTabPage( sal_uInt16 nId, + const String &rRiderText, + CreateTabPage pCreateFunc, // != 0 + GetTabPageRanges pRangesFunc, // can be 0 + sal_Bool bItemsOnDemand = sal_False, + sal_uInt16 nPos = TAB_APPEND); + void AddTabPage( sal_uInt16 nId, + const Bitmap &rRiderBitmap, + CreateTabPage pCreateFunc, // != 0 + GetTabPageRanges pRangesFunc, // can be 0 + sal_Bool bItemsOnDemand = sal_False, + sal_uInt16 nPos = TAB_APPEND); + + void AddTabPage( sal_uInt16 nId, + sal_Bool bItemsOnDemand = sal_False); + void AddTabPage( sal_uInt16 nId, + const String &rRiderText, + sal_Bool bItemsOnDemand = sal_False, + sal_uInt16 nPos = TAB_APPEND); + void AddTabPage( sal_uInt16 nId, + const Bitmap &rRiderBitmap, + sal_Bool bItemsOnDemand = sal_False, + sal_uInt16 nPos = TAB_APPEND); + + void RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui + void RemoveTabPage( sal_uInt16 nId ); + + void SetCurPageId(sal_uInt16 nId) + { + nAppPageId = nId; + } + void SetCurPageId(const OString& rName) + { + nAppPageId = m_pTabCtrl->GetPageId(rName); + } + sal_uInt16 GetCurPageId() const + { + return m_pTabCtrl->GetCurPageId(); + } + void ShowPage( sal_uInt16 nId ); + + // may provide local slots converted by Map + const sal_uInt16* GetInputRanges( const SfxItemPool& ); + void SetInputSet( const SfxItemSet* pInSet ); + const SfxItemSet* GetOutputItemSet() const { return pOutSet; } + sal_Bool IsFormat() const { return bFmt; } + + const OKButton& GetOKButton() const { return *m_pOKBtn; } + OKButton& GetOKButton() { return *m_pOKBtn; } + const CancelButton& GetCancelButton() const { return *m_pCancelBtn; } + CancelButton& GetCancelButton() { return *m_pCancelBtn; } + const HelpButton& GetHelpButton() const { return *m_pHelpBtn; } + HelpButton& GetHelpButton() { return *m_pHelpBtn; } + + const PushButton* GetUserButton() const { return m_pUserBtn; } + PushButton* GetUserButton() { return m_pUserBtn; } + void RemoveResetButton(); + + short Execute(); + void StartExecuteModal( const Link& rEndDialogHdl ); + void Start( sal_Bool bShow = sal_True ); + + const SfxItemSet* GetExampleSet() const { return pExampleSet; } + SfxViewFrame* GetViewFrame() const { return pFrame; } + + void EnableApplyButton(sal_Bool bEnable = sal_True); + sal_Bool IsApplyButtonEnabled() const; + void SetApplyHandler(const Link& _rHdl); + + SAL_DLLPRIVATE void Start_Impl(); + + //calls Ok without closing dialog + bool Apply(); +}; + +namespace sfx { class ItemConnectionBase; } + +class SFX2_DLLPUBLIC SfxTabPage: public TabPage +{ +friend class SfxTabDialog; + +private: + const SfxItemSet* pSet; + String aUserString; + sal_Bool bHasExchangeSupport; + SfxTabDialog* pTabDlg; + TabPageImpl* pImpl; + + SAL_DLLPRIVATE void SetTabDialog( SfxTabDialog* pNew ) { pTabDlg = pNew; } + SAL_DLLPRIVATE void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; } + +protected: + SfxTabPage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet ); + SfxTabPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet); + + sal_uInt16 GetSlot( sal_uInt16 nWhich ) const + { return pSet->GetPool()->GetSlotId( nWhich ); } + sal_uInt16 GetWhich( sal_uInt16 nSlot, sal_Bool bDeep = sal_True ) const + { return pSet->GetPool()->GetWhich( nSlot, bDeep ); } + const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True ); + SfxTabDialog* GetTabDialog() const { return pTabDlg; } + + void AddItemConnection( sfx::ItemConnectionBase* pConnection ); + +public: + virtual ~SfxTabPage(); + + const SfxItemSet& GetItemSet() const { return *pSet; } + + virtual sal_Bool FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + + sal_Bool HasExchangeSupport() const + { return bHasExchangeSupport; } + void SetExchangeSupport( sal_Bool bNew = sal_True ) + { bHasExchangeSupport = bNew; } + + enum sfxpg { + KEEP_PAGE = 0x0000, // Error handling; page does not change + // 2. Fill an itemset for update + // parent examples, this pointer can be NULL all the time! + LEAVE_PAGE = 0x0001, + // Set, refresh and update other Page + REFRESH_SET = 0x0002 + }; + + using TabPage::ActivatePage; + using TabPage::DeactivatePage; + virtual void ActivatePage( const SfxItemSet& ); + virtual int DeactivatePage( SfxItemSet* pSet = 0 ); + void SetUserData(const String& rString) + { aUserString = rString; } + String GetUserData() { return aUserString; } + virtual void FillUserData(); + virtual sal_Bool IsReadOnly() const; + virtual void PageCreated (SfxAllItemSet aSet); + static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True ); + + void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/tabpage.hrc b/include/sfx2/tabpage.hrc new file mode 100644 index 000000000000..2c70183d433f --- /dev/null +++ b/include/sfx2/tabpage.hrc @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_TABPAGE_HRC +#define INCLUDED_SFX2_TABPAGE_HRC + +// Width and height of all tab pages used in dialogs. Because tab pages +// can be combined arbitrarily in tab dialogs, they have to have the +// same dimensions. If you need to adjust either dimension of any tab +// page (when adding new controls), do the change here. + +#define TP_WIDTH 260 +#define TP_HEIGHT 199 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx new file mode 100644 index 000000000000..0d0dd6eea199 --- /dev/null +++ b/include/sfx2/taskpane.hxx @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 OUString& i_rPanelURL ) = 0; + + protected: + ~ITaskPaneToolPanelAccess() {} + }; + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow + ,public ITaskPaneToolPanelAccess + { + public: + TaskPaneWrapper( + Window* i_pParent, + sal_uInt16 i_nId, + SfxBindings* i_pBindings, + SfxChildWinInfo* i_pInfo + ); + + SFX_DECL_CHILDWINDOW( TaskPaneWrapper ); + + // ITaskPaneToolPanelAccess + virtual void ActivateToolPanel( const 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 OUString& i_rLHS, + const OUString& i_rRHS + ) const = 0; + + protected: + ~IToolPanelCompare() {} + }; + + //================================================================================================================== + //= 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 ::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 OUString& i_rResourceURL ); + + /** returns the resource URL of the panel at the specified position + */ + 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(); + + /// activates the panel with the given URL + void ActivateToolPanel( const 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 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx new file mode 100644 index 000000000000..56047d1e32ad --- /dev/null +++ b/include/sfx2/tbxctrl.hxx @@ -0,0 +1,412 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXTBXCTRL_HXX +#define _SFXTBXCTRL_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <vcl/timer.hxx> +#include <vcl/menu.hxx> +#include <vcl/fixed.hxx> +#include <vcl/floatwin.hxx> +#include <comphelper/processfactory.hxx> +#include <sfx2/ctrlitem.hxx> +#include <sfx2/sfxstatuslistener.hxx> +#include <svtools/toolboxcontroller.hxx> +#include <svtools/framestatuslistener.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/frame/XSubToolbarController.hpp> + +//------------------------------------------------------------------ + +class SfxToolBoxControl; +class SfxBindings; +class SfxModule; +class SfxUnoControllerItem; + +svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL ); + +typedef SfxToolBoxControl* (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + +struct SfxTbxCtrlFactory +{ + SfxToolBoxControlCtor pCtor; + TypeId nTypeId; + sal_uInt16 nSlotId; + + SfxTbxCtrlFactory( SfxToolBoxControlCtor pTheCtor, + TypeId nTheTypeId, sal_uInt16 nTheSlotId ): + pCtor(pTheCtor), + nTypeId(nTheTypeId), + nSlotId(nTheSlotId) + {} +}; + +//------------------------------------------------------------------ + +enum SfxPopupWindowType +{ + SFX_POPUPWINDOW_NONE, + SFX_POPUPWINDOW_ONCLICK, + SFX_POPUPWINDOW_ONTIMEOUT, + SFX_POPUPWINDOW_ONCLICKANDMOVE, + SFX_POPUPWINDOW_ONTIMEOUTANDMOVE, + SFX_POPUPWINDOW_CONTEXTMENU +}; + +//------------------------------------------------------------------ + +class SfxFrameStatusListener : public svt::FrameStatusListener +{ + public: + SfxFrameStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + SfxStatusListenerInterface* pCallee ); + virtual ~SfxFrameStatusListener(); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) + throw ( ::com::sun::star::uno::RuntimeException ); + + private: + SfxStatusListenerInterface* m_pCallee; +}; + +//------------------------------------------------------------------ + +/* Floating windows that can be torn from tool boxes should be derived from + this class. Since it is also derived from SfxControllerItem, its instances + will also receive the StateChanged calls. +*/ + +class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow, public SfxStatusListenerInterface +{ + sal_Bool m_bFloating; + sal_uIntPtr m_nEventId; + sal_Bool m_bCascading; + Link m_aDeleteLink; + sal_uInt16 m_nId; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + SfxFrameStatusListener* m_pStatusListener; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xStatusListener; + +private: + SfxFrameStatusListener* GetOrCreateStatusListener(); + + SAL_DLLPRIVATE SfxPopupWindow(SfxPopupWindow &); // not defined + SAL_DLLPRIVATE void operator =(SfxPopupWindow &); // not defined + void Delete(); + +protected: + virtual void PopupModeEnd(); + virtual sal_Bool Close(); + virtual void DeleteFloatingWindow(); + + sal_uInt16 GetId() const { return m_nId; } + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& GetFrame() const { return m_xFrame; } + + void BindListener(); + void UnbindListener(); + void AddStatusListener( const OUString& rCommandURL ); + + // SfxStatusListenerInterface + using FloatingWindow::StateChanged; + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + +public: + SfxPopupWindow( sal_uInt16 nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + WinBits nBits ); + SfxPopupWindow( sal_uInt16 nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ResId &rId ); + SfxPopupWindow( sal_uInt16 nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + WinBits nBits ); + ~SfxPopupWindow(); + + virtual SfxPopupWindow* Clone() const; + virtual void MouseMove( const MouseEvent& rMEvt ); + + void StartCascading(); + SAL_DLLPRIVATE void SetDeleteLink_Impl( const Link& rLink ) + { + m_aDeleteLink = rLink; + } +}; + +//------------------------------------------------------------------ + +#define SFX_DECL_TOOLBOX_CONTROL() \ + static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \ + static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) + +/* For special ToolBox controls, such as a font selection box or toolbox + tear-off floating windows, an appropriate Item-Subclass of SfxTooBoxControl + has to be implemented. + + This class has to be registered in SfxApplication:Init() with the static + control method RegisterControl(). The SFx then automatically creates these + controls in the toolbox, if the associated slots are of the specific type. + */ + +struct SfxToolBoxControl_Impl; +class SFX2_DLLPUBLIC SfxToolBoxControl: + public ::com::sun::star::awt::XDockableWindowListener, + public ::com::sun::star::frame::XSubToolbarController, + public svt::ToolboxController + +{ +friend class SfxToolbox; +friend class SfxPopupWindow; +friend struct SfxTbxCtrlFactory; + + SfxToolBoxControl_Impl* pImpl; + +protected: + DECL_LINK( PopupModeEndHdl, void * ); + DECL_LINK( ClosePopupWindow, SfxPopupWindow * ); + + // old SfxToolBoxControl methods + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void Select( sal_Bool bMod1 = sal_False ); + virtual void Select( sal_uInt16 nModifier ); + + virtual void DoubleClick(); + virtual void Click(); + virtual SfxPopupWindowType GetPopupWindowType() const; + virtual SfxPopupWindow* CreatePopupWindow(); + virtual SfxPopupWindow* CreatePopupWindowCascading(); + virtual Window* CreateItemWindow( Window *pParent ); + + // Must be called by subclass to set a new popup window instance + void SetPopupWindow( SfxPopupWindow* pWindow ); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XEventListener + using ::cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // new controller API + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& rParent ) + throw (::com::sun::star::uno::RuntimeException); + + // XSubToolbarController + virtual ::sal_Bool SAL_CALL opensSubToolbar( ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getSubToolbarName( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL functionSelected( const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateImage( ) throw (::com::sun::star::uno::RuntimeException); + + // XDockableWindowListener + virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + // helper methods + void createAndPositionSubToolBar( const OUString& rSubToolBarResName ); + ::Size getPersistentFloatingSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& rSubToolBarResName ); + +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SfxToolBoxControl( sal_uInt16 nSlotID, sal_uInt16 nId, ToolBox& rBox, sal_Bool bShowStrings = sal_False ); + virtual ~SfxToolBoxControl(); + + ToolBox& GetToolBox() const; + unsigned short GetId() const; + unsigned short GetSlotId() const; + + void Dispatch( const OUString& aCommand, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ); + static void Dispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const OUString& rCommand, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ); + + static SfxItemState GetItemState( const SfxPoolItem* pState ); + static SfxToolBoxControl* CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule *pMod ); + static void RegisterToolBoxControl( SfxModule*, SfxTbxCtrlFactory*); +}; + +#define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \ + SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + { return new Class( nSlotId, nId, rTbx ); } \ + void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ + { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \ + Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } + +#define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \ + SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + { return new Class( nSlotId, nId, rTbx, Arg); } \ + void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ + { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \ + Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } + +//========================================================================= + + +class SfxDragButton_Impl : public FixedImage +{ +public: + + SfxDragButton_Impl( Window *pParent ); + virtual void Command ( const CommandEvent& rCEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); +}; + +class SfxDragToolBoxControl_Impl : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox ); + virtual Window* CreateItemWindow( Window *pParent ); + using SfxToolBoxControl::Select; + virtual void Select( sal_Bool bMod1 = sal_False ); +}; + +//------------------------------------------------------------------------ + +class SfxAppToolBoxControl_Impl : public SfxToolBoxControl + +/* [Description] + + Internal helper class for the pop-up menu <AppMenu_Impl> under new + start in the SDT. +*/ + +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + ~SfxAppToolBoxControl_Impl(); + void SetImage( const String& rFacName ); + + struct ExecuteInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo* ); + +protected: + virtual void Click(); + using SfxToolBoxControl::Select; + virtual void Select( sal_Bool ); + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual SfxPopupWindow* CreatePopupWindow(); + DECL_LINK( Activate, Menu * ); +private: + String aLastURL; + PopupMenu* pMenu; + sal_uIntPtr m_nSymbolsStyle; + sal_Bool m_bShowMenuImages; +}; + +class SfxHistoryToolBoxControl_Impl : public SfxToolBoxControl +{ + Timer aTimer; + +private: + DECL_LINK( Timeout, Timer * ); + +protected: + virtual void Click( ); + using SfxToolBoxControl::Select; + virtual void Select( sal_Bool ); + +public: + SFX_DECL_TOOLBOX_CONTROL(); + SfxHistoryToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox ); +}; + +class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl +{ + protected: + using SfxToolBoxControl::Select; + virtual void Select( sal_uInt16 nSelectModifier ); + + public: + SFX_DECL_TOOLBOX_CONTROL(); + SfxReloadToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); +}; + +class SfxPopupMenuManager; +class SfxAddonsToolBoxControl_Impl : public SfxToolBoxControl + +/* [Description] + + Internal helper class to provide the addons popup menu through the addons + toolbox button. +*/ + +{ + sal_Bool bBigImages; + PopupMenu* pMenu; + sal_Bool m_bShowMenuImages; + +protected: + virtual void Click(); + using SfxToolBoxControl::Select; + virtual void Select( sal_Bool ); + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + DECL_LINK( Activate, Menu * ); +public: + SFX_DECL_TOOLBOX_CONTROL(); + SfxAddonsToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + ~SfxAddonsToolBoxControl_Impl(); + + void RefreshMenuImages( Menu* pMenu ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx new file mode 100644 index 000000000000..5f1eca6a80fa --- /dev/null +++ b/include/sfx2/templateabstractview.hxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__ +#define __SFX2_TEMPLATEABSTRACTVIEW_HXX__ + +#include <sfx2/templateproperties.hxx> +#include <sfx2/thumbnailview.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> + +//template thumbnail item defines +#define TEMPLATE_ITEM_MAX_WIDTH 160 +#define TEMPLATE_ITEM_MAX_HEIGHT 140 +#define TEMPLATE_ITEM_PADDING 5 +#define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20 +#define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 88 + +//template thumbnail height with a subtitle +#define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160 + +//template thumbnail image defines +#define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING +#define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING + +class SfxDocumentTemplates; + +enum FILTER_APPLICATION +{ + FILTER_APP_NONE, + FILTER_APP_WRITER, + FILTER_APP_CALC, + FILTER_APP_IMPRESS, + FILTER_APP_DRAW +}; + +// Display template items depending on the generator application +class ViewFilter_Application +{ +public: + + ViewFilter_Application (FILTER_APPLICATION App) + : mApp(App) + {} + + virtual ~ViewFilter_Application () {} + + virtual bool operator () (const ThumbnailViewItem *pItem); + + bool isValid (const OUString& rPath) const; + +protected: + + FILTER_APPLICATION mApp; +}; + +class ViewFilter_Keyword +{ +public: + + ViewFilter_Keyword (const OUString &rKeyword) + : maKeyword(rKeyword) + {} + + bool operator () (const ThumbnailViewItem *pItem); + +private: + + OUString maKeyword; +}; + +class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView +{ +public: + + TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren); + + TemplateAbstractView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); + + virtual ~TemplateAbstractView (); + + void insertItem (const TemplateItemProperties &rTemplate); + + // Fill view with new item list + void insertItems (const std::vector<TemplateItemProperties> &rTemplates); + + // Fill view with template folders thumbnails + virtual void Populate () { } + + virtual void reload () { } + + virtual void showRootRegion () = 0; + + virtual void showRegion (ThumbnailViewItem *pItem) = 0; + + virtual sal_uInt16 createRegion (const OUString &rName) = 0; + + // Return if we can have regions inside the current region + virtual bool isNestedRegionAllowed () const = 0; + + // Return if we can import templates to the current region + virtual bool isImportAllowed () const = 0; + + sal_uInt16 getCurRegionId () const; + + const OUString& getCurRegionName () const; + + // Check if the root region is visible or not. + bool isNonRootRegionVisible () const; + + void setOpenRegionHdl(const Link &rLink); + + void setOpenTemplateHdl (const Link &rLink); + + static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height); + + static BitmapEx getDefaultThumbnail( const OUString& rPath ); + + static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height); + +protected: + + DECL_LINK(ShowRootRegionHdl, void*); + + virtual void OnItemDblClicked(ThumbnailViewItem *pItem); + +protected: + + sal_uInt16 mnCurRegionId; + OUString maCurRegionName; + + PushButton maAllButton; + FixedText maFTName; + + Link maOpenRegionHdl; + Link maOpenTemplateHdl; +}; + +#endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templatecontaineritem.hxx b/include/sfx2/templatecontaineritem.hxx new file mode 100644 index 000000000000..527571c80cac --- /dev/null +++ b/include/sfx2/templatecontaineritem.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef TEMPLATEFOLDERVIEWITEM_HXX +#define TEMPLATEFOLDERVIEWITEM_HXX + +#include <sfx2/templateproperties.hxx> +#include <sfx2/thumbnailviewitem.hxx> + +class TemplateContainerItem : public ThumbnailViewItem +{ +public: + + sal_uInt16 mnRegionId; + BitmapEx maPreview2; + BitmapEx maPreview3; + BitmapEx maPreview4; + std::vector<TemplateItemProperties> maTemplates; + + TemplateContainerItem (ThumbnailView &rView); + + virtual ~TemplateContainerItem (); + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs); + + virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight, + const long nPadding, sal_uInt32 nMaxTextLenght, + const ThumbnailItemAttributes *pAttrs); + + bool HasMissingPreview( ); + +private: + + Rectangle maThumbnailArea; +}; + +#endif // TEMPLATEFOLDERVIEWITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx new file mode 100644 index 000000000000..69d79b20da9a --- /dev/null +++ b/include/sfx2/templateinfodlg.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#ifndef __SFX2_TEMPLATEINFODLG_HXX__ +#define __SFX2_TEMPLATEINFODLG_HXX__ + +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> + +namespace svtools { + class ODocumentInfoPreview; +} + +namespace com{ namespace sun { namespace star { namespace awt { class XWindow; } } } } +namespace com{ namespace sun { namespace star { namespace frame { class XFrame2; } } } } + +class SfxTemplateInfoDlg : public ModalDialog +{ +public: + + SfxTemplateInfoDlg (Window *pParent = NULL); + + ~SfxTemplateInfoDlg (); + + void loadDocument (const OUString &rURL); + +protected: + + DECL_LINK (CloseHdl, void*); + +private: + + PushButton maBtnClose; + + Window *mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor) + svtools::ODocumentInfoPreview *mpInfoView; + + ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; +}; + +#endif // __SFX2_TEMPLATEINFODLG_HXX__ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx new file mode 100644 index 000000000000..6cefaf1782c0 --- /dev/null +++ b/include/sfx2/templatelocalview.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef TEMPLATEFOLDERVIEW_HXX +#define TEMPLATEFOLDERVIEW_HXX + +#include <set> + +#include <sfx2/templateabstractview.hxx> + +class SfxDocumentTemplates; +class TemplateContainerItem; + +namespace com { + namespace sun { namespace star { namespace frame { + class XModel; + } } } +} + +class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView +{ + typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); + +public: + + TemplateLocalView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); + + virtual ~TemplateLocalView (); + + // Fill view with template folders thumbnails + virtual void Populate (); + + virtual void reload (); + + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); + + void showRegion (const OUString &rName); + + sal_uInt16 getCurRegionItemId () const; + + sal_uInt16 getRegionId (size_t pos) const; + + OUString getRegionName(const sal_uInt16 nRegionId) const; + + OUString getRegionItemName(const sal_uInt16 nItemId) const; + + std::vector<OUString> getFolderNames (); + + std::vector<TemplateItemProperties> + getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc) const; + + virtual sal_uInt16 createRegion (const OUString &rName); + + virtual bool isNestedRegionAllowed () const; + + virtual bool isImportAllowed () const; + + bool removeRegion (const sal_uInt16 nItemId); + + bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId); + + bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem, + const sal_uInt16 nTargetItem); + + bool moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem); + + bool copyFrom (const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath); + + // Import a template to the current region + bool copyFrom (const OUString &rPath); + + bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath); + + bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName); + + bool saveTemplateAs (sal_uInt16 nItemId, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName); + + bool saveTemplateAs (TemplateContainerItem *pDstItem, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName); + + bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString &rName) const; + + virtual bool renameItem(ThumbnailViewItem* pItem, OUString sNewTitle); + +private: + + SfxDocumentTemplates *mpDocTemplates; + std::vector<TemplateContainerItem* > maRegions; +}; + +#endif // TEMPLATEFOLDERVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templatelocnames.hrc b/include/sfx2/templatelocnames.hrc new file mode 100644 index 000000000000..7d3c52798461 --- /dev/null +++ b/include/sfx2/templatelocnames.hrc @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Péter Rabi <prabi@caesar.elte.hu> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#define NUM_TEMPLATE_NAMES 10 +#define TEMPL_LOC_OFFSET 2190 + +#define STR_TEMPLATE_NAME1_DEF (TEMPL_LOC_OFFSET + 1) +#define STR_TEMPLATE_NAME2_DEF (TEMPL_LOC_OFFSET + 2) +#define STR_TEMPLATE_NAME3_DEF (TEMPL_LOC_OFFSET + 3) +#define STR_TEMPLATE_NAME4_DEF (TEMPL_LOC_OFFSET + 4) +#define STR_TEMPLATE_NAME5_DEF (TEMPL_LOC_OFFSET + 5) +#define STR_TEMPLATE_NAME6_DEF (TEMPL_LOC_OFFSET + 6) +#define STR_TEMPLATE_NAME7_DEF (TEMPL_LOC_OFFSET + 7) +#define STR_TEMPLATE_NAME8_DEF (TEMPL_LOC_OFFSET + 8) +#define STR_TEMPLATE_NAME9_DEF (TEMPL_LOC_OFFSET + 9) +#define STR_TEMPLATE_NAME10_DEF (TEMPL_LOC_OFFSET + 10) + +#define STR_TEMPLATE_NAME1 (TEMPL_LOC_OFFSET + 51) +#define STR_TEMPLATE_NAME2 (TEMPL_LOC_OFFSET + 52) +#define STR_TEMPLATE_NAME3 (TEMPL_LOC_OFFSET + 53) +#define STR_TEMPLATE_NAME4 (TEMPL_LOC_OFFSET + 54) +#define STR_TEMPLATE_NAME5 (TEMPL_LOC_OFFSET + 55) +#define STR_TEMPLATE_NAME6 (TEMPL_LOC_OFFSET + 56) +#define STR_TEMPLATE_NAME7 (TEMPL_LOC_OFFSET + 57) +#define STR_TEMPLATE_NAME8 (TEMPL_LOC_OFFSET + 58) +#define STR_TEMPLATE_NAME9 (TEMPL_LOC_OFFSET + 59) +#define STR_TEMPLATE_NAME10 (TEMPL_LOC_OFFSET + 60) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templateproperties.hxx b/include/sfx2/templateproperties.hxx new file mode 100644 index 000000000000..f0db901073f0 --- /dev/null +++ b/include/sfx2/templateproperties.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __SFX2_TEMPLATEPROPERTIES_HXX__ +#define __SFX2_TEMPLATEPROPERTIES_HXX__ + +#include <rtl/ustring.hxx> +#include <vcl/bitmapex.hxx> + +struct TemplateItemProperties +{ + bool aIsFolder; + sal_uInt16 nId; ///< Index for ThumbnailView + sal_uInt16 nDocId; ///< Index based on SfxTemplateDocument + sal_uInt16 nRegionId; + OUString aName; + OUString aPath; + BitmapEx aThumbnail; +}; + +#endif // __SFX2_TEMPLATEPROPERTIES_HXX__ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templateremoteview.hxx b/include/sfx2/templateremoteview.hxx new file mode 100644 index 000000000000..bcb2b68fc0a4 --- /dev/null +++ b/include/sfx2/templateremoteview.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __SFX2_TEMPLATEREMOTEVIEW_HXX__ +#define __SFX2_TEMPLATEREMOTEVIEW_HXX__ + +#include <sfx2/templateabstractview.hxx> +#include <sfx2/templateproperties.hxx> + +#include <com/sun/star/ucb/XCommandEnvironment.hpp> + +class TemplateRepository; + +class TemplateRemoteView : public TemplateAbstractView +{ +public: + + TemplateRemoteView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren); + + virtual ~TemplateRemoteView (); + + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); + + bool loadRepository (TemplateRepository* pRepository, bool bRefresh); + + virtual sal_uInt16 createRegion (const OUString &rName); + + virtual bool isNestedRegionAllowed () const; + + virtual bool isImportAllowed () const; + +private: + + com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; +}; + +#endif // __SFX2_TEMPLATEREMOTEVIEW_HXX__ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templaterepository.hxx b/include/sfx2/templaterepository.hxx new file mode 100644 index 000000000000..f134c9897bf6 --- /dev/null +++ b/include/sfx2/templaterepository.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __SFX2_TEMPLATEREPOSITORY_HXX__ +#define __SFX2_TEMPLATEREPOSITORY_HXX__ + +#include <sfx2/templateproperties.hxx> + +class TemplateRepository +{ +public: + + TemplateRepository () : mnId(0) { }; + + virtual ~TemplateRepository () { }; + + void setURL (const OUString &rURL) { maUrl = rURL; } + + const OUString& getURL () const { return maUrl; } + + void insertTemplate (const TemplateItemProperties &prop) { maTemplates.push_back(prop); } + + void clearTemplates () { maTemplates.clear(); } + + const std::vector<TemplateItemProperties>& getTemplates () const { return maTemplates; } + +public: + + sal_uInt16 mnId; + OUString maTitle; + +private: + + OUString maUrl; + std::vector<TemplateItemProperties> maTemplates; +}; + +#endif // __SFX2_TEMPLATEREPOSITORY_HXX__ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templateviewitem.hxx b/include/sfx2/templateviewitem.hxx new file mode 100644 index 000000000000..efabd34ea4fd --- /dev/null +++ b/include/sfx2/templateviewitem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef TEMPLATEVIEWITEM_HXX +#define TEMPLATEVIEWITEM_HXX + +#include <sfx2/thumbnailviewitem.hxx> + +class TemplateViewItem : public ThumbnailViewItem +{ +public: + + TemplateViewItem (ThumbnailView &rView); + + virtual ~TemplateViewItem (); + + void setPath (const OUString &rPath) { maPath = rPath; } + + const OUString& getPath () const { return maPath; } + + void setAuthor (const OUString &rAuthor) { maAuthor = rAuthor; } + + const OUString& getAuthor () const { return maAuthor; } + + void setKeywords (const OUString &rKeywords) { maKeywords = rKeywords; } + + const OUString& getKeywords () const { return maKeywords; } + + void setSubTitle (const OUString &rTitle) { maSubTitle = rTitle; } + + const OUString& getSubTitle () const { return maSubTitle; } + + virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight, + const long nPadding, sal_uInt32 nMaxTextLenght, + const ThumbnailItemAttributes *pAttrs); + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs); + + sal_uInt16 mnRegionId; + sal_uInt16 mnDocId; + +private: + + OUString maPath; + OUString maAuthor; + OUString maKeywords; + OUString maSubTitle; + + Point maSubTitlePos; +}; + +#endif // TEMPLATEVIEWITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx new file mode 100644 index 000000000000..e9fb3a5e4c51 --- /dev/null +++ b/include/sfx2/templdlg.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_TEMPLDLG_HXX +#define _SFX_TEMPLDLG_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" + +#include <rsc/rscsfx.hxx> + +#include <sfx2/dockwin.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/basedlgs.hxx> + +class SfxTemplateDialog_Impl; + +// class ISfxTemplateCommon ---------------------------------------------- + +class ISfxTemplateCommon +{ +public: + virtual SfxStyleFamily GetActualFamily() const = 0; + virtual String GetSelectedEntry() const = 0; + +protected: + ~ISfxTemplateCommon() {} +}; + +// class SfxTemplateDialog ----------------------------------------------- + +class SfxTemplateDialog : public SfxDockingWindow +{ +private: +friend class SfxTemplateDialogWrapper; +friend class SfxTemplateDialog_Impl; + + SfxTemplateDialog_Impl* pImpl; + + virtual void DataChanged( const DataChangedEvent& _rDCEvt ); + virtual void Resize(); + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ); + virtual void StateChanged( StateChangedType nStateChange ); + +public: + SfxTemplateDialog( SfxBindings*, SfxChildWindow*, Window* ); + ~SfxTemplateDialog(); + + virtual void Update(); + + ISfxTemplateCommon* GetISfxTemplateCommon(); + void SetParagraphFamily(); +}; + +// class SfxTemplateDialogWrapper ---------------------------------------- + +class SFX2_DLLPUBLIC SfxTemplateDialogWrapper : public SfxChildWindow +{ +public: + SfxTemplateDialogWrapper + (Window*,sal_uInt16,SfxBindings*,SfxChildWinInfo*); + SFX_DECL_CHILDWINDOW_WITHID(SfxTemplateDialogWrapper); + + void SetParagraphFamily(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx new file mode 100644 index 000000000000..2bdf1b94ae09 --- /dev/null +++ b/include/sfx2/thumbnailview.hxx @@ -0,0 +1,332 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright 2012 LibreOffice contributors. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef THUMBNAILVIEW_HXX +#define THUMBNAILVIEW_HXX + +#include "sfx2/dllapi.h" + +#include <vector> +#include <boost/function.hpp> + +#include <sfx2/thumbnailviewitem.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/timer.hxx> + +class BitmapEx; +class MouseEvent; +class TrackingEvent; +class HelpEvent; +class KeyEvent; +class DataChangedEvent; +class ScrollBar; +typedef ::std::vector< ThumbnailViewItem* > ValueItemList; + +struct ThumbnailItemAttributes; +class ThumbnailViewAcc; +class ThumbnailViewItemAcc; + +namespace drawinglayer { + namespace processor2d { + class BaseProcessor2D; + } +} + +/************************************************************************* + + Description + ============ + + class ThumbnailView + + This class allows the selection of an item. In the process items are + drawn side by side. The selection of items can be more clear than in a + ListBox shape for example in case of colors or samples. + The amount of columns drawn by the control and whether the items + should be encircled can be specified. Optional a NoSelection or name + field could be shown. By default image and color items are supported. + Items could be drawn by oneself if InsertItem() is only called with + an ID. To achieve this the UserDraw handler needs to be overloaded. The + description text could be specified afterwards in case of UserDraw + and any other items. + + Cross references + + class ListBox + + -------------------------------------------------------------------------- + + WinBits + + WB_VSCROLL A scroolbar will be always shown. The visible number of + lines have to be specified with SetLineCount() if this + flag is set. + WB_TABSTOP It is possible to jump into the ValueSet with the tab key. + WB_NOTABSTOP It is not possible to jump into the ValueSet with the + tab key. + -------------------------------------------------------------------------- + + The number of columns must be either set with SetColCount() or + SetItemWidth(). If the number of colums is specified by SetColCount() + the width of the items will be calculated by the visible range. + If the items should have a static width, it has to be specified + with SetItemWidth(). In this case the number of columns will be calculated + by the visible range. + + The number of rows is given by the number of items / number of columns. The + number of visible rows must either specified by SetLineCount() or + SetItemWidth(). If the number of visible rows is specified by SetLineCount(), + the height of the items will be calculated from the visible height. If the + items should have a fixed height it has to be specified with SetItemHeight(). + In this case the number of visible rows is then calculated from the visible + height. If the number of visible rows is neither specified by SetLineCount() + nor by SetItemHeight() all rows will be shown. The height of the items will + be calculated by the visible height. If the number of visible rows is + specified by SetLineCount() or SetItemHeight() ValueSet does scroll + automatically when more lines are available, as are visible. If scrolling + should be also possible with a ScrollBar WB_VSCROLL needs to be set. + + The distance between the items can be increased by SetExtraSpacing(). The + distance, which will be shown between two items (both in x and in y), is + measured in pixels. + + The exact window size for a specific item size can be calculated by + CalcWindowSizePixel(). To do this all relevant data (number of columns/...) + have to be specified and if no number of rows was set, all items need to + be inserted. If the window was created with WB_BORDER/Border=sal_True the + size has to be specified with SetOutputSizePixel(). In other cases different + size-methods can be used. With CalcItemSize() the inner and outer size of + an item could be calculated (for this the free space defined by + SetExtraSpacing() will not be included). + + The background color could be specified by SetColor(), with which the image + or UserDraw items will be underlayed. If no color is specified the color + of other windows (WindowColor) will be used for the background. + + -------------------------------------------------------------------------- + + At first all items should be inserted and only then Show() should be called + since the output area will be precomputed. If this is not done the first + Paint will appear a little bit slower. Therefore the Control, if it is loaded + from the resource and only supplied with items during runtime, should be + loaded with Hide = sal_True and then displayed with Show(). + + In case of a visible Control the creation of the new output area could be + activated before Paint by calling Format(). + + -------------------------------------------------------------------------- + + If Drag and Drop will be called from the ValueSet the Command-Handler has to + be overloaded. From this StartDrag needs to be called. If this method returns + sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no + processing will take place. This method makes sure that ValueSet stops its + processing and as appropriate selects the entry. Therefore the calling of + Select-Handler within this function must be expected. + + For dropping QueryDrop() and Drop() need to be overloaded and ShowDropPos() + and HideDropPos() should be called within these methods. + To show the insertion point ShowDropPos() has to be called within the + QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed + position is located at the window border. Furthermore ShowDropPos() returns + the position, at which the item should be inserted respectively which + insertion point was shown. If no insertion point was determined + VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging + or the drag process is terminated HideDropPos() should be called in any case. + + -------------------------------------------------------------------------- + + This class is currently still in the SV-Tools. That's why the ValueSet needs + to be loaded as a Control out of the resource and the desired WinBits have + to be set (before Show) with SetStyle(). + +*************************************************************************/ + +/* ThumbnailView types */ + +#define THUMBNAILVIEW_APPEND ((sal_uInt16)-1) +#define THUMBNAILVIEW_ITEM_NOTFOUND ((sal_uInt16)-1) + +// Display all the available items in the thumbnail. +class ViewFilterAll +{ +public: + + bool operator () (const ThumbnailViewItem*) const + { + return true; + } +}; + +/** + * + * Class to display thumbnails with their names below their respective icons + * + **/ + +class SFX2_DLLPUBLIC ThumbnailView : public Control +{ +public: + + ThumbnailView ( Window* pParent, WinBits nWinStyle = WB_TABSTOP, bool bDisableTransientChildren = false ); + + ThumbnailView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); + + virtual ~ThumbnailView (); + + void AppendItem (ThumbnailViewItem *pItem); + + void RemoveItem( sal_uInt16 nItemId ); + + void Clear(); + + // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item) + void updateItems(const std::vector<ThumbnailViewItem *> &items); + + size_t GetItemPos( sal_uInt16 nItemId ) const; + + sal_uInt16 GetItemId( size_t nPos ) const; + + sal_uInt16 GetItemId( const Point& rPos ) const; + + sal_uInt16 getNextItemId () const; + + long GetItemWidth() const { return mnItemWidth; } + + long GetItemHeight() const { return mnItemHeight; } + + void setItemMaxTextLength (sal_uInt32 nLength); + + void setItemDimensions (long ItemWidth, long ThumbnailHeight, + long DisplayHeight, int itemPadding); + + sal_uInt16 GetFirstLine() const { return mnFirstLine; } + + void SelectItem( sal_uInt16 nItemId ); + + void DeselectItem( sal_uInt16 nItemId ); + + bool IsItemSelected( sal_uInt16 nItemId ) const; + + /** + * + * @brief deselect all current selected items. + * + **/ + + void deselectItems (); + + OUString GetItemText( sal_uInt16 nItemId ) const; + + void SetColor( const Color& rColor ); + + void SetColor() { SetColor( Color( COL_TRANSPARENT ) ); } + + Color GetColor() const { return maColor; } + + bool IsColor() const { return maColor.GetTransparency() == 0; } + + void filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func); + + void sortItems (const boost::function<bool (const ThumbnailViewItem*, + const ThumbnailViewItem*) > &func); + + void setItemStateHdl (const Link &aLink) { maItemStateHdl = aLink; } + + virtual void Resize(); + + virtual bool renameItem(ThumbnailViewItem* pItem, OUString sNewTitle); + +protected: + + virtual void KeyInput( const KeyEvent& rKEvt ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + virtual void Command( const CommandEvent& rCEvt ); + + virtual void Paint( const Rectangle& rRect ); + + virtual void GetFocus(); + + virtual void LoseFocus(); + + virtual void StateChanged( StateChangedType nStateChange ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + +protected: + + // Drawing item related functions, override them to make your own custom ones. + + virtual void DrawItem (ThumbnailViewItem *pItem); + + virtual void OnItemDblClicked (ThumbnailViewItem *pItem); + +protected: + + friend class ThumbnailViewAcc; + friend class ThumbnailViewItemAcc; + using Control::ImplInitSettings; + using Window::ImplInit; + + void CalculateItemPositions (); + void MakeItemVisible( sal_uInt16 nId ); + + SFX2_DLLPRIVATE void ImplInit(); + SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + SFX2_DLLPRIVATE void ImplInitScrollBar(); + SFX2_DLLPRIVATE void ImplDeleteItems(); + SFX2_DLLPRIVATE void ImplDraw(); + SFX2_DLLPRIVATE size_t ImplGetItem( const Point& rPoint, bool bMove = false ) const; + SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetItem( size_t nPos ); + SFX2_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const; + SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetVisibleItem( sal_uInt16 nVisiblePos ); + SFX2_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); + SFX2_DLLPRIVATE bool ImplHasAccessibleListeners(); + DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar* ); + + DECL_LINK(OnItemSelected, ThumbnailViewItem*); + +protected: + + ValueItemList mItemList; + ValueItemList mFilteredItemList; ///< Cache to store the filtered items + ValueItemList::iterator mpStartSelRange; + ScrollBar* mpScrBar; + Rectangle maItemListRect; + long mnHeaderHeight; + long mnItemWidth; + long mnItemHeight; + long mnItemPadding; + long mnThumbnailHeight; // Maximum height of the thumbnail + long mnDisplayHeight; // Height of the data display box (name, etc) + long mnVisLines; + long mnLines; + sal_uInt16 mnHighItemId; + sal_uInt16 mnCols; + sal_uInt16 mnFirstLine; + sal_uInt16 mnSpacing; + bool mbScroll : 1; + bool mbIsTransientChildrenDisabled : 1; + bool mbHasVisibleItems : 1; + Color maColor; + + Link maItemStateHdl; + ThumbnailItemAttributes *mpItemAttrs; + drawinglayer::processor2d::BaseProcessor2D *mpProcessor; + boost::function<bool (const ThumbnailViewItem*) > maFilterFunc; +}; + +#endif // THUMBNAILVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx new file mode 100644 index 000000000000..64a20cda910f --- /dev/null +++ b/include/sfx2/thumbnailviewitem.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef THUMBNAILVIEWITEM_HXX +#define THUMBNAILVIEWITEM_HXX + +#include <basegfx/vector/b2dvector.hxx> +#include <drawinglayer/attribute/fontattribute.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <osl/mutex.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/vclmedit.hxx> +#include "sfx2/dllapi.h" + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE + +class CheckBox; +class Font; +class Window; +class ThumbnailView; + +namespace basegfx { + class B2DPolygon; +} + +namespace drawinglayer { + namespace processor2d { + class BaseProcessor2D; + } + + namespace primitive2d { + class PolygonHairlinePrimitive2D; + } +} + +struct ThumbnailItemAttributes +{ + sal_uInt32 nMaxTextLenght; + basegfx::BColor aFillColor; + basegfx::BColor aHighlightColor; + basegfx::B2DVector aFontSize; + drawinglayer::attribute::FontAttribute aFontAttr; +}; + +class SFX2_DLLPUBLIC ThumbnailViewItem +{ +public: + + ThumbnailView &mrParent; + sal_uInt16 mnId; + bool mbVisible; + bool mbSelected; + bool mbHover; + BitmapEx maPreview1; + OUString maTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc; + + ThumbnailViewItem (ThumbnailView &rView); + + virtual ~ThumbnailViewItem (); + + bool isVisible () const { return mbVisible; } + + void show (bool bVisible); + + bool isSelected () const { return mbSelected; } + + void setSelection (bool state); + + bool isHighlighted () const { return mbHover; } + + void setHighlight (bool state); + + void setEditTitle (bool edit, bool bChangeFocus = true); + void updateTitleEditSize (); + virtual void setTitle (const OUString& rTitle); + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetAccessible( bool bIsTransientChildrenDisabled ); + + void setDrawArea (const Rectangle &area); + + const Rectangle& getDrawArea () const { return maDrawArea; } + Rectangle getTextArea () const; + + virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight, + const long nPadding, sal_uInt32 nMaxTextLenght, + const ThumbnailItemAttributes *pAttrs); + + const Point& getTextPos () const { return maTextPos; } + + const Point& getPrev1Pos () const { return maPrev1Pos; } + + void setSelectClickHdl (const Link &link); + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs); + void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DSequence& rSeq); + + static drawinglayer::primitive2d::PolygonHairlinePrimitive2D* + createBorderLine (const basegfx::B2DPolygon &rPolygon); + +protected: + + Point maTextPos; + Point maPrev1Pos; + Rectangle maDrawArea; + Link maClickHdl; + bool mbEditTitle; + VclMultiLineEdit* mpTitleED; + Rectangle maTextEditMaxArea; +}; + +#endif // THUMBNAILVIEWITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx new file mode 100644 index 000000000000..09b500caa6bc --- /dev/null +++ b/include/sfx2/titledockwin.hxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 ); + + /** 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 + */ + sal_uInt16 AddDropDownToolBoxItem( const String& i_rItemText, const OString& 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; } + + /** Return the border that is painted around the inner window as + decoration. + */ + SvBorder GetDecorationBorder (void) const { return m_aBorder; } + + 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 OUString& i_rText ); + + // DockingWindow overridables + void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ); + + // own overridables + virtual void onLayoutDone(); + + protected: + /** internal version of ResetToolBox + */ + void impl_resetToolBox(); + + /** internal version of AddDropDownToolBoxItem + */ + sal_uInt16 impl_addDropDownToolBoxItem( const String& i_rItemText, const OString& 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: + OUString 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; + + /** Height of the title bar. Calculated in impl_layout(). + */ + int m_nTitleBarHeight; + + }; + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... + +#endif // SFX_TITLEDOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx new file mode 100644 index 000000000000..58f0618443ae --- /dev/null +++ b/include/sfx2/tplpitem.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_TPLPITEM_HXX +#define _SFX_TPLPITEM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <tools/string.hxx> +#include <tools/rtti.hxx> +#include <svl/flagitem.hxx> +#include <svl/style.hrc> + +class SFX2_DLLPUBLIC SfxTemplateItem: public SfxFlagItem +{ + String aStyle; +public: + TYPEINFO(); + SfxTemplateItem(); + SfxTemplateItem( sal_uInt16 nWhich, + const String &rStyle, + sal_uInt16 nMask = SFXSTYLEBIT_ALL ); + SfxTemplateItem( const SfxTemplateItem& ); + + const String& GetStyleName() const { return aStyle; } + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual int operator==( const SfxPoolItem& ) const; + virtual sal_uInt8 GetFlagCount() const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx new file mode 100644 index 000000000000..d1d41b8ae689 --- /dev/null +++ b/include/sfx2/unoctitm.hxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFX_UNOCTITM_HXX +#define _SFX_UNOCTITM_HXX + +#include <functional> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <sfx2/sfxuno.hxx> +#include <sfx2/ctrlitem.hxx> +#include <osl/mutex.hxx> + +class SfxBindings; +class SfxFrame; +class SfxDispatcher; + +class SfxUnoControllerItem : public ::com::sun::star::frame::XStatusListener , + public ::com::sun::star::lang::XTypeProvider , + public ::cppu::OWeakObject +{ + ::com::sun::star::util::URL aCommand; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + SfxControllerItem* pCtrlItem; + SfxBindings* pBindings; + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > TryGetDispatch( SfxFrame* pFrame ); + +public: + SFX_DECL_XINTERFACE_XTYPEPROVIDER + + + SfxUnoControllerItem( SfxControllerItem*, SfxBindings&, const String& ); + ~SfxUnoControllerItem(); + + const ::com::sun::star::util::URL& GetCommand() const + { return aCommand; } + + // XStatusListener + virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException ); + + // Something else + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + void UnBind(); + void GetNewDispatch(); + void ReleaseDispatch(); + void ReleaseBindings(); +}; + +struct SfxStatusDispatcher_Impl_hashType +{ + size_t operator()(const OUString& s) const + { return s.hashCode(); } +}; + +typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< OUString, SfxStatusDispatcher_Impl_hashType, std::equal_to< OUString > > SfxStatusDispatcher_Impl_ListenerContainer ; + +class SfxStatusDispatcher : public ::com::sun::star::frame::XNotifyingDispatch, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakObject +{ + ::osl::Mutex aMutex; + SfxStatusDispatcher_Impl_ListenerContainer aListeners; + +public: + SFX_DECL_XINTERFACE_XTYPEPROVIDER + + SfxStatusDispatcher(); + + // XDispatch + virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException ); + + // Something else + void ReleaseAll(); + SfxStatusDispatcher_Impl_ListenerContainer& GetListeners() + { return aListeners; } +}; + +class SfxSlotServer; +class SfxDispatchController_Impl; +class SfxOfficeDispatch : public SfxStatusDispatcher + , public ::com::sun::star::lang::XUnoTunnel +{ +friend class SfxDispatchController_Impl; + SfxDispatchController_Impl* pControllerItem; +public: + SfxOfficeDispatch( SfxBindings& rBind, + SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const ::com::sun::star::util::URL& rURL ); + SfxOfficeDispatch( SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const ::com::sun::star::util::URL& rURL ); + ~SfxOfficeDispatch(); + + SFX_DECL_XINTERFACE_XTYPEPROVIDER + + virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, + const ::com::sun::star::util::URL& aURL) + throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) ; + static const ::com::sun::star::uno::Sequence< sal_Int8 >& impl_getStaticIdentifier(); + + static sal_Bool IsMasterUnoCommand( const ::com::sun::star::util::URL& aURL ); + static OUString GetMasterUnoCommand( const ::com::sun::star::util::URL& aURL ); + + void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + + void SetMasterUnoCommand( sal_Bool bSet ); + + SfxDispatcher* GetDispatcher_Impl(); +}; + +class SfxDispatchController_Impl : public SfxControllerItem +{ + ::com::sun::star::util::URL aDispatchURL; + SfxDispatcher* pDispatcher; + SfxBindings* pBindings; + const SfxPoolItem* pLastState; + sal_uInt16 nSlot; + SfxOfficeDispatch* pDispatch; + sal_Bool bMasterSlave; + sal_Bool bVisible; + const char* pUnoName; + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xFrame; + + void addParametersToArgs( const com::sun::star::util::URL& aURL, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ) const; + SfxMapUnit GetCoreMetric( SfxItemPool& rPool, sal_uInt16 nSlot ); + +public: + SfxDispatchController_Impl( SfxOfficeDispatch* pDisp, + SfxBindings* pBind, + SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const ::com::sun::star::util::URL& rURL ); + ~SfxDispatchController_Impl(); + + static OUString getSlaveCommand( const ::com::sun::star::util::URL& rURL ); + + void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer* pServ ); + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void setMasterSlaveCommand( sal_Bool bSet ); + void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException ); + void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException ); + void UnBindController(); + SfxDispatcher* GetDispatcher(); + void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/userinputinterception.hxx b/include/sfx2/userinputinterception.hxx new file mode 100644 index 000000000000..7350314b4835 --- /dev/null +++ b/include/sfx2/userinputinterception.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef USERINPUTINTERCEPTION_HXX +#define USERINPUTINTERCEPTION_HXX + +#include "sfx2/dllapi.h" + +#include <com/sun/star/awt/XUserInputInterception.hpp> + +#include <boost/noncopyable.hpp> +#include <memory> + +class NotifyEvent; + +namespace cppu { class OWeakObject; } + +//........................................................................ +namespace sfx2 +{ +//........................................................................ + + //==================================================================== + //= UserInputInterception + //==================================================================== + struct UserInputInterception_Data; + /** helper class for implementing the XUserInputInterception interface + for a controller implementation + */ + class SFX2_DLLPUBLIC UserInputInterception : public ::boost::noncopyable + { + public: + UserInputInterception( ::cppu::OWeakObject& _rControllerImpl, ::osl::Mutex& _rMutex ); + ~UserInputInterception(); + + // delegator functions for your XUserInputInterception implementation + void addKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + void removeKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + void addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + void removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + + // state + bool hasKeyHandlers() const; + bool hasMouseClickListeners() const; + + // forwarding a NotifyEvent to the KeyListeners respectively MouseClickListeners + bool handleNotifyEvent( const NotifyEvent& _rEvent ); + + private: + ::std::auto_ptr< UserInputInterception_Data > m_pData; + }; + +//........................................................................ +} // namespace sfx2 +//........................................................................ + +#endif // USERINPUTINTERCEPTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/viewfac.hxx b/include/sfx2/viewfac.hxx new file mode 100644 index 000000000000..3348cb69d199 --- /dev/null +++ b/include/sfx2/viewfac.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _VIEWFAC_HXX +#define _VIEWFAC_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include <tools/string.hxx> +#include <tools/resid.hxx> + +class SfxViewFrame; +class SfxViewShell; +class Window; + +typedef SfxViewShell* (*SfxViewCtor)(SfxViewFrame*, SfxViewShell*); + +// CLASS ----------------------------------------------------------------- +class SFX2_DLLPUBLIC SfxViewFactory +{ +public: + SfxViewFactory( SfxViewCtor fnC, + sal_uInt16 nOrdinal, const sal_Char* asciiViewName ); + + SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh); + sal_uInt16 GetOrdinal() const { return nOrd; } + + /// returns a legacy view name. This is "view" with an appended ordinal/ID. + String GetLegacyViewName() const; + + /** returns a API-compatible view name. + + For details on which view names are specified, see the XModel2.getAvailableViewControllerNames + documentation. + */ + String GetAPIViewName() const; + +private: + SfxViewCtor fnCreate; + sal_uInt16 nOrd; + const String m_sViewName; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx new file mode 100644 index 000000000000..522b4719eac0 --- /dev/null +++ b/include/sfx2/viewfrm.hxx @@ -0,0 +1,335 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXVIEWFRM_HXX +#define _SFXVIEWFRM_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <svl/lstner.hxx> +#include <sfx2/module.hxx> +#include <sfx2/frame.hxx> +#include <sfx2/shell.hxx> +#include <sfx2/sfxsids.hrc> +#include <svl/poolitem.hxx> +#include <vcl/button.hxx> +#include <com/sun/star/frame/status/Verb.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController2.hpp> + +#include <tools/svborder.hxx> + +class SvBorder; +class SfxDispatcher; +class SfxObjectShell; +class SfxBindings; +class SfxProgress; +class SvData; +class SfxViewShell; +class SystemWindow; +class Fraction; +class Point; +class Size; +class SfxChildWindow; + +namespace sfx2 +{ +class SvLinkSource; +} +namespace svtools +{ + class AsynchronLink; +} + +#ifndef SFX_DECL_OBJECTSHELL_DEFINED +#define SFX_DECL_OBJECTSHELL_DEFINED +SV_DECL_REF(SfxObjectShell) +#endif + +//======================================================================== +DBG_NAMEEX(SfxViewFrame) +class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener +{ + struct SfxViewFrame_Impl* pImp; + + SfxObjectShellRef xObjSh; + SfxDispatcher* pDispatcher; + SfxBindings* pBindings; + sal_uInt16 nAdjustPosPixelLock; + +private: +#ifndef _SFX_HXX + SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh=NULL ); +#endif + +protected: + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +#ifndef _SFX_HXX + SAL_DLLPRIVATE void KillDispatcher_Impl(); +#endif + + virtual ~SfxViewFrame(); + +public: + SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc = NULL ); + + TYPEINFO(); + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) + + static void SetViewFrame( SfxViewFrame* ); + + static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId ); + static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId = 0 ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const sal_uInt16 i_nViewId = 0 ); + static SfxViewFrame* DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const sal_uInt16 i_nViewId = 0 ); + + static SfxViewFrame* Current(); + static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True ); + static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True ); + + static SfxViewFrame* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController, const SfxObjectShell* i_pDoc = NULL ); + + void DoActivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL); + void DoDeactivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL); + + SfxViewFrame* GetParentViewFrame() const; + + using SfxShell::GetDispatcher; + SfxDispatcher* GetDispatcher() { return pDispatcher; } + SfxBindings& GetBindings() { return *pBindings; } + const SfxBindings& GetBindings() const { return *pBindings; } + Window& GetWindow() const; + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); + + SfxProgress* GetProgress() const; + + SfxObjectShell* GetObjectShell() const + { return xObjSh; } + + void LockAdjustPosSizePixel() + { nAdjustPosPixelLock++; } + void UnlockAdjustPosSizePixel() + { nAdjustPosPixelLock--; } + void DoAdjustPosSizePixel( SfxViewShell * pSh, + const Point &rPos, const Size &rSize ); + void Show(); + sal_Bool IsVisible() const; + void ToTop(); + void Enable( sal_Bool bEnable ); + virtual sal_Bool Close(); + virtual void Activate( sal_Bool bUI ); + virtual void Deactivate( sal_Bool bUI ); + + // DDE-Interface + virtual long DdeExecute( const String& rCmd ); + virtual long DdeGetData( const String& rItem, + const String& rMimeType, + ::com::sun::star::uno::Any & rValue ); + virtual long DdeSetData( const String& rItem, + const String& rMimeType, + const ::com::sun::star::uno::Any & rValue ); + virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); + + void UpdateTitle(); + + static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL ); + + // interne Handler + SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); + SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const; + SAL_DLLPRIVATE virtual void InvalidateBorderImpl( const SfxViewShell *pSh ); + + virtual SfxObjectShell* GetObjectShell(); + sal_uInt16 GetCurViewId() const; + SfxFrame& GetFrame() const; + SfxViewFrame* GetTopViewFrame() const; + + sal_Bool DoClose(); + sal_uIntPtr GetFrameType() const + { return GetFrame().GetFrameType(); } + SfxFrame& GetTopFrame() const + { return GetFrame().GetTopFrame(); } + void GetTargetList( TargetList& rList ) const + { GetFrame().GetTargetList( rList ); } + void CancelTransfers() + { GetFrame().CancelTransfers(); } + + void SetModalMode( sal_Bool ); + sal_Bool IsInModalMode() const; + void Resize(sal_Bool bForce=sal_False); + + void SetChildWindow(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus=sal_True); + void ToggleChildWindow(sal_uInt16); + sal_Bool HasChildWindow(sal_uInt16); + sal_Bool KnowsChildWindow(sal_uInt16); + void ShowChildWindow(sal_uInt16,sal_Bool bVisible=sal_True); + SfxChildWindow* GetChildWindow(sal_uInt16); + void ChildWindowExecute(SfxRequest&); + void ChildWindowState(SfxItemSet&); + + /** Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar). + + The buttons will be added from Right to Left at the right of the info bar. The parent, size + and position of each button will be changed: only the width will remain unchanged. + */ + void AppendInfoBar( const OUString& sId, const OUString& sMessage, std::vector< PushButton* > aButtons ); + void RemoveInfoBar( const OUString& sId ); + + SAL_DLLPRIVATE void SetDowning_Impl(); + SAL_DLLPRIVATE void GetDocNumber_Impl(); + SAL_DLLPRIVATE sal_Bool IsDowning_Impl() const; + SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh ); + SAL_DLLPRIVATE void ReleaseObjectShell_Impl(); + + SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet ); + SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq ); + SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet ); + SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq ); + SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet ); + SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq ); + SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet ); + SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const; + SAL_DLLPRIVATE void ForceOuterResize_Impl(sal_Bool bOn=sal_True); + SAL_DLLPRIVATE sal_Bool IsResizeInToOut_Impl() const; + SAL_DLLPRIVATE sal_Bool IsAdjustPosSizePixelLocked_Impl() const + { return nAdjustPosPixelLock != 0; } + SAL_DLLPRIVATE void UpdateDocument_Impl(); + + SAL_DLLPRIVATE void LockObjectShell_Impl(sal_Bool bLock=sal_True); + + SAL_DLLPRIVATE void MakeActive_Impl( sal_Bool bActivate ); + SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool ); + SAL_DLLPRIVATE const Size& GetMargin_Impl() const; + SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* ); + SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const; + SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const; + SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( sal_uInt16 nId ); + SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString& sMacro); + + SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID ); + SAL_DLLPRIVATE void ActivateToolPanel_Impl( const OUString& i_rPanelURL ); + +private: + SAL_DLLPRIVATE sal_Bool SwitchToViewShell_Impl( sal_uInt16 nNo, sal_Bool bIsIndex = sal_False ); + SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into + @param i_rLoadArgs + the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the + model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved, + instead of being reset. + @param i_nViewId + the ID of the view to create + @throws Exception + if something goes wrong. The caller is responsible for handling this. + */ + SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, + const sal_uInt16 i_nViewId, + const bool i_bHidden + ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. + + If no frame is given, a blank top level frame is created. + + If anything fails during the process, as much as possible is cleaned up. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into. Might be <NULL/>, in which case a new frame is created. + @param i_nViewId + the ID of the view to create + */ + SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const sal_uInt16 i_nViewId, + const bool i_bHidden + ); +}; + +//-------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SfxViewFrameItem: public SfxPoolItem +{ + SfxViewFrame* pFrame; + +public: + TYPEINFO(); + SfxViewFrameItem( SfxViewFrame *pViewFrame ): + SfxPoolItem( 0 ), + pFrame( pViewFrame) + {} + SfxViewFrameItem( sal_uInt16 nWhichId, SfxViewFrame *pViewFrame ): + SfxPoolItem( nWhichId ), + pFrame( pViewFrame) + {} + + virtual int operator==( const SfxPoolItem& ) const; + virtual String GetValueText() const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + SfxViewFrame* GetFrame() const + { return pFrame; } +}; + +class SfxVerbListItem : public SfxPoolItem +{ + com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbs; + +public: + TYPEINFO(); + SfxVerbListItem( sal_uInt16 nWhichId = SID_OBJECT ) : + SfxPoolItem( nWhichId ) + {} + + SfxVerbListItem( sal_uInt16 nWhichId, const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& ); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbList() const { return aVerbs; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx new file mode 100644 index 000000000000..ad4c64cd5272 --- /dev/null +++ b/include/sfx2/viewsh.hxx @@ -0,0 +1,343 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SFXVIEWSH_HXX +#define _SFXVIEWSH_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/view/XRenderable.hpp> +#include <com/sun/star/uno/Reference.h> +#include <svl/lstner.hxx> +#include <com/sun/star/ui/XContextMenuInterceptor.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> +#include <cppuhelper/interfacecontainer.hxx> +#include "shell.hxx" +#include <tools/gen.hxx> +#include <tools/errcode.hxx> +#include <vcl/jobset.hxx> +#include <vector> + +class SfxBaseController; +class Size; +class Fraction; +class Window; +class KeyEvent; +class WorkWindow; +class SvBorder; +class SdrView; +class SfxFrame; +class SfxMedium; +class SfxModule; +class SfxViewFrame; +class SfxItemPool; +class SfxTabPage; +class SfxFrameSetDescriptor; +class Printer; +class SfxPrinter; +class SfxProgress; +class SfxFrameItem; +class Dialog; +class Menu; +class NotifyEvent; + +#define SFX_PRINTER_PRINTER 1 // without JOB SETUP => Temporary +#define SFX_PRINTER_JOBSETUP 2 +#define SFX_PRINTER_OPTIONS 4 +#define SFX_PRINTER_CHG_ORIENTATION 8 +#define SFX_PRINTER_CHG_SIZE 16 +#define SFX_PRINTER_ALL 31 + +#define SFX_PRINTER_CHG_ORIENTATION_FLAG 3 +#define SFX_PRINTER_CHG_SIZE_FLAG 4 + +#define SFX_PRINTERROR_NONE 0 +#define SFX_PRINTERROR_BUSY 1 + +// "Verified" using www.apple.com and Netscape 3.01 +#define DEFAULT_MARGIN_WIDTH 8 +#define DEFAULT_MARGIN_HEIGHT 12 + +//======================================================================== + +// @[SfxViewShell-Flags] + +#define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button and Options- + Dialog in PrintDialog */ +#define SFX_VIEW_CAN_PRINT 0x0020 /* Printing enabled without having + to create a Printer */ +#define SFX_VIEW_NO_SHOW 0x0040 /* Window of the ViewShell shall + not be showed automatically */ +#define SFX_VIEW_NO_NEWWINDOW 0x0100 /* Allow N View */ + +/* [Description] + + The SfxViewShell flags control the behavior of SfxViewShell for the + duration of its lifetime. They are defined in the constructor of + <SfxViewShell>. +*/ + +//========================================================================= + +#define SFX_DECL_VIEWFACTORY(Class) \ +private: \ + static SfxViewFactory *pFactory; \ +public: \ + static SfxViewShell *CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView); \ + static void RegisterFactory( sal_uInt16 nPrio = USHRT_MAX ); \ + static SfxViewFactory&Factory() { return *pFactory; } \ + static void InitFactory() + +#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \ + SfxViewFactory* Class::pFactory; \ + SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \ + { return new Class(pFrame, pOldView); } \ + void Class::RegisterFactory( sal_uInt16 nPrio ) \ + { \ + pFactory = new SfxViewFactory(&CreateInstance,nPrio,AsciiViewName);\ + InitFactory(); \ + } \ + void Class::InitFactory() + +#define SFX_VIEW_REGISTRATION(DocClass) \ + DocClass::Factory().RegisterViewFactory( Factory() ) + +class SfxInPlaceClient; +typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList; + +// ----------------------------------------------------------------------- +class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener +{ +#ifdef _SFXVIEWSH_HXX +friend class SfxViewFrame; +friend class SfxBaseController; +friend class SfxPrinterController; +#endif + + struct SfxViewShell_Impl* pImp; + SfxInPlaceClientList* pIPClientList; + SfxViewFrame* pFrame; + SfxShell* pSubShell; + Window* pWindow; + sal_Bool bNoNewWindow; + +protected: + virtual void Activate(sal_Bool IsMDIActivate); + virtual void Deactivate(sal_Bool IsMDIActivate); + + virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); + virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ); + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); + + virtual void Move(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +public: + // Iteration + static SfxViewShell* GetFirst( const TypeId* pType = 0, sal_Bool bOnlyVisible = sal_True ); + static SfxViewShell* GetNext( const SfxViewShell& rPrev, + const TypeId* pType = 0, sal_Bool bOnlyVisible = sal_True ); + static SfxViewShell* Current(); + + static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); + + // Initialize Constructors/Destructors + TYPEINFO(); + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH) + + SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 ); + virtual ~SfxViewShell(); + + SfxInPlaceClient* GetIPClient() const; + SfxInPlaceClient* GetUIActiveClient() const; + SfxInPlaceClient* FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, Window *pObjParentWin ) const; + + virtual ErrCode DoVerb(long nVerb); + + virtual void OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* pClient ); + virtual void InplaceActivating( SfxInPlaceClient* pClient ); + virtual void InplaceDeactivated( SfxInPlaceClient* pClient ); + virtual void UIActivating( SfxInPlaceClient* pClient ); + virtual void UIDeactivated( SfxInPlaceClient* pClient ); + + virtual void JumpToMark( const String& rMark ); + void VisAreaChanged(const Rectangle& rRect); + + // Misc + virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); + virtual String GetSelectionText( sal_Bool bCompleteWords = sal_False ); + virtual sal_Bool HasSelection( sal_Bool bText = sal_True ) const; + virtual SdrView* GetDrawView() const; + + SfxShell* GetSubShell() const { return pSubShell; } + void AddSubShell( SfxShell& rShell ); + void RemoveSubShell( SfxShell *pShell=NULL ); + SfxShell* GetSubShell( sal_uInt16 ); + + // Focus, KeyInput, Cursor + void GotFocus() const; + inline void LostFocus() const; + virtual void ShowCursor( bool bOn = true ); + virtual bool KeyInput( const KeyEvent &rKeyEvent ); + sal_Bool Escape(); + + // Viewing Interface + Window* GetWindow() const { return pWindow; } + void SetWindow( Window *pViewPort ); + virtual void AdjustPosSizePixel( const Point &rOfs, const Size &rSize ); + const SvBorder& GetBorderPixel() const; + void SetBorderPixel( const SvBorder &rBorder ); + void InvalidateBorder(); + inline SfxViewFrame* GetViewFrame() const; + + // Printing Interface + virtual SfxPrinter* GetPrinter( sal_Bool bCreate = sal_False ); + virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=sal_False ); + virtual bool HasPrintOptionsPage() const; + virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); + virtual JobSetup GetJobSetup() const; + Printer* GetActivePrinter() const; + + // Working set + virtual void WriteUserData( String&, sal_Bool bBrowse = sal_False ); + virtual void ReadUserData( const String&, sal_Bool bBrowse = sal_False ); + virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False ); + virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False ); + virtual void QueryObjAreaPixel( Rectangle& rRect ) const; + + virtual SfxObjectShell* GetObjectShell(); + /** retrieves the document which shall be considered the "current document" when the frame is active + + The default implementation simply returns the XModel of the associated SfxObjectShell. You will rarely + need to overwrite this behavior. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetCurrentDocument() const; + /** forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocument + */ + void SetCurrentDocument() const; + + /** get an XRenderable instance that can render this document + */ + virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable(); + + + virtual void MarginChanged(); + const Size& GetMargin() const; + void SetMargin( const Size& ); + void DisconnectAllClients(); + virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); + sal_Bool NewWindowAllowed() const { return !bNoNewWindow; } + void SetNewWindowAllowed( sal_Bool bSet ) { bNoNewWindow = !bSet; } + + void SetController( SfxBaseController* pController ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > + GetController(); + + sal_Bool TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent ); + + void ExecPrint( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, sal_Bool, sal_Bool ); + + void AddRemoveClipboardListener( const com::sun::star::uno::Reference < com::sun::star::datatransfer::clipboard::XClipboardListener>&, sal_Bool ); + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier(); + + SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const; + SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); + SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); + SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ); + + SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ) + { GetIPClientList_Impl(sal_True)->push_back(pIPClient); } + SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient ); + SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( sal_Bool bCreate = sal_True ) const; + SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP ); + SAL_DLLPRIVATE void DiscardClients_Impl(); + + SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( SfxPrinter *pNewPrinter ); + SAL_DLLPRIVATE sal_Bool IsShowView_Impl() const; + + SAL_DLLPRIVATE long HandleNotifyEvent_Impl( NotifyEvent& rEvent ); + SAL_DLLPRIVATE sal_Bool HasKeyListeners_Impl(); + SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl(); + + SAL_DLLPRIVATE SfxBaseController* GetBaseController_Impl() const; + + // Shell Interface + SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &); + SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &); + SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&); + SAL_DLLPRIVATE SfxFrameSetDescriptor* GetFrameSet_Impl() const; + SAL_DLLPRIVATE void SetFrameSet_Impl(SfxFrameSetDescriptor*); + SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient*, const Rectangle& ); + SAL_DLLPRIVATE void PushSubShells_Impl( sal_Bool bPush=sal_True ); + SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( sal_False ); } + SAL_DLLPRIVATE void TakeOwnership_Impl(); + SAL_DLLPRIVATE void TakeFrameOwnership_Impl(); + SAL_DLLPRIVATE sal_Bool ExecKey_Impl(const KeyEvent& aKey); +}; + +//======================================================================== + +inline void SfxViewShell::LostFocus() const + +/* [Description] + + This method has to be called by the application developer, if the edit + window has lost the focus. The SFx has for example the ability to turn off + the accelerator, so that the cursor keys, the Delete button, etc. work in + certain Floating-Windows, even though they are redefined by the + Accelerator. + + [Note] + + <StarView> unfortunatly does not provide the possibility to define + such events 'from the side'. +*/ + +{ +} + +//------------------------------------------------------------------------ + +inline SfxViewFrame* SfxViewShell::GetViewFrame() const + +/* [Description] + + This method returns a pointer to the <SfxViewFrame> Instance in which + this SfxViewShell is displayed. This is the instance that was passed + on in the constructor. It is guaranteed that the returned pointer + points on the valid SfxViewFrame instance. + + [Cross-reference] + + <SfxShell::GetFrame()const> +*/ + +{ + return pFrame; +} + +#endif // #ifndef _SFXVIEWSH_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/zoomitem.hxx b/include/sfx2/zoomitem.hxx new file mode 100644 index 000000000000..ab5c81c425aa --- /dev/null +++ b/include/sfx2/zoomitem.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ZOOMITEM_HXX +#define _SVX_ZOOMITEM_HXX + +#include <svl/intitem.hxx> +#include <sfx2/sfxsids.hrc> +#include "sfx2/dllapi.h" + +//------------------------------------------------------------------------- + +enum SvxZoomType +{ + SVX_ZOOM_PERCENT, // GetValue() ist kein besonderer prozentualer Wert + SVX_ZOOM_OPTIMAL, // GetValue() entspricht der optimalen Gr"o\se + SVX_ZOOM_WHOLEPAGE, // GetValue() entspricht der ganzen Seite + SVX_ZOOM_PAGEWIDTH, // GetValue() entspricht der Seitenbreite + SVX_ZOOM_PAGEWIDTH_NOBORDER // GetValue() pagewidth without border +}; + +//------------------------------------------------------------------------- + +class SFX2_DLLPUBLIC SvxZoomItem: public SfxUInt16Item +{ + sal_uInt16 nValueSet; // erlaubte Werte (siehe #defines unten) + SvxZoomType eType; + +public: + TYPEINFO(); + + SvxZoomItem( SvxZoomType eZoomType = SVX_ZOOM_PERCENT, + sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM ); + SvxZoomItem( const SvxZoomItem& ); + ~SvxZoomItem(); + + void SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; } + sal_uInt16 GetValueSet() const { return nValueSet; } + bool IsValueAllowed( sal_uInt16 nValue ) const + { return nValue == ( nValue & nValueSet ); } + + SvxZoomType GetType() const { return eType; } + void SetType( SvxZoomType eNewType ) + { eType = eNewType; } + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const; + virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const; + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +//------------------------------------------------------------------------ + +#define SVX_ZOOM_ENABLE_50 0x0001 +#define SVX_ZOOM_ENABLE_75 0x0002 +#define SVX_ZOOM_ENABLE_100 0x0004 +#define SVX_ZOOM_ENABLE_150 0x0008 +#define SVX_ZOOM_ENABLE_200 0x0010 +#define SVX_ZOOM_ENABLE_OPTIMAL 0x1000 +#define SVX_ZOOM_ENABLE_WHOLEPAGE 0x2000 +#define SVX_ZOOM_ENABLE_PAGEWIDTH 0x4000 +#define SVX_ZOOM_ENABLE_ALL 0x701F + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |