Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/sdr/overlay/overlayrollingrectangle.hxx>
30 : : #include <tools/gen.hxx>
31 : : #include <vcl/outdev.hxx>
32 : : #include <basegfx/matrix/b2dhommatrix.hxx>
33 : : #include <svx/sdr/overlay/overlaytools.hxx>
34 : : #include <svx/sdr/overlay/overlaymanager.hxx>
35 : : #include <basegfx/polygon/b2dpolygontools.hxx>
36 : : #include <basegfx/polygon/b2dpolygon.hxx>
37 : : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
38 : :
39 : : //////////////////////////////////////////////////////////////////////////////
40 : :
41 : : namespace sdr
42 : : {
43 : : namespace overlay
44 : : {
45 : 0 : drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
46 : : {
47 : 0 : drawinglayer::primitive2d::Primitive2DSequence aRetval;
48 : :
49 [ # # ][ # # ]: 0 : if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
[ # # ][ # # ]
50 : : {
51 : 0 : const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
52 : 0 : const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
53 : 0 : const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
54 [ # # ]: 0 : const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
55 : :
56 [ # # ]: 0 : if(getShowBounds())
57 : : {
58 : : // view-independent part, create directly
59 [ # # ]: 0 : const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle));
60 : : const drawinglayer::primitive2d::Primitive2DReference aReference(
61 : : new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
62 : : aPolygon,
63 : : aRGBColorA,
64 : : aRGBColorB,
65 [ # # ][ # # ]: 0 : fStripeLengthPixel));
[ # # ]
66 : :
67 [ # # ][ # # ]: 0 : drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
68 : : }
69 : :
70 [ # # ]: 0 : if(getExtendedLines())
71 : : {
72 : : // view-dependent part, use helper primitive
73 : : const drawinglayer::primitive2d::Primitive2DReference aReference(
74 : : new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
75 : : aRollingRectangle,
76 : : aRGBColorA,
77 : : aRGBColorB,
78 [ # # ][ # # ]: 0 : fStripeLengthPixel));
[ # # ]
79 : :
80 [ # # ]: 0 : drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
81 : 0 : }
82 : : }
83 : :
84 : 0 : return aRetval;
85 : : }
86 : :
87 : 0 : void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
88 : : {
89 : : // react on OverlayManager's stripe definition change
90 : 0 : objectChange();
91 : 0 : }
92 : :
93 : 0 : OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
94 : : const basegfx::B2DPoint& rBasePos,
95 : : const basegfx::B2DPoint& rSecondPos,
96 : : bool bExtendedLines,
97 : : bool bShowBounds)
98 : : : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
99 : : maSecondPosition(rSecondPos),
100 : : mbExtendedLines(bExtendedLines),
101 [ # # ]: 0 : mbShowBounds(bShowBounds)
102 : : {
103 : 0 : }
104 : :
105 : 0 : OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
106 : : {
107 [ # # ]: 0 : }
108 : :
109 : 0 : void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
110 : : {
111 [ # # ]: 0 : if(rNew != maSecondPosition)
112 : : {
113 : : // remember new value
114 : 0 : maSecondPosition = rNew;
115 : :
116 : : // register change (after change)
117 : 0 : objectChange();
118 : : }
119 : 0 : }
120 : : } // end of namespace overlay
121 : : } // end of namespace sdr
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|