[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source vcl/unx
include/vcl/filter/PDFiumLibrary.hxx |2 - include/vcl/outdev.hxx |2 - include/vcl/pdfwriter.hxx |2 - include/vcl/textview.hxx |2 - vcl/inc/font/PhysicalFontCollection.hxx|2 - vcl/inc/fontattributes.hxx |6 +-- vcl/inc/pdf/pdfwriter_impl.hxx |2 - vcl/inc/ppdparser.hxx |2 - vcl/inc/sallayout.hxx |2 - vcl/qa/cppunit/PDFiumLibraryTest.cxx |2 - vcl/qa/cppunit/physicalfontcollection.cxx | 52 ++--- vcl/qa/cppunit/physicalfontfamily.cxx |6 +-- vcl/source/bitmap/BitmapPopArtFilter.cxx |1 vcl/source/control/field.cxx | 18 +- vcl/source/control/field2.cxx |8 ++-- vcl/source/edit/textdoc.cxx| 12 +++--- vcl/source/edit/textdoc.hxx|4 +- vcl/source/edit/textview.cxx | 10 ++--- vcl/source/filter/FilterConfigItem.cxx | 11 +++--- vcl/source/filter/svm/SvmConverter.cxx |4 +- vcl/source/filter/wmf/wmfwr.cxx|8 ++-- vcl/source/filter/wmf/wmfwr.hxx|4 +- vcl/source/font/PhysicalFontCollection.cxx | 14 +++ vcl/source/font/PhysicalFontFamily.cxx |4 +- vcl/source/gdi/pdfwriter.cxx |2 - vcl/source/gdi/pdfwriter_impl.cxx |6 +-- vcl/source/gdi/sallayout.cxx |4 +- vcl/source/gdi/textlayout.cxx |4 +- vcl/source/outdev/font.cxx | 10 ++--- vcl/source/pdf/PDFiumTools.cxx | 40 +++--- vcl/source/uitest/uiobject.cxx |5 +- vcl/source/window/dlgctrl.cxx |8 ++-- vcl/source/window/dlgctrl.hxx |2 - vcl/unx/generic/print/printerjob.cxx |6 +-- vcl/unx/generic/printer/ppdparser.cxx | 50 +-- vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 14 +++ 36 files changed, 166 insertions(+), 165 deletions(-) New commits: commit 0fe36103482b6142833731e77b0d074946138538 Author: Noel Grandin AuthorDate: Tue Sep 20 14:50:10 2022 +0200 Commit: Noel Grandin CommitDate: Wed Sep 21 10:20:02 2022 +0200 use more string_view in vcl Change-Id: I66f96a305bb095716023ae1e565950971826bce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140242 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 1dc1382643d0..8140864171eb 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -233,7 +233,7 @@ struct VCL_DLLPUBLIC PDFiumLibrary final // Tools -VCL_DLLPUBLIC OUString convertPdfDateToISO8601(OUString const& rInput); +VCL_DLLPUBLIC OUString convertPdfDateToISO8601(std::u16string_view rInput); } // namespace vcl::pdf diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index d217b786bd15..928f49c3d614 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1137,7 +1137,7 @@ public: boolGetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) const; -sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr, +sal_Int32 HasGlyphs( const vcl::Font& rFont, std::u16string_view rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const; tools::LongGetMinKashida() const; diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 34da05a642da..d1543df7dde2 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -1076,7 +1076,7 @@ The following structure describes the permissions used in PDF security @returns the new structure element's id for use in SetCurrentStructureElement */ - sal_Int32 BeginStructureElement( enum StructElement eType, const OUString& rAlias ); + sal_Int32 BeginStructureElement( enum StructElement eType, std::u16string_view rAlias ); /** end the current logical structure element Close the current structure element. The current element's diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx index 9b7255db8638..903e1b4fae2a 100644 --- a/include/vcl/textview.hxx +++ b/include/vcl/textview.hxx @@ -105,7 +105,7 @@ class VCL_DLLPUBLIC TextView final : public vcl::unohelper::DragAndDropClient voidImpShowDDCursor(); boolImplTruncateNewText( OUString& rNewText ) const; -boolImplCheckTextLen( const OUString& rNewText ) const; +boolImplCheckTextLen( std::u16string_view rNewText ) const; // DragAndDropClient virtual v
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/graphic/GraphicMetadata.hxx| 61 ++ include/vcl/graphicfilter.hxx | 72 +-- vcl/inc/graphic/GraphicFormatDetector.hxx | 112 ++- vcl/qa/cppunit/GraphicFormatDetectorTest.cxx |8 vcl/qa/cppunit/GraphicTest.cxx | 14 - vcl/qa/cppunit/graphicfilter/filters-tiff-test.cxx |3 vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx |3 vcl/source/filter/GraphicFormatDetector.cxx| 128 +++- vcl/source/filter/graphicfilter2.cxx | 212 + 9 files changed, 362 insertions(+), 251 deletions(-) New commits: commit 5e636747faf919e36bfd015c6dfcf0aea0c41938 Author: offtkp AuthorDate: Sat Jul 30 01:47:54 2022 +0300 Commit: Tomaž Vajngerl CommitDate: Wed Aug 10 07:45:01 2022 +0200 Prepare GraphicDescriptor and GraphicFormatDetector for merging Make GraphicFormatDetector return GraphicFileFormat instead of a string and various variable changes so that the two can be combined in future patches. Change-Id: I6e184b3ba52289db02e0d4eebeeadde0ce0433b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137627 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/graphic/GraphicMetadata.hxx b/include/vcl/graphic/GraphicMetadata.hxx new file mode 100644 index ..da27fde01514 --- /dev/null +++ b/include/vcl/graphic/GraphicMetadata.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ +#ifndef INCLUDED_VCL_GRAPHIC_GRAPHICMETADATA_HXX +#define INCLUDED_VCL_GRAPHIC_GRAPHICMETADATA_HXX +// Info class for all supported file formats +enum class GraphicFileFormat +{ +NOT = 0x, +BMP = 0x0001, +GIF = 0x0002, +JPG = 0x0003, +PCD = 0x0004, +PCX = 0x0005, +PNG = 0x0006, +TIF = 0x0007, +XBM = 0x0008, +XPM = 0x0009, +PBM = 0x000a, +PGM = 0x000b, +PPM = 0x000c, +RAS = 0x000d, +TGA = 0x000e, +PSD = 0x000f, +EPS = 0x0010, +WEBP = 0x0011, +MOV = 0x00e0, +PDF = 0x00e1, +DXF = 0x00f1, +MET = 0x00f2, +PCT = 0x00f3, +// retired SGF = 0x00f4, +SVM = 0x00f5, +WMF = 0x00f6, +// retired SGV = 0x00f7, +EMF = 0x00f8, +SVG = 0x00f9, +WMZ = 0x00fa, +EMZ = 0x00fb, +SVGZ = 0x00fc +}; +struct GraphicMetadata +{ +Size maPixSize{}; +Size maLogSize{}; +std::optional maPreferredLogSize = std::nullopt; +std::optional maPreferredMapMode = std::nullopt; +sal_uInt16 mnBitsPerPixel = 0; +sal_uInt16 mnPlanes = 0; +GraphicFileFormat mnFormat = GraphicFileFormat::NOT; +sal_uInt8 mnNumberOfImageComponents = 0; +bool mbIsTransparent = false; +bool mbIsAlpha = false; +}; +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index fb237bc780a4..8985b09eab32 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -25,9 +25,9 @@ #include #include #include +#include #include -#include namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::uno { template class Sequence; } @@ -124,56 +124,12 @@ inline constexpr OUStringLiteral SVG_SHORTNAME = u"SVG"; inline constexpr OUStringLiteral PDF_SHORTNAME = u"PDF"; inline constexpr OUStringLiteral WEBP_SHORTNAME = u"WEBP"; -// Info class for all supported file formats - -enum class GraphicFileFormat -{ -NOT = 0x, -BMP = 0x0001, -GIF = 0x0002, -JPG = 0x0003, -PCD = 0x0004, -PCX = 0x0005, -PNG = 0x0006, -TIF = 0x0007, -XBM = 0x0008, -XPM = 0x0009, -PBM = 0x000a, -PGM = 0x000b, -PPM = 0x000c, -RAS = 0x000d, -TGA = 0x000e, -PSD = 0x000f, -EPS = 0x0010, -WEBP = 0x0011, -DXF = 0x00f1, -MET = 0x00f2, -PCT = 0x00f3, -// retired SGF = 0x00f4, -SVM = 0x00f5, -WMF = 0x00f6, -// retired SGV = 0x00f7, -EMF = 0x00f8, -SVG = 0x00f9 -}; - - class VCL_DLLPUBLIC GraphicDescriptor final { -SvStream* pFileStm; - -OUStringaPathExt; -SizeaPixSize; -SizeaLogSize; -std::optional maPreferredLogSize; -std::optional maPreferredMapMode; -sal_uInt16 nBitsPerPixel; -sal_uInt16 nPlanes; -GraphicFileFormat nFormat; -boolbOwnStream; -sal_uInt8 mnNumberOfImageComponents; -boolbIsTransparent; -boolbIsAlpha; +SvStream*pFileStm; +OUString
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/IconThemeInfo.hxx|4 +- include/vcl/font/FeatureParser.hxx |2 - include/vcl/i18nhelp.hxx |2 - vcl/inc/sallayout.hxx|2 - vcl/qa/cppunit/FontFeatureTest.cxx | 42 +-- vcl/qa/cppunit/app/test_IconThemeInfo.cxx| 10 +++--- vcl/qa/cppunit/app/test_IconThemeScanner.cxx |4 +- vcl/source/app/IconThemeInfo.cxx | 26 vcl/source/app/i18nhelp.cxx |8 ++--- vcl/source/control/field2.cxx| 12 +++ vcl/source/font/FeatureParser.cxx|8 ++--- vcl/source/gdi/CommonSalLayout.cxx |2 - vcl/source/image/ImplImageTree.cxx | 23 +++--- 13 files changed, 73 insertions(+), 72 deletions(-) New commits: commit 239752d358a44d9bd9e5e2a9b7e6084da97d8862 Author: Noel Grandin AuthorDate: Wed Apr 13 14:32:50 2022 +0200 Commit: Noel Grandin CommitDate: Wed Apr 13 16:55:54 2022 +0200 use more string_view in vcl Change-Id: Iabe6c14d17c7805fcc3697cd919234abe3f0a0f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132963 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/IconThemeInfo.hxx b/include/vcl/IconThemeInfo.hxx index ec116ca2f4fc..f061821ceaa1 100644 --- a/include/vcl/IconThemeInfo.hxx +++ b/include/vcl/IconThemeInfo.hxx @@ -51,7 +51,7 @@ public: static Size SizeByThemeName(std::u16string_view); /** Check whether an IconThemeInfo can be constructed from a URL */ -static bool UrlCanBeParsed(const OUString& url); +static bool UrlCanBeParsed(std::u16string_view url); /** Find an icon theme by its id in a vector. * Throws a runtime_error if the theme is not contained in the vector @@ -73,7 +73,7 @@ private: * If the name does not have an underscore in it, the whole name until the last dot is returned, * e.g. default.zip becomes default */ -static OUString FileNameToThemeId(const OUString&); +static OUString FileNameToThemeId(std::u16string_view); /** Creates the display name for the given id of a file. * Currently, we only uppercase the id. diff --git a/include/vcl/font/FeatureParser.hxx b/include/vcl/font/FeatureParser.hxx index 3662c6a20baf..93fe6eabe261 100644 --- a/include/vcl/font/FeatureParser.hxx +++ b/include/vcl/font/FeatureParser.hxx @@ -32,7 +32,7 @@ private: std::vector m_aFeatures; public: -FeatureParser(OUString const& sFontName); +FeatureParser(std::u16string_view sFontName); OUString const& getLanguage() const { return m_sLanguage; } diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx index f48d562c40a9..e5368da08547 100644 --- a/include/vcl/i18nhelp.hxx +++ b/include/vcl/i18nhelp.hxx @@ -63,7 +63,7 @@ public: sal_Int32 CompareString( const OUString& rStr1, const OUString& rStr2 ) const; boolMatchString( const OUString& rStr1, const OUString& rStr2 ) const; -boolMatchMnemonic( const OUString& rString, sal_Unicode cMnemonicChar ) const; +boolMatchMnemonic( std::u16string_view rString, sal_Unicode cMnemonicChar ) const; OUStringGetNum( tools::Long nNumber, sal_uInt16 nDecimals, bool bUseThousandSep = true, bool bTrailingZeros = true ) const; diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 75110158dc53..894be0a3098b 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -154,7 +154,7 @@ private: boolHasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); -voidParseFeatures(const OUString& name); +voidParseFeatures(std::u16string_view name); css::uno::Reference mxBreak; diff --git a/vcl/qa/cppunit/FontFeatureTest.cxx b/vcl/qa/cppunit/FontFeatureTest.cxx index 091654b8a87a..0e9ada19cdd4 100644 --- a/vcl/qa/cppunit/FontFeatureTest.cxx +++ b/vcl/qa/cppunit/FontFeatureTest.cxx @@ -128,11 +128,11 @@ void FontFeatureTest::testGetFontFeatures() void FontFeatureTest::testParseFeature() { { // No font features specified -vcl::font::FeatureParser aParser("Font name with no features"); +vcl::font::FeatureParser aParser(u"Font name with no features"); CPPUNIT_ASSERT_EQUAL(size_t(0), aParser.getFeatures().size()); } { // One feature specified, no value -vcl::font::FeatureParser aParser("Font name:abcd"); +vcl::font::FeatureParser aParser(u"Font name:abcd"); CPPUNIT_ASSERT_EQUAL(size_t(1), aParser.getFeatures().size()); auto aFeatures = aParser.getFeatures(); @@ -140,7 +140,7 @@ void FontFeatureTest::testParseFeature() CPPUNIT_ASSERT_EQUAL(uint32_t(1), aFeatures[0].m_nValue); } { // One feature specified, explicit value -vcl::font::FeatureParser aParser("Font name:abcd=5"); +vcl::font::FeatureParser aParser(u"Font name:abcd=5"); CPPUNIT_ASSER
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/vectorgraphicdata.hxx |5 + vcl/inc/impgraph.hxx |1 + vcl/qa/cppunit/GraphicTest.cxx|8 vcl/source/gdi/impgraph.cxx | 20 +++- 4 files changed, 29 insertions(+), 5 deletions(-) New commits: commit 28beaffba6a0ecaf351c84bed41443a6721d85b6 Author: Tomaž Vajngerl AuthorDate: Wed Jul 29 20:57:40 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Aug 17 13:45:08 2020 +0200 vcl: save and load the page number when swapping the graphic PDF vector graphic includes a page number, of the page that the graphic is rendering. This however isn't remembered when swapping out and back in the graphic, because the serialization format doesn't include it. This adds a version 2 of the serialization format, with an additional page number (page index) attribute. Also changes the GraphicTest to account for an additional 4 bytes written and the change of the checksum. Change-Id: Ic0fbfc4ad983f7880e06956da3b4664bd4b610d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100836 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx index 8fcee6e8..3d30c03d683d 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -113,6 +113,11 @@ public: sal_Int32 getPageIndex() const { return std::max(sal_Int32(0), mnPageIndex); } +void setPageIndex(sal_Int32 nPageIndex) +{ +mnPageIndex = nPageIndex; +} + bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; } }; diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 8b3cc14b7f2d..a65462a48819 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -38,6 +38,7 @@ struct ImpSwapInfo bool mbIsAlpha; sal_uInt32 mnAnimationLoopCount; +sal_Int32 mnPageIndex; }; class OutputDevice; diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 6a70ba921942..3d6d0a79b1a9 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -335,10 +335,10 @@ void GraphicTest::testSwapping() CPPUNIT_ASSERT_EQUAL(true, bool(xStream)); // Check size of the stream -CPPUNIT_ASSERT_EQUAL(sal_uInt64(445), xStream->remainingSize()); +CPPUNIT_ASSERT_EQUAL(sal_uInt64(449), xStream->remainingSize()); std::vector aHash = calculateHash(xStream); - CPPUNIT_ASSERT_EQUAL(std::string("304f17d9c56e79b95f6c337dab88709d4f9b61f0"), + CPPUNIT_ASSERT_EQUAL(std::string("878281e583487b29ae09078e8040c01791c7649a"), toHexString(aHash)); } @@ -407,10 +407,10 @@ void GraphicTest::testSwappingVectorGraphic() CPPUNIT_ASSERT_EQUAL(true, bool(xStream)); // Check size of the stream -CPPUNIT_ASSERT_EQUAL(sal_uInt64(349), xStream->remainingSize()); +CPPUNIT_ASSERT_EQUAL(sal_uInt64(353), xStream->remainingSize()); std::vector aHash = calculateHash(xStream); - CPPUNIT_ASSERT_EQUAL(std::string("88b4c1c359e3cf7be005fbb46c93ffa6de9dcf4a"), + CPPUNIT_ASSERT_EQUAL(std::string("6ae83fc9c06ca253ada0b156d6e4700a4a028c34"), toHexString(aHash)); } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index c40a344ba1da..70609d0b31f8 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -385,6 +385,7 @@ void ImpGraphic::createSwapInfo() maSwapInfo.mbIsTransparent = ImplIsTransparent(); maSwapInfo.mbIsAlpha = ImplIsAlpha(); maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount(); +maSwapInfo.mnPageIndex = getPageNumber(); } void ImpGraphic::ImplClearGraphics() @@ -442,6 +443,9 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint) maSwapInfo.mnAnimationLoopCount = 0; maSwapInfo.mbIsEPS = false; maSwapInfo.mbIsAnimated = bAnimated; + +if (maVectorGraphicData) +maSwapInfo.mnPageIndex = maVectorGraphicData->getPageIndex(); } void ImpGraphic::ImplClear() @@ -1137,6 +1141,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm ) SizeaSize; sal_uInt32 nId; sal_Int32 nType; +sal_Int32 nPageIndex = -1; const SvStreamEndian nOldFormat = rIStm.GetEndian(); boolbRet = false; @@ -1155,6 +1160,11 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm ) TypeSerializer aSerializer(rIStm); aSerializer.readSize(aSize); ReadMapMode( rIStm, aMapMode ); + +if (aCompat.GetVersion() >= 2) +{ +rIStm.ReadInt32(nPageIndex); +} } else { @@ -1253,6 +1263,8 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm ) { ImplSetPrefMapMode( aMapMode ); ImplSetPrefSize( aSize ); +if
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/alpha.hxx| 13 +++-- vcl/inc/bitmapwriteaccess.hxx|2 - vcl/inc/widgetdraw/WidgetDefinition.hxx | 16 +++- vcl/inc/widgetdraw/WidgetDefinitionReader.hxx| 15 ++- vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx |2 - vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 20 ++- vcl/source/gdi/WidgetDefinition.cxx |7 + vcl/source/gdi/WidgetDefinitionReader.cxx| 17 +--- 8 files changed, 67 insertions(+), 25 deletions(-) New commits: commit 983566119c926d0e2478f74548f00a789de55c15 Author: Tomaž Vajngerl AuthorDate: Fri Feb 8 21:56:14 2019 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Mar 5 11:23:41 2019 +0100 Add support for draw definition to draw a SVG image Attribute "source" is used to get the relative path to the image. Path is relative to the definition file. Change-Id: I6ca0c113385e26ad74b928e1f56635b4b0cef995 Reviewed-on: https://gerrit.libreoffice.org/68712 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index b4ec04de031a..b0ea775e1516 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -29,7 +29,7 @@ class BitmapEx; -class VCL_DLLPUBLIC AlphaMask : private Bitmap +class VCL_DLLPUBLIC AlphaMask : public Bitmap { public: @@ -51,23 +51,18 @@ public: voidSetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } -SizeGetSizePixel() const { return Bitmap::GetSizePixel(); } - -BitmapChecksum GetChecksum() const { return Bitmap::GetChecksum(); } - Bitmap const & GetBitmap() const; voidErase( sal_uInt8 cTransparency ); voidReplace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); voidReplace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency ); -BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } -BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } +BitmapReadAccess* AcquireAlphaReadAccess() { return Bitmap::AcquireReadAccess(); } +BitmapWriteAccess* AcquireAlphaWriteAccess() { return Bitmap::AcquireWriteAccess(); } voidReleaseAccess( BitmapReadAccess* pAccess ); -typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess > -ScopedReadAccess; +typedef vcl::ScopedBitmapAccess ScopedReadAccess; using Bitmap::IsEmpty; diff --git a/vcl/inc/bitmapwriteaccess.hxx b/vcl/inc/bitmapwriteaccess.hxx index f20e4e8e2e6e..02ca3f983300 100644 --- a/vcl/inc/bitmapwriteaccess.hxx +++ b/vcl/inc/bitmapwriteaccess.hxx @@ -19,7 +19,7 @@ typedef vcl::ScopedBitmapAccess BitmapScopedWriteAccess; -typedef vcl::ScopedBitmapAccess +typedef vcl::ScopedBitmapAccess AlphaScopedWriteAccess; class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx index f1035c694cfe..d3d6c1413992 100644 --- a/vcl/inc/widgetdraw/WidgetDefinition.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -28,7 +28,8 @@ enum class DrawCommandType { RECTANGLE, CIRCLE, -LINE +LINE, +IMAGE }; class VCL_DLLPUBLIC DrawCommand @@ -102,6 +103,17 @@ public: } }; +class VCL_DLLPUBLIC ImageDrawCommand : public DrawCommand +{ +public: +OUString msSource; + +ImageDrawCommand() +: DrawCommand(DrawCommandType::IMAGE) +{ +} +}; + struct VCL_DLLPUBLIC ControlTypeAndPart { ControlType const meType; @@ -162,6 +174,8 @@ public: void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2, float fY2); + +void addDrawImage(OUString sSource); }; class VCL_DLLPUBLIC WidgetDefinitionPart diff --git a/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx index 53da5e1a3bed..94c7d49e18cd 100644 --- a/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx @@ -22,18 +22,19 @@ namespace vcl class VCL_DLLPUBLIC WidgetDefinitionReader { private: -OUString m_rFilePath; +OUString m_rDefinitionFile; +OUString m_rResourcePath; -static void readDefinition(tools::XmlWalker& rWalker, WidgetDefinition& rWidgetDefinition, - ControlType eType); +void readDefinition(tools::XmlWalker& rWalker, WidgetDefinition& rWidgetDefinition, +ControlType eType); -static void readPart(tools::XmlWalker& rWalker, std::shared_ptr rpPart); +void readPart(tools::XmlWalker& rWalker, std::shared_ptr rpPart); -static void readDrawingDefinition(tools::XmlWalker& rWalker, -
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/bitmapaccess.hxx |5 ++--- vcl/inc/bitmapwriteaccess.hxx |2 +- vcl/qa/cppunit/BitmapTest.cxx | 10 +- vcl/source/filter/igif/gifread.cxx |4 ++-- vcl/source/gdi/bmpacc.cxx |2 +- 5 files changed, 11 insertions(+), 12 deletions(-) New commits: commit 0515ffdb2e4c975f1d19257dfed2a24ff3cbfdb4 Author: Gabor Kelemen AuthorDate: Tue Jan 1 03:42:10 2019 +0100 Commit: Michael Stahl CommitDate: Fri Jan 11 18:00:11 2019 +0100 tdf#114441 Convert use of sal_uLong to sal_uInt32 Convert the return type of GetScanlineSize to sal_uInt32 since the type of the mnScanlineSize member of the BitmapBuffer struct is "long" Convert places that are using the value returned by this method Change-Id: I222ce30b8e8f88402ddfd25286ca3b7548a8e8fb Reviewed-on: https://gerrit.libreoffice.org/65779 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/vcl/bitmapaccess.hxx b/include/vcl/bitmapaccess.hxx index 47eb8cabb31e..cb4c8cb6ad0e 100644 --- a/include/vcl/bitmapaccess.hxx +++ b/include/vcl/bitmapaccess.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_VCL_BMPACC_HXX #define INCLUDED_VCL_BMPACC_HXX -#include #include #include #include @@ -71,11 +70,11 @@ public: return mpBuffer ? RemoveScanline(mpBuffer->mnFormat) : ScanlineFormat::NONE; } -sal_uLong GetScanlineSize() const +sal_uInt32 GetScanlineSize() const { assert(mpBuffer && "Access is not valid!"); -return mpBuffer ? mpBuffer->mnScanlineSize : 0UL; +return mpBuffer ? mpBuffer->mnScanlineSize : 0; } sal_uInt16 GetBitCount() const diff --git a/vcl/inc/bitmapwriteaccess.hxx b/vcl/inc/bitmapwriteaccess.hxx index b2aba128381d..f20e4e8e2e6e 100644 --- a/vcl/inc/bitmapwriteaccess.hxx +++ b/vcl/inc/bitmapwriteaccess.hxx @@ -30,7 +30,7 @@ public: void CopyScanline(long nY, const BitmapReadAccess& rReadAcc); void CopyScanline(long nY, ConstScanline aSrcScanline, ScanlineFormat nSrcScanlineFormat, - sal_uLong nSrcScanlineSize); + sal_uInt32 nSrcScanlineSize); void CopyBuffer(const BitmapReadAccess& rReadAcc); diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index 706fb1f58690..6372b71d55aa 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -347,11 +347,11 @@ void BitmapTest::testConvert() CPPUNIT_ASSERT_EQUAL(static_cast(8), pReadAccess->GetBitCount()); #if defined MACOSX || defined IOS //it would be nice to find and change the stride for quartz to be the same as everyone else -CPPUNIT_ASSERT_EQUAL(static_cast(10), pReadAccess->GetScanlineSize()); +CPPUNIT_ASSERT_EQUAL(static_cast(10), pReadAccess->GetScanlineSize()); #else #if HAVE_FEATURE_OPENGL if (!OpenGLHelper::isVCLOpenGLEnabled()) -CPPUNIT_ASSERT_EQUAL(static_cast(12), pReadAccess->GetScanlineSize()); +CPPUNIT_ASSERT_EQUAL(static_cast(12), pReadAccess->GetScanlineSize()); #endif #endif CPPUNIT_ASSERT(pReadAccess->HasPalette()); @@ -370,18 +370,18 @@ void BitmapTest::testConvert() CPPUNIT_ASSERT_EQUAL(static_cast(24), pReadAccess->GetBitCount()); #if defined LINUX || defined FREEBSD -CPPUNIT_ASSERT_EQUAL(sal_uLong(32), pReadAccess->GetScanlineSize()); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(32), pReadAccess->GetScanlineSize()); #else #if defined(_WIN32) if (!OpenGLHelper::isVCLOpenGLEnabled()) { // GDI Scanlines padded to DWORD multiples, it seems -CPPUNIT_ASSERT_EQUAL(sal_uLong(32), pReadAccess->GetScanlineSize()); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(32), pReadAccess->GetScanlineSize()); } else #endif { -CPPUNIT_ASSERT_EQUAL(sal_uLong(30), pReadAccess->GetScanlineSize()); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(30), pReadAccess->GetScanlineSize()); } #endif diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 745440853f55..3ddcb06c643e 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -561,9 +561,9 @@ void GIFReader::FillImages( const sal_uInt8* pBytes, sal_uLong nCount ) if( ( nMinY > nLastImageY ) && ( nLastImageY < ( nImageHeight - 1 ) ) ) { sal_uInt8* pScanline8 = pAcc8->GetScanline( nYAcc ); -sal_uLong nSize8 = pAcc8->GetScanlineSize(); +sal_uInt32 nSize8 = pAcc8->GetScanlineSize(); sal_uInt8* pScanline1 = nullptr; -sal_uLong nSize1 = 0; +sal_uInt32 nSize1 = 0; if( bGCTransparent ) { diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index 9b
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source vcl/unx vcl/workben
include/vcl/FilterConfigItem.hxx |2 +- include/vcl/bitmap.hxx |2 +- include/vcl/builder.hxx|2 +- include/vcl/dockwin.hxx|2 +- include/vcl/field.hxx |8 include/vcl/graph.hxx |2 +- include/vcl/longcurr.hxx | 12 ++-- include/vcl/pdfextoutdevdata.hxx |2 +- include/vcl/syswin.hxx |2 +- include/vcl/texteng.hxx|2 +- include/vcl/vclevent.hxx |2 +- include/vcl/window.hxx |6 +++--- vcl/inc/brdwin.hxx |2 +- vcl/inc/canvasbitmap.hxx |2 +- vcl/inc/fontattributes.hxx |2 +- vcl/inc/impfont.hxx|2 +- vcl/inc/opengl/x11/salvd.hxx |2 +- vcl/inc/unx/glyphcache.hxx |6 +++--- vcl/inc/unx/gtk/gtkframe.hxx |2 +- vcl/inc/unx/salbmp.h |2 +- vcl/inc/unx/saldisp.hxx|2 +- vcl/inc/unx/salframe.h |2 +- vcl/inc/unx/salgdi.h |2 +- vcl/inc/unx/salvd.h|2 +- vcl/inc/unx/sm.hxx |2 +- vcl/qa/cppunit/lifecycle.cxx |2 +- vcl/source/gdi/pdfextoutdevdata.cxx|2 +- vcl/source/gdi/print3.cxx |2 +- vcl/source/gdi/textlayout.cxx |2 +- vcl/source/window/menufloatingwindow.hxx |2 +- vcl/source/window/window2.cxx |6 +++--- vcl/unx/generic/app/sm.cxx |2 +- vcl/unx/generic/gdi/cairo_xlib_cairo.hxx |2 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx |2 +- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |4 ++-- vcl/workben/vcldemo.cxx|2 +- 36 files changed, 51 insertions(+), 51 deletions(-) New commits: commit d8644c8edb405abd9d71e62e43e898c1d2a28fd2 Author: Noel Grandin Date: Thu Apr 14 09:23:37 2016 +0200 loplugin:passstuffbyref in vcl Change-Id: I17a4dc73c3fc81b0bfebdf442021af65f8f6166c Reviewed-on: https://gerrit.libreoffice.org/24075 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/include/vcl/FilterConfigItem.hxx b/include/vcl/FilterConfigItem.hxx index f12eec5..61bf5e3 100644 --- a/include/vcl/FilterConfigItem.hxx +++ b/include/vcl/FilterConfigItem.hxx @@ -79,7 +79,7 @@ public: voidWriteBool( const OUString& rKey, bool bValue ); voidWriteInt32( const OUString& rKey, sal_Int32 nValue ); -css::uno::Sequence< css::beans::PropertyValue > GetFilterData() const { return aFilterData;} +const css::uno::Sequence< css::beans::PropertyValue >& GetFilterData() const { return aFilterData;} // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator() const; diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index e534d20..31811b9 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -717,7 +717,7 @@ public: public: SAL_DLLPRIVATE void ImplMakeUnique(); -std::shared_ptr ImplGetImpBitmap() const { return mxImpBmp;} +const std::shared_ptr& ImplGetImpBitmap() const { return mxImpBmp; } SAL_DLLPRIVATE void ImplSetImpBitmap( const std::shared_ptr& xImpBmp ); SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap ); diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 1af5bc5..928e512 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -106,7 +106,7 @@ public: static void reorderWithinParent(std::vector< vcl::Window*>& rChilds, bool bIsButtonBox); static void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition); -css::uno::Reference getFrame() { return m_xFrame; } +const css::uno::Reference& getFrame() { return m_xFrame; } private: VclBuilder(const VclBuilder&) = delete; diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index e126c3e..48413b4 100644 --- a/include/vcl/dockwin.hxx +++ b/include/vcl/dockwin.hxx @@ -135,7 +135,7 @@ public: voidToggleFloatingMode(); voidSetDragArea( const Rectangle& rRect ); -Rectangle GetDragArea() const { return maDragArea;} +const Rectangle& GetDragArea() const { return maDragArea;} voidLock(); voidUnlock(); diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 62db9fb..75f8207 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -586,9 +586,9 @@ public: virtual vo
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |2 ++ vcl/inc/impfont.hxx |7 --- vcl/qa/cppunit/font.cxx | 14 ++ vcl/source/font/font.cxx |5 + 4 files changed, 25 insertions(+), 3 deletions(-) New commits: commit 231d5c7db8188d53c6aab441b7080d3fa1a01446 Author: Chris Sherlock Date: Fri Jan 22 15:29:27 2016 +1100 vcl: add orientation flag property to Font class Add getter and setter for orientation flag to the Font class. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test added to vcl/qa/cppunit/font.cxx to test this flag. Change-Id: I62d5a47f870702eeac4625830dd279dd53fbcc3d Reviewed-on: https://gerrit.libreoffice.org/21696 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index b728f87..87a9d87 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -89,6 +89,7 @@ public: boolIsBuiltInFont() const; boolCanEmbed() const; boolCanSubset() const; +boolCanRotate() const; voidSetQuality(int); voidIncreaseQualityBy(int); @@ -98,6 +99,7 @@ public: voidSetBuiltInFontFlag(bool); voidSetEmbeddableFlag(bool); voidSetSubsettableFlag(bool); +voidSetOrientationFlag(bool); // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 52b9a1b..c6667ef 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -77,12 +77,12 @@ public: boolIsBuiltInFont() const { return mbDevice; } boolCanEmbed() const{ return mbEmbeddable; } boolCanSubset() const { return mbSubsettable; } -/* Missing function: bool CanRotate() const; */ +boolCanRotate() const { return mbRotatable; } voidSetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } voidSetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; } voidSetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; } -/* missing function: void SetOrientationFlag( bool ); */ +voidSetOrientationFlag( bool bCanRotate ) { mbRotatable = bCanRotate; } booloperator==( const ImplFont& ) const; @@ -121,7 +121,8 @@ private: mbTransparent:1,// compatibility, now on output device mbDevice:1, mbEmbeddable:1, -mbSubsettable:1; +mbSubsettable:1, +mbRotatable:1; // is "rotatable" even a word?!? I'll keep it for consistency for now int mnQuality; OUStringmaMapNames; diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 656d089..5a8ad83 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -30,6 +30,7 @@ public: void testBuiltInFontFlag(); void testEmbeddableFontFlag(); void testSubsettableFontFlag(); +void testOrientationFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -42,6 +43,7 @@ public: CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testEmbeddableFontFlag); CPPUNIT_TEST(testSubsettableFontFlag); +CPPUNIT_TEST(testOrientationFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -146,6 +148,18 @@ void VclFontTest::testSubsettableFontFlag() CPPUNIT_ASSERT_EQUAL( true, aFont.CanSubset() ); } + +void VclFontTest::testOrientationFlag() +{ +vcl::Font aFont; + +CPPUNIT_ASSERT_EQUAL( false, aFont.CanRotate() ); + +aFont.SetOrientationFlag( true ); +CPPUNIT_ASSERT_EQUAL( true, aFont.CanRotate() ); +} + + void VclFontTest::testSymbolFlagAndCharSet() { // default constructor should set scalable flag to false diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 554cdb4..6890ca6 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -824,6 +824,9 @@ bool Font::CanEmbed() const { return mpImplFont->CanEmbed(); } void Font::SetEmbeddableFlag( bool bEmbeddable ) { mpImplFont->SetEmbeddableFlag( bEmbeddable ); } bool Font::CanSubset() const { return mpImplFont->CanSubset(); } void Font::SetSubsettableFlag( bool bSubsettable ) { mpImplFont->SetSubsettableFlag( bSubsettable ); } +bool Font::CanRotate() const { retu
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |2 ++ vcl/inc/impfont.hxx | 11 ++- vcl/qa/cppunit/font.cxx | 13 + vcl/source/font/font.cxx |4 4 files changed, 25 insertions(+), 5 deletions(-) New commits: commit a5372932f787534d15d4e36ee8c297f3c6ac0888 Author: Chris Sherlock Date: Thu Jan 21 15:13:22 2016 +1100 vcl: add subsettable flag property functions to Font class Added getter and setter for subsettable flag property to the Font class. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test added to vcl/qa/cppunit/font.cxx to test this flag. Change-Id: I2a66f1c4876698e1ffeaf260b2b43d5308b71191 Reviewed-on: https://gerrit.libreoffice.org/21651 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 8cb34b6..498c6a5 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -87,6 +87,7 @@ public: boolIsBuiltInFont() const; boolCanEmbed() const; +boolCanSubset() const; voidSetQuality(int); voidIncreaseQualityBy(int); @@ -94,6 +95,7 @@ public: voidSetBuiltInFontFlag(bool); voidSetEmbeddableFlag(bool); +voidSetSubsettableFlag(bool); // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index cc87b2e..e522c28 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -37,8 +37,8 @@ public: // device independent font functions const OUString& GetFamilyName() const { return maFamilyName; } -FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } -FontFamily GetFamilyTypeNoAsk() const { return meFamily; } +FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } +FontFamily GetFamilyTypeNoAsk() const { return meFamily; } const OUString& GetStyleName() const{ return maStyleName; } FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } @@ -75,7 +75,7 @@ public: boolIsBuiltInFont() const { return mbDevice; } boolCanEmbed() const{ return mbEmbeddable; } -/* Missing function: bool CanSubSet() const; */ +boolCanSubset() const { return mbSubsettable; } /* Missing function: bool CanRotate() const; */ /* Missing function: bool HasMapNames() const; */ @@ -84,7 +84,7 @@ public: voidSetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } voidSetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; } -/* Missing function: void SetSettableFlag( bool ); */ +voidSetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; } /* missing function: void SetOrientationFlag( bool ); */ booloperator==( const ImplFont& ) const; @@ -123,7 +123,8 @@ private: mbVertical:1, mbTransparent:1,// compatibility, now on output device mbDevice:1, -mbEmbeddable:1; +mbEmbeddable:1, +mbSubsettable:1; int mnQuality; friend SvStream&ReadImplFont( SvStream& rIStm, ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index a57395c0..656d089 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -29,6 +29,7 @@ public: void testQuality(); void testBuiltInFontFlag(); void testEmbeddableFontFlag(); +void testSubsettableFontFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -40,6 +41,7 @@ public: CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testEmbeddableFontFlag); +CPPUNIT_TEST(testSubsettableFontFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -133,6 +135,17 @@ void VclFontTest::testEmbeddableFontFlag() CPPUNIT_ASSERT_EQUAL( true, aFont.CanEmbed() ); } + +void VclFontTest::testSubsettableFontFlag() +{ +vcl::Font aFont; + +CPPUNIT_ASSERT_EQUAL( false, aFont.CanSubset() ); + +aFont.SetS
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |2 ++ vcl/inc/impfont.hxx |9 + vcl/qa/cppunit/font.cxx | 12 vcl/source/font/font.cxx |4 4 files changed, 23 insertions(+), 4 deletions(-) New commits: commit abf04f6b0ad0dd83b4d479723144593e2f83ede0 Author: Chris Sherlock Date: Thu Jan 21 15:00:08 2016 +1100 vcl: add embeddable font property functions to Font class Added setter and getter for embeddable font property to the Font class. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test added to vcl/qa/cppunit/font.cxx to test this flag. Change-Id: I7f4ddf09d4a122c7c335b017efcb95f1774ae0d8 Reviewed-on: https://gerrit.libreoffice.org/21650 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 51ce742..dc7ab9e 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -86,12 +86,14 @@ public: int GetQuality() const; boolIsBuiltInFont() const; +boolCanEmbed() const; voidSetQuality(int); voidIncreaseQualityBy(int); voidDecreaseQualityBy(int); voidSetBuiltInFontFlag(bool); +voidSetEmbeddableFlag(bool); // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index e7475e1..4cd79dc 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -63,6 +63,7 @@ public: voidSetItalic( const FontItalic eItalic ) { meItalic = eItalic; } voidSetWeight( const FontWeight eWeight ) { meWeight = eWeight; } voidSetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; } +voidSetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; } voidSetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; } @@ -75,7 +76,7 @@ public: /* Missing function: OUString GetMapNames() const; */ boolIsBuiltInFont() const { return mbDevice; } -/* Missing function: bool CanEmbed() const; */ +boolCanEmbed() const{ return mbEmbeddable; } /* Missing function: bool CanSubSet() const; */ /* Missing function: bool CanRotate() const; */ /* Missing function: bool HasMapNames() const; */ @@ -84,10 +85,9 @@ public: /* Missing function: void AddMapName( OUString const& ); */ voidSetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } -/* Missing function: void SetEmbeddableFlag( bool ); */ +voidSetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; } /* Missing function: void SetSettableFlag( bool ); */ /* missing function: void SetOrientationFlag( bool ); */ -voidSetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; } booloperator==( const ImplFont& ) const; @@ -124,7 +124,8 @@ private: mbShadow:1, mbVertical:1, mbTransparent:1,// compatibility, now on output device -mbDevice:1; +mbDevice:1, +mbEmbeddable:1; int mnQuality; friend SvStream&ReadImplFont( SvStream& rIStm, ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 224c8cd..a57395c0 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -28,6 +28,7 @@ public: void testItalic(); void testQuality(); void testBuiltInFontFlag(); +void testEmbeddableFontFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -38,6 +39,7 @@ public: CPPUNIT_TEST(testItalic); CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testBuiltInFontFlag); +CPPUNIT_TEST(testEmbeddableFontFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -121,6 +123,16 @@ void VclFontTest::testBuiltInFontFlag() CPPUNIT_ASSERT_EQUAL( true, aFont.IsBuiltInFont() ); } +void VclFontTest::testEmbeddableFontFlag() +{ +vcl::Font aFont; + +CPPUNIT_ASSERT_EQUAL( false, aFont.CanEmbed() ); + +aFont.SetEmbeddableFlag( true ); +CPPUNIT_ASSERT_EQUAL( true, aFont.CanEmbed() ); +} + void VclFontTest::testSymbolFlagAndCharSet() { // default constructor should set scalable flag to false diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 7c9e9a2..6022ebb 100644 --
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |4 vcl/inc/impfont.hxx |7 --- vcl/qa/cppunit/font.cxx | 11 +++ vcl/source/font/font.cxx |4 4 files changed, 23 insertions(+), 3 deletions(-) New commits: commit 137c440ccddbc9b41b8a8997820b7c0253b4de64 Author: Chris Sherlock Date: Wed Jan 20 23:41:06 2016 +1100 vcl: add built in font property functions to Font class Added setter for built-in font property and IsBuiltInFontFlag to Font class. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test added to vcl/qa/cppunit/font.cxx to test this flag. Change-Id: I61ce33fe6ffb31be22c68ce8a94d0886ebdc8fcf Reviewed-on: https://gerrit.libreoffice.org/21627 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 19acdc6..51ce742 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -85,10 +85,14 @@ public: // Device dependent functions int GetQuality() const; +boolIsBuiltInFont() const; + voidSetQuality(int); voidIncreaseQualityBy(int); voidDecreaseQualityBy(int); +voidSetBuiltInFontFlag(bool); + // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles const Color&GetColor() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 26616930..e7475e1 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -74,7 +74,7 @@ public: voidDecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } /* Missing function: OUString GetMapNames() const; */ -/* Missing function: bool IsBuiltInFont() const; */ +boolIsBuiltInFont() const { return mbDevice; } /* Missing function: bool CanEmbed() const; */ /* Missing function: bool CanSubSet() const; */ /* Missing function: bool CanRotate() const; */ @@ -83,7 +83,7 @@ public: /* Missing function: void SetNames( OUString const& ); */ /* Missing function: void AddMapName( OUString const& ); */ -/* Missing function: void SetBuiltInFontFlag( bool ); */ +voidSetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } /* Missing function: void SetEmbeddableFlag( bool ); */ /* Missing function: void SetSettableFlag( bool ); */ /* missing function: void SetOrientationFlag( bool ); */ @@ -123,7 +123,8 @@ private: mbConfigLookup:1, // there was a config lookup mbShadow:1, mbVertical:1, -mbTransparent:1;// compatibility, now on output device +mbTransparent:1,// compatibility, now on output device +mbDevice:1; int mnQuality; friend SvStream&ReadImplFont( SvStream& rIStm, ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 5649b32..224c8cd 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -27,6 +27,7 @@ public: void testPitch(); void testItalic(); void testQuality(); +void testBuiltInFontFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -36,6 +37,7 @@ public: CPPUNIT_TEST(testPitch); CPPUNIT_TEST(testItalic); CPPUNIT_TEST(testQuality); +CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -109,6 +111,15 @@ void VclFontTest::testQuality() CPPUNIT_ASSERT_EQUAL( (int)50, aFont.GetQuality() ); } +void VclFontTest::testBuiltInFontFlag() +{ +vcl::Font aFont; + +CPPUNIT_ASSERT_EQUAL( false, aFont.IsBuiltInFont() ); + +aFont.SetBuiltInFontFlag( true ); +CPPUNIT_ASSERT_EQUAL( true, aFont.IsBuiltInFont() ); +} void VclFontTest::testSymbolFlagAndCharSet() { diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index e24eb8a..7c9e9a2 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -813,6 +813,8 @@ void Font::SetQuality( int nQuality ) { mpImplFont->SetQuality( nQuality ); } void Font::IncreaseQualityBy( int nQualityAmount ) { mpImplFont->IncreaseQualityBy( nQualityAmount ); } void Font::DecreaseQualityBy( int nQualityAmount ) { mpImplFont->DecreaseQualityBy( nQualityAmount ); } +bool Font::IsBuiltInFont() const { return mpImplFont->IsBuiltInFont(); } +void Font::SetBuiltInFontFlag( bool bIsBuiltInFontFlag ) { mpImplFont->SetBuiltInFontFlag( bIsBuiltInFontFlag ); } bool Font::IsOutline() const { return mpImplFont->mbOutline; } bool Font::IsShadow() const { return mpImplFont->mbSha
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |2 ++ vcl/inc/fontattributes.hxx |2 +- vcl/inc/impfont.hxx|8 +--- vcl/qa/cppunit/font.cxx|8 +++- vcl/source/font/font.cxx | 30 -- 5 files changed, 31 insertions(+), 19 deletions(-) New commits: commit ab6f80909877f1e14de252c456dd2acd84c43974 Author: Chris Sherlock Date: Wed Jan 20 20:47:19 2016 +1100 vcl: add more property functions to Font Added increase and decrease quality functions to Font class, and also charset mutator and accessor function. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit test change in vcl/qa/cppunit/font.cxx: - enhanced to check increase and decrease quality functions Change-Id: I2f5970438f6ef1ad185163d5fdcec5bbc88912a4 Reviewed-on: https://gerrit.libreoffice.org/21622 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 920f069..19acdc6 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -86,6 +86,8 @@ public: int GetQuality() const; voidSetQuality(int); +voidIncreaseQualityBy(int); +voidDecreaseQualityBy(int); // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx index cd53400..0168a32 100644 --- a/vcl/inc/fontattributes.hxx +++ b/vcl/inc/fontattributes.hxx @@ -50,6 +50,7 @@ public: voidSetItalic(const FontItalic eItalic ){ meItalic = eItalic; } voidSetWeight(const FontWeight eWeight ){ meWeight = eWeight; } voidSetWidthType(const FontWidth eWidthType){ meWidthType = eWidthType; } +voidSetCharSet( const rtl_TextEncoding ); voidSetSymbolFlag(const bool ); @@ -89,7 +90,6 @@ public: voidSetEmbeddableFlag ( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; } voidSetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; } voidSetOrientationFlag( bool bCanRotate ) { mbOrientation = bCanRotate; } -voidSetCharSet( const rtl_TextEncoding ); private: // device independent variables diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index c425ea7..26616930 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -51,6 +51,7 @@ public: FontPitch GetPitchNoAsk() const { return mePitch; } FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; } FontWidth GetWidthTypeNoAsk() const { return meWidthType; } +rtl_TextEncodingGetCharSet() const { return meCharSet; } boolIsSymbolFont() const{ return mbSymbol; } @@ -68,9 +69,9 @@ public: // device dependent functions int GetQuality() const { return mnQuality; } -voidSetQuality( int nQuality ) { mnQuality = nQuality; } -voidIncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } -voidDecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } +voidSetQuality( int nQuality ) { mnQuality = nQuality; } +voidIncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } +voidDecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } /* Missing function: OUString GetMapNames() const; */ /* Missing function: bool IsBuiltInFont() const; */ @@ -86,6 +87,7 @@ public: /* Missing function: void SetEmbeddableFlag( bool ); */ /* Missing function: void SetSettableFlag( bool ); */ /* missing function: void SetOrientationFlag( bool ); */ +voidSetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; } booloperator==( const ImplFont& ) const; diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index f4fcf18..5649b32 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -100,7 +100,13 @@ void VclFontTest::testQuality() CPPUNIT_ASSERT_EQUAL( (int)0, aFont.GetQuality() ); aFont.SetQuality( 100 ); -CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality()); +CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality() ); + +aFont.IncreaseQualityBy( 50 ); +CPPUNIT_ASSERT_EQUAL( (int)150, aFont.GetQua
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |5 + vcl/inc/impfont.hxx|7 ++- vcl/qa/cppunit/font.cxx| 13 + vcl/source/font/font.cxx | 29 +++-- vcl/source/outdev/font.cxx |1 + 5 files changed, 32 insertions(+), 23 deletions(-) New commits: commit 94b7876e43a88618364c8256f0645e70d0daae6f Author: Chris Sherlock Date: Tue Jan 19 14:10:02 2016 +1100 vcl: add quality accessor & mutator to Font Change-Id: I261c717cabf966b8b20b8e6c921b38f4cd73e268 Reviewed-on: https://gerrit.libreoffice.org/21597 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index bf50ab7..920f069 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -82,6 +82,11 @@ public: voidSetSymbolFlag( bool ); +// Device dependent functions +int GetQuality() const; + +voidSetQuality(int); + // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles const Color&GetColor() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index f9c006f..aaad50a2 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -66,7 +66,11 @@ public: voidSetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; } // device dependent functions -/* Missing function: int GetQuality() const; */ +int GetQuality() const { return mnQuality; } + +voidSetQuality( int nQuality ) { mnQuality = nQuality; } +voidIncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; } +voidDecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } /* Missing function: OUString GetMapNames() const; */ /* Missing function: bool IsBuiltInFont() const; */ @@ -121,6 +125,7 @@ private: mbShadow:1, mbVertical:1, mbTransparent:1;// compatibility, now on output device +int mnQuality; friend SvStream&ReadImplFont( SvStream& rIStm, ImplFont& ); friend SvStream&WriteImplFont( SvStream& rOStm, const ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index a8532a9..f4fcf18 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -26,6 +26,7 @@ public: void testWidthType(); void testPitch(); void testItalic(); +void testQuality(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -34,6 +35,7 @@ public: CPPUNIT_TEST(testWidthType); CPPUNIT_TEST(testPitch); CPPUNIT_TEST(testItalic); +CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -91,6 +93,17 @@ void VclFontTest::testPitch() CPPUNIT_ASSERT_EQUAL_MESSAGE( "Pitch should be PITCH_FIXED", FontPitch::PITCH_FIXED, aFont.GetPitch()); } +void VclFontTest::testQuality() +{ +vcl::Font aFont; + +CPPUNIT_ASSERT_EQUAL( (int)0, aFont.GetQuality() ); + +aFont.SetQuality( 100 ); +CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality()); +} + + void VclFontTest::testSymbolFlagAndCharSet() { // default constructor should set scalable flag to false diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 8cca361..7fe618a 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -771,41 +771,29 @@ Font Font::identifyFont( const void* i_pBuffer, sal_uInt32 i_nSize ) // The inlines from the font.hxx header are now instantiated for pImpl-ification const Color& Font::GetColor() const { return mpImplFont->maColor; } - const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; } - bool Font::IsTransparent() const { return mpImplFont->mbTransparent; } FontAlign Font::GetAlign() const { return mpImplFont->meAlign; } const OUString& Font::GetFamilyName() const { return mpImplFont->GetFamilyName(); } - const OUString& Font::GetStyleName() const { return mpImplFont->maStyleName; } const Size& Font::GetSize() const { return mpImplFont->maSize; } - void Font::SetHeight( long nHeight ) { SetSize( Size( mpImplFont->maSize.Width(), nHeight ) ); } - long Font::GetHeight() const { return mpImplFont->maSize.Height(); } - void Font::SetWidth( long nWidth ) { SetSize( Size( nWidth, mpImplFont->maSize.Height() ) ); } - long Font::GetWidth() const { return mpImplFont->maSize.Width(); } rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->meCharSet; } const LanguageTag& Font::GetLanguageTag() const { return mpImplFont->maLanguageTag; } - const LanguageTag& Font::GetCJKContextLanguageTag() const { return mpImplFont->maCJKLanguageTag; } - LanguageType Font::GetLanguage() cons
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/font.hxx |5 ++ vcl/inc/impfont.hxx |9 vcl/qa/cppunit/font.cxx | 63 ++ vcl/source/font/font.cxx | 86 --- 4 files changed, 120 insertions(+), 43 deletions(-) New commits: commit bb3fc6cda5700e64eec3233737765e0ab55f5b9e Author: Chris Sherlock Date: Sat Jan 16 12:24:17 2016 +1100 vcl: created accessors and mutators for font classes Font accessors: - GetFamily() - GetPitch() - GetWidthType() - GetWeight() - GetItalic() - GetName() <--- shouldn't that be GetFamilyName()?!? - GetStyleName() Font mutators did not need to be added. Font unit tests are testing: - Setting and getting FontFamily private member - Setting and getting FontPitch private member - Setting and getting FontWidth private member - Setting and getting FontWeight private member - Setting and getting FontItalic private member - Setting and getting the family name and style ImplFont accessors: - GetFamilyNoAsk() - GetPitchNoAsk() - GetWidthTypeNoAsk() - GetWeightNoAsk() - GetItalicNoAsk() - GetFamilyName() - GetStyleName() (These "NoAsk" functions are necessary because the default getters call on a function that checks the configuration for default values, something that is not wanted in all cases). Change-Id: Icfbc8b4e5253d55a80892df050b0803dfc7d7c9f Reviewed-on: https://gerrit.libreoffice.org/21501 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 04052ad..c8a2c2d 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -78,6 +78,7 @@ public: longGetWidth() const; voidSetFamily( FontFamily ); +FontFamily GetFamily(); FontFamily GetFamily() const; voidSetCharSet( rtl_TextEncoding ); rtl_TextEncodingGetCharSet() const; @@ -94,6 +95,7 @@ public: voidSetCJKContextLanguage( LanguageType ); LanguageTypeGetCJKContextLanguage() const; voidSetPitch( FontPitch ePitch ); +FontPitch GetPitch(); FontPitch GetPitch() const; voidSetOrientation( short nLineOrientation ); @@ -105,10 +107,13 @@ public: boolIsKerning() const; voidSetWeight( FontWeight ); +FontWeight GetWeight(); FontWeight GetWeight() const; voidSetWidthType( FontWidth ); +FontWidth GetWidthType(); FontWidth GetWidthType() const; voidSetItalic( FontItalic ); +FontItalic GetItalic(); FontItalic GetItalic() const; voidSetOutline( bool bOutline ); boolIsOutline() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index a4d9e25..54b4cf8 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -38,14 +38,21 @@ public: // device independent font functions const OUString& GetFamilyName() const { return maFamilyName; } FontFamily GetFamily() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } +FontFamily GetFamilyNoAsk() const { return meFamily; } FontFamily GetFamilyType() { return GetFamily(); } +FontFamily GetFamilyTypeNoAsk() const { return GetFamilyNoAsk(); } const OUString& GetStyleName() const{ return maStyleName; } FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } +FontWeight GetWeightNoAsk() const { return meWeight; } FontItalic GetSlantType() { return GetItalic(); } +FontItalic GetSlantType() const{ return GetItalicNoAsk(); } FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } +FontItalic GetItalicNoAsk() const { return meItalic; } FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW)AskConfig(); return mePitch; } -FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW)AskConfig(); return meWidthType; } +FontPitch GetPitchNoAsk() const { return mePitch; } +FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); ret
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/metric.hxx|1 + vcl/inc/impfont.hxx |1 + vcl/qa/cppunit/fontmetric.cxx | 13 - vcl/source/gdi/metric.cxx |5 + vcl/source/outdev/font.cxx|2 +- 5 files changed, 20 insertions(+), 2 deletions(-) New commits: commit 1ccece2f322eae35601bf09c57ea583f8b270574 Author: Chris Sherlock Date: Thu Jan 14 09:11:20 2016 +1100 vcl: Create mutator for bullet offset attribute in FontMetric Mutator created for bullet offset attribute in FontMetric. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can get and set bullet offset attribute - check equality operator on FontMetric after setting bullet offset attribute Change-Id: I87a76982a8b3ed697664299cb340fa35fb514c0e diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index f2b84b2..9c2015b 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -60,6 +60,7 @@ public: voidSetInternalLeading(long); voidSetLineHeight(long); voidSetSlant(long); +voidSetBulletOffset(long); boolIsScalable() const; boolIsFullstopCentered() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index ee66fad..8ff0aab 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -129,6 +129,7 @@ public: voidSetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } voidSetLineHeight( long nHeight ) { mnLineHeight = nHeight; } voidSetSlant( long nSlant ) { mnSlant = nSlant; } +voidSetBulletOffset( long nOffset ) { mnBulletOffset = nOffset; } boolIsScalable() const { return mbScalableFont; } boolIsFullstopCentered() const { return mbFullstopCentered; } diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index 2865743..4f82adc 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -28,6 +28,7 @@ public: void testBuiltInFontFlag(); void testSpacings(); void testSlant(); +void testBulletOffset(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); @@ -36,6 +37,7 @@ public: CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testSpacings); CPPUNIT_TEST(testSlant); +CPPUNIT_TEST(testBulletOffset); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -104,7 +106,6 @@ void VclFontMetricTest::testSpacings() CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetLineHeight(), 100L ); } - void VclFontMetricTest::testSlant() { // default constructor should set scalable flag to false @@ -116,6 +117,16 @@ void VclFontMetricTest::testSlant() CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 45L ); } +void VclFontMetricTest::testBulletOffset() +{ +// default constructor should set scalable flag to false +FontMetric aFontMetric; + +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetBulletOffset(), 0L ); + +aFontMetric.SetBulletOffset( 45 ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetBulletOffset(), 45L ); +} void VclFontMetricTest::testEqualityOperator() { diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index a91bd9f..a24cc3f 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -183,6 +183,11 @@ long FontMetric::GetBulletOffset() const return mpImplMetric->GetBulletOffset(); } +void FontMetric::SetBulletOffset( long nOffset ) +{ +mpImplMetric->SetBulletOffset( nOffset ); +} + bool FontMetric::IsScalable() const { return mpImplMetric->IsScalable(); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 9267a4c..a38af4a 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -215,7 +215,7 @@ FontMetric OutputDevice::GetFontMetric() const aMetric.SetBuiltInFontFlag( pFontAttributes->IsBuiltInFont() ); aMetric.SetScalableFlag( pFontAttributes->IsScalable() ); aMetric.SetFullstopCenteredFlag( pFontAttributes->IsFullstopCentered() ); -aMetric.mpImplMetric->mnBulletOffset = pFontAttributes->GetBulletOffset(); +aMetric.SetBulletOffset( pFontAttributes->GetBulletOffset() ); aMetric.SetAscent( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + mnEmphasisAscent ) ); aMetric.SetDescent( ImplDevicePixelToLogicHeight( pFontAttributes->GetDescent() + mnEmphasisDescent ) ); aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontAttributes->GetInternalLeading() + mnEmphasisAscent ) ); ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/metric.hxx|1 + vcl/inc/impfont.hxx |1 + vcl/qa/cppunit/fontmetric.cxx | 19 +++ vcl/source/gdi/metric.cxx |5 + vcl/source/outdev/font.cxx|2 +- 5 files changed, 27 insertions(+), 1 deletion(-) New commits: commit 71d5ffba4434538e7897b288ddfa2e0a6df03dd2 Author: Chris Sherlock Date: Thu Jan 14 08:51:33 2016 +1100 vcl: Create mutator for slant attribute in FontMetric Mutator created for slant attribute in FontMetric. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can get and set slant attribute - check equality operator on FontMetric after setting slant attribute Change-Id: I5490a40dba4c86386d59a42f2d04303b3fc4d536 diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index e4e6661..f2b84b2 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -59,6 +59,7 @@ public: voidSetExternalLeading(long); voidSetInternalLeading(long); voidSetLineHeight(long); +voidSetSlant(long); boolIsScalable() const; boolIsFullstopCentered() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index e0a1ca1..ee66fad 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -128,6 +128,7 @@ public: voidSetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } voidSetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } voidSetLineHeight( long nHeight ) { mnLineHeight = nHeight; } +voidSetSlant( long nSlant ) { mnSlant = nSlant; } boolIsScalable() const { return mbScalableFont; } boolIsFullstopCentered() const { return mbFullstopCentered; } diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index 3093783..2865743 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -27,6 +27,7 @@ public: void testFullstopCenteredFlag(); void testBuiltInFontFlag(); void testSpacings(); +void testSlant(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); @@ -34,6 +35,7 @@ public: CPPUNIT_TEST(testFullstopCenteredFlag); CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testSpacings); +CPPUNIT_TEST(testSlant); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -103,6 +105,18 @@ void VclFontMetricTest::testSpacings() } +void VclFontMetricTest::testSlant() +{ +// default constructor should set scalable flag to false +FontMetric aFontMetric; + +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 0L ); + +aFontMetric.SetSlant( 45 ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 45L ); +} + + void VclFontMetricTest::testEqualityOperator() { // default constructor should set scalable flag to false @@ -142,6 +156,11 @@ void VclFontMetricTest::testEqualityOperator() aRhs.SetDescent( 100 ); CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS == aRhs failed", aLhs == aRhs ); CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); + +aLhs.SetSlant( 100 ); +aRhs.SetSlant( 100 ); +CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS == aRhs failed", aLhs == aRhs ); +CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); } diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 1b7206f..a91bd9f 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -173,6 +173,11 @@ long FontMetric::GetSlant() const return mpImplMetric->GetSlant(); } +void FontMetric::SetSlant( long nSlant ) +{ +mpImplMetric->SetSlant( nSlant ); +} + long FontMetric::GetBulletOffset() const { return mpImplMetric->GetBulletOffset(); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 2165677..9267a4c 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -222,7 +222,7 @@ FontMetric OutputDevice::GetFontMetric() const // OutputDevice has its own external leading function due to #i60945# aMetric.SetExternalLeading( ImplDevicePixelToLogicHeight( GetFontExtLeading() ) ); aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + pFontAttributes->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) ); -aMetric.mpImplMetric->mnSlant= ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ); +aMetric.SetSlant( ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ) ); SAL_INFO("vcl.gdi.fontmetric", "Ou
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/metric.hxx|2 + vcl/inc/impfont.hxx |2 + vcl/qa/cppunit/fontmetric.cxx | 43 +- vcl/source/gdi/metric.cxx | 10 + 4 files changed, 52 insertions(+), 5 deletions(-) New commits: commit f8ffe2ff7a654052e0e2d6cb168841025bcc2f25 Author: Chris Sherlock Date: Thu Jan 14 07:48:48 2016 +1100 vcl: Create accessor and mutator for ascent and descent in FontMetric Accessor and mutator created for ascent and descent spacing in FontMetric. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can set font ascent and descent spacing - check equality operator on FontMetric after setting both ascent and descent font spacing Change-Id: I714363b14bdc61ddfa37a619fe4b03f4e4e96f7a Reviewed-on: https://gerrit.libreoffice.org/21458 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index 2c8d9f2..0a7d0e6 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -54,6 +54,8 @@ public: longGetSlant() const; longGetBulletOffset() const; +voidSetAscent(long); +voidSetDescent(long); voidSetExternalLeading(long); voidSetInternalLeading(long); diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 0b9577a..182f4e8 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -123,6 +123,8 @@ public: longGetSlant() const{ return mnSlant; } longGetBulletOffset() const { return mnBulletOffset; } +voidSetAscent( long nAscent ) { mnAscent = nAscent; } +voidSetDescent( long nDescent ) { mnDescent = nDescent; } voidSetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } voidSetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index 316e03d..07fc0e6 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -8,6 +8,8 @@ */ #include +#include +#include #include #include @@ -24,6 +26,7 @@ public: void testScalableFlag(); void testFullstopCenteredFlag(); void testBuiltInFontFlag(); +void testSpacings(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); @@ -31,6 +34,7 @@ public: CPPUNIT_TEST(testFullstopCenteredFlag); CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testEqualityOperator); +CPPUNIT_TEST(testSpacings); CPPUNIT_TEST_SUITE_END(); }; @@ -70,6 +74,30 @@ void VclFontMetricTest::testBuiltInFontFlag() CPPUNIT_ASSERT_MESSAGE( "Built-in font flag should be true", aFontMetric.IsBuiltInFont() ); } +void VclFontMetricTest::testSpacings() +{ +// default constructor should set scalable flag to false +FontMetric aFontMetric; + +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetAscent(), 0L ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetDescent(), 0L ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetExternalLeading(), 0L ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetInternalLeading(), 0L ); + +aFontMetric.SetAscent( 100 ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetAscent(), 100L ); + +aFontMetric.SetDescent( 100 ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetDescent(), 100L ); + +aFontMetric.SetExternalLeading( 100L ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetExternalLeading(), 100L ); + +aFontMetric.SetInternalLeading( 100L ); +CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetInternalLeading(), 100L ); +} + + void VclFontMetricTest::testEqualityOperator() { // default constructor should set scalable flag to false @@ -77,33 +105,38 @@ void VclFontMetricTest::testEqualityOperator() aLhs.SetScalableFlag(true); aRhs.SetScalableFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs == aRhs failed", aLhs == aRhs ); CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) ); aLhs.SetFullstopCenteredFlag(true); aRhs.SetFullstopCenteredFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs == aRhs failed", aLhs == aRhs ); CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) ); aLhs.SetBuiltInFontFlag(true); aRhs.SetBuiltInFontFlag(true); - CPPUNIT_ASSERT_MESSAGE( "Builtin font flag set same, aLHS == aRhs failed", aLhs == aRhs ); CPPUNIT_ASSERT_MESSAGE( "Builtin font fla
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/metric.hxx|2 ++ vcl/inc/impfont.hxx | 10 +++--- vcl/qa/cppunit/fontmetric.cxx | 21 +++-- vcl/source/gdi/metric.cxx | 17 ++--- vcl/source/outdev/font.cxx|6 ++ 5 files changed, 44 insertions(+), 12 deletions(-) New commits: commit e3746c66929f4f038d1dee58b4fa222fb3c31951 Author: Chris Sherlock Date: Wed Jan 13 17:14:53 2016 +1100 vcl: Create accessor and mutator for builtin font flag in FontMetric Accessor and mutator created for builtin font flag, removed the existing bit field. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can set builtin font flag - check equality operator on FontMetric after setting builtin font flag Change-Id: Iac3f4270f86d10f9dcd0bb6e3951c0e983a4f22f Reviewed-on: https://gerrit.libreoffice.org/21414 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index f3de018..7b3694d 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -56,9 +56,11 @@ public: boolIsScalable() const; boolIsFullstopCentered() const; +boolIsBuiltInFont() const; voidSetScalableFlag(bool); voidSetFullstopCenteredFlag(bool); +voidSetBuiltInFontFlag(bool); FontMetric& operator=( const FontMetric& rMetric ); booloperator==( const FontMetric& rMetric ) const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 5367a77..13c7801 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -106,11 +106,12 @@ private: boolmbScalableFont; boolmbFullstopCentered; +boolmbDevice; // TODO: As these are progressively moved from bit fields into boolean variables, comment them out. // Eventually this enum will not be needed and we can remove it. enum { -DEVICE_FLAG=1, +/* DEVICE_FLAG=1, */ /* SCALABLE_FLAG=2, */ LATIN_FLAG=4, CJK_FLAG=8, @@ -136,9 +137,12 @@ public: boolIsScalable() const { return mbScalableFont; } boolIsFullstopCentered() const { return mbFullstopCentered; } +boolIsBuiltInFont() const { return mbDevice; } + +voidSetScalableFlag( bool bScalable ) { mbScalableFont = bScalable; } +voidSetFullstopCenteredFlag( bool bCentered ) { mbFullstopCentered = bCentered; } +voidSetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } -voidSetScalableFlag(bool bScalable) { mbScalableFont = bScalable; } -voidSetFullstopCenteredFlag(bool bCentered) { mbFullstopCentered = bCentered; } }; diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index 1428cfb..f434ae0 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -23,11 +23,13 @@ public: void testScalableFlag(); void testFullstopCenteredFlag(); +void testBuiltInFontFlag(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); CPPUNIT_TEST(testScalableFlag); CPPUNIT_TEST(testFullstopCenteredFlag); +CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -44,7 +46,6 @@ void VclFontMetricTest::testScalableFlag() CPPUNIT_ASSERT_MESSAGE( "Scalable flag should be true", aFontMetric.IsScalable() ); } - void VclFontMetricTest::testFullstopCenteredFlag() { // default constructor should set scalable flag to false @@ -57,6 +58,17 @@ void VclFontMetricTest::testFullstopCenteredFlag() CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be true", aFontMetric.IsFullstopCentered() ); } +void VclFontMetricTest::testBuiltInFontFlag() +{ +// default constructor should set scalable flag to false +FontMetric aFontMetric; + +CPPUNIT_ASSERT_MESSAGE( "Built-in font flag should be false after default constructor called", !aFontMetric.IsBuiltInFont() ); + +aFontMetric.SetBuiltInFontFlag(true); + +CPPUNIT_ASSERT_MESSAGE( "Built-in font flag should be true", aFontMetric.IsBuiltInFont() ); +} void VclFontMetricTest::testEqualityOperator() { @@ -71,7 +83,12 @@ void VclFontMetricTest::testEqualityOperator() aLhs.SetFullstopCenteredFlag(true); aRhs.SetFullstopCenteredFlag(true); -CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same", aLhs == aRhs ); +CPPUNIT_ASSERT_MESSAGE( "Scalable font flag set same", aLhs == aRhs ); +
[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
include/vcl/metric.hxx|4 +++- vcl/inc/impfont.hxx | 10 ++ vcl/qa/cppunit/fontmetric.cxx | 21 + vcl/source/gdi/metric.cxx | 21 ++--- vcl/source/outdev/font.cxx|3 +-- 5 files changed, 45 insertions(+), 14 deletions(-) New commits: commit bfd690701ff414496ad77c2b268bf7200947dc3a Author: Chris Sherlock Date: Wed Jan 13 12:13:12 2016 +1100 vcl: Create accessor and mutator for full stop centered in FontMetric Accessor and mutator created for full stop centered flag, removed bit field. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can set full stop centered flag - check equality operator on FontMetric after setting full stop centered flag Change-Id: I9cacb0fbf9ea65cfebcaebdc9f0481c0a796cbcf Reviewed-on: https://gerrit.libreoffice.org/21413 Reviewed-by: Chris Sherlock Tested-by: Chris Sherlock diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index e289b72..f3de018 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -52,11 +52,13 @@ public: longGetExtLeading() const; longGetLineHeight() const; longGetSlant() const; +longGetBulletOffset() const; + boolIsScalable() const; boolIsFullstopCentered() const; -longGetBulletOffset() const; voidSetScalableFlag(bool); +voidSetFullstopCenteredFlag(bool); FontMetric& operator=( const FontMetric& rMetric ); booloperator==( const FontMetric& rMetric ) const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 376c0cb..5367a77 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -105,6 +105,7 @@ private: sal_uInt32 mnRefCount;// Reference Counter boolmbScalableFont; +boolmbFullstopCentered; // TODO: As these are progressively moved from bit fields into boolean variables, comment them out. // Eventually this enum will not be needed and we can remove it. @@ -113,8 +114,8 @@ private: /* SCALABLE_FLAG=2, */ LATIN_FLAG=4, CJK_FLAG=8, -CTL_FLAG=16, -FULLSTOP_CENTERED_FLAG=32 +CTL_FLAG=16 +/* FULLSTOP_CENTERED_FLAG=32 */ }; public: @@ -131,12 +132,13 @@ public: longGetExtLeading() const { return mnExtLeading; } longGetLineHeight() const { return mnLineHeight; } longGetSlant() const{ return mnSlant; } +longGetBulletOffset() const { return mnBulletOffset; } boolIsScalable() const { return mbScalableFont; } -boolIsFullstopCentered() const { return ((mnMiscFlags & FULLSTOP_CENTERED_FLAG ) != 0); } -longGetBulletOffset() const { return mnBulletOffset; } +boolIsFullstopCentered() const { return mbFullstopCentered; } voidSetScalableFlag(bool bScalable) { mbScalableFont = bScalable; } +voidSetFullstopCenteredFlag(bool bCentered) { mbFullstopCentered = bCentered; } }; diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index b7db7df..1428cfb 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -22,10 +22,12 @@ public: VclFontMetricTest() : BootstrapFixture(true, false) {} void testScalableFlag(); +void testFullstopCenteredFlag(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); CPPUNIT_TEST(testScalableFlag); +CPPUNIT_TEST(testFullstopCenteredFlag); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -42,6 +44,20 @@ void VclFontMetricTest::testScalableFlag() CPPUNIT_ASSERT_MESSAGE( "Scalable flag should be true", aFontMetric.IsScalable() ); } + +void VclFontMetricTest::testFullstopCenteredFlag() +{ +// default constructor should set scalable flag to false +FontMetric aFontMetric; + +CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be false after default constructor called", !aFontMetric.IsFullstopCentered() ); + +aFontMetric.SetFullstopCenteredFlag(true); + +CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be true", aFontMetric.IsFullstopCentered() ); +} + + void VclFontMetricTest::testEqualityOperator() { // default constructor should set scalable flag to false @@ -51,6 +67,11 @@ void VclFontMetricTest::testE