Files
libreoffice/include/svtools/ctrltool.hxx

219 lines
8.3 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by: Jurgen Schmidt remove onlineregistration with dependencies http://svn.apache.org/viewvc?view=revision&revision=1240245 imported patch package_eventlistener.patch http://svn.apache.org/viewvc?view=revision&revision=1172103 Patch contributed by Pedro Giffuni Accept Google Chrome OS fonts as equivalent to MS fonts. http://svn.apache.org/viewvc?view=revision&revision=1233155 http://svn.apache.org/viewvc?view=revision&revision=1233408 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i114600#: remove forbidden characters from list of unencoded characters http://svn.apache.org/viewvc?view=revision&revision=1172370 Patches contributed by Oliver Rainer-Wittman some clean up in JPEGReader due to memory constraints http://svn.apache.org/viewvc?view=revision&revision=1299729 119114 - method <UpdateDialog::addSpecificError(..)> - create entry with correct type http://svn.apache.org/viewvc?view=revision&revision=1305265 Patches contributed by Ariel Constenla-Haile i118707 - make toolbar control's popup window grab focus http://svn.apache.org/viewvc?view=revision&revision=1225846 Patches contributed by Herbert Duerr #i118662# remove usage of BerkeleyDB in desktop module http://svn.apache.org/viewvc?view=revision&revision=1213171 minor cleanups in dp_persmap.* http://svn.apache.org/viewvc?view=revision&revision=1215064 flush early to prevent problem with extension manager not cleaning up its objects http://svn.apache.org/viewvc?view=revision&revision=1228147 i118726 do not flush *pmap file while reading it http://svn.apache.org/viewvc?view=revision&revision=1230614 #i119048# migrate BDB extension entries using a simple heuristic http://svn.apache.org/viewvc?view=revision&revision=1300972 #i119048# handle edge cases when importing BDB hash files http://svn.apache.org/viewvc?view=revision&revision=1301428 #i119113# fix of-by-one when importing BDB files http://svn.apache.org/viewvc?view=revision&revision=1305420 restore our encryption settings, icon themes, and dictionaries. removed wrapper hacks, kill obsolete bundled extension blob / pre-registration handling, remove duplicated quickstart code. remove OS/2 conditionals.
2012-11-15 17:28:16 +00:00
/*
* 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 .
*/
2000-09-18 16:07:07 +00:00
#ifndef INCLUDED_SVTOOLS_CTRLTOOL_HXX
#define INCLUDED_SVTOOLS_CTRLTOOL_HXX
2000-09-18 16:07:07 +00:00
#include <svtools/svtdllapi.h>
#include <rtl/ustring.hxx>
2000-09-18 16:07:07 +00:00
#include <sal/types.h>
#include <vcl/metric.hxx>
#include <tools/solar.h>
2000-09-18 16:07:07 +00:00
#include <vector>
#include <memory>
2000-09-18 16:07:07 +00:00
class ImplFontListNameInfo;
class OutputDevice;
2000-09-18 16:07:07 +00:00
/*
2000-09-18 16:07:07 +00:00
Description
2000-09-18 16:07:07 +00:00
============
class FontList
This class manages all fonts which can be display on one or two output devices.
Additionally, this class offers methods for generating the StyleName from
bold and italics or the missing attributes from a StyleName.
Furthermore, this class can handle synthetically reproduced fonts.
It also works with several standard controls and standard menus.
2000-09-18 16:07:07 +00:00
Links:
2000-09-18 16:07:07 +00:00
class FontNameBox, class FontStyleBox, class FontSizeBox,
2011-12-21 01:42:15 +01:00
class FontNameMenu, class FontSizeMenu
2000-09-18 16:07:07 +00:00
--------------------------------------------------------------------------
FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2 = NULL,
bool bAll = true );
2000-09-18 16:07:07 +00:00
Constructor of the FontList class. The relevant fonts will be queried from
the OutputDevice. The OutputDevice needs to exist as long as the FontList
class exists. Optionally, a second output device can be given in order to,
e.g., manage the fonts from both, a printer and a screen in a single FontList
and thus also give FontMenus the fonts if both OutputDevices.
The pDevice2 needs to exist as long as the FontList class exists.
The OutputDevice given first should be the preferred one. This is usually
the printer. Because if two different device fonts (one for the printer and
one for the screen) exist, the ones from the "pDevice" are preferred.
The third parameter governs whether only scalable or all fonts shall be queried.
With sal_True bitmap fonts will also be queried.
With sal_False vectorized and scalable fonts will be queried.
2000-09-18 16:07:07 +00:00
--------------------------------------------------------------------------
String FontList::GetStyleName( const FontMetric& rFontMetric ) const;
2000-09-18 16:07:07 +00:00
This method returns the StyleName of a FontMetric.
If no StyleName is set, a name will be generated from the set attributes.
2000-09-18 16:07:07 +00:00
--------------------------------------------------------------------------
OUString FontList::GetFontMapText( const FontMetric& rFontMetric ) const;
This method returns a Matchstring which indicates the problem that could
arise when using a font. This string should be displayed to the user.
--------------------------------------------------------------------------
FontMetric FontList::Get( const String& rName, const String& rStyleName ) const;
2000-09-18 16:07:07 +00:00
This method search a FontMetric for the given name and the given style name.
The Stylename can also be a synthetic one.
In that case the relevant FontMetric fields will be set.
If a StyleName is provided, a FontMetric structure without a Stylename can be
returned. To get a representation of the StyleName for displaying it to the user,
call GetStyleName() on this FontMetric structure.
2000-09-18 16:07:07 +00:00
Links:
2000-09-18 16:07:07 +00:00
FontList::GetStyleName()
--------------------------------------------------------------------------
FontMetric FontList::Get( const String& rName, FontWeight eWeight,
2000-09-18 16:07:07 +00:00
FontItalic eItalic ) const;
This method search a FontMetric structure for a provided name and styles.
This method can also return a FontMetric without a Stylename.
To get a representation of the StyleName to be presented to the user
call GetStyleName() with this FontMetric.
2000-09-18 16:07:07 +00:00
Links:
2000-09-18 16:07:07 +00:00
FontList::GetStyleName()
--------------------------------------------------------------------------
const sal_IntPtr* FontList::GetSizeAry( const FontMetric& rFontMetric ) const;
2000-09-18 16:07:07 +00:00
This method returns the available sizes for the given font.
If it is a scalable font, standard sizes are returned.
The array contains the heights of the font in tenth (1/10) point.
The last value of the array is 0.
The returned array will destroyed by the FontList.
You should thus not reference the array after the next method call on the
FontList.
*/
2011-05-02 12:29:34 -04:30
class SVT_DLLPUBLIC FontList
2000-09-18 16:07:07 +00:00
{
private:
static const sal_IntPtr aStdSizeAry[];
OUString maMapBoth;
OUString maMapPrinterOnly;
OUString maMapStyleNotAvailable;
mutable OUString maMapNotAvailable;
OUString maLight;
OUString maLightItalic;
OUString maNormal;
OUString maNormalItalic;
OUString maBold;
OUString maBoldItalic;
OUString maBlack;
OUString maBlackItalic;
mutable std::unique_ptr<sal_IntPtr[]>
mpSizeAry;
VclPtr<OutputDevice> mpDev;
VclPtr<OutputDevice> mpDev2;
std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const;
SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice* pDev, bool bInsertData);
2000-09-18 16:07:07 +00:00
public:
FontList( OutputDevice* pDevice,
OutputDevice* pDevice2 = nullptr);
2000-09-18 16:07:07 +00:00
~FontList();
std::unique_ptr<FontList> Clone() const;
OUString GetFontMapText( const FontMetric& rFontMetric ) const;
2000-09-18 16:07:07 +00:00
const OUString& GetNormalStr() const { return maNormal; }
const OUString& GetItalicStr() const { return maNormalItalic; }
const OUString& GetBoldStr() const { return maBold; }
const OUString& GetBoldItalicStr() const { return maBoldItalic; }
const OUString& GetStyleName( FontWeight eWeight, FontItalic eItalic ) const;
OUString GetStyleName( const FontMetric& rFontMetric ) const;
2000-09-18 16:07:07 +00:00
FontMetric Get( const OUString& rName,
const OUString& rStyleName ) const;
FontMetric Get( const OUString& rName,
2000-09-18 16:07:07 +00:00
FontWeight eWeight,
FontItalic eItalic ) const;
bool IsAvailable( const OUString& rName ) const;
size_t GetFontNameCount() const
{
return m_Entries.size();
}
const FontMetric& GetFontName(size_t nFont) const;
sal_Handle GetFirstFontMetric( const OUString& rName ) const;
static sal_Handle GetNextFontMetric( sal_Handle hFontMetric );
static const FontMetric& GetFontMetric( sal_Handle hFontMetric );
2000-09-18 16:07:07 +00:00
const sal_IntPtr* GetSizeAry( const FontMetric& rFontMetric ) const;
static const sal_IntPtr* GetStdSizeAry() { return aStdSizeAry; }
2000-09-18 16:07:07 +00:00
private:
FontList( const FontList& ) = delete;
FontList& operator =( const FontList& ) = delete;
2000-09-18 16:07:07 +00:00
};
class SVT_DLLPUBLIC FontSizeNames
2000-12-07 15:07:37 +00:00
{
private:
2011-03-01 16:08:28 +01:00
const struct ImplFSNameItem* mpArray;
sal_uLong mnElem;
2000-12-07 15:07:37 +00:00
public:
FontSizeNames( LanguageType eLanguage /* = LANGUAGE_DONTKNOW */ );
sal_uLong Count() const { return mnElem; }
bool IsEmpty() const { return !mnElem; }
long Name2Size( const OUString& ) const;
OUString Size2Name( long ) const;
2000-12-07 15:07:37 +00:00
OUString GetIndexName( sal_uLong nIndex ) const;
long GetIndexSize( sal_uLong nIndex ) const;
2000-12-07 15:07:37 +00:00
};
#endif // INCLUDED_SVTOOLS_CTRLTOOL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */