/* -*- 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_SVL_MACITEM_HXX #define INCLUDED_SVL_MACITEM_HXX // class SvxMacroItem ---------------------------------------------------- #include #include #include #include class SvStream; #define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript" #define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic" #define SVX_MACRO_LANGUAGE_SF "Script" enum ScriptType { STARBASIC, JAVASCRIPT, EXTENDED_STYPE }; class SVL_DLLPUBLIC SvxMacro { OUString aMacName; OUString aLibName; ScriptType eType; public: SvxMacro( const OUString &rMacName, const OUString &rLanguage); SvxMacro( const OUString &rMacName, const OUString &rLibName, ScriptType eType); // = STARBASIC removes const OUString &GetLibName() const { return aLibName; } const OUString &GetMacName() const { return aMacName; } OUString GetLanguage()const; ScriptType GetScriptType() const { return eType; } bool HasMacro() const { return !aMacName.isEmpty(); } SvxMacro& operator=( const SvxMacro& rBase ); }; inline SvxMacro::SvxMacro( const OUString &rMacName, const OUString &rLibName, ScriptType eTyp ) : aMacName( rMacName ), aLibName( rLibName ), eType( eTyp ) {} // Macro Table, destroys the pointers in the DTor! typedef std::map SvxMacroTable; #define SVX_MACROTBL_VERSION31 0 #define SVX_MACROTBL_VERSION40 1 #define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 class SVL_DLLPUBLIC SvxMacroTableDtor { private: SvxMacroTable aSvxMacroTable; public: SvxMacroTableDtor() {} SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : aSvxMacroTable(rCpy.aSvxMacroTable) { } SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy ); bool operator==( const SvxMacroTableDtor& rOther ) const; void Read( SvStream &, sal_uInt16 nVersion = SVX_MACROTBL_AKTVERSION ); SvStream& Write( SvStream & ) const; static sal_uInt16 GetVersion() { return SVX_MACROTBL_AKTVERSION; } SvxMacroTable::iterator begin() { return aSvxMacroTable.begin(); } SvxMacroTable::const_iterator begin() const { return aSvxMacroTable.begin(); } SvxMacroTable::iterator end() { return aSvxMacroTable.end(); } SvxMacroTable::const_iterator end () const { return aSvxMacroTable.end(); } SvxMacroTable::size_type size() const { return aSvxMacroTable.size(); } bool empty() const { return aSvxMacroTable.empty(); } // returns NULL if no entry exists, or a pointer to the internal value const SvxMacro* Get(sal_uInt16 nEvent) const; // returns NULL if no entry exists, or a pointer to the internal value SvxMacro* Get(sal_uInt16 nEvent); // return true if the key exists bool IsKeyValid(sal_uInt16 nEvent) const; // This stores a copy of the rMacro parameter SvxMacro& Insert(sal_uInt16 nEvent, const SvxMacro& rMacro); // If the entry exists, remove it from the map and release it's storage void Erase(sal_uInt16 nEvent); }; /* This item describes a Macro table. */ class SVL_DLLPUBLIC SvxMacroItem: public SfxPoolItem { public: explicit inline SvxMacroItem ( const sal_uInt16 nId ); // "pure virtual methods" of SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper * = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } inline const SvxMacro& GetMacro( sal_uInt16 nEvent ) const; inline bool HasMacro( sal_uInt16 nEvent ) const; void SetMacro( sal_uInt16 nEvent, const SvxMacro& ); private: SvxMacroTableDtor aMacroTable; inline SvxMacroItem( const SvxMacroItem& ); SvxMacroItem &operator=( const SvxMacroItem & ) = delete; }; inline SvxMacroItem::SvxMacroItem( const sal_uInt16 nId ) : SfxPoolItem( nId ) {} inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) : SfxPoolItem( rCpy ), aMacroTable( rCpy.GetMacroTable() ) {} inline bool SvxMacroItem::HasMacro( sal_uInt16 nEvent ) const { return aMacroTable.IsKeyValid( nEvent ); } inline const SvxMacro& SvxMacroItem::GetMacro( sal_uInt16 nEvent ) const { return *(aMacroTable.Get(nEvent)); } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /lov-6.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2017-09-29loplugin:flatten check for throw in then clauseNoel Grandin
2017-09-27loplugin:flatten in toolkit..vbahelperNoel Grandin
2017-09-22Fresh run of bin/update_pch.shMike Kaganski
2017-09-14clang-tidy modernize-use-emplace in test..vbahelperNoel Grandin
2017-09-08oovbaapi: create XOval and XLine shape typesTamas Bunth
2017-08-31inline some use-once typedefsNoel Grandin
2017-08-01move resmgr to unotoolsCaolán McNamara
2017-08-01loplugin:constparams in variousNoel Grandin
2017-08-01loplugin:checkunusedparamsNoel Grandin
2017-07-21migrate to boost::gettextCaolán McNamara
2017-07-15emfplus: create a wmf/emf/emf+ primitive based importerArmin Le Grand
2017-07-14use more OUString::operator== in test..xmlsecurityNoel Grandin
2017-07-06Create vba library if it did not exist beforeTamas Bunth
2017-07-05new loplugin unnecessaryparenNoel Grandin
2017-06-28loplugin:oncevar in ucb..vbahelperNoel Grandin
2017-06-24oovbaapi: use autoshape in case of EllipseShapeTamas Bunth
2017-06-21convert ErrCode to strong typedefNoel Grandin
2017-06-18vbahelper: remove unused variableJochen Nitschke
2017-06-18remove unused osl/mutex.hxx includesJochen Nitschke
2017-06-16loplugin:unusedfields in tools..vbahelperNoel Grandin
2017-06-12cleanup unused css/frame/* includesJochen Nitschke
2017-05-31clang-tidy readability-redundant-control-flowNoel Grandin
2017-05-20cleanup unused css/uri/ includesJochen Nitschke
2017-05-20cleanup unused css/script/ includesJochen Nitschke
2017-05-09make loplugin constantparam smarter about string paramsNoel Grandin
2017-05-05loplugin:checkunusedparams in toolkit..vbahelperNoel Grandin
2017-04-27tools: move errcode.hxx to the vcl moduleChris Sherlock
2017-04-25errinf.hxx moved out of tools and into vcl moduleChris Sherlock
2017-04-25tools: svstream.hxx needs only errcode.hxx & not errinf.hxxChris Sherlock
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky
2017-04-20loplugin:unusedmethodsNoel Grandin
2017-04-12enum spelling: throught -> throughJustin Luth
2017-04-07loplugin:redundantcast find cstyle arithmetic castsNoel Grandin
2017-04-03use actual UNO enums in test..vbahelperNoel Grandin
2017-03-31tdf#82580 tools: rename Rectangle to tools::RectangleMiklos Vajna
2017-03-25Fix typosAndrea Gelmini
2017-03-22loplugin:redundantcast find redundant c-style enum castsNoel Grandin
2017-03-03Remove redundant 'inline' keywordStephan Bergmann
2017-03-02Fix typosAndrea Gelmini
2017-02-28new loplugin unoanyNoel Grandin
2017-02-13Fix typosAndrea Gelmini
2017-01-27loplugin: unnecessary destructor vbahelper..vclNoel Grandin
2017-01-26Remove dynamic exception specificationsStephan Bergmann
2017-01-23Change all Idle* LINKs to be Timer*Jan-Marek Glogowski
2017-01-19New loplugin:dynexcspec: Add @throws documentation, vbahelperStephan Bergmann
2017-01-09New loplugin:externvar: vbahelperStephan Bergmann
2017-01-07Typo: Acess->AccessJulien Nabet
2017-01-07Typo: Postion->PositionJulien Nabet