[Libreoffice-commits] .: xmloff/inc xmloff/source

2012-04-10 Thread Miklos Vajna
 xmloff/inc/xmloff/txtparae.hxx  |6 ++
 xmloff/source/text/txtparae.cxx |   92 ++--
 2 files changed, 94 insertions(+), 4 deletions(-)

New commits:
commit 7a1c5e54afe4e4ef7e17c2e9c969cd41221edc28
Author: Brennan Vincent 
Date:   Sun Apr 8 14:45:01 2012 -0700

Partial fix for bug 30711

diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index 11e0140..c5d3e75 100644
--- a/xmloff/inc/xmloff/txtparae.hxx
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -110,6 +110,9 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public 
XMLStyleExport
 ::std::vector< XMLTextListsHelper* > maTextListsHelperStack;
 
 enum FrameType { FT_TEXT, FT_GRAPHIC, FT_EMBEDDED, FT_SHAPE };
+public:
+
+enum FieldmarkType { NONE, TEXT, CHECK }; // Used for simulating 
fieldmarks in OpenDocument 1.n Strict (for n <= 2). CHECK currently ignored.
 
 protected:
 
@@ -430,7 +433,8 @@ protected:
 const ::com::sun::star::uno::Reference <
 ::com::sun::star::text::XTextRange > & rTextRange,
 sal_Bool bAutoStyles,
-bool& rPrevCharWasSpace );
+bool& rPrevCharWasSpace,
+FieldmarkType& openFieldmarkType );
 
 void exportListChange( const XMLTextNumRuleInfo& rPrvInfo,
const XMLTextNumRuleInfo& rNextInfo );
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 522d43f..922dce1 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2182,6 +2182,10 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
 static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
 bool bPrevCharIsSpace = bPrvChrIsSpc;
 
+/* This is  used for exporting to strict OpenDocument 1.2, in which case 
traditional
+ * bookmarks are used instead of fieldmarks. */
+FieldmarkType openFieldMark = NONE;
+
 while( rTextEnum->hasMoreElements() )
 {
 Reference xPropSet(rTextEnum->nextElement(), UNO_QUERY);
@@ -2196,7 +2200,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
 if( sType.equals(sText))
 {
 exportTextRange( xTxtRange, bAutoStyles,
- bPrevCharIsSpace );
+ bPrevCharIsSpace, openFieldMark);
 }
 else if( sType.equals(sTextField))
 {
@@ -2261,6 +2265,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
 }
 else if (sType.equals(sTextFieldStart))
 {
+/* As of now, textmarks are a proposed extension to the 
OpenDocument standard. */
 if ( GetExport().getDefaultVersion() == 
SvtSaveOptions::ODFVER_LATEST )
 {
 Reference 
xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
@@ -2280,6 +2285,46 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
 }
 GetExport().EndElement(XML_NAMESPACE_FIELD, 
XML_FIELDMARK_START, sal_False);
 }
+/* The OpenDocument standard does not include support for 
TextMarks for now, so use bookmarks instead. */
+else
+{
+Reference< ::com::sun::star::text::XFormField > 
xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+if (xFormField.is())
+{
+Reference< ::com::sun::star::container::XNameAccess > 
xParameters(xFormField->getParameters(), UNO_QUERY);
+if (xParameters.is() && xParameters->hasByName("Name"))
+{
+const Any aValue = xParameters->getByName("Name");
+const Type aValueType = aValue.getValueType();
+if (aValueType == ::getCppuType((OUString*)0))
+{
+OUString sValue;
+aValue >>= sValue;
+GetExport().AddAttribute(XML_NAMESPACE_TEXT, 
XML_NAME, sValue);
+}
+}
+GetExport().StartElement(XML_NAMESPACE_TEXT, 
XML_BOOKMARK_START, sal_False);
+GetExport().EndElement(XML_NAMESPACE_TEXT, 
XML_BOOKMARK_START, sal_False);
+const OUString sFieldType = xFormField->getFieldType();
+if (sFieldType ==  ODF_FORMTEXT)
+{
+openFieldMark = TEXT;
+}
+else if (sFieldType == ODF_FORMCHECKBOX)
+{
+openFieldMark = CHECK;
+}
+else
+{
+openFieldMark = NONE;
+}
+  

[Libreoffice-commits] .: xmloff/inc xmloff/source

2012-01-31 Thread Stephan Bergmann
 xmloff/inc/xmloff/nmspmap.hxx  |   24 ++--
 xmloff/source/core/nmspmap.cxx |   23 +--
 2 files changed, 19 insertions(+), 28 deletions(-)

New commits:
commit 965f3ae45ad605baf4d25d3cc8aaa9be85886b97
Author: Stephan Bergmann 
Date:   Tue Jan 31 11:32:02 2012 +0100

Clean up

diff --git a/xmloff/inc/xmloff/nmspmap.hxx b/xmloff/inc/xmloff/nmspmap.hxx
index 79139ef..816f2d3 100644
--- a/xmloff/inc/xmloff/nmspmap.hxx
+++ b/xmloff/inc/xmloff/nmspmap.hxx
@@ -30,11 +30,14 @@
 #define _XMLOFF_NMSPMAP_HXX
 
 #include "sal/config.h"
+
+#include 
+#include 
+
 #include "xmloff/dllapi.h"
 #include "sal/types.h"
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -73,25 +76,17 @@ struct uInt32lt
 return r1 < r2;
 }
 };
-typedef ::std::pair < sal_uInt16, const ::rtl::OUString* > QNamePair;
+typedef ::std::pair < sal_uInt16, rtl::OUString > QNamePair;
 
 struct QNamePairHash
 {
 size_t operator()( const QNamePair &r1 ) const
 {
-return (size_t) r1.second->hashCode() + r1.first;
-}
-};
-struct QNamePairEq
-{
-bool operator()( const QNamePair &r1,
- const QNamePair &r2 ) const
-{
-return r1.first == r2.first && *(r1.second) == *(r2.second);
+return (size_t) r1.second.hashCode() + r1.first;
 }
 };
 
-typedef ::boost::unordered_map < QNamePair, ::rtl::OUString, QNamePairHash, 
QNamePairEq > QNameCache;
+typedef ::boost::unordered_map < QNamePair, ::rtl::OUString, QNamePairHash > 
QNameCache;
 typedef ::boost::unordered_map < ::rtl::OUString, ::rtl::Reference 
, rtl::OUStringHash, OUStringEqFunc > NameSpaceHash;
 typedef ::std::map < sal_uInt16, ::rtl::Reference < NameSpaceEntry >, uInt32lt 
> NameSpaceMap;
 
@@ -100,9 +95,10 @@ class XMLOFF_DLLPUBLIC SvXMLNamespaceMap
 const ::rtl::OUString   sXMLNS;
 const ::rtl::OUString   sEmpty;
 
-NameSpaceHash   aNameHash, aNameCache;
+NameSpaceHash   aNameHash;
+mutable NameSpaceHash   aNameCache;
 NameSpaceMapaNameMap;
-QNameCache  aQNameCache;
+mutable QNameCache  aQNameCache;
 SAL_DLLPRIVATE sal_uInt16 _Add( const rtl::OUString& rPrefix, const 
rtl::OUString &rName, sal_uInt16 nKey );
 
 public:
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
index 383df82..06e6caa 100644
--- a/xmloff/source/core/nmspmap.cxx
+++ b/xmloff/source/core/nmspmap.cxx
@@ -26,6 +26,8 @@
  *
  /
 
+#include "sal/config.h"
+
 #include 
 #include 
 #include 
@@ -75,13 +77,6 @@ void SvXMLNamespaceMap::operator=( const SvXMLNamespaceMap& 
rMap )
 
 SvXMLNamespaceMap::~SvXMLNamespaceMap()
 {
-QNameCache::iterator aIter = aQNameCache.begin(), aEnd = aQNameCache.end();
-while ( aIter != aEnd )
-{
-const OUString *pString = (*aIter).first.second;
-++aIter;
-delete pString;
-}
 }
 
 int SvXMLNamespaceMap::operator ==( const SvXMLNamespaceMap& rCmp ) const
@@ -243,7 +238,7 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey,
 {
 QNameCache::const_iterator aQCacheIter;
 if (bCache)
-aQCacheIter = aQNameCache.find ( QNamePair ( nKey, &rLocalName 
) );
+aQCacheIter = aQNameCache.find ( QNamePair ( nKey, rLocalName 
) );
 else
 aQCacheIter = aQNameCache.end();
 if ( aQCacheIter != aQNameCache.end() )
@@ -265,8 +260,9 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey,
 if (bCache)
 {
 OUString sString(sQName.makeStringAndClear());
-OUString *pString = new OUString ( rLocalName );
-const_cast < QNameCache * > (&aQNameCache)->operator[] 
( QNamePair ( nKey, pString ) ) = sString;
+aQNameCache.insert(
+QNameCache::value_type(
+QNamePair(nKey, rLocalName), sString));
 return sString;
 }
 else
@@ -357,10 +353,9 @@ sal_uInt16 SvXMLNamespaceMap::_GetKeyByAttrName( const 
OUString& rAttrName,
 nKey = xEntry->nKey = XML_NAMESPACE_NONE;
 
 if (bCache)
-{
-typedef std::pair< const rtl::OUString, rtl::Reference 
> value_type;
-(void) const_cast(&aNameCache)->insert (value_type 
(rAttrName, xEntry));
-}
+{
+aNameCache.insert(NameSpaceHash::value_type(rAttrName, xEntry));
+}
 }
 
 return nKey;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: xmloff/inc xmloff/source

2012-01-16 Thread August Sodora
 xmloff/inc/xmloff/txtparae.hxx  |3 --
 xmloff/source/text/txtparae.cxx |   56 +++-
 2 files changed, 22 insertions(+), 37 deletions(-)

New commits:
commit 2070d9a298f40d3a866920106357843994e90c85
Author: August Sodora 
Date:   Mon Jan 16 12:36:13 2012 -0500

SV_DECL_PTRARR_DEL->std::vector

diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx
index 0ed0583..4fb9ad6 100644
--- a/xmloff/inc/xmloff/txtparae.hxx
+++ b/xmloff/inc/xmloff/txtparae.hxx
@@ -49,7 +49,6 @@ class XMLTextListsHelper;
 class SvXMLExport;
 class SvXMLAutoStylePoolP;
 class XMLTextFieldExport;
-class OUStrings_Impl;
 class XMLTextNumRuleInfo;
 class XMLTextListAutoStylePool;
 class XMLSectionExport;
@@ -89,7 +88,7 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public 
XMLStyleExport
 
 const ::std::auto_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets;
 XMLTextFieldExport  *pFieldExport;
-OUStrings_Impl  *pListElements;
+std::vector  *pListElements;
 XMLTextListAutoStylePool*pListAutoPool;
 XMLSectionExport*pSectionExport;
 XMLIndexMarkExport  *pIndexMarkExport;
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 7df0eb5..e32203a 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -273,10 +273,6 @@ namespace xmloff
 };
 }
 
-typedef OUString *OUStringPtr;
-SV_DECL_PTRARR_DEL( OUStrings_Impl, OUStringPtr, 20, 10 )
-SV_IMPL_PTRARR( OUStrings_Impl, OUStringPtr )
-
 #ifdef DBG_UTIL
 static int txtparae_bContainsIllegalCharacters = sal_False;
 #endif
@@ -860,17 +856,14 @@ void XMLTextParagraphExport::exportListChange(
 
 if ( nListLevelsToBeClosed > 0 &&
  pListElements &&
- pListElements->Count() >= ( 2 * nListLevelsToBeClosed ) )
+ pListElements->size() >= ( 2 * nListLevelsToBeClosed ) )
 {
 do {
-for( sal_uInt16 j = 0; j < 2; ++j )
+for(size_t j = 0; j < 2; ++j)
 {
-OUString *pElem = 
(*pListElements)[pListElements->Count()-1];
-pListElements->Remove( pListElements->Count()-1 );
-
-GetExport().EndElement( *pElem, sal_True );
-
-delete pElem;
+rtl::OUString aElem(pListElements->back());
+pListElements->pop_back();
+GetExport().EndElement(aElem, sal_True);
 }
 
 // remove closed list from list stack
@@ -1021,16 +1014,15 @@ void XMLTextParagraphExport::exportListChange(
 
 enum XMLTokenEnum eLName = XML_LIST;
 
-OUString *pElem = new OUString(
-GetExport().GetNamespaceMap().GetQNameByKey(
+rtl::OUString 
aElem(GetExport().GetNamespaceMap().GetQNameByKey(
 XML_NAMESPACE_TEXT,
 GetXMLToken(eLName) ) );
 GetExport().IgnorableWhitespace();
-GetExport().StartElement( *pElem, sal_False );
+GetExport().StartElement(aElem, sal_False);
 
-if( !pListElements )
-pListElements = new OUStrings_Impl;
-pListElements->Insert( pElem, pListElements->Count() );
+if(!pListElements)
+pListElements = new std::vector;
+pListElements->push_back(aElem);
 
 mpTextListsHelper->PushListOnStack( sListId,
 sListStyleName );
@@ -1064,13 +1056,12 @@ void XMLTextParagraphExport::exportListChange(
 eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 
)
  ? XML_LIST_ITEM
  : XML_LIST_HEADER;
-pElem = new OUString(  
GetExport().GetNamespaceMap().GetQNameByKey(
+aElem = rtl::OUString( 
GetExport().GetNamespaceMap().GetQNameByKey(
 XML_NAMESPACE_TEXT,
 GetXMLToken(eLName) ) );
 GetExport().IgnorableWhitespace();
-GetExport().StartElement( *pElem, sal_False );
-
-pListElements->Insert( pElem, pListElements->Count() );
+GetExport().StartElement(aElem, sal_False);
+pListElements->push_back(aElem);
 
 // export of  element for last opened 
, if requested
 if ( GetExport().exportTextNumberElement() &&
@@ -1097,24 +1088,20 @@ void XMLTextParagraphExport::exportListChange(
  rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
 {
 // close previous list-item
-DBG_ASSERT( pListElements && pListElements->Count() >= 2,
+DBG_ASSERT( pListElements && pListElements->size() >= 2,
 "Sw

[Libreoffice-commits] .: xmloff/inc xmloff/source

2011-10-11 Thread Michael Stahl
 xmloff/inc/xmloff/xmluconv.hxx|3 +++
 xmloff/source/style/DashStyle.cxx |2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 1eb7b69ef4d58da1459a07a9e562e873ab1078c0
Author: Michael Stahl 
Date:   Tue Oct 11 18:58:57 2011 +0200

xmluconv.hxx: noncopyable (thank you tinderbox)

diff --git a/xmloff/inc/xmloff/xmluconv.hxx b/xmloff/inc/xmloff/xmluconv.hxx
index a5064fd..2f822de 100644
--- a/xmloff/inc/xmloff/xmluconv.hxx
+++ b/xmloff/inc/xmloff/xmluconv.hxx
@@ -35,6 +35,8 @@
 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -90,6 +92,7 @@ public:
 */
 
 class XMLOFF_DLLPUBLIC SvXMLUnitConverter
+: private ::boost::noncopyable
 {
 private:
 struct Impl;
diff --git a/xmloff/source/style/DashStyle.cxx 
b/xmloff/source/style/DashStyle.cxx
index f80375c..608a7b7 100644
--- a/xmloff/source/style/DashStyle.cxx
+++ b/xmloff/source/style/DashStyle.cxx
@@ -243,7 +243,7 @@ sal_Bool XMLDashStyleExport::exportXML(
 {
 sal_Bool bRet = sal_False;
 
-SvXMLUnitConverter rUnitConverter = rExport.GetMM100UnitConverter();
+SvXMLUnitConverter & rUnitConverter = rExport.GetMM100UnitConverter();
 
 drawing::LineDash aLineDash;
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits