2014-07-03 11:47:10 -05:00
|
|
|
/* -*- 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>
|
2014-07-25 09:45:13 -05:00
|
|
|
#include <svx/Palette.hxx>
|
2014-07-03 11:47:10 -05:00
|
|
|
#include <rtl/ustring.hxx>
|
2014-07-08 12:08:38 -05:00
|
|
|
#include <svx/tbxcolorupdate.hxx>
|
2014-07-03 11:47:10 -05:00
|
|
|
|
2014-07-30 10:15:49 -05:00
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#include <com/sun/star/util/XURLTransformer.hpp>
|
|
|
|
#include <com/sun/star/util/URLTransformer.hpp>
|
2014-07-30 12:45:37 -05:00
|
|
|
|
2015-07-23 15:21:49 -05:00
|
|
|
#include <deque>
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
2014-07-30 10:15:49 -05:00
|
|
|
|
2016-08-02 13:23:38 -05:00
|
|
|
class SVX_DLLPUBLIC PaletteManager
|
2014-07-03 11:47:10 -05:00
|
|
|
{
|
2014-08-11 10:35:50 -05:00
|
|
|
const sal_uInt16 mnMaxRecentColors;
|
2014-07-03 11:47:10 -05:00
|
|
|
|
2014-08-11 10:35:50 -05:00
|
|
|
sal_uInt16 mnNumOfPalettes;
|
|
|
|
sal_uInt16 mnCurrentPalette;
|
|
|
|
|
|
|
|
long mnColorCount;
|
2014-07-08 12:08:38 -05:00
|
|
|
svx::ToolboxButtonColorUpdater* mpBtnUpdater;
|
2014-07-03 11:47:10 -05:00
|
|
|
|
2016-07-24 06:53:40 -05:00
|
|
|
XColorListRef pColorList;
|
2014-08-11 10:35:50 -05:00
|
|
|
Color mLastColor;
|
2016-11-05 15:28:27 -05:00
|
|
|
std::deque<NamedColor> maRecentColors;
|
2015-07-23 15:21:49 -05:00
|
|
|
std::vector<std::unique_ptr<Palette>> m_Palettes;
|
|
|
|
|
2016-11-05 15:28:27 -05:00
|
|
|
std::function<void(const OUString&, const NamedColor&)> maColorSelectFunction;
|
2016-07-29 08:09:46 -05:00
|
|
|
css::uno::Reference < css::uno::XComponentContext > m_context;
|
2014-07-03 11:47:10 -05:00
|
|
|
public:
|
|
|
|
PaletteManager();
|
2014-07-25 09:45:13 -05:00
|
|
|
~PaletteManager();
|
2016-08-02 13:23:38 -05:00
|
|
|
PaletteManager(const PaletteManager&) = delete;
|
|
|
|
PaletteManager& operator=(const PaletteManager&) = delete;
|
2014-07-03 11:47:10 -05:00
|
|
|
void LoadPalettes();
|
|
|
|
void ReloadColorSet(SvxColorValueSet& rColorSet);
|
2018-06-18 15:30:10 -05:00
|
|
|
void ReloadColorSet(ColorValueSet& rColorSet);
|
2014-08-11 10:35:50 -05:00
|
|
|
void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
|
2018-06-18 15:30:10 -05:00
|
|
|
void ReloadRecentColorSet(ColorValueSet& rColorSet);
|
2014-07-10 09:14:29 -05:00
|
|
|
std::vector<OUString> GetPaletteList();
|
|
|
|
void SetPalette( sal_Int32 nPos );
|
|
|
|
sal_Int32 GetPalette();
|
2016-08-02 13:23:38 -05:00
|
|
|
sal_Int32 GetPaletteCount() { return mnNumOfPalettes; }
|
2016-07-24 06:53:40 -05:00
|
|
|
OUString GetPaletteName();
|
2016-08-02 13:23:38 -05:00
|
|
|
OUString GetSelectedPalettePath();
|
2014-07-10 09:14:29 -05:00
|
|
|
|
2014-07-03 11:47:10 -05:00
|
|
|
long GetColorCount();
|
2014-08-11 10:35:50 -05:00
|
|
|
long GetRecentColorCount();
|
|
|
|
|
2014-07-08 12:08:38 -05:00
|
|
|
const Color& GetLastColor();
|
|
|
|
void SetLastColor(const Color& rLastColor);
|
2016-11-05 15:28:27 -05:00
|
|
|
void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
|
2014-08-11 10:35:50 -05:00
|
|
|
|
2014-07-08 12:08:38 -05:00
|
|
|
void SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater);
|
2018-03-09 07:48:20 -06:00
|
|
|
void PopupColorPicker(vcl::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
|
2015-08-19 16:43:39 -05:00
|
|
|
|
2016-11-05 15:28:27 -05:00
|
|
|
void SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction);
|
2015-08-19 16:43:39 -05:00
|
|
|
|
2016-11-05 15:28:27 -05:00
|
|
|
static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor);
|
2014-07-03 11:47:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDED_SVX_PALETTEMANAGER_HXX
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|