[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sc/source svl/inc svl/source sw/source
Oliver-Rainer Wittmann
orw at apache.org
Wed Sep 11 09:08:14 PDT 2013
sc/source/core/tool/cellform.cxx | 5 ++
svl/inc/svl/zformat.hxx | 6 +++
svl/source/numbers/zformat.cxx | 13 +++++++
sw/source/filter/xml/xmlexp.cxx | 46 ++++++++++++++++++++++++---
sw/source/filter/xml/xmlimp.cxx | 66 ++++++++++++++++++++++++++++-----------
5 files changed, 114 insertions(+), 22 deletions(-)
New commits:
commit f34566c8de508efd9b0b6f6a8f28b6f2b27324c8
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Wed Sep 11 15:19:48 2013 +0000
123144: ODF import/export of current database settings:
- assure certain order on export for former versions
- assure certain order on setting these properties on import to be independent of order in ODF
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 2f44153..bdcd974 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -64,10 +64,7 @@
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
-// --> OD 2007-03-30 #i73788#
#include <pausethreadstarting.hxx>
-// <--
-
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -543,7 +540,48 @@ void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps)
{
Reference< XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
if( xProps.is() )
- SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+ {
+ // property CurrentDatabaseDataSource needs to be exported before CurrentDatabaseCommand and CurrentDatabaseCommandType
+ // in order to assure that AOO/OOo versions (before AOO 4.0.1) are able to apply the current database settings correct
+ // Thus, put CurrentDatabaseDataSource as the first one into the Sequence
+// SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties();
+ const sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ rProps.realloc(nCount);
+ beans::PropertyValue* pProps = rProps.getArray();
+
+ static ::rtl::OUString csCurrentDatabaseSource = ::rtl::OUString::createFromAscii("CurrentDatabaseDataSource");
+ const sal_Bool bHasCurrentDatabaseSource = xPropertySetInfo->hasPropertyByName( csCurrentDatabaseSource );
+ if ( bHasCurrentDatabaseSource )
+ {
+ beans::Property aProp = xPropertySetInfo->getPropertyByName( csCurrentDatabaseSource );
+ pProps->Name = aProp.Name;
+ pProps->Value = xProps->getPropertyValue(aProp.Name);
+ ++pProps;
+ }
+
+ for (sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if ( bHasCurrentDatabaseSource
+ && aProps[i].Name.compareTo( csCurrentDatabaseSource ) == 0 )
+ {
+ // nothing to do - already added as first item - see above
+ }
+ else
+ {
+ pProps->Name = aProps[i].Name;
+ pProps->Value = xProps->getPropertyValue(aProps[i].Name);
+ ++pProps;
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 2be65cd..9f2982d 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1178,7 +1178,6 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if( !xInfo.is() )
return;
- // #111955#
hash_set< String, StringHashRef, StringEqRef > aSet;
aSet.insert(String("ForbiddenCharacters", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("IsKernAsianPunctuation", RTL_TEXTENCODING_ASCII_US));
@@ -1204,16 +1203,14 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
aSet.insert(String("PrintSingleJobs", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("UpdateFromTemplate", RTL_TEXTENCODING_ASCII_US));
aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US));
- // --> FME 2005-12-13 #b6354161#
aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US));
- // <--
sal_Int32 nCount = aConfigProps.getLength();
const PropertyValue* pValues = aConfigProps.getConstArray();
SvtSaveOptions aSaveOpt;
- sal_Bool bIsUserSetting = aSaveOpt.IsLoadUserSettings(),
- bSet = bIsUserSetting;
+ sal_Bool bIsUserSetting = aSaveOpt.IsLoadUserSettings();
+ sal_Bool bSet = bIsUserSetting;
// for some properties we don't want to use the application
// default if they're missing. So we watch for them in the loop
@@ -1236,7 +1233,16 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
bool bUnixForceZeroExtLeading = false;
bool bUseOldPrinterMetrics = false;
- OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
+ static const OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
+
+ // Set current database properties in certain order
+ // Thus, keep these properties during loop and set them afterwards in valid order
+ static const OUString sCurrentDatabaseDataSource( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseDataSource" ) );
+ uno::Any aCurrentDatabaseDataSource;
+ static const OUString sCurrentDatabaseCommand( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommand" ) );
+ uno::Any aCurrentDatabaseCommand;
+ static const OUString sCurrentDatabaseCommandType( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommandType" ) );
+ uno::Any aCurrentDatabaseCommandType;
while( nCount-- )
{
@@ -1260,10 +1266,24 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
pValues->Value >>= aKey;
GetTextImport()->SetChangesProtectionKey( aKey );
}
+ else if ( !aCurrentDatabaseDataSource.hasValue()
+ && pValues->Name.equals( sCurrentDatabaseDataSource ) )
+ {
+ aCurrentDatabaseDataSource = pValues->Value;
+ }
+ else if ( !aCurrentDatabaseCommand.hasValue()
+ && pValues->Name.equals( sCurrentDatabaseCommand ) )
+ {
+ aCurrentDatabaseCommand = pValues->Value;
+ }
+ else if ( !aCurrentDatabaseCommandType.hasValue()
+ && pValues->Name.equals( sCurrentDatabaseCommandType ) )
+ {
+ aCurrentDatabaseCommandType = pValues->Value;
+ }
else
{
- xProps->setPropertyValue( pValues->Name,
- pValues->Value );
+ xProps->setPropertyValue( pValues->Name, pValues->Value );
}
}
@@ -1311,11 +1331,26 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
pValues++;
}
+ // apply current database properties
+ {
+ if ( aCurrentDatabaseDataSource.hasValue() )
+ {
+ xProps->setPropertyValue( sCurrentDatabaseDataSource, aCurrentDatabaseDataSource );
+ }
+ if ( aCurrentDatabaseCommand.hasValue() )
+ {
+ xProps->setPropertyValue( sCurrentDatabaseCommand, aCurrentDatabaseCommand );
+ }
+ if ( aCurrentDatabaseCommandType.hasValue() )
+ {
+ xProps->setPropertyValue( sCurrentDatabaseCommandType, aCurrentDatabaseCommandType );
+ }
+ }
+
// finally, treat the non-default cases
- // --> OD 2006-04-18 #b6402800#
+
// introduce boolean, that indicates a document, written by version prior SO8.
const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
- // <--
if( ! bPrinterIndependentLayout )
{
@@ -1345,14 +1380,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
OUString( RTL_CONSTASCII_USTRINGPARAM("UseFormerObjectPositioning")), makeAny( true ) );
}
- if( !bUseOldNumbering ) // #111955#
+ if( !bUseOldNumbering )
{
Any aAny;
sal_Bool bOldNum = true;
aAny.setValue(&bOldNum, ::getBooleanCppuType());
- xProps->setPropertyValue
- (OUString( RTL_CONSTASCII_USTRINGPARAM("UseOldNumbering")),
- aAny );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("UseOldNumbering")), aAny );
}
if( !bOutlineLevelYieldsOutlineRule )
@@ -1418,8 +1451,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if ( !bLoadReadonly )
{
- xProps->setPropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM("LoadReadonly") ), makeAny( false ) );
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("LoadReadonly") ), makeAny( false ) );
}
// This flag has to be set for all documents < SO8
@@ -1456,7 +1488,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if( xTextTunnel.is() )
{
SwXText *pText = reinterpret_cast< SwXText *>(
- sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
+ sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
ASSERT( pText, "SwXText missing" );
if( pText )
{
commit 2a3ef82d52df74abf39e17f5e5f9f12f9a985cb3
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Wed Sep 11 14:54:23 2013 +0000
122927: adjusting change made for 121126 - allow formatting of boolean formula result as number,
but force it, if formatting code contains string/text section
Review by: Clarence Guo <clarence dot guo dot bj at gmail dot com>
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 010643c..f8bef32 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -28,6 +28,7 @@
#include <sfx2/objsh.hxx>
#include <svl/smplhint.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include "cellform.hxx"
#include "cell.hxx"
@@ -129,7 +130,9 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rStr
rString.Erase();
else if ( pFCell->IsValue() )
{
- if(pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL)
+ const SvNumberformat* pNumFmt = rFormatter.GetEntry( nFormat );
+ const bool bHasTextFormatCode = pNumFmt != NULL && pNumFmt->HasTextFormatCode();
+ if( pFCell->GetFormatType() == NUMBERFORMAT_LOGICAL && bHasTextFormatCode )
{
String aCellString;
double fValue = pFCell->GetValue();
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index cf9f40b..1f0becd 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -159,6 +159,9 @@ public:
void SetNatNumDate( sal_Bool bDate ) { aNatNum.SetDate( bDate ); }
const SvNumberNatNum& GetNatNum() const { return aNatNum; }
+ // check, if the format code contains a subformat for text
+ const bool HasTextFormatCode() const;
+
private:
ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos
String sColorName; // color name
@@ -332,6 +335,9 @@ public:
// Whether a new SYMBOLTYPE_CURRENCY is contained in the format
sal_Bool HasNewCurrency() const;
+ // check, if the format code contains a subformat for text
+ const bool HasTextFormatCode() const;
+
// Build string from NewCurrency for saving it SO50 compatible
void Build50Formatstring( String& rStr ) const;
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index c11a759..e8df25e 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -406,6 +406,10 @@ sal_Bool ImpSvNumFor::HasNewCurrency() const
return sal_False;
}
+const bool ImpSvNumFor::HasTextFormatCode() const
+{
+ return aI.eScannedType == NUMBERFORMAT_TEXT;
+}
sal_Bool ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol,
String& rExtension ) const
@@ -1718,6 +1722,15 @@ sal_Bool SvNumberformat::HasNewCurrency() const
return sal_False;
}
+const bool SvNumberformat::HasTextFormatCode() const
+{
+ for ( sal_uInt16 j=0; j<4; j++ )
+ {
+ if ( NumFor[j].HasTextFormatCode() )
+ return true;
+ }
+ return false;
+}
sal_Bool SvNumberformat::GetNewCurrencySymbol( String& rSymbol,
String& rExtension ) const
More information about the Libreoffice-commits
mailing list