[Libreoffice-commits] core.git: 46 commits - comphelper/source configure.ac download.lst include/sfx2 include/ucbhelper libcmis/libcmis-0.3.0-lotus-live-fix.patch libcmis/libcmis-0.3.0.patch libcmis/libcmis-0.3.0-proxy.patch libcmis/libcmis-0.3.0-warnings.patch libcmis/libcmis-0.3.0-win.patch libcmis/libcmis-0.4.1.patch libcmis/StaticLibrary_cmis.mk libcmis/UnpackedTarball_cmis.mk offapi/com offapi/UnoApi_offapi.mk officecfg/registry sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk ucbhelper/source ucb/Library_ucpcmis1.mk ucb/source
Cédric Bosdonnat
cedric.bosdonnat.ooo at free.fr
Mon Sep 2 04:44:01 PDT 2013
comphelper/source/misc/mediadescriptor.cxx | 5
configure.ac | 2
download.lst | 2
include/sfx2/dinfdlg.hxx | 140 +
include/sfx2/sfxbasemodel.hxx | 17
include/ucbhelper/content.hxx | 4
libcmis/StaticLibrary_cmis.mk | 13
libcmis/UnpackedTarball_cmis.mk | 8
libcmis/libcmis-0.3.0-lotus-live-fix.patch | 122 -
libcmis/libcmis-0.3.0-proxy.patch | 1088 -------------
libcmis/libcmis-0.3.0-warnings.patch | 238 --
libcmis/libcmis-0.3.0-win.patch | 25
libcmis/libcmis-0.3.0.patch | 49
libcmis/libcmis-0.4.1.patch | 95 +
offapi/UnoApi_offapi.mk | 1
offapi/com/sun/star/document/CmisProperty.idl | 72
offapi/com/sun/star/document/XCmisDocument.idl | 10
offapi/com/sun/star/ucb/GlobalTransferCommandArgument2.idl | 6
offapi/com/sun/star/ucb/InsertCommandArgument2.idl | 5
officecfg/registry/data/org/openoffice/Office/Common.xcu | 2
sfx2/UIConfig_sfx.mk | 2
sfx2/source/dialog/dinfdlg.cxx | 520 ++++++
sfx2/source/dialog/dinfdlg.hrc | 6
sfx2/source/dialog/dinfdlg.src | 4
sfx2/source/doc/docfile.cxx | 10
sfx2/source/doc/objserv.cxx | 18
sfx2/source/doc/sfxbasemodel.cxx | 58
sfx2/source/inc/sfxlocal.hrc | 8
sfx2/source/view/sfxbasecontroller.cxx | 2
sfx2/uiconfig/ui/cmisinfopage.ui | 106 +
sfx2/uiconfig/ui/cmisline.ui | 151 +
sfx2/uiconfig/ui/documentinfopage.ui | 14
sfx2/uiconfig/ui/documentpropertiesdialog.ui | 16
ucb/Library_ucpcmis1.mk | 1
ucb/source/core/provprox.cxx | 3
ucb/source/core/ucbcmds.cxx | 4
ucb/source/ucp/cmis/auth_provider.hxx | 2
ucb/source/ucp/cmis/certvalidation_handler.cxx | 127 +
ucb/source/ucp/cmis/certvalidation_handler.hxx | 42
ucb/source/ucp/cmis/cmis_content.cxx | 457 +++--
ucb/source/ucp/cmis/cmis_content.hxx | 7
ucb/source/ucp/cmis/cmis_oauth2_providers.hxx | 32
ucb/source/ucp/cmis/cmis_provider.hxx | 2
ucb/source/ucp/cmis/cmis_repo_content.cxx | 33
ucb/source/ucp/cmis/cmis_repo_content.hxx | 7
ucb/source/ucp/cmis/cmis_strings.hxx | 23
ucb/source/ucp/cmis/cmis_url.cxx | 11
ucbhelper/source/client/content.cxx | 6
48 files changed, 1781 insertions(+), 1795 deletions(-)
New commits:
commit f408102bd4befffa0a5a07d00cf7a79376566b3c
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Sep 2 13:51:32 2013 +0200
feature/cmis rebase: fixed uno DateTime construction
Change-Id: Ibbbbaf0445bb1cdaaf83b9449f4d4fbba6097b24
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index c94c016..4c46eab 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2445,7 +2445,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
util::DateTime aDateTime( aTmpTime.GetNanoSec(), aTmpTime.GetSec(),
aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(),
- aTmpDate.GetYear() );
+ aTmpDate.GetYear(), sal_True );
seqValue[k] = aDateTime;
}
aPropertiesSeq[i].Value <<= makeAny( seqValue );
commit c33b82bd37d4b01574832a4b5fff8fc546c9dda8
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Fri Aug 30 14:06:09 2013 +0200
libcmis: add a mandatory patch for GDrive feature to properly work
Change-Id: I1bd183508b7f481feed641f8658c0baea6f743bd
diff --git a/libcmis/UnpackedTarball_cmis.mk b/libcmis/UnpackedTarball_cmis.mk
index 5786474..0b2a9fb 100644
--- a/libcmis/UnpackedTarball_cmis.mk
+++ b/libcmis/UnpackedTarball_cmis.mk
@@ -13,6 +13,8 @@ $(eval $(call gb_UnpackedTarball_set_tarball,cmis,$(CMIS_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,cmis,0))
+$(eval $(call gb_UnpackedTarball_add_patches,cmis,libcmis/libcmis-0.4.1.patch))
+
ifeq ($(OS)$(COM),WNTMSC)
$(eval $(call gb_UnpackedTarball_add_patches,cmis,libcmis/boost-win.patch))
endif
diff --git a/libcmis/libcmis-0.4.1.patch b/libcmis/libcmis-0.4.1.patch
new file mode 100644
index 0000000..214475f
--- /dev/null
+++ b/libcmis/libcmis-0.4.1.patch
@@ -0,0 +1,95 @@
+diff --git src/libcmis/json-utils.cxx src/libcmis/json-utils.cxx
+index b537a09..b4e037d 100644
+--- src/libcmis/json-utils.cxx
++++ src/libcmis/json-utils.cxx
+@@ -213,48 +213,54 @@ Json::Type Json::parseType( )
+ {
+ Type type = json_string;
+ string str = toString( );
+- boost::posix_time::ptime time = libcmis::parseDateTime( str );
+- if ( !time.is_not_a_date_time( ) )
+- type = json_datetime;
+- else
++ if ( str.empty( ) )
++ return type;
++ try
+ {
+- Type backupType = type;
+- type = json_bool;
+- try
+- {
+- parseBool( str );
+- }
+- catch (...)
++ boost::posix_time::ptime time = libcmis::parseDateTime( str );
++ if ( !time.is_not_a_date_time( ) )
++ return json_datetime;
++ }
++ catch (...)
++ {
++ // Try other types
++ }
++ Type backupType = type;
++ type = json_bool;
++ try
++ {
++ parseBool( str );
++ }
++ catch (...)
++ {
++ type = backupType;
++ }
++ if ( type != json_bool )
++ {
++ if ( str.find('.') == string::npos )
+ {
+- type = backupType;
++ backupType = type;
++ type = json_int;
++ try
++ {
++ parseInteger( str );
++ }
++ catch(...)
++ {
++ type = backupType;
++ }
+ }
+- if ( type != json_bool )
++ else
+ {
+- if ( str.find('.') == string::npos )
++ backupType = type;
++ type = json_double;
++ try
+ {
+- backupType = type;
+- type = json_int;
+- try
+- {
+- parseInteger( str );
+- }
+- catch(...)
+- {
+- type = backupType;
+- }
++ parseDouble( str );
+ }
+- else
+- {
+- backupType = type;
+- type = json_double;
+- try
+- {
+- parseDouble( str );
+- }
+- catch(...)
+- {
+- type = backupType;
+- }
++ catch(...)
++ {
++ type = backupType;
+ }
+ }
+ }
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index e6d213d..1ba5a86 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -171,7 +171,7 @@ namespace
bool bMultiValued = prop.MultiValued;
bool bOpenChoice = prop.OpenChoice;
uno::Any value = prop.Value;
- libcmis::PropertyType::Type type;
+ libcmis::PropertyType::Type type = libcmis::PropertyType::String;
if ( prop.Type == CMIS_TYPE_STRING )
type = libcmis::PropertyType::String;
else if ( prop.Type == CMIS_TYPE_BOOL )
commit 4e2d23812c62b76cc1d5f00ff6d5a23f777756b1
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Wed Aug 7 17:23:35 2013 +0200
Updated libcmis to 0.4.1: only build changes for distros
Change-Id: Ie5bd26d0fd9e3cd2b590b3b1ee1753faee533d63
diff --git a/download.lst b/download.lst
index 7b4d72e..b5a6efc 100644
--- a/download.lst
+++ b/download.lst
@@ -24,7 +24,7 @@ export BOOST_TARBALL := 15cb8c0803064faef0c4ddf5bc5ca279-boost_1_54_0.tar.bz2
export BSH_TARBALL := ea570af93c284aa9e5621cd563f54f4d-bsh-2.0b1-src.tar.gz
export CAIRO_TARBALL := f101a9e88b783337b20b2e26dfd26d5f-cairo-1.10.2.tar.gz
export CLUCENE_TARBALL := 48d647fbd8ef8889e5a7f422c1bfda94-clucene-core-2.3.3.4.tar.gz
-export CMIS_TARBALL := a649ee75b673cedff7e3322097ca199f-libcmis-0.4.0.tar.gz
+export CMIS_TARBALL := 22f8a85daf4a012180322e1f52a7563b-libcmis-0.4.1.tar.gz
export CPPUNIT_TARBALL := ac4781e01619be13461bb2d562b94a7b-cppunit-1.13.1.tar.gz
export CT2N_TARBALL := 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
export CURL_TARBALL := 3fa4d5236f2a36ca5c3af6715e837691-curl-7.26.0.tar.gz
commit b8a6e351ff287848a0e1cff8ef65400e02831626
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Fri Aug 23 19:41:01 2013 +0200
CMIS properties: make multiple values
Change-Id: I0d5ed8fbfd113940aadc117bcc7cf751be246071
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 19d8461..2834ca2 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -514,6 +514,29 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
};
+struct CmisValue : public VclBuilderContainer
+{
+ Edit* m_aValueEdit;
+
+ CmisValue( Window* pParent, const OUString& aStr );
+};
+
+struct CmisDateTime : public VclBuilderContainer
+{
+ DateField* m_aDateField;
+ TimeField* m_aTimeField;
+
+ CmisDateTime( Window* pParent, const ::com::sun::star::util::DateTime& aDateTime );
+};
+
+struct CmisYesNo : public VclBuilderContainer
+{
+ RadioButton* m_aYesButton;
+ RadioButton* m_aNoButton;
+
+ CmisYesNo( Window* pParent, bool bValue);
+};
+
// struct CmisPropertyLine ---------------------------------------------
struct CmisPropertyLine : public VclBuilderContainer
@@ -527,14 +550,13 @@ struct CmisPropertyLine : public VclBuilderContainer
bool m_bOpenChoice;
FixedText* m_aName;
FixedText* m_aType;
- Edit* m_aValueEdit;
- DateField* m_aDateField;
- TimeField* m_aTimeField;
- RadioButton* m_aYesButton;
- RadioButton* m_aNoButton;
-
+ std::vector< CmisValue* > m_aValues;
+ std::vector< CmisDateTime* > m_aDateTimes;
+ std::vector< CmisYesNo* > m_aYesNos;
+ sal_Int32 m_nNumValue;
long getItemHeight() const;
CmisPropertyLine( Window* pParent );
+ ~CmisPropertyLine();
};
// class CmisPropertiesWindow ------------------------------------------
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index dfd8395..c94c016 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2144,21 +2144,81 @@ SfxTabPage* SfxCustomPropertiesPage::Create( Window* pParent, const SfxItemSet&
return new SfxCustomPropertiesPage( pParent, rItemSet );
}
+CmisValue::CmisValue( Window* pParent, const OUString& aStr )
+{
+ m_pUIBuilder = new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui");
+ get( m_aValueEdit, "value");
+ m_aValueEdit->Show( true );
+ m_aValueEdit->SetText( aStr );
+}
+
+CmisDateTime::CmisDateTime( Window* pParent, const util::DateTime& aDateTime )
+{
+ m_pUIBuilder = new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui");
+ get( m_aDateField, "date");
+ get( m_aTimeField, "time");
+ m_aDateField->Show( true );
+ m_aTimeField->Show( true );
+ m_aDateField->SetDate( Date( aDateTime.Day, aDateTime.Month, aDateTime.Year ) );
+ m_aTimeField->SetTime( Time( aDateTime.Hours, aDateTime.Minutes,
+ aDateTime.Seconds, aDateTime.NanoSeconds ) );
+}
+
+CmisYesNo::CmisYesNo( Window* pParent, bool bValue )
+{
+ m_pUIBuilder = new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui");
+ get( m_aYesButton, "yes");
+ get( m_aNoButton, "no");
+ m_aYesButton->Show( true );
+ m_aNoButton->Show( true );
+ if ( bValue )
+ m_aYesButton->Check( );
+ else
+ m_aNoButton->Check( );
+}
+
// struct CmisPropertyLine ---------------------------------------------
CmisPropertyLine::CmisPropertyLine( Window* pParent )
{
+ m_nNumValue = 1;
m_sId = OUString("");
m_sType = CMIS_TYPE_STRING;
m_pUIBuilder = new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui");
get( m_pFrame, "CmisFrame" );
- m_pFrame->Enable();
get( m_aName, "name" );
get( m_aType, "type" );
- get( m_aValueEdit, "value" );
- get( m_aYesButton, "yes" );
- get( m_aNoButton, "no" );
- get( m_aDateField, "date" );
- get( m_aTimeField, "time" );
+ m_pFrame->Enable();
+}
+
+CmisPropertyLine::~CmisPropertyLine( )
+{
+ std::vector< CmisValue* >::iterator pIter;
+ for ( pIter = m_aValues.begin();
+ pIter != m_aValues.end(); ++pIter )
+ {
+ CmisValue* pValue = *pIter;
+ delete pValue;
+ }
+ m_aValues.clear();
+
+ std::vector< CmisYesNo* >::iterator pIterYesNo;
+ for ( pIterYesNo = m_aYesNos.begin();
+ pIterYesNo != m_aYesNos.end(); ++pIterYesNo )
+ {
+ CmisYesNo* pYesNo = *pIterYesNo;
+ delete pYesNo;
+ }
+ m_aYesNos.clear();
+
+ std::vector< CmisDateTime* >::iterator pIterDateTime;
+ for ( pIterDateTime = m_aDateTimes.begin();
+ pIterDateTime != m_aDateTimes.end(); ++pIterDateTime )
+ {
+ CmisDateTime* pDateTime = *pIterDateTime;
+ delete pDateTime;
+ }
+ m_aDateTimes.clear();
+
}
long CmisPropertyLine::getItemHeight() const
@@ -2197,7 +2257,12 @@ void CmisPropertiesWindow::ClearAllLines()
sal_uInt16 CmisPropertiesWindow::GetLineCount() const
{
- return m_aCmisPropertiesLines.size( );
+ sal_uInt16 nCount = 0;
+ std::vector< CmisPropertyLine* >::const_iterator pIter;
+ for ( pIter = m_aCmisPropertiesLines.begin();
+ pIter != m_aCmisPropertiesLines.end(); ++pIter )
+ nCount += ( (*pIter)->m_nNumValue + 1 );
+ return nCount;
}
void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
@@ -2214,62 +2279,80 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
pNewLine->m_bMultiValued = bMultiValued;
pNewLine->m_bOpenChoice = bOpenChoice;
- pNewLine->m_aValueEdit->SetReadOnly( !bUpdatable );
- pNewLine->m_aDateField->SetReadOnly( !bUpdatable );
- pNewLine->m_aTimeField->SetReadOnly( !bUpdatable );
- pNewLine->m_aYesButton->Enable( bUpdatable );
- pNewLine->m_aNoButton->Enable( bUpdatable );
-
- pNewLine->m_aName->SetText( sName );
-
- OUString sValue;
if ( sType == CMIS_TYPE_INTEGER )
{
- Sequence< sal_Int64 > nTmpValue;
- rAny >>= nTmpValue;
+ Sequence< sal_Int64 > seqValue;
+ rAny >>= seqValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( nTmpValue[0], nIndex, sValue );
+ sal_Int32 m_nNumValue = seqValue.getLength( );
+ for ( sal_Int32 i = 0; i < m_nNumValue; ++i )
+ {
+ OUString sValue;
+ m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue );
+ CmisValue* pValue = new CmisValue( m_pBox, sValue );
+ pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
+ pNewLine->m_aValues.push_back( pValue );
+ }
}
else if ( sType == CMIS_TYPE_DECIMAL )
{
- Sequence< double > dTmpValue;
- rAny >>= dTmpValue;
+ Sequence< double > seqValue;
+ rAny >>= seqValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( dTmpValue[0], nIndex, sValue );
+ sal_Int32 m_nNumValue = seqValue.getLength( );
+ for ( sal_Int32 i = 0; i < m_nNumValue; ++i )
+ {
+ OUString sValue;
+ m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue );
+ CmisValue* pValue = new CmisValue( m_pBox, sValue );
+ pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
+ pNewLine->m_aValues.push_back( pValue );
+ }
+
}
else if ( sType == CMIS_TYPE_BOOL )
{
- Sequence< bool > bTmpValue;
- rAny >>= bTmpValue;
- if ( bTmpValue[0] )
- pNewLine->m_aYesButton->Check();
- else
- pNewLine->m_aNoButton->Check();
+ Sequence< bool > seqValue;
+ rAny >>= seqValue;
+ sal_Int32 m_nNumValue = seqValue.getLength( );
+ for ( sal_Int32 i = 0; i < m_nNumValue; ++i )
+ {
+ CmisYesNo* pYesNo = new CmisYesNo( m_pBox, seqValue[i] );
+ pYesNo->m_aYesButton->Enable( bUpdatable );
+ pYesNo->m_aNoButton->Enable( bUpdatable );
+ pNewLine->m_aYesNos.push_back( pYesNo );
+ }
}
else if ( sType == CMIS_TYPE_STRING )
{
Sequence< OUString > seqValue;
rAny >>= seqValue;
- sValue = seqValue[0];
+ sal_Int32 m_nNumValue = seqValue.getLength( );
+ for ( sal_Int32 i = 0; i < m_nNumValue; ++i )
+ {
+ CmisValue* pValue = new CmisValue( m_pBox, seqValue[i] );
+ pValue->m_aValueEdit->SetReadOnly( !bUpdatable );
+ pNewLine->m_aValues.push_back( pValue );
+ }
}
else if ( sType == CMIS_TYPE_DATETIME )
{
- Sequence< util::DateTime > aTmpDateTime;
- rAny >>= aTmpDateTime;
- pNewLine->m_aDateField->SetDate( Date( aTmpDateTime[0].Day, aTmpDateTime[0].Month, aTmpDateTime[0].Year ) );
- pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime[0].Hours, aTmpDateTime[0].Minutes, aTmpDateTime[0].Seconds, aTmpDateTime[0].NanoSeconds ) );
+ Sequence< util::DateTime > seqValue;
+ rAny >>= seqValue;
+ sal_Int32 m_nNumValue = seqValue.getLength( );
+ for ( sal_Int32 i = 0; i < m_nNumValue; ++i )
+ {
+ CmisDateTime* pDateTime = new CmisDateTime( m_pBox, seqValue[i]);
+ pDateTime->m_aDateField->SetReadOnly( !bUpdatable );
+ pDateTime->m_aTimeField->SetReadOnly( !bUpdatable );
+ pNewLine->m_aDateTimes.push_back( pDateTime );
+ }
}
-
- pNewLine->m_aValueEdit->SetText( sValue );
+ pNewLine->m_aName->SetText( sName );
+ pNewLine->m_aName->Show( true );
pNewLine->m_aType->SetText( sType );
- pNewLine->m_aValueEdit->Show( CMIS_TYPE_STRING == sType ||
- CMIS_TYPE_INTEGER == sType ||
- CMIS_TYPE_DECIMAL == sType );
- pNewLine->m_aDateField->Show( CMIS_TYPE_DATETIME == sType );
- pNewLine->m_aTimeField->Show( CMIS_TYPE_DATETIME == sType );
- pNewLine->m_aYesButton->Show( CMIS_TYPE_BOOL == sType );
- pNewLine->m_aNoButton->Show( CMIS_TYPE_BOOL == sType );
+ pNewLine->m_aType->Show( true );
m_aCmisPropertiesLines.push_back( pNewLine );
}
@@ -2301,41 +2384,82 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
aPropertiesSeq[i].Name = sPropertyName;
OUString sType = pLine->m_aType->GetText( );
- if ( CMIS_TYPE_INTEGER == sType ||
- CMIS_TYPE_DECIMAL == sType )
+ if ( CMIS_TYPE_DECIMAL == sType )
{
- double nValue = 0;
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
- sal_Bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
- IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue );
- Sequence< double > seqValue( 1 );
- seqValue[0] = nValue;
- if ( bIsNum )
- aPropertiesSeq[i].Value <<= makeAny( seqValue );
+ Sequence< double > seqValue( pLine->m_aValues.size( ) );
+ sal_Int32 k = 0;
+ for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ it != pLine->m_aValues.end(); ++it, ++k)
+ {
+ double dValue = 0.0;
+ OUString sValue( (*it)->m_aValueEdit->GetText() );
+ sal_Bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
+ IsNumberFormat( sValue, nIndex, dValue );
+ if ( bIsNum )
+ seqValue[k] = dValue;
+ }
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
+ }
+ else if ( CMIS_TYPE_INTEGER == sType )
+ {
+ sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
+ m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
+ Sequence< sal_Int64 > seqValue( pLine->m_aValues.size( ) );
+ sal_Int32 k = 0;
+ for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ it != pLine->m_aValues.end(); ++it, ++k)
+ {
+ double dValue = 0;
+ OUString sValue( (*it)->m_aValueEdit->GetText() );
+ sal_Bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
+ IsNumberFormat( sValue, nIndex, dValue );
+ if ( bIsNum )
+ seqValue[k] = (sal_Int64) dValue;
+ }
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
else if ( CMIS_TYPE_BOOL == sType )
{
- bool bValue = pLine->m_aYesButton->IsChecked();
- Sequence< bool > seqValue( 1 );
- seqValue[0] = bValue;
+ Sequence< bool > seqValue( pLine->m_aYesNos.size( ) );
+ sal_Int32 k = 0;
+ for ( std::vector< CmisYesNo*>::const_iterator it = pLine->m_aYesNos.begin();
+ it != pLine->m_aYesNos.end(); ++it, ++k)
+ {
+ bool bValue = (*it)->m_aYesButton->IsChecked();
+ seqValue[k] = bValue;
+ }
aPropertiesSeq[i].Value <<= makeAny( seqValue );
+
}
else if ( CMIS_TYPE_DATETIME == sType )
{
- Date aTmpDate = pLine->m_aDateField->GetDate();
- Time aTmpTime = pLine->m_aTimeField->GetTime();
- util::DateTime aDateTime(aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
- aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear() );
- Sequence< util::DateTime > seqValue( 1 );
- seqValue[0] = aDateTime;
- aPropertiesSeq[i].Value <<= seqValue;
+ Sequence< util::DateTime > seqValue( pLine->m_aDateTimes.size( ) );
+ sal_Int32 k = 0;
+ for ( std::vector< CmisDateTime*>::const_iterator it = pLine->m_aDateTimes.begin();
+ it != pLine->m_aDateTimes.end(); ++it, ++k)
+ {
+ Date aTmpDate = (*it)->m_aDateField->GetDate();
+ Time aTmpTime = (*it)->m_aTimeField->GetTime();
+ util::DateTime aDateTime( aTmpTime.GetNanoSec(), aTmpTime.GetSec(),
+ aTmpTime.GetMin(), aTmpTime.GetHour(),
+ aTmpDate.GetDay(), aTmpDate.GetMonth(),
+ aTmpDate.GetYear() );
+ seqValue[k] = aDateTime;
+ }
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
else
{
- OUString sValue( pLine->m_aValueEdit->GetText() );
- Sequence< OUString > seqValue( 1 );
- seqValue[0] = sValue;
+ Sequence< OUString > seqValue( pLine->m_aValues.size( ) );
+ sal_Int32 k = 0;
+ for ( std::vector< CmisValue*>::const_iterator it = pLine->m_aValues.begin();
+ it != pLine->m_aValues.end(); ++it, ++k)
+ {
+ OUString sValue( (*it)->m_aValueEdit->GetText() );
+ seqValue[k] = sValue;
+ }
aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
}
@@ -2388,8 +2512,6 @@ void CmisPropertiesControl::setScrollRange()
{
sal_Int32 nScrollOffset = m_pPropertiesWin.GetItemHeight();
sal_Int32 nVisibleItems = m_rScrolledWindow.getVisibleChildSize().Height() / nScrollOffset;
- if ( !nVisibleItems )
- nVisibleItems = m_pPropertiesWin.GetLineCount() / 2;
m_rVertScroll.SetPageSize( nVisibleItems - 1 );
m_rVertScroll.SetVisibleSize( nVisibleItems );
m_rVertScroll.Scroll();
@@ -2442,33 +2564,9 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
std::vector< document::CmisProperty > changedProps;
for ( sal_Int32 i = 0; i< aNewProps.getLength( ); ++i )
- if ( aOldProps[i].Updatable )
+ if ( aOldProps[i].Updatable && !aNewProps[i].Id.isEmpty( ) )
{
- if ( aOldProps[i].Type == CMIS_TYPE_STRING )
- {
- Sequence< OUString > oldValue;
- aOldProps[i].Value >>= oldValue;
- Sequence< OUString > newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- {
- modifiedNum++;
- changedProps.push_back( aNewProps[i] );
- }
- }
- else if ( aOldProps[i].Type == CMIS_TYPE_BOOL )
- {
- Sequence< bool > oldValue;
- aOldProps[i].Value >>= oldValue;
- Sequence< bool > newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- {
- modifiedNum++;
- changedProps.push_back( aNewProps[i] );
- }
- }
- else if ( aOldProps[i].Type == CMIS_TYPE_DATETIME )
+ if ( aOldProps[i].Type == CMIS_TYPE_DATETIME )
{
Sequence< util::DateTime > oldValue;
aOldProps[i].Value >>= oldValue;
@@ -2481,35 +2579,16 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
}
Sequence< util::DateTime > newValue;
aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- {
- modifiedNum++;
- changedProps.push_back( aNewProps[i] );
- }
- }
- else if ( aOldProps[i].Type == CMIS_TYPE_INTEGER )
- {
- Sequence< sal_Int64 > oldValue;
- aOldProps[i].Value >>= oldValue;
- Sequence< sal_Int64 > newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ if ( oldValue != newValue )
{
modifiedNum++;
changedProps.push_back( aNewProps[i] );
}
}
- else if ( aOldProps[i].Type == CMIS_TYPE_DECIMAL )
+ else if ( aOldProps[i].Value != aNewProps[i].Value )
{
- Sequence< double > oldValue;
- aOldProps[i].Value >>= oldValue;
- Sequence< double > newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- {
- modifiedNum++;
- changedProps.push_back( aNewProps[i] );
- }
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
}
}
Sequence< document::CmisProperty> aModifiedProps( modifiedNum );
diff --git a/sfx2/uiconfig/ui/cmisline.ui b/sfx2/uiconfig/ui/cmisline.ui
index 3f5b498..bfdf7b0 100644
--- a/sfx2/uiconfig/ui/cmisline.ui
+++ b/sfx2/uiconfig/ui/cmisline.ui
@@ -6,6 +6,7 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
@@ -23,9 +24,9 @@
<object class="GtkLabel" id="name">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xpad">95</property>
- <property name="label" translatable="yes">Name</property>
- <property name="width_chars">26</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="width_chars">30</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -39,9 +40,9 @@
</child>
<child>
<object class="GtkLabel" id="type">
- <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xpad">47</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
<property name="label" translatable="yes">Type</property>
<property name="width_chars">8</property>
<attributes>
@@ -59,12 +60,12 @@
<object class="GtkRadioButton" id="yes">
<property name="label" translatable="yes">Yes</property>
<property name="use_action_appearance">False</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
+ <property name="yalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">no</property>
@@ -80,12 +81,12 @@
<object class="GtkRadioButton" id="no">
<property name="label" translatable="yes">No</property>
<property name="use_action_appearance">False</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
+ <property name="yalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">yes</property>
</object>
@@ -98,9 +99,8 @@
</child>
<child>
<object class="GtkEntry" id="value">
- <property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">80</property>
+ <property name="max_length">300</property>
<property name="width_chars">55</property>
</object>
<packing>
commit ac11dee3db1c531307d4f15514080a8d52ea950e
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Fri Aug 23 16:36:11 2013 +0200
CMIS properties: fix update issue
Change-Id: Ia04c588c7491cf9a4a5430b364b52ac89adf2f90
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 84e520b..19d8461 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -537,7 +537,6 @@ struct CmisPropertyLine : public VclBuilderContainer
CmisPropertyLine( Window* pParent );
};
-typedef boost::ptr_vector<CmisPropertyLine> CmisPropertiesLines;
// class CmisPropertiesWindow ------------------------------------------
class CmisPropertiesWindow
@@ -545,11 +544,8 @@ class CmisPropertiesWindow
private:
VclBox* m_pBox;
sal_Int32 m_nItemHeight;
- SvtSysLocale m_aSysLocale;
SvNumberFormatter m_aNumberFormatter;
- Timer m_aEditLoseFocusTimer;
- Timer m_aBoxLoseFocusTimer;
- CmisPropertiesLines m_aCmisPropertiesLines;
+ std::vector< CmisPropertyLine* > m_aCmisPropertiesLines;
public:
CmisPropertiesWindow(SfxTabPage* pParent);
~CmisPropertiesWindow();
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 6b1f06b..dfd8395 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2174,13 +2174,8 @@ CmisPropertiesWindow::CmisPropertiesWindow(SfxTabPage* pParent):
{
pParent->get(m_pBox, "CmisWindow");
- if ( !m_aCmisPropertiesLines.empty())
- m_nItemHeight = m_aCmisPropertiesLines.front().getItemHeight();
- else
- {
- CmisPropertyLine aTemp( m_pBox );
- m_nItemHeight = aTemp.getItemHeight();
- }
+ CmisPropertyLine aTemp( m_pBox );
+ m_nItemHeight = aTemp.getItemHeight();
};
CmisPropertiesWindow::~CmisPropertiesWindow()
@@ -2190,6 +2185,13 @@ CmisPropertiesWindow::~CmisPropertiesWindow()
void CmisPropertiesWindow::ClearAllLines()
{
+ std::vector< CmisPropertyLine* >::iterator pIter;
+ for ( pIter = m_aCmisPropertiesLines.begin();
+ pIter != m_aCmisPropertiesLines.end(); ++pIter )
+ {
+ CmisPropertyLine* pLine = *pIter;
+ delete pLine;
+ }
m_aCmisPropertiesLines.clear();
}
@@ -2281,24 +2283,24 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
{
Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() );
sal_Int32 i = 0;
- boost::ptr_vector< CmisPropertyLine >::const_iterator pIter;
+ std::vector< CmisPropertyLine* >::const_iterator pIter;
for ( pIter = m_aCmisPropertiesLines.begin();
pIter != m_aCmisPropertiesLines.end(); ++pIter, ++i )
{
- CmisPropertyLine pLine = *pIter;
+ CmisPropertyLine* pLine = *pIter;
- aPropertiesSeq[i].Id = pLine.m_sId;
- aPropertiesSeq[i].Type = pLine.m_sType;
- aPropertiesSeq[i].Updatable = pLine.m_bUpdatable;
- aPropertiesSeq[i].Required = pLine.m_bRequired;
- aPropertiesSeq[i].OpenChoice = pLine.m_bOpenChoice;
- aPropertiesSeq[i].MultiValued = pLine.m_bMultiValued;
+ aPropertiesSeq[i].Id = pLine->m_sId;
+ aPropertiesSeq[i].Type = pLine->m_sType;
+ aPropertiesSeq[i].Updatable = pLine->m_bUpdatable;
+ aPropertiesSeq[i].Required = pLine->m_bRequired;
+ aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice;
+ aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued;
- String sPropertyName = pLine.m_aName->GetText();
+ String sPropertyName = pLine->m_aName->GetText();
if ( sPropertyName.Len() > 0 )
{
aPropertiesSeq[i].Name = sPropertyName;
- OUString sType = pLine.m_aType->GetText( );
+ OUString sType = pLine->m_aType->GetText( );
if ( CMIS_TYPE_INTEGER == sType ||
CMIS_TYPE_DECIMAL == sType )
{
@@ -2306,27 +2308,35 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
sal_Bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
- IsNumberFormat( pLine.m_aValueEdit->GetText(), nIndex, nValue );
+ IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue );
+ Sequence< double > seqValue( 1 );
+ seqValue[0] = nValue;
if ( bIsNum )
- aPropertiesSeq[i].Value <<= makeAny( nValue );
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
else if ( CMIS_TYPE_BOOL == sType )
{
- bool bValue = pLine.m_aYesButton->IsChecked();
- aPropertiesSeq[i].Value <<= makeAny( bValue );
+ bool bValue = pLine->m_aYesButton->IsChecked();
+ Sequence< bool > seqValue( 1 );
+ seqValue[0] = bValue;
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
else if ( CMIS_TYPE_DATETIME == sType )
{
- Date aTmpDate = pLine.m_aDateField->GetDate();
- Time aTmpTime = pLine.m_aTimeField->GetTime();
+ Date aTmpDate = pLine->m_aDateField->GetDate();
+ Time aTmpTime = pLine->m_aTimeField->GetTime();
util::DateTime aDateTime(aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear() );
- aPropertiesSeq[i].Value <<= aDateTime;
+ Sequence< util::DateTime > seqValue( 1 );
+ seqValue[0] = aDateTime;
+ aPropertiesSeq[i].Value <<= seqValue;
}
else
{
- OUString sValue( pLine.m_aValueEdit->GetText() );
- aPropertiesSeq[i].Value <<= makeAny( sValue );
+ OUString sValue( pLine->m_aValueEdit->GetText() );
+ Sequence< OUString > seqValue( 1 );
+ seqValue[0] = sValue;
+ aPropertiesSeq[i].Value <<= makeAny( seqValue );
}
}
}
@@ -2430,26 +2440,83 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
Sequence< document::CmisProperty > aOldProps = pInfo->GetCmisProperties( );
Sequence< document::CmisProperty > aNewProps = m_pPropertiesCtrl.GetCmisProperties();
- for ( sal_Int32 i = 0; i< aNewProps.getLength( ); i++ )
+ std::vector< document::CmisProperty > changedProps;
+ for ( sal_Int32 i = 0; i< aNewProps.getLength( ); ++i )
+ if ( aOldProps[i].Updatable )
{
- OUString oldValue;
- aOldProps[i].Value >>= oldValue;
- OUString newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- modifiedNum++;
+ if ( aOldProps[i].Type == CMIS_TYPE_STRING )
+ {
+ Sequence< OUString > oldValue;
+ aOldProps[i].Value >>= oldValue;
+ Sequence< OUString > newValue;
+ aNewProps[i].Value >>= newValue;
+ if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ {
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
+ }
+ }
+ else if ( aOldProps[i].Type == CMIS_TYPE_BOOL )
+ {
+ Sequence< bool > oldValue;
+ aOldProps[i].Value >>= oldValue;
+ Sequence< bool > newValue;
+ aNewProps[i].Value >>= newValue;
+ if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ {
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
+ }
+ }
+ else if ( aOldProps[i].Type == CMIS_TYPE_DATETIME )
+ {
+ Sequence< util::DateTime > oldValue;
+ aOldProps[i].Value >>= oldValue;
+ // We only edit hours and minutes
+ // don't compare NanoSeconds and Seconds
+ for ( sal_Int32 ii = 0; ii < oldValue.getLength( ); ++ii )
+ {
+ oldValue[ii].NanoSeconds = 0;
+ oldValue[ii].Seconds = 0;
+ }
+ Sequence< util::DateTime > newValue;
+ aNewProps[i].Value >>= newValue;
+ if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ {
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
+ }
+ }
+ else if ( aOldProps[i].Type == CMIS_TYPE_INTEGER )
+ {
+ Sequence< sal_Int64 > oldValue;
+ aOldProps[i].Value >>= oldValue;
+ Sequence< sal_Int64 > newValue;
+ aNewProps[i].Value >>= newValue;
+ if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ {
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
+ }
+ }
+ else if ( aOldProps[i].Type == CMIS_TYPE_DECIMAL )
+ {
+ Sequence< double > oldValue;
+ aOldProps[i].Value >>= oldValue;
+ Sequence< double > newValue;
+ aNewProps[i].Value >>= newValue;
+ if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
+ {
+ modifiedNum++;
+ changedProps.push_back( aNewProps[i] );
+ }
+ }
}
Sequence< document::CmisProperty> aModifiedProps( modifiedNum );
sal_Int32 nCount = 0;
- for ( sal_Int32 i = 0; i< aNewProps.getLength( ); i++ )
- {
- OUString oldValue;
- aOldProps[i].Value >>= oldValue;
- OUString newValue;
- aNewProps[i].Value >>= newValue;
- if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
- aModifiedProps[ nCount++ ] = aNewProps[i];
- }
+ for( std::vector< document::CmisProperty>::const_iterator pIter = changedProps.begin();
+ pIter != changedProps.end( ); ++pIter )
+ aModifiedProps[ nCount++ ] = *pIter;
pInfo->SetCmisProperties( aModifiedProps );
}
commit 5c1d9086db52d31f9242c93a9304d90bf56b4219
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Fri Aug 23 15:43:03 2013 +0200
CMIS properties dialog: get multiple values
Change-Id: Ife7562d52cc3070c8d409f2da68d4e2aa5faea69
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index ef7bdbc..6b1f06b 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2220,43 +2220,42 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
pNewLine->m_aName->SetText( sName );
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
OUString sValue;
if ( sType == CMIS_TYPE_INTEGER )
{
- sal_Int64 nTmpValue = 0;
+ Sequence< sal_Int64 > nTmpValue;
rAny >>= nTmpValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
+ m_aNumberFormatter.GetInputLineString( nTmpValue[0], nIndex, sValue );
}
else if ( sType == CMIS_TYPE_DECIMAL )
{
- double dTmpValue = 0.0;
+ Sequence< double > dTmpValue;
rAny >>= dTmpValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( dTmpValue, nIndex, sValue );
+ m_aNumberFormatter.GetInputLineString( dTmpValue[0], nIndex, sValue );
}
else if ( sType == CMIS_TYPE_BOOL )
{
- bool bTmpValue = false;
+ Sequence< bool > bTmpValue;
rAny >>= bTmpValue;
- sValue = ( bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord() );
- if ( bTmpValue )
+ if ( bTmpValue[0] )
pNewLine->m_aYesButton->Check();
else
pNewLine->m_aNoButton->Check();
}
else if ( sType == CMIS_TYPE_STRING )
{
- rAny >>= sValue;
+ Sequence< OUString > seqValue;
+ rAny >>= seqValue;
+ sValue = seqValue[0];
}
else if ( sType == CMIS_TYPE_DATETIME )
{
- util::DateTime aTmpDateTime;
+ Sequence< util::DateTime > aTmpDateTime;
rAny >>= aTmpDateTime;
- pNewLine->m_aDateField->SetDate( Date( aTmpDateTime.Day, aTmpDateTime.Month, aTmpDateTime.Year ) );
- pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime.Hours, aTmpDateTime.Minutes, aTmpDateTime.Seconds, aTmpDateTime.NanoSeconds ) );
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTime[0].Day, aTmpDateTime[0].Month, aTmpDateTime[0].Year ) );
+ pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime[0].Hours, aTmpDateTime[0].Minutes, aTmpDateTime[0].Seconds, aTmpDateTime[0].NanoSeconds ) );
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f2048a0..e6d213d 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -82,114 +82,78 @@ namespace
uno::Any lcl_cmisPropertyToUno( libcmis::PropertyPtr pProperty )
{
uno::Any aValue;
- bool bMultiValued = pProperty->getPropertyType( )->isMultiValued( );
switch ( pProperty->getPropertyType( )->getType( ) )
{
default:
case libcmis::PropertyType::String:
{
vector< string > aCmisStrings = pProperty->getStrings( );
- if ( bMultiValued )
+ uno::Sequence< OUString > aStrings( aCmisStrings.size( ) );
+ OUString* aStringsArr = aStrings.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< string >::iterator it = aCmisStrings.begin( );
+ it != aCmisStrings.end( ); ++it, ++i )
{
- uno::Sequence< OUString > aStrings( aCmisStrings.size( ) );
- OUString* aStringsArr = aStrings.getArray( );
- sal_Int32 i = 0;
- for ( vector< string >::iterator it = aCmisStrings.begin( );
- it != aCmisStrings.end( ); ++it, ++i )
- {
- string str = *it;
- aStringsArr[i] = STD_TO_OUSTR( str );
- }
- aValue <<= aStrings;
- }
- else if ( !aCmisStrings.empty( ) )
- {
- aValue <<= STD_TO_OUSTR( aCmisStrings.front( ) );
+ string str = *it;
+ aStringsArr[i] = STD_TO_OUSTR( str );
}
+ aValue <<= aStrings;
}
break;
case libcmis::PropertyType::Integer:
{
vector< long > aCmisLongs = pProperty->getLongs( );
- if ( bMultiValued )
+ uno::Sequence< sal_Int64 > aLongs( aCmisLongs.size( ) );
+ sal_Int64* aLongsArr = aLongs.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< long >::iterator it = aCmisLongs.begin( );
+ it != aCmisLongs.end( ); ++it, ++i )
{
- uno::Sequence< sal_Int64 > aLongs( aCmisLongs.size( ) );
- sal_Int64* aLongsArr = aLongs.getArray( );
- sal_Int32 i = 0;
- for ( vector< long >::iterator it = aCmisLongs.begin( );
- it != aCmisLongs.end( ); ++it, ++i )
- {
- aLongsArr[i] = *it;
- }
- aValue <<= aLongs;
- }
- else if ( !aCmisLongs.empty( ) )
- {
- aValue <<= aCmisLongs.front( );
+ aLongsArr[i] = *it;
}
+ aValue <<= aLongs;
}
break;
case libcmis::PropertyType::Decimal:
{
vector< double > aCmisDoubles = pProperty->getDoubles( );
- if ( bMultiValued )
- {
- uno::Sequence< double > aDoubles( aCmisDoubles.size( ) );
- double* aDoublesArr = aDoubles.getArray( );
- sal_Int32 i = 0;
- for ( vector< double >::iterator it = aCmisDoubles.begin( );
- it != aCmisDoubles.end( ); ++it, ++i )
- {
- aDoublesArr[i] = *it;
- }
- aValue <<= aDoubles;
- }
- else if ( !aCmisDoubles.empty( ) )
+ uno::Sequence< double > aDoubles( aCmisDoubles.size( ) );
+ double* aDoublesArr = aDoubles.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< double >::iterator it = aCmisDoubles.begin( );
+ it != aCmisDoubles.end( ); ++it, ++i )
{
- aValue <<= aCmisDoubles.front( );
+ aDoublesArr[i] = *it;
}
+ aValue <<= aDoubles;
}
break;
case libcmis::PropertyType::Bool:
{
vector< bool > aCmisBools = pProperty->getBools( );
- if ( bMultiValued )
+ uno::Sequence< sal_Bool > aBools( aCmisBools.size( ) );
+ sal_Bool* aBoolsArr = aBools.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< bool >::iterator it = aCmisBools.begin( );
+ it != aCmisBools.end( ); ++it, ++i )
{
- uno::Sequence< sal_Bool > aBools( aCmisBools.size( ) );
- sal_Bool* aBoolsArr = aBools.getArray( );
- sal_Int32 i = 0;
- for ( vector< bool >::iterator it = aCmisBools.begin( );
- it != aCmisBools.end( ); ++it, ++i )
- {
- aBoolsArr[i] = *it;
- }
- aValue <<= aBools;
- }
- else if ( !aCmisBools.empty( ) )
- {
- aValue <<= sal_Bool( aCmisBools.front( ) );
+ aBoolsArr[i] = *it;
}
+ aValue <<= aBools;
}
break;
case libcmis::PropertyType::DateTime:
{
vector< boost::posix_time::ptime > aCmisTimes = pProperty->getDateTimes( );
- if ( bMultiValued )
+ uno::Sequence< util::DateTime > aTimes( aCmisTimes.size( ) );
+ util::DateTime* aTimesArr = aTimes.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< boost::posix_time::ptime >::iterator it = aCmisTimes.begin( );
+ it != aCmisTimes.end( ); ++it, ++i )
{
- uno::Sequence< util::DateTime > aTimes( aCmisTimes.size( ) );
- util::DateTime* aTimesArr = aTimes.getArray( );
- sal_Int32 i = 0;
- for ( vector< boost::posix_time::ptime >::iterator it = aCmisTimes.begin( );
- it != aCmisTimes.end( ); ++it, ++i )
- {
- aTimesArr[i] = lcl_boostToUnoTime( *it );
- }
- aValue <<= aTimes;
- }
- else if ( !aCmisTimes.empty( ) )
- {
- aValue <<= lcl_boostToUnoTime( aCmisTimes.front( ) );
+ aTimesArr[i] = lcl_boostToUnoTime( *it );
}
+ aValue <<= aTimes;
}
break;
}
@@ -212,11 +176,11 @@ namespace
type = libcmis::PropertyType::String;
else if ( prop.Type == CMIS_TYPE_BOOL )
type = libcmis::PropertyType::Bool;
- else if ( prop.Type == CMIS_TYPE_INTEGER )
+ else if ( prop.Type == CMIS_TYPE_INTEGER )
type = libcmis::PropertyType::Integer;
- else if ( prop.Type == CMIS_TYPE_DECIMAL )
+ else if ( prop.Type == CMIS_TYPE_DECIMAL )
type = libcmis::PropertyType::Decimal;
- else if ( prop.Type == CMIS_TYPE_DATETIME )
+ else if ( prop.Type == CMIS_TYPE_DATETIME )
type = libcmis::PropertyType::DateTime;
propertyType->setId( OUSTR_TO_STDSTR( id ));
@@ -230,23 +194,13 @@ namespace
std::vector< std::string > values;
// convert UNO value to string vector
- if ( bMultiValued )
- {
- uno::Sequence< OUString > aStrings;
- value >>= aStrings;
- sal_Int32 len = aStrings.getLength( );
- for ( sal_Int32 i = 0; i < len; i++ )
- {
- string str = OUSTR_TO_STDSTR( aStrings[i] );
- values.push_back( str );
- }
- }
- else
+ uno::Sequence< OUString > aStrings;
+ value >>= aStrings;
+ sal_Int32 len = aStrings.getLength( );
+ for ( sal_Int32 i = 0; i < len; i++ )
{
- OUString val;
- value >>= val;
- std::string str = OUSTR_TO_STDSTR( val );
- values.push_back( str);
+ string str = OUSTR_TO_STDSTR( aStrings[i] );
+ values.push_back( str );
}
libcmis::PropertyPtr property( new libcmis::Property( propertyType, values ) );
commit b5e2d83bd529b0f0ce04d0690f4e0cccb667931e
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Fri Aug 23 15:25:06 2013 +0200
CMIS properties dialog: fix scroll
Change-Id: I4f65adea63267dcafa448001fed7693f55378751
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 6a1d6d8..ef7bdbc 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2379,6 +2379,8 @@ void CmisPropertiesControl::setScrollRange()
{
sal_Int32 nScrollOffset = m_pPropertiesWin.GetItemHeight();
sal_Int32 nVisibleItems = m_rScrolledWindow.getVisibleChildSize().Height() / nScrollOffset;
+ if ( !nVisibleItems )
+ nVisibleItems = m_pPropertiesWin.GetLineCount() / 2;
m_rVertScroll.SetPageSize( nVisibleItems - 1 );
m_rVertScroll.SetVisibleSize( nVisibleItems );
m_rVertScroll.Scroll();
@@ -2475,6 +2477,7 @@ void SfxCmisPropertiesPage::Reset( const SfxItemSet& rItemSet )
aCmisProps[i].Choices,
aCmisProps[i].Value );
}
+ m_pPropertiesCtrl.setScrollRange();
}
int SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )
commit 956126cc526ecd2808f193883e369cb38d9d94fd
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Sat Aug 17 22:13:57 2013 +0200
Convert CMIS properties dialog to .ui
Change-Id: I98caf59352bb5e57c7685cb24561ddb2966b6035
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 50309bc..84e520b 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -21,6 +21,8 @@
#include <boost/optional/optional.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include "sal/config.h"
#include "sfx2/dllapi.h"
@@ -42,6 +44,8 @@
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/scrbar.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/ctrl.hxx>
#include "tabdlg.hxx"
@@ -510,180 +514,88 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
};
-struct CmisPropertyLine;
-
-class CmisPropertiesEdit : public Edit
-{
-private:
- CmisPropertyLine* m_pLine;
-
-public:
- inline CmisPropertiesEdit(
- Window* pParent, const ResId& rResId, CmisPropertyLine* pLine ) :
- Edit( pParent, rResId ), m_pLine( pLine ) {}
-
- inline CmisPropertyLine* GetLine() const { return m_pLine; }
-};
-
-class CmisPropertiesDateField : public DateField
-{
-private:
- CmisPropertyLine* m_pLine;
-
-public:
- inline CmisPropertiesDateField(
- Window* pParent, const ResId& rResId, CmisPropertyLine* pLine ) :
- DateField( pParent, rResId ), m_pLine( pLine ) {}
-
- inline CmisPropertyLine* GetLine() const { return m_pLine; }
-};
-class CmisPropertiesTimeField : public TimeField
-{
-private:
- CmisPropertyLine* m_pLine;
-
-public:
- inline CmisPropertiesTimeField(
- Window* pParent, const ResId& rResId, CmisPropertyLine* pLine ) :
- TimeField( pParent, rResId ), m_pLine( pLine ) {}
-
- inline CmisPropertyLine* GetLine() const { return m_pLine; }
-};
-
-class CmisPropertiesEditButton : public PushButton
-{
- CmisPropertyLine* m_pLine;
-
-public:
- CmisPropertiesEditButton( Window* pParent, const ResId& rResId, CmisPropertyLine* pLine );
- ~CmisPropertiesEditButton();
-
- DECL_LINK(ClickHdl, void *);
-};
-
-class CmisPropertiesYesNoButton : public Control
-{
-private:
- RadioButton m_aYesButton;
- RadioButton m_aNoButton;
-
-public:
- CmisPropertiesYesNoButton( Window* pParent, const ResId& rResId );
-
- virtual void Resize();
-
- void SetReadOnly( );
-
- inline void CheckYes() { m_aYesButton.Check(); }
- inline void CheckNo() { m_aNoButton.Check(); }
- inline bool IsYesChecked() const { return m_aYesButton.IsChecked() != sal_False; }
-};
-
// struct CmisPropertyLine ---------------------------------------------
-struct CmisPropertyLine
+struct CmisPropertyLine : public VclBuilderContainer
{
+ VclFrame* m_pFrame;
OUString m_sId;
OUString m_sType;
bool m_bUpdatable;
bool m_bRequired;
bool m_bMultiValued;
bool m_bOpenChoice;
- FixedText m_aName;
- FixedText m_aType;
- CmisPropertiesEdit m_aValueEdit;
- CmisPropertiesDateField m_aDateField;
- CmisPropertiesTimeField m_aTimeField;
- CmisPropertiesYesNoButton m_aYesNoButton;
- Point m_aDatePos;
- Point m_aTimePos;
- Size m_aDateTimeSize;
- bool m_bTypeLostFocus;
+ FixedText* m_aName;
+ FixedText* m_aType;
+ Edit* m_aValueEdit;
+ DateField* m_aDateField;
+ TimeField* m_aTimeField;
+ RadioButton* m_aYesButton;
+ RadioButton* m_aNoButton;
+
+ long getItemHeight() const;
CmisPropertyLine( Window* pParent );
};
+typedef boost::ptr_vector<CmisPropertyLine> CmisPropertiesLines;
// class CmisPropertiesWindow ------------------------------------------
-class CmisPropertiesWindow : public Window
+class CmisPropertiesWindow
{
private:
- FixedText m_aName;
- FixedText m_aType;
- Edit m_aValueEdit;
- DateField m_aDateField;
- TimeField m_aTimeField;
- CmisPropertiesYesNoButton m_aYesNoButton;
-
- sal_Int32 m_nLineHeight;
- sal_Int32 m_nScrollPos;
+ VclBox* m_pBox;
+ sal_Int32 m_nItemHeight;
SvtSysLocale m_aSysLocale;
- std::vector< CmisPropertyLine* > m_aCmisPropertiesLines;
- CmisPropertyLine* m_pCurrentLine;
SvNumberFormatter m_aNumberFormatter;
Timer m_aEditLoseFocusTimer;
Timer m_aBoxLoseFocusTimer;
-
- DECL_LINK( EditLoseFocusHdl, CmisPropertiesEdit* );
-
- bool IsLineValid( CmisPropertyLine* pLine ) const;
- void ValidateLine( CmisPropertyLine* pLine, bool bIsFromTypeBox );
-
+ CmisPropertiesLines m_aCmisPropertiesLines;
public:
- CmisPropertiesWindow(Window* pParent,
- const OUString &rHeaderAccName,
- const OUString &rHeaderAccType,
- const OUString &rHeaderAccValue);
+ CmisPropertiesWindow(SfxTabPage* pParent);
~CmisPropertiesWindow();
- void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
- sal_uInt16 GetLineCount() const;
- inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
- void AddLine( const OUString& sId, const OUString& sName,
- const OUString& sType, const bool bUpdatable,
- const bool bRequired, const bool bMultiValued,
- const bool bOpenChoice,
- com::sun::star::uno::Any& aChoices,
- com::sun::star::uno::Any& rAny );
- bool AreAllLinesValid() const;
- void ClearAllLines();
- void DoScroll( sal_Int32 nNewPos );
+ sal_uInt16 GetLineCount() const;
+ inline sal_Int32 GetItemHeight() const { return m_nItemHeight; }
+ void AddLine( const OUString& sId, const OUString& sName,
+ const OUString& sType, const bool bUpdatable,
+ const bool bRequired, const bool bMultiValued,
+ const bool bOpenChoice,
+ com::sun::star::uno::Any& aChoices,
+ com::sun::star::uno::Any& rAny );
+ void ClearAllLines();
+ void DoScroll( sal_Int32 nNewPos );
::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisProperty >
GetCmisProperties() const;
- void updateLineWidth();
};
// class CmisPropertiesControl -----------------------------------------
-class CmisPropertiesControl : public VclVBox
+class CmisPropertiesControl
{
private:
- HeaderBar* m_pHeaderBar;
- VclHBox* m_pBody;
- CmisPropertiesWindow* m_pPropertiesWin;
- ScrollBar* m_pVertScroll;
- sal_Int32 m_nThumbPos;
-
+ CmisPropertiesWindow m_pPropertiesWin;
+ VclScrolledWindow& m_rScrolledWindow;
+ ScrollBar& m_rVertScroll;
DECL_LINK( ScrollHdl, ScrollBar* );
+ void checkAutoVScroll();
+
public:
- CmisPropertiesControl(Window* pParent);
- ~CmisPropertiesControl();
+ CmisPropertiesControl(SfxTabPage* pParent);
+ void setScrollRange();
- void AddLine( const OUString& sId, const OUString& sName,
- const OUString& sType, const bool bUpdatable,
- const bool bRequired, const bool bMultiValude,
- const bool bOpenChoice,
- com::sun::star::uno::Any& aChoices,
- com::sun::star::uno::Any& rAny, bool bInteractive );
+ void AddLine( const OUString& sId, const OUString& sName,
+ const OUString& sType, const bool bUpdatable,
+ const bool bRequired, const bool bMultiValude,
+ const bool bOpenChoice,
+ com::sun::star::uno::Any& aChoices,
+ com::sun::star::uno::Any& rAny );
- inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
- inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
+ void ClearAllLines();
inline ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisProperty >
GetCmisProperties() const
- { return m_pPropertiesWin->GetCmisProperties(); }
- void Init(VclBuilderContainer& rParent);
- virtual void setAllocation(const Size &rAllocation);
+ { return m_pPropertiesWin.GetCmisProperties(); }
};
// class SfxCmisPropertiesPage -------------------------------------------------
@@ -691,7 +603,7 @@ public:
class SfxCmisPropertiesPage : public SfxTabPage
{
private:
- CmisPropertiesControl* m_pPropertiesCtrl;
+ CmisPropertiesControl m_pPropertiesCtrl;
using TabPage::DeactivatePage;
DECL_LINK(UpdateHdl, void *);
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 6b3c3da..ff75447 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -29,6 +29,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/versioncommentdialog \
sfx2/uiconfig/ui/startcenter \
sfx2/uiconfig/ui/cmisinfopage \
+ sfx2/uiconfig/ui/cmisline \
))
# vim: set noet sw=4 ts=4:
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 16b82a9..6a1d6d8 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2144,222 +2144,53 @@ SfxTabPage* SfxCustomPropertiesPage::Create( Window* pParent, const SfxItemSet&
return new SfxCustomPropertiesPage( pParent, rItemSet );
}
-
-// class CmisPropertiesYesNoButton -------------------------------------
-
-CmisPropertiesYesNoButton::CmisPropertiesYesNoButton( Window* pParent, const ResId& rResId ) :
- Control( pParent, rResId ),
- m_aYesButton( this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() ) ),
- m_aNoButton ( this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() ) )
-{
- FreeResource();
- Wallpaper aWall( Color( COL_TRANSPARENT ) );
- SetBackground( aWall );
- SetBorderStyle( WINDOW_BORDER_MONO );
- CheckNo();
- m_aYesButton.SetBackground( aWall );
- m_aNoButton.SetBackground( aWall );
-}
-
-void CmisPropertiesYesNoButton::SetReadOnly( )
-{
- m_aNoButton.Enable( sal_False );
- m_aYesButton.Enable( sal_False );
-}
-
-CmisPropertiesEditButton::CmisPropertiesEditButton( Window* pParent, const ResId& rResId, CmisPropertyLine* pLine ) :
- PushButton( pParent, rResId ), m_pLine( pLine )
-{
- SetClickHdl( LINK( this, CmisPropertiesEditButton, ClickHdl ));
-}
-
-CmisPropertiesEditButton::~CmisPropertiesEditButton()
-{
-}
-
-IMPL_LINK_NOARG(CmisPropertiesEditButton, ClickHdl)
-{
- return 1;
-}
-//--------------------------------------------------------------------------
-void CmisPropertiesYesNoButton::Resize()
+// struct CmisPropertyLine ---------------------------------------------
+CmisPropertyLine::CmisPropertyLine( Window* pParent )
{
- const long nWidth = GetSizePixel().Width();
- const long n3Width = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width();
- const long nNewWidth = ( nWidth / 2 ) - n3Width - 2;
- Size aSize = m_aYesButton.GetSizePixel();
- const long nDelta = aSize.Width() - nNewWidth;
- aSize.Width() = nNewWidth;
- m_aYesButton.SetSizePixel( aSize );
- Point aPos = m_aNoButton.GetPosPixel();
- aPos.X() -= nDelta;
- m_aNoButton.SetPosSizePixel( aPos, aSize );
+ m_sId = OUString("");
+ m_sType = CMIS_TYPE_STRING;
+ m_pUIBuilder = new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui");
+ get( m_pFrame, "CmisFrame" );
+ m_pFrame->Enable();
+ get( m_aName, "name" );
+ get( m_aType, "type" );
+ get( m_aValueEdit, "value" );
+ get( m_aYesButton, "yes" );
+ get( m_aNoButton, "no" );
+ get( m_aDateField, "date" );
+ get( m_aTimeField, "time" );
}
-// struct CmisPropertyLine ---------------------------------------------
-CmisPropertyLine::CmisPropertyLine( Window* pParent ) :
- m_sId ( ),
- m_sType ( CMIS_TYPE_STRING ),
- m_aName ( pParent, SfxResId( SFX_CMIS_PROPERTY_NAME ) ),
- m_aType ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
- m_aValueEdit ( pParent, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ), this ),
- m_aDateField ( pParent, SfxResId( SFX_CMIS_FLD_DATE), this),
- m_aTimeField ( pParent, SfxResId( SFX_CMIS_FLD_TIME), this),
- m_aYesNoButton ( pParent, SfxResId( SFX_CMIS_WIN_PROPERTY_YESNO ) ),
- m_bTypeLostFocus( false )
-
+long CmisPropertyLine::getItemHeight() const
{
- m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG );
- m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
+ return VclContainer::getLayoutRequisition(*m_pFrame).Height();
}
// class CmisPropertiesWindow -----------------------------------------
-CmisPropertiesWindow::CmisPropertiesWindow(Window* pParent,
- const OUString &rHeaderAccName,
- const OUString &rHeaderAccType,
- const OUString &rHeaderAccValue) :
- Window(pParent),
- m_aName ( this, SfxResId( SFX_CMIS_PROPERTY_NAME ) ),
- m_aType ( this, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
- m_aValueEdit ( this, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ) ),
- m_aDateField ( this, SfxResId( SFX_CMIS_FLD_DATE) ),
- m_aTimeField ( this, SfxResId( SFX_CMIS_FLD_TIME) ),
- m_aYesNoButton ( this, SfxResId( SFX_CMIS_WIN_PROPERTY_YESNO ) ),
- m_nScrollPos (0),
+CmisPropertiesWindow::CmisPropertiesWindow(SfxTabPage* pParent):
m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
Application::GetSettings().GetLanguageTag().getLanguageType() )
{
- m_aName.SetAccessibleName(rHeaderAccName);
- m_aType.SetAccessibleName(rHeaderAccType);
- m_aValueEdit.SetAccessibleName(rHeaderAccValue);
-}
-
-CmisPropertiesWindow::~CmisPropertiesWindow()
-{
- m_aEditLoseFocusTimer.Stop();
- ClearAllLines();
-}
-
-IMPL_LINK( CmisPropertiesWindow, EditLoseFocusHdl, CmisPropertiesEdit*, pEdit )
-{
- if ( pEdit )
- {
- CmisPropertyLine* pLine = pEdit->GetLine();
- if ( !pLine->m_bTypeLostFocus )
- {
- m_pCurrentLine = pLine;
- m_aEditLoseFocusTimer.Start();
- }
- else
- pLine->m_bTypeLostFocus = false;
- }
- return 0;
-}
-
-bool CmisPropertiesWindow::IsLineValid( CmisPropertyLine* pLine ) const
-{
- bool bIsValid = true;
- pLine->m_bTypeLostFocus = false;
- String sValue = pLine->m_aValueEdit.GetText();
- if ( sValue.Len() == 0 )
- return true;
-
- sal_uInt32 nIndex = 0xFFFFFFFF;
- if ( CMIS_TYPE_INTEGER == pLine->m_sType ||
- CMIS_TYPE_DECIMAL == pLine->m_sType )
- nIndex = const_cast< SvNumberFormatter& >(
- m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
- else if ( CMIS_TYPE_DATETIME == pLine->m_sType )
- nIndex = const_cast< SvNumberFormatter& >(
- m_aNumberFormatter).GetFormatIndex( NF_DATE_SYS_DDMMYYYY );
-
- if ( nIndex != 0xFFFFFFFF )
+ pParent->get(m_pBox, "CmisWindow");
+ if ( !m_aCmisPropertiesLines.empty())
+ m_nItemHeight = m_aCmisPropertiesLines.front().getItemHeight();
+ else
{
- sal_uInt32 nTemp = nIndex;
- double fDummy = 0.0;
- bIsValid = const_cast< SvNumberFormatter& >(
- m_aNumberFormatter ).IsNumberFormat( sValue, nIndex, fDummy ) != sal_False;
- if ( bIsValid && nTemp != nIndex )
- // sValue is a number but the format doesn't match the index
- bIsValid = false;
+ CmisPropertyLine aTemp( m_pBox );
+ m_nItemHeight = aTemp.getItemHeight();
}
+};
- return bIsValid;
-}
-
-void CmisPropertiesWindow::ValidateLine( CmisPropertyLine* pLine, bool bIsFromTypeBox )
+CmisPropertiesWindow::~CmisPropertiesWindow()
{
- if ( !IsLineValid( pLine ) )
- {
- if ( bIsFromTypeBox )
- pLine->m_bTypeLostFocus = true;
- Window* pParent = GetParent()->GetParent();
- if ( QueryBox( pParent, SfxResId( SFX_QB_WRONG_TYPE ) ).Execute() == RET_OK )
- pLine->m_aType.SetText( CMIS_TYPE_STRING );
- else
- pLine->m_aValueEdit.GrabFocus();
- }
+ ClearAllLines();
}
-void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar )
+void CmisPropertiesWindow::ClearAllLines()
{
- DBG_ASSERT( pHeaderBar, "CmisPropertiesWindow::InitControls(): invalid headerbar" );
- DBG_ASSERT( pScrollBar, "CmisPropertiesWindow::InitControls(): invalid scrollbar" );
-
- m_aName.Hide();
- m_aType.Hide();
- m_aValueEdit.Hide();
- m_aDateField.Hide();
- m_aTimeField.Hide();
- m_aYesNoButton.Hide();
-
- const long nOffset = 4;
- const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
- const long nButtonWidth = nScrollBarWidth + nOffset;
- long nTypeWidth = m_aValueEdit.CalcMinimumSizeForText( CMIS_TYPE_DATETIME ).Width( )
- + ( 2 * nOffset );
- long nFullWidth = pHeaderBar->GetSizePixel().Width();
- long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
- pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
- pHeaderBar->SetItemSize( HI_TYPE, nTypeWidth );
- pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
- pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
-
- Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit, NULL };
- Window** pCurrent = pWindows;
- sal_uInt16 nPos = 0;
- while ( *pCurrent )
- {
- Rectangle aRect = pHeaderBar->GetItemRect( pHeaderBar->GetItemId( nPos++ ) );
- Size aSize = (*pCurrent)->GetSizePixel();
- Point aPos = (*pCurrent)->GetPosPixel();
- long nWidth = aRect.GetWidth() - nOffset;
-
- aSize.Width() = nWidth;
- aPos.X() = aRect.getX() + ( nOffset / 2 );
- (*pCurrent)->SetPosSizePixel( aPos, aSize );
-
- if ( *pCurrent == &m_aValueEdit )
- {
- aSize = m_aYesNoButton.GetSizePixel();
- aPos = m_aYesNoButton.GetPosPixel();
- aSize.Width() = nWidth;
- aPos.X() = aRect.getX() + ( nOffset / 2 );
- m_aYesNoButton.SetPosSizePixel( aPos, aSize );
- aSize.Width() /= 2;
- aSize.Width() -= 2;
- m_aDateField.SetPosSizePixel( aPos, aSize );
- aPos.X() += aSize.Width() + 4;
- m_aTimeField.SetPosSizePixel( aPos, aSize );
- }
-
- pCurrent++;
- }
-
- m_nLineHeight = m_aValueEdit.GetSizePixel().Height();
-
+ m_aCmisPropertiesLines.clear();
}
sal_uInt16 CmisPropertiesWindow::GetLineCount() const
@@ -2367,43 +2198,12 @@ sal_uInt16 CmisPropertiesWindow::GetLineCount() const
return m_aCmisPropertiesLines.size( );
}
-void CmisPropertiesWindow::updateLineWidth()
-{
- Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aYesNoButton, NULL };
-
- for (std::vector< CmisPropertyLine* >::iterator aI =
- m_aCmisPropertiesLines.begin(), aEnd = m_aCmisPropertiesLines.end();
- aI != aEnd; ++aI)
- {
- CmisPropertyLine* pNewLine = *aI;
-
- Window* pNewWindows[] =
- { &pNewLine->m_aName, &pNewLine->m_aType, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aYesNoButton, NULL };
-
- Window** pCurrent = pWindows;
- Window** pNewCurrent = pNewWindows;
- while ( *pCurrent )
- {
- Size aSize = (*pCurrent)->GetSizePixel();
- Point aPos = (*pCurrent)->GetPosPixel();
- aPos.Y() = (*pNewCurrent)->GetPosPixel().Y();
- (*pNewCurrent)->SetPosSizePixel( aPos, aSize );
- pCurrent++;
- pNewCurrent++;
- }
- }
-}
-
void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
const OUString& sType, const bool bUpdatable,
const bool bRequired, const bool bMultiValued,
const bool bOpenChoice, Any& /*aChoices*/, Any& rAny )
{
- CmisPropertyLine* pNewLine = new CmisPropertyLine( this );
+ CmisPropertyLine* pNewLine = new CmisPropertyLine( m_pBox );
pNewLine->m_sId = sId;
pNewLine->m_sType = sType;
@@ -2412,43 +2212,13 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
pNewLine->m_bMultiValued = bMultiValued;
pNewLine->m_bOpenChoice = bOpenChoice;
- pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, EditLoseFocusHdl ) );
-
- pNewLine->m_aValueEdit.SetReadOnly( !bUpdatable );
- pNewLine->m_aDateField.SetReadOnly( !bUpdatable );
- pNewLine->m_aTimeField.SetReadOnly( !bUpdatable );
- if ( !bUpdatable)
- pNewLine->m_aYesNoButton.SetReadOnly( );
+ pNewLine->m_aValueEdit->SetReadOnly( !bUpdatable );
+ pNewLine->m_aDateField->SetReadOnly( !bUpdatable );
+ pNewLine->m_aTimeField->SetReadOnly( !bUpdatable );
+ pNewLine->m_aYesButton->Enable( bUpdatable );
+ pNewLine->m_aNoButton->Enable( bUpdatable );
- m_nLineHeight = m_aValueEdit.GetSizePixel().Height() ;
-
- long nPos = GetLineCount() * GetLineHeight();
- m_aCmisPropertiesLines.push_back( pNewLine );
- Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aYesNoButton, NULL };
- Window* pNewWindows[] =
- { &pNewLine->m_aName, &pNewLine->m_aType, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aYesNoButton, NULL };
- Window** pCurrent = pWindows;
- Window** pNewCurrent = pNewWindows;
- while ( *pCurrent )
- {
- Size aSize = (*pCurrent)->GetSizePixel();
- Point aPos = (*pCurrent)->GetPosPixel();
- aPos.Y() += nPos;
- aPos.Y() += m_nScrollPos;
- (*pNewCurrent)->SetPosSizePixel( aPos, aSize );
- (*pNewCurrent)->Show();
- pCurrent++;
- pNewCurrent++;
- }
-
- pNewLine->m_aDatePos = pNewLine->m_aDateField.GetPosPixel();
- pNewLine->m_aTimePos = pNewLine->m_aTimeField.GetPosPixel();
- pNewLine->m_aDateTimeSize = pNewLine->m_aDateField.GetSizePixel();
- pNewLine->m_aName.SetText( sName );
+ pNewLine->m_aName->SetText( sName );
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
@@ -2473,9 +2243,9 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
rAny >>= bTmpValue;
sValue = ( bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord() );
if ( bTmpValue )
- pNewLine->m_aYesNoButton.CheckYes();
+ pNewLine->m_aYesButton->Check();
else
- pNewLine->m_aYesNoButton.CheckNo();
+ pNewLine->m_aNoButton->Check();
}
else if ( sType == CMIS_TYPE_STRING )
{
@@ -2485,100 +2255,51 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
{
util::DateTime aTmpDateTime;
rAny >>= aTmpDateTime;
- pNewLine->m_aDateField.SetDate( Date( aTmpDateTime.Day, aTmpDateTime.Month, aTmpDateTime.Year ) );
- pNewLine->m_aTimeField.SetTime( Time( aTmpDateTime.Hours, aTmpDateTime.Minutes, aTmpDateTime.Seconds, aTmpDateTime.NanoSeconds ) );
- pNewLine->m_aDateField.SetPosSizePixel(pNewLine->m_aDatePos, pNewLine->m_aDateTimeSize );
- pNewLine->m_aTimeField.SetPosSizePixel(pNewLine->m_aTimePos, pNewLine->m_aDateTimeSize );
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTime.Day, aTmpDateTime.Month, aTmpDateTime.Year ) );
+ pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime.Hours, aTmpDateTime.Minutes, aTmpDateTime.Seconds, aTmpDateTime.NanoSeconds ) );
}
- pNewLine->m_aValueEdit.SetText( sValue );
- pNewLine->m_aType.SetText( sType );
- pNewLine->m_aValueEdit.Show( CMIS_TYPE_STRING == sType ||
+ pNewLine->m_aValueEdit->SetText( sValue );
+ pNewLine->m_aType->SetText( sType );
+ pNewLine->m_aValueEdit->Show( CMIS_TYPE_STRING == sType ||
CMIS_TYPE_INTEGER == sType ||
CMIS_TYPE_DECIMAL == sType );
- pNewLine->m_aDateField.Show( CMIS_TYPE_DATETIME == sType );
- pNewLine->m_aTimeField.Show( CMIS_TYPE_DATETIME == sType );
- pNewLine->m_aYesNoButton.Show( CMIS_TYPE_BOOL == sType );
+ pNewLine->m_aDateField->Show( CMIS_TYPE_DATETIME == sType );
+ pNewLine->m_aTimeField->Show( CMIS_TYPE_DATETIME == sType );
+ pNewLine->m_aYesButton->Show( CMIS_TYPE_BOOL == sType );
+ pNewLine->m_aNoButton->Show( CMIS_TYPE_BOOL == sType );
- pNewLine->m_aName.GrabFocus();
-}
-
-bool CmisPropertiesWindow::AreAllLinesValid() const
-{
- bool bRet = true;
- std::vector< CmisPropertyLine* >::const_iterator pIter;
- for ( pIter = m_aCmisPropertiesLines.begin();
- pIter != m_aCmisPropertiesLines.end(); ++pIter )
- {
- CmisPropertyLine* pLine = *pIter;
- if ( !IsLineValid( pLine ) )
- {
- bRet = false;
- break;
- }
- }
-
- return bRet;
-}
-
-void CmisPropertiesWindow::ClearAllLines()
-{
- std::vector< CmisPropertyLine* >::iterator pIter;
- for ( pIter = m_aCmisPropertiesLines.begin();
- pIter != m_aCmisPropertiesLines.end(); ++pIter )
- {
- CmisPropertyLine* pLine = *pIter;
- delete pLine;
- }
- m_aCmisPropertiesLines.clear();
- m_nScrollPos = 0;
+ m_aCmisPropertiesLines.push_back( pNewLine );
}
void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos )
{
- m_nScrollPos += nNewPos;
- std::vector< CmisPropertyLine* >::iterator pIter;
- for ( pIter = m_aCmisPropertiesLines.begin();
- pIter != m_aCmisPropertiesLines.end(); ++pIter )
- {
- CmisPropertyLine* pLine = *pIter;
-
- Window* pWindows[] = { &pLine->m_aName, &pLine->m_aType, &pLine->m_aValueEdit, &pLine->m_aDateField,
- &pLine->m_aTimeField, &pLine->m_aYesNoButton, NULL };
- Window** pCurrent = pWindows;
- while ( *pCurrent )
- {
- Point aPos = (*pCurrent)->GetPosPixel();
- aPos.Y() += nNewPos;
- (*pCurrent)->SetPosPixel( aPos );
- pCurrent++;
- }
- }
+ m_pBox->SetPosPixel(Point(0, nNewPos));
}
Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() const
{
Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() );
sal_Int32 i = 0;
- std::vector< CmisPropertyLine* >::const_iterator pIter;
+ boost::ptr_vector< CmisPropertyLine >::const_iterator pIter;
for ( pIter = m_aCmisPropertiesLines.begin();
pIter != m_aCmisPropertiesLines.end(); ++pIter, ++i )
{
- CmisPropertyLine* pLine = *pIter;
+ CmisPropertyLine pLine = *pIter;
- aPropertiesSeq[i].Id = pLine->m_sId;
- aPropertiesSeq[i].Type = pLine->m_sType;
- aPropertiesSeq[i].Updatable = pLine->m_bUpdatable;
- aPropertiesSeq[i].Required = pLine->m_bRequired;
- aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice;
- aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued;
+ aPropertiesSeq[i].Id = pLine.m_sId;
+ aPropertiesSeq[i].Type = pLine.m_sType;
+ aPropertiesSeq[i].Updatable = pLine.m_bUpdatable;
+ aPropertiesSeq[i].Required = pLine.m_bRequired;
+ aPropertiesSeq[i].OpenChoice = pLine.m_bOpenChoice;
+ aPropertiesSeq[i].MultiValued = pLine.m_bMultiValued;
- String sPropertyName = pLine->m_aName.GetText();
+ String sPropertyName = pLine.m_aName->GetText();
if ( sPropertyName.Len() > 0 )
{
aPropertiesSeq[i].Name = sPropertyName;
- OUString sType = pLine->m_aType.GetText( );
+ OUString sType = pLine.m_aType->GetText( );
if ( CMIS_TYPE_INTEGER == sType ||
CMIS_TYPE_DECIMAL == sType )
{
@@ -2586,26 +2307,26 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
sal_Bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
- IsNumberFormat( pLine->m_aValueEdit.GetText(), nIndex, nValue );
+ IsNumberFormat( pLine.m_aValueEdit->GetText(), nIndex, nValue );
if ( bIsNum )
aPropertiesSeq[i].Value <<= makeAny( nValue );
}
else if ( CMIS_TYPE_BOOL == sType )
{
- bool bValue = pLine->m_aYesNoButton.IsYesChecked();
+ bool bValue = pLine.m_aYesButton->IsChecked();
aPropertiesSeq[i].Value <<= makeAny( bValue );
}
else if ( CMIS_TYPE_DATETIME == sType )
{
- Date aTmpDate = pLine->m_aDateField.GetDate();
- Time aTmpTime = pLine->m_aTimeField.GetTime();
+ Date aTmpDate = pLine.m_aDateField->GetDate();
+ Time aTmpTime = pLine.m_aTimeField->GetTime();
util::DateTime aDateTime(aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear() );
aPropertiesSeq[i].Value <<= aDateTime;
}
else
{
- OUString sValue( pLine->m_aValueEdit.GetText() );
+ OUString sValue( pLine.m_aValueEdit->GetText() );
aPropertiesSeq[i].Value <<= makeAny( sValue );
}
}
@@ -2614,116 +2335,74 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
return aPropertiesSeq;
}
-CmisPropertiesControl::CmisPropertiesControl(Window* pParent)
- : VclVBox(pParent)
- , m_nThumbPos(0)
+CmisPropertiesControl::CmisPropertiesControl(SfxTabPage* pParent)
+ : m_pPropertiesWin( pParent )
+ , m_rScrolledWindow( *pParent->get<VclScrolledWindow>("CmisScroll"))
+ , m_rVertScroll( m_rScrolledWindow.getVertScrollBar())
{
-}
-
-void CmisPropertiesControl::Init(VclBuilderContainer& rBuilder)
-{
- m_pHeaderBar = new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
- m_pBody = new VclHBox(this);
- OUString sName = rBuilder.get<FixedText>("name")->GetText();
- OUString sType = rBuilder.get<FixedText>("type")->GetText();
- OUString sValue = rBuilder.get<FixedText>("value")->GetText();
- m_pPropertiesWin = new CmisPropertiesWindow(m_pBody, sName, sType, sValue);
- m_pVertScroll = new ScrollBar(m_pBody, WB_VERT);
-
- set_hexpand(true);
- set_vexpand(true);
- set_expand(true);
- set_fill(true);
-
- m_pBody->set_hexpand(true);
- m_pBody->set_vexpand(true);
- m_pBody->set_expand(true);
- m_pBody->set_fill(true);
- m_pBody->Show();
-
- m_pPropertiesWin->set_hexpand(true);
- m_pPropertiesWin->set_vexpand(true);
- m_pPropertiesWin->set_expand(true);
- m_pPropertiesWin->set_fill(true);
- m_pPropertiesWin->Show();
-
- m_pPropertiesWin->SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
- m_pVertScroll->EnableDrag();
- m_pVertScroll->Show();
-
- m_pHeaderBar->set_height_request(GetTextHeight() + 6);
-
- const HeaderBarItemBits nHeadBits = HIB_VCENTER | HIB_FIXED | HIB_FIXEDPOS | HIB_LEFT;
-
- m_pHeaderBar->InsertItem( HI_NAME, sName, 0, nHeadBits );
- m_pHeaderBar->InsertItem( HI_TYPE, sType, 0, nHeadBits );
- m_pHeaderBar->InsertItem( HI_VALUE, sValue, 0, nHeadBits );
- m_pHeaderBar->InsertItem( HI_ACTION, OUString(), 0, nHeadBits );
- m_pHeaderBar->Show();
-
- m_pVertScroll->SetRangeMin( 0 );
- m_pVertScroll->SetRangeMax( 0 );
- m_pVertScroll->SetVisibleSize( 0xFFFF );
+ m_rVertScroll.EnableDrag();
+ m_rVertScroll.Show( m_rScrolledWindow.GetStyle() && WB_VSCROLL);
+ m_rVertScroll.SetRangeMin(0);
+ m_rVertScroll.SetVisibleSize( 0xFFFF );
Link aScrollLink = LINK( this, CmisPropertiesControl, ScrollHdl );
- m_pVertScroll->SetScrollHdl( aScrollLink );
+ m_rVertScroll.SetScrollHdl( aScrollLink );
}
-void CmisPropertiesControl::setAllocation(const Size &rAllocation)
+void CmisPropertiesControl::ClearAllLines()
{
- VclVBox::setAllocation(rAllocation);
-
- m_pPropertiesWin->InitControls( m_pHeaderBar, m_pVertScroll );
- sal_Int32 nScrollOffset = m_pPropertiesWin->GetLineHeight();
- sal_Int32 nVisibleEntries = m_pPropertiesWin->GetSizePixel().Height() / nScrollOffset;
- m_pVertScroll->SetPageSize( nVisibleEntries - 1 );
- m_pVertScroll->SetVisibleSize( nVisibleEntries );
- m_pPropertiesWin->updateLineWidth();
+ m_pPropertiesWin.ClearAllLines();
}
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeCmisPropertiesControl(Window *pParent,
- VclBuilder::stringmap &)
+IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
{
- return new CmisPropertiesControl(pParent);
+ sal_Int32 nOffset = m_pPropertiesWin.GetItemHeight();
+ nOffset *= ( pScrollBar->GetThumbPos() );
+ m_pPropertiesWin.DoScroll( -nOffset );
+ return 0;
}
-CmisPropertiesControl::~CmisPropertiesControl()
+void CmisPropertiesControl::checkAutoVScroll()
{
- delete m_pVertScroll;
- delete m_pPropertiesWin;
- delete m_pBody;
- delete m_pHeaderBar;
+ WinBits nBits = m_rScrolledWindow.GetStyle();
+ if (nBits && WB_VSCROLL)
+ return;
+ if (nBits && WB_AUTOVSCROLL)
+ {
+ sal_Bool bShow = m_rVertScroll.GetRangeMax() > m_rVertScroll.GetVisibleSize();
+ if (bShow != m_rVertScroll.IsVisible())
+ m_rVertScroll.Show(bShow);
+ }
}
-IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
+void CmisPropertiesControl::setScrollRange()
{
- sal_Int32 nOffset = m_pPropertiesWin->GetLineHeight();
- nOffset *= ( m_nThumbPos - pScrollBar->GetThumbPos() );
- m_nThumbPos = pScrollBar->GetThumbPos();
- m_pPropertiesWin->DoScroll( nOffset );
- return 0;
+ sal_Int32 nScrollOffset = m_pPropertiesWin.GetItemHeight();
+ sal_Int32 nVisibleItems = m_rScrolledWindow.getVisibleChildSize().Height() / nScrollOffset;
+ m_rVertScroll.SetPageSize( nVisibleItems - 1 );
+ m_rVertScroll.SetVisibleSize( nVisibleItems );
+ m_rVertScroll.Scroll();
+ checkAutoVScroll();
}
void CmisPropertiesControl::AddLine( const OUString& sId, const OUString& sName,
const OUString& sType, const bool bUpdatable,
const bool bRequired, const bool bMultiValued,
- const bool bOpenChoice, Any& aChoices, Any& rAny,
- bool bInteractive )
+ const bool bOpenChoice, Any& aChoices, Any& rAny
+ )
{
- m_pPropertiesWin->AddLine( sId, sName, sType, bUpdatable, bRequired, bMultiValued,
+ m_rVertScroll.SetRangeMax( m_pPropertiesWin.GetLineCount() + 1 );
+ m_rVertScroll.DoScroll( m_pPropertiesWin.GetLineCount() + 1 );
+ m_pPropertiesWin.AddLine( sId, sName, sType, bUpdatable, bRequired, bMultiValued,
bOpenChoice, aChoices, rAny );
- m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetLineCount() + 1 );
- if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() <
- m_pPropertiesWin->GetLineCount() * m_pPropertiesWin->GetLineHeight() )
- m_pVertScroll->DoScroll( m_pPropertiesWin->GetLineCount() + 1 );
+ checkAutoVScroll();
}
// class SfxCmisPropertiesPage -----------------------------------------
SfxCmisPropertiesPage::SfxCmisPropertiesPage( Window* pParent, const SfxItemSet& rItemSet )
: SfxTabPage(pParent, "CmisInfoPage", "sfx/ui/cmisinfopage.ui", rItemSet)
+ , m_pPropertiesCtrl( this )
{
- get(m_pPropertiesCtrl, "cmisproperties");
- m_pPropertiesCtrl->Init(*this);
}
sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
@@ -2748,7 +2427,7 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
if ( pInfo )
{
Sequence< document::CmisProperty > aOldProps = pInfo->GetCmisProperties( );
- Sequence< document::CmisProperty > aNewProps = m_pPropertiesCtrl->GetCmisProperties();
+ Sequence< document::CmisProperty > aNewProps = m_pPropertiesCtrl.GetCmisProperties();
for ( sal_Int32 i = 0; i< aNewProps.getLength( ); i++ )
{
@@ -2770,9 +2449,7 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
if ( !aNewProps[i].Id.isEmpty() && aNewProps[i].Updatable && oldValue != newValue )
aModifiedProps[ nCount++ ] = aNewProps[i];
}
-
pInfo->SetCmisProperties( aModifiedProps );
-
}
rSet.Put( *pInfo );
@@ -2783,29 +2460,26 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet )
void SfxCmisPropertiesPage::Reset( const SfxItemSet& rItemSet )
{
- m_pPropertiesCtrl->ClearAllLines();
+ m_pPropertiesCtrl.ClearAllLines();
const SfxDocumentInfoItem* m_pInfoItem = &(const SfxDocumentInfoItem &)rItemSet.Get(SID_DOCINFO);
uno::Sequence< document::CmisProperty > aCmisProps = m_pInfoItem->GetCmisProperties();
for ( sal_Int32 i = 0; i < aCmisProps.getLength(); i++ )
{
- m_pPropertiesCtrl->AddLine( aCmisProps[i].Id,
- aCmisProps[i].Name,
- aCmisProps[i].Type,
- aCmisProps[i].Updatable,
- aCmisProps[i].Required,
- aCmisProps[i].MultiValued,
- aCmisProps[i].OpenChoice,
- aCmisProps[i].Choices,
- aCmisProps[i].Value, false );
+ m_pPropertiesCtrl.AddLine( aCmisProps[i].Id,
+ aCmisProps[i].Name,
+ aCmisProps[i].Type,
+ aCmisProps[i].Updatable,
+ aCmisProps[i].Required,
+ aCmisProps[i].MultiValued,
+ aCmisProps[i].OpenChoice,
+ aCmisProps[i].Choices,
+ aCmisProps[i].Value );
}
}
int SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )
{
- int nRet = LEAVE_PAGE;
- if ( !m_pPropertiesCtrl->AreAllLinesValid() )
- nRet = KEEP_PAGE;
- return nRet;
+ return LEAVE_PAGE;
}
SfxTabPage* SfxCmisPropertiesPage::Create( Window* pParent, const SfxItemSet& rItemSet )
diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src
index 77952a1..c3853ba 100644
--- a/sfx2/source/dialog/dinfdlg.src
+++ b/sfx2/source/dialog/dinfdlg.src
@@ -365,71 +365,4 @@ ModalDialog RID_EDIT_DURATIONS
};
};
-FixedText SFX_CMIS_PROPERTY_NAME
-{
- Pos = MAP_APPFONT ( 0 , 2 ) ;
- Size = MAP_APPFONT ( 41 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
- Left = TRUE ;
-};
-
-FixedText SFX_CMIS_PROPERTY_TYPE
-{
- Pos = MAP_APPFONT ( 40 , 2 ) ;
- Size = MAP_APPFONT ( 40 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
- Left = TRUE ;
-};
-
-Edit SFX_CMIS_ED_PROPERTY_VALUE
-{
- Border = TRUE ;
- Pos = MAP_APPFONT ( 127 , 2 ) ;
- Size = MAP_APPFONT ( 61 , RSC_CD_TEXTBOX_HEIGHT ) ;
- TabStop = TRUE ;
- Left = TRUE ;
-};
-
-DateField SFX_CMIS_FLD_DATE
-{
- Border = TRUE ;
- Pos = MAP_APPFONT ( 127 , 2 ) ;
- Size = MAP_APPFONT ( 29 , RSC_CD_TEXTBOX_HEIGHT ) ;
- TabStop = TRUE ;
- Left = TRUE ;
- Spin = TRUE;
-};
-
-TimeField SFX_CMIS_FLD_TIME
-{
- Border = TRUE ;
- Pos = MAP_APPFONT ( 159 , 2 ) ;
- Size = MAP_APPFONT ( 29 , RSC_CD_TEXTBOX_HEIGHT ) ;
- TabStop = TRUE ;
- Left = TRUE ;
- Spin = TRUE;
-};
-
-Control SFX_CMIS_WIN_PROPERTY_YESNO
-{
- HelpId = HID_CTRL_CUSTOMPROPS_YES_NO;
- OutputSize = TRUE ;
- Pos = MAP_APPFONT ( 127 , 2 ) ;
- Size = MAP_APPFONT ( 61 , RSC_CD_TEXTBOX_HEIGHT ) ;
- Border = TRUE ;
- DialogControl = TRUE ;
- RadioButton RB_PROPERTY_YES
- {
- TabStop = TRUE ;
- Pos = MAP_APPFONT( 1 , 1 ) ;
- Size = MAP_APPFONT( 28 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
- Text [ en-US ] = "Yes" ;
- };
- RadioButton RB_PROPERTY_NO
- {
- TabStop = TRUE ;
- Pos = MAP_APPFONT( 32 , 1 ) ;
- Size = MAP_APPFONT( 29 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
- Text [ en-US ] = "No" ;
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/uiconfig/ui/cmisinfopage.ui b/sfx2/uiconfig/ui/cmisinfopage.ui
index f03494d..6fad683 100644
--- a/sfx2/uiconfig/ui/cmisinfopage.ui
+++ b/sfx2/uiconfig/ui/cmisinfopage.ui
@@ -24,11 +24,25 @@
</packing>
</child>
<child>
- <object class="sfxlo-CmisPropertiesControl" id="cmisproperties">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
+ <object class="GtkScrolledWindow" id="CmisScroll">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkBox" id="CmisWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/sfx2/uiconfig/ui/cmisline.ui b/sfx2/uiconfig/ui/cmisline.ui
new file mode 100644
index 0000000..3f5b498
--- /dev/null
+++ b/sfx2/uiconfig/ui/cmisline.ui
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkFrame" id="CmisFrame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xpad">95</property>
+ <property name="label" translatable="yes">Name</property>
+ <property name="width_chars">26</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="type">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xpad">47</property>
+ <property name="label" translatable="yes">Type</property>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list