Files
libreoffice/svx/source/dialog/fntctrl.cxx

1477 lines
46 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 Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 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 Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +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
#include <sfx2/dialoghelper.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/printer.hxx>
#include <vcl/builderfactory.hxx>
2000-09-18 16:07:07 +00:00
#include <vcl/metric.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
CWS-TOOLING: integrate CWS graphite01 2009-08-06 11:09:01 +0200 hdu r274708 : #i10000# fix build breaker for SYSTEM_GRAPHITE=NO 2009-07-21 12:01:52 +0200 hdu r274174 : #i93645# fix include files for EXT_USE_STLPORT 2009-07-21 11:51:07 +0200 hdu r274173 : #i93645# convert line-endings of files to be patched 2009-07-21 10:49:01 +0200 hdu r274170 : #i93645# adjust makefile.vc8 for HH-RelEng env (thanks ause) 2009-07-20 05:21:32 +0200 kstribley r274105 : attempt to fix Windows build error caused by NULL variable in nmake file 2009-07-16 10:22:36 +0200 hdu r274032 : #i69129# also use solar minor version to find graphite lib 2009-07-16 05:36:06 +0200 kstribley r274029 : allow windows build to have Graphite disabled with SAL_DISABLE_GRAPHITE 2009-07-15 13:59:22 +0200 hdu r274011 : #i69129# default to ENABLE_GRAPHITE=TRUE 2009-07-15 13:19:54 +0200 hdu r274008 : #i93645# ignore compile warnings for graphite 2009-07-15 13:18:25 +0200 hdu r274006 : #i93645# stlport needs libmath, use solar minor version to find matching libs 2009-07-15 09:21:13 +0200 hdu r273989 : #i100000# avoid compile warning 2009-07-14 12:19:08 +0200 hdu r273963 : CWS-TOOLING: rebase CWS graphite01 to trunk@273858 (milestone: DEV300:m52) 2009-07-13 06:54:56 +0200 kstribley r273912 : change to use standard file headers 2009-07-13 05:39:14 +0200 kstribley r273911 : Remove unnecessary change to configure.in as reported by Rene 2009-07-10 16:58:44 +0200 hdu r273902 : #i100000# fix compile for precompiled-header support 2009-07-02 13:48:26 +0200 kstribley r273647 : #69129# fix a graphite bug which could crash with fonts containing obscure GDL positioning rules 2009-07-02 01:44:02 +0200 rene r273616 : #i10000# we need to link with -licuuc 2009-07-01 04:02:20 +0200 kstribley r273540 : restore missing sdf files from base 2009-07-01 04:01:40 +0200 kstribley r273539 : restore missing sdf files from base 2009-07-01 04:01:12 +0200 kstribley r273538 : restore missing sdf files from base 2009-07-01 03:59:41 +0200 kstribley r273537 : restore missing sdf files from base 2009-06-29 10:16:51 +0200 kstribley r273456 : #i69129# fixes a bug which caused occasional incorrect linebreaking when graphite is asked to render a part of a cluster not containing a base 2009-06-27 10:43:58 +0200 kstribley r273445 : #i69129# added kashida support for justified RTL text 2009-06-01 12:57:06 +0200 kstribley r272476 : CWS-TOOLING: rebase CWS graphite01 to trunk@272291 (milestone: DEV300:m49) 2009-05-26 10:50:06 +0200 kstribley r272286 : #i69129# fixes a build error when NDEBUG is not defined 2009-05-25 13:14:06 +0200 kstribley r272237 : #i69129# enable debugging by fixing compile warnings 2009-05-25 13:07:47 +0200 kstribley r272234 : #i69129# added env variable to disable GRAPHITE at run time on linux and fixed a bug with a rare attachment sequence 2009-04-20 17:39:25 +0200 kstribley r271001 : CWS-TOOLING: rebase CWS graphite01 to trunk@270723 (milestone: DEV300:m46) 2009-04-18 07:11:33 +0200 kstribley r270957 : #i101178# attempt to fix buildbot builds by reordering configure.in 2009-04-14 17:37:07 +0200 kstribley r270801 : #i93645# tweak configure to enable graphite by default on windows and linux to assist testing with tinderbox build 2009-04-14 16:33:17 +0200 kstribley r270796 : #i96925# another fix for rtl fallback and add optional debug info in MultiSalLayout 2009-04-08 13:27:55 +0200 kstribley r270641 : #i69129# fix features after a bad merge 2009-04-08 13:26:34 +0200 kstribley r270640 : #i69129# add a patch for WinFont 2009-03-24 12:37:54 +0100 kstribley r269937 : #i69129# fix build error due to locale being included in method for features 2009-03-24 12:36:10 +0100 kstribley r269936 : #i93645# change patch variable and fix configure 2009-03-20 04:18:56 +0100 kstribley r269776 : CWS-TOOLING: rebase CWS graphite01 to trunk@269297 (milestone: DEV300:m43) 2009-03-01 13:10:59 +0100 kstribley r268622 : added a patch to improve handling of a font with bad graphite language feature tables #i93645# 2009-02-12 04:50:51 +0100 kstribley r267631 : #i93645# fix windows build for graphite 2.3.1 and remove unnecessary patch 2009-02-10 04:48:50 +0100 kstribley r267535 : #i93645# fix a build error with stlport on Ubuntu 8.10 x86 2009-02-10 03:51:10 +0100 kstribley r267534 : #i69129# remove legacy config_office 2009-02-07 19:12:54 +0100 kstribley r267482 : #i93645# upgrade to using silgraphite-2.3.1 2009-02-02 18:17:57 +0100 kstribley r267290 : #i69129# backout unwanted checkin 2009-02-02 17:44:03 +0100 kstribley r267281 : #i69129# backout erroneous update to aclocal.m4 2009-02-01 10:05:03 +0100 kstribley r267236 : #i69129# fix build error due to locale being added to set font attributes 2009-02-01 06:02:52 +0100 kstribley r267235 : #i69129# fix erroneous merge 2009-01-31 16:24:56 +0100 kstribley r267234 : #i69129# update configure.in solenv.in in their new locations with enable graphite 2009-01-31 10:53:18 +0100 kstribley r267232 : CWS-TOOLING: rebase CWS graphite01 to trunk@267171 (milestone: DEV300:m41) 2008-12-17 04:17:33 +0100 kstribley r265577 : #i93645# remove superfluous autoreconf check and autoconf patch 2008-12-16 10:07:20 +0100 rene r265529 : fix aclocal.m4 breakage 2008-12-16 05:13:29 +0100 kstribley r265520 : #i93645# change to autoconf && configure 2008-12-16 04:39:48 +0100 kstribley r265519 : #i93645# modified LD_FLAGS so that system graphite isn't pulled in by accident and fixed autoconf problem 2008-12-15 14:16:25 +0100 rene r265497 : check for working STL 2008-12-15 12:53:39 +0100 rene r265473 : revert broken check 2008-12-15 11:59:21 +0100 kstribley r265472 : #i93645# added check for system STL, since this is a requirement for system graphite to work correctly and moved the position of the check further down 2008-12-15 11:55:34 +0100 kstribley r265471 : #i93645# remove references to gr3ooo to allow system graphite to be used 2008-12-12 18:48:18 +0100 rene r265437 : fix link for system-graphite 2008-12-12 18:46:45 +0100 rene r265436 : the tarball is in graphite, remove obsolete check 2008-12-12 18:22:22 +0100 rene r265433 : typo; re-autoconf 2008-12-12 17:35:26 +0100 rene r265432 : actually implement SYSTEM_GRAPHIT checks (as already checked for in makefile.mks) but remove the checks in graphit itself and move to BUILD_TYPE 2008-12-12 08:08:33 +0100 kstribley r265387 : #i69129# 2 of the patched files need windows line endings so patch works on linux as well as windows 2008-12-12 08:04:41 +0100 kstribley r265386 : #i69129# rtl fallback fix which prevents caching of segments with fallback 2008-12-08 04:28:12 +0100 kstribley r264969 : results of running autoconf with graphite config changes #i69129# 2008-12-05 08:12:47 +0100 kstribley r264886 : backout unintential change at r264884 2008-12-05 06:26:33 +0100 kstribley r264884 : #i96925# fixes for uniscribe fallback 2008-12-05 06:11:37 +0100 kstribley r264883 : #i69129# improvements to windows graphite code, including caching of sila table lookup 2008-12-02 13:28:51 +0100 kstribley r264694 : #i93645# add graphite library and append to patch 2008-11-27 06:47:10 +0100 kstribley r264445 : #69129# fix rtl loop bug and rtl caching problem 2008-11-27 06:42:20 +0100 kstribley r264444 : add caching for GraphiteFontAdaptor 2008-11-14 15:57:03 +0100 kstribley r263681 : #69129# add graphite addtional files from cvs 2008-11-14 15:54:47 +0100 kstribley r263680 : #69129# fix for modified resolution api 2008-11-13 16:24:09 +0100 kstribley r263652 : #69129# add skeleton to build graphite module library 2008-11-13 16:22:19 +0100 kstribley r263651 : #69129# add skeleton to build graphite module library 2008-11-13 16:16:10 +0100 kstribley r263650 : #69129# migrate from cvs 2008-11-13 15:26:54 +0100 kstribley r263646 : #69129# add a module for the graphite library
2009-08-17 14:12:14 +00:00
#include <unicode/uchar.h>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <vector>
#include <deque>
#include <svtools/colorcfg.hxx>
#include <svtools/sampletext.hxx>
#include <svx/fntctrl.hxx>
#include <svx/dialogs.hrc>
#include <svx/sdasitm.hxx>
2000-09-18 16:07:07 +00:00
// Item set includes
#include <svl/itemset.hxx>
#include <svl/itempool.hxx>
#include <svl/stritem.hxx>
#include <svl/languageoptions.hxx>
#include <editeng/colritem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/editids.hrc>
#include <editeng/postitem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crossedoutitem.hxx>
#include <editeng/contouritem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/shdditem.hxx>
#include <editeng/escapementitem.hxx>
#include <editeng/wrlmitem.hxx>
#include <editeng/cmapitem.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/emphasismarkitem.hxx>
#include <editeng/charreliefitem.hxx>
#include <editeng/twolinesitem.hxx>
#include <editeng/charscaleitem.hxx>
#include <editeng/langitem.hxx>
//TODO: remove this and calculate off the actual size of text, not
//an arbitrary number of characters
#define TEXT_WIDTH 80
#define ISITEMSET rSet.GetItemState(nWhich)>=SfxItemState::DEFAULT
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using ::com::sun::star::i18n::XBreakIterator;
using ::com::sun::star::i18n::BreakIterator;
2002-08-13 07:42:53 +00:00
// small helper functions to set fonts
2002-08-13 07:42:53 +00:00
namespace
2002-08-06 07:51:00 +00:00
{
void scaleFontWidth(vcl::Font& rFont, vcl::RenderContext& rRenderContext,long& n100PercentFont)
{
rFont.SetWidth(0);
n100PercentFont = rRenderContext.GetFontMetric(rFont).GetWidth();
}
void initFont(vcl::Font& rFont)
{
rFont.SetTransparent(true);
rFont.SetAlignment(ALIGN_BASELINE);
}
void setFontSize(vcl::Font& rFont)
{
Size aSize(rFont.GetSize());
aSize.Height() = (aSize.Height() * 3) / 5;
aSize.Width() = (aSize.Width() * 3) / 5;
rFont.SetSize(aSize);
}
void calcFontHeightAnyAscent(vcl::RenderContext& rRenderContext, const vcl::Font& rFont, long& nHeight, long& nAscent)
{
if (!nHeight)
2002-08-13 07:42:53 +00:00
{
rRenderContext.SetFont(rFont);
FontMetric aMetric(rRenderContext.GetFontMetric());
nHeight = aMetric.GetLineHeight();
nAscent = aMetric.GetAscent();
2002-08-13 07:42:53 +00:00
}
}
2002-08-13 07:42:53 +00:00
void setFont(const SvxFont& rNewFont, SvxFont& rImplFont)
{
rImplFont = rNewFont;
rImplFont.SetTransparent(true);
rImplFont.SetAlignment(ALIGN_BASELINE);
2002-08-06 07:51:00 +00:00
}
} // end anonymous namespace
class FontPrevWin_Impl
2000-09-18 16:07:07 +00:00
{
friend class SvxFontPrevWindow;
SvxFont maFont;
VclPtr<Printer> mpPrinter;
bool mbDelPrinter;
Reference <XBreakIterator> mxBreak;
std::vector<sal_uIntPtr> maTextWidth;
std::deque<sal_Int32> maScriptChg;
std::vector<sal_uInt16> maScriptType;
SvxFont maCJKFont;
SvxFont maCTLFont;
OUString maText;
OUString maScriptText;
Color* mpColor;
Color* mpBackColor;
long mnAscent;
sal_Unicode mcStartBracket;
sal_Unicode mcEndBracket;
long mn100PercentFontWidth; // initial -1 -> not set yet
long mn100PercentFontWidthCJK;
long mn100PercentFontWidthCTL;
sal_uInt16 mnFontWidthScale;
bool mbSelection : 1;
bool mbGetSelection : 1;
bool mbUseResText : 1;
bool mbPreviewBackgroundToCharacter : 1;
bool mbTwoLines : 1;
bool mbUseFontNameAsText : 1;
bool mbTextInited : 1;
bool m_bCJKEnabled;
bool m_bCTLEnabled;
public:
inline FontPrevWin_Impl() :
mpPrinter(nullptr),
mbDelPrinter(false),
mpColor(nullptr),
mpBackColor(nullptr),
mnAscent(0),
mcStartBracket(0),
mcEndBracket(0),
mnFontWidthScale(100),
mbSelection(false),
mbGetSelection(false),
mbUseResText(false),
mbPreviewBackgroundToCharacter(false),
mbTwoLines(false),
mbUseFontNameAsText(false),
mbTextInited(false)
{
SvtLanguageOptions aLanguageOptions;
m_bCJKEnabled = aLanguageOptions.IsAnyEnabled();
m_bCTLEnabled = aLanguageOptions.IsCTLFontEnabled();
Invalidate100PercentFontWidth();
}
inline ~FontPrevWin_Impl()
{
delete mpColor;
delete mpBackColor;
if (mbDelPrinter)
mpPrinter.disposeAndClear();
}
void CheckScript();
Size CalcTextSize(vcl::RenderContext& rRenderContext, OutputDevice* pPrinter, const SvxFont& rFont);
void DrawPrev(vcl::RenderContext& rRenderContext, Printer* pPrinter, Point& rPt, const SvxFont& rFont);
bool SetFontWidthScale(sal_uInt16 nScaleInPercent);
inline void Invalidate100PercentFontWidth();
inline bool Is100PercentFontWidthValid() const;
void ScaleFontWidth(vcl::RenderContext& rRenderContext);
// scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
// sets the 100%-Font-Widths
2000-09-18 16:07:07 +00:00
};
inline void FontPrevWin_Impl::Invalidate100PercentFontWidth()
{
mn100PercentFontWidth = mn100PercentFontWidthCJK = mn100PercentFontWidthCTL = -1;
}
inline bool FontPrevWin_Impl::Is100PercentFontWidthValid() const
{
DBG_ASSERT( ( mn100PercentFontWidth == -1 && mn100PercentFontWidthCJK == -1 ) ||
( mn100PercentFontWidth != -1 && mn100PercentFontWidthCJK != -1 ) ||
( mn100PercentFontWidth == -1 && mn100PercentFontWidthCTL == -1 ) ||
( mn100PercentFontWidth != -1 && mn100PercentFontWidthCTL != -1 ),
"*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous" );
return mn100PercentFontWidth != -1;
}
/*
* evalutates the scripttypes of the actual string.
* Afterwards the positions of script change are notified in aScriptChg,
* the scripttypes in aScriptType.
* The aTextWidth array will be filled with zero.
*/
void FontPrevWin_Impl::CheckScript()
{
assert(!maText.isEmpty()); // must have a preview text here!
if (maText == maScriptText)
{
return; // already initialized
}
maScriptText = maText;
maScriptChg.clear();
maScriptType.clear();
maTextWidth.clear();
if (!mxBreak.is())
{
Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
mxBreak = BreakIterator::create(xContext);
}
sal_uInt16 nScript = 0;
sal_Int32 nChg = 0;
while (nChg < maText.getLength())
{
nScript = mxBreak->getScriptType(maText, nChg);
nChg = mxBreak->endOfScript(maText, nChg, nScript);
if (nChg < maText.getLength() && nChg > 0 &&
(css::i18n::ScriptType::WEAK ==
mxBreak->getScriptType(maText, nChg - 1)))
{
int8_t nType = u_charType(maText[nChg]);
if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
nType == U_COMBINING_SPACING_MARK)
CWS-TOOLING: integrate CWS graphite01 2009-08-06 11:09:01 +0200 hdu r274708 : #i10000# fix build breaker for SYSTEM_GRAPHITE=NO 2009-07-21 12:01:52 +0200 hdu r274174 : #i93645# fix include files for EXT_USE_STLPORT 2009-07-21 11:51:07 +0200 hdu r274173 : #i93645# convert line-endings of files to be patched 2009-07-21 10:49:01 +0200 hdu r274170 : #i93645# adjust makefile.vc8 for HH-RelEng env (thanks ause) 2009-07-20 05:21:32 +0200 kstribley r274105 : attempt to fix Windows build error caused by NULL variable in nmake file 2009-07-16 10:22:36 +0200 hdu r274032 : #i69129# also use solar minor version to find graphite lib 2009-07-16 05:36:06 +0200 kstribley r274029 : allow windows build to have Graphite disabled with SAL_DISABLE_GRAPHITE 2009-07-15 13:59:22 +0200 hdu r274011 : #i69129# default to ENABLE_GRAPHITE=TRUE 2009-07-15 13:19:54 +0200 hdu r274008 : #i93645# ignore compile warnings for graphite 2009-07-15 13:18:25 +0200 hdu r274006 : #i93645# stlport needs libmath, use solar minor version to find matching libs 2009-07-15 09:21:13 +0200 hdu r273989 : #i100000# avoid compile warning 2009-07-14 12:19:08 +0200 hdu r273963 : CWS-TOOLING: rebase CWS graphite01 to trunk@273858 (milestone: DEV300:m52) 2009-07-13 06:54:56 +0200 kstribley r273912 : change to use standard file headers 2009-07-13 05:39:14 +0200 kstribley r273911 : Remove unnecessary change to configure.in as reported by Rene 2009-07-10 16:58:44 +0200 hdu r273902 : #i100000# fix compile for precompiled-header support 2009-07-02 13:48:26 +0200 kstribley r273647 : #69129# fix a graphite bug which could crash with fonts containing obscure GDL positioning rules 2009-07-02 01:44:02 +0200 rene r273616 : #i10000# we need to link with -licuuc 2009-07-01 04:02:20 +0200 kstribley r273540 : restore missing sdf files from base 2009-07-01 04:01:40 +0200 kstribley r273539 : restore missing sdf files from base 2009-07-01 04:01:12 +0200 kstribley r273538 : restore missing sdf files from base 2009-07-01 03:59:41 +0200 kstribley r273537 : restore missing sdf files from base 2009-06-29 10:16:51 +0200 kstribley r273456 : #i69129# fixes a bug which caused occasional incorrect linebreaking when graphite is asked to render a part of a cluster not containing a base 2009-06-27 10:43:58 +0200 kstribley r273445 : #i69129# added kashida support for justified RTL text 2009-06-01 12:57:06 +0200 kstribley r272476 : CWS-TOOLING: rebase CWS graphite01 to trunk@272291 (milestone: DEV300:m49) 2009-05-26 10:50:06 +0200 kstribley r272286 : #i69129# fixes a build error when NDEBUG is not defined 2009-05-25 13:14:06 +0200 kstribley r272237 : #i69129# enable debugging by fixing compile warnings 2009-05-25 13:07:47 +0200 kstribley r272234 : #i69129# added env variable to disable GRAPHITE at run time on linux and fixed a bug with a rare attachment sequence 2009-04-20 17:39:25 +0200 kstribley r271001 : CWS-TOOLING: rebase CWS graphite01 to trunk@270723 (milestone: DEV300:m46) 2009-04-18 07:11:33 +0200 kstribley r270957 : #i101178# attempt to fix buildbot builds by reordering configure.in 2009-04-14 17:37:07 +0200 kstribley r270801 : #i93645# tweak configure to enable graphite by default on windows and linux to assist testing with tinderbox build 2009-04-14 16:33:17 +0200 kstribley r270796 : #i96925# another fix for rtl fallback and add optional debug info in MultiSalLayout 2009-04-08 13:27:55 +0200 kstribley r270641 : #i69129# fix features after a bad merge 2009-04-08 13:26:34 +0200 kstribley r270640 : #i69129# add a patch for WinFont 2009-03-24 12:37:54 +0100 kstribley r269937 : #i69129# fix build error due to locale being included in method for features 2009-03-24 12:36:10 +0100 kstribley r269936 : #i93645# change patch variable and fix configure 2009-03-20 04:18:56 +0100 kstribley r269776 : CWS-TOOLING: rebase CWS graphite01 to trunk@269297 (milestone: DEV300:m43) 2009-03-01 13:10:59 +0100 kstribley r268622 : added a patch to improve handling of a font with bad graphite language feature tables #i93645# 2009-02-12 04:50:51 +0100 kstribley r267631 : #i93645# fix windows build for graphite 2.3.1 and remove unnecessary patch 2009-02-10 04:48:50 +0100 kstribley r267535 : #i93645# fix a build error with stlport on Ubuntu 8.10 x86 2009-02-10 03:51:10 +0100 kstribley r267534 : #i69129# remove legacy config_office 2009-02-07 19:12:54 +0100 kstribley r267482 : #i93645# upgrade to using silgraphite-2.3.1 2009-02-02 18:17:57 +0100 kstribley r267290 : #i69129# backout unwanted checkin 2009-02-02 17:44:03 +0100 kstribley r267281 : #i69129# backout erroneous update to aclocal.m4 2009-02-01 10:05:03 +0100 kstribley r267236 : #i69129# fix build error due to locale being added to set font attributes 2009-02-01 06:02:52 +0100 kstribley r267235 : #i69129# fix erroneous merge 2009-01-31 16:24:56 +0100 kstribley r267234 : #i69129# update configure.in solenv.in in their new locations with enable graphite 2009-01-31 10:53:18 +0100 kstribley r267232 : CWS-TOOLING: rebase CWS graphite01 to trunk@267171 (milestone: DEV300:m41) 2008-12-17 04:17:33 +0100 kstribley r265577 : #i93645# remove superfluous autoreconf check and autoconf patch 2008-12-16 10:07:20 +0100 rene r265529 : fix aclocal.m4 breakage 2008-12-16 05:13:29 +0100 kstribley r265520 : #i93645# change to autoconf && configure 2008-12-16 04:39:48 +0100 kstribley r265519 : #i93645# modified LD_FLAGS so that system graphite isn't pulled in by accident and fixed autoconf problem 2008-12-15 14:16:25 +0100 rene r265497 : check for working STL 2008-12-15 12:53:39 +0100 rene r265473 : revert broken check 2008-12-15 11:59:21 +0100 kstribley r265472 : #i93645# added check for system STL, since this is a requirement for system graphite to work correctly and moved the position of the check further down 2008-12-15 11:55:34 +0100 kstribley r265471 : #i93645# remove references to gr3ooo to allow system graphite to be used 2008-12-12 18:48:18 +0100 rene r265437 : fix link for system-graphite 2008-12-12 18:46:45 +0100 rene r265436 : the tarball is in graphite, remove obsolete check 2008-12-12 18:22:22 +0100 rene r265433 : typo; re-autoconf 2008-12-12 17:35:26 +0100 rene r265432 : actually implement SYSTEM_GRAPHIT checks (as already checked for in makefile.mks) but remove the checks in graphit itself and move to BUILD_TYPE 2008-12-12 08:08:33 +0100 kstribley r265387 : #i69129# 2 of the patched files need windows line endings so patch works on linux as well as windows 2008-12-12 08:04:41 +0100 kstribley r265386 : #i69129# rtl fallback fix which prevents caching of segments with fallback 2008-12-08 04:28:12 +0100 kstribley r264969 : results of running autoconf with graphite config changes #i69129# 2008-12-05 08:12:47 +0100 kstribley r264886 : backout unintential change at r264884 2008-12-05 06:26:33 +0100 kstribley r264884 : #i96925# fixes for uniscribe fallback 2008-12-05 06:11:37 +0100 kstribley r264883 : #i69129# improvements to windows graphite code, including caching of sila table lookup 2008-12-02 13:28:51 +0100 kstribley r264694 : #i93645# add graphite library and append to patch 2008-11-27 06:47:10 +0100 kstribley r264445 : #69129# fix rtl loop bug and rtl caching problem 2008-11-27 06:42:20 +0100 kstribley r264444 : add caching for GraphiteFontAdaptor 2008-11-14 15:57:03 +0100 kstribley r263681 : #69129# add graphite addtional files from cvs 2008-11-14 15:54:47 +0100 kstribley r263680 : #69129# fix for modified resolution api 2008-11-13 16:24:09 +0100 kstribley r263652 : #69129# add skeleton to build graphite module library 2008-11-13 16:22:19 +0100 kstribley r263651 : #69129# add skeleton to build graphite module library 2008-11-13 16:16:10 +0100 kstribley r263650 : #69129# migrate from cvs 2008-11-13 15:26:54 +0100 kstribley r263646 : #69129# add a module for the graphite library
2009-08-17 14:12:14 +00:00
{
maScriptChg.push_back(nChg - 1);
CWS-TOOLING: integrate CWS graphite01 2009-08-06 11:09:01 +0200 hdu r274708 : #i10000# fix build breaker for SYSTEM_GRAPHITE=NO 2009-07-21 12:01:52 +0200 hdu r274174 : #i93645# fix include files for EXT_USE_STLPORT 2009-07-21 11:51:07 +0200 hdu r274173 : #i93645# convert line-endings of files to be patched 2009-07-21 10:49:01 +0200 hdu r274170 : #i93645# adjust makefile.vc8 for HH-RelEng env (thanks ause) 2009-07-20 05:21:32 +0200 kstribley r274105 : attempt to fix Windows build error caused by NULL variable in nmake file 2009-07-16 10:22:36 +0200 hdu r274032 : #i69129# also use solar minor version to find graphite lib 2009-07-16 05:36:06 +0200 kstribley r274029 : allow windows build to have Graphite disabled with SAL_DISABLE_GRAPHITE 2009-07-15 13:59:22 +0200 hdu r274011 : #i69129# default to ENABLE_GRAPHITE=TRUE 2009-07-15 13:19:54 +0200 hdu r274008 : #i93645# ignore compile warnings for graphite 2009-07-15 13:18:25 +0200 hdu r274006 : #i93645# stlport needs libmath, use solar minor version to find matching libs 2009-07-15 09:21:13 +0200 hdu r273989 : #i100000# avoid compile warning 2009-07-14 12:19:08 +0200 hdu r273963 : CWS-TOOLING: rebase CWS graphite01 to trunk@273858 (milestone: DEV300:m52) 2009-07-13 06:54:56 +0200 kstribley r273912 : change to use standard file headers 2009-07-13 05:39:14 +0200 kstribley r273911 : Remove unnecessary change to configure.in as reported by Rene 2009-07-10 16:58:44 +0200 hdu r273902 : #i100000# fix compile for precompiled-header support 2009-07-02 13:48:26 +0200 kstribley r273647 : #69129# fix a graphite bug which could crash with fonts containing obscure GDL positioning rules 2009-07-02 01:44:02 +0200 rene r273616 : #i10000# we need to link with -licuuc 2009-07-01 04:02:20 +0200 kstribley r273540 : restore missing sdf files from base 2009-07-01 04:01:40 +0200 kstribley r273539 : restore missing sdf files from base 2009-07-01 04:01:12 +0200 kstribley r273538 : restore missing sdf files from base 2009-07-01 03:59:41 +0200 kstribley r273537 : restore missing sdf files from base 2009-06-29 10:16:51 +0200 kstribley r273456 : #i69129# fixes a bug which caused occasional incorrect linebreaking when graphite is asked to render a part of a cluster not containing a base 2009-06-27 10:43:58 +0200 kstribley r273445 : #i69129# added kashida support for justified RTL text 2009-06-01 12:57:06 +0200 kstribley r272476 : CWS-TOOLING: rebase CWS graphite01 to trunk@272291 (milestone: DEV300:m49) 2009-05-26 10:50:06 +0200 kstribley r272286 : #i69129# fixes a build error when NDEBUG is not defined 2009-05-25 13:14:06 +0200 kstribley r272237 : #i69129# enable debugging by fixing compile warnings 2009-05-25 13:07:47 +0200 kstribley r272234 : #i69129# added env variable to disable GRAPHITE at run time on linux and fixed a bug with a rare attachment sequence 2009-04-20 17:39:25 +0200 kstribley r271001 : CWS-TOOLING: rebase CWS graphite01 to trunk@270723 (milestone: DEV300:m46) 2009-04-18 07:11:33 +0200 kstribley r270957 : #i101178# attempt to fix buildbot builds by reordering configure.in 2009-04-14 17:37:07 +0200 kstribley r270801 : #i93645# tweak configure to enable graphite by default on windows and linux to assist testing with tinderbox build 2009-04-14 16:33:17 +0200 kstribley r270796 : #i96925# another fix for rtl fallback and add optional debug info in MultiSalLayout 2009-04-08 13:27:55 +0200 kstribley r270641 : #i69129# fix features after a bad merge 2009-04-08 13:26:34 +0200 kstribley r270640 : #i69129# add a patch for WinFont 2009-03-24 12:37:54 +0100 kstribley r269937 : #i69129# fix build error due to locale being included in method for features 2009-03-24 12:36:10 +0100 kstribley r269936 : #i93645# change patch variable and fix configure 2009-03-20 04:18:56 +0100 kstribley r269776 : CWS-TOOLING: rebase CWS graphite01 to trunk@269297 (milestone: DEV300:m43) 2009-03-01 13:10:59 +0100 kstribley r268622 : added a patch to improve handling of a font with bad graphite language feature tables #i93645# 2009-02-12 04:50:51 +0100 kstribley r267631 : #i93645# fix windows build for graphite 2.3.1 and remove unnecessary patch 2009-02-10 04:48:50 +0100 kstribley r267535 : #i93645# fix a build error with stlport on Ubuntu 8.10 x86 2009-02-10 03:51:10 +0100 kstribley r267534 : #i69129# remove legacy config_office 2009-02-07 19:12:54 +0100 kstribley r267482 : #i93645# upgrade to using silgraphite-2.3.1 2009-02-02 18:17:57 +0100 kstribley r267290 : #i69129# backout unwanted checkin 2009-02-02 17:44:03 +0100 kstribley r267281 : #i69129# backout erroneous update to aclocal.m4 2009-02-01 10:05:03 +0100 kstribley r267236 : #i69129# fix build error due to locale being added to set font attributes 2009-02-01 06:02:52 +0100 kstribley r267235 : #i69129# fix erroneous merge 2009-01-31 16:24:56 +0100 kstribley r267234 : #i69129# update configure.in solenv.in in their new locations with enable graphite 2009-01-31 10:53:18 +0100 kstribley r267232 : CWS-TOOLING: rebase CWS graphite01 to trunk@267171 (milestone: DEV300:m41) 2008-12-17 04:17:33 +0100 kstribley r265577 : #i93645# remove superfluous autoreconf check and autoconf patch 2008-12-16 10:07:20 +0100 rene r265529 : fix aclocal.m4 breakage 2008-12-16 05:13:29 +0100 kstribley r265520 : #i93645# change to autoconf && configure 2008-12-16 04:39:48 +0100 kstribley r265519 : #i93645# modified LD_FLAGS so that system graphite isn't pulled in by accident and fixed autoconf problem 2008-12-15 14:16:25 +0100 rene r265497 : check for working STL 2008-12-15 12:53:39 +0100 rene r265473 : revert broken check 2008-12-15 11:59:21 +0100 kstribley r265472 : #i93645# added check for system STL, since this is a requirement for system graphite to work correctly and moved the position of the check further down 2008-12-15 11:55:34 +0100 kstribley r265471 : #i93645# remove references to gr3ooo to allow system graphite to be used 2008-12-12 18:48:18 +0100 rene r265437 : fix link for system-graphite 2008-12-12 18:46:45 +0100 rene r265436 : the tarball is in graphite, remove obsolete check 2008-12-12 18:22:22 +0100 rene r265433 : typo; re-autoconf 2008-12-12 17:35:26 +0100 rene r265432 : actually implement SYSTEM_GRAPHIT checks (as already checked for in makefile.mks) but remove the checks in graphit itself and move to BUILD_TYPE 2008-12-12 08:08:33 +0100 kstribley r265387 : #i69129# 2 of the patched files need windows line endings so patch works on linux as well as windows 2008-12-12 08:04:41 +0100 kstribley r265386 : #i69129# rtl fallback fix which prevents caching of segments with fallback 2008-12-08 04:28:12 +0100 kstribley r264969 : results of running autoconf with graphite config changes #i69129# 2008-12-05 08:12:47 +0100 kstribley r264886 : backout unintential change at r264884 2008-12-05 06:26:33 +0100 kstribley r264884 : #i96925# fixes for uniscribe fallback 2008-12-05 06:11:37 +0100 kstribley r264883 : #i69129# improvements to windows graphite code, including caching of sila table lookup 2008-12-02 13:28:51 +0100 kstribley r264694 : #i93645# add graphite library and append to patch 2008-11-27 06:47:10 +0100 kstribley r264445 : #69129# fix rtl loop bug and rtl caching problem 2008-11-27 06:42:20 +0100 kstribley r264444 : add caching for GraphiteFontAdaptor 2008-11-14 15:57:03 +0100 kstribley r263681 : #69129# add graphite addtional files from cvs 2008-11-14 15:54:47 +0100 kstribley r263680 : #69129# fix for modified resolution api 2008-11-13 16:24:09 +0100 kstribley r263652 : #69129# add skeleton to build graphite module library 2008-11-13 16:22:19 +0100 kstribley r263651 : #69129# add skeleton to build graphite module library 2008-11-13 16:16:10 +0100 kstribley r263650 : #69129# migrate from cvs 2008-11-13 15:26:54 +0100 kstribley r263646 : #69129# add a module for the graphite library
2009-08-17 14:12:14 +00:00
}
else
{
maScriptChg.push_back(nChg);
CWS-TOOLING: integrate CWS graphite01 2009-08-06 11:09:01 +0200 hdu r274708 : #i10000# fix build breaker for SYSTEM_GRAPHITE=NO 2009-07-21 12:01:52 +0200 hdu r274174 : #i93645# fix include files for EXT_USE_STLPORT 2009-07-21 11:51:07 +0200 hdu r274173 : #i93645# convert line-endings of files to be patched 2009-07-21 10:49:01 +0200 hdu r274170 : #i93645# adjust makefile.vc8 for HH-RelEng env (thanks ause) 2009-07-20 05:21:32 +0200 kstribley r274105 : attempt to fix Windows build error caused by NULL variable in nmake file 2009-07-16 10:22:36 +0200 hdu r274032 : #i69129# also use solar minor version to find graphite lib 2009-07-16 05:36:06 +0200 kstribley r274029 : allow windows build to have Graphite disabled with SAL_DISABLE_GRAPHITE 2009-07-15 13:59:22 +0200 hdu r274011 : #i69129# default to ENABLE_GRAPHITE=TRUE 2009-07-15 13:19:54 +0200 hdu r274008 : #i93645# ignore compile warnings for graphite 2009-07-15 13:18:25 +0200 hdu r274006 : #i93645# stlport needs libmath, use solar minor version to find matching libs 2009-07-15 09:21:13 +0200 hdu r273989 : #i100000# avoid compile warning 2009-07-14 12:19:08 +0200 hdu r273963 : CWS-TOOLING: rebase CWS graphite01 to trunk@273858 (milestone: DEV300:m52) 2009-07-13 06:54:56 +0200 kstribley r273912 : change to use standard file headers 2009-07-13 05:39:14 +0200 kstribley r273911 : Remove unnecessary change to configure.in as reported by Rene 2009-07-10 16:58:44 +0200 hdu r273902 : #i100000# fix compile for precompiled-header support 2009-07-02 13:48:26 +0200 kstribley r273647 : #69129# fix a graphite bug which could crash with fonts containing obscure GDL positioning rules 2009-07-02 01:44:02 +0200 rene r273616 : #i10000# we need to link with -licuuc 2009-07-01 04:02:20 +0200 kstribley r273540 : restore missing sdf files from base 2009-07-01 04:01:40 +0200 kstribley r273539 : restore missing sdf files from base 2009-07-01 04:01:12 +0200 kstribley r273538 : restore missing sdf files from base 2009-07-01 03:59:41 +0200 kstribley r273537 : restore missing sdf files from base 2009-06-29 10:16:51 +0200 kstribley r273456 : #i69129# fixes a bug which caused occasional incorrect linebreaking when graphite is asked to render a part of a cluster not containing a base 2009-06-27 10:43:58 +0200 kstribley r273445 : #i69129# added kashida support for justified RTL text 2009-06-01 12:57:06 +0200 kstribley r272476 : CWS-TOOLING: rebase CWS graphite01 to trunk@272291 (milestone: DEV300:m49) 2009-05-26 10:50:06 +0200 kstribley r272286 : #i69129# fixes a build error when NDEBUG is not defined 2009-05-25 13:14:06 +0200 kstribley r272237 : #i69129# enable debugging by fixing compile warnings 2009-05-25 13:07:47 +0200 kstribley r272234 : #i69129# added env variable to disable GRAPHITE at run time on linux and fixed a bug with a rare attachment sequence 2009-04-20 17:39:25 +0200 kstribley r271001 : CWS-TOOLING: rebase CWS graphite01 to trunk@270723 (milestone: DEV300:m46) 2009-04-18 07:11:33 +0200 kstribley r270957 : #i101178# attempt to fix buildbot builds by reordering configure.in 2009-04-14 17:37:07 +0200 kstribley r270801 : #i93645# tweak configure to enable graphite by default on windows and linux to assist testing with tinderbox build 2009-04-14 16:33:17 +0200 kstribley r270796 : #i96925# another fix for rtl fallback and add optional debug info in MultiSalLayout 2009-04-08 13:27:55 +0200 kstribley r270641 : #i69129# fix features after a bad merge 2009-04-08 13:26:34 +0200 kstribley r270640 : #i69129# add a patch for WinFont 2009-03-24 12:37:54 +0100 kstribley r269937 : #i69129# fix build error due to locale being included in method for features 2009-03-24 12:36:10 +0100 kstribley r269936 : #i93645# change patch variable and fix configure 2009-03-20 04:18:56 +0100 kstribley r269776 : CWS-TOOLING: rebase CWS graphite01 to trunk@269297 (milestone: DEV300:m43) 2009-03-01 13:10:59 +0100 kstribley r268622 : added a patch to improve handling of a font with bad graphite language feature tables #i93645# 2009-02-12 04:50:51 +0100 kstribley r267631 : #i93645# fix windows build for graphite 2.3.1 and remove unnecessary patch 2009-02-10 04:48:50 +0100 kstribley r267535 : #i93645# fix a build error with stlport on Ubuntu 8.10 x86 2009-02-10 03:51:10 +0100 kstribley r267534 : #i69129# remove legacy config_office 2009-02-07 19:12:54 +0100 kstribley r267482 : #i93645# upgrade to using silgraphite-2.3.1 2009-02-02 18:17:57 +0100 kstribley r267290 : #i69129# backout unwanted checkin 2009-02-02 17:44:03 +0100 kstribley r267281 : #i69129# backout erroneous update to aclocal.m4 2009-02-01 10:05:03 +0100 kstribley r267236 : #i69129# fix build error due to locale being added to set font attributes 2009-02-01 06:02:52 +0100 kstribley r267235 : #i69129# fix erroneous merge 2009-01-31 16:24:56 +0100 kstribley r267234 : #i69129# update configure.in solenv.in in their new locations with enable graphite 2009-01-31 10:53:18 +0100 kstribley r267232 : CWS-TOOLING: rebase CWS graphite01 to trunk@267171 (milestone: DEV300:m41) 2008-12-17 04:17:33 +0100 kstribley r265577 : #i93645# remove superfluous autoreconf check and autoconf patch 2008-12-16 10:07:20 +0100 rene r265529 : fix aclocal.m4 breakage 2008-12-16 05:13:29 +0100 kstribley r265520 : #i93645# change to autoconf && configure 2008-12-16 04:39:48 +0100 kstribley r265519 : #i93645# modified LD_FLAGS so that system graphite isn't pulled in by accident and fixed autoconf problem 2008-12-15 14:16:25 +0100 rene r265497 : check for working STL 2008-12-15 12:53:39 +0100 rene r265473 : revert broken check 2008-12-15 11:59:21 +0100 kstribley r265472 : #i93645# added check for system STL, since this is a requirement for system graphite to work correctly and moved the position of the check further down 2008-12-15 11:55:34 +0100 kstribley r265471 : #i93645# remove references to gr3ooo to allow system graphite to be used 2008-12-12 18:48:18 +0100 rene r265437 : fix link for system-graphite 2008-12-12 18:46:45 +0100 rene r265436 : the tarball is in graphite, remove obsolete check 2008-12-12 18:22:22 +0100 rene r265433 : typo; re-autoconf 2008-12-12 17:35:26 +0100 rene r265432 : actually implement SYSTEM_GRAPHIT checks (as already checked for in makefile.mks) but remove the checks in graphit itself and move to BUILD_TYPE 2008-12-12 08:08:33 +0100 kstribley r265387 : #i69129# 2 of the patched files need windows line endings so patch works on linux as well as windows 2008-12-12 08:04:41 +0100 kstribley r265386 : #i69129# rtl fallback fix which prevents caching of segments with fallback 2008-12-08 04:28:12 +0100 kstribley r264969 : results of running autoconf with graphite config changes #i69129# 2008-12-05 08:12:47 +0100 kstribley r264886 : backout unintential change at r264884 2008-12-05 06:26:33 +0100 kstribley r264884 : #i96925# fixes for uniscribe fallback 2008-12-05 06:11:37 +0100 kstribley r264883 : #i69129# improvements to windows graphite code, including caching of sila table lookup 2008-12-02 13:28:51 +0100 kstribley r264694 : #i93645# add graphite library and append to patch 2008-11-27 06:47:10 +0100 kstribley r264445 : #69129# fix rtl loop bug and rtl caching problem 2008-11-27 06:42:20 +0100 kstribley r264444 : add caching for GraphiteFontAdaptor 2008-11-14 15:57:03 +0100 kstribley r263681 : #69129# add graphite addtional files from cvs 2008-11-14 15:54:47 +0100 kstribley r263680 : #69129# fix for modified resolution api 2008-11-13 16:24:09 +0100 kstribley r263652 : #69129# add skeleton to build graphite module library 2008-11-13 16:22:19 +0100 kstribley r263651 : #69129# add skeleton to build graphite module library 2008-11-13 16:16:10 +0100 kstribley r263650 : #69129# migrate from cvs 2008-11-13 15:26:54 +0100 kstribley r263646 : #69129# add a module for the graphite library
2009-08-17 14:12:14 +00:00
}
}
else
{
maScriptChg.push_back(nChg);
}
maScriptType.push_back(nScript);
maTextWidth.push_back(0);
}
}
/*
* Size FontPrevWin_Impl::CalcTextSize(..)
* fills the aTextWidth array with the text width of every part
* of the actual string without a script change inside.
* For Latin parts the given rFont will be used,
* for Asian parts the aCJKFont.
* The returned size contains the whole string.
* The member nAscent is calculated to the maximal ascent of all used fonts.
*/
Size FontPrevWin_Impl::CalcTextSize(vcl::RenderContext& rRenderContext, OutputDevice* _pPrinter, const SvxFont& rInFont)
{
sal_uInt16 nScript;
sal_uInt16 nIdx = 0;
sal_Int32 nStart = 0;
sal_Int32 nEnd;
size_t nCnt = maScriptChg.size();
if (nCnt)
{
nEnd = maScriptChg[nIdx];
nScript = maScriptType[nIdx];
}
else
{
nEnd = maText.getLength();
nScript = css::i18n::ScriptType::LATIN;
}
long nTxtWidth = 0;
long nCJKHeight = 0;
2002-08-13 07:42:53 +00:00
long nCTLHeight = 0;
long nHeight = 0;
mnAscent = 0;
long nCJKAscent = 0;
2002-08-13 07:42:53 +00:00
long nCTLAscent = 0;
do
{
const SvxFont& rFont = (nScript == css::i18n::ScriptType::ASIAN) ?
maCJKFont :
((nScript == css::i18n::ScriptType::COMPLEX) ?
maCTLFont :
rInFont);
sal_uIntPtr nWidth = rFont.GetTextSize(_pPrinter, maText, nStart, nEnd - nStart).Width();
if (nIdx >= maTextWidth.size())
break;
maTextWidth[nIdx++] = nWidth;
nTxtWidth += nWidth;
switch (nScript)
{
case css::i18n::ScriptType::ASIAN:
calcFontHeightAnyAscent(rRenderContext, maCJKFont, nCJKHeight, nCJKAscent);
2002-08-13 07:42:53 +00:00
break;
case css::i18n::ScriptType::COMPLEX:
calcFontHeightAnyAscent(rRenderContext, maCTLFont, nCTLHeight, nCTLAscent);
2002-08-13 07:42:53 +00:00
break;
default:
calcFontHeightAnyAscent(rRenderContext, rFont, nHeight, mnAscent);
}
2002-08-13 07:42:53 +00:00
if (nEnd < maText.getLength() && nIdx < nCnt)
{
nStart = nEnd;
nEnd = maScriptChg[nIdx];
nScript = maScriptType[nIdx];
}
else
break;
}
while(true);
nHeight -= mnAscent;
nCJKHeight -= nCJKAscent;
2002-08-13 07:42:53 +00:00
nCTLHeight -= nCTLAscent;
if (nHeight < nCJKHeight)
nHeight = nCJKHeight;
if (mnAscent < nCJKAscent)
mnAscent = nCJKAscent;
if (nHeight < nCTLHeight)
2002-08-13 07:42:53 +00:00
nHeight = nCTLHeight;
if (mnAscent < nCTLAscent)
mnAscent = nCTLAscent;
nHeight += mnAscent;
Size aTxtSize(nTxtWidth, nHeight);
return aTxtSize;
}
/*
* void FontPrevWin_Impl::DrawPrev(..)
* calls SvxFont::DrawPrev(..) for every part of the string without a script
* change inside, for Asian parts the aCJKFont will be used, otherwise the
* given rFont.
*/
void FontPrevWin_Impl::DrawPrev(vcl::RenderContext& rRenderContext, Printer* _pPrinter, Point &rPt, const SvxFont& rInFont)
{
vcl::Font aOldFont = _pPrinter->GetFont();
sal_uInt16 nScript;
sal_uInt16 nIdx = 0;
sal_Int32 nStart = 0;
sal_Int32 nEnd;
size_t nCnt = maScriptChg.size();
if (nCnt)
{
nEnd = maScriptChg[nIdx];
nScript = maScriptType[nIdx];
}
else
{
nEnd = maText.getLength();
nScript = css::i18n::ScriptType::LATIN;
}
do
{
const SvxFont& rFont = (nScript == css::i18n::ScriptType::ASIAN)
? maCJKFont
: ((nScript == css::i18n::ScriptType::COMPLEX)
? maCTLFont
: rInFont);
_pPrinter->SetFont(rFont);
rFont.DrawPrev(&rRenderContext, _pPrinter, rPt, maText, nStart, nEnd - nStart);
rPt.X() += maTextWidth[nIdx++];
if (nEnd < maText.getLength() && nIdx < nCnt)
{
nStart = nEnd;
nEnd = maScriptChg[nIdx];
nScript = maScriptType[nIdx];
}
else
break;
}
while(true);
_pPrinter->SetFont(aOldFont);
}
bool FontPrevWin_Impl::SetFontWidthScale(sal_uInt16 nScale)
{
if (mnFontWidthScale != nScale)
{
mnFontWidthScale = nScale;
return true;
}
return false;
}
void FontPrevWin_Impl::ScaleFontWidth(vcl::RenderContext& rOutDev)
{
if (!Is100PercentFontWidthValid())
{
scaleFontWidth(maFont, rOutDev, mn100PercentFontWidth);
scaleFontWidth(maCJKFont, rOutDev, mn100PercentFontWidthCJK);
scaleFontWidth(maCTLFont, rOutDev, mn100PercentFontWidthCTL);
}
maFont.SetWidth(mn100PercentFontWidth * mnFontWidthScale / 100);
maCJKFont.SetWidth(mn100PercentFontWidthCJK * mnFontWidthScale / 100);
maCTLFont.SetWidth(mn100PercentFontWidthCTL * mnFontWidthScale / 100);
}
void SvxFontPrevWindow::ResetSettings(bool bForeground, bool bBackground)
{
mbResetForeground = bForeground;
mbResetBackground = bBackground;
Invalidate();
}
void SvxFontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext)
2000-09-18 16:07:07 +00:00
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
if (mbResetForeground)
2000-09-18 16:07:07 +00:00
{
svtools::ColorConfig aColorConfig;
Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
2000-09-18 16:07:07 +00:00
if (IsControlForeground())
2000-09-18 16:07:07 +00:00
aTextColor = GetControlForeground();
rRenderContext.SetTextColor(aTextColor);
mbResetForeground = false;
2000-09-18 16:07:07 +00:00
}
if (mbResetBackground)
2000-09-18 16:07:07 +00:00
{
if (IsControlBackground())
rRenderContext.SetBackground(GetControlBackground());
2000-09-18 16:07:07 +00:00
else
rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
mbResetBackground = false;
2000-09-18 16:07:07 +00:00
}
}
void SvxFontPrevWindow::Init()
2000-09-18 16:07:07 +00:00
{
pImpl.reset(new FontPrevWin_Impl);
2000-09-18 16:07:07 +00:00
SfxViewShell* pSh = SfxViewShell::Current();
if (pSh)
pImpl->mpPrinter = pSh->GetPrinter();
2000-09-18 16:07:07 +00:00
if (!pImpl->mpPrinter)
2000-09-18 16:07:07 +00:00
{
pImpl->mpPrinter = VclPtr<Printer>::Create();
pImpl->mbDelPrinter = true;
2000-09-18 16:07:07 +00:00
}
SetMapMode(MapMode(MAP_TWIP));
initFont(pImpl->maFont);
initFont(pImpl->maCJKFont);
initFont(pImpl->maCTLFont);
ResetSettings(true, true);
SetBorderStyle(WindowBorderStyle::MONO);
2000-09-18 16:07:07 +00:00
}
SvxFontPrevWindow::SvxFontPrevWindow(vcl::Window* pParent, const ResId& rId)
: Window(pParent, rId)
, mbResetForeground(true)
, mbResetBackground(true)
{
Init();
}
2000-09-18 16:07:07 +00:00
SvxFontPrevWindow::SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle)
: Window(pParent, nStyle)
, mbResetForeground(true)
, mbResetBackground(true)
{
Init();
}
VCL_BUILDER_DECL_FACTORY(SvxFontPrevWindow)
{
WinBits nWinStyle = 0;
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
rRet = VclPtr<SvxFontPrevWindow>::Create(pParent, nWinStyle);
}
2000-09-18 16:07:07 +00:00
SvxFontPrevWindow::~SvxFontPrevWindow()
{
disposeOnce();
}
void SvxFontPrevWindow::dispose()
2000-09-18 16:07:07 +00:00
{
pImpl.reset();
vcl::Window::dispose();
2000-09-18 16:07:07 +00:00
}
2002-08-13 07:42:53 +00:00
SvxFont& SvxFontPrevWindow::GetCTLFont()
{
return pImpl->maCTLFont;
2002-08-13 07:42:53 +00:00
}
SvxFont& SvxFontPrevWindow::GetCJKFont()
{
return pImpl->maCJKFont;
}
2000-09-18 16:07:07 +00:00
void SvxFontPrevWindow::StateChanged( StateChangedType nType )
{
if (nType == StateChangedType::ControlForeground)
ResetSettings(true, false);
else if (nType == StateChangedType::ControlBackground)
ResetSettings(false, true);
2000-09-18 16:07:07 +00:00
Window::StateChanged(nType);
Invalidate();
2000-09-18 16:07:07 +00:00
}
void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
{
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
ResetSettings(true, true);
2000-09-18 16:07:07 +00:00
else
Window::DataChanged( rDCEvt );
}
SvxFont& SvxFontPrevWindow::GetFont()
{
pImpl->Invalidate100PercentFontWidth(); // because the user might change the size
return pImpl->maFont;
}
const SvxFont& SvxFontPrevWindow::GetFont() const
{
return pImpl->maFont;
}
void SvxFontPrevWindow::SetPreviewText( const OUString& rString )
{
pImpl->maText = rString;
pImpl->mbTextInited = true;
}
void SvxFontPrevWindow::SetFontNameAsPreviewText()
{
pImpl->mbUseFontNameAsText = true;
}
2002-08-13 07:42:53 +00:00
void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
2002-08-06 07:51:00 +00:00
{
setFont(rNormalOutFont, pImpl->maFont);
setFont(rCJKOutFont, pImpl->maCJKFont);
setFont(rCTLFont, pImpl->maCTLFont);
2002-08-06 07:51:00 +00:00
pImpl->Invalidate100PercentFontWidth();
Invalidate();
}
2000-09-18 16:07:07 +00:00
void SvxFontPrevWindow::SetColor(const Color &rColor)
{
delete pImpl->mpColor;
pImpl->mpColor = new Color(rColor);
2000-09-18 16:07:07 +00:00
Invalidate();
}
CWS-TOOLING: integrate CWS os132 2009-07-21 15:24:18 +0200 os r274201 : #i103696# SwXTextPortion/SwXParagraph excluded 2009-07-15 13:19:17 +0200 os r274007 : #i103564# typo 2009-07-15 13:09:30 +0200 os r274005 : #i103564# SwFrames::hasElements 2009-07-15 13:02:16 +0200 os r274003 : #i103564# SwXBookmark::getPropertySetInfo fixed 2009-06-26 10:11:00 +0200 os r273395 : CWS-TOOLING: rebase CWS os132 to trunk@272827 (milestone: DEV300:m50) 2009-06-23 08:52:24 +0200 os r273256 : #i102764# patch: attribute ListBoxes correctly handled in ::Reset() 2009-06-23 08:51:31 +0200 os r273255 : #i102764# ResetColor() added to remove background color 2009-06-22 14:57:38 +0200 os r273233 : #i102619# prevent access to already destroyed shell 2009-06-18 13:26:51 +0200 os r273112 : #i99508# ::insertTextContent: re-route to ::attach() 2009-06-18 10:59:53 +0200 os r273107 : #i85405# patch to enable 'Print grid' CheckBox correctly 2009-06-18 10:54:02 +0200 os r273106 : #i85133# dispose connection in GetColumnFmt to prevent connection locking 2009-06-18 10:24:31 +0200 os r273104 : #99535# ExportGraphic changed 2009-06-18 10:24:03 +0200 os r273103 : #99535# ExportGraphic changed 2009-06-18 10:23:11 +0200 os r273102 : #i102841# redlining mode switches to insert mode (cmc) 2009-06-17 14:05:42 +0200 os r273070 : #i102111# do not save already saved HTML documents before switching to source veiw 2009-06-17 13:18:20 +0200 os r273063 : #i101825# set rembered start position at the real start not at the initial start 2009-06-17 08:24:10 +0200 os r273048 : #99535# no dierect access to the file picker interface 2009-06-16 15:00:12 +0200 os r273020 : #i99937# notification of user options changes re-introduced 2009-06-15 14:36:03 +0200 os r272987 : #i98032# unreplaced text in protected areas must not be attributed either 2009-06-15 14:20:26 +0200 os r272985 : #i98032# replace list has to be initialised 2009-06-04 13:29:02 +0200 os r272624 : #i97810# set focus into column page 2009-06-04 11:01:14 +0200 os r272617 : #i98164# dialog resize to ease localisation 2009-06-04 10:59:44 +0200 os r272616 : #i98164# dialog resize to ease localisation 2009-05-28 16:05:03 +0200 os r272413 : #i98172# ConvertFieldsToText: take care of tabs with attributes 2009-05-28 11:12:45 +0200 os r272385 : #i59361# dialog controls resized 2009-05-28 11:03:14 +0200 os r272383 : #i59174# dialog controls moved
2009-08-06 12:44:16 +00:00
void SvxFontPrevWindow::ResetColor()
{
delete pImpl->mpColor;
pImpl->mpColor = nullptr;
CWS-TOOLING: integrate CWS os132 2009-07-21 15:24:18 +0200 os r274201 : #i103696# SwXTextPortion/SwXParagraph excluded 2009-07-15 13:19:17 +0200 os r274007 : #i103564# typo 2009-07-15 13:09:30 +0200 os r274005 : #i103564# SwFrames::hasElements 2009-07-15 13:02:16 +0200 os r274003 : #i103564# SwXBookmark::getPropertySetInfo fixed 2009-06-26 10:11:00 +0200 os r273395 : CWS-TOOLING: rebase CWS os132 to trunk@272827 (milestone: DEV300:m50) 2009-06-23 08:52:24 +0200 os r273256 : #i102764# patch: attribute ListBoxes correctly handled in ::Reset() 2009-06-23 08:51:31 +0200 os r273255 : #i102764# ResetColor() added to remove background color 2009-06-22 14:57:38 +0200 os r273233 : #i102619# prevent access to already destroyed shell 2009-06-18 13:26:51 +0200 os r273112 : #i99508# ::insertTextContent: re-route to ::attach() 2009-06-18 10:59:53 +0200 os r273107 : #i85405# patch to enable 'Print grid' CheckBox correctly 2009-06-18 10:54:02 +0200 os r273106 : #i85133# dispose connection in GetColumnFmt to prevent connection locking 2009-06-18 10:24:31 +0200 os r273104 : #99535# ExportGraphic changed 2009-06-18 10:24:03 +0200 os r273103 : #99535# ExportGraphic changed 2009-06-18 10:23:11 +0200 os r273102 : #i102841# redlining mode switches to insert mode (cmc) 2009-06-17 14:05:42 +0200 os r273070 : #i102111# do not save already saved HTML documents before switching to source veiw 2009-06-17 13:18:20 +0200 os r273063 : #i101825# set rembered start position at the real start not at the initial start 2009-06-17 08:24:10 +0200 os r273048 : #99535# no dierect access to the file picker interface 2009-06-16 15:00:12 +0200 os r273020 : #i99937# notification of user options changes re-introduced 2009-06-15 14:36:03 +0200 os r272987 : #i98032# unreplaced text in protected areas must not be attributed either 2009-06-15 14:20:26 +0200 os r272985 : #i98032# replace list has to be initialised 2009-06-04 13:29:02 +0200 os r272624 : #i97810# set focus into column page 2009-06-04 11:01:14 +0200 os r272617 : #i98164# dialog resize to ease localisation 2009-06-04 10:59:44 +0200 os r272616 : #i98164# dialog resize to ease localisation 2009-05-28 16:05:03 +0200 os r272413 : #i98172# ConvertFieldsToText: take care of tabs with attributes 2009-05-28 11:12:45 +0200 os r272385 : #i59361# dialog controls resized 2009-05-28 11:03:14 +0200 os r272383 : #i59174# dialog controls moved
2009-08-06 12:44:16 +00:00
Invalidate();
}
2000-09-18 16:07:07 +00:00
void SvxFontPrevWindow::SetBackColor(const Color &rColor)
{
delete pImpl->mpBackColor;
pImpl->mpBackColor = new Color(rColor);
Invalidate();
}
void SvxFontPrevWindow::UseResourceText(bool bUse)
2000-09-18 16:07:07 +00:00
{
pImpl->mbUseResText = bUse;
2000-09-18 16:07:07 +00:00
}
void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
2000-09-18 16:07:07 +00:00
{
ApplySettings(rRenderContext);
Printer* pPrinter = pImpl->mpPrinter;
const SvxFont& rFont = pImpl->maFont;
const SvxFont& rCJKFont = pImpl->maCJKFont;
const SvxFont& rCTLFont = pImpl->maCTLFont;
if (!IsEnabled())
2000-09-18 16:07:07 +00:00
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size aLogSize(rRenderContext.GetOutputSize());
2000-09-18 16:07:07 +00:00
Rectangle aRect(Point(0, 0), aLogSize);
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(rStyleSettings.GetWindowColor());
rRenderContext.DrawRect(aRect);
}
else
{
if (pImpl->mbUseResText)
pImpl->maText = GetText();
else if (!pImpl->mbSelection && !pImpl->mbTextInited)
2000-09-18 16:07:07 +00:00
{
using namespace css::i18n::ScriptType;
SfxViewShell* pSh = SfxViewShell::Current();
if (pSh && !pImpl->mbGetSelection && !pImpl->mbUseFontNameAsText)
{
pImpl->maText = pSh->GetSelectionText();
pImpl->mbGetSelection = true;
pImpl->mbSelection = !pImpl->maText.isEmpty();
}
2000-09-18 16:07:07 +00:00
if (!pImpl->mbSelection || pImpl->mbUseFontNameAsText)
{
//If we're showing multiple sample texts, then they're all
//sample texts. If only showing Latin, continue to use
//the fontname as the preview
if ((pImpl->m_bCJKEnabled) || (pImpl->m_bCTLEnabled))
pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
else
pImpl->maText = rFont.GetFamilyName();
if (pImpl->m_bCJKEnabled)
2011-10-16 14:35:24 +01:00
{
if (!pImpl->maText.isEmpty())
pImpl->maText += " ";
pImpl->maText += makeRepresentativeTextForFont(ASIAN, rCJKFont);
2011-10-16 14:35:24 +01:00
}
if (pImpl->m_bCTLEnabled)
{
if (!pImpl->maText.isEmpty())
pImpl->maText += " ";
pImpl->maText += makeRepresentativeTextForFont(COMPLEX, rCTLFont);
2011-10-16 14:35:24 +01:00
}
}
if (pImpl->maText.isEmpty())
pImpl->maText = GetText();
2000-09-18 16:07:07 +00:00
if (pImpl->maText.isEmpty())
{ // fdo#58427: still no text? let's try that one...
pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
}
// remove line feeds and carriage returns from string
bool bNotEmpty = false;
for (sal_Int32 i = 0; i < pImpl->maText.getLength(); ++i)
{
if (0xa == pImpl->maText[i] || 0xd == pImpl->maText[i])
pImpl->maText = pImpl->maText.replaceAt(i, 1, " ");
else
bNotEmpty = true;
}
if (!bNotEmpty)
pImpl->maText = GetText();
if (pImpl->maText.getLength() > (TEXT_WIDTH - 1))
{
const sal_Int32 nSpaceIdx = pImpl->maText.indexOf(" ", TEXT_WIDTH);
if (nSpaceIdx != -1)
pImpl->maText = pImpl->maText.copy(0, nSpaceIdx);
else
pImpl->maText = pImpl->maText.copy(0, (TEXT_WIDTH - 1));
}
}
// calculate text width scaling
pImpl->ScaleFontWidth(rRenderContext);
pImpl->CheckScript();
Size aTxtSize = pImpl->CalcTextSize(rRenderContext, pPrinter, rFont);
2000-09-18 16:07:07 +00:00
const Size aLogSize(rRenderContext.GetOutputSize());
2000-09-18 16:07:07 +00:00
long nX = aLogSize.Width() / 2 - aTxtSize.Width() / 2;
long nY = aLogSize.Height() / 2 - aTxtSize.Height() / 2;
2000-09-18 16:07:07 +00:00
if (nY + pImpl->mnAscent > aLogSize.Height())
nY = aLogSize.Height() - pImpl->mnAscent;
2000-12-04 14:34:19 +00:00
if (pImpl->mpBackColor)
2000-12-04 14:34:19 +00:00
{
Rectangle aRect(Point(0, 0), aLogSize);
Color aLineCol = rRenderContext.GetLineColor();
Color aFillCol = rRenderContext.GetFillColor();
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(*pImpl->mpBackColor);
rRenderContext.DrawRect(aRect);
rRenderContext.SetLineColor(aLineCol);
rRenderContext.SetFillColor(aFillCol);
2000-12-04 14:34:19 +00:00
}
if (pImpl->mpColor)
2000-12-04 14:34:19 +00:00
{
Rectangle aRect(Point(nX, nY), aTxtSize);
Color aLineCol = rRenderContext.GetLineColor();
Color aFillCol = rRenderContext.GetFillColor();
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(*pImpl->mpColor);
rRenderContext.DrawRect(aRect);
rRenderContext.SetLineColor(aLineCol);
rRenderContext.SetFillColor(aFillCol);
2000-12-04 14:34:19 +00:00
}
long nStdAscent = pImpl->mnAscent;
nY += nStdAscent;
2000-12-04 14:34:19 +00:00
2011-11-08 09:19:23 +00:00
if (IsTwoLines())
2000-12-04 14:34:19 +00:00
{
SvxFont aSmallFont(rFont);
Size aOldSize = pImpl->maCJKFont.GetSize();
setFontSize(aSmallFont);
setFontSize(pImpl->maCJKFont);
long nStartBracketWidth = 0;
long nEndBracketWidth = 0;
long nTextWidth = 0;
if (pImpl->mcStartBracket)
{
OUString sBracket(pImpl->mcStartBracket);
nStartBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
}
if (pImpl->mcEndBracket)
{
OUString sBracket(pImpl->mcEndBracket);
nEndBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
}
nTextWidth = pImpl->CalcTextSize(rRenderContext, pPrinter, aSmallFont).Width();
long nResultWidth = nStartBracketWidth;
nResultWidth += nEndBracketWidth;
nResultWidth += nTextWidth;
2000-12-04 14:34:19 +00:00
long _nX = (aLogSize.Width() - nResultWidth) / 2;
rRenderContext.DrawLine(Point(0, nY), Point(_nX, nY));
rRenderContext.DrawLine(Point(_nX + nResultWidth, nY), Point(aLogSize.Width(), nY));
2000-12-04 14:34:19 +00:00
long nSmallAscent = pImpl->mnAscent;
long nOffset = (nStdAscent - nSmallAscent) / 2;
if (pImpl->mcStartBracket)
{
OUString sBracket(pImpl->mcStartBracket);
rFont.DrawPrev(&rRenderContext, pPrinter, Point(_nX, nY - nOffset - 4), sBracket);
_nX += nStartBracketWidth;
}
Point aTmpPoint1(_nX, nY - nSmallAscent - 2);
Point aTmpPoint2(_nX, nY);
pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint1, aSmallFont);
pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint2, aSmallFont);
_nX += nTextWidth;
if (pImpl->mcEndBracket)
{
Point aTmpPoint( _nX + 1, nY - nOffset - 4);
OUString sBracket(pImpl->mcEndBracket);
rFont.DrawPrev(&rRenderContext, pPrinter, aTmpPoint, sBracket);
}
pImpl->maCJKFont.SetSize(aOldSize);
2000-12-04 14:34:19 +00:00
}
else
{
Color aLineCol = rRenderContext.GetLineColor();
rRenderContext.SetLineColor(rFont.GetColor());
rRenderContext.DrawLine(Point(0, nY), Point(nX, nY));
rRenderContext.DrawLine(Point(nX + aTxtSize.Width(), nY), Point(aLogSize.Width(), nY));
rRenderContext.SetLineColor(aLineCol);
Point aTmpPoint(nX, nY);
pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint, rFont);
}
2000-12-04 14:34:19 +00:00
}
2000-09-18 16:07:07 +00:00
}
bool SvxFontPrevWindow::IsTwoLines() const
2011-11-08 09:19:23 +00:00
{
return pImpl->mbTwoLines;
2011-11-08 09:19:23 +00:00
}
void SvxFontPrevWindow::SetTwoLines(bool bSet)
2011-11-08 09:19:23 +00:00
{
pImpl->mbTwoLines = bSet;
2011-11-08 09:19:23 +00:00
}
2000-12-04 14:34:19 +00:00
void SvxFontPrevWindow::SetBrackets(sal_Unicode cStart, sal_Unicode cEnd)
{
pImpl->mcStartBracket = cStart;
pImpl->mcEndBracket = cEnd;
2000-12-04 14:34:19 +00:00
}
2000-09-18 16:07:07 +00:00
void SvxFontPrevWindow::SetFontWidthScale( sal_uInt16 n )
{
if (pImpl->SetFontWidthScale(n))
Invalidate();
}
void SvxFontPrevWindow::AutoCorrectFontColor()
{
Color aFontColor( GetTextColor() );
if (COL_AUTO == pImpl->maFont.GetColor().GetColor())
pImpl->maFont.SetColor(aFontColor);
if (COL_AUTO == pImpl->maCJKFont.GetColor().GetColor())
pImpl->maCJKFont.SetColor(aFontColor);
2002-08-13 07:42:53 +00:00
if (COL_AUTO == pImpl->maCTLFont.GetColor().GetColor())
pImpl->maCTLFont.SetColor(aFontColor);
}
static bool GetWhich (const SfxItemSet& rSet, sal_uInt16 nSlot, sal_uInt16& rWhich)
{
rWhich = rSet.GetPool()->GetWhich(nSlot);
return rSet.GetItemState(rWhich) >= SfxItemState::DEFAULT;
}
static void SetPrevFont(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont)
{
sal_uInt16 nWhich;
if (GetWhich(rSet, nSlot, nWhich))
{
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(rSet.Get(nWhich));
rFont.SetFamily(rFontItem.GetFamily());
rFont.SetFamilyName(rFontItem.GetFamilyName());
rFont.SetPitch(rFontItem.GetPitch());
rFont.SetCharSet(rFontItem.GetCharSet());
rFont.SetStyleName(rFontItem.GetStyleName());
}
}
static void SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont& rFont )
{
sal_uInt16 nWhich;
if( GetWhich( rSet, nPosture, nWhich ) )
{
const SvxPostureItem& rItem = static_cast<const SvxPostureItem&>( rSet.Get( nWhich ) );
rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE );
}
if( GetWhich( rSet, nWeight, nWhich ) )
{
const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>( rSet.Get( nWhich ) );
rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL );
}
}
void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont )
{
sal_uInt16 nWhich;
long nH;
if (GetWhich(rSet, nSlot, nWhich))
{
nH = LogicToLogic(static_cast<const SvxFontHeightItem&>(rSet.Get(nWhich)).GetHeight(),
(MapUnit) rSet.GetPool()->GetMetric(nWhich),
MAP_TWIP);
}
else
nH = 240;// as default 12pt
rFont.SetSize(Size(0, nH));
}
void SvxFontPrevWindow::SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont)
{
sal_uInt16 nWhich;
LanguageType nLang;
if( GetWhich( rSet, nSlot, nWhich ) )
nLang = static_cast<const SvxLanguageItem&>(rSet.Get(nWhich)).GetLanguage();
else
nLang = LANGUAGE_NONE;
rFont.SetLanguage(nLang);
}
static void SetPrevFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
{
rFont.SetPropr(nProp);
rFont.SetProprRel(nEscProp);
rFont.SetEscapement(nEsc);
}
void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBackgroundToCharacter)
{
sal_uInt16 nWhich;
SvxFont& rFont = GetFont();
SvxFont& rCJKFont = GetCJKFont();
SvxFont& rCTLFont = GetCTLFont();
// Preview string
if( GetWhich( rSet, SID_CHAR_DLG_PREVIEW_STRING, nWhich ) )
{
const SfxStringItem& rItem = static_cast<const SfxStringItem&>( rSet.Get( nWhich ) );
OUString aString = rItem.GetValue();
if( !aString.isEmpty() )
SetPreviewText( aString );
else
SetFontNameAsPreviewText();
}
// Underline
FontLineStyle eUnderline;
if( GetWhich( rSet, SID_ATTR_CHAR_UNDERLINE, nWhich ) )
{
const SvxUnderlineItem& rItem = static_cast<const SvxUnderlineItem&>( rSet.Get( nWhich ) );
eUnderline = ( FontLineStyle ) rItem.GetValue();
SetTextLineColor( rItem.GetColor() );
}
else
eUnderline = LINESTYLE_NONE;
rFont.SetUnderline( eUnderline );
rCJKFont.SetUnderline( eUnderline );
rCTLFont.SetUnderline( eUnderline );
// Overline
FontLineStyle eOverline;
if( GetWhich( rSet, SID_ATTR_CHAR_OVERLINE, nWhich ) )
{
const SvxOverlineItem& rItem = static_cast<const SvxOverlineItem&>( rSet.Get( nWhich ) );
eOverline = ( FontLineStyle ) rItem.GetValue();
SetOverlineColor( rItem.GetColor() );
}
else
eOverline = LINESTYLE_NONE;
rFont.SetOverline( eOverline );
rCJKFont.SetOverline( eOverline );
rCTLFont.SetOverline( eOverline );
// Strikeout
FontStrikeout eStrikeout;
if( GetWhich( rSet, SID_ATTR_CHAR_STRIKEOUT, nWhich ) )
{
const SvxCrossedOutItem& rItem = static_cast<const SvxCrossedOutItem&>( rSet.Get( nWhich ) );
eStrikeout = ( FontStrikeout ) rItem.GetValue();
}
else
eStrikeout = STRIKEOUT_NONE;
rFont.SetStrikeout( eStrikeout );
rCJKFont.SetStrikeout( eStrikeout );
rCTLFont.SetStrikeout( eStrikeout );
// WordLineMode
if( GetWhich( rSet, SID_ATTR_CHAR_WORDLINEMODE, nWhich ) )
{
const SvxWordLineModeItem& rItem = static_cast<const SvxWordLineModeItem&>( rSet.Get( nWhich ) );
rFont.SetWordLineMode( rItem.GetValue() );
rCJKFont.SetWordLineMode( rItem.GetValue() );
rCTLFont.SetWordLineMode( rItem.GetValue() );
}
// Emphasis
if( GetWhich( rSet, SID_ATTR_CHAR_EMPHASISMARK, nWhich ) )
{
const SvxEmphasisMarkItem& rItem = static_cast<const SvxEmphasisMarkItem&>( rSet.Get( nWhich ) );
FontEmphasisMark eMark = rItem.GetEmphasisMark();
rFont.SetEmphasisMark( eMark );
rCJKFont.SetEmphasisMark( eMark );
rCTLFont.SetEmphasisMark( eMark );
}
// Relief
if( GetWhich( rSet, SID_ATTR_CHAR_RELIEF, nWhich ) )
{
const SvxCharReliefItem& rItem = static_cast<const SvxCharReliefItem&>( rSet.Get( nWhich ) );
FontRelief eFontRelief = ( FontRelief ) rItem.GetValue();
rFont.SetRelief( eFontRelief );
rCJKFont.SetRelief( eFontRelief );
rCTLFont.SetRelief( eFontRelief );
}
// Effects
if( GetWhich( rSet, SID_ATTR_CHAR_CASEMAP, nWhich ) )
{
const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>( rSet.Get( nWhich ) );
SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
rFont.SetCaseMap( eCaseMap );
rCJKFont.SetCaseMap( eCaseMap );
// #i78474# small caps do not exist in CTL fonts
rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap );
}
// Outline
if( GetWhich( rSet, SID_ATTR_CHAR_CONTOUR, nWhich ) )
{
const SvxContourItem& rItem = static_cast<const SvxContourItem&>( rSet.Get( nWhich ) );
bool bOutline = rItem.GetValue();
rFont.SetOutline( bOutline );
rCJKFont.SetOutline( bOutline );
rCTLFont.SetOutline( bOutline );
}
// Shadow
if( GetWhich( rSet, SID_ATTR_CHAR_SHADOWED, nWhich ) )
{
const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>( rSet.Get( nWhich ) );
bool bShadow = rItem.GetValue();
rFont.SetShadow( bShadow );
rCJKFont.SetShadow( bShadow );
rCTLFont.SetShadow( bShadow );
}
// Background
bool bTransparent;
if( GetWhich( rSet, bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR, nWhich ) )
{
const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) );
const Color& rColor = rBrush.GetColor();
bTransparent = rColor.GetTransparency() > 0;
rFont.SetFillColor( rColor );
rCJKFont.SetFillColor( rColor );
rCTLFont.SetFillColor( rColor );
}
else
bTransparent = TRUE;
rFont.SetTransparent( bTransparent );
rCJKFont.SetTransparent( bTransparent );
rCTLFont.SetTransparent( bTransparent );
Color aBackCol( COL_TRANSPARENT );
if( !bPreviewBackgroundToCharacter )
{
if( GetWhich( rSet, SID_ATTR_BRUSH, nWhich ) )
{
const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) );
if( GPOS_NONE == rBrush.GetGraphicPos() )
aBackCol = rBrush.GetColor();
}
}
SetBackColor( aBackCol );
// Font
SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont );
SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont );
SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont );
// Style
SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont );
SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont );
SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont );
// Size
SetFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont );
SetFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont );
SetFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont );
// Language
SetFontLang( rSet, SID_ATTR_CHAR_LANGUAGE, rFont );
SetFontLang( rSet, SID_ATTR_CHAR_CJK_LANGUAGE, rCJKFont );
SetFontLang( rSet, SID_ATTR_CHAR_CTL_LANGUAGE, rCTLFont );
// Color
if( GetWhich( rSet, SID_ATTR_CHAR_COLOR, nWhich ) )
{
const SvxColorItem& rItem = static_cast<const SvxColorItem&>( rSet.Get( nWhich ) );
Color aCol( rItem.GetValue() );
rFont.SetColor( aCol );
rCJKFont.SetColor( aCol );
rCTLFont.SetColor( aCol );
AutoCorrectFontColor(); // handle color COL_AUTO
}
// Kerning
if( GetWhich( rSet, SID_ATTR_CHAR_KERNING, nWhich ) )
{
const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) );
short nKern = ( short )
LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP );
rFont.SetFixKerning( nKern );
rCJKFont.SetFixKerning( nKern );
rCTLFont.SetFixKerning( nKern );
}
// Escapement
const sal_uInt8 nProp = 100;
short nEsc;
sal_uInt8 nEscProp;
if( GetWhich( rSet, SID_ATTR_CHAR_ESCAPEMENT, nWhich ) )
{
const SvxEscapementItem& rItem = static_cast<const SvxEscapementItem&>( rSet.Get( nWhich ) );
nEsc = rItem.GetEsc();
nEscProp = rItem.GetProportionalHeight();
if( nEsc == DFLT_ESC_AUTO_SUPER )
nEsc = DFLT_ESC_SUPER;
else if( nEsc == DFLT_ESC_AUTO_SUB )
nEsc = DFLT_ESC_SUB;
}
else
{
nEsc = 0;
nEscProp = 100;
}
SetPrevFontEscapement( rFont, nProp, nEscProp, nEsc );
SetPrevFontEscapement( rCJKFont, nProp, nEscProp, nEsc );
SetPrevFontEscapement( rCTLFont, nProp, nEscProp, nEsc );
// Font width scale
if( GetWhich( rSet, SID_ATTR_CHAR_SCALEWIDTH, nWhich ) )
{
const SvxCharScaleWidthItem&rItem = static_cast<const SvxCharScaleWidthItem&>( rSet.Get( nWhich ) );
SetFontWidthScale( rItem.GetValue() );
}
Invalidate();
}
void SvxFontPrevWindow::Init(const SfxItemSet& rSet)
{
SvxFont& rFont = GetFont();
SvxFont& rCJKFont = GetCJKFont();
SvxFont& rCTLFont = GetCTLFont();
initFont(rFont);
initFont(rCJKFont);
initFont(rCTLFont);
ResetSettings(true, true);
sal_uInt16 nWhich;
nWhich = rSet.GetPool()->GetWhich( SID_CHAR_DLG_PREVIEW_STRING );
if (ISITEMSET)
{
const SfxStringItem& rItem = static_cast<const SfxStringItem&>( rSet.Get( nWhich ) );
OUString aString = rItem.GetValue();
if( !aString.isEmpty() )
SetPreviewText( aString );
else
SetFontNameAsPreviewText();
}
// Underline
FontLineStyle eUnderline;
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_UNDERLINE );
if( ISITEMSET )
{
const SvxUnderlineItem& rItem = static_cast<const SvxUnderlineItem&>( rSet.Get( nWhich ) );
eUnderline = ( FontLineStyle ) rItem.GetValue();
SetTextLineColor( rItem.GetColor() );
}
else
eUnderline = LINESTYLE_NONE;
rFont.SetUnderline( eUnderline );
rCJKFont.SetUnderline( eUnderline );
rCTLFont.SetUnderline( eUnderline );
// Overline
FontLineStyle eOverline;
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_OVERLINE );
if( ISITEMSET )
{
const SvxOverlineItem& rItem = static_cast<const SvxOverlineItem&>( rSet.Get( nWhich ) );
eOverline = ( FontLineStyle ) rItem.GetValue();
SetOverlineColor( rItem.GetColor() );
}
else
eOverline = LINESTYLE_NONE;
rFont.SetOverline( eOverline );
rCJKFont.SetOverline( eOverline );
rCTLFont.SetOverline( eOverline );
// Strikeout
FontStrikeout eStrikeout;
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_STRIKEOUT );
if( ISITEMSET )
{
const SvxCrossedOutItem& rItem = static_cast<const SvxCrossedOutItem&>( rSet.Get( nWhich ) );
eStrikeout = ( FontStrikeout ) rItem.GetValue();
}
else
eStrikeout = STRIKEOUT_NONE;
rFont.SetStrikeout( eStrikeout );
rCJKFont.SetStrikeout( eStrikeout );
rCTLFont.SetStrikeout( eStrikeout );
// WordLineMode
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
if( ISITEMSET )
{
const SvxWordLineModeItem& rItem = static_cast<const SvxWordLineModeItem&>( rSet.Get( nWhich ) );
rFont.SetWordLineMode( rItem.GetValue() );
rCJKFont.SetWordLineMode( rItem.GetValue() );
rCTLFont.SetWordLineMode( rItem.GetValue() );
}
// Emphasis
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
if( ISITEMSET )
{
const SvxEmphasisMarkItem& rItem = static_cast<const SvxEmphasisMarkItem&>( rSet.Get( nWhich ) );
FontEmphasisMark eMark = rItem.GetEmphasisMark();
rFont.SetEmphasisMark( eMark );
rCJKFont.SetEmphasisMark( eMark );
rCTLFont.SetEmphasisMark( eMark );
}
// Relief
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_RELIEF );
if( ISITEMSET )
{
const SvxCharReliefItem& rItem = static_cast<const SvxCharReliefItem&>( rSet.Get( nWhich ) );
FontRelief eFontRelief = ( FontRelief ) rItem.GetValue();
rFont.SetRelief( eFontRelief );
rCJKFont.SetRelief( eFontRelief );
rCTLFont.SetRelief( eFontRelief );
}
// Effects
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_CASEMAP );
if( ISITEMSET )
{
const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>( rSet.Get( nWhich ) );
SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
rFont.SetCaseMap( eCaseMap );
rCJKFont.SetCaseMap( eCaseMap );
// #i78474# small caps do not exist in CTL fonts
rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap );
}
// Outline
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_CONTOUR );
if( ISITEMSET )
{
const SvxContourItem& rItem = static_cast<const SvxContourItem&>( rSet.Get( nWhich ) );
bool bOutline = rItem.GetValue();
rFont.SetOutline( bOutline );
rCJKFont.SetOutline( bOutline );
rCTLFont.SetOutline( bOutline );
}
// Shadow
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_SHADOWED );
if( ISITEMSET )
{
const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>( rSet.Get( nWhich ) );
bool bShadow = rItem.GetValue();
rFont.SetShadow( bShadow );
rCJKFont.SetShadow( bShadow );
rCTLFont.SetShadow( bShadow );
}
// Background
bool bTransparent;
nWhich = rSet.GetPool()->GetWhich(pImpl->mbPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR);
if (ISITEMSET)
{
const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) );
const Color& rColor = rBrush.GetColor();
bTransparent = rColor.GetTransparency() > 0;
rFont.SetFillColor(rColor);
rCJKFont.SetFillColor(rColor);
rCTLFont.SetFillColor(rColor);
}
else
bTransparent = true;
rFont.SetTransparent( bTransparent );
rCJKFont.SetTransparent( bTransparent );
rCTLFont.SetTransparent( bTransparent );
Color aBackCol( COL_TRANSPARENT );
if (!pImpl->mbPreviewBackgroundToCharacter)
{
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_BRUSH );
if (ISITEMSET)
{
const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>(rSet.Get(nWhich));
if (GPOS_NONE == rBrush.GetGraphicPos())
aBackCol = rBrush.GetColor();
}
}
SetBackColor(aBackCol);
// Font
SetFont(rSet, SID_ATTR_CHAR_FONT, rFont);
SetFont(rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont);
SetFont(rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont);
// Style
SetFontStyle(rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont);
SetFontStyle(rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont);
SetFontStyle(rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont);
// Size
SetFontSize(rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont);
SetFontSize(rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont);
SetFontSize(rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont);
// Language
SetFontLang( rSet, SID_ATTR_CHAR_LANGUAGE, rFont );
SetFontLang( rSet, SID_ATTR_CHAR_CJK_LANGUAGE, rCJKFont );
SetFontLang( rSet, SID_ATTR_CHAR_CTL_LANGUAGE, rCTLFont );
// Color
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_COLOR );
if( ISITEMSET )
{
const SvxColorItem& rItem = static_cast<const SvxColorItem&>( rSet.Get( nWhich ) );
Color aCol( rItem.GetValue() );
rFont.SetColor( aCol );
rCJKFont.SetColor( aCol );
rCTLFont.SetColor( aCol );
AutoCorrectFontColor(); // handle color COL_AUTO
}
// Kerning
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_KERNING );
if( ISITEMSET )
{
const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) );
short nKern = ( short )
LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP );
rFont.SetFixKerning( nKern );
rCJKFont.SetFixKerning( nKern );
rCTLFont.SetFixKerning( nKern );
}
// Escapement
nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
const sal_uInt8 nProp = 100;
short nEsc;
sal_uInt8 nEscProp;
if( ISITEMSET )
{
const SvxEscapementItem& rItem = static_cast<const SvxEscapementItem&>( rSet.Get( nWhich ) );
nEsc = rItem.GetEsc();
nEscProp = rItem.GetProportionalHeight();
if( nEsc == DFLT_ESC_AUTO_SUPER )
nEsc = DFLT_ESC_SUPER;
else if( nEsc == DFLT_ESC_AUTO_SUB )
nEsc = DFLT_ESC_SUB;
}
else
{
nEsc = 0;
nEscProp = 100;
}
SetFontEscapement( nProp, nEscProp, nEsc );
// Font width scale
SetFontWidthScale( rSet );
Invalidate();
}
void SvxFontPrevWindow::SetFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont )
{
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( nSlot );
if( ISITEMSET )
{
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>( rSet.Get(nWhich) );
rFont.SetFamily( rFontItem.GetFamily() );
rFont.SetFamilyName( rFontItem.GetFamilyName() );
rFont.SetPitch( rFontItem.GetPitch() );
rFont.SetCharSet( rFontItem.GetCharSet() );
rFont.SetStyleName( rFontItem.GetStyleName() );
}
}
void SvxFontPrevWindow::SetFontStyle( const SfxItemSet& rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont& rFont )
{
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( nPosture );
if( ISITEMSET )
{
const SvxPostureItem& rItem = static_cast<const SvxPostureItem&>( rSet.Get( nWhich ) );
rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE );
}
nWhich = rSet.GetPool()->GetWhich( nWeight );
if( ISITEMSET )
{
const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>( rSet.Get( nWhich ) );
rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL );
}
}
void SvxFontPrevWindow::SetFontWidthScale( const SfxItemSet& rSet )
{
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
if( ISITEMSET )
{
const SvxCharScaleWidthItem& rItem = static_cast<const SvxCharScaleWidthItem&>( rSet.Get( nWhich ) );
SetFontWidthScale( rItem.GetValue() );
}
}
namespace
{
void setFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
{
rFont.SetPropr(nProp);
rFont.SetProprRel(nEscProp);
rFont.SetEscapement(nEsc);
}
}
void SvxFontPrevWindow::SetFontEscapement(sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
{
setFontEscapement(GetFont(), nProp, nEscProp, nEsc);
setFontEscapement(GetCJKFont(), nProp, nEscProp, nEsc);
setFontEscapement(GetCTLFont(), nProp, nEscProp, nEsc);
Invalidate();
}
Size SvxFontPrevWindow::GetOptimalSize() const
{
return getPreviewStripSize(this);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */