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
bde1e4dc
Kaydet (Commit)
bde1e4dc
authored
Nis 19, 2014
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
writerfilter: fix indentation in rtfsprm
Change-Id: Id81cb97033e616acf071f386630b49ccb83dfedc
üst
2d786ef2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
76 deletions
+96
-76
rtfsprm.cxx
writerfilter/source/rtftok/rtfsprm.cxx
+7
-4
rtfsprm.hxx
writerfilter/source/rtftok/rtfsprm.hxx
+89
-72
No files found.
writerfilter/source/rtftok/rtfsprm.cxx
Dosyayı görüntüle @
bde1e4dc
...
@@ -13,12 +13,14 @@
...
@@ -13,12 +13,14 @@
#include <resourcemodel/QNameToString.hxx>
#include <resourcemodel/QNameToString.hxx>
namespace
writerfilter
{
namespace
writerfilter
namespace
rtftok
{
{
namespace
rtftok
{
RTFSprm
::
RTFSprm
(
Id
nKeyword
,
RTFValue
::
Pointer_t
&
pValue
)
RTFSprm
::
RTFSprm
(
Id
nKeyword
,
RTFValue
::
Pointer_t
&
pValue
)
:
m_nKeyword
(
nKeyword
),
:
m_nKeyword
(
nKeyword
),
m_pValue
(
pValue
)
m_pValue
(
pValue
)
{
{
}
}
...
@@ -156,7 +158,8 @@ void RTFSprms::deduplicate(RTFSprms& rReference)
...
@@ -156,7 +158,8 @@ void RTFSprms::deduplicate(RTFSprms& rReference)
void
RTFSprms
::
ensureCopyBeforeWrite
()
void
RTFSprms
::
ensureCopyBeforeWrite
()
{
{
if
(
m_pSprms
->
m_nRefCount
>
1
)
{
if
(
m_pSprms
->
m_nRefCount
>
1
)
{
boost
::
intrusive_ptr
<
RTFSprmsImpl
>
pClone
(
new
RTFSprmsImpl
());
boost
::
intrusive_ptr
<
RTFSprmsImpl
>
pClone
(
new
RTFSprmsImpl
());
for
(
std
::
vector
<
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
>::
const_iterator
i
=
m_pSprms
->
begin
();
i
!=
m_pSprms
->
end
();
++
i
)
for
(
std
::
vector
<
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
>::
const_iterator
i
=
m_pSprms
->
begin
();
i
!=
m_pSprms
->
end
();
++
i
)
pClone
->
push_back
(
std
::
make_pair
(
i
->
first
,
RTFValue
::
Pointer_t
(
i
->
second
->
Clone
())));
pClone
->
push_back
(
std
::
make_pair
(
i
->
first
,
RTFValue
::
Pointer_t
(
i
->
second
->
Clone
())));
...
...
writerfilter/source/rtftok/rtfsprm.hxx
Dosyayı görüntüle @
bde1e4dc
...
@@ -20,84 +20,101 @@
...
@@ -20,84 +20,101 @@
#include <rtfcontrolwords.hxx>
#include <rtfcontrolwords.hxx>
#include <rtfvalue.hxx>
#include <rtfvalue.hxx>
namespace
writerfilter
{
namespace
writerfilter
namespace
rtftok
{
{
namespace
rtftok
{
typedef
std
::
vector
<
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
>
RTFSprmsImplBase
;
typedef
std
::
vector
<
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
>
RTFSprmsImplBase
;
/// The payload of RTFSprms which is only copied on write.
/// The payload of RTFSprms which is only copied on write.
class
RTFSprmsImpl
:
public
RTFSprmsImplBase
class
RTFSprmsImpl
:
public
RTFSprmsImplBase
{
{
public
:
public
:
sal_Int32
m_nRefCount
;
sal_Int32
m_nRefCount
;
RTFSprmsImpl
()
:
RTFSprmsImplBase
(),
m_nRefCount
(
0
)
{}
RTFSprmsImpl
()
:
RTFSprmsImplBase
(),
m_nRefCount
(
0
)
{}
};
};
inline
void
intrusive_ptr_add_ref
(
RTFSprmsImpl
*
p
)
inline
void
intrusive_ptr_add_ref
(
RTFSprmsImpl
*
p
)
{
{
++
(
p
->
m_nRefCount
);
++
(
p
->
m_nRefCount
);
}
}
inline
void
intrusive_ptr_release
(
RTFSprmsImpl
*
p
)
inline
void
intrusive_ptr_release
(
RTFSprmsImpl
*
p
)
{
{
if
(
!--
(
p
->
m_nRefCount
))
if
(
!--
(
p
->
m_nRefCount
))
delete
p
;
delete
p
;
}
}
enum
RTFOverwrite
enum
RTFOverwrite
{
{
OVERWRITE_YES
,
///< Yes, if an existing key is found, overwrite it.
OVERWRITE_YES
,
///< Yes, if an existing key is found, overwrite it.
OVERWRITE_NO_APPEND
,
///< No, always append the value to the end of the list.
OVERWRITE_NO_APPEND
,
///< No, always append the value to the end of the list.
OVERWRITE_NO_IGNORE
///< No, if the key is already in the list, then ignore, otherwise append.
OVERWRITE_NO_IGNORE
///< No, if the key is already in the list, then ignore, otherwise append.
};
};
/// A list of RTFSprm with a copy constructor that performs a deep copy.
/// A list of RTFSprm with a copy constructor that performs a deep copy.
class
RTFSprms
class
RTFSprms
{
{
public
:
public
:
typedef
::
boost
::
shared_ptr
<
RTFSprms
>
Pointer_t
;
typedef
::
boost
::
shared_ptr
<
RTFSprms
>
Pointer_t
;
typedef
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
Entry_t
;
typedef
std
::
pair
<
Id
,
RTFValue
::
Pointer_t
>
Entry_t
;
typedef
std
::
vector
<
Entry_t
>::
iterator
Iterator_t
;
typedef
std
::
vector
<
Entry_t
>::
iterator
Iterator_t
;
RTFSprms
();
RTFSprms
();
RTFSprms
(
const
RTFSprms
&
rSprms
);
RTFSprms
(
const
RTFSprms
&
rSprms
);
~
RTFSprms
();
~
RTFSprms
();
RTFSprms
&
operator
=
(
const
RTFSprms
&
rOther
);
RTFSprms
&
operator
=
(
const
RTFSprms
&
rOther
);
RTFValue
::
Pointer_t
find
(
Id
nKeyword
,
bool
bFirst
=
true
,
bool
bForWrite
=
false
);
RTFValue
::
Pointer_t
find
(
Id
nKeyword
,
bool
bFirst
=
true
,
bool
bForWrite
=
false
);
/// Does the same as ->push_back(), except that it can overwrite or ignore existing entries.
/// Does the same as ->push_back(), except that it can overwrite or ignore existing entries.
void
set
(
Id
nKeyword
,
RTFValue
::
Pointer_t
pValue
,
RTFOverwrite
eOverwrite
=
OVERWRITE_YES
);
void
set
(
Id
nKeyword
,
RTFValue
::
Pointer_t
pValue
,
RTFOverwrite
eOverwrite
=
OVERWRITE_YES
);
bool
erase
(
Id
nKeyword
);
bool
erase
(
Id
nKeyword
);
/// Removes elements, which are already in the reference set.
/// Removes elements, which are already in the reference set.
void
deduplicate
(
RTFSprms
&
rReference
);
void
deduplicate
(
RTFSprms
&
rReference
);
size_t
size
()
const
{
return
m_pSprms
->
size
();
}
size_t
size
()
const
bool
empty
()
const
{
return
m_pSprms
->
empty
();
}
{
Entry_t
&
back
()
{
return
m_pSprms
->
back
();
}
return
m_pSprms
->
size
();
Iterator_t
begin
()
{
return
m_pSprms
->
begin
();
}
}
Iterator_t
end
()
{
return
m_pSprms
->
end
();
}
bool
empty
()
const
void
clear
();
{
private
:
return
m_pSprms
->
empty
();
void
ensureCopyBeforeWrite
();
}
boost
::
intrusive_ptr
<
RTFSprmsImpl
>
m_pSprms
;
Entry_t
&
back
()
};
{
return
m_pSprms
->
back
();
}
Iterator_t
begin
()
{
return
m_pSprms
->
begin
();
}
Iterator_t
end
()
{
return
m_pSprms
->
end
();
}
void
clear
();
private
:
void
ensureCopyBeforeWrite
();
boost
::
intrusive_ptr
<
RTFSprmsImpl
>
m_pSprms
;
};
/// RTF keyword with a parameter
/// RTF keyword with a parameter
class
RTFSprm
class
RTFSprm
:
public
Sprm
:
public
Sprm
{
{
public
:
public
:
RTFSprm
(
Id
nKeyword
,
RTFValue
::
Pointer_t
&
pValue
);
RTFSprm
(
Id
nKeyword
,
RTFValue
::
Pointer_t
&
pValue
);
virtual
~
RTFSprm
()
{}
virtual
~
RTFSprm
()
{}
virtual
sal_uInt32
getId
()
const
SAL_OVERRIDE
;
virtual
sal_uInt32
getId
()
const
SAL_OVERRIDE
;
virtual
Value
::
Pointer_t
getValue
()
SAL_OVERRIDE
;
virtual
Value
::
Pointer_t
getValue
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
BinaryObj
>::
Pointer_t
getBinary
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
BinaryObj
>::
Pointer_t
getBinary
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
Stream
>::
Pointer_t
getStream
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
Stream
>::
Pointer_t
getStream
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
Properties
>::
Pointer_t
getProps
()
SAL_OVERRIDE
;
virtual
writerfilter
::
Reference
<
Properties
>::
Pointer_t
getProps
()
SAL_OVERRIDE
;
virtual
Kind
getKind
()
SAL_OVERRIDE
;
virtual
Kind
getKind
()
SAL_OVERRIDE
;
virtual
std
::
string
getName
()
const
SAL_OVERRIDE
;
virtual
std
::
string
getName
()
const
SAL_OVERRIDE
;
virtual
std
::
string
toString
()
const
SAL_OVERRIDE
;
virtual
std
::
string
toString
()
const
SAL_OVERRIDE
;
private
:
private
:
Id
m_nKeyword
;
Id
m_nKeyword
;
RTFValue
::
Pointer_t
&
m_pValue
;
RTFValue
::
Pointer_t
&
m_pValue
;
};
};
}
// namespace rtftok
}
// namespace rtftok
}
// namespace writerfilter
}
// namespace writerfilter
#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSPRM_HXX
#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSPRM_HXX
...
...
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