2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-04-17 10:38:58 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
2008-04-10 21:54:14 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-04-17 10:38:58 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:01:34 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_xmloff.hxx"
|
2001-04-17 10:38:58 +00:00
|
|
|
#include "XMLAutoMarkFileContext.hxx"
|
2007-06-27 14:52:12 +00:00
|
|
|
#include <xmloff/xmlimp.hxx>
|
2001-04-17 10:38:58 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
2007-06-27 14:52:12 +00:00
|
|
|
#include <xmloff/nmspmap.hxx>
|
2010-04-16 23:04:00 +02:00
|
|
|
#include "xmloff/xmlnmspe.hxx"
|
2007-06-27 14:52:12 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2001-04-17 10:38:58 +00:00
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::xml::sax::XAttributeList;
|
|
|
|
using ::com::sun::star::beans::XPropertySet;
|
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
using ::xmloff::token::IsXMLToken;
|
|
|
|
using ::xmloff::token::XML_HREF;
|
|
|
|
|
2001-04-17 10:38:58 +00:00
|
|
|
|
|
|
|
TYPEINIT1( XMLAutoMarkFileContext, SvXMLImportContext );
|
|
|
|
|
|
|
|
XMLAutoMarkFileContext::XMLAutoMarkFileContext(
|
|
|
|
SvXMLImport& rImport,
|
|
|
|
sal_uInt16 nPrefix,
|
|
|
|
const OUString& rLocalName) :
|
|
|
|
SvXMLImportContext(rImport, nPrefix, rLocalName),
|
|
|
|
sIndexAutoMarkFileURL(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM("IndexAutoMarkFileURL"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLAutoMarkFileContext::~XMLAutoMarkFileContext()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void XMLAutoMarkFileContext::StartElement(
|
|
|
|
const Reference<XAttributeList> & xAttrList)
|
|
|
|
{
|
|
|
|
// scan for text:alphabetical-index-auto-mark-file attribute, and if
|
|
|
|
// found set value with the document
|
|
|
|
|
|
|
|
sal_Int16 nLength = xAttrList->getLength();
|
|
|
|
for( sal_Int16 i = 0; i < nLength; i++ )
|
|
|
|
{
|
|
|
|
OUString sLocalName;
|
|
|
|
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
|
|
|
|
GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
|
|
|
|
|
|
|
|
if ( ( XML_NAMESPACE_XLINK == nPrefix ) &&
|
2001-06-29 20:07:26 +00:00
|
|
|
IsXMLToken(sLocalName, XML_HREF) )
|
2001-04-17 10:38:58 +00:00
|
|
|
{
|
|
|
|
Any aAny;
|
2001-06-27 06:38:11 +00:00
|
|
|
aAny <<= GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) );
|
2001-04-17 10:38:58 +00:00
|
|
|
Reference<XPropertySet> xPropertySet(
|
|
|
|
GetImport().GetModel(), UNO_QUERY );
|
|
|
|
if (xPropertySet.is())
|
|
|
|
{
|
|
|
|
xPropertySet->setPropertyValue( sIndexAutoMarkFileURL, aAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|