2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-30 12:23:25 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
#include "scitems.hxx"
|
2011-11-18 21:03:31 +00:00
|
|
|
#include <comphelper/string.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
#include <svx/algitem.hxx>
|
2003-03-26 17:07:02 +00:00
|
|
|
#include <svtools/colorcfg.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/editview.hxx>
|
|
|
|
#include <editeng/editstat.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/escapementitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/flditem.hxx>
|
|
|
|
#include <editeng/numitem.hxx>
|
2010-10-05 11:19:10 -04:00
|
|
|
#include <editeng/justifyitem.hxx>
|
2013-08-08 17:18:29 +02:00
|
|
|
#include <editeng/editobj.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/outdev.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/inethist.hxx>
|
|
|
|
#include <unotools/syslocale.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2012-05-04 23:45:24 -04:00
|
|
|
#include <com/sun/star/text/textfield/Type.hpp>
|
2012-05-08 16:08:02 -04:00
|
|
|
#include <com/sun/star/document/XDocumentProperties.hpp>
|
2012-05-04 23:45:24 -04:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
#include "editutil.hxx"
|
|
|
|
#include "global.hxx"
|
|
|
|
#include "attrib.hxx"
|
|
|
|
#include "document.hxx"
|
|
|
|
#include "docpool.hxx"
|
|
|
|
#include "patattr.hxx"
|
2001-05-11 15:20:22 +00:00
|
|
|
#include "scmod.hxx"
|
|
|
|
#include "inputopt.hxx"
|
2009-07-03 11:00:47 +00:00
|
|
|
#include "compiler.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2012-05-04 23:45:24 -04:00
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
// Delimiters zusaetzlich zu EditEngine-Default:
|
|
|
|
|
2015-03-20 13:49:00 +02:00
|
|
|
ScEditUtil::ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
|
|
|
|
const Point& rScrPosPixel,
|
|
|
|
OutputDevice* pDevice, double nScaleX, double nScaleY,
|
|
|
|
const Fraction& rX, const Fraction& rY ) :
|
|
|
|
pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
|
|
|
|
aScrPos(rScrPosPixel),pDev(pDevice),
|
|
|
|
nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY) {}
|
|
|
|
|
2013-05-20 07:30:19 -03:00
|
|
|
OUString ScEditUtil::ModifyDelimiters( const OUString& rOld )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-11-18 21:03:31 +00:00
|
|
|
// underscore is used in function argument names
|
2016-07-01 13:20:11 +02:00
|
|
|
OUString aRet = rOld.replaceAll("_", "") +
|
2014-12-15 10:14:25 +01:00
|
|
|
"=()+-*/^&<>" +
|
2013-05-20 07:30:19 -03:00
|
|
|
ScCompiler::GetNativeSymbol(ocSep); // argument separator is localized.
|
2000-09-18 23:16:46 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2013-07-25 15:33:49 +02:00
|
|
|
static OUString lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nParCount = rEngine.GetParagraphCount();
|
2013-07-25 15:33:49 +02:00
|
|
|
OUStringBuffer aRet( nParCount * 80 );
|
2013-05-08 18:12:32 +02:00
|
|
|
for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if (nPar > 0)
|
2013-07-25 15:33:49 +02:00
|
|
|
aRet.append(c);
|
|
|
|
aRet.append( rEngine.GetText( nPar ));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2013-07-25 15:33:49 +02:00
|
|
|
return aRet.makeStringAndClear();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 17:18:29 +02:00
|
|
|
static OUString lcl_GetDelimitedString( const EditTextObject& rEdit, const sal_Char c )
|
|
|
|
{
|
|
|
|
sal_Int32 nParCount = rEdit.GetParagraphCount();
|
|
|
|
OUStringBuffer aRet( nParCount * 80 );
|
|
|
|
for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
|
|
|
|
{
|
|
|
|
if (nPar > 0)
|
|
|
|
aRet.append(c);
|
|
|
|
aRet.append( rEdit.GetText( nPar ));
|
|
|
|
}
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2013-07-25 15:33:49 +02:00
|
|
|
OUString ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
|
2009-05-18 15:28:50 +00:00
|
|
|
{
|
|
|
|
return lcl_GetDelimitedString(rEngine, ' ');
|
|
|
|
}
|
2013-07-25 15:33:49 +02:00
|
|
|
OUString ScEditUtil::GetMultilineString( const EditEngine& rEngine )
|
2009-05-18 15:28:50 +00:00
|
|
|
{
|
|
|
|
return lcl_GetDelimitedString(rEngine, '\n');
|
|
|
|
}
|
|
|
|
|
2013-08-08 17:18:29 +02:00
|
|
|
OUString ScEditUtil::GetMultilineString( const EditTextObject& rEdit )
|
|
|
|
{
|
|
|
|
return lcl_GetDelimitedString(rEdit, '\n');
|
|
|
|
}
|
|
|
|
|
2013-07-25 15:33:49 +02:00
|
|
|
OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocument* pDoc )
|
2013-03-22 19:49:41 -04:00
|
|
|
{
|
2013-07-25 15:33:49 +02:00
|
|
|
// ScFieldEditEngine is needed to resolve field contents.
|
|
|
|
if (pDoc)
|
2013-03-22 19:49:41 -04:00
|
|
|
{
|
2013-07-25 15:33:49 +02:00
|
|
|
/* TODO: make ScDocument::GetEditEngine() const? Most likely it's only
|
|
|
|
* not const because of the pointer assignment, make that mutable, and
|
|
|
|
* then remove the ugly const_cast here. */
|
|
|
|
EditEngine& rEE = const_cast<ScDocument*>(pDoc)->GetEditEngine();
|
|
|
|
rEE.SetText( rEditText);
|
|
|
|
return GetMultilineString( rEE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
static osl::Mutex aMutex;
|
|
|
|
osl::MutexGuard aGuard( aMutex);
|
|
|
|
EditEngine& rEE = ScGlobal::GetStaticFieldEditEngine();
|
|
|
|
rEE.SetText( rEditText);
|
|
|
|
return GetMultilineString( rEE);
|
2013-03-22 19:49:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-27 15:53:09 -04:00
|
|
|
EditTextObject* ScEditUtil::CreateURLObjectFromURL( ScDocument& rDoc, const OUString& rURL, const OUString& rText )
|
|
|
|
{
|
|
|
|
SvxURLField aUrlField( rURL, rText, SVXURLFORMAT_APPDEFAULT);
|
|
|
|
EditEngine& rEE = rDoc.GetEditEngine();
|
|
|
|
rEE.SetText( EMPTY_OUSTRING );
|
2013-05-08 18:12:32 +02:00
|
|
|
rEE.QuickInsertField( SvxFieldItem( aUrlField, EE_FEATURE_FIELD ),
|
|
|
|
ESelection( EE_PARA_MAX_COUNT, EE_TEXTPOS_MAX_COUNT ) );
|
2013-03-27 15:53:09 -04:00
|
|
|
|
|
|
|
return rEE.CreateTextObject();
|
|
|
|
}
|
|
|
|
|
2013-03-27 20:35:34 -04:00
|
|
|
void ScEditUtil::RemoveCharAttribs( EditTextObject& rEditText, const ScPatternAttr& rAttr )
|
|
|
|
{
|
2016-03-29 10:25:17 +02:00
|
|
|
static const struct {
|
2013-03-27 20:35:34 -04:00
|
|
|
sal_uInt16 nAttrType;
|
|
|
|
sal_uInt16 nCharType;
|
|
|
|
} AttrTypeMap[] = {
|
|
|
|
{ ATTR_FONT, EE_CHAR_FONTINFO },
|
|
|
|
{ ATTR_FONT_HEIGHT, EE_CHAR_FONTHEIGHT },
|
|
|
|
{ ATTR_FONT_WEIGHT, EE_CHAR_WEIGHT },
|
|
|
|
{ ATTR_FONT_COLOR, EE_CHAR_COLOR }
|
|
|
|
};
|
2016-03-29 10:25:17 +02:00
|
|
|
sal_uInt16 nMapCount = SAL_N_ELEMENTS(AttrTypeMap);
|
2013-03-27 20:35:34 -04:00
|
|
|
|
|
|
|
const SfxItemSet& rSet = rAttr.GetItemSet();
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
for (sal_uInt16 i = 0; i < nMapCount; ++i)
|
|
|
|
{
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SfxItemState::SET )
|
2013-03-27 20:35:34 -04:00
|
|
|
rEditText.RemoveCharAttribs(AttrTypeMap[i].nCharType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-24 11:52:18 -04:00
|
|
|
EditTextObject* ScEditUtil::Clone( const EditTextObject& rObj, ScDocument& rDestDoc )
|
|
|
|
{
|
2015-11-10 10:22:39 +01:00
|
|
|
EditTextObject* pNew = nullptr;
|
2013-05-24 11:52:18 -04:00
|
|
|
|
|
|
|
EditEngine& rEngine = rDestDoc.GetEditEngine();
|
|
|
|
if (rObj.HasOnlineSpellErrors())
|
|
|
|
{
|
2015-03-24 16:05:55 +02:00
|
|
|
EEControlBits nControl = rEngine.GetControlWord();
|
|
|
|
const EEControlBits nSpellControl = EEControlBits::ONLINESPELLING | EEControlBits::ALLOWBIGOBJS;
|
2013-05-24 11:52:18 -04:00
|
|
|
bool bNewControl = ( (nControl & nSpellControl) != nSpellControl );
|
|
|
|
if (bNewControl)
|
|
|
|
rEngine.SetControlWord(nControl | nSpellControl);
|
|
|
|
rEngine.SetText(rObj);
|
|
|
|
pNew = rEngine.CreateTextObject();
|
|
|
|
if (bNewControl)
|
|
|
|
rEngine.SetControlWord(nControl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rEngine.SetText(rObj);
|
|
|
|
pNew = rEngine.CreateTextObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
|
2013-08-25 13:45:55 -04:00
|
|
|
OUString ScEditUtil::GetCellFieldValue(
|
|
|
|
const SvxFieldData& rFieldData, const ScDocument* pDoc, Color** ppTextColor )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
switch (rFieldData.GetClassId())
|
|
|
|
{
|
|
|
|
case text::textfield::Type::URL:
|
|
|
|
{
|
|
|
|
const SvxURLField& rField = static_cast<const SvxURLField&>(rFieldData);
|
2016-04-12 16:39:03 +02:00
|
|
|
const OUString& aURL = rField.GetURL();
|
2013-08-25 13:45:55 -04:00
|
|
|
|
|
|
|
switch (rField.GetFormat())
|
|
|
|
{
|
2014-11-11 04:51:00 -05:00
|
|
|
case SVXURLFORMAT_APPDEFAULT: //TODO: configurable with App???
|
2013-08-25 13:45:55 -04:00
|
|
|
case SVXURLFORMAT_REPR:
|
|
|
|
aRet = rField.GetRepresentation();
|
|
|
|
break;
|
|
|
|
case SVXURLFORMAT_URL:
|
|
|
|
aRet = aURL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
svtools::ColorConfigEntry eEntry =
|
|
|
|
INetURLHistory::GetOrCreate()->QueryUrl(aURL) ? svtools::LINKSVISITED : svtools::LINKS;
|
|
|
|
|
|
|
|
if (ppTextColor)
|
|
|
|
*ppTextColor = new Color( SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
|
|
|
{
|
|
|
|
const SvxExtTimeField& rField = static_cast<const SvxExtTimeField&>(rFieldData);
|
|
|
|
if (pDoc)
|
|
|
|
aRet = rField.GetFormatted(*pDoc->GetFormatTable(), ScGlobal::eLnge);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TODO: quite expensive, we could have a global formatter? */
|
|
|
|
SvNumberFormatter aFormatter( comphelper::getProcessComponentContext(), ScGlobal::eLnge );
|
|
|
|
aRet = rField.GetFormatted(aFormatter, ScGlobal::eLnge);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::DATE:
|
|
|
|
{
|
|
|
|
Date aDate(Date::SYSTEM);
|
|
|
|
aRet = ScGlobal::pLocaleData->getDate(aDate);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::DOCINFO_TITLE:
|
|
|
|
{
|
|
|
|
if (pDoc)
|
|
|
|
{
|
|
|
|
SfxObjectShell* pDocShell = pDoc->GetDocumentShell();
|
|
|
|
if (pDocShell)
|
|
|
|
{
|
|
|
|
aRet = pDocShell->getDocProperties()->getTitle();
|
|
|
|
if (aRet.isEmpty())
|
|
|
|
aRet = pDocShell->GetTitle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aRet.isEmpty())
|
|
|
|
aRet = "?";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::TABLE:
|
|
|
|
{
|
|
|
|
const SvxTableField& rField = static_cast<const SvxTableField&>(rFieldData);
|
|
|
|
SCTAB nTab = rField.GetTab();
|
|
|
|
OUString aName;
|
|
|
|
if (pDoc && pDoc->GetName(nTab, aName))
|
|
|
|
aRet = aName;
|
|
|
|
else
|
|
|
|
aRet = "?";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aRet = "?";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aRet.isEmpty()) // leer ist baeh
|
|
|
|
aRet = " "; // Space ist Default der Editengine
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2014-02-11 15:12:51 +02:00
|
|
|
Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bForceToTop )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2000-09-25 16:35:04 +00:00
|
|
|
// bForceToTop = always align to top, for editing
|
2011-01-17 13:20:22 +01:00
|
|
|
// (sal_False for querying URLs etc.)
|
2000-09-25 16:35:04 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
if (!pPattern)
|
|
|
|
pPattern = pDoc->GetPattern( nCol, nRow, nTab );
|
|
|
|
|
|
|
|
Point aStartPos = aScrPos;
|
|
|
|
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
|
2004-02-03 11:21:42 +00:00
|
|
|
long nLayoutSign = bLayoutRTL ? -1 : 1;
|
|
|
|
|
2014-10-22 16:06:44 +02:00
|
|
|
const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE));
|
2000-09-18 23:16:46 +00:00
|
|
|
long nCellX = (long) ( pDoc->GetColWidth(nCol,nTab) * nPPTX );
|
|
|
|
if ( pMerge->GetColMerge() > 1 )
|
|
|
|
{
|
2004-06-04 09:35:56 +00:00
|
|
|
SCCOL nCountX = pMerge->GetColMerge();
|
|
|
|
for (SCCOL i=1; i<nCountX; i++)
|
2000-09-18 23:16:46 +00:00
|
|
|
nCellX += (long) ( pDoc->GetColWidth(nCol+i,nTab) * nPPTX );
|
|
|
|
}
|
|
|
|
long nCellY = (long) ( pDoc->GetRowHeight(nRow,nTab) * nPPTY );
|
|
|
|
if ( pMerge->GetRowMerge() > 1 )
|
|
|
|
{
|
2004-06-04 09:35:56 +00:00
|
|
|
SCROW nCountY = pMerge->GetRowMerge();
|
2004-08-20 08:12:18 +00:00
|
|
|
nCellY += (long) pDoc->GetScaledRowHeight( nRow+1, nRow+nCountY-1, nTab, nPPTY);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2014-10-22 16:06:44 +02:00
|
|
|
const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem(ATTR_MARGIN));
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nIndent = 0;
|
2014-10-22 16:06:44 +02:00
|
|
|
if ( static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue() ==
|
2000-09-18 23:16:46 +00:00
|
|
|
SVX_HOR_JUSTIFY_LEFT )
|
2014-10-22 16:06:44 +02:00
|
|
|
nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue();
|
2000-09-18 23:16:46 +00:00
|
|
|
long nPixDifX = (long) ( ( pMargin->GetLeftMargin() + nIndent ) * nPPTX );
|
2004-02-03 11:21:42 +00:00
|
|
|
aStartPos.X() += nPixDifX * nLayoutSign;
|
2000-09-18 23:16:46 +00:00
|
|
|
nCellX -= nPixDifX + (long) ( pMargin->GetRightMargin() * nPPTX ); // wegen Umbruch etc.
|
|
|
|
|
|
|
|
// vertikale Position auf die in der Tabelle anpassen
|
|
|
|
|
|
|
|
long nPixDifY;
|
|
|
|
long nTopMargin = (long) ( pMargin->GetTopMargin() * nPPTY );
|
2014-10-22 16:06:44 +02:00
|
|
|
SvxCellVerJustify eJust = (SvxCellVerJustify) static_cast<const SvxVerJustifyItem&>(pPattern->
|
2000-09-18 23:16:46 +00:00
|
|
|
GetItem(ATTR_VER_JUSTIFY)).GetValue();
|
2002-04-05 18:21:05 +00:00
|
|
|
|
|
|
|
// asian vertical is always edited top-aligned
|
2014-10-22 16:06:44 +02:00
|
|
|
bool bAsianVertical = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_STACKED )).GetValue() &&
|
|
|
|
static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_VERTICAL_ASIAN )).GetValue();
|
2002-04-05 18:21:05 +00:00
|
|
|
|
2001-05-11 15:20:22 +00:00
|
|
|
if ( eJust == SVX_VER_JUSTIFY_TOP ||
|
2002-04-05 18:21:05 +00:00
|
|
|
( bForceToTop && ( SC_MOD()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) )
|
2000-09-18 23:16:46 +00:00
|
|
|
nPixDifY = nTopMargin;
|
|
|
|
else
|
|
|
|
{
|
2000-09-25 16:35:04 +00:00
|
|
|
MapMode aMode = pDev->GetMapMode();
|
2016-09-20 16:41:39 +02:00
|
|
|
pDev->SetMapMode( MapUnit::MapPixel );
|
2000-09-25 16:35:04 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
long nTextHeight = pDoc->GetNeededSize( nCol, nRow, nTab,
|
2011-03-10 16:55:21 -05:00
|
|
|
pDev, nPPTX, nPPTY, aZoomX, aZoomY, false );
|
2000-09-18 23:16:46 +00:00
|
|
|
if (!nTextHeight)
|
|
|
|
{ // leere Zelle
|
2014-09-16 10:09:58 +02:00
|
|
|
vcl::Font aFont;
|
2002-03-11 13:08:12 +00:00
|
|
|
// font color doesn't matter here
|
|
|
|
pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aZoomY );
|
2000-09-18 23:16:46 +00:00
|
|
|
pDev->SetFont(aFont);
|
|
|
|
nTextHeight = pDev->GetTextHeight() + nTopMargin +
|
|
|
|
(long) ( pMargin->GetBottomMargin() * nPPTY );
|
|
|
|
}
|
2000-09-25 16:35:04 +00:00
|
|
|
|
|
|
|
pDev->SetMapMode(aMode);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2000-09-25 17:23:30 +00:00
|
|
|
if ( nTextHeight > nCellY + nTopMargin || bForceToTop )
|
2000-09-18 23:16:46 +00:00
|
|
|
nPixDifY = 0; // zu gross -> oben anfangen
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( eJust == SVX_VER_JUSTIFY_CENTER )
|
|
|
|
nPixDifY = nTopMargin + ( nCellY - nTextHeight ) / 2;
|
|
|
|
else
|
|
|
|
nPixDifY = nCellY - nTextHeight + nTopMargin; // JUSTIFY_BOTTOM
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aStartPos.Y() += nPixDifY;
|
|
|
|
nCellY -= nPixDifY;
|
|
|
|
|
2004-02-03 11:21:42 +00:00
|
|
|
if ( bLayoutRTL )
|
|
|
|
aStartPos.X() -= nCellX - 2; // excluding grid on both sides
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
// -1 -> Gitter nicht ueberschreiben
|
|
|
|
return Rectangle( aStartPos, Size(nCellX-1,nCellY-1) );
|
|
|
|
}
|
|
|
|
|
2005-03-08 14:41:35 +00:00
|
|
|
ScEditAttrTester::ScEditAttrTester( ScEditEngineDefaulter* pEng ) :
|
2000-09-18 23:16:46 +00:00
|
|
|
pEngine( pEng ),
|
2015-11-10 10:22:39 +01:00
|
|
|
pEditAttrs( nullptr ),
|
2011-03-10 16:55:21 -05:00
|
|
|
bNeedsObject( false ),
|
|
|
|
bNeedsCellAttr( false )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( pEngine->GetParagraphCount() > 1 )
|
|
|
|
{
|
2014-11-11 04:51:00 -05:00
|
|
|
bNeedsObject = true; //TODO: find cell attributes ?
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-10 10:22:39 +01:00
|
|
|
const SfxPoolItem* pItem = nullptr;
|
2000-09-18 23:16:46 +00:00
|
|
|
pEditAttrs = new SfxItemSet( pEngine->GetAttribs(
|
2006-03-27 08:31:22 +00:00
|
|
|
ESelection(0,0,0,pEngine->GetTextLen(0)), EditEngineAttribs_OnlyHard ) );
|
2005-03-08 14:41:35 +00:00
|
|
|
const SfxItemSet& rEditDefaults = pEngine->GetDefaults();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
for (sal_uInt16 nId = EE_CHAR_START; nId <= EE_CHAR_END && !bNeedsObject; nId++)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2011-03-10 16:55:21 -05:00
|
|
|
SfxItemState eState = pEditAttrs->GetItemState( nId, false, &pItem );
|
2014-09-10 17:53:41 +02:00
|
|
|
if (eState == SfxItemState::DONTCARE)
|
2014-02-11 15:19:39 +02:00
|
|
|
bNeedsObject = true;
|
2014-09-10 17:53:41 +02:00
|
|
|
else if (eState == SfxItemState::SET)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2001-10-17 17:20:39 +00:00
|
|
|
if ( nId == EE_CHAR_ESCAPEMENT || nId == EE_CHAR_PAIRKERNING ||
|
|
|
|
nId == EE_CHAR_KERNING || nId == EE_CHAR_XMLATTRIBS )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2001-10-17 17:20:39 +00:00
|
|
|
// Escapement and kerning are kept in EditEngine because there are no
|
|
|
|
// corresponding cell format items. User defined attributes are kept in
|
|
|
|
// EditEngine because "user attributes applied to all the text" is different
|
|
|
|
// from "user attributes applied to the cell".
|
|
|
|
|
2005-03-08 14:41:35 +00:00
|
|
|
if ( *pItem != rEditDefaults.Get(nId) )
|
2014-02-11 15:19:39 +02:00
|
|
|
bNeedsObject = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (!bNeedsCellAttr)
|
2005-03-08 14:41:35 +00:00
|
|
|
if ( *pItem != rEditDefaults.Get(nId) )
|
2014-02-11 15:19:39 +02:00
|
|
|
bNeedsCellAttr = true;
|
2005-03-08 14:41:35 +00:00
|
|
|
// rEditDefaults contains the defaults from the cell format
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Feldbefehle enthalten?
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
SfxItemState eFieldState = pEditAttrs->GetItemState( EE_FEATURE_FIELD, false );
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( eFieldState == SfxItemState::DONTCARE || eFieldState == SfxItemState::SET )
|
2014-02-11 15:19:39 +02:00
|
|
|
bNeedsObject = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// not converted characters?
|
|
|
|
|
2011-03-10 16:55:21 -05:00
|
|
|
SfxItemState eConvState = pEditAttrs->GetItemState( EE_FEATURE_NOTCONV, false );
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( eConvState == SfxItemState::DONTCARE || eConvState == SfxItemState::SET )
|
2014-02-11 15:19:39 +02:00
|
|
|
bNeedsObject = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScEditAttrTester::~ScEditAttrTester()
|
|
|
|
{
|
|
|
|
delete pEditAttrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScEnginePoolHelper::ScEnginePoolHelper( SfxItemPool* pEnginePoolP,
|
2014-02-11 15:24:39 +02:00
|
|
|
bool bDeleteEnginePoolP )
|
2000-09-18 23:16:46 +00:00
|
|
|
:
|
|
|
|
pEnginePool( pEnginePoolP ),
|
2015-11-10 10:22:39 +01:00
|
|
|
pDefaults( nullptr ),
|
2007-02-27 11:15:32 +00:00
|
|
|
bDeleteEnginePool( bDeleteEnginePoolP ),
|
2011-03-10 16:55:21 -05:00
|
|
|
bDeleteDefaults( false )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScEnginePoolHelper::ScEnginePoolHelper( const ScEnginePoolHelper& rOrg )
|
|
|
|
:
|
|
|
|
pEnginePool( rOrg.bDeleteEnginePool ? rOrg.pEnginePool->Clone() : rOrg.pEnginePool ),
|
2015-11-10 10:22:39 +01:00
|
|
|
pDefaults( nullptr ),
|
2007-02-27 11:15:32 +00:00
|
|
|
bDeleteEnginePool( rOrg.bDeleteEnginePool ),
|
2011-03-10 16:55:21 -05:00
|
|
|
bDeleteDefaults( false )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScEnginePoolHelper::~ScEnginePoolHelper()
|
|
|
|
{
|
|
|
|
if ( bDeleteDefaults )
|
|
|
|
delete pDefaults;
|
|
|
|
if ( bDeleteEnginePool )
|
CWS-TOOLING: integrate CWS aw063
2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects
2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects
2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL
2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction
2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction
2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1
2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round
2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round
2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round
2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round
2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round
2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round
2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round
2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition
2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF
2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable
2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable
2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix
2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix
2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers
2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts
2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules
2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include
2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include
2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much
2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from
2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size
2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances
2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage
2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences
2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange
2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle
2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case
2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
|
|
|
SfxItemPool::Free(pEnginePool);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScEditEngineDefaulter::ScEditEngineDefaulter( SfxItemPool* pEnginePoolP,
|
2014-02-11 15:32:01 +02:00
|
|
|
bool bDeleteEnginePoolP )
|
2000-09-18 23:16:46 +00:00
|
|
|
:
|
|
|
|
ScEnginePoolHelper( pEnginePoolP, bDeleteEnginePoolP ),
|
|
|
|
EditEngine( pEnginePoolP )
|
|
|
|
{
|
2001-11-12 19:04:36 +00:00
|
|
|
// All EditEngines use ScGlobal::GetEditDefaultLanguage as DefaultLanguage.
|
|
|
|
// DefaultLanguage for InputHandler's EditEngine is updated later.
|
|
|
|
|
|
|
|
SetDefaultLanguage( ScGlobal::GetEditDefaultLanguage() );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScEditEngineDefaulter::ScEditEngineDefaulter( const ScEditEngineDefaulter& rOrg )
|
|
|
|
:
|
|
|
|
ScEnginePoolHelper( rOrg ),
|
|
|
|
EditEngine( pEnginePool )
|
|
|
|
{
|
2001-11-12 19:04:36 +00:00
|
|
|
SetDefaultLanguage( ScGlobal::GetEditDefaultLanguage() );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScEditEngineDefaulter::~ScEditEngineDefaulter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-11 15:32:01 +02:00
|
|
|
void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberCopy )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( bRememberCopy )
|
|
|
|
{
|
|
|
|
if ( bDeleteDefaults )
|
|
|
|
delete pDefaults;
|
|
|
|
pDefaults = new SfxItemSet( rSet );
|
2014-02-11 15:24:39 +02:00
|
|
|
bDeleteDefaults = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
const SfxItemSet& rNewSet = bRememberCopy ? *pDefaults : rSet;
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUndo = IsUndoEnabled();
|
2011-03-10 16:55:21 -05:00
|
|
|
EnableUndo( false );
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = GetParagraphCount();
|
|
|
|
for ( sal_Int32 j=0; j<nPara; j++ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
SetParaAttribs( j, rNewSet );
|
|
|
|
}
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
if ( bUndo )
|
2014-02-20 14:17:27 +02:00
|
|
|
EnableUndo( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 11:35:33 +02:00
|
|
|
void ScEditEngineDefaulter::SetDefaults( SfxItemSet* pSet )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( bDeleteDefaults )
|
|
|
|
delete pDefaults;
|
|
|
|
pDefaults = pSet;
|
2016-03-04 11:35:33 +02:00
|
|
|
bDeleteDefaults = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
if ( pDefaults )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetDefaults( *pDefaults, false );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem )
|
|
|
|
{
|
|
|
|
if ( !pDefaults )
|
|
|
|
{
|
|
|
|
pDefaults = new SfxItemSet( GetEmptyItemSet() );
|
2014-02-11 15:24:39 +02:00
|
|
|
bDeleteDefaults = true;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
pDefaults->Put( rItem );
|
2011-03-10 16:55:21 -05:00
|
|
|
SetDefaults( *pDefaults, false );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2005-03-08 14:41:35 +00:00
|
|
|
const SfxItemSet& ScEditEngineDefaulter::GetDefaults()
|
|
|
|
{
|
|
|
|
if ( !pDefaults )
|
|
|
|
{
|
|
|
|
pDefaults = new SfxItemSet( GetEmptyItemSet() );
|
2014-02-11 15:24:39 +02:00
|
|
|
bDeleteDefaults = true;
|
2005-03-08 14:41:35 +00:00
|
|
|
}
|
|
|
|
return *pDefaults;
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
void ScEditEngineDefaulter::SetText( const EditTextObject& rTextObject )
|
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2000-09-18 23:16:46 +00:00
|
|
|
EditEngine::SetText( rTextObject );
|
|
|
|
if ( pDefaults )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetDefaults( *pDefaults, false );
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScEditEngineDefaulter::SetTextNewDefaults( const EditTextObject& rTextObject,
|
2014-02-11 15:32:01 +02:00
|
|
|
const SfxItemSet& rSet, bool bRememberCopy )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2000-09-18 23:16:46 +00:00
|
|
|
EditEngine::SetText( rTextObject );
|
|
|
|
SetDefaults( rSet, bRememberCopy );
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2002-03-20 08:26:42 +00:00
|
|
|
void ScEditEngineDefaulter::SetTextNewDefaults( const EditTextObject& rTextObject,
|
2016-03-02 15:41:41 +02:00
|
|
|
SfxItemSet* pSet )
|
2002-03-20 08:26:42 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2002-03-20 08:26:42 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2002-03-20 08:26:42 +00:00
|
|
|
EditEngine::SetText( rTextObject );
|
2016-03-02 15:41:41 +02:00
|
|
|
SetDefaults( pSet );
|
2002-03-20 08:26:42 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2002-03-20 08:26:42 +00:00
|
|
|
}
|
|
|
|
|
2013-01-21 14:32:09 +01:00
|
|
|
void ScEditEngineDefaulter::SetText( const OUString& rText )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2000-09-18 23:16:46 +00:00
|
|
|
EditEngine::SetText( rText );
|
|
|
|
if ( pDefaults )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetDefaults( *pDefaults, false );
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-10-04 11:03:40 +02:00
|
|
|
void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText,
|
2016-03-02 15:41:41 +02:00
|
|
|
const SfxItemSet& rSet )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2000-09-18 23:16:46 +00:00
|
|
|
EditEngine::SetText( rText );
|
2016-03-02 15:41:41 +02:00
|
|
|
SetDefaults( rSet );
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-10-04 11:03:40 +02:00
|
|
|
void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText,
|
2016-03-02 15:41:41 +02:00
|
|
|
SfxItemSet* pSet )
|
2002-03-20 08:26:42 +00:00
|
|
|
{
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2002-03-20 08:26:42 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2002-03-20 08:26:42 +00:00
|
|
|
EditEngine::SetText( rText );
|
2016-03-02 15:41:41 +02:00
|
|
|
SetDefaults( pSet );
|
2002-03-20 08:26:42 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2002-03-20 08:26:42 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2002-09-23 13:13:30 +00:00
|
|
|
void ScEditEngineDefaulter::RepeatDefaults()
|
|
|
|
{
|
|
|
|
if ( pDefaults )
|
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = GetParagraphCount();
|
|
|
|
for ( sal_Int32 j=0; j<nPara; j++ )
|
2002-09-23 13:13:30 +00:00
|
|
|
SetParaAttribs( j, *pDefaults );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 18:18:47 +00:00
|
|
|
void ScEditEngineDefaulter::RemoveParaAttribs()
|
|
|
|
{
|
2015-11-10 10:22:39 +01:00
|
|
|
SfxItemSet* pCharItems = nullptr;
|
2014-04-23 11:08:48 +02:00
|
|
|
bool bUpdateMode = GetUpdateMode();
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2011-03-10 16:55:21 -05:00
|
|
|
SetUpdateMode( false );
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nParCount = GetParagraphCount();
|
|
|
|
for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
|
2001-07-11 18:18:47 +00:00
|
|
|
{
|
|
|
|
const SfxItemSet& rParaAttribs = GetParaAttribs( nPar );
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nWhich;
|
2001-07-11 18:18:47 +00:00
|
|
|
for (nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich ++)
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pParaItem;
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( rParaAttribs.GetItemState( nWhich, false, &pParaItem ) == SfxItemState::SET )
|
2001-07-11 18:18:47 +00:00
|
|
|
{
|
|
|
|
// if defaults are set, use only items that are different from default
|
|
|
|
if ( !pDefaults || *pParaItem != pDefaults->Get(nWhich) )
|
|
|
|
{
|
|
|
|
if (!pCharItems)
|
|
|
|
pCharItems = new SfxItemSet( GetEmptyItemSet() );
|
|
|
|
pCharItems->Put( *pParaItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pCharItems )
|
|
|
|
{
|
2014-02-02 22:16:48 -06:00
|
|
|
std::vector<sal_Int32> aPortions;
|
2001-07-11 18:18:47 +00:00
|
|
|
GetPortions( nPar, aPortions );
|
|
|
|
|
|
|
|
// loop through the portions of the paragraph, and set only those items
|
|
|
|
// that are not overridden by existing character attributes
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nStart = 0;
|
|
|
|
for ( std::vector<sal_Int32>::const_iterator it(aPortions.begin()); it != aPortions.end(); ++it )
|
2001-07-11 18:18:47 +00:00
|
|
|
{
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nEnd = *it;
|
2001-07-11 18:18:47 +00:00
|
|
|
ESelection aSel( nPar, nStart, nPar, nEnd );
|
|
|
|
SfxItemSet aOldCharAttrs = GetAttribs( aSel );
|
|
|
|
SfxItemSet aNewCharAttrs = *pCharItems;
|
|
|
|
for (nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich ++)
|
|
|
|
{
|
|
|
|
// Clear those items that are different from existing character attributes.
|
|
|
|
// Where no character attributes are set, GetAttribs returns the paragraph attributes.
|
|
|
|
const SfxPoolItem* pItem;
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( aNewCharAttrs.GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
|
2001-07-11 18:18:47 +00:00
|
|
|
*pItem != aOldCharAttrs.Get(nWhich) )
|
|
|
|
{
|
|
|
|
aNewCharAttrs.ClearItem(nWhich);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( aNewCharAttrs.Count() )
|
|
|
|
QuickSetAttribs( aNewCharAttrs, aSel );
|
|
|
|
|
|
|
|
nStart = nEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
DELETEZ( pCharItems );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( rParaAttribs.Count() )
|
|
|
|
{
|
|
|
|
// clear all paragraph attributes (including defaults),
|
|
|
|
// so they are not contained in resulting EditTextObjects
|
|
|
|
|
|
|
|
SetParaAttribs( nPar, SfxItemSet( *rParaAttribs.GetPool(), rParaAttribs.GetRanges() ) );
|
|
|
|
}
|
|
|
|
}
|
2001-10-15 10:11:50 +00:00
|
|
|
if ( bUpdateMode )
|
2014-02-20 14:17:27 +02:00
|
|
|
SetUpdateMode( true );
|
2001-07-11 18:18:47 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
ScTabEditEngine::ScTabEditEngine( ScDocument* pDoc )
|
|
|
|
: ScEditEngineDefaulter( pDoc->GetEnginePool() )
|
|
|
|
{
|
|
|
|
SetEditTextObjectPool( pDoc->GetEditPool() );
|
2014-10-22 16:06:44 +02:00
|
|
|
Init(static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScTabEditEngine::ScTabEditEngine( const ScPatternAttr& rPattern,
|
2007-02-27 11:15:32 +00:00
|
|
|
SfxItemPool* pEnginePoolP, SfxItemPool* pTextObjectPool )
|
|
|
|
: ScEditEngineDefaulter( pEnginePoolP )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( pTextObjectPool )
|
|
|
|
SetEditTextObjectPool( pTextObjectPool );
|
|
|
|
Init( rPattern );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScTabEditEngine::Init( const ScPatternAttr& rPattern )
|
|
|
|
{
|
2016-09-20 16:41:39 +02:00
|
|
|
SetRefMapMode(MapUnit::Map100thMM);
|
2000-09-18 23:16:46 +00:00
|
|
|
SfxItemSet* pEditDefaults = new SfxItemSet( GetEmptyItemSet() );
|
|
|
|
rPattern.FillEditItemSet( pEditDefaults );
|
|
|
|
SetDefaults( pEditDefaults );
|
|
|
|
// wir haben keine StyleSheets fuer Text
|
2015-03-24 16:05:55 +02:00
|
|
|
SetControlWord( GetControlWord() & ~EEControlBits::RTFSTYLESHEETS );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Feldbefehle fuer Kopf- und Fusszeilen
|
|
|
|
|
|
|
|
// Zahlen aus \sw\source\core\doc\numbers.cxx
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2013-10-07 17:49:38 +02:00
|
|
|
static OUString lcl_GetCharStr( sal_Int32 nNo )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-03-16 04:58:29 +01:00
|
|
|
OSL_ENSURE( nNo, "0 is an invalid number !!" );
|
2013-10-07 17:49:38 +02:00
|
|
|
OUString aStr;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-02-12 13:25:13 +00:00
|
|
|
const sal_Int32 coDiff = 'Z' - 'A' +1;
|
|
|
|
sal_Int32 nCalc;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
nCalc = nNo % coDiff;
|
|
|
|
if( !nCalc )
|
|
|
|
nCalc = coDiff;
|
2016-08-30 15:28:44 +02:00
|
|
|
aStr = OUStringLiteral1( 'a' - 1 + nCalc ) + aStr;
|
2008-02-12 13:25:13 +00:00
|
|
|
nNo = sal::static_int_cast<sal_Int32>( nNo - nCalc );
|
2000-09-18 23:16:46 +00:00
|
|
|
if( nNo )
|
|
|
|
nNo /= coDiff;
|
|
|
|
} while( nNo );
|
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
|
2012-12-15 14:57:53 +00:00
|
|
|
static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-12-15 14:57:53 +00:00
|
|
|
OUString aTmpStr('0');
|
2000-09-18 23:16:46 +00:00
|
|
|
if( nNo )
|
|
|
|
{
|
|
|
|
switch( eType )
|
|
|
|
{
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
case css::style::NumberingType::CHARS_UPPER_LETTER:
|
|
|
|
case css::style::NumberingType::CHARS_LOWER_LETTER:
|
2000-09-18 23:16:46 +00:00
|
|
|
aTmpStr = lcl_GetCharStr( nNo );
|
|
|
|
break;
|
|
|
|
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
case css::style::NumberingType::ROMAN_UPPER:
|
|
|
|
case css::style::NumberingType::ROMAN_LOWER:
|
2008-02-12 13:25:13 +00:00
|
|
|
if( nNo < 4000 )
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
aTmpStr = SvxNumberFormat::CreateRomanString( nNo, ( eType == css::style::NumberingType::ROMAN_UPPER ) );
|
2008-02-12 13:25:13 +00:00
|
|
|
else
|
2014-11-12 14:24:10 +05:30
|
|
|
aTmpStr.clear();
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
case css::style::NumberingType::NUMBER_NONE:
|
2014-11-12 14:24:10 +05:30
|
|
|
aTmpStr.clear();
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// CHAR_SPECIAL:
|
|
|
|
// ????
|
|
|
|
|
|
|
|
// case ARABIC: ist jetzt default
|
|
|
|
default:
|
2013-08-21 15:07:31 +02:00
|
|
|
aTmpStr = OUString::number(nNo);
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
if( css::style::NumberingType::CHARS_UPPER_LETTER == eType )
|
2012-12-15 14:57:53 +00:00
|
|
|
aTmpStr = aTmpStr.toAsciiUpperCase();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
return aTmpStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScHeaderFieldData::ScHeaderFieldData()
|
2011-12-01 21:03:42 +01:00
|
|
|
:
|
|
|
|
aDate( Date::EMPTY ),
|
2014-09-28 15:49:26 +02:00
|
|
|
aTime( tools::Time::EMPTY )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
nPageNo = nTotalPages = 0;
|
Fix "ubsan: 9 is not a valid value for type ´SvxNumType´" once again
...after 1658bd231bc662504a072097dc614c29fe2e116d "loplugin:unusedenumvalues"
broke it again after 992fba98f4d0b6ff0d20c15b0ddff09edd37847c "ubsan: 9 is not a
valid value for type ´SvxNumType´" had fixed it the last time.
This time, acknowledge that SvxNumType can apparently take on rather arbitrary
sal_Int16 values from the css::style::NumberingTypes constants, and make it an
alias for sal_Int16 (whether or not keeping such a trivial alias is good or bad
overall).
Or is the bug elsewhere, and values of type SvxNumType should really only take
on the restricted set of values originally encoded by the enum? At least the
below UBSan backtrace (from CppunitTest_sw_rtfexport) suggests otherwise, but
then again there's also an SvxExtNumType enum (include/editeng/svxenum.hxx),
encompassing more parts of css::style::NumberingTypes. Oh, my.
> svx/source/items/pageitem.cxx:49:25: runtime error: load of value 9, which is not a valid value for type 'SvxNumType'
> #0 0x2aafdaebe669 in SvxPageItem::SvxPageItem(SvxPageItem const&) svx/source/items/pageitem.cxx:49:25
> #1 0x2aafdaebf194 in SvxPageItem::Clone(SfxItemPool*) const svx/source/items/pageitem.cxx:59:16
> #2 0x2aaf7fab9b7c in SfxItemPool::Put(SfxPoolItem const&, unsigned short) svl/source/items/itempool.cxx:632:40
> #3 0x2aaf7fc4794a in SfxItemSet::Put(SfxPoolItem const&, unsigned short) svl/source/items/itemset.cxx:467:56
> #4 0x2aaf7fb96635 in SfxItemSet::Put(SfxPoolItem const&) include/svl/itemset.hxx:131:42
> #5 0x2aaf7fb89539 in SfxItemPropertySet::setPropertyValue(SfxItemPropertySimpleEntry const&, com::sun::star::uno::Any const&, SfxItemSet&) const svl/source/items/itemprop.cxx:256:14
> #6 0x2aaf9ef1a5d4 in void SwXStyle::SetPropertyValue<(unsigned short)1>(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:1596:14
> #7 0x2aaf9ef3c72f in SwXStyle::SetStyleProperty(SfxItemPropertySimpleEntry const&, SfxItemPropertySet const&, com::sun::star::uno::Any const&, SwStyleBase_Impl&) sw/source/core/unocore/unostyle.cxx:2013:9
> #8 0x2aaf9ef8103d in SwXPageStyle::SetPropertyValues_Impl(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3025:17
> #9 0x2aaf9ef821ee in SwXPageStyle::setPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) sw/source/core/unocore/unostyle.cxx:3053:9
> #10 0x2ab00730d08b in writerfilter::dmapper::SectionPropertyMap::ApplyProperties_(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) writerfilter/source/dmapper/PropertyMap.cxx:1489:24
> #11 0x2ab00731cede in writerfilter::dmapper::SectionPropertyMap::CloseSectionGroup(writerfilter::dmapper::DomainMapper_Impl&) writerfilter/source/dmapper/PropertyMap.cxx:1331:13
> #12 0x2ab006b9ede2 in writerfilter::dmapper::DomainMapper::lcl_endSectionGroup() writerfilter/source/dmapper/DomainMapper.cxx:2823:30
> #13 0x2ab0071db9f9 in writerfilter::LoggedStream::endSectionGroup() writerfilter/source/dmapper/LoggedResources.cxx:101:5
> #14 0x2ab006712a3b in writerfilter::rtftok::RTFDocumentImpl::sectBreak(bool) writerfilter/source/rtftok/rtfdocumentimpl.cxx:633:18
> #15 0x2ab0067a8c13 in writerfilter::rtftok::RTFDocumentImpl::popState() writerfilter/source/rtftok/rtfdocumentimpl.cxx:2789:13
> #16 0x2ab006a26134 in writerfilter::rtftok::RTFTokenizer::resolveParse() writerfilter/source/rtftok/rtftokenizer.cxx:105:33
> #17 0x2ab0067194f9 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) writerfilter/source/rtftok/rtfdocumentimpl.cxx:740:27
> #18 0x2ab0075ebae7 in RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) writerfilter/source/filter/RtfFilter.cxx:147:20
> #19 0x2aafcf2873a5 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) sfx2/source/doc/objstor.cxx:2261:30
> #20 0x2aafcf22d4d2 in SfxObjectShell::DoLoad(SfxMedium*) sfx2/source/doc/objstor.cxx:764:23
> #21 0x2aafcf4a4d09 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) sfx2/source/doc/sfxbasemodel.cxx:1841:36
> #22 0x2aafcfde31b3 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) sfx2/source/view/frmload.cxx:698:28
> #23 0x2aaffef07028 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1110:37
> #24 0x2aaffeeead5a in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
> #25 0x2aaffeee3919 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/loadenv/loadenv.cxx:165:14
> #26 0x2aafff10ddac in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:596:12
> #27 0x2aafff10e11a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/desktop.cxx:582:64
> #28 0x2aafab4c3938 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) unotest/source/cpp/macros_test.cxx:50:60
> #29 0x2aaf90aee900 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:621:23
> #30 0x2aaf90aed267 in SwModelTestBase::load(char const*, char const*) sw/qa/extras/inc/swmodeltestbase.hxx:610:16
> #31 0x2aaf90aec404 in SwModelTestBase::executeImportTest(char const*) sw/qa/extras/inc/swmodeltestbase.hxx:222:13
> #32 0x2aaf90cf4d31 in testTdf65642::Import() sw/qa/extras/rtfexport/rtfexport.cxx:1013:1
> #33 0x2aaf90cf62af in CppUnit::TestCaller<testTdf65642>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #34 0x2aaf4ee5d7dd in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #35 0x2aaf680c4cd6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:36:14
> #36 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #37 0x2aaf5ea4a8a6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #38 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #39 0x2aaf5abd5ef4 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:65:16
> #40 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #41 0x2aaf4ed8c2ef in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #42 0x2aaf4ee17a87 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #43 0x2aaf4ee14101 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
> #44 0x2aaf4eede065 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:28
> #45 0x2aaf4ee5a929 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13
> #46 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #47 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #48 0x2aaf4ee60ad3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30
> #49 0x2aaf4ee5fa3d in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
> #50 0x2aaf4ef1eeb6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27
> #51 0x2aaf4eedbe79 in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:9
> #52 0x2aaf4ef20440 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14
> #53 0x52b642 in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:305:20
> #54 0x52604d in sal_main() sal/cppunittester/cppunittester.cxx:455:20
> #55 0x524192 in main sal/cppunittester/cppunittester.cxx:362:1
> #56 0x2aaf50b3c730 in __libc_start_main (/lib64/libc.so.6+0x20730)
> #57 0x437658 in _start (workdir/LinkTarget/Executable/cppunittester+0x437658)
Change-Id: Id170860cbff9f4cae5c87cb5cfc70ffe3bc8c9c5
2016-09-20 16:45:47 +02:00
|
|
|
eNumType = css::style::NumberingType::ARABIC;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2016-03-22 15:56:13 +02:00
|
|
|
ScHeaderEditEngine::ScHeaderEditEngine( SfxItemPool* pEnginePoolP )
|
|
|
|
: ScEditEngineDefaulter( pEnginePoolP,true/*bDeleteEnginePoolP*/ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-26 10:08:28 +01:00
|
|
|
OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 /* nPara */, sal_Int32 /* nPos */,
|
2007-02-27 11:15:32 +00:00
|
|
|
Color*& /* rTxtColor */, Color*& /* rFldColor */ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
const SvxFieldData* pFieldData = rField.GetField();
|
2012-05-08 17:05:37 -04:00
|
|
|
if (!pFieldData)
|
2013-04-07 12:06:47 +02:00
|
|
|
return OUString("?");
|
2012-05-08 17:05:37 -04:00
|
|
|
|
2012-12-15 14:57:53 +00:00
|
|
|
OUString aRet;
|
2012-05-08 17:05:37 -04:00
|
|
|
sal_Int32 nClsId = pFieldData->GetClassId();
|
|
|
|
switch (nClsId)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-05-08 17:05:37 -04:00
|
|
|
case text::textfield::Type::PAGE:
|
2008-02-12 13:25:13 +00:00
|
|
|
aRet = lcl_GetNumStr( aData.nPageNo,aData.eNumType );
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
|
|
|
case text::textfield::Type::PAGES:
|
2008-02-12 13:25:13 +00:00
|
|
|
aRet = lcl_GetNumStr( aData.nTotalPages,aData.eNumType );
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
2012-11-05 19:58:02 -05:00
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
2012-05-08 17:05:37 -04:00
|
|
|
case text::textfield::Type::TIME:
|
2012-11-05 19:58:02 -05:00
|
|
|
// For now, time field in the header / footer is always dynamic.
|
2001-07-11 14:28:50 +00:00
|
|
|
aRet = ScGlobal::pLocaleData->getTime(aData.aTime);
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
2012-05-14 10:35:45 -04:00
|
|
|
case text::textfield::Type::DOCINFO_TITLE:
|
2000-09-18 23:16:46 +00:00
|
|
|
aRet = aData.aTitle;
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-05-08 17:05:37 -04:00
|
|
|
switch (static_cast<const SvxExtFileField*>(pFieldData)->GetFormat())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
case SVXFILEFORMAT_FULLPATH :
|
|
|
|
aRet = aData.aLongDocName;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aRet = aData.aShortDocName;
|
|
|
|
}
|
|
|
|
}
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
|
|
|
case text::textfield::Type::TABLE:
|
2000-09-18 23:16:46 +00:00
|
|
|
aRet = aData.aTabName;
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
|
|
|
case text::textfield::Type::DATE:
|
2001-07-11 14:28:50 +00:00
|
|
|
aRet = ScGlobal::pLocaleData->getDate(aData.aDate);
|
2012-05-08 17:05:37 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aRet = "?";
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Feld-Daten
|
2014-02-25 19:58:48 +01:00
|
|
|
|
2012-04-20 00:46:19 -04:00
|
|
|
ScFieldEditEngine::ScFieldEditEngine(
|
|
|
|
ScDocument* pDoc, SfxItemPool* pEnginePoolP,
|
|
|
|
SfxItemPool* pTextObjectPool, bool bDeleteEnginePoolP) :
|
2007-02-27 11:15:32 +00:00
|
|
|
ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
|
2012-04-20 00:46:19 -04:00
|
|
|
mpDoc(pDoc), bExecuteURL(true)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
if ( pTextObjectPool )
|
|
|
|
SetEditTextObjectPool( pTextObjectPool );
|
2015-03-24 16:05:55 +02:00
|
|
|
SetControlWord( EEControlBits(GetControlWord() | EEControlBits::MARKFIELDS) & ~EEControlBits::RTFSTYLESHEETS );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-04-26 10:08:28 +01:00
|
|
|
OUString ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 /* nPara */, sal_Int32 /* nPos */,
|
2007-02-27 11:15:32 +00:00
|
|
|
Color*& rTxtColor, Color*& /* rFldColor */ )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
const SvxFieldData* pFieldData = rField.GetField();
|
|
|
|
|
2012-04-20 00:46:19 -04:00
|
|
|
if (!pFieldData)
|
2013-04-07 12:06:47 +02:00
|
|
|
return OUString(" ");
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-08-25 13:45:55 -04:00
|
|
|
return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, &rTxtColor);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField, sal_Int32, sal_Int32 )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2015-10-06 10:50:12 +01:00
|
|
|
if (!bExecuteURL)
|
|
|
|
return;
|
|
|
|
if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(rField.GetField()))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2015-10-06 10:50:12 +01:00
|
|
|
ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-27 11:15:32 +00:00
|
|
|
ScNoteEditEngine::ScNoteEditEngine( SfxItemPool* pEnginePoolP,
|
2016-03-22 15:56:13 +02:00
|
|
|
SfxItemPool* pTextObjectPool ) :
|
|
|
|
ScEditEngineDefaulter( pEnginePoolP, false/*bDeleteEnginePoolP*/ )
|
2004-09-08 12:45:18 +00:00
|
|
|
{
|
|
|
|
if ( pTextObjectPool )
|
|
|
|
SetEditTextObjectPool( pTextObjectPool );
|
2015-03-24 16:05:55 +02:00
|
|
|
SetControlWord( EEControlBits(GetControlWord() | EEControlBits::MARKFIELDS) & ~EEControlBits::RTFSTYLESHEETS );
|
2004-09-08 12:45:18 +00:00
|
|
|
}
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|