1 /* 2 * This file is part of the LibreOffice project. 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 10 * Licensed to the Apache Software Foundation (ASF) under one or more 11 * contributor license agreements. See the NOTICE file distributed 12 * with this work for additional information regarding copyright 13 * ownership. The ASF licenses this file to you under the Apache 14 * License, Version 2.0 (the "License"); you may not use this file 15 * except in compliance with the License. You may obtain a copy of 16 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 17 */ 18 19 #ifndef INCLUDED_SVX_SWFRAMEEXAMPLE_HXX 20 #define INCLUDED_SVX_SWFRAMEEXAMPLE_HXX 21 22 #include <tools/color.hxx> 23 #include <tools/gen.hxx> 24 #include <svx/svxdllapi.h> 25 #include <svx/swframetypes.hxx> 26 #include <vcl/customweld.hxx> 27 #include <com/sun/star/text/WrapTextMode.hpp> 28 29 class SVX_DLLPUBLIC SwFrameExample final : public weld::CustomWidgetController 30 { 31 Color m_aTransColor; ///< transparency 32 Color m_aBgCol; ///< background 33 Color m_aFrameColor; ///< graphic frame 34 Color m_aAlignColor; ///< align anchor 35 Color m_aBorderCol; ///< frame of doc 36 Color m_aPrintAreaCol; ///< frame of printable area of doc 37 Color m_aTxtCol; ///< symbolised text 38 Color m_aBlankCol; ///< area of symbol for blank 39 Color m_aBlankFrameCol; ///< frame of symbol for blank 40 41 tools::Rectangle aPage; 42 tools::Rectangle aPagePrtArea; 43 tools::Rectangle aTextLine; 44 tools::Rectangle aPara; 45 tools::Rectangle aParaPrtArea; 46 tools::Rectangle aFrameAtFrame; 47 tools::Rectangle aDrawObj; 48 tools::Rectangle aAutoCharFrame; 49 Size aFrmSize; 50 51 short nHAlign; 52 short nHRel; 53 54 short nVAlign; 55 short nVRel; 56 57 css::text::WrapTextMode nWrap; 58 RndStdIds nAnchor; 59 bool bTrans; 60 61 Point aRelPos; 62 63 void InitColors_Impl(); 64 void InitAllRects_Impl(vcl::RenderContext& rRenderContext); 65 void CalcBoundRect_Impl(const vcl::RenderContext& rRenderContext, tools::Rectangle &rRect); 66 tools::Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor); 67 68 virtual void StyleUpdated() override; 69 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; 70 public: 71 72 SwFrameExample(); 73 74 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; 75 SetWrap(css::text::WrapTextMode nW)76 void SetWrap(css::text::WrapTextMode nW) { nWrap = nW; } 77 SetHAlign(short nH)78 void SetHAlign(short nH) { nHAlign = nH; } SetHoriRel(short nR)79 void SetHoriRel(short nR) { nHRel = nR; } 80 SetVAlign(short nV)81 void SetVAlign(short nV) { nVAlign = nV; } SetVertRel(short nR)82 void SetVertRel(short nR) { nVRel = nR; } 83 SetTransparent(bool bT)84 void SetTransparent(bool bT) { bTrans = bT; } SetAnchor(RndStdIds nA)85 void SetAnchor(RndStdIds nA) { nAnchor = nA; } 86 87 void SetRelPos(const Point& rP); 88 }; 89 90 91 92 #endif // INCLUDED_SVX_SWFRAMEEXAMPLE_HXX 93 94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 95