1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #pragma once 20 21 #include <com/sun/star/uno/Reference.hxx> 22 23 #include <vector> 24 25 namespace chart { class ChartModel; } 26 namespace com::sun::star::awt { struct Rectangle; } 27 namespace com::sun::star::awt { struct Size; } 28 namespace com::sun::star::chart2 { class XLegend; } 29 namespace com::sun::star::drawing { class XShape; } 30 namespace com::sun::star::drawing { class XShapes; } 31 namespace com::sun::star::lang { class XMultiServiceFactory; } 32 namespace com::sun::star::uno { class XComponentContext; } 33 34 namespace chart 35 { 36 37 class LegendEntryProvider; 38 39 class VLegend 40 { 41 public: 42 VLegend( const css::uno::Reference< css::chart2::XLegend > & xLegend, 43 const css::uno::Reference< css::uno::XComponentContext > & xContext, 44 const std::vector< LegendEntryProvider* >& rLegendEntryProviderList, 45 const css::uno::Reference< css::drawing::XShapes >& xTargetPage, 46 const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, 47 ChartModel& rModel ); 48 49 void setDefaultWritingMode( sal_Int16 nDefaultWritingMode ); 50 51 void createShapes( const css::awt::Size & rAvailableSpace, 52 const css::awt::Size & rPageSize, 53 css::awt::Size & rDefaultLegendSize ); 54 55 /** Sets the position according to its internal anchor. 56 57 @param rOutAvailableSpace 58 is modified by the method, if the legend is in a standard position, 59 such that the space allocated by the legend is removed from it. 60 61 @param rReferenceSize 62 is used to calculate the offset (default 2%) from the edge. 63 */ 64 void changePosition( 65 css::awt::Rectangle & rOutAvailableSpace, 66 const css::awt::Size & rReferenceSize, 67 const css::awt::Size & rDefaultLegendSize ); 68 69 static bool isVisible( 70 const css::uno::Reference< css::chart2::XLegend > & xLegend ); 71 72 private: 73 css::uno::Reference< css::drawing::XShapes > m_xTarget; 74 css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; 75 css::uno::Reference< css::chart2::XLegend > m_xLegend; 76 css::uno::Reference< css::drawing::XShape > m_xShape; 77 78 ChartModel& mrModel; 79 80 css::uno::Reference< css::uno::XComponentContext > m_xContext; 81 82 std::vector< LegendEntryProvider* > m_aLegendEntryProviderList; 83 84 sal_Int16 m_nDefaultWritingMode;//to be used when writing mode is set to page 85 }; 86 87 } //namespace chart 88 89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 90