diff options
author | Krisztian Pinter <pin.terminator@gmail.com> | 2014-07-03 18:47:10 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2014-09-17 10:19:34 +0200 |
commit | e3fcf5591eb2ac28a96315fb089f5c88e0c6aa1f (patch) | |
tree | a222b9cf0839f156959f08d58c8468f5a7649726 /include | |
parent | 24933a3c920af29add1a19f19dbb8a8f129659cf (diff) |
Add PaletteManager, refactor palette code
Change-Id: I7e30fc895834318514b51bc648d32aa6d297bfae
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/Palette.hxx | 46 | ||||
-rw-r--r-- | include/svx/PaletteManager.hxx | 45 | ||||
-rw-r--r-- | include/svx/SvxColorValueSet.hxx | 13 | ||||
-rw-r--r-- | include/svx/tbcontrl.hxx | 5 |
4 files changed, 96 insertions, 13 deletions
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx new file mode 100644 index 000000000000..f7ced038c3e6 --- /dev/null +++ b/include/svx/Palette.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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_SVX_PALETTE_HXX +#define INCLUDED_SVX_PALETTE_HXX + +#include <rtl/ustring.hxx> +#include <tools/color.hxx> + +class Palette +{ +public: + typedef std::pair<Color, OString> NamedColor; + typedef std::vector< NamedColor > ColorList; +private: + bool mbLoaded; + OUString maFname; + OString maName; + ColorList maColors; + + void LoadPalette(); +public: + Palette(const OUString &rFname); + + const OString& GetPaletteName(); + const ColorList& GetPaletteColors(); +}; + +#endif // INCLUDED_SVX_PALETTE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx new file mode 100644 index 000000000000..a6b2dfa79317 --- /dev/null +++ b/include/svx/PaletteManager.hxx @@ -0,0 +1,45 @@ +/* -*- 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_SVX_PALETTEMANAGER_HXX +#define INCLUDED_SVX_PALETTEMANAGER_HXX + +#include <svx/SvxColorValueSet.hxx> +#include <rtl/ustring.hxx> + +class PaletteManager +{ + sal_uInt16 mnNumOfPalettes; + sal_uInt16 mnCurrentPalette; + + long mnColorCount; + + std::vector<Palette> maPalettes; +public: + PaletteManager(); + void LoadPalettes(); + void ReloadColorSet(SvxColorValueSet& rColorSet); + void PrevPalette(); + void NextPalette(); + long GetColorCount(); + OUString GetPaletteName(); +}; + +#endif // INCLUDED_SVX_PALETTEMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx index 77ad9b294ff6..7db9f4c38a6e 100644 --- a/include/svx/SvxColorValueSet.hxx +++ b/include/svx/SvxColorValueSet.hxx @@ -19,21 +19,12 @@ #ifndef INCLUDED_SVX_SVXCOLORVALUESET_HXX #define INCLUDED_SVX_SVXCOLORVALUESET_HXX +#include <svx/Palette.hxx> #include <svtools/valueset.hxx> #include <svx/svxdllapi.h> class XColorList; -struct Palette -{ - typedef std::pair<Color, OString> NamedColor; - typedef std::vector< NamedColor > ColorList; - Palette(){}; - Palette(const OUString &rFname); - OString maName; - ColorList maColors; -}; - class SVX_DLLPUBLIC SvxColorValueSet : public ValueSet { private: @@ -50,7 +41,7 @@ public: void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1); void loadColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex = 1); - void loadPalette(const Palette& rPalette); + void loadPalette(Palette& rPalette); Size layoutAllVisible(sal_uInt32 nEntryCount); Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount); }; diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index b1b578f6548f..6d9975f46110 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -133,6 +133,7 @@ #include <svx/svxdllapi.h> #include <boost/scoped_ptr.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <svx/PaletteManager.hxx> // important im tbxctrls.hxx created HeDaBu !!! class SvxLineItem; @@ -221,7 +222,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater; Color mLastColor; - sal_uInt16 nCurrentPalette; + PaletteManager mrPaletteManager; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); @@ -242,7 +243,7 @@ class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl { ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater; Color mLastColor; - sal_uInt16 nCurrentPalette; + PaletteManager mrPaletteManager; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); |