LCOV - code coverage report
Current view: top level - include/svx - tbcontrl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 3 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SVX_TBCONTRL_HXX
      20             : #define INCLUDED_SVX_TBCONTRL_HXX
      21             : 
      22             : /*--------------------------------------------------------------*\
      23             : 
      24             :     Description:
      25             :     -------------
      26             :     ToolBox-Controller for:
      27             :         Font-Name, Font-Height, Font-Color
      28             :         Fore-/Background color /-patterns
      29             :         Frames, Lines
      30             :         (indentation-)templates
      31             : 
      32             :     Use:
      33             :     ----------
      34             :         SvxFontNameToolBoxControl
      35             :         -------------------------
      36             :         Item type:      SvxFontItem
      37             :         Execute-Id:     SID_ATTR_CHAR_FONT
      38             :                         -> SvxFontItem
      39             :         Additional information
      40             :         from DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
      41             : 
      42             :         SvxColorToolBoxControl
      43             :         ----------------------
      44             :         Item type:      SvxColorItem
      45             :                         SvxLineItem
      46             :                         SfxBoolItem
      47             :                         XLineColorItem
      48             :                     and XFillColorItem
      49             : 
      50             :         for font color (writer, ...)
      51             :         Execute-Id      SID_ATTR_CHAR_COLOR2
      52             :                     and SID_ATTR_CHAR_COLOR_EXT
      53             : 
      54             :         for font color
      55             :         (calc/impress/draw and writer drawing objects)
      56             :         Execute-Id      SID_ATTR_CHAR_COLOR
      57             : 
      58             :         for character background color (writer)
      59             :         Execute-Id      SID_ATTR_CHAR_COLOR_BACKGROUND
      60             :                     and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
      61             : 
      62             :         for paragraph background color (writer)
      63             :         and cell background color (calc)
      64             :         Execute-Id      SID_BACKGROUND_COLOR
      65             : 
      66             :         for table/cell border color (writer, calc)
      67             :         Execute-Id      SID_FRAME_LINECOLOR
      68             : 
      69             :         for 3D extrusion
      70             :         Execute-Id      SID_EXTRUSION_3D_COLOR
      71             : 
      72             :         for line color
      73             :         Execute-Id      SID_ATTR_LINE_COLOR
      74             : 
      75             :         for area fill color
      76             :         Execute-Id      SID_ATTR_FILL_COLOR
      77             : 
      78             :         SvxPatternToolBoxControl
      79             :         ------------------------
      80             :         Item type:      SvxBrushItem
      81             :         Execute-Id:     SID_BACKGROUND_PATTERN
      82             :                         -> SvxBrushItem
      83             :         Additional information
      84             :         from DocShell:   presently none
      85             :                         in future: color palette
      86             :         Note:           Analysis of BrushItem:
      87             :                         Brush-FillColor() is misused as switch,
      88             :                         to distinguish whether a new style
      89             :                         or a new color has been set
      90             : 
      91             :                         GetFillColor() == COL_BLACK -> GetStyle() ,
      92             :                         GetFillColor() == COL_WHITE -> GetColor()
      93             : 
      94             :         SvxFrameToolBoxControl
      95             :         ----------------------
      96             :         Item type:      SvxBoxItem
      97             :         Execute-Id:     SID_ATTR_BORDER
      98             :                         -> SvxBoxItem & SvxBoxInfoItem
      99             :         Additional information
     100             :         from DocShell:  none
     101             :         Bemerkung:      provides dependent of chosen ValueSet-Item
     102             :                         only SvxBoxItem or additionally SvxBoxInfoItem
     103             :                         If the Controller ein SfxUInt16Item receives a
     104             :                         value != 0, paragraph mode will be switched on,
     105             :                         i.e. the last line will be hidden.
     106             :                         A value == 0 switches again to Tabel mode.
     107             : 
     108             :         SvxFrameLineStyleToolBoxControl
     109             :         -------------------------------
     110             :         Item type:      SvxLineItem
     111             :         Execute-Id:     SID_FRAME_LINESTYLE
     112             :                         -> SvxLineItem
     113             :         Additional information
     114             :         from DocShell:  none
     115             :         Bemerkung:      provides a SvxLineItem, which provides a SvxBorderLine
     116             :                         without color information.
     117             : 
     118             :         SvxStyleToolBoxControl
     119             :         ----------------------
     120             :         Item type:      SfxTemplateItem
     121             :         Execute-Id:     SID_TEMPLATE_APPLY
     122             :                         -> StyleName (SfxStringItem)
     123             :                         -> eStyleFamily (SfxUInt16Item)
     124             :         Additional information
     125             :         from DocShell:  none
     126             :         Bemerkung:      Switch family by Invalidate
     127             :                         at the Bindings (->SfxStyleControllerItem)
     128             : 
     129             : \*--------------------------------------------------------------*/
     130             : 
     131             : // ITEMID_...-Defines i *.cxx
     132             : 
     133             : #include <rsc/rscsfx.hxx>
     134             : #include <svl/lstner.hxx>
     135             : #include <sfx2/tbxctrl.hxx>
     136             : #include <svx/strarray.hxx>
     137             : #include <svx/svxdllapi.h>
     138             : #include <com/sun/star/awt/FontDescriptor.hpp>
     139             : #include <svx/PaletteManager.hxx>
     140             : #include <memory>
     141             : 
     142             : // important im tbxctrls.hxx created HeDaBu !!!
     143             : class SvxLineItem;
     144             : class SvxBoxInfoItem;
     145             : class SvxFontItem;
     146             : class SfxStyleControllerItem_Impl;
     147             : class SfxStyleSheetBasePool;
     148             : class SfxTemplateItem;
     149             : 
     150             : namespace svx
     151             : {
     152             :     class ToolboxButtonColorUpdater;
     153             : }
     154             : 
     155             : class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
     156             : {
     157             :     struct Impl;
     158             :     std::unique_ptr<Impl> pImpl;
     159             : 
     160             : public:
     161             :     SFX_DECL_TOOLBOX_CONTROL();
     162             : 
     163             :     SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     164             :     virtual ~SvxStyleToolBoxControl();
     165             : 
     166             :     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
     167             : 
     168             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     169             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     170             : 
     171             :     DECL_LINK( VisibilityNotification, void* );
     172             : protected:
     173             :     // XInitialization
     174             :     virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& aArguments)
     175             :             throw (css::uno::Exception, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             : 
     177             :     // XUpdatable
     178             :     virtual void SAL_CALL update()
     179             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             :     // XComponent
     182             :     virtual void SAL_CALL dispose()
     183             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             : 
     185             : private:
     186             : 
     187             : #define MAX_FAMILIES 5
     188             : 
     189             :     SfxStyleSheetBasePool* pStyleSheetPool;
     190             :     SfxStyleControllerItem_Impl* pBoundItems[MAX_FAMILIES];
     191             :     css::uno::Reference<css::lang::XComponent> m_xBoundItems[MAX_FAMILIES];
     192             :     SfxTemplateItem* pFamilyState[MAX_FAMILIES];
     193             :     sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
     194             : 
     195             :     SVX_DLLPRIVATE void Update();
     196             :     SVX_DLLPRIVATE void FillStyleBox();
     197             :     SVX_DLLPRIVATE void SelectStyle(const OUString& rStyleName);
     198             : 
     199             : friend class SfxStyleControllerItem_Impl;
     200             : 
     201             :     SVX_DLLPRIVATE void SetFamilyState(sal_uInt16 nIdx, const SfxTemplateItem* pItem);
     202             :     SVX_DLLPRIVATE SfxStyleFamily GetActFamily();
     203             : };
     204             : 
     205        1972 : class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
     206             : {
     207             : public:
     208             :     SFX_DECL_TOOLBOX_CONTROL();
     209             :     SvxFontNameToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
     210             : 
     211             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     212             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     213             :     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
     214             : };
     215             : 
     216             : class BorderColorStatus
     217             : {
     218             :     Color maColor;
     219             :     Color maTLBRColor;
     220             :     Color maBLTRColor;
     221             : public:
     222             :     BorderColorStatus();
     223             :     ~BorderColorStatus();
     224             :     void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
     225             :     Color GetColor();
     226             : };
     227             : 
     228             : class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
     229             : {
     230             :     using SfxToolBoxControl::StateChanged;
     231             : 
     232             :     std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater;
     233             :     PaletteManager mPaletteManager;
     234             :     BorderColorStatus maBorderColorStatus;
     235             :     bool bSidebarType;
     236             :     DECL_LINK(SelectedHdl, Color*);
     237             : public:
     238             :     SFX_DECL_TOOLBOX_CONTROL();
     239             :     SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     240             :     virtual ~SvxColorToolBoxControl();
     241             : 
     242             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     243             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     244             :     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
     245             :     virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     246             :     virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
     247             : };
     248             : 
     249         310 : class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
     250             : {
     251             : public:
     252             :     SFX_DECL_TOOLBOX_CONTROL();
     253             :     SvxFrameToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     254             : 
     255             :     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
     256             :     virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     257             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     258             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     259             : };
     260             : 
     261         310 : class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
     262             : {
     263             : public:
     264             :     SFX_DECL_TOOLBOX_CONTROL();
     265             :     SvxFrameLineStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     266             : 
     267             :     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
     268             :     virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     269             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     270             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     271             : };
     272             : 
     273             : class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
     274             : {
     275             : private:
     276             :     OUString aDefaultText;
     277             : 
     278             : public:
     279             :     SFX_DECL_TOOLBOX_CONTROL();
     280             :     SvxSimpleUndoRedoController(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
     281             :     virtual ~SvxSimpleUndoRedoController();
     282             : 
     283             :     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
     284             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     285             : };
     286             : 
     287             : #endif // INCLUDED_SVX_TBCONTRL_HXX
     288             : 
     289             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11