diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-11-30 15:31:47 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-11-30 15:31:47 +0000 |
commit | 0d216d4937ea65ac06e442164f7eb7e6fa71683f (patch) | |
tree | db03f61760a23feb4613bb700b2a2d3e266195ca /vcl/inc | |
parent | 056be7cf7d354fbae161394905bc4b454d05d41a (diff) | |
parent | f4ce12bb2e6f64f5b4cfed9b1b13f8e87371b4a9 (diff) |
slideshow1: merge with DEV300 m56
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/vcl/gdimtf.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/vcl/graph.hxx | 44 | ||||
-rw-r--r-- | vcl/inc/vcl/graphite_adaptors.hxx | 154 | ||||
-rw-r--r-- | vcl/inc/vcl/graphite_cache.hxx | 265 | ||||
-rw-r--r-- | vcl/inc/vcl/graphite_features.hxx | 77 | ||||
-rw-r--r-- | vcl/inc/vcl/graphite_layout.hxx | 167 | ||||
-rw-r--r-- | vcl/inc/vcl/graphite_serverfont.hxx | 103 | ||||
-rw-r--r-- | vcl/inc/vcl/impgraph.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/vcl/jobset.h | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/outdev.hxx | 24 | ||||
-rw-r--r-- | vcl/inc/vcl/pngread.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/print.hxx | 9 | ||||
-rw-r--r-- | vcl/inc/vcl/prntypes.hxx | 28 | ||||
-rw-r--r-- | vcl/inc/vcl/salprn.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/settings.hxx | 14 | ||||
-rw-r--r-- | vcl/inc/vcl/sndstyle.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/syschild.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/window.hxx | 2 |
18 files changed, 854 insertions, 56 deletions
diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 62439d4d4613..c53460d35584 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -164,6 +164,14 @@ public: void Scale( double fScaleX, double fScaleY ); void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); void Rotate( long nAngle10 ); + /* get the bound rect of the contained actions + * caveats: + * - clip actions will limit the contained actions, + * but the current clipregion of the passed OutputDevice will not + * - coordinates of actions will be transformed to preferred mapmode + * - the returned rectangle is relative to the preferred mapmode of the metafile + */ + Rectangle GetBoundRect( OutputDevice& i_rReference ); void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0, short nChannelRPercent = 0, short nChannelGPercent = 0, diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index f56c55b7db42..9d70c67d3e55 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -53,6 +53,36 @@ class OutputDevice; class Font; class GfxLink; +class VCL_DLLPUBLIC GraphicConversionParameters +{ +private: + Size maSizePixel; // default is (0,0) + + // bitfield + unsigned mbUnlimitedSize : 1; // default is false + unsigned mbAntiAliase : 1; // default is false + unsigned mbSnapHorVerLines : 1; // default is false + +public: + GraphicConversionParameters( + const Size& rSizePixel = Size(), + bool bUnlimitedSize = false, + bool bAntiAliase = false, + bool bSnapHorVerLines = false) + : maSizePixel(rSizePixel), + mbUnlimitedSize(bUnlimitedSize), + mbAntiAliase(bAntiAliase), + mbSnapHorVerLines(bSnapHorVerLines) + { + } + + // data read access + const Size getSizePixel() const { return maSizePixel; } + bool getUnlimitedSize() const { return mbUnlimitedSize; } + bool getAntiAliase() const { return mbAntiAliase; } + bool getSnapHorVerLines() const { return mbSnapHorVerLines; } +}; + class VCL_DLLPUBLIC Graphic : public SvDataCopyStream { private: @@ -96,12 +126,14 @@ public: BOOL IsAlpha() const; BOOL IsAnimated() const; - Bitmap GetBitmap() const; - Bitmap GetBitmap( const Size* pSizePixel ) const; - BitmapEx GetBitmapEx() const; - BitmapEx GetBitmapEx( const Size* pSizePixel ) const; - Bitmap GetUnlimitedBitmap( const Size* pSizePixel ) const; - BitmapEx GetUnlimitedBitmapEx( const Size* pSizePixel ) const; + // #i102089# Access of Bitmap potentially will have to rasterconvert the Graphic + // if it is a MetaFile. To be able to control this conversion it is necessary to + // allow giving parameters which control AntiAliasing and LineSnapping of the + // MetaFile when played. Defaults will use a no-AAed, not snapped conversion as + // before. + Bitmap GetBitmap(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; + BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; + Animation GetAnimation() const; const GDIMetaFile& GetGDIMetaFile() const; diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx new file mode 100644 index 000000000000..41ffa00b0f8f --- /dev/null +++ b/vcl/inc/vcl/graphite_adaptors.hxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SV_GRAPHITEADAPTORS_HXX +#define _SV_GRAPHITEADAPTORS_HXX + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +// Standard Library +#include <stdexcept> +// Platform + +#ifndef _SVWIN_H +#include <tools/svwin.h> +#endif + +#ifndef _SV_SVSYS_HXX +#include <svsys.h> +#endif + +#ifndef _SV_SALGDI_HXX +#include <vcl/salgdi.hxx> +#endif + +#ifndef _SV_SALLAYOUT_HXX +#include <vcl/sallayout.hxx> +#endif + +// Module +#include "vcl/dllapi.h" + +// Libraries +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/ITextSource.h> + + +// Module type definitions and forward declarations. +// +#ifndef MSC +// SAL/VCL types +class ServerFont; +class FreetypeServerFont; + +// Graphite types + +struct FontProperties : gr::FontProps +{ + FontProperties(const FreetypeServerFont & font) throw(); +}; + +namespace grutils +{ + class GrFeatureParser; +} + +// This class adapts the Sal font and graphics services to form required by +// the Graphite engine. +// @author tse +// +class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font +{ +typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap; + +public: + static bool IsGraphiteEnabledFont(ServerFont &) throw(); + + GraphiteFontAdaptor(ServerFont & font, const sal_Int32 dpi_x, const sal_Int32 dpi_y); + GraphiteFontAdaptor(const GraphiteFontAdaptor &) throw(); + ~GraphiteFontAdaptor() throw(); + + gr::Font * copyThis(); + + // Basic attribute accessors. + virtual float ascent(); + virtual float descent(); + virtual bool bold(); + virtual bool italic(); + virtual float height(); + virtual unsigned int getDPIx(); + virtual unsigned int getDPIy(); + + // Font access methods. + virtual const void * getTable(gr::fontTableId32 tableID, size_t * pcbSize); + virtual void getFontMetrics(float * ascent_out, float * descent_out = 0, float * em_square_out = 0); + + // Glyph metrics. + virtual void getGlyphMetrics(gr::gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances); + + // Adaptor attributes. + const FontProperties & fontProperties() const throw(); + FreetypeServerFont & font() const throw(); + const grutils::GrFeatureParser * features() const { return mpFeatures; }; + +private: + virtual void UniqueCacheInfo(std::wstring &, bool &, bool &); + + FreetypeServerFont& mrFont; + FontProperties maFontProperties; + const unsigned int mnDpiX, mnDpiY; + const float mfAscent, + mfDescent, + mfEmUnits; + grutils::GrFeatureParser * mpFeatures; + GlyphMetricMap maGlyphMetricMap; +}; + +// Partial implementation of class GraphiteFontAdaptor. +// +inline const FontProperties & GraphiteFontAdaptor::fontProperties() const throw() { + return maFontProperties; +} + +inline FreetypeServerFont & GraphiteFontAdaptor::font() const throw() { + return mrFont; +} +#endif // not MFC + +// Partial implementation of class TextSourceAdaptor. +// +//inline const ImplLayoutArgs & TextSourceAdaptor::layoutArgs() const throw() { +// return _layout_args; +//} + + +#endif // _SV_GRAPHITEADAPTORS_HXX diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx new file mode 100644 index 000000000000..5a537c5f1e48 --- /dev/null +++ b/vcl/inc/vcl/graphite_cache.hxx @@ -0,0 +1,265 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// Description: Classes to cache Graphite Segments to try to improve +// rendering performance. + +#ifndef GraphiteSegmentCache_h +#define GraphiteSegmentCache_h + +#include <tools/solar.h> +#include <rtl/ustring.h> + +#define GRCACHE_REUSE_VECTORS 1 + +//#include <rope> +#include <hash_map> + +class TextSourceAdaptor; +/** +* GrSegRecord stores a Graphite Segment and its associated text +*/ +class GrSegRecord { +public: + GrSegRecord(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); + + ~GrSegRecord(); + + void reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); + + void clearVectors(); + void clear(); +#ifdef GRCACHE_REUSE_VECTORS + void setGlyphVectors(long nWidth, GraphiteLayout::Glyphs & vGlyphs, std::vector<int> vCharDxs, + std::vector<int> & vChar2Base, std::vector<int> & vGlyph2Char) + { + clearVectors(); + mnWidth = nWidth; + mvGlyphs.insert(mvGlyphs.begin(), vGlyphs.begin(), vGlyphs.end()); + mvCharDxs.insert(mvCharDxs.begin(),vCharDxs.begin(),vCharDxs.end()); + mvChar2BaseGlyph.insert(mvChar2BaseGlyph.begin(),vChar2Base.begin(),vChar2Base.end()); + mvGlyph2Char.insert(mvGlyph2Char.begin(),vGlyph2Char.begin(),vGlyph2Char.end()); + } +#endif + gr::Segment * getSegment() { return m_seg; } + TextSourceAdaptor * getTextSrc() { return m_text; } + void unlock() { --m_lockCount; } + bool isRtl() const { return mbIsRtl; } +#ifdef GRCACHE_REUSE_VECTORS + const long & width() const { return mnWidth; } + const GraphiteLayout::Glyphs & glyphs() const { return mvGlyphs; } + const std::vector<int> & charDxs() const { return mvCharDxs; } + const std::vector<int> & char2BaseGlyph() const { return mvChar2BaseGlyph; } + const std::vector<int> & glyph2Char() const { return mvGlyph2Char; } +#endif +private: + rtl::OUString * m_rope; + TextSourceAdaptor * m_text; + gr::Segment * m_seg; + const xub_Unicode * m_nextKey; + const xub_Unicode* m_pStr; + size_t m_startChar; + float m_fontScale; + long mnWidth; + GraphiteLayout::Glyphs mvGlyphs; // glyphs in display order + std::vector<int> mvCharDxs; // right hand side x offset of each glyph + std::vector<int> mvChar2BaseGlyph; + std::vector<int> mvGlyph2Char; + bool mbIsRtl; + int m_lockCount; + friend class GraphiteSegmentCache; +}; + +typedef std::hash_map<long, GrSegRecord*, std::hash<long> > GraphiteSegMap; +typedef std::hash_multimap<size_t, GrSegRecord*> GraphiteRopeMap; +typedef std::pair<GraphiteRopeMap::iterator, GraphiteRopeMap::iterator> GrRMEntry; + +/** +* GraphiteSegmentCache contains the cached Segments for one particular font size +*/ +class GraphiteSegmentCache +{ + enum { + // not really sure what good values are here, + // bucket size should be >> cache size + SEG_BUCKET_SIZE = 4096, + SEG_CACHE_SIZE = 255 + }; +public: + GraphiteSegmentCache() + : m_segMap(SEG_BUCKET_SIZE), + m_oldestKey(NULL) {}; + ~GraphiteSegmentCache() + { + m_ropeMap.clear(); + GraphiteSegMap::iterator i = m_segMap.begin(); + while (i != m_segMap.end()) + { + GrSegRecord *r = i->second; + delete r; + ++i; + } + m_segMap.clear(); + }; + GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl) + { + GrSegRecord * found = NULL; + // try to find a segment starting at correct place, if not, try to find a + // match for the complete buffer + GraphiteSegMap::iterator iMap = + m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr + + layoutArgs.mnMinCharPos)); + if (iMap != m_segMap.end()) + { + found = iMap->second; + } + else + { + iMap = m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr)); + if (iMap != m_segMap.end()) + { + found = iMap->second; + } + } + if (found) + { + if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos && + found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos) + { + const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos + + GraphiteLayout::EXTRA_CONTEXT_LENGTH); + DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache"); + // restore original start character, in case it has changed + found->m_seg->setTextSourceOffset(found->m_startChar); + // check that characters are the same, at least in the range of + // interest + // We could use substr and ==, but substr does a copy, + // so its probably faster to do it like this + for (size_t i = layoutArgs.mnMinCharPos; i < seg_char_limit; i++) + { + //if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter())) + if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i]) + return NULL; + } + if (found->isRtl() != bIsRtl) + { + return NULL; + } +// if (found->m_lockCount != 0) +// OutputDebugString("Multple users of SegRecord!"); + found->m_lockCount++; + } + else found = NULL; + } + else + { + // the pointers aren't the same, but we might still have the same text in a segment + // this is expecially needed when editing a large paragraph + // each edit changes the pointers, but if we don't reuse any segments it gets very + // slow. + const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos + + GraphiteLayout::EXTRA_CONTEXT_LENGTH); + rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos, + seg_char_limit - layoutArgs.mnMinCharPos); + if (!rope) return NULL; + size_t nHash = (*(rope)).hashCode(); + GrRMEntry range = m_ropeMap.equal_range(nHash); + while (range.first != range.second) + { + found = range.first->second; + if (found->m_lockCount == 0) + { + if(rope->match(*(found->m_rope))) + { + // found, but the pointers are all wrong + found->m_seg->setTextSourceOffset(layoutArgs.mnMinCharPos); + // the switch is done in graphite_layout.cxx + //found->m_text->switchLayoutArgs(layoutArgs); + found->m_lockCount++; + break; + } + else + found = NULL; + } + else + found = NULL; + ++(range.first); + } + delete rope; + } + return found; + }; + GrSegRecord * cacheSegment(TextSourceAdaptor * adapter, gr::Segment * seg, bool bIsRtl); +private: + GraphiteSegMap m_segMap; + GraphiteRopeMap m_ropeMap; + const xub_Unicode * m_oldestKey; + const xub_Unicode * m_prevKey; +}; + +typedef std::hash_map<int, GraphiteSegmentCache *, std::hash<int> > GraphiteCacheMap; + +/** +* GraphiteCacheHandler maps a particular font, style, size to a GraphiteSegmentCache +*/ +class GraphiteCacheHandler +{ +public: + GraphiteCacheHandler() : m_cacheMap(255) {}; + ~GraphiteCacheHandler() + { + GraphiteCacheMap::iterator i = m_cacheMap.begin(); + while (i != m_cacheMap.end()) + { + GraphiteSegmentCache *r = i->second; + delete r; + ++i; + } + m_cacheMap.clear(); + }; + + static GraphiteCacheHandler instance; + + GraphiteSegmentCache * getCache(sal_Int32 & fontHash) + { + if (m_cacheMap.count(fontHash) > 0) + { + return m_cacheMap.find(fontHash)->second; + } + GraphiteSegmentCache *pCache = new GraphiteSegmentCache(); + m_cacheMap[fontHash] = pCache; + return pCache; + } +private: + GraphiteCacheMap m_cacheMap; +}; + +#endif + diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx new file mode 100644 index 000000000000..6cfe5dfca0fd --- /dev/null +++ b/vcl/inc/vcl/graphite_features.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// Description: +// Parse a string of features specified as ; separated pairs. +// e.g. +// 1001=1&2002=2&fav1=0 + +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/GrFeature.h> + +namespace grutils +{ + + class GrFeatureParser + { + public: + enum { MAX_FEATURES = 64 }; + static const char FEAT_PREFIX; + static const char FEAT_SEPARATOR; + static const char FEAT_ID_VALUE_SEPARATOR; + static const std::string ISO_LANG; + GrFeatureParser(gr::Font & font, const std::string features, const std::string lang); + GrFeatureParser(gr::Font & font, const std::string lang); + GrFeatureParser(const GrFeatureParser & copy); + ~GrFeatureParser(); + size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const; + bool parseErrors() { return mbErrors; }; + static bool isValid(gr::Font & font, gr::FeatureSetting & setting); + gr::isocode getLanguage() const { return maLang; }; + bool hasLanguage() const { return (maLang.rgch[0] != '\0'); } + sal_Int32 hashCode() const; + private: + void setLang(gr::Font & font, const std::string & lang); + bool isCharId(const std::string & id, size_t offset, size_t length); + int getCharId(const std::string & id, size_t offset, size_t length); + int getIntValue(const std::string & id, size_t offset, size_t length); + size_t mnNumSettings; + gr::isocode maLang; + bool mbErrors; + gr::FeatureSetting maSettings[64]; + }; + + union FeatId + { + gr::featid num; + unsigned char label[5]; + }; +} diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx new file mode 100644 index 000000000000..2ec3bc4c2391 --- /dev/null +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SV_GRAPHITELAYOUT_HXX +#define _SV_GRAPHITELAYOUT_HXX +// Description: An implementation of the SalLayout interface that uses the +// Graphite engine. + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +#define GRCACHE 1 + +// Standard Library +#include <memory> +#include <vector> +#include <utility> +// Libraries +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/GrConstants.h> +#include <graphite/GrAppData.h> +#include <graphite/SegmentAux.h> +// Platform +#include <vcl/sallayout.hxx> +#include <vcl/dllapi.h> +// Module + +// For backwards compatibility with 2.4.x +#if (SUPD == 680) +typedef sal_Int32 sal_GlyphId; +#endif + + +// Module type definitions and forward declarations. +// +class TextSourceAdaptor; +class GraphiteFontAdaptor; +class GrSegRecord; +// SAL/VCL types +class ServerFont; +// Graphite types +namespace gr { class Segment; class GlyphIterator; } +namespace grutils { class GrFeatureParser; } + +// This class uses the SIL Graphite engine to provide complex text layout services to the VCL +// @author tse +// +class VCL_DLLPUBLIC GraphiteLayout : public SalLayout +{ +public: + class Glyphs : public std::vector<GlyphItem> + { + public: + typedef std::pair<Glyphs::const_iterator, Glyphs::const_iterator> iterator_pair_t; + + void fill_from(gr::Segment & rSeg, ImplLayoutArgs & rArgs, + bool bRtl, long &rWidth, float fScaling, + std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, + std::vector<int> & rCharDxs); + void move_glyph(Glyphs::iterator, long dx); + + const_iterator cluster_base(const_iterator) const; + iterator_pair_t neighbour_clusters(const_iterator) const; + private: + std::pair<float,float> appendCluster(gr::Segment & rSeg, ImplLayoutArgs & rArgs, + bool bRtl, int nFirstCharInCluster, int nNextChar, + int nFirstGlyphInCluster, int nNextGlyph, float fScaling, + std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, + std::vector<int> & rCharDxs, long & rDXOffset); + void append(gr::Segment & rSeg, ImplLayoutArgs & rArgs, gr::GlyphInfo & rGi, float nextGlyphOrigin, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset, bool bIsBase); + }; + + mutable Glyphs mvGlyphs; + void clear(); + +private: + TextSourceAdaptor * mpTextSrc; // Text source. + gr::LayoutEnvironment maLayout; + const gr::Font &mrFont; + long mnWidth; + std::vector<int> mvCharDxs; + std::vector<int> mvChar2BaseGlyph; + std::vector<int> mvGlyph2Char; + float mfScaling; + const grutils::GrFeatureParser * mpFeatures; + +public: + GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * features = NULL) throw(); + + // used by upper layers + virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout + // split into two stages to allow dc to be restored on the segment +#ifdef GRCACHE + gr::Segment * CreateSegment(ImplLayoutArgs& rArgs, GrSegRecord ** pRecord = NULL); + bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment, GrSegRecord * pSegRecord); +#else + gr::Segment * CreateSegment(ImplLayoutArgs& rArgs); + bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment); +#endif + + virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting positions + + // methods using string indexing + virtual int GetTextBreak( long nMaxWidth, long nCharExtra=0, int nFactor=1 ) const; + virtual long FillDXArray( sal_Int32* pDXArray ) const; + virtual void ApplyDXArray(ImplLayoutArgs &rArgs, std::vector<int> & rDeltaWidth); + + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const; + + // methods using glyph indexing + virtual int GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&, + sal_Int32* pGlyphAdvAry = 0, int* pCharPosAry = 0 ) const; + + // used by glyph+font+script fallback + virtual void MoveGlyph( int nStart, long nNewXPos ); + virtual void DropGlyph( int nStart ); + virtual void Simplify( bool bIsBase ); + + // Dummy implementation so layout can be shared between Linux/Windows + virtual void DrawText(SalGraphics&) const {}; + + virtual ~GraphiteLayout() throw(); + void SetFeatures(grutils::GrFeatureParser * aFeature) { mpFeatures = aFeature; } + void SetFontScale(float s) { mfScaling = s; }; + const TextSourceAdaptor * textSrc() const { return mpTextSrc; }; + virtual sal_GlyphId getKashidaGlyph(int & width) = 0; + void kashidaJustify(std::vector<int> & rDeltaWidth, sal_GlyphId, int width); + + static const int EXTRA_CONTEXT_LENGTH; +private: + int glyph_to_char(Glyphs::iterator); + std::pair<int,int> glyph_to_chars(const GlyphItem &) const; + + std::pair<long,long> caret_positions(size_t) const; +}; + + + +#endif // _SV_GRAPHITELAYOUT_HXX diff --git a/vcl/inc/vcl/graphite_serverfont.hxx b/vcl/inc/vcl/graphite_serverfont.hxx new file mode 100644 index 000000000000..d9e6670df79b --- /dev/null +++ b/vcl/inc/vcl/graphite_serverfont.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SV_GRAPHITESERVERFONT_HXX +#define _SV_GRAPHITESERVERFONT_HXX + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +#ifndef MSC +#include <vcl/graphite_layout.hxx> +#include <vcl/graphite_adaptors.hxx> + +// Modules + +class VCL_DLLPUBLIC GraphiteLayoutImpl : public GraphiteLayout +{ +public: + GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw() + : GraphiteLayout(font, features), mpFont(pFont) {}; + virtual ~GraphiteLayoutImpl() throw() {}; + virtual sal_GlyphId getKashidaGlyph(int & width); +private: + GraphiteFontAdaptor * mpFont; +}; + +// This class implments the server font specific parts. +// @author tse +// +class VCL_DLLPUBLIC GraphiteServerFontLayout : public ServerFontLayout +{ +private: + mutable GraphiteFontAdaptor * mpFont; + // mutable so that the DrawOffset/DrawBase can be set + mutable GraphiteLayoutImpl maImpl; +public: + GraphiteServerFontLayout(GraphiteFontAdaptor * font) throw(); + + virtual bool LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); }; // first step of layout + virtual void AdjustLayout( ImplLayoutArgs& rArgs) + { + SalLayout::AdjustLayout(rArgs); + maImpl.DrawBase() = maDrawBase; + maImpl.DrawOffset() = maDrawOffset; + maImpl.AdjustLayout(rArgs); + }; + virtual long GetTextWidth() const { return maImpl.GetTextWidth(); } + virtual long FillDXArray( sal_Int32* dxa ) const { return maImpl.FillDXArray(dxa); } + virtual int GetTextBreak( long mw, long ce, int f ) const { return maImpl.GetTextBreak(mw, ce, f); } + virtual void GetCaretPositions( int as, sal_Int32* cxa ) const { maImpl.GetCaretPositions(as, cxa); } + + // used by display layers + virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s, + sal_Int32* gaa = NULL, int* cpa = NULL ) const + { + maImpl.DrawBase() = maDrawBase; + maImpl.DrawOffset() = maDrawOffset; + return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa); + } + + virtual void MoveGlyph( int nStart, long nNewXPos ) { maImpl.MoveGlyph(nStart, nNewXPos); }; + virtual void DropGlyph( int nStart ) { maImpl.DropGlyph(nStart); }; + virtual void Simplify( bool bIsBase ) { maImpl.Simplify(bIsBase); }; + + virtual ~GraphiteServerFontLayout() throw(); + +// For use with PspGraphics + const sal_Unicode* getTextPtr() const; + int getMinCharPos() const { return mnMinCharPos; } + int getMaxCharPos() const { return mnEndCharPos; } +}; + + + +#endif +#endif //_SV_GRAPHITESERVERFONT_HXX diff --git a/vcl/inc/vcl/impgraph.hxx b/vcl/inc/vcl/impgraph.hxx index 34b61a5fe21c..3b36173891ae 100644 --- a/vcl/inc/vcl/impgraph.hxx +++ b/vcl/inc/vcl/impgraph.hxx @@ -55,6 +55,7 @@ struct ImpSwapInfo class OutputDevice; class GfxLink; struct ImpSwapFile; +class GraphicConversionParameters; class ImpGraphic { @@ -102,8 +103,8 @@ private: BOOL ImplIsAlpha() const; BOOL ImplIsAnimated() const; - Bitmap ImplGetBitmap( const Size* pSizePixel, BOOL bUnlimited ) const; - BitmapEx ImplGetBitmapEx( const Size* pSizePixel, BOOL bUnlimited ) const; + Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const; + BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const; Animation ImplGetAnimation() const; const GDIMetaFile& ImplGetGDIMetaFile() const; diff --git a/vcl/inc/vcl/jobset.h b/vcl/inc/vcl/jobset.h index 5d08319a7e6c..9f3eefd507d5 100644 --- a/vcl/inc/vcl/jobset.h +++ b/vcl/inc/vcl/jobset.h @@ -61,7 +61,7 @@ struct ImplJobSetup String maDriver; // Driver-Name Orientation meOrientation; // Orientation USHORT mnPaperBin; // Papierschacht - Paper mePaperFormat; // Papierformat + Paper mePaperFormat; // Papierformat long mnPaperWidth; // Papierbreite in 100tel mm long mnPaperHeight; // Papierhoehe in 100tel mm ULONG mnDriverDataLen; // Laenge der systemabhaengigen Daten diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 3f821f995a51..f4e42846dd5e 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -563,6 +563,20 @@ public: // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI SAL_DLLPRIVATE bool ImplIsAntiparallel() const ; + // #i101491# + // Helper which holds the old line geometry creation and is extended to use AA when + // switched on. Advantage is that line geometry is only temporarily used for paint + SAL_DLLPRIVATE void ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo); + + // #i101491# + // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon + // without MetaFile processing + SAL_DLLPRIVATE void ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly); + + // #i101491# + // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check. + SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin); + protected: OutputDevice(); @@ -655,20 +669,20 @@ public: void GetKerningPairs( ULONG nPairs, KerningPair* pKernPairs ) const; BOOL GetTextBoundRect( Rectangle& rRect, - const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, - xub_StrLen nLen = STRING_LEN ) const; + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutline( PolyPolygon&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutlines( PolyPolyVector&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetTextOutlines( ::basegfx::B2DPolyPolygonVector&, const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, - const ULONG nWidth = 0, const sal_Int32* pDXArray = NULL ) const; + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ); diff --git a/vcl/inc/vcl/pngread.hxx b/vcl/inc/vcl/pngread.hxx index 200b52eb6182..285af1407c1c 100644 --- a/vcl/inc/vcl/pngread.hxx +++ b/vcl/inc/vcl/pngread.hxx @@ -65,6 +65,8 @@ namespace vcl std::vector< sal_uInt8 > aData; }; const std::vector< ChunkData >& GetChunks() const; + + void SetIgnoreGammaChunk( sal_Bool b ); }; } diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index fdc7f2ba9c69..b9176f4106dc 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -330,17 +330,12 @@ public: USHORT GetPaperBin() const; BOOL SetPaper( Paper ePaper ); BOOL SetPaperSizeUser( const Size& rSize ); - Paper GetPaper() const; + Paper GetPaper() const; // returns number of available paper formats int GetPaperInfoCount() const; // returns info about paper format nPaper - const vcl::PaperInfo& GetPaperInfo( int nPaper ) const; - // sets current paper to format contained in rInfo - BOOL SetPaperFromInfo( const vcl::PaperInfo& rInfo ); - // gets info about paper fromat best matching current paper - const vcl::PaperInfo& GetCurrentPaperInfo() const; - + const PaperInfo& GetPaperInfo( int nPaper ) const; USHORT GetPaperBinCount() const; XubString GetPaperBinName( USHORT nPaperBin ) const; diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx index 84ef320de20e..681f4f972a7c 100644 --- a/vcl/inc/vcl/prntypes.hxx +++ b/vcl/inc/vcl/prntypes.hxx @@ -33,6 +33,7 @@ #include <tools/string.hxx> #include <vcl/sv.h> +#include <i18npool/paper.hxx> // --------------- // - Duplex Mode - @@ -46,33 +47,6 @@ enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_ON }; enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE }; -// --------- -// - Paper - -// --------- - -typedef USHORT Paper; -#define PAPER_A3 ((Paper)0) -#define PAPER_A4 ((Paper)1) -#define PAPER_A5 ((Paper)2) -#define PAPER_B4 ((Paper)3) -#define PAPER_B5 ((Paper)4) -#define PAPER_LETTER ((Paper)5) -#define PAPER_LEGAL ((Paper)6) -#define PAPER_TABLOID ((Paper)7) -#define PAPER_USER ((Paper)8) - -namespace vcl -{ -struct PaperInfo -{ - String m_aPaperName; // user readable name of paper - unsigned long m_nPaperWidth; // width in mm - unsigned long m_nPaperHeight; // height in mm - - PaperInfo() : m_nPaperWidth( 0 ), m_nPaperHeight( 0 ) {} -}; -} - // ------------------- // - QueueInfo-Types - // ------------------- diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx index a80c5873cbfb..2927215034b5 100644 --- a/vcl/inc/vcl/salprn.hxx +++ b/vcl/inc/vcl/salprn.hxx @@ -68,7 +68,7 @@ struct VCL_DLLPUBLIC SalPrinterQueueInfo class VCL_DLLPUBLIC SalInfoPrinter { public: - std::vector< vcl::PaperInfo > m_aPaperFormats; // all printer supported formats + std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats bool m_bPapersInit; // set to true after InitPaperFormats bool m_bCompatMetrics; diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 5ee27e3aeb31..a7cd61477519 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -139,7 +139,7 @@ private: ULONG mnMenuDelay; ULONG mnFollow; USHORT mnMiddleButtonAction; - BOOL mbNoWheelActionWithoutFocus; + USHORT mnWheelBehavior; BOOL mbAlign1; }; @@ -158,6 +158,10 @@ private: #define MOUSE_MIDDLE_AUTOSCROLL ((USHORT)1) #define MOUSE_MIDDLE_PASTESELECTION ((USHORT)2) +#define MOUSE_WHEEL_DISABLE ((USHORT)0) +#define MOUSE_WHEEL_FOCUS_ONLY ((USHORT)1) +#define MOUSE_WHEEL_ALWAYS ((USHORT)2) + class VCL_DLLPUBLIC MouseSettings { void CopyData(); @@ -257,10 +261,10 @@ public: USHORT GetMiddleButtonAction() const { return mpData->mnMiddleButtonAction; } - void SetNoWheelActionWithoutFocus( BOOL bAction ) - { CopyData(); mpData->mbNoWheelActionWithoutFocus = bAction; } - BOOL GetNoWheelActionWithoutFocus() const - { return mpData->mbNoWheelActionWithoutFocus; } + void SetWheelBehavior( USHORT nBehavior ) + { CopyData(); mpData->mnWheelBehavior = nBehavior; } + USHORT GetWheelBehavior() const + { return mpData->mnWheelBehavior; } const MouseSettings& operator =( const MouseSettings& rSet ); diff --git a/vcl/inc/vcl/sndstyle.hxx b/vcl/inc/vcl/sndstyle.hxx index 2fc568a5e86d..55255171ad9f 100644 --- a/vcl/inc/vcl/sndstyle.hxx +++ b/vcl/inc/vcl/sndstyle.hxx @@ -44,6 +44,6 @@ typedef USHORT SoundType; #define SOUND_ERROR ((SoundType)3) #define SOUND_QUERY ((SoundType)4) -#define SOUND_DISABLE (SOUND_DEFAULT) +#define SOUND_DISABLE ((SoundType)5) #endif // _SV_SNDSTYLE_HXX diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx index 1d4d0fafd7aa..29610e653b9d 100644 --- a/vcl/inc/vcl/syschild.hxx +++ b/vcl/inc/vcl/syschild.hxx @@ -46,7 +46,7 @@ class VCL_DLLPUBLIC SystemChildWindow : public Window { private: using Window::ImplInit; - SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = TRUE ); + SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = FALSE ); // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE SystemChildWindow (const SystemChildWindow &); diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 6f7c18ac2730..3f05383d4f80 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -983,6 +983,8 @@ public: void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly ); // the same, but fills a passed Color with a text color complementing the selection background void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor ); + // support rounded edges in the selection rect + void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor ); void ShowTracking( const Rectangle& rRect, USHORT nFlags = SHOWTRACK_SMALL ); |