Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
40283f01
Kaydet (Commit)
40283f01
authored
Agu 10, 2011
tarafından
Nigel Hawkins
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replace SvArray stuff with vector in xmloff/xmlcnimp.hxx and refactor
LGPLv3+/MPL1.1
üst
f26117a5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
580 additions
and
289 deletions
+580
-289
Library_xo.mk
xmloff/Library_xo.mk
+3
-1
xmlcnimp.hxx
xmloff/inc/xmloff/xmlcnimp.hxx
+20
-67
SvXMLAttr.cxx
xmloff/source/core/SvXMLAttr.cxx
+72
-0
SvXMLAttr.hxx
xmloff/source/core/SvXMLAttr.hxx
+58
-0
SvXMLAttrCollection.cxx
xmloff/source/core/SvXMLAttrCollection.cxx
+188
-0
SvXMLAttrCollection.hxx
xmloff/source/core/SvXMLAttrCollection.hxx
+90
-0
unoatrcn.cxx
xmloff/source/core/unoatrcn.cxx
+1
-0
xmlcnimp.cxx
xmloff/source/core/xmlcnimp.cxx
+148
-0
xmlcnitm.cxx
xmloff/source/core/xmlcnitm.cxx
+0
-221
No files found.
xmloff/Library_xo.mk
Dosyayı görüntüle @
40283f01
...
@@ -100,6 +100,8 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
...
@@ -100,6 +100,8 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/core/RDFaExportHelper \
xmloff/source/core/RDFaExportHelper \
xmloff/source/core/RDFaImportHelper \
xmloff/source/core/RDFaImportHelper \
xmloff/source/core/SettingsExportHelper \
xmloff/source/core/SettingsExportHelper \
xmloff/source/core/SvXMLAttr \
xmloff/source/core/SvXMLAttrCollection \
xmloff/source/core/XMLBase64Export \
xmloff/source/core/XMLBase64Export \
xmloff/source/core/XMLBase64ImportContext \
xmloff/source/core/XMLBase64ImportContext \
xmloff/source/core/XMLBasicExportFilter \
xmloff/source/core/XMLBasicExportFilter \
...
@@ -111,7 +113,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
...
@@ -111,7 +113,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/core/nmspmap \
xmloff/source/core/nmspmap \
xmloff/source/core/unoatrcn \
xmloff/source/core/unoatrcn \
xmloff/source/core/unointerfacetouniqueidentifiermapper \
xmloff/source/core/unointerfacetouniqueidentifiermapper \
xmloff/source/core/xmlcni
tm
\
xmloff/source/core/xmlcni
mp
\
xmloff/source/core/xmlehelp \
xmloff/source/core/xmlehelp \
xmloff/source/core/xmlerror \
xmloff/source/core/xmlerror \
xmloff/source/core/xmlexp \
xmloff/source/core/xmlexp \
...
...
xmloff/inc/xmloff/xmlcnimp.hxx
Dosyayı görüntüle @
40283f01
...
@@ -29,32 +29,21 @@
...
@@ -29,32 +29,21 @@
#ifndef _XMLOFF_XMLCNIMP_HXX
#ifndef _XMLOFF_XMLCNIMP_HXX
#define _XMLOFF_XMLCNIMP_HXX
#define _XMLOFF_XMLCNIMP_HXX
#include "sal/config.h"
#include "xmloff/dllapi.h" //XMLOFF_DLLPUBLIC
#include "xmloff/dllapi.h"
#include <sal/types.h> //sal_uInt16 and sal_Bool
#include "sal/types.h"
#include <boost/scoped_ptr.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <svl/svarray.hxx>
#include <xmloff/nmspmap.hxx>
#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
namespace
rtl
{
class
OUString
;
}
namespace
rtl
{
class
OUString
;
}
class
SvXMLAttrCollection
;
//Forward declaration only.
class
SvXMLAttrContainerData_Impl
;
class
XMLOFF_DLLPUBLIC
SvXMLAttrContainerData
class
XMLOFF_DLLPUBLIC
SvXMLAttrContainerData
{
{
SvXMLNamespaceMap
aNamespaceMap
;
private
:
SvUShorts
aPrefixPoss
;
boost
::
scoped_ptr
<
SvXMLAttrCollection
>
pimpl
;
SvXMLAttrContainerData_Impl
*
pLNames
;
SvXMLAttrContainerData_Impl
*
pValues
;
SAL_DLLPRIVATE
inline
sal_uInt16
GetPrefixPos
(
sal_uInt16
i
)
const
;
public
:
public
:
SvXMLAttrContainerData
(
const
SvXMLAttrContainerData
&
rImpl
);
SvXMLAttrContainerData
();
SvXMLAttrContainerData
();
SvXMLAttrContainerData
(
const
SvXMLAttrContainerData
&
rCopy
);
~
SvXMLAttrContainerData
();
~
SvXMLAttrContainerData
();
int
operator
==
(
const
SvXMLAttrContainerData
&
rCmp
)
const
;
int
operator
==
(
const
SvXMLAttrContainerData
&
rCmp
)
const
;
...
@@ -66,66 +55,30 @@ public:
...
@@ -66,66 +55,30 @@ public:
const
::
rtl
::
OUString
&
rLName
,
const
::
rtl
::
OUString
&
rLName
,
const
::
rtl
::
OUString
&
rValue
);
const
::
rtl
::
OUString
&
rValue
);
s
al_uInt16
GetAttrCount
()
const
;
s
ize_t
GetAttrCount
()
const
;
inline
::
rtl
::
OUString
GetAttrNamespace
(
sal_uInt16
i
)
const
;
const
rtl
::
OUString
GetAttrNamespace
(
size_t
i
)
const
;
inline
::
rtl
::
OUString
GetAttrPrefix
(
sal_uInt16
i
)
const
;
const
rtl
::
OUString
GetAttrPrefix
(
size_t
i
)
const
;
const
::
rtl
::
OUString
&
GetAttrLName
(
sal_uInt16
i
)
const
;
const
rtl
::
OUString
&
GetAttrLName
(
size_t
i
)
const
;
const
::
rtl
::
OUString
&
GetAttrValue
(
sal_uInt16
i
)
const
;
const
rtl
::
OUString
&
GetAttrValue
(
size_t
i
)
const
;
sal_uInt16
GetFirstNamespaceIndex
()
const
{
return
aNamespaceMap
.
GetFirstIndex
();
}
sal_uInt16
GetFirstNamespaceIndex
()
const
;
sal_uInt16
GetNextNamespaceIndex
(
sal_uInt16
nIdx
)
const
{
return
aNamespaceMap
.
GetNextIndex
(
nIdx
);
}
sal_uInt16
GetNextNamespaceIndex
(
sal_uInt16
nIdx
)
const
;
inline
const
::
rtl
::
OUString
&
GetNamespace
(
sal_uInt16
i
)
const
;
const
::
rtl
::
OUString
&
GetNamespace
(
sal_uInt16
i
)
const
;
inline
const
::
rtl
::
OUString
&
GetPrefix
(
sal_uInt16
i
)
const
;
const
::
rtl
::
OUString
&
GetPrefix
(
sal_uInt16
i
)
const
;
sal_Bool
SetAt
(
s
al_uInt16
i
,
sal_Bool
SetAt
(
s
ize_t
i
,
const
::
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
const
::
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
SetAt
(
s
al_uInt16
i
,
sal_Bool
SetAt
(
s
ize_t
i
,
const
::
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
::
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
::
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
const
::
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
SetAt
(
s
al_uInt16
i
,
sal_Bool
SetAt
(
s
ize_t
i
,
const
::
rtl
::
OUString
&
rPrefix
,
const
::
rtl
::
OUString
&
rPrefix
,
const
::
rtl
::
OUString
&
rLName
,
const
::
rtl
::
OUString
&
rLName
,
const
::
rtl
::
OUString
&
rValue
);
const
::
rtl
::
OUString
&
rValue
);
void
Remove
(
s
al_uInt16
i
);
void
Remove
(
s
ize_t
i
);
};
};
inline
sal_uInt16
SvXMLAttrContainerData
::
GetPrefixPos
(
sal_uInt16
i
)
const
{
// DBG_ASSERT( i >= 0 && i < aPrefixPoss.Count(),
// "SvXMLAttrContainerData::GetPrefixPos: illegal index" );
return
aPrefixPoss
[
i
];
}
inline
::
rtl
::
OUString
SvXMLAttrContainerData
::
GetAttrNamespace
(
sal_uInt16
i
)
const
{
::
rtl
::
OUString
sRet
;
sal_uInt16
nPos
=
GetPrefixPos
(
i
);
if
(
USHRT_MAX
!=
nPos
)
sRet
=
aNamespaceMap
.
GetNameByIndex
(
nPos
);
return
sRet
;
}
inline
::
rtl
::
OUString
SvXMLAttrContainerData
::
GetAttrPrefix
(
sal_uInt16
i
)
const
{
::
rtl
::
OUString
sRet
;
sal_uInt16
nPos
=
GetPrefixPos
(
i
);
if
(
USHRT_MAX
!=
nPos
)
sRet
=
aNamespaceMap
.
GetPrefixByIndex
(
nPos
);
return
sRet
;
}
inline
const
::
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetNamespace
(
sal_uInt16
i
)
const
{
return
aNamespaceMap
.
GetNameByIndex
(
i
);
}
inline
const
::
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetPrefix
(
sal_uInt16
i
)
const
{
return
aNamespaceMap
.
GetPrefixByIndex
(
i
);
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/SvXMLAttr.cxx
0 → 100644
Dosyayı görüntüle @
40283f01
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is
* Nigel Hawkins - n.hawkins@gmx.com
* Portions created by the Initial Developer are Copyright (C) 2011 the
* Initial Developer. All Rights Reserved.
*
* Major Contributor(s):
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#include <limits.h> //USHRT_MAX
#include "SvXMLAttr.hxx"
SvXMLAttr
::
SvXMLAttr
(
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
:
aPrefixPos
(
USHRT_MAX
),
aLName
(
rLName
),
aValue
(
rValue
)
{
}
SvXMLAttr
::
SvXMLAttr
(
const
sal_uInt16
nPos
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
:
aPrefixPos
(
nPos
),
aLName
(
rLName
),
aValue
(
rValue
)
{
}
bool
SvXMLAttr
::
operator
==
(
const
SvXMLAttr
&
rCmp
)
const
{
return
(
rCmp
.
aPrefixPos
==
aPrefixPos
)
&&
(
rCmp
.
aLName
==
aLName
)
&&
(
rCmp
.
aValue
==
aValue
);
}
sal_uInt16
SvXMLAttr
::
getPrefixPos
()
const
{
return
aPrefixPos
;
}
const
rtl
::
OUString
&
SvXMLAttr
::
getLName
()
const
{
return
aLName
;
}
const
rtl
::
OUString
&
SvXMLAttr
::
getValue
()
const
{
return
aValue
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/SvXMLAttr.hxx
0 → 100644
Dosyayı görüntüle @
40283f01
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is
* Nigel Hawkins - n.hawkins@gmx.com
* Portions created by the Initial Developer are Copyright (C) 2011 the
* Initial Developer. All Rights Reserved.
*
* Major Contributor(s):
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#ifndef _XMLOFF_SVXMLATTR_HXX
#define _XMLOFF_SVXMLATTR_HXX
#include <rtl/ustring.hxx> //rtl::OUString
class
SvXMLAttr
{
private
:
sal_uInt16
aPrefixPos
;
rtl
::
OUString
aLName
;
rtl
::
OUString
aValue
;
public
:
// Assuming OUString is well behaved, the default copy constructor and
// assignment operator are fine.
SvXMLAttr
(
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
SvXMLAttr
(
const
sal_uInt16
nPos
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
bool
operator
==
(
const
SvXMLAttr
&
rCmp
)
const
;
sal_uInt16
getPrefixPos
()
const
;
const
rtl
::
OUString
&
getLName
()
const
;
const
rtl
::
OUString
&
getValue
()
const
;
};
#endif
/* _XMLOFF_SVXMLATTR_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/SvXMLAttrCollection.cxx
0 → 100644
Dosyayı görüntüle @
40283f01
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is
* Nigel Hawkins - n.hawkins@gmx.com
* Portions created by the Initial Developer are Copyright (C) 2011 the
* Initial Developer. All Rights Reserved.
*
* Major Contributor(s):
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#include "SvXMLAttrCollection.hxx"
#include <limits.h> //USHRT_MAX
bool
SvXMLAttrCollection
::
operator
==
(
const
SvXMLAttrCollection
&
rCmp
)
const
{
return
(
rCmp
.
aNamespaceMap
==
aNamespaceMap
)
&&
(
rCmp
.
aAttrs
==
aAttrs
);
}
sal_Bool
SvXMLAttrCollection
::
AddAttr
(
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
aAttrs
.
push_back
(
SvXMLAttr
(
rLName
,
rValue
)
);
return
sal_True
;
}
sal_Bool
SvXMLAttrCollection
::
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
sal_uInt16
nPos
=
aNamespaceMap
.
Add
(
rPrefix
,
rNamespace
);
aAttrs
.
push_back
(
SvXMLAttr
(
nPos
,
rLName
,
rValue
)
);
return
sal_True
;
}
sal_Bool
SvXMLAttrCollection
::
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
sal_uInt16
nPos
=
aNamespaceMap
.
GetIndexByPrefix
(
rPrefix
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
aAttrs
.
push_back
(
SvXMLAttr
(
nPos
,
rLName
,
rValue
)
);
return
sal_True
;
}
sal_Bool
SvXMLAttrCollection
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
aAttrs
[
i
]
=
SvXMLAttr
(
rLName
,
rValue
);
return
sal_True
;
}
sal_Bool
SvXMLAttrCollection
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
sal_uInt16
nPos
=
aNamespaceMap
.
Add
(
rPrefix
,
rNamespace
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
aAttrs
[
i
]
=
SvXMLAttr
(
nPos
,
rLName
,
rValue
);
return
sal_True
;
}
sal_Bool
SvXMLAttrCollection
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
sal_uInt16
nPos
=
aNamespaceMap
.
GetIndexByPrefix
(
rPrefix
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
aAttrs
[
i
]
=
SvXMLAttr
(
nPos
,
rLName
,
rValue
);
return
sal_True
;
}
void
SvXMLAttrCollection
::
Remove
(
size_t
i
)
{
if
(
i
<
GetAttrCount
()
)
{
aAttrs
.
erase
(
aAttrs
.
begin
()
+
i
);
}
else
{
OSL_FAIL
(
"illegal index"
);
}
}
size_t
SvXMLAttrCollection
::
GetAttrCount
()
const
{
return
aAttrs
.
size
();
}
const
rtl
::
OUString
&
SvXMLAttrCollection
::
GetAttrLName
(
size_t
i
)
const
{
OSL_ENSURE
(
i
<
aAttrs
.
size
(),
"SvXMLAttrContainerData::GetLName: illegal index"
);
return
aAttrs
[
i
].
getLName
();
}
const
rtl
::
OUString
&
SvXMLAttrCollection
::
GetAttrValue
(
size_t
i
)
const
{
OSL_ENSURE
(
i
<
aAttrs
.
size
(),
"SvXMLAttrContainerData::GetValue: illegal index"
);
return
aAttrs
[
i
].
getValue
();
}
const
rtl
::
OUString
SvXMLAttrCollection
::
GetAttrNamespace
(
size_t
i
)
const
{
rtl
::
OUString
sRet
;
sal_uInt16
nPos
=
GetPrefixPos
(
i
);
//Does this point to a valid namespace entry?
if
(
USHRT_MAX
!=
nPos
)
sRet
=
aNamespaceMap
.
GetNameByIndex
(
nPos
);
return
sRet
;
}
const
rtl
::
OUString
SvXMLAttrCollection
::
GetAttrPrefix
(
size_t
i
)
const
{
rtl
::
OUString
sRet
;
sal_uInt16
nPos
=
GetPrefixPos
(
i
);
//Does this point to a valid namespace entry?
if
(
USHRT_MAX
!=
nPos
)
sRet
=
aNamespaceMap
.
GetPrefixByIndex
(
nPos
);
return
sRet
;
}
const
rtl
::
OUString
&
SvXMLAttrCollection
::
GetNamespace
(
sal_uInt16
i
)
const
{
return
aNamespaceMap
.
GetNameByIndex
(
i
);
}
const
rtl
::
OUString
&
SvXMLAttrCollection
::
GetPrefix
(
sal_uInt16
i
)
const
{
return
aNamespaceMap
.
GetPrefixByIndex
(
i
);
}
sal_uInt16
SvXMLAttrCollection
::
GetFirstNamespaceIndex
()
const
{
return
aNamespaceMap
.
GetFirstIndex
();
}
sal_uInt16
SvXMLAttrCollection
::
GetNextNamespaceIndex
(
sal_uInt16
nIdx
)
const
{
return
aNamespaceMap
.
GetNextIndex
(
nIdx
);
}
sal_uInt16
SvXMLAttrCollection
::
GetPrefixPos
(
size_t
i
)
const
{
// DBG_ASSERT( i >= 0 && i < aAttrs.size(),
// "SvXMLAttrCollection::GetPrefixPos: illegal index" );
return
aAttrs
[
i
].
getPrefixPos
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/SvXMLAttrCollection.hxx
0 → 100644
Dosyayı görüntüle @
40283f01
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is
* Nigel Hawkins - n.hawkins@gmx.com
* Portions created by the Initial Developer are Copyright (C) 2011 the
* Initial Developer. All Rights Reserved.
*
* Major Contributor(s):
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#ifndef SVXMLATTRCOLLECTION_HXX_
#define SVXMLATTRCOLLECTION_HXX_
#include "SvXMLAttr.hxx"
#include <xmloff/nmspmap.hxx> //SvXMLNamespaceMap
#include <rtl/ustring.hxx> //rtl::OUString
#include <sal/types.h> //sal_uInt16 and sal_Bool
#include <vector>
class
SvXMLAttrCollection
{
public
:
SvXMLNamespaceMap
aNamespaceMap
;
std
::
vector
<
SvXMLAttr
>
aAttrs
;
bool
operator
==
(
const
SvXMLAttrCollection
&
rCmp
)
const
;
sal_Bool
AddAttr
(
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
sal_Bool
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
);
void
Remove
(
size_t
i
);
size_t
GetAttrCount
()
const
;
const
rtl
::
OUString
&
GetAttrLName
(
size_t
i
)
const
;
const
rtl
::
OUString
&
GetAttrValue
(
size_t
i
)
const
;
const
rtl
::
OUString
GetAttrNamespace
(
size_t
i
)
const
;
const
rtl
::
OUString
GetAttrPrefix
(
size_t
i
)
const
;
const
rtl
::
OUString
&
GetNamespace
(
sal_uInt16
i
)
const
;
const
rtl
::
OUString
&
GetPrefix
(
sal_uInt16
i
)
const
;
sal_uInt16
GetFirstNamespaceIndex
()
const
;
sal_uInt16
GetNextNamespaceIndex
(
sal_uInt16
nIdx
)
const
;
private
:
sal_uInt16
GetPrefixPos
(
size_t
i
)
const
;
};
#endif
/* SVXMLATTRCOLLECTION_HXX_ */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/unoatrcn.cxx
Dosyayı görüntüle @
40283f01
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/memory.h>
#include <rtl/memory.h>
#include <comphelper/servicehelper.hxx>
#include <comphelper/servicehelper.hxx>
#include <limits.h>
#include <xmloff/xmlcnimp.hxx>
#include <xmloff/xmlcnimp.hxx>
...
...
xmloff/source/core/xmlcnimp.cxx
0 → 100644
Dosyayı görüntüle @
40283f01
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#include "SvXMLAttrCollection.hxx"
#include <xmloff/xmlcnimp.hxx>
#include <rtl/ustring.hxx> //rtl::OUString
SvXMLAttrContainerData
::
SvXMLAttrContainerData
()
:
pimpl
(
new
SvXMLAttrCollection
()
)
{
}
SvXMLAttrContainerData
::
SvXMLAttrContainerData
(
const
SvXMLAttrContainerData
&
rCopy
)
:
pimpl
(
new
SvXMLAttrCollection
(
*
(
rCopy
.
pimpl
)
)
)
{
}
//Need destructor defined (despite it being empty) to avoid "checked_delete"
//compiler errors.
SvXMLAttrContainerData
::~
SvXMLAttrContainerData
()
{
}
int
SvXMLAttrContainerData
::
operator
==
(
const
SvXMLAttrContainerData
&
rCmp
)
const
{
return
(
*
(
rCmp
.
pimpl
)
==
*
(
pimpl
)
);
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
AddAttr
(
rLName
,
rValue
);
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
AddAttr
(
rPrefix
,
rNamespace
,
rLName
,
rValue
);
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
AddAttr
(
rPrefix
,
rLName
,
rValue
);
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
SetAt
(
i
,
rLName
,
rValue
);
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
SetAt
(
i
,
rPrefix
,
rNamespace
,
rLName
,
rValue
);
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
size_t
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
return
pimpl
->
SetAt
(
i
,
rPrefix
,
rLName
,
rValue
);
}
void
SvXMLAttrContainerData
::
Remove
(
size_t
i
)
{
pimpl
->
Remove
(
i
);
}
size_t
SvXMLAttrContainerData
::
GetAttrCount
()
const
{
return
pimpl
->
GetAttrCount
();
}
const
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetAttrLName
(
size_t
i
)
const
{
return
pimpl
->
GetAttrLName
(
i
);
}
const
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetAttrValue
(
size_t
i
)
const
{
return
pimpl
->
GetAttrValue
(
i
);
}
const
rtl
::
OUString
SvXMLAttrContainerData
::
GetAttrNamespace
(
size_t
i
)
const
{
return
pimpl
->
GetAttrNamespace
(
i
);
}
const
rtl
::
OUString
SvXMLAttrContainerData
::
GetAttrPrefix
(
size_t
i
)
const
{
return
pimpl
->
GetAttrPrefix
(
i
);
}
const
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetNamespace
(
sal_uInt16
i
)
const
{
return
pimpl
->
GetNamespace
(
i
);
}
const
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetPrefix
(
sal_uInt16
i
)
const
{
return
pimpl
->
GetPrefix
(
i
);
}
sal_uInt16
SvXMLAttrContainerData
::
GetFirstNamespaceIndex
()
const
{
return
pimpl
->
GetFirstNamespaceIndex
();
}
sal_uInt16
SvXMLAttrContainerData
::
GetNextNamespaceIndex
(
sal_uInt16
nIdx
)
const
{
return
pimpl
->
GetNextNamespaceIndex
(
nIdx
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
xmloff/source/core/xmlcnitm.cxx
deleted
100644 → 0
Dosyayı görüntüle @
f26117a5
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include <tools/debug.hxx>
#include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <xmloff/xmlcnimp.hxx>
#include "xmloff/unoatrcn.hxx"
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
container
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
xml
;
using
::
rtl
::
OUString
;
typedef
::
rtl
::
OUString
*
OUStringPtr
;
SV_DECL_PTRARR_DEL
(
SvXMLAttrContainerData_Impl
,
OUStringPtr
,
5
,
5
)
SV_IMPL_PTRARR
(
SvXMLAttrContainerData_Impl
,
OUStringPtr
)
SvXMLAttrContainerData
::
SvXMLAttrContainerData
(
const
SvXMLAttrContainerData
&
rImpl
)
:
aNamespaceMap
(
rImpl
.
aNamespaceMap
),
pLNames
(
new
SvXMLAttrContainerData_Impl
),
pValues
(
new
SvXMLAttrContainerData_Impl
)
{
sal_uInt16
nCount
=
rImpl
.
pLNames
->
Count
();
for
(
sal_uInt16
i
=
0
;
i
<
nCount
;
i
++
)
{
aPrefixPoss
.
Insert
(
rImpl
.
aPrefixPoss
[
i
],
i
);
pLNames
->
Insert
(
new
OUString
(
*
(
*
rImpl
.
pLNames
)[
i
]
),
i
);
pValues
->
Insert
(
new
OUString
(
*
(
*
rImpl
.
pValues
)[
i
]
),
i
);
}
}
SvXMLAttrContainerData
::
SvXMLAttrContainerData
()
:
pLNames
(
new
SvXMLAttrContainerData_Impl
),
pValues
(
new
SvXMLAttrContainerData_Impl
)
{
}
SvXMLAttrContainerData
::~
SvXMLAttrContainerData
()
{
delete
pLNames
;
delete
pValues
;
}
int
SvXMLAttrContainerData
::
operator
==
(
const
SvXMLAttrContainerData
&
rCmp
)
const
{
sal_Bool
bRet
=
pLNames
->
Count
()
==
rCmp
.
pLNames
->
Count
()
&&
aNamespaceMap
==
rCmp
.
aNamespaceMap
;
if
(
bRet
)
{
sal_uInt16
nCount
=
pLNames
->
Count
();
sal_uInt16
i
;
for
(
i
=
0
;
bRet
&&
i
<
nCount
;
i
++
)
bRet
=
aPrefixPoss
[
i
]
==
rCmp
.
aPrefixPoss
[
i
];
if
(
bRet
)
{
for
(
i
=
0
;
bRet
&&
i
<
nCount
;
i
++
)
bRet
=
*
(
*
pLNames
)[
i
]
==
*
(
*
rCmp
.
pLNames
)[
i
]
&&
*
(
*
pValues
)[
i
]
==
*
(
*
rCmp
.
pValues
)[
i
];
}
}
return
(
int
)
bRet
;
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
OUString
&
rLName
,
const
OUString
&
rValue
)
{
aPrefixPoss
.
Insert
(
USHRT_MAX
,
aPrefixPoss
.
Count
()
);
pLNames
->
Insert
(
new
OUString
(
rLName
),
pLNames
->
Count
()
);
pValues
->
Insert
(
new
OUString
(
rValue
),
pValues
->
Count
()
);
return
sal_True
;
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
OUString
&
rPrefix
,
const
OUString
&
rNamespace
,
const
OUString
&
rLName
,
const
OUString
&
rValue
)
{
sal_uInt16
nPos
=
aNamespaceMap
.
Add
(
rPrefix
,
rNamespace
);
aPrefixPoss
.
Insert
(
nPos
,
aPrefixPoss
.
Count
()
);
pLNames
->
Insert
(
new
OUString
(
rLName
),
pLNames
->
Count
()
);
pValues
->
Insert
(
new
OUString
(
rValue
),
pValues
->
Count
()
);
return
sal_True
;
}
sal_Bool
SvXMLAttrContainerData
::
AddAttr
(
const
OUString
&
rPrefix
,
const
OUString
&
rLName
,
const
OUString
&
rValue
)
{
sal_uInt16
nPos
=
aNamespaceMap
.
GetIndexByPrefix
(
rPrefix
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
aPrefixPoss
.
Insert
(
nPos
,
aPrefixPoss
.
Count
()
);
pLNames
->
Insert
(
new
OUString
(
rLName
),
pLNames
->
Count
()
);
pValues
->
Insert
(
new
OUString
(
rValue
),
pValues
->
Count
()
);
return
sal_True
;
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
sal_uInt16
i
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
*
(
*
pLNames
)[
i
]
=
rLName
;
*
(
*
pValues
)[
i
]
=
rValue
;
aPrefixPoss
[
i
]
=
USHRT_MAX
;
return
sal_True
;
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
sal_uInt16
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rNamespace
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
sal_uInt16
nPos
=
aNamespaceMap
.
Add
(
rPrefix
,
rNamespace
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
*
(
*
pLNames
)[
i
]
=
rLName
;
*
(
*
pValues
)[
i
]
=
rValue
;
aPrefixPoss
[
i
]
=
nPos
;
return
sal_True
;
}
sal_Bool
SvXMLAttrContainerData
::
SetAt
(
sal_uInt16
i
,
const
rtl
::
OUString
&
rPrefix
,
const
rtl
::
OUString
&
rLName
,
const
rtl
::
OUString
&
rValue
)
{
if
(
i
>=
GetAttrCount
()
)
return
sal_False
;
sal_uInt16
nPos
=
aNamespaceMap
.
GetIndexByPrefix
(
rPrefix
);
if
(
USHRT_MAX
==
nPos
)
return
sal_False
;
*
(
*
pLNames
)[
i
]
=
rLName
;
*
(
*
pValues
)[
i
]
=
rValue
;
aPrefixPoss
[
i
]
=
nPos
;
return
sal_True
;
}
void
SvXMLAttrContainerData
::
Remove
(
sal_uInt16
i
)
{
if
(
i
<
GetAttrCount
()
)
{
delete
(
*
pLNames
)[
i
];
pLNames
->
Remove
(
i
);
delete
(
*
pValues
)[
i
];
pValues
->
Remove
(
i
);
aPrefixPoss
.
Remove
(
i
);
}
else
{
OSL_FAIL
(
"illegal index"
);
}
}
sal_uInt16
SvXMLAttrContainerData
::
GetAttrCount
()
const
{
return
pLNames
->
Count
();
}
const
::
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetAttrLName
(
sal_uInt16
i
)
const
{
OSL_ENSURE
(
i
<
pLNames
->
Count
(),
"SvXMLAttrContainerData::GetLName: illegal index"
);
return
*
(
*
pLNames
)[
i
];
}
const
::
rtl
::
OUString
&
SvXMLAttrContainerData
::
GetAttrValue
(
sal_uInt16
i
)
const
{
OSL_ENSURE
(
i
<
pValues
->
Count
(),
"SvXMLAttrContainerData::GetValue: illegal index"
);
return
*
(
*
pValues
)[
i
];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment