use boost::optional in OutDevState

Change-Id: I83fb85fcba6cd2a5dc4f99fdfd3238d72afb7bc2
Reviewed-on: https://gerrit.libreoffice.org/51770
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2018-03-23 11:52:20 +02:00
parent bea081b509
commit 38e7aef0fa
7 changed files with 25 additions and 28 deletions

View file

@ -36,7 +36,6 @@
#include <vcl/gfxlink.hxx>
#include <vcl/lineinfo.hxx>
#include <vcl/metaactiontypes.hxx>
#include <vcl/outdevstate.hxx>
class SvStream;
enum class DrawTextFlags;

View file

@ -30,6 +30,7 @@
#include <tools/fontenum.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <memory>
#include <boost/optional.hpp>
class Color;
@ -80,17 +81,17 @@ public:
OutDevState();
~OutDevState();
std::unique_ptr<MapMode> mpMapMode;
boost::optional<MapMode> mpMapMode;
bool mbMapActive;
std::unique_ptr<vcl::Region> mpClipRegion;
std::unique_ptr<Color> mpLineColor;
std::unique_ptr<Color> mpFillColor;
boost::optional<Color> mpLineColor;
boost::optional<Color> mpFillColor;
std::unique_ptr<vcl::Font> mpFont;
std::unique_ptr<Color> mpTextColor;
std::unique_ptr<Color> mpTextFillColor;
std::unique_ptr<Color> mpTextLineColor;
std::unique_ptr<Color> mpOverlineColor;
std::unique_ptr<Point> mpRefPoint;
boost::optional<Color> mpTextColor;
boost::optional<Color> mpTextFillColor;
boost::optional<Color> mpTextLineColor;
boost::optional<Color> mpOverlineColor;
boost::optional<Point> mpRefPoint;
TextAlign meTextAlign;
RasterOp meRasterOp;
ComplexTextLayoutFlags mnTextLayoutMode;

View file

@ -29,7 +29,6 @@
#include <vcl/vclenum.hxx>
#include <vcl/font.hxx>
#include <vcl/graphictools.hxx>
#include <vcl/outdevstate.hxx>
#include <vcl/outdev.hxx>
#include <com/sun/star/io/XOutputStream.hpp>

View file

@ -27,7 +27,10 @@ $(eval $(call gb_CppunitTest_use_libraries,sfx2_misc, \
utl \
))
$(eval $(call gb_CppunitTest_use_external,sfx2_misc,libxml2))
$(eval $(call gb_CppunitTest_use_externals,sfx2_misc,\
libxml2 \
boost_headers \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sfx2_misc))

View file

@ -31,17 +31,9 @@
#include <salgdi.hxx>
OutDevState::OutDevState()
: mpMapMode(nullptr)
, mbMapActive(false)
: mbMapActive(false)
, mpClipRegion(nullptr)
, mpLineColor(nullptr)
, mpFillColor(nullptr)
, mpFont(nullptr)
, mpTextColor(nullptr)
, mpTextFillColor(nullptr)
, mpTextLineColor(nullptr)
, mpOverlineColor(nullptr)
, mpRefPoint(nullptr)
, meTextAlign(ALIGN_TOP)
, meRasterOp(RasterOp::OverPaint)
, mnTextLayoutMode(ComplexTextLayoutFlags::Default)
@ -76,27 +68,27 @@ void OutputDevice::Push( PushFlags nFlags )
if (nFlags & PushFlags::LINECOLOR && mbLineColor)
{
pState->mpLineColor.reset( new Color( maLineColor ) );
pState->mpLineColor = maLineColor;
}
if (nFlags & PushFlags::FILLCOLOR && mbFillColor)
{
pState->mpFillColor.reset( new Color( maFillColor ) );
pState->mpFillColor = maFillColor;
}
if ( nFlags & PushFlags::FONT )
pState->mpFont.reset( new vcl::Font( maFont ) );
if ( nFlags & PushFlags::TEXTCOLOR )
pState->mpTextColor.reset( new Color( GetTextColor() ) );
pState->mpTextColor = GetTextColor();
if (nFlags & PushFlags::TEXTFILLCOLOR && IsTextFillColor())
{
pState->mpTextFillColor.reset( new Color( GetTextFillColor() ) );
pState->mpTextFillColor = GetTextFillColor();
}
if (nFlags & PushFlags::TEXTLINECOLOR && IsTextLineColor())
{
pState->mpTextLineColor.reset( new Color( GetTextLineColor() ) );
pState->mpTextLineColor = GetTextLineColor();
}
if (nFlags & PushFlags::OVERLINECOLOR && IsOverlineColor())
{
pState->mpOverlineColor.reset( new Color( GetOverlineColor() ) );
pState->mpOverlineColor = GetOverlineColor();
}
if ( nFlags & PushFlags::TEXTALIGN )
pState->meTextAlign = GetTextAlign();
@ -108,7 +100,7 @@ void OutputDevice::Push( PushFlags nFlags )
pState->meRasterOp = GetRasterOp();
if ( nFlags & PushFlags::MAPMODE )
{
pState->mpMapMode.reset( new MapMode( maMapMode ) );
pState->mpMapMode = maMapMode;
pState->mbMapActive = mbMap;
}
if (nFlags & PushFlags::CLIPREGION && mbClipRegion)
@ -117,7 +109,7 @@ void OutputDevice::Push( PushFlags nFlags )
}
if (nFlags & PushFlags::REFPOINT && mbRefPoint)
{
pState->mpRefPoint.reset( new Point( maRefPoint ) );
pState->mpRefPoint = maRefPoint;
}
mpOutDevStateStack->push_back( pState );

View file

@ -29,6 +29,7 @@ $(eval $(call gb_Library_set_include,writerperfect, \
))
$(eval $(call gb_Library_use_externals,writerperfect,\
boost_headers \
odfgen \
revenge \
))

View file

@ -11,6 +11,8 @@ $(eval $(call gb_Executable_Executable,pdfverify))
$(eval $(call gb_Executable_use_sdk_api,pdfverify))
$(eval $(call gb_Executable_use_external,pdfverify,boost_headers))
$(eval $(call gb_Executable_set_include,pdfverify,\
$$(INCLUDE) \
-I$(SRCDIR)/xmlsecurity/inc \