#87316# load/save protected attribute for indices

This commit is contained in:
Daniel Vogelheim 2001-05-29 11:32:58 +00:00
parent f1a2da716a
commit ff7f865553
4 changed files with 49 additions and 17 deletions

View file

@ -1,5 +1,5 @@
<!--
$Id: text.mod,v 1.31 2001-05-07 12:06:55 dvo Exp $
$Id: text.mod,v 1.32 2001-05-29 12:32:57 dvo Exp $
The Contents of this file are made available subject to the terms of
either of the following licenses
@ -747,6 +747,7 @@
<!ELEMENT text:table-of-content (text:table-of-content-source,
text:index-body) >
<!ATTLIST text:table-of-content text:style-name %styleName; #IMPLIED>
<!ATTLIST text:table-of-content text:protected %boolean; "false">
<!ELEMENT text:table-of-content-source (text:index-title-template? ,
text:table-of-content-entry-template*,
@ -775,6 +776,7 @@
<!ELEMENT text:illustration-index
(text:illustration-index-source, text:index-body)>
<!ATTLIST text:illustration-index text:style-name %styleName; #IMPLIED>
<!ATTLIST text:illustration-index text:protected %boolean; "false">
<!ELEMENT text:illustration-index-source (text:index-title-template?,
text:illustration-index-entry-template?) >
@ -798,6 +800,7 @@
<!ELEMENT text:table-index (text:table-index-source, text:index-body)>
<!ATTLIST text:table-index text:style-name %styleName; #IMPLIED>
<!ATTLIST text:table-index text:protected %boolean; "false">
<!ELEMENT text:table-index-source (text:index-title-template?,
text:table-index-entry-template?) >
@ -820,6 +823,7 @@
<!ELEMENT text:object-index ( text:object-index-source, text:index-body ) >
<!ATTLIST text:object-index text:style-name %styleName; #IMPLIED>
<!ATTLIST text:object-index text:protected %boolean; "false">
<!ELEMENT text:object-index-source ( text:index-title-template?,
text:object-index-entry-template? ) >
@ -843,6 +847,7 @@
<!ELEMENT text:user-index (text:user-index-source, text:index-body) >
<!ATTLIST text:user-index text:style-name %styleName; #IMPLIED>
<!ATTLIST text:user-index text:protected %boolean; "false">
<!ELEMENT text:user-index-source ( text:index-title-template?,
text:user-index-entry-template*,
@ -871,6 +876,7 @@
<!ELEMENT text:alphabetical-index (text:alphabetical-index-source,
text:index-body)>
<!ATTLIST text:alphabetical-index text:style-name %styleName; #IMPLIED>
<!ATTLIST text:alphabetical-index text:protected %boolean; "false">
<!ELEMENT text:alphabetical-index-source ( text:index-title-template?,
text:alphabetical-index-entry-template* ) >
@ -912,6 +918,7 @@
<!ELEMENT text:bibliography (text:bibliography-source, text:index-body) >
<!ATTLIST text:bibliography text:style-name %styleName; #IMPLIED>
<!ATTLIST text:bibliography text:protected %boolean; "false">
<!ELEMENT text:bibliography-source ( text:index-title-template?,
text:bibliography-entry-template* ) >

View file

@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCContext.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: dvo $ $Date: 2001-01-02 14:41:37 $
* last change: $Author: dvo $ $Date: 2001-05-29 12:32:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -219,7 +219,8 @@ XMLIndexTOCContext::XMLIndexTOCContext(
SvXMLImportContext(rImport, nPrfx, rLocalName),
pSourceElementName(NULL),
bValid(sal_False),
sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected"))
{
if (XML_NAMESPACE_TEXT == nPrfx)
{
@ -376,26 +377,43 @@ void XMLIndexTOCContext::StartElement(
}
// find text:style-name attribute and set section style
// find text:protected and set value
sal_Int16 nCount = xAttrList->getLength();
sal_Bool bProtected = sal_False;
for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
{
OUString sLocalName;
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
&sLocalName );
if ( (XML_NAMESPACE_TEXT == nPrefix) &&
(sLocalName.equalsAsciiL(sXML_style_name,
sizeof(sXML_style_name)-1)) )
if ( XML_NAMESPACE_TEXT == nPrefix)
{
XMLPropStyleContext* pStyle =
GetImport().GetTextImport()->FindSectionStyle(
xAttrList->getValueByIndex(nAttr));
if (pStyle != NULL)
if ( sLocalName.equalsAsciiL(sXML_style_name,
sizeof(sXML_style_name)-1) )
{
pStyle->FillPropertySet( xTOCPropertySet );
XMLPropStyleContext* pStyle =
GetImport().GetTextImport()->FindSectionStyle(
xAttrList->getValueByIndex(nAttr));
if (pStyle != NULL)
{
pStyle->FillPropertySet( xTOCPropertySet );
}
}
else if ( sLocalName.equalsAsciiL(sXML_protected,
sizeof(sXML_protected)-1) )
{
sal_Bool bTmp;
if ( SvXMLUnitConverter::convertBool(
bTmp, xAttrList->getValueByIndex(nAttr) ) )
{
bProtected = bTmp;
}
}
}
}
Any aAny;
aAny.setValue( &bProtected, ::getBooleanCppuType() );
xTOCPropertySet->setPropertyValue( sIsProtected, aAny );
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: XMLIndexTOCContext.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: dvo $ $Date: 2000-11-30 16:46:20 $
* last change: $Author: dvo $ $Date: 2001-05-29 12:32:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -103,6 +103,7 @@ enum IndexTypeEnum
class XMLIndexTOCContext : public SvXMLImportContext
{
const ::rtl::OUString sTitle;
const ::rtl::OUString sIsProtected;
/** XPropertySet of the index */
::com::sun::star::uno::Reference<

View file

@ -2,9 +2,9 @@
*
* $RCSfile: XMLSectionExport.cxx,v $
*
* $Revision: 1.16 $
* $Revision: 1.17 $
*
* last change: $Author: dvo $ $Date: 2001-05-02 15:04:56 $
* last change: $Author: dvo $ $Date: 2001-05-29 12:32:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -889,7 +889,13 @@ void XMLSectionExport::ExportBaseIndexStart(
const OUString sElementName,
const Reference<XPropertySet> & rPropertySet)
{
// rPropertySet not used any more; should be removed
// protect + protection key
Any aAny = rPropertySet->getPropertyValue(sIsProtected);
if (*(sal_Bool*)aAny.getValue())
{
GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT, sXML_protected,
sXML_true);
}
// index Element start
GetExport().GetDocHandler()->ignorableWhitespace( GetExport().sWS );