1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // ============================================================================ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef SC_XLTRACER_HXX 27cdf0e10cSrcweir #define SC_XLTRACER_HXX 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "global.hxx" // ScAddress 30cdf0e10cSrcweir #include "xltools.hxx" 31cdf0e10cSrcweir 32cdf0e10cSrcweir // As Trace features become implemented, we can safely delete the enum entry as 33cdf0e10cSrcweir // we use the member mnID to keep track of the actual trace tag ID value. 34cdf0e10cSrcweir enum XclTracerId 35cdf0e10cSrcweir { 36cdf0e10cSrcweir eUnKnown , /// unused but allows us to set the correct index 37cdf0e10cSrcweir eRowLimitExceeded , 38cdf0e10cSrcweir eTabLimitExceeded , 39cdf0e10cSrcweir ePassword , 40cdf0e10cSrcweir ePrintRange , 41cdf0e10cSrcweir eShortDate , 42cdf0e10cSrcweir eBorderLineStyle , 43cdf0e10cSrcweir eFillPattern , 44cdf0e10cSrcweir eInvisibleGrid , 45cdf0e10cSrcweir eFormattedNote , 46cdf0e10cSrcweir eFormulaExtName , 47cdf0e10cSrcweir eFormulaMissingArg , 48cdf0e10cSrcweir ePivotDataSource , 49cdf0e10cSrcweir ePivotChartExists , 50cdf0e10cSrcweir eChartUnKnownType , 51cdf0e10cSrcweir eChartTrendLines , 52cdf0e10cSrcweir eChartErrorBars , 53cdf0e10cSrcweir eChartOnlySheet , 54cdf0e10cSrcweir eChartRange , 55cdf0e10cSrcweir eChartDSName, 56cdf0e10cSrcweir eChartDataTable, 57cdf0e10cSrcweir eChartLegendPosition, 58cdf0e10cSrcweir eChartTextFormatting, 59cdf0e10cSrcweir eChartEmbeddedObj, 60cdf0e10cSrcweir eChartAxisAuto, 61cdf0e10cSrcweir eChartAxisManual, 62cdf0e10cSrcweir eChartInvalidXY, 63cdf0e10cSrcweir eUnsupportedObject , 64cdf0e10cSrcweir eObjectNotPrintable , 65cdf0e10cSrcweir eDVType, 66cdf0e10cSrcweir eTraceLength /// this *should* always be the final entry 67cdf0e10cSrcweir }; 68cdf0e10cSrcweir 69cdf0e10cSrcweir struct XclTracerDetails 70cdf0e10cSrcweir { 71cdf0e10cSrcweir XclTracerId meProblemId; /// Excel Import Trace index. 72cdf0e10cSrcweir sal_uInt32 mnID; /// actual ID Index trace tag Value 73cdf0e10cSrcweir const sal_Char* mpContext; /// Context for problem e.g. Limits 74cdf0e10cSrcweir const sal_Char* mpDetail; /// Context Detail e.g. SheetX 75cdf0e10cSrcweir const sal_Char* mpProblem; /// Description of problem 76cdf0e10cSrcweir }; 77cdf0e10cSrcweir 78cdf0e10cSrcweir 79cdf0e10cSrcweir // ============================================================================ 80cdf0e10cSrcweir 81cdf0e10cSrcweir class MSFilterTracer; 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** This class wraps an MSFilterTracer to create trace logs for import/export filters. */ 84cdf0e10cSrcweir class XclTracer 85cdf0e10cSrcweir { 86cdf0e10cSrcweir public: 87cdf0e10cSrcweir explicit XclTracer( const String& rDocUrl, const ::rtl::OUString& rConfigPath ); 88cdf0e10cSrcweir virtual ~XclTracer(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** Returns true, if tracing is enabled. */ IsEnabled() const91cdf0e10cSrcweir inline bool IsEnabled() const { return mbEnabled; } 92cdf0e10cSrcweir 93cdf0e10cSrcweir /** Adds an attribute to be traced with the next Trace() call. */ 94cdf0e10cSrcweir void AddAttribute( const ::rtl::OUString& rName, const ::rtl::OUString& rValue ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir /** Creates an element including all attributes set up to this call. 97cdf0e10cSrcweir @descr Removes all attributes after the element is traced. */ 98cdf0e10cSrcweir void Trace( const ::rtl::OUString& rElementID, const ::rtl::OUString& rMessage ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir /** Calls Trace() with a known document properties problem. */ 101cdf0e10cSrcweir void TraceLog( XclTracerId eProblem, sal_Int32 nValue = 0 ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir /** Calls AddAttribute() to create the Context & Detail for known problems. */ 104cdf0e10cSrcweir void Context( XclTracerId eProblem, SCTAB nTab = 0 ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir /** Ensure that particular traces are logged once per document. */ 107cdf0e10cSrcweir void ProcessTraceOnce(XclTracerId eProblem, SCTAB nTab = 0); 108cdf0e10cSrcweir 109cdf0e10cSrcweir void TraceInvalidAddress(const ScAddress& rPos, const ScAddress& rMaxPos); 110cdf0e10cSrcweir void TraceInvalidRow( SCTAB nTab, sal_uInt32 nRow, sal_uInt32 nMaxrow ); 111cdf0e10cSrcweir void TraceInvalidTab( SCTAB nTab, SCTAB nMaxTab); 112cdf0e10cSrcweir void TracePrintRange(); 113cdf0e10cSrcweir void TraceDates(sal_uInt16 nNumFmt); 114cdf0e10cSrcweir void TraceBorderLineStyle(bool bBorderLineStyle); 115cdf0e10cSrcweir void TraceFillPattern(bool bFillPattern); 116cdf0e10cSrcweir void TraceFormulaMissingArg(); 117cdf0e10cSrcweir void TracePivotDataSource(bool bExternal); 118cdf0e10cSrcweir void TracePivotChartExists(); 119cdf0e10cSrcweir void TraceChartUnKnownType(); 120cdf0e10cSrcweir void TraceChartOnlySheet(); 121cdf0e10cSrcweir void TraceChartDataTable(); 122cdf0e10cSrcweir void TraceChartLegendPosition(); 123cdf0e10cSrcweir void TraceChartEmbeddedObj(); 124cdf0e10cSrcweir void TraceUnsupportedObjects(); 125cdf0e10cSrcweir void TraceObjectNotPrintable(); 126cdf0e10cSrcweir void TraceDVType(bool bType); 127cdf0e10cSrcweir 128cdf0e10cSrcweir /** Returns the SVX filter tracer for usage in external code (i.e. Escher). */ GetBaseTracer()129cdf0e10cSrcweir inline MSFilterTracer& GetBaseTracer() { return *mpTracer; } 130cdf0e10cSrcweir 131cdf0e10cSrcweir private: 132cdf0e10cSrcweir typedef ::std::auto_ptr< MSFilterTracer > MSFilterTracerPtr; 133cdf0e10cSrcweir MSFilterTracerPtr mpTracer; 134cdf0e10cSrcweir bool mbEnabled; 135cdf0e10cSrcweir typedef ::std::vector< bool > BoolVec; 136cdf0e10cSrcweir /** array of flags corresponding to each entry in the XclTracerDetails table. */ 137cdf0e10cSrcweir BoolVec maFirstTimes; 138cdf0e10cSrcweir }; 139cdf0e10cSrcweir 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ============================================================================ 142cdf0e10cSrcweir 143cdf0e10cSrcweir #endif 144cdf0e10cSrcweir 145