summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-08-03 13:46:23 +0000
committerSascha Ballach <sab@openoffice.org>2001-08-03 13:46:23 +0000
commiteedc83b9e2869a522ade03777d883ec1901d2486 (patch)
treee7371215cc631d061b999ddf5bce4304d99388d2 /sc
parentbc33f01345c38fb1ea8ca28f698ecfe190dffcac (diff)
#90549#; remember the IsVisible property and don't ask again for this
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx187
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx11
-rw-r--r--sc/source/filter/xml/xmlstyle.cxx52
-rw-r--r--sc/source/filter/xml/xmlstyle.hxx33
4 files changed, 177 insertions, 106 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3e398129bb95..ef5fc07b730f 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexprt.cxx,v $
*
- * $Revision: 1.132 $
+ * $Revision: 1.133 $
*
- * last change: $Author: sab $ $Date: 2001-08-02 08:53:57 $
+ * last change: $Author: sab $ $Date: 2001-08-03 14:46:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -435,8 +435,8 @@ ScXMLExport::ScXMLExport(const sal_uInt16 nExportFlag) :
{
pGroupColumns = new ScMyOpenCloseColumnRowGroup(*this, XML_TABLE_COLUMN_GROUP);
pGroupRows = new ScMyOpenCloseColumnRowGroup(*this, XML_TABLE_ROW_GROUP);
- pColumnStyles = new ScColumnRowStyles();
- pRowStyles = new ScColumnRowStyles();
+ pColumnStyles = new ScColumnStyles();
+ pRowStyles = new ScRowStyles();
pRowFormatRanges = new ScRowFormatRanges();
pMergedRangesContainer = new ScMyMergedRangesContainer();
pValidationsContainer = new ScMyValidationsContainer();
@@ -454,7 +454,7 @@ ScXMLExport::ScXMLExport(const sal_uInt16 nExportFlag) :
xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesProperties, xScPropHdlFactory);
xCellStylesExportPropertySetMapper = new ScXMLCellExportPropertyMapper(xCellStylesPropertySetMapper);
xCellStylesExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateCharExtPropMapper(*this));
- xColumnStylesExportPropertySetMapper = new SvXMLExportPropertyMapper(xColumnStylesPropertySetMapper);
+ xColumnStylesExportPropertySetMapper = new ScXMLColumnExportPropertyMapper(xColumnStylesPropertySetMapper);
xRowStylesExportPropertySetMapper = new ScXMLRowExportPropertyMapper(xRowStylesPropertySetMapper);
xTableStylesExportPropertySetMapper = new ScXMLTableExportPropertyMapper(xTableStylesPropertySetMapper);
@@ -859,105 +859,86 @@ void ScXMLExport::ExportColumns(const sal_uInt16 nTable, const table::CellRangeA
sal_Bool bIsClosed (sal_True);
sal_Bool bIsFirst (sal_False);
sal_Int32 nPrevIndex (-1);
- uno::Reference<table::XColumnRowRange> xColumnRowRange (xCurrentTable, uno::UNO_QUERY);
- if (xColumnRowRange.is())
+ for (sal_Int32 nColumn = 0; nColumn <= pSharedData->GetLastColumn(nTable); nColumn++)
{
- uno::Reference<table::XTableColumns> xTableColumns = xColumnRowRange->getColumns();
- if (xTableColumns.is())
+ CheckAttrList();
+ sal_Bool bIsVisible(sal_True);
+ nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumn, bIsVisible);
+
+ bIsHeader = bHasColumnHeader && (aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= aColumnHeaderRange.EndColumn);
+ if (bIsHeader != bWasHeader)
{
- for (sal_Int32 nColumn = 0; nColumn <= pSharedData->GetLastColumn(nTable); nColumn++)
+ if (bIsHeader)
{
- CheckAttrList();
- uno::Any aColumn = xTableColumns->getByIndex(nColumn);
- uno::Reference<table::XCellRange> xTableColumn;
- if (aColumn >>= xTableColumn)
+ bIsFirst = sal_False;
+ if (nColumn > 0)
{
- uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumn, uno::UNO_QUERY);
- if (xColumnProperties.is())
- {
- nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumn);
-
- uno::Any aAny = xColumnProperties->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLVIS)));
- sal_Bool bIsVisible(sal_True);
- aAny >>= bIsVisible;
- bIsHeader = bHasColumnHeader && (aColumnHeaderRange.StartColumn <= nColumn) && (nColumn <= aColumnHeaderRange.EndColumn);
- if (bIsHeader != bWasHeader)
- {
- if (bIsHeader)
- {
- bIsFirst = sal_False;
- if (nColumn > 0)
- {
- WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
- if (pGroupColumns->IsGroupEnd(nColumn - 1))
- pGroupColumns->CloseGroups(nColumn - 1);
- }
- bPrevIsVisible = bIsVisible;
- nPrevIndex = nIndex;
- nPrevColumn = nColumn;
- nColsRepeated = 1;
- bIsFirst = sal_True;
- if(pGroupColumns->IsGroupStart(nColumn))
- pGroupColumns->OpenGroups(nColumn);
- OpenHeaderColumn();
- bWasHeader = sal_True;
- bIsClosed = sal_False;
- }
- else
- {
- WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
- CloseHeaderColumn();
- if (pGroupColumns->IsGroupEnd(nColumn - 1))
- pGroupColumns->CloseGroups(nColumn - 1);
- bPrevIsVisible = bIsVisible;
- nPrevIndex = nIndex;
- nPrevColumn = nColumn;
- nColsRepeated = 1;
- bWasHeader = sal_False;
- bIsClosed = sal_True;
- }
- }
- else if (nColumn == 0)
- {
- if (pGroupColumns->IsGroupStart(nColumn))
- pGroupColumns->OpenGroups(nColumn);
- bPrevIsVisible = bIsVisible;
- nPrevIndex = nIndex;
- bIsFirst = sal_True;
- }
- else if ((bIsVisible == bPrevIsVisible) && (nIndex == nPrevIndex) &&
- !pGroupColumns->IsGroupStart(nColumn) && !pGroupColumns->IsGroupEnd(nColumn - 1))
- nColsRepeated++;
- else
- {
- bIsFirst = sal_False;
- WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
- if (pGroupColumns->IsGroupEnd(nColumn - 1))
- pGroupColumns->CloseGroups(nColumn - 1);
- if (pGroupColumns->IsGroupStart(nColumn))
- {
- if (bIsHeader)
- CloseHeaderColumn();
- pGroupColumns->OpenGroups(nColumn);
- if (bIsHeader)
- OpenHeaderColumn();
- }
- bPrevIsVisible = bIsVisible;
- nPrevIndex = nIndex;
- nPrevColumn = nColumn;
- nColsRepeated = 1;
- }
- }
+ WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
+ if (pGroupColumns->IsGroupEnd(nColumn - 1))
+ pGroupColumns->CloseGroups(nColumn - 1);
}
+ bPrevIsVisible = bIsVisible;
+ nPrevIndex = nIndex;
+ nPrevColumn = nColumn;
+ nColsRepeated = 1;
+ bIsFirst = sal_True;
+ if(pGroupColumns->IsGroupStart(nColumn))
+ pGroupColumns->OpenGroups(nColumn);
+ OpenHeaderColumn();
+ bWasHeader = sal_True;
+ bIsClosed = sal_False;
}
- //if (nColsRepeated > 1 || bIsFirst)
+ else
+ {
WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
- if (!bIsClosed)
CloseHeaderColumn();
+ if (pGroupColumns->IsGroupEnd(nColumn - 1))
+ pGroupColumns->CloseGroups(nColumn - 1);
+ bPrevIsVisible = bIsVisible;
+ nPrevIndex = nIndex;
+ nPrevColumn = nColumn;
+ nColsRepeated = 1;
+ bWasHeader = sal_False;
+ bIsClosed = sal_True;
+ }
+ }
+ else if (nColumn == 0)
+ {
+ if (pGroupColumns->IsGroupStart(nColumn))
+ pGroupColumns->OpenGroups(nColumn);
+ bPrevIsVisible = bIsVisible;
+ nPrevIndex = nIndex;
+ bIsFirst = sal_True;
+ }
+ else if ((bIsVisible == bPrevIsVisible) && (nIndex == nPrevIndex) &&
+ !pGroupColumns->IsGroupStart(nColumn) && !pGroupColumns->IsGroupEnd(nColumn - 1))
+ nColsRepeated++;
+ else
+ {
+ bIsFirst = sal_False;
+ WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
if (pGroupColumns->IsGroupEnd(nColumn - 1))
pGroupColumns->CloseGroups(nColumn - 1);
+ if (pGroupColumns->IsGroupStart(nColumn))
+ {
+ if (bIsHeader)
+ CloseHeaderColumn();
+ pGroupColumns->OpenGroups(nColumn);
+ if (bIsHeader)
+ OpenHeaderColumn();
+ }
+ bPrevIsVisible = bIsVisible;
+ nPrevIndex = nIndex;
+ nPrevColumn = nColumn;
+ nColsRepeated = 1;
}
}
+ //if (nColsRepeated > 1 || bIsFirst)
+ WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
+ if (!bIsClosed)
+ CloseHeaderColumn();
+ if (pGroupColumns->IsGroupEnd(nColumn - 1))
+ pGroupColumns->CloseGroups(nColumn - 1);
}
void ScXMLExport::WriteRowContent()
@@ -1763,7 +1744,8 @@ void ScXMLExport::_ExportAutoStyles()
sal_Int32 nColumn = 0;
while (/*nColumn <= nColumns && */nColumn <= MAXCOL)
{
- sal_Int32 nIndex;
+ sal_Int32 nIndex(-1);
+ sal_Bool bIsVisible(sal_True);
uno::Any aColumn = xTableColumns->getByIndex(nColumn);
uno::Reference<table::XCellRange> xTableColumn;
if (aColumn >>= xTableColumn)
@@ -1774,6 +1756,16 @@ void ScXMLExport::_ExportAutoStyles()
std::vector<XMLPropertyState> xPropStates = xColumnStylesExportPropertySetMapper->Filter(xColumnProperties);
if(xPropStates.size())
{
+ std::vector< XMLPropertyState >::iterator aItr = xPropStates.begin();
+ while (aItr != xPropStates.end())
+ {
+ if (xColumnStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex) == CTF_SC_ISVISIBLE)
+ {
+ aItr->maValue >>= bIsVisible;
+ break;
+ }
+ aItr++;
+ }
rtl::OUString sParent;
rtl::OUString sName;
if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates))
@@ -1783,7 +1775,7 @@ void ScXMLExport::_ExportAutoStyles()
}
else
nIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX);
- pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex);
+ pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
}
}
}
@@ -1792,13 +1784,14 @@ void ScXMLExport::_ExportAutoStyles()
if (nColumn == MAXCOL)
nColumn++;
for (sal_Int32 i = nOld + 1; i < nColumn; i++)
- pColumnStyles->AddFieldStyleName(nTable, i, nIndex);
+ pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
}
if (aCellAddress.EndColumn > nColumns)
{
- sal_Int32 nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumns);
+ sal_Bool bIsVisible(sal_True);
+ sal_Int32 nIndex = pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible);
for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; i++)
- pColumnStyles->AddFieldStyleName(nTable, i, nIndex);
+ pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
}
}
uno::Reference<table::XTableRows> xTableRows = xColumnRowRange->getRows();
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 1ae3ff5c819e..fe6aeed5a1bf 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexprt.hxx,v $
*
- * $Revision: 1.67 $
+ * $Revision: 1.68 $
*
- * last change: $Author: sab $ $Date: 2001-08-02 08:53:57 $
+ * last change: $Author: sab $ $Date: 2001-08-03 14:46:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,8 @@ class ScMyMergedRangesContainer;
class ScMyValidationsContainer;
class ScMyNotEmptyCellsIterator;
class ScChangeTrackingExportHelper;
-class ScColumnRowStyles;
+class ScColumnStyles;
+class ScRowStyles;
class ScFormatRangeStyles;
class ScRowFormatRanges;
class ScMyOpenCloseColumnRowGroup;
@@ -121,8 +122,8 @@ class ScXMLExport : public SvXMLExport
UniReference < SvXMLExportPropertyMapper > xTableStylesExportPropertySetMapper;
XMLNumberFormatAttributesExportHelper* pNumberFormatAttributesExportHelper;
ScMySharedData* pSharedData;
- ScColumnRowStyles* pColumnStyles;
- ScColumnRowStyles* pRowStyles;
+ ScColumnStyles* pColumnStyles;
+ ScRowStyles* pRowStyles;
ScFormatRangeStyles* pCellStyles;
ScRowFormatRanges* pRowFormatRanges;
std::vector<rtl::OUString> aTableStyles;
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index f45977f177ca..ac7b0a3aeb09 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyle.cxx,v $
*
- * $Revision: 1.38 $
+ * $Revision: 1.39 $
*
- * last change: $Author: sab $ $Date: 2001-07-26 06:51:20 $
+ * last change: $Author: sab $ $Date: 2001-08-03 14:46:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,9 @@
#ifndef _XMLOFF_ATTRLIST_HXX
#include <xmloff/attrlist.hxx>
#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
#ifndef _COM_SUN_STAR_UTIL_CELLPROTECTION_HPP_
#include <com/sun/star/util/CellProtection.hpp>
@@ -173,6 +176,7 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
{
MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_SC_TYPE_BREAKBEFORE, 0),
+ MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
MAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_MEASURE, 0 ),
// MAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_COLUMN_WIDTH, XML_TYPE_BOOL, 0),
{ 0L }
@@ -407,6 +411,28 @@ void ScXMLRowExportPropertyMapper::ContextFilter(
}
}
+ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper )
+ : SvXMLExportPropertyMapper(rMapper)
+{
+}
+
+ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
+{
+}
+
+/** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+void ScXMLColumnExportPropertyMapper::handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties,
+ sal_uInt32 nIdx ) const
+{
+ // the SpecialItem IsVisible must not be handled by this method
+}
+
ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
const UniReference< XMLPropertySetMapper >& rMapper )
: SvXMLExportPropertyMapper(rMapper)
@@ -731,6 +757,11 @@ const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
pHdl = new XmlScPropHdl_IsTextWrapped;
}
break;
+ case XML_SC_TYPE_EQUAL :
+ {
+ pHdl = new XmlScPropHdl_IsEqual;
+ }
+ break;
}
if(pHdl)
@@ -1537,3 +1568,20 @@ sal_Bool XmlScPropHdl_IsTextWrapped::exportXML(
return bRetval;
}
+
+sal_Bool XmlScPropHdl_IsEqual::importXML( const ::rtl::OUString& rStrImpValue,
+ ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ DBG_ERROR("should never be called");
+ return sal_False;
+}
+
+sal_Bool XmlScPropHdl_IsEqual::exportXML( ::rtl::OUString& rStrExpValue,
+ const ::com::sun::star::uno::Any& rValue,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ DBG_ERROR("should never be called");
+ return sal_False;
+}
+
diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx
index c5195aea489e..052601916178 100644
--- a/sc/source/filter/xml/xmlstyle.hxx
+++ b/sc/source/filter/xml/xmlstyle.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyle.hxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: sab $ $Date: 2001-05-29 15:42:01 $
+ * last change: $Author: sab $ $Date: 2001-08-03 14:46:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,6 +108,7 @@ extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
#define XML_SC_TYPE_BORDERBOTTOM (XML_SC_TYPES_START + 12)
#define XML_SC_TYPE_VERTJUSTIFY (XML_SC_TYPES_START + 13)
#define XML_SC_ISTEXTWRAPPED (XML_SC_TYPES_START + 14)
+#define XML_SC_TYPE_EQUAL (XML_SC_TYPES_START + 15)
#define CTF_SC_HORIJUSTIFY (XML_SC_CTF_START + 1)
#define CTF_SC_HORIJUSTIFY_SOURCE (XML_SC_CTF_START + 2)
@@ -137,6 +138,7 @@ extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
#define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50)
#define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51)
#define CTF_SC_ROWBREAKBEFORE (XML_SC_CTF_START + 52)
+#define CTF_SC_ISVISIBLE (XML_SC_CTF_START + 53)
#define CTF_SC_MASTERPAGENAME (XML_SC_CTF_START + 53)
@@ -183,6 +185,23 @@ public:
virtual ~ScXMLRowExportPropertyMapper();
};
+class ScXMLColumnExportPropertyMapper : public SvXMLExportPropertyMapper
+{
+public:
+ ScXMLColumnExportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper );
+ virtual ~ScXMLColumnExportPropertyMapper();
+
+ /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+ virtual void handleSpecialItem(
+ SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState > *pProperties = 0,
+ sal_uInt32 nIdx = 0 ) const;
+};
+
class ScXMLTableExportPropertyMapper : public SvXMLExportPropertyMapper
{
protected:
@@ -339,4 +358,14 @@ public:
virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
};
+
+class XmlScPropHdl_IsEqual : public XMLPropertyHandler
+{
+public:
+ virtual ~XmlScPropHdl_IsEqual() {}
+ virtual sal_Bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const { return sal_True; }
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
#endif