diff options
Diffstat (limited to 'svx/inc/svx')
-rw-r--r-- | svx/inc/svx/AffineMatrixItem.hxx | 54 | ||||
-rw-r--r-- | svx/inc/svx/XPropertyEntry.hxx | 47 | ||||
-rw-r--r-- | svx/inc/svx/nbdtmg.hxx | 376 | ||||
-rw-r--r-- | svx/inc/svx/nbdtmgfact.hxx | 33 | ||||
-rw-r--r-- | svx/inc/svx/sdr/table/tablecontroller.hxx | 159 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/ColorControl.hxx | 82 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/ColorPopup.hxx | 51 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx | 65 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/Popup.hxx | 103 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/PopupContainer.hxx | 44 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/PopupControl.hxx | 47 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/SelectionAnalyzer.hxx | 62 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/SelectionChangeHandler.hxx | 85 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/SidebarDialControl.hxx | 41 | ||||
-rw-r--r-- | svx/inc/svx/sidebar/ValueSetWithTextControl.hxx | 157 |
15 files changed, 1406 insertions, 0 deletions
diff --git a/svx/inc/svx/AffineMatrixItem.hxx b/svx/inc/svx/AffineMatrixItem.hxx new file mode 100644 index 000000000000..20fa4ae8f15b --- /dev/null +++ b/svx/inc/svx/AffineMatrixItem.hxx @@ -0,0 +1,54 @@ +/* + * 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_AFFINEMATRIXITEM_HXX +#define _SVX_AFFINEMATRIXITEM_HXX + +#include <svx/svxdllapi.h> +#include <svl/poolitem.hxx> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> + +//--------------------- +// class AffineMatrixItem +//--------------------- + +class SVX_DLLPUBLIC AffineMatrixItem : public SfxPoolItem +{ +private: + com::sun::star::geometry::AffineMatrix2D maMatrix; + +public: + TYPEINFO(); + AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix = 0); + AffineMatrixItem(SvStream& rIn); + AffineMatrixItem(const AffineMatrixItem&); + virtual ~AffineMatrixItem(); + + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) 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 ); + + const com::sun::star::geometry::AffineMatrix2D& GetAffineMatrix2D() const; +}; + +#endif // _SVX_AFFINEMATRIXITEM_HXX + +// eof diff --git a/svx/inc/svx/XPropertyEntry.hxx b/svx/inc/svx/XPropertyEntry.hxx new file mode 100644 index 000000000000..32b5b409c27b --- /dev/null +++ b/svx/inc/svx/XPropertyEntry.hxx @@ -0,0 +1,47 @@ +/* + * 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 _XPROPERTYENTRY_HXX +#define _XPROPERTYENTRY_HXX + +#include <svx/svxdllapi.h> +#include <tools/string.hxx> +#include <vcl/bitmap.hxx> + +// --------------------- +// class XPropertyEntry + +class SVX_DLLPUBLIC XPropertyEntry +{ +private: + String maName; + Bitmap maUiBitmap; + +protected: + XPropertyEntry(const String& rName); + XPropertyEntry(const XPropertyEntry& rOther); + +public: + virtual ~XPropertyEntry(); + + void SetName(const String& rName) { maName = rName; } + const String& GetName() const { return maName; } + void SetUiBitmap(const Bitmap& rUiBitmap) { maUiBitmap = rUiBitmap; } + const Bitmap& GetUiBitmap() const { return maUiBitmap; } +}; + +#endif // _XPROPERTYENTRY_HXX diff --git a/svx/inc/svx/nbdtmg.hxx b/svx/inc/svx/nbdtmg.hxx new file mode 100644 index 000000000000..eb75368a5274 --- /dev/null +++ b/svx/inc/svx/nbdtmg.hxx @@ -0,0 +1,376 @@ +/* + * 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 _NBDTMG_HXX +#define _NBDTMG_HXX +#include "svx/svxdllapi.h" +#include <boost/shared_ptr.hpp> +#include <vector> +#include <editeng/numitem.hxx> +#include <vcl/font.hxx> + +namespace svx { namespace sidebar { + +#define DEFAULT_BULLET_TYPES 8 +#define DEFAULT_NONE 10 +#define DEFAULT_NUM_TYPE_MEMBER 5 +#define DEFAULT_NUM_VALUSET_COUNT 8 +#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10 + +typedef sal_uInt16 NBOType; +namespace eNBOType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; + const NBOType NUMBERING = 0x03; + const NBOType OUTLINE = 0x04; + const NBOType MIXBULLETS = 0x05; +} + +typedef sal_uInt16 NBType; +namespace eNBType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; +} + +class SVX_DLLPUBLIC NumSettings_Impl +{ + public: + short nNumberType; + short nParentNumbering; + SvxNumberFormat::LabelFollowedBy eLabelFollowedBy; + long nTabValue; + SvxAdjust eNumAlign; + long nNumAlignAt; + long nNumIndentAt; + rtl::OUString sPrefix; + rtl::OUString sSuffix; + rtl::OUString sBulletChar; + rtl::OUString sBulletFont; + SvxBrushItem *pBrushItem; + Size aSize; + + public: + NumSettings_Impl() + : nNumberType(0) + , nParentNumbering(0) + , pBrushItem(0) + , aSize(0,0) + {} + ~NumSettings_Impl(){} +}; + +typedef NumSettings_Impl* NumSettings_ImplPtr; +typedef std::vector< boost::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl; + +class SVX_DLLPUBLIC BulletsSettings +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NBType eType; + public: + BulletsSettings(NBType eTy) : + bIsCustomized(sal_False), + eType(eTy) + {} + virtual ~BulletsSettings(){} +}; + +class SVX_DLLPUBLIC BulletsSettings_Impl:public BulletsSettings +{ + public: + sal_Unicode cBulletChar; + //rtl::OUString sBulletFont; + Font aFont; + + public: + BulletsSettings_Impl(NBType eTy) : + BulletsSettings(eTy) + {} + virtual ~BulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC GrfBulDataRelation: public BulletsSettings +{ + public: + String sGrfName; + sal_uInt16 nTabIndex; + sal_uInt16 nGallaryIndex; + const Graphic* pGrfObj; + Size aSize; + GrfBulDataRelation(NBType eTy): + BulletsSettings(eTy), + nTabIndex((sal_uInt16)0xFFFF), + nGallaryIndex((sal_uInt16)0xFFFF), + pGrfObj(0), + aSize(0,0) + {} + virtual ~GrfBulDataRelation(){} +}; + +class SVX_DLLPUBLIC MixBulletsSettings_Impl +{ + public: + NBType eType; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + BulletsSettings* pBullets; + public: + MixBulletsSettings_Impl(NBType eTy) : + eType(eTy), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pBullets(0) + {} + ~MixBulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC NumberSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + NumSettings_Impl *pNumSetting; + public: + NumberSettings_Impl() : + bIsCustomized(sal_False), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pNumSetting(NULL) + {} + ~NumberSettings_Impl(){} +}; + +typedef NumberSettings_Impl* NumberSettings_ImplPtr; +typedef std::vector< boost::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl; + +class SVX_DLLPUBLIC OutlineSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NumSettingsArr_Impl *pNumSettingsArr; + public: + OutlineSettings_Impl() : + bIsCustomized(sal_False), + pNumSettingsArr(NULL) + {} + ~OutlineSettings_Impl(){ + } +}; + +class SVX_DLLPUBLIC NBOTypeMgrBase +{ + public: + NBOType eType; + private: + const SfxItemSet* pSet; + SfxMapUnit eCoreUnit; + //Sym3_2508 store the attributes passed from pSet + String aNumCharFmtName; + void StoreBulCharFmtName_impl(); + void StoreMapUnit_impl(); + + public: + NBOTypeMgrBase(const NBOType aType):eType(aType),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOType aType,const SfxItemSet* pArg):eType(aType),pSet(pArg),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOTypeMgrBase& aTypeMgr){eType = aTypeMgr.eType;pSet = aTypeMgr.pSet;eCoreUnit = aTypeMgr.eCoreUnit;aNumCharFmtName = aTypeMgr.aNumCharFmtName; } + virtual ~NBOTypeMgrBase() {} + virtual void Init()=0; + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0)=0; + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF)=0; + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF, sal_Bool isDefault=false,sal_Bool isResetSize=false)=0; + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false)=0; + virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0; + sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel); + const SfxItemSet* GetItems() { return pSet;} + //Sym3_2508 store the attributes passed from pSet + void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();} + protected: + String GetBulCharFmtName(); + SfxMapUnit GetMapUnit(); + protected: + sal_Bool bIsLoading; + void ImplLoad(String filename); + void ImplStore(String filename); + +}; + + +class SVX_DLLPUBLIC BulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]; + static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]; + static BulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static BulletsTypeMgr* _instance; + public: + BulletsTypeMgr(const NBOType aType); + BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr); + virtual ~BulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_Unicode GetBulChar(sal_uInt16 nIndex); + Font GetBulCharFont(sal_uInt16 nIndex); + static BulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new BulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC GraphyicBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + typedef std::vector<GrfBulDataRelation*> ListType; + ListType aGrfDataLst; + static GraphyicBulletsTypeMgr* _instance; + public: + GraphyicBulletsTypeMgr(const NBOType aType); + GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr); + virtual ~GraphyicBulletsTypeMgr(); + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + String GetGrfName(sal_uInt16 nIndex); + static GraphyicBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new GraphyicBulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC MixBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static MixBulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsSettings_Impl* pDefaultActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsTypeMgr* _instance; + public: + MixBulletsTypeMgr(const NBOType aType); + MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr); + virtual ~MixBulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static MixBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new MixBulletsTypeMgr(eNBOType::MIXBULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC NumberingTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArr; + NumberSettingsArr_Impl* pNumberSettingsArr; + NumberSettingsArr_Impl* pDefaultNumberSettingsArr; + static NumberingTypeMgr* _instance; + public: + NumberingTypeMgr(const NBOType aType); + NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg); + NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr); + virtual ~NumberingTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_uInt16 GetNumCount() const; + NumberSettings_Impl* GetNumSettingByIndex(sal_uInt16 nIndex) const; + static NumberingTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new NumberingTypeMgr(eNBOType::NUMBERING); + } + + return _instance; + } +}; + +class SVX_DLLPUBLIC OutlineTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + static OutlineTypeMgr* _instance; + public: + OutlineTypeMgr(const NBOType aType); + OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg); + OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr); + virtual ~OutlineTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static OutlineTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new OutlineTypeMgr(eNBOType::OUTLINE); + } + + return _instance; + } +}; +}} +#endif + diff --git a/svx/inc/svx/nbdtmgfact.hxx b/svx/inc/svx/nbdtmgfact.hxx new file mode 100644 index 000000000000..76638d996a98 --- /dev/null +++ b/svx/inc/svx/nbdtmgfact.hxx @@ -0,0 +1,33 @@ +/* + * 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 _NBDTMGFACT_HXX +#define _NBDTMGFACT_HXX +#ifndef _NBDTMG_HXX +#include "nbdtmg.hxx" +#endif +namespace svx { namespace sidebar { +class SVX_DLLPUBLIC NBOutlineTypeMgrFact +{ +public: + static NBOTypeMgrBase* CreateInstance(const NBOType aType); + NBOutlineTypeMgrFact(); + virtual ~NBOutlineTypeMgrFact() {} +}; +}} +#endif + diff --git a/svx/inc/svx/sdr/table/tablecontroller.hxx b/svx/inc/svx/sdr/table/tablecontroller.hxx new file mode 100644 index 000000000000..5efdd875968e --- /dev/null +++ b/svx/inc/svx/sdr/table/tablecontroller.hxx @@ -0,0 +1,159 @@ +/* -*- 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_TABLECONTROLLER_HXX_ +#define _SVX_TABLECONTROLLER_HXX_ + +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/table/XTable.hpp> +#include <rtl/ref.hxx> + +#include <svx/sdr/overlay/overlayobjectlist.hxx> +#include <svx/selectioncontroller.hxx> +#include <svx/svdotable.hxx> +#include <svx/svdview.hxx> +//#include <tablemodel.hxx> + +class SdrObjEditView; +class SdrObject; +class SfxItemSet; + +namespace sdr { namespace table { + +class TableModel; + +class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController +{ +public: + SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj ); + SVX_DLLPRIVATE virtual ~SvxTableController(); + + // from sdr::SelectionController + SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin); + SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin); + SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin); + SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin); + + SVX_DLLPRIVATE virtual bool DeleteMarked(); + + SVX_DLLPRIVATE virtual void onSelectionHasChanged(); + + SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ); + SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq ); + + SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const; + SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ); + + SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); + SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ); + + // slots + SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 ); + SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId ); + SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId ); + SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq ); + SVX_DLLPRIVATE void MergeMarkedCells(); + SVX_DLLPRIVATE void SplitMarkedCells(); + SVX_DLLPRIVATE void DistributeColumns(); + SVX_DLLPRIVATE void DistributeRows(); + SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId ); + + SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController ); + + SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const; + SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll); + + SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const; + SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll); + + SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage ); + SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ); + + SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); } + + void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos ); + void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos ); + void clearSelection(); + void selectAll(); + + SVX_DLLPRIVATE void onTableModified(); + +private: + SvxTableController(SvxTableController &); // not defined + void operator =(SvxTableController &); // not defined + + // internals + SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr ); + SVX_DLLPRIVATE void UpdateTableShape(); + + SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs ); + SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs ); + + SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj ); + + SVX_DLLPRIVATE bool checkTableObject(); + SVX_DLLPRIVATE bool updateTableObject(); + SVX_DLLPRIVATE const CellPos& getSelectionStart(); + SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos ); + SVX_DLLPRIVATE const CellPos& getSelectionEnd(); + SVX_DLLPRIVATE void checkCell( CellPos& rPos ); + + SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow ); + + SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 ); + SVX_DLLPRIVATE bool StopTextEdit(); + + SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow ); + SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow ); + SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 ); + + SVX_DLLPRIVATE void StartSelection( const CellPos& rPos ); + SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos ); + SVX_DLLPRIVATE void RemoveSelection(); + SVX_DLLPRIVATE void updateSelectionOverlay(); + SVX_DLLPRIVATE void destroySelectionOverlay(); + + SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos ); + + DECL_LINK( UpdateHdl, void * ); + + //TableModelRef mxTable; + rtl::Reference< TableModel > mxTable; + + CellPos maCursorFirstPos; + CellPos maCursorLastPos; + bool mbCellSelectionMode; + CellPos maMouseDownPos; + bool mbLeftButtonDown; + ::sdr::overlay::OverlayObjectList* mpSelectionOverlay; + + SdrView* mpView; + SdrObjectWeakRef mxTableObj; + SdrModel* mpModel; + + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener; + + sal_uLong mnUpdateEvent; +}; + +} } + +#endif // _SVX_TABLECONTROLLER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/sidebar/ColorControl.hxx b/svx/inc/svx/sidebar/ColorControl.hxx new file mode 100644 index 000000000000..58ab534c1aa1 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorControl.hxx @@ -0,0 +1,82 @@ +/* + * 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 "svx/sidebar/PopupControl.hxx" + +#include <svtools/valueset.hxx> +#include <boost/function.hpp> + +class Window; +class SfxBindings; +class RedId; +class FloatingWindow; + + +namespace svx { namespace sidebar { + +/** The ColorControl uses a ValueSet control for displaying all named + colors in a matrix. +*/ +class SVX_DLLPUBLIC ColorControl + : public PopupControl +{ +public: + /** Create a new ColorControl object. + @param rControlResId + The resource id for the whole color control. + @param rNoColorGetter + A functor for getting the color which will be returned when the + WB_NONEFIELD is used and got selected + @param rColorSetter + A functor for setting the color that is selected by the + user. + @param pNoColorStringResId + Resource id of an optional string for the "no color" + string. When a value is given then a + field/button is created above the color matrix for + selecting "no color" ie. transparent. + When zero is given then no such field is created. + */ + ColorControl ( + Window* pParent, + SfxBindings* pBindings, + const ResId& rControlResId, + const ResId& rValueSetResId, + const ::boost::function<Color(void)>& rNoColorGetter, + const ::boost::function<void(String&,Color)>& rColorSetter, + FloatingWindow* pFloatingWindow, + const ResId* pNoColorStringResId); + virtual ~ColorControl (void); + + void GetFocus (void); + void SetCurColorSelect ( + const Color aCol, + const bool bAvl); + +private: + SfxBindings* mpBindings; + ValueSet maVSColor; + FloatingWindow* mpFloatingWindow; + const String msNoColorString; + ::boost::function<Color(void)> maNoColorGetter; + ::boost::function<void(String&,Color)> maColorSetter; + + void FillColors (void); + DECL_LINK(VSSelectHdl, void *); +}; + +} } // end of namespace svx::sidebar diff --git a/svx/inc/svx/sidebar/ColorPopup.hxx b/svx/inc/svx/sidebar/ColorPopup.hxx new file mode 100644 index 000000000000..cdac568c7fd5 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorPopup.hxx @@ -0,0 +1,51 @@ +/* + * 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_SIDEBAR_COLOR_POPUP_HXX_ +#define _SVX_SIDEBAR_COLOR_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <tools/color.hxx> + + +namespace svx { namespace sidebar { + +/** Popup control that displays all named colors in a matrix. + The number of rows and columns of the matrix are computed from + the number of named colors so that both have roughly the same + value. + + The ColorPopup uses ColorControl as control for its content. +*/ +class SVX_DLLPUBLIC ColorPopup + : public Popup +{ +public : + ColorPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~ColorPopup (void); + + void SetCurrentColor ( + const Color aCurrentColor, + const bool bIsColorAvailable); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx new file mode 100644 index 000000000000..5075cdac70be --- /dev/null +++ b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx @@ -0,0 +1,65 @@ +/* + * 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_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ +#define _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +class SfxViewShell; + +/** Convenience frontend for com::sun::star::ui::ContextChangeEventMultiplexer +*/ +class SVX_DLLPUBLIC ContextChangeEventMultiplexer +{ +public: + /** Notify the activation of a context. + @param rxController + This controller is used to determine the module (ie + application like Writer or Calc). + @param eContext + The activated context. + */ + static void NotifyContextChange ( + const cssu::Reference<css::frame::XController>& rxController, + const ::sfx2::sidebar::EnumContext::Context eContext); + + /** Notify the activation of a context. + @param pViewShell + This view shell is used to determine the module (ie + application like Writer or Calc). When <NULL/> then no + notification is made. + @param eContext + The activated context. + */ + static void NotifyContextChange ( + SfxViewShell* pViewShell, + const ::sfx2::sidebar::EnumContext::Context eContext); + +private: + static ::rtl::OUString GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + +#endif + diff --git a/svx/inc/svx/sidebar/Popup.hxx b/svx/inc/svx/sidebar/Popup.hxx new file mode 100644 index 000000000000..25571f11a5a7 --- /dev/null +++ b/svx/inc/svx/sidebar/Popup.hxx @@ -0,0 +1,103 @@ +/* + * 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_SIDEBAR_POPUP_HXX_ +#define _SVX_SIDEBAR_POPUP_HXX_ + +#include "svx/svxdllapi.h" +#include <rtl/ustring.hxx> +#include <tools/link.hxx> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> + +class Window; +class ToolBox; + +namespace svx { namespace sidebar { + +class PopupContainer; +class PopupControl; + +/** A wrapper around a PopupContainer and a PopupControl object. + Usually used as drop down for a toolbox. Use Show() to start + drop down mode and Hide() to end it. +*/ +class SVX_DLLPUBLIC Popup +{ +public : + /** Create a Popup wrapper object. + @param pParent + Parent window of the PopupContainer, which in turn is the + parent of the PopupControl. + @param rControlCreator + A functor that is called to create the PopupControl object + (usually an instance of a class derived from + PopupControl). + */ + Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName); + virtual ~Popup (void); + + /** Show the popup. + @rToolBox + The tool box is used to determine the position at which + the popup is displayed. + */ + void Show (ToolBox& rToolBox); + + /** Hide the popup. + This method is called automatically when eg. the user clicks + outside the popup or when the ESC-key is pressed. The + application can call Hide() when the popup should be closed + for other, non-standard reasons. + */ + void Hide (void); + + /** If you want to be informed when the popup closes then add a + callback that is called after that. + */ + void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback); + +protected: + ::boost::scoped_ptr<PopupControl> mpControl; + + /** Make sure that both PopupContainer and PopupControl objects + exist. Calls the maControlCreator functor if necessary. + */ + void ProvideContainerAndControl (void); + + /** A derived specialisation class can override this method to do + additional work. + */ + virtual void CreateContainerAndControl (void); + +private: + Window* mpParent; + ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + ::boost::function<void(void)> maPopupModeEndCallback; + const ::rtl::OUString msAccessibleName; + ::boost::scoped_ptr<PopupContainer> mpContainer; + + DECL_LINK(PopupModeEndHandler, void*); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupContainer.hxx b/svx/inc/svx/sidebar/PopupContainer.hxx new file mode 100644 index 000000000000..1b33988c50fd --- /dev/null +++ b/svx/inc/svx/sidebar/PopupContainer.hxx @@ -0,0 +1,44 @@ +/* + * 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_SIDEBAR_POPUP_CONTAINER_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTAINER_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/floatwin.hxx> + +namespace svx { namespace sidebar { + +/** Simple base class for popup container windows used by sidebar + related drop downs. + It initializes the underlying floating window with the right + flags and closes the drop down when appropriate. +*/ +class SVX_DLLPUBLIC PopupContainer + : public FloatingWindow +{ +public: + PopupContainer (Window* pParent); + virtual ~PopupContainer (void); + + virtual long Notify (NotifyEvent& rNEvt); +}; + + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupControl.hxx b/svx/inc/svx/sidebar/PopupControl.hxx new file mode 100644 index 000000000000..de116750109f --- /dev/null +++ b/svx/inc/svx/sidebar/PopupControl.hxx @@ -0,0 +1,47 @@ +/* + * 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_SIDEBAR_POPUP_CONTROL_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTROL_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/ctrl.hxx> + +namespace svx { namespace sidebar { + +/** Base class for sidebar related popup controls. + A PopupControl is typically a child of a PopupContainer and + provides the actual content of a popup. + This base class takes care of painting the proper background and + border for sidebar popups. + Specialize by derivation. +*/ +class SVX_DLLPUBLIC PopupControl + : public Control +{ +public : + PopupControl ( + Window* pParent, + const ResId& rResId); + virtual ~PopupControl (void); + + virtual void Paint (const Rectangle& rect); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionAnalyzer.hxx b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx new file mode 100644 index 000000000000..05f8c0b4ee9d --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx @@ -0,0 +1,62 @@ +/* + * 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_SIDEBAR_SELECTION_ANALYZER_HXX_ +#define _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_ + +#include <sfx2/sidebar/EnumContext.hxx> +#include "svx/svxdllapi.h" + +class SdrMarkList; +class SdrObject; + + +namespace svx { namespace sidebar { + +class SVX_DLLPUBLIC SelectionAnalyzer +{ +public : + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC ( + const SdrMarkList& rMarkList); + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const bool bIsMasterPage, + const bool bIsHandoutPage, + const bool bIsNotesPage); + +private: + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC ( + const sal_uInt16 nObjectId); + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD ( + const sal_uInt16 nObjectId, + const bool bIsHandoutPage, + const bool bIsNotesPage); + static sal_uInt32 GetInventorTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromGroup ( + const SdrObject* pObj); + static bool IsShapeType ( + const sal_uInt16 nType); + static bool IsTextObjType ( + const sal_uInt16 nType); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionChangeHandler.hxx b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx new file mode 100644 index 000000000000..29116e5249b8 --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx @@ -0,0 +1,85 @@ +/* + * 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_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ +#define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <boost/noncopyable.hpp> +#include <boost/function.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +class SdrMarkView; + + +namespace svx { namespace sidebar { + +namespace { + typedef ::cppu::WeakComponentImplHelper1 < + css::view::XSelectionChangeListener + > SelectionChangeHandlerInterfaceBase; +} + + +class SVX_DLLPUBLIC SelectionChangeHandler + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SelectionChangeHandlerInterfaceBase +{ +public: + SelectionChangeHandler ( + const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, + const cssu::Reference<css::frame::XController>& rxController, + const sfx2::sidebar::EnumContext::Context eDefaultContext); + virtual ~SelectionChangeHandler (void); + + virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (void) + throw (cssu::RuntimeException); + + void Connect (void); + void Disconnect (void); + +private: + const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback; + cssu::Reference<css::frame::XController> mxController; + const sfx2::sidebar::EnumContext::Context meDefaultContext; + bool mbIsConnected; +}; + + +} } // end of namespace svx::sidebar + + +#endif + diff --git a/svx/inc/svx/sidebar/SidebarDialControl.hxx b/svx/inc/svx/sidebar/SidebarDialControl.hxx new file mode 100644 index 000000000000..f468784cb36f --- /dev/null +++ b/svx/inc/svx/sidebar/SidebarDialControl.hxx @@ -0,0 +1,41 @@ +/* + * 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_SIDEBAR_DIAL_CONTROL_HXX +#define SVX_SIDEBAR_DIAL_CONTROL_HXX + +#include <svx/dialcontrol.hxx> + +namespace svx { namespace sidebar { + +/** Provide some improvements over the standard DialControl. +*/ +class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl +{ +public: + SidebarDialControl (Window* pParent, const ResId& rResId); + virtual ~SidebarDialControl (void); + + virtual void MouseButtonDown (const MouseEvent& rMEvt); + +protected: + virtual void HandleMouseEvent (const Point& rPos, bool bInitial); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx new file mode 100644 index 000000000000..d0e524ca4e70 --- /dev/null +++ b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx @@ -0,0 +1,157 @@ +/* + * 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_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ +#define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ + +#include "svx/svxdllapi.h" + +#include <svtools/valueset.hxx> +#include <limits.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/lang/Locale.hpp> + +#include <vcl/image.hxx> + +#include <vector> + +namespace com{namespace sun{ namespace star{ + namespace container{ + class XIndexAccess; + } + namespace beans{ + struct PropertyValue; + } + namespace text{ + class XNumberingFormatter; + } +}}} + +namespace svx { namespace sidebar { + +/** Specialization of class <ValueSet>. + This specialization allows is a one-columned ValueSet which allow + items containing an image and a text or a text and a second text. + + Especially, used for sidebar related controls. +*/ +class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet +{ +public: + // control type of specialized <ValueSet>: + // - image + text + // - text + text + enum tControlType + { + IMAGE_TEXT, + TEXT_TEXT + }; + + ValueSetWithTextControl( + const tControlType eControlType, + Window* pParent, + const ResId& rResId); + + virtual ~ValueSetWithTextControl(void); + + // add item for control type IMAGE_TEXT + // if control type does not match IMAGE_TEXT no item is added. + // @param pSelectedItemImage + // selection item image is optional. if not provided, it is the same as the image item + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const Image& rItemImage, + const Image* pSelectedItemImage, + const XubString& rItemText, + const XubString* pItemHelpText ); + + // replace item images for control type IMAGE_TEXT + void ReplaceItemImages( + const sal_uInt16 nItemId, + const Image& rItemImage, + const Image* pSelectedItemImage ); + + // add item for control type TEXT_TEXT + // if control type does not match TEXT_TEXT no item is added. + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const XubString& rItemText, + const XubString& rItemText2, + const XubString* pItemHelpText ); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +private: + struct ValueSetWithTextItem + { + Image maItemImage; + Image maSelectedItemImage; + XubString maItemText; + XubString maItemText2; + }; + + typedef ::std::vector< ValueSetWithTextItem > tItemList; + + const tControlType meControlType; + tItemList maItems; +}; + +class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet +{ + Color aLineColor; + Rectangle aOrgRect; + VirtualDevice* pVDev; + + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; + com::sun::star::lang::Locale aLocale; + + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> > aNumSettings; + + + public: + SvxNumValueSet2( Window* pParent, const ResId& rResId); + ~SvxNumValueSet2(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + + void SetNumberingSettings( + const com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> >& aNum, + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, + const com::sun::star::lang::Locale& rLocale ); +}; + +class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet +{ + public: + SvxNumValueSet3( Window* pParent, const ResId& rResId); + ~SvxNumValueSet3(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +}; + +} } // end of namespace svx::sidebar + +#endif |