19#include <oox/token/namespaces.hxx>
20#include <oox/token/tokens.hxx>
26#include <document.hxx>
27#include <compiler.hxx>
32#include <tokenarray.hxx>
34#include <com/sun/star/util/DateTime.hpp>
53class RCCCellValueContext :
public WorkbookContextBase
64 RevisionLogFragment& rParent, sal_Int32 nSheetIndex,
ScAddress& rPos,
ScCellValue& rCellValue ) :
65 WorkbookContextBase(rParent),
73 sal_Int32 nElement,
const AttributeList& )
override
75 if (nElement == XLS_TOKEN(is))
84 virtual void onStartElement(
const AttributeList& rAttribs )
override
86 switch (getCurrentElement())
97 virtual void onCharacters(
const OUString& rChars )
override
99 switch (getCurrentElement())
109 if (
mnType == XML_inlineStr)
122 std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(rChars);
134 virtual void onEndElement()
override
136 switch (getCurrentElement())
149 pTextObj->NormalizeString(rPool);
161 void importCell(
const AttributeList& rAttribs )
163 mnType = rAttribs.getToken(XML_t, XML_n);
164 OUString aRefStr = rAttribs.getString(XML_r, OUString());
165 if (!aRefStr.isEmpty())
174struct RevisionMetadata
180 RevisionMetadata(
const RevisionMetadata& r ) :
210 switch (getCurrentElement())
212 case XLS_TOKEN(headers):
217 case XLS_TOKEN(sheetIdMap):
219 case XLS_TOKEN(sheetId):
230 switch (getCurrentElement())
232 case XLS_TOKEN(headers):
236 case XLS_TOKEN(sheetIdMap):
238 case XLS_TOKEN(sheetId):
249 OUString aSelfUser = pCT->GetUser();
250 pCT->SetUseFixDateTime(
true);
253 for (
const auto& [rRelId, rData] :
mpImpl->maRevData)
260 pCT->SetUser(rData.maUserName);
261 pCT->SetFixDateTimeLocal(rData.maDateTime);
267 pCT->SetUser(aSelfUser);
268 pCT->SetUseFixDateTime(
false);
279 OUString aRId = rAttribs.
getString(R_TOKEN(
id), OUString());
284 RevisionMetadata aMetadata;
285 OUString aDateTimeStr = rAttribs.
getString(XML_dateTime, OUString());
286 if (!aDateTimeStr.isEmpty())
288 util::DateTime aDateTime;
290 aMetadata.maDateTime = aDateTime;
292 SAL_WARN(
"sc.filter",
"RevisionHeadersFragment: broken DateTime '" << aDateTimeStr <<
"'");
295 aMetadata.maUserName = rAttribs.
getString(XML_userName, OUString());
297 mpImpl->maRevData.emplace(aRId, aMetadata);
329 mpImpl(new
Impl(rChangeTrack)) {}
341 return new RCCCellValueContext(*
this,
mpImpl->mnSheetIndex,
mpImpl->maNewCellPos,
mpImpl->maNewCellValue);
343 return new RCCCellValueContext(*
this,
mpImpl->mnSheetIndex,
mpImpl->maOldCellPos,
mpImpl->maOldCellValue);
352 switch (getCurrentElement())
355 mpImpl->maNewCellPos.SetInvalid();
356 mpImpl->maOldCellPos.SetInvalid();
357 mpImpl->maNewCellValue.clear();
358 mpImpl->maOldCellValue.clear();
373 switch (getCurrentElement())
395 mpImpl->meType = REV_CELLCHANGE;
402 if (
mpImpl->mnSheetIndex == -1)
406 mpImpl->meType = REV_UNKNOWN;
407 sal_Int32 nAction = rAttribs.
getToken(XML_action, -1);
411 OUString aRefStr = rAttribs.
getString(XML_ref, OUString());
413 if (!
mpImpl->maRange.IsValid())
419 mpImpl->meType = REV_INSERTROW;
437 mpImpl->mrChangeTrack.AppendContentOnTheFly(
constexpr sal_Int8 header[]
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
void SetShowChanges(bool bFlag)
SC_DLLPUBLIC void SetChangeTrack(std::unique_ptr< ScChangeTrack > pTrack)
only for import filter, deletes any existing ChangeTrack via EndChangeTracking() and takes ownership ...
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings &rNew)
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
std::optional< OUString > getString(sal_Int32 nAttrToken) const
std::optional< bool > getBool(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
OUString getFragmentPathFromRelId(const OUString &rRelId) const
static FastParser * createParser()
virtual ~RevisionLogFragment() override
void importCommon(const AttributeList &rAttribs)
virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
virtual void finalizeImport() override
std::unique_ptr< Impl > mpImpl
void importRcc(const AttributeList &rAttribs)
RevisionLogFragment(const WorkbookHelper &rHelper, const OUString &rFragmentPath, ScChangeTrack &rChangeTrack)
virtual void onEndElement() override
virtual void onCharacters(const OUString &rChars) override
void importRrc(const AttributeList &rAttribs)
virtual void onStartElement(const AttributeList &rAttribs) override
Fragment handler derived from the WorkbookHelper helper class.
Helper class to provide access to global workbook data.
bool importOoxFragment(const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
Imports a fragment using the passed fragment handler, which contains the full path to the fragment st...
ScDocument & getScDocument()
static bool parseDateTime(css::util::DateTime &rDateTime, std::u16string_view rString)
SharedString intern(const OUString &rStr)
#define SAL_WARN(area, stream)
std::shared_ptr< RichString > RichStringRef
constexpr OUStringLiteral EMPTY
ScCellValue & mrCellValue
RichStringRef mxRichString
Store arbitrary cell value of any kind.
ScChangeTrack & mrChangeTrack
Impl(ScChangeTrack &rChangeTrack)
ScCellValue maOldCellValue
ScCellValue maNewCellValue