update dev300-m58
[ooovba.git] / sd / source / filter / html / htmlattr.cxx
bloba4712440d2aee5604a37461bd8a023e7d7208ed2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlattr.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #ifdef SD_DLLIMPLEMENTATION
35 #undef SD_DLLIMPLEMENTATION
36 #endif
38 #include "htmlattr.hxx"
39 #include "htmlex.hxx"
40 #include <tools/link.hxx>
41 #include <vcl/decoview.hxx>
44 // =====================================================================
45 // =====================================================================
46 SdHtmlAttrPreview::SdHtmlAttrPreview( Window* pParent, const ResId& rResId )
47 :Control( pParent, rResId )
49 // SetMapMode( MAP_100TH_MM );
52 // =====================================================================
53 // =====================================================================
54 SdHtmlAttrPreview::~SdHtmlAttrPreview()
58 // =====================================================================
59 // =====================================================================
60 void SdHtmlAttrPreview::Paint( const Rectangle& rRect )
62 DecorationView aDecoView( this );
64 Rectangle aTextRect;
65 aTextRect.SetSize(GetOutputSize());
67 SetLineColor(m_aBackColor);
68 SetFillColor(m_aBackColor);
69 DrawRect(rRect);
70 SetFillColor();
72 int nHeight = (aTextRect.nBottom - aTextRect.nTop) >> 2;
73 aTextRect.nBottom = nHeight + aTextRect.nTop;
75 SetTextColor(m_aTextColor);
76 DrawText( aTextRect, String(SdResId(STR_HTMLATTR_TEXT)),
77 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
79 aTextRect.Move(0,nHeight);
80 SetTextColor(m_aLinkColor);
81 DrawText( aTextRect, String(SdResId(STR_HTMLATTR_LINK)),
82 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
84 aTextRect.Move(0,nHeight);
85 SetTextColor(m_aALinkColor);
86 DrawText( aTextRect, String(SdResId(STR_HTMLATTR_ALINK)),
87 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
89 aTextRect.Move(0,nHeight);
90 SetTextColor(m_aVLinkColor);
91 DrawText( aTextRect, String(SdResId(STR_HTMLATTR_VLINK)),
92 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
95 // =====================================================================
96 // =====================================================================
97 void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink,
98 Color& aVLink, Color& aALink )
100 m_aBackColor = aBack;
101 m_aTextColor = aText;
102 m_aLinkColor = aLink;
103 m_aVLinkColor = aVLink;
104 m_aALinkColor = aALink;
107 // =====================================================================
108 // =====================================================================
109 void SdHtmlAttrPreview::GetColors( Color& aBack, Color& aText, Color& aLink,
110 Color& aVLink, Color& aALink ) const
112 aBack = m_aBackColor;
113 aText = m_aTextColor;
114 aLink = m_aLinkColor;
115 aVLink = m_aVLinkColor;
116 aALink = m_aALinkColor;