/* -*- 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_SHELL_HXX #define INCLUDED_SFX2_SHELL_HXX #include #include #include #include #include #include #include class ResMgr; namespace vcl { 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; } /** Id for s, gives a quasi-static access to the interface through an array to . */ enum SfxInterfaceId { 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 }; typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq); typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet); /** The class SfxShell is the base class for all classes, which provide the functionality of the form s. Each instance has a reference to an interface description, which is obtainable through . 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 , which is generated from an IDL-file by the . For each SfxShell Subclass-File there is one such IDL-file to write. */ class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster { friend class SfxObjectItem; SfxShell_Impl* pImp; SfxItemPool* pPool; ::svl::IUndoManager* pUndoMgr; private: SfxShell( const SfxShell & ) = delete; SfxShell& operator = ( const SfxShell & ) = delete; protected: /** The constructor of the SfxShell class initializes only simple types, the corresponding SbxObject is only created on-demand. Therefore, the application of a SfxShell instance is very cheap. */ SfxShell(); /** The constructor of the SfxShell class initializes only simple types, the corresponding SbxObject is only created on-demand. Therefore, the application of a SfxShell instance is very cheap. */ SfxShell( SfxViewShell *pViewSh ); void SetViewShell_Impl( SfxViewShell* pView ); SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ); static void HandleOpenXmlFilterSettings(SfxRequest &); public: /** The connection to a possible corresponding SbxObject is dissolved. The SbxObject may continue to exist, but can not any longer perform any functions and can not provide any properties. */ virtual ~SfxShell(); /** With this virtual method, which is automatically overridden by each subclass with its own slots through the macro , one can access each of the instance belonging to the subclass. The class SfxShell itself has no own SfxInterface (no slots), therefore a NULL-pointer is returned. */ virtual SfxInterface* GetInterface() const; static SfxInterface* GetStaticInterface() { return nullptr; } /** Sets the name of the Shell object. With this name, the SfxShell instance of BASIC can be expressed. */ void SetName( const OUString &rName ); /** Returns the name of the Shell object. With this name, the SfxShell instance of BASIC can be expressed. */ const OUString& GetName() const; /** Returns the SfxViewShell in which they are located in the subshells. Otherwise, and if not specified by the App developer, this method returns NULL. */ 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 &); /** This method returns the status of the slot with the specified slot ID on the specified interface. If the slot is disabled or in this SfxShell (and their parent shells) are not known, a Null-pointer is returned. If the slot does not have a Status, a SfxVoidItem is returned. The status is set directly in this Set when pStateSet != 0 , so that overridden Slots of the Subclasses and also in the Status method of the base implementation can be called. [Example] In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be intercepted. Under certain circumstances a query should appear before you print, and the request will be aborted if necessary. Also in the IDL of this subclass of the above slot is entered. The status method will contain in outline: void SubViewShell::PrintState( SfxItemSet &rState ) { if ( rState.GetItemState( SID_PRINTDOCDIRECT ) != SfxItemState::UNKNOWN ) GetSlotState( SID_PRINTDOCDIRECT, SfxViewShell::GetInterface(), &rState ); ... } [Cross-reference] */ const SfxPoolItem* GetSlotState( sal_uInt16 nSlotId, const SfxInterface *pIF = nullptr, SfxItemSet *pStateSet = nullptr ); /** This method allows you to forward a to the specified base . [Example] In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be intercepted. Under certain circumstances a query should appear before you print, and the request will be aborted if necessary. Also in the IDL of this subclass of the above slot is entered. The status method will contain in outline: void SubViewShell::Exec( SfxRequest &rReq ) { if ( rReq.GetSlot() == SID_PRINTDOCDIRECT ) { 'dialog' if ( 'condition' ) ExecuteSlot( rReq, SfxViewShell::GetInterface() ); } } It usually takes no rReq.Done() to be called as that is already completed in implementation of the SfxViewShell, for instance it has been canceled. [Cross-reference] */ const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = nullptr ); /** Asynchronous ExecuteSlot for the RELOAD */ void ExecuteSlot( SfxRequest &rReq, bool bAsync ); inline SfxItemPool& GetPool() const; inline void SetPool( SfxItemPool *pNewPool ) ; /** Each Subclass of SfxShell can have a . This can be set in the derived class with . The class SfxShell itself does not have a SfxUndoManager, a NULL-pointer is therefore returned. */ virtual ::svl::IUndoManager* GetUndoManager(); /** Sets a for this Instance. For the undo is only the undo-manager used for SfxShell at the top of the stack of each . On the given is automatically the current Max-Undo-Action-Count setting set form the options. 'pNewUndoMgr' must exist until the Destuctor of SfxShell instance is called or until the next 'SetUndoManager()'. */ void SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ); /** Returns a pointer to the instance that is used in SID_REPEAT as repeat target when it is addressed from the supplied by this SfxShell. The return value can be NULL. [Note] A derivation of or one of its subclasses of is not recommended, as compiler errors are provoked. (due to Call-to-Pointer-to-Member-Function to the subclass). */ SfxRepeatTarget* GetRepeatTarget() const; /** Sets the instance that is used in SID_REPEAT as RepeatTarget, when the current supplied by this is addressed. By 'pTarget==0' the SID_REPEAT is disabled for this SfxShell. The instance '*pTarget' must live as long as it is registered. [Note] A derivation of or one of its subclasses of is not recommended, as compiler errors are provoked. (due to Call-to-Pointer-to-Member-Function to the subclass). */ void SetRepeatTarget( SfxRepeatTarget *pTarget ); /** With this method can the slots of the subclasses be invalidated through the slot Id or alternatively through the Which ID. Slot IDs, which are inherited by the subclass are also invalidert. [Cross-reference] */ virtual void Invalidate(sal_uInt16 nId = 0); virtual bool IsDesignMode() const { return false; }; bool IsActive() const; /** Virtual method that is called when enabling the SfxShell instance, in order to give the Subclasses the opportunity to respond to the to the enabling. [Cross-reference] StarView SystemWindow::Activate(bool) */ virtual void Activate(bool bMDI); /** Virtual method that is called when disabling the SfxShell instance, to give the Subclasses the opportunity to respond to the disabling. [Cross-reference] StarView SystemWindow::Deactivate(bool) */ virtual void Deactivate(bool bMDI); /** This method returns a pointer to the , when the SfxShell is currently or a NULL-pointer if it is not UI-active. The returned pointer is only valid in the immediate context of the method call. */ SfxDispatcher* GetDispatcher() const; /** This method returns a pointer to the to which this SfxShell instance is associated or in which they currently is . A NULL pointer is returned if this SfxShell instance is not UI-active at the moment and also no SfxViewFrame is permanently assigned. The returned pointer is only valid in the immediate context of the method call. [Note] Only instances of a subclass of SfxApplication and SfxObjectShell should here provide a NULL-pointer. Otherwise, there is an error in the application program (wrong constructor was called from SfxShell). [Cross-reference] */ SfxViewFrame* GetFrame() const; virtual bool HasUIFeature( sal_uInt32 nFeature ); void UIFeatureChanged(); // Items /** With this method any objects of subclasses can be accessed. This exchange method is needed if, for example special subclasses need access to certain data such as the . The returned instance belongs to the particular SfxShell and may be used only in the immediate context of the method call. [Cross-reference] */ const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const; /** With this method, any objects of subclasses of can be made available. This exchange technology is needed if, for example, special Subclasses need access to certain data such as the If a SfxPoolItem exists with the same slot ID, it is deleted automatically. [Cross-reference] */ void PutItem( const SfxPoolItem& rItem ); // TODO/CLEANUP: still needed?! void SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >& aVerbs); const css::uno::Sequence < css::embed::VerbDescriptor >& GetVerbs() const; void VerbExec (SfxRequest&); static 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 ); /** Set the name of the sidebar context that is broadcast on calls to Activation(). */ void SetContextName (const ::rtl::OUString& rsContextName); /** Broadcast a sidebar context change. This method is typically called from Activate() or Deactivate(). @param bIsActivated When then broadcast the context name that was defined with an earlier call to SetContextName(). When then broadcast the 'default' context. */ void BroadcastContextForActivation (const bool bIsActivated); /** Enabled or disable the context broadcaster. Returns the old state. */ bool SetContextBroadcasterEnabled (const bool bIsEnabled); /** This method determines by calling the status function whether 'rSlot' can be executed currently. */ SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); /** This method controls the activation of SfxShell instance. First, by calling the virtual method which gives the subclass the opportunity to respond to the event. When bMDI == TRUE, the associated SbxObject is being 'armed', so that unqualified methods of the object (without the name of the object) from BASIC are found. */ SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI); /** This method controls the deactivation of the SfxShell instance. When bMDI == TRUE the SbxObject is first set to a status that only qualified BASIC methods can be called. Then the subclass gets the opportunity in every case to respond to the event by calling the virtual method . */ SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI); }; /** Each Subclass of SfxShell must reference a pool. This is partly set by SFx's own set of subclasses (eg ). 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, therefore a null-pointer is returned. */ SfxItemPool& SfxShell::GetPool() const { assert(pPool && "no pool"); return *pPool; } /** With this method, the subclasses register their special 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 deregistered with SetPool(0). */ inline void SfxShell::SetPool ( SfxItemPool* pNewPool // Pointer to the new Pool or null ) { pPool = pNewPool; } #define SFX_DECL_INTERFACE(nId) \ static SfxInterface* pInterface; \ static SfxInterface* GetStaticInterface(); \ static SfxInterfaceId GetInterfaceId() {return SfxInterfaceId(nId);} \ static void RegisterInterface(SfxModule* pMod=nullptr); \ virtual SfxInterface* GetInterface() const override; #define SFX_TMPL_INTERFACE(Class,SuperClass,Abstract) \ \ SfxInterface* Class::pInterface = nullptr; \ SfxInterface* Class::GetStaticInterface() \ { \ if ( !pInterface ) \ { \ pInterface = \ new SfxInterface( \ #Class, Abstract, 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); \ } #define SFX_IMPL_INTERFACE(Class,SuperClass) \ SFX_TMPL_INTERFACE(Class,SuperClass,false) \ #define SFX_IMPL_SUPERCLASS_INTERFACE(Class,SuperClass) \ SFX_TMPL_INTERFACE(Class,SuperClass,true) \ #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 #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ rfwork4'>feature/perfwork4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-08-29tdf#161826 - Add uniform Glow effect for texts in shapesBalazs Varga
- Add new text Glow effect properties for shapes - Using TextGlowPrimitive for rendering uniform text glow in shapes - Add/allow new UI Glow Effect for texts in shapes on sidebar (Only for Impress/Draw and Calc) - Import/Export ooxml files with Glow effect on texts in shapes (Only PPTX/XLSX) - Import/Export odf files with Glow effect on texts in shapes - Add unit test for glow text attributes in ODF - Add uni tests for OOXML import/export Note: Also this patch effects on tdf#144061 - Effects: Allow GLOW to apply to Text (as we have for shapes) Change-Id: I16586c01654f197f532129e4e06aa2ef9f214395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172216 Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2023-04-18sc drawstyles: Comment shadow should depends on shadow attributeMaxim Monastirsky
The shadow of comments differs from the shadow of normal callout shapes, as it shows only for the text rectangle. However the way it's implemented is weird: The shadow attribute is set to false, which turns off the "normal" shadow, and then the special shadow is drawn unconditionally. There is also a code that forces the shadow attribute to false on import, to handle some old files that used to have the shadow on. The confusion begins when one shows the comment, and looks at right click > Area... > Shadow, which (rightfully) shows the shadow as off, but doesn't align with what is visible on the document canvas. Moreover, the other shadow settings on this page do affect the comment shadow, but in order to change them it is needed to check the "Use shadow" checkbox first. But leaving that checkbox as checked will result with a double shadow being drawn for the text rectangle, and an unnecessary shadow drawn for the arrow part. The problem becomes now more visible, as there is a Note style listed in the sidebar. One possible approach could be to draw the special shadow only when the shadow attribute is on, and patch existing files on import to "shadow on" instead of "shadow off". But this will cause the "double shadow" problem when opened in older versions (unless the comment is hidden, in which case we used to override the shadow attribute). But now there's an opportunity for a better solution: As we assign the default comment style to imported comments, we can just clear the shadow attribute DF, instead of forcing it to some value. As a result, the "shadow on" attribute of the style will be in effect in newer versions, while in older versions it will fallback to the "shadow off" pool default. Change-Id: I4b35bc1e8e2e12ed35a82b0c2e9aabcf28b46270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150353 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2020-07-19compact namespace: svxNoel Grandin
Change-Id: I15c64c6cc0ae2a0f1fb9a3e1651dda1d6ced7585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99008 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-12Rename attributes to reflect that they represent different effectsMike Kaganski
... not only shadow. In preparation to add soft edge effect (tdf#49247). Change-Id: Ia5b17fff00e1c2d7f717179687dbd44410795a71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94007 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-11Limit utility function's visibilityMike Kaganski
Change-Id: I1d1a89a197d90dcb1e7de9b4090e1fe6baf53e1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93972 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-10compact namespace in svxNoel Grandin
Change-Id: I9229775999aa70c2b37c0527ba1c332143f9f2cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93877 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-03tdf#101181 Implement glow effect on shapesTamas Bunth
Glow effect is a color-blurred outline outside of the shape. In ooxml document it is specified with the <a:glow> element. The commit contains the following: - Add support for importing and exporting <a:glow> from ooxml documents. - Assign new properties to XShape which stores glow-related attributes. - A new 2D primitive is introduced in module 'drawinglayer' which is responsible for representing the glow primitive which is to be rendered. + A glow primitive is a clone of the original shape which has been scaled up slightly and a new color has been assigned to it. The radius of the glow effect and the color is defined in the <a:glow> element being imported. - A blur algorithm is introduced in module 'vcl', which is called during rendering the primitive. + The blur algorithm works on a bitmap. + Since the algorithm is CPU-intensive, the result is cached in the processor and it is recalculated only if needed. - Add support for importing and exporting glow effect to ODF format. For that, new attributes of element <style:graphic-properties> has been added: + loext:glow, which can have the values "visible" or "hidden" + loext:glow-radius: which holds the radius of the glow effect in cm. + loext:glow-color: holds the color of the glow effect - Tests have been added to assert properties after pptx import and export. Change-Id: I836aeb5e0f24e2c8d5725834c8c0f98083bc82e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89125 Tested-by: Jenkins Reviewed-by: Tamás Bunth <btomi96@gmail.com>
2020-02-12move some svx/ headers inside the moduleNoel Grandin
Change-Id: I8d9a50039a8139caebb2cfb83ca476d39432f255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>