Kaydet (Commit) 145aa21e authored tarafından Cao Cuong Ngo's avatar Cao Cuong Ngo Kaydeden (comit) Cédric Bosdonnat

CMIS properties dialog

Change property name and type to FixedText

Change-Id: I568e213efb0cd0fb0167d8dab397f67b3fa1f69e
üst dbfbfd08
...@@ -525,19 +525,6 @@ public: ...@@ -525,19 +525,6 @@ public:
inline CmisPropertyLine* GetLine() const { return m_pLine; } inline CmisPropertyLine* GetLine() const { return m_pLine; }
}; };
class CmisPropertiesTypeBox : public ListBox
{
private:
CmisPropertyLine* m_pLine;
public:
inline CmisPropertiesTypeBox(
Window* pParent, const ResId& rResId, CmisPropertyLine* pLine ) :
ListBox( pParent, rResId ), m_pLine( pLine ) {}
inline CmisPropertyLine* GetLine() const { return m_pLine; }
};
class CmisPropertiesDateField : public DateField class CmisPropertiesDateField : public DateField
{ {
private: private:
...@@ -594,20 +581,17 @@ public: ...@@ -594,20 +581,17 @@ public:
struct CmisPropertyLine struct CmisPropertyLine
{ {
SelectableFixedText m_aNameBox; FixedText m_aName;
CmisPropertiesTypeBox m_aTypeBox; FixedText m_aType;
CmisPropertiesEdit m_aValueEdit; CmisPropertiesEdit m_aValueEdit;
CmisPropertiesDateField m_aDateField; CmisPropertiesDateField m_aDateField;
CmisPropertiesTimeField m_aTimeField; CmisPropertiesTimeField m_aTimeField;
CmisPropertiesYesNoButton m_aYesNoButton; CmisPropertiesYesNoButton m_aYesNoButton;
Point m_aDatePos; Point m_aDatePos;
Point m_aTimePos; Point m_aTimePos;
Size m_aDateTimeSize; Size m_aDateTimeSize;
bool m_bTypeLostFocus; bool m_bTypeLostFocus;
CmisPropertyLine( Window* pParent ); CmisPropertyLine( Window* pParent );
void SetRemoved();
}; };
// class CmisPropertiesWindow ------------------------------------------ // class CmisPropertiesWindow ------------------------------------------
...@@ -615,8 +599,8 @@ struct CmisPropertyLine ...@@ -615,8 +599,8 @@ struct CmisPropertyLine
class CmisPropertiesWindow : public Window class CmisPropertiesWindow : public Window
{ {
private: private:
SelectableFixedText m_aNameBox; FixedText m_aName;
ListBox m_aTypeBox; FixedText m_aType;
Edit m_aValueEdit; Edit m_aValueEdit;
DateField m_aDateField; DateField m_aDateField;
TimeField m_aTimeField; TimeField m_aTimeField;
...@@ -631,9 +615,7 @@ private: ...@@ -631,9 +615,7 @@ private:
Timer m_aEditLoseFocusTimer; Timer m_aEditLoseFocusTimer;
Timer m_aBoxLoseFocusTimer; Timer m_aBoxLoseFocusTimer;
DECL_LINK( TypeHdl, CmisPropertiesTypeBox* );
DECL_LINK( EditLoseFocusHdl, CmisPropertiesEdit* ); DECL_LINK( EditLoseFocusHdl, CmisPropertiesEdit* );
DECL_LINK( BoxLoseFocusHdl, CmisPropertiesTypeBox* );
bool IsLineValid( CmisPropertyLine* pLine ) const; bool IsLineValid( CmisPropertyLine* pLine ) const;
void ValidateLine( CmisPropertyLine* pLine, bool bIsFromTypeBox ); void ValidateLine( CmisPropertyLine* pLine, bool bIsFromTypeBox );
...@@ -646,7 +628,7 @@ public: ...@@ -646,7 +628,7 @@ public:
~CmisPropertiesWindow(); ~CmisPropertiesWindow();
void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar ); void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
sal_uInt16 GetVisibleLineCount() const; sal_uInt16 GetLineCount() const;
inline sal_Int32 GetLineHeight() const { return m_nLineHeight; } inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny ); void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny );
bool AreAllLinesValid() const; bool AreAllLinesValid() const;
...@@ -697,7 +679,7 @@ private: ...@@ -697,7 +679,7 @@ private:
protected: protected:
SfxCmisPropertiesPage( Window* pParent, const SfxItemSet& ); SfxCmisPropertiesPage( Window* pParent, const SfxItemSet& );
virtual sal_Bool FillItemSet( SfxItemSet& ); virtual sal_Bool FillItemSet( SfxItemSet& );
virtual void Reset( const SfxItemSet& ); virtual void Reset( const SfxItemSet& );
virtual int DeactivatePage( SfxItemSet* pSet = NULL ); virtual int DeactivatePage( SfxItemSet* pSet = NULL );
......
...@@ -2211,12 +2211,12 @@ void CmisPropertiesYesNoButton::Resize() ...@@ -2211,12 +2211,12 @@ void CmisPropertiesYesNoButton::Resize()
// struct CmisPropertyLine --------------------------------------------- // struct CmisPropertyLine ---------------------------------------------
CmisPropertyLine::CmisPropertyLine( Window* pParent ) : CmisPropertyLine::CmisPropertyLine( Window* pParent ) :
m_aNameBox ( pParent ), m_aName ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
m_aTypeBox ( pParent, SfxResId( SFX_LB_CMIS_PROPERTY_TYPE ), this ), m_aType ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
m_aValueEdit ( pParent, SfxResId( SFX_ED_PROPERTY_VALUE ), this ), m_aValueEdit ( pParent, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ), this ),
m_aDateField ( pParent, SfxResId( SFX_FLD_DATE), this), m_aDateField ( pParent, SfxResId( SFX_CMIS_FLD_DATE), this),
m_aTimeField ( pParent, SfxResId( SFX_FLD_TIME), this), m_aTimeField ( pParent, SfxResId( SFX_CMIS_FLD_TIME), this),
m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), m_aYesNoButton ( pParent, SfxResId( SFX_CMIS_WIN_PROPERTY_YESNO ) ),
m_bTypeLostFocus( false ) m_bTypeLostFocus( false )
{ {
...@@ -2231,47 +2231,28 @@ CmisPropertiesWindow::CmisPropertiesWindow(Window* pParent, ...@@ -2231,47 +2231,28 @@ CmisPropertiesWindow::CmisPropertiesWindow(Window* pParent,
const OUString &rHeaderAccType, const OUString &rHeaderAccType,
const OUString &rHeaderAccValue) : const OUString &rHeaderAccValue) :
Window(pParent), Window(pParent),
m_aNameBox ( this ), m_aName ( this, SfxResId( SFX_CMIS_PROPERTY_NAME ) ),
m_aTypeBox ( this, SfxResId( SFX_LB_CMIS_PROPERTY_TYPE ) ), m_aType ( this, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ),
m_aValueEdit ( this, SfxResId( SFX_ED_PROPERTY_VALUE ) ), m_aValueEdit ( this, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ) ),
m_aDateField ( this, SfxResId( SFX_FLD_DATE) ), m_aDateField ( this, SfxResId( SFX_CMIS_FLD_DATE) ),
m_aTimeField ( this, SfxResId( SFX_FLD_TIME) ), m_aTimeField ( this, SfxResId( SFX_CMIS_FLD_TIME) ),
m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), m_aYesNoButton ( this, SfxResId( SFX_CMIS_WIN_PROPERTY_YESNO ) ),
m_nScrollPos (0), m_nScrollPos (0),
m_aNumberFormatter( ::comphelper::getProcessComponentContext(), m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
Application::GetSettings().GetLanguageTag().getLanguageType() ) Application::GetSettings().GetLanguageTag().getLanguageType() )
{ {
m_aNameBox.SetAccessibleName(rHeaderAccName); m_aName.SetAccessibleName(rHeaderAccName);
m_aTypeBox.SetAccessibleName(rHeaderAccType); m_aType.SetAccessibleName(rHeaderAccType);
m_aValueEdit.SetAccessibleName(rHeaderAccValue); m_aValueEdit.SetAccessibleName(rHeaderAccValue);
} }
CmisPropertiesWindow::~CmisPropertiesWindow() CmisPropertiesWindow::~CmisPropertiesWindow()
{ {
m_aEditLoseFocusTimer.Stop(); m_aEditLoseFocusTimer.Stop();
m_aBoxLoseFocusTimer.Stop();
ClearAllLines(); ClearAllLines();
} }
IMPL_LINK( CmisPropertiesWindow, TypeHdl, CmisPropertiesTypeBox*, pBox )
{
sal_Int64 nType = sal_Int64( (long)pBox->GetEntryData( pBox->GetSelectEntryPos() ) );
CmisPropertyLine* pLine = pBox->GetLine();
pLine->m_aValueEdit.Show(( CMIS_TYPE_STRING == nType ) || ( CMIS_TYPE_NUMBER == nType ) );
pLine->m_aDateField.Show( CMIS_TYPE_DATETIME == nType );
pLine->m_aTimeField.Show( CMIS_TYPE_DATETIME == nType );
pLine->m_aYesNoButton.Show( CMIS_TYPE_BOOLEAN == nType );
if ( nType == CMIS_TYPE_DATETIME )
{
pLine->m_aDateField.SetPosSizePixel( pLine->m_aDatePos, pLine->m_aDateTimeSize );
pLine->m_aTimeField.SetPosSizePixel(pLine->m_aTimePos, pLine->m_aDateTimeSize );
}
return 0;
}
IMPL_LINK( CmisPropertiesWindow, EditLoseFocusHdl, CmisPropertiesEdit*, pEdit ) IMPL_LINK( CmisPropertiesWindow, EditLoseFocusHdl, CmisPropertiesEdit*, pEdit )
{ {
if ( pEdit ) if ( pEdit )
...@@ -2288,32 +2269,20 @@ IMPL_LINK( CmisPropertiesWindow, EditLoseFocusHdl, CmisPropertiesEdit*, pEdit ) ...@@ -2288,32 +2269,20 @@ IMPL_LINK( CmisPropertiesWindow, EditLoseFocusHdl, CmisPropertiesEdit*, pEdit )
return 0; return 0;
} }
IMPL_LINK( CmisPropertiesWindow, BoxLoseFocusHdl, CmisPropertiesTypeBox*, pBox )
{
if ( pBox )
{
m_pCurrentLine = pBox->GetLine();
m_aBoxLoseFocusTimer.Start();
}
return 0;
}
bool CmisPropertiesWindow::IsLineValid( CmisPropertyLine* pLine ) const bool CmisPropertiesWindow::IsLineValid( CmisPropertyLine* pLine ) const
{ {
bool bIsValid = true; bool bIsValid = true;
pLine->m_bTypeLostFocus = false; pLine->m_bTypeLostFocus = false;
sal_Int64 nType = sal_Int64( OUString sType = pLine->m_aType.GetText( );
(long)pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) );
String sValue = pLine->m_aValueEdit.GetText(); String sValue = pLine->m_aValueEdit.GetText();
if ( sValue.Len() == 0 ) if ( sValue.Len() == 0 )
return true; return true;
sal_uInt32 nIndex = 0xFFFFFFFF; sal_uInt32 nIndex = 0xFFFFFFFF;
if ( CMIS_TYPE_NUMBER == nType ) if ( CMIS_TYPE_NUMBER == sType )
nIndex = const_cast< SvNumberFormatter& >( nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
else if ( CMIS_TYPE_DATETIME == nType ) else if ( CMIS_TYPE_DATETIME == sType )
nIndex = const_cast< SvNumberFormatter& >( nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter).GetFormatIndex( NF_DATE_SYS_DDMMYYYY ); m_aNumberFormatter).GetFormatIndex( NF_DATE_SYS_DDMMYYYY );
...@@ -2339,7 +2308,7 @@ void CmisPropertiesWindow::ValidateLine( CmisPropertyLine* pLine, bool bIsFromTy ...@@ -2339,7 +2308,7 @@ void CmisPropertiesWindow::ValidateLine( CmisPropertyLine* pLine, bool bIsFromTy
pLine->m_bTypeLostFocus = true; pLine->m_bTypeLostFocus = true;
Window* pParent = GetParent()->GetParent(); Window* pParent = GetParent()->GetParent();
if ( QueryBox( pParent, SfxResId( SFX_QB_WRONG_TYPE ) ).Execute() == RET_OK ) if ( QueryBox( pParent, SfxResId( SFX_QB_WRONG_TYPE ) ).Execute() == RET_OK )
pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( (void*)CMIS_TYPE_STRING ) ); pLine->m_aType.SetText( CMIS_TYPE_STRING );
else else
pLine->m_aValueEdit.GrabFocus(); pLine->m_aValueEdit.GrabFocus();
} }
...@@ -2350,8 +2319,8 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* ...@@ -2350,8 +2319,8 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar*
DBG_ASSERT( pHeaderBar, "CmisPropertiesWindow::InitControls(): invalid headerbar" ); DBG_ASSERT( pHeaderBar, "CmisPropertiesWindow::InitControls(): invalid headerbar" );
DBG_ASSERT( pScrollBar, "CmisPropertiesWindow::InitControls(): invalid scrollbar" ); DBG_ASSERT( pScrollBar, "CmisPropertiesWindow::InitControls(): invalid scrollbar" );
m_aNameBox.Hide(); m_aName.Hide();
m_aTypeBox.Hide(); m_aType.Hide();
m_aValueEdit.Hide(); m_aValueEdit.Hide();
m_aDateField.Hide(); m_aDateField.Hide();
m_aTimeField.Hide(); m_aTimeField.Hide();
...@@ -2360,7 +2329,7 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* ...@@ -2360,7 +2329,7 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar*
const long nOffset = 4; const long nOffset = 4;
const long nScrollBarWidth = pScrollBar->GetSizePixel().Width(); const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
const long nButtonWidth = nScrollBarWidth + nOffset; const long nButtonWidth = nScrollBarWidth + nOffset;
long nTypeWidth = m_aTypeBox.CalcMinimumSize().Width() + ( 2 * nOffset ); long nTypeWidth = m_aType.CalcMinimumSize().Width() + ( 2 * nOffset );
long nFullWidth = pHeaderBar->GetSizePixel().Width(); long nFullWidth = pHeaderBar->GetSizePixel().Width();
long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2; long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
pHeaderBar->SetItemSize( HI_NAME, nItemWidth ); pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
...@@ -2368,7 +2337,7 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* ...@@ -2368,7 +2337,7 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar*
pHeaderBar->SetItemSize( HI_VALUE, nItemWidth ); pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth ); pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, NULL }; Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit, NULL };
Window** pCurrent = pWindows; Window** pCurrent = pWindows;
sal_uInt16 nPos = 0; sal_uInt16 nPos = 0;
while ( *pCurrent ) while ( *pCurrent )
...@@ -2403,19 +2372,14 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar* ...@@ -2403,19 +2372,14 @@ void CmisPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBar*
} }
sal_uInt16 CmisPropertiesWindow::GetVisibleLineCount() const sal_uInt16 CmisPropertiesWindow::GetLineCount() const
{ {
sal_uInt16 nCount = 0; return m_aCmisPropertiesLines.size( );
std::vector< CmisPropertyLine* >::const_iterator pIter;
for ( pIter = m_aCmisPropertiesLines.begin();
pIter != m_aCmisPropertiesLines.end(); ++pIter )
nCount++;
return nCount;
} }
void CmisPropertiesWindow::updateLineWidth() void CmisPropertiesWindow::updateLineWidth()
{ {
Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit,
&m_aDateField, &m_aTimeField, &m_aDateField, &m_aTimeField,
&m_aYesNoButton, NULL }; &m_aYesNoButton, NULL };
...@@ -2426,7 +2390,7 @@ void CmisPropertiesWindow::updateLineWidth() ...@@ -2426,7 +2390,7 @@ void CmisPropertiesWindow::updateLineWidth()
CmisPropertyLine* pNewLine = *aI; CmisPropertyLine* pNewLine = *aI;
Window* pNewWindows[] = Window* pNewWindows[] =
{ &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit, { &pNewLine->m_aName, &pNewLine->m_aType, &pNewLine->m_aValueEdit,
&pNewLine->m_aDateField, &pNewLine->m_aTimeField, &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
&pNewLine->m_aYesNoButton, NULL }; &pNewLine->m_aYesNoButton, NULL };
...@@ -2447,24 +2411,21 @@ void CmisPropertiesWindow::updateLineWidth() ...@@ -2447,24 +2411,21 @@ void CmisPropertiesWindow::updateLineWidth()
void CmisPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) void CmisPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{ {
CmisPropertyLine* pNewLine = new CmisPropertyLine( this ); CmisPropertyLine* pNewLine = new CmisPropertyLine( this );
pNewLine->m_aTypeBox.SetSelectHdl( LINK( this, CmisPropertiesWindow, TypeHdl ) );
pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, EditLoseFocusHdl ) ); pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, EditLoseFocusHdl ) );
pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, BoxLoseFocusHdl ) ); pNewLine->m_aName.SetAccessibleName(m_aName.GetAccessibleName());
pNewLine->m_aType.SetAccessibleName(m_aType.GetAccessibleName());
pNewLine->m_aNameBox.SetAccessibleName(m_aNameBox.GetAccessibleName());
pNewLine->m_aTypeBox.SetAccessibleName(m_aTypeBox.GetAccessibleName());
pNewLine->m_aValueEdit.SetAccessibleName(m_aValueEdit.GetAccessibleName()); pNewLine->m_aValueEdit.SetAccessibleName(m_aValueEdit.GetAccessibleName());
m_nLineHeight = m_aValueEdit.GetSizePixel().Height() ; m_nLineHeight = m_aValueEdit.GetSizePixel().Height() ;
long nPos = GetVisibleLineCount() * GetLineHeight(); long nPos = GetLineCount() * GetLineHeight();
m_aCmisPropertiesLines.push_back( pNewLine ); m_aCmisPropertiesLines.push_back( pNewLine );
Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, Window* pWindows[] = { &m_aName, &m_aType, &m_aValueEdit,
&m_aDateField, &m_aTimeField, &m_aDateField, &m_aTimeField,
&m_aYesNoButton, NULL }; &m_aYesNoButton, NULL };
Window* pNewWindows[] = Window* pNewWindows[] =
{ &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit, { &pNewLine->m_aName, &pNewLine->m_aType, &pNewLine->m_aValueEdit,
&pNewLine->m_aDateField, &pNewLine->m_aTimeField, &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
&pNewLine->m_aYesNoButton, NULL }; &pNewLine->m_aYesNoButton, NULL };
Window** pCurrent = pWindows; Window** pCurrent = pWindows;
...@@ -2491,49 +2452,59 @@ void CmisPropertiesWindow::AddLine( const OUString& sName, Any& rAny ) ...@@ -2491,49 +2452,59 @@ void CmisPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
util::DateTime aTmpDateTime; util::DateTime aTmpDateTime;
SvtSysLocale aSysLocale; SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
pNewLine->m_aNameBox.SetText( sName ); pNewLine->m_aName.SetText( sName );
sal_IntPtr nType = CMIS_TYPE_ANY; OUString sType = CMIS_TYPE_ANY;
String sValue; OUString sValue;
if ( rAny >>= nTmpValue ) if ( rAny >>= nTmpValue )
{ {
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM ); sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue ); m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
pNewLine->m_aValueEdit.SetText( sValue ); pNewLine->m_aValueEdit.SetText( sValue );
nType = CMIS_TYPE_NUMBER; sType = CMIS_TYPE_NUMBER;
} }
else if ( rAny >>= bTmpValue ) else if ( rAny >>= bTmpValue )
{ {
sValue = ( bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord() ); sValue = ( bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord() );
nType = CMIS_TYPE_BOOLEAN; sType = CMIS_TYPE_BOOLEAN;
} }
else if ( rAny >>= sTmpValue ) else if ( rAny >>= sTmpValue )
{ {
pNewLine->m_aValueEdit.SetText( sTmpValue ); pNewLine->m_aValueEdit.SetText( sTmpValue );
nType = CMIS_TYPE_STRING; sType = CMIS_TYPE_STRING;
} }
else if ( rAny >>= aTmpDateTime ) else if ( rAny >>= aTmpDateTime )
{ {
pNewLine->m_aDateField.SetDate( Date( aTmpDateTime.Day, aTmpDateTime.Month, aTmpDateTime.Year ) ); 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_aTimeField.SetTime( Time( aTmpDateTime.Hours, aTmpDateTime.Minutes, aTmpDateTime.Seconds, aTmpDateTime.NanoSeconds ) );
nType = CMIS_TYPE_DATETIME; sType = CMIS_TYPE_DATETIME;
} }
if ( nType != CMIS_TYPE_ANY ) if ( sType != CMIS_TYPE_ANY )
{ {
if ( CMIS_TYPE_BOOLEAN == nType ) if ( CMIS_TYPE_BOOLEAN == sType )
{ {
if ( bTmpValue ) if ( bTmpValue )
pNewLine->m_aYesNoButton.CheckYes(); pNewLine->m_aYesNoButton.CheckYes();
else else
pNewLine->m_aYesNoButton.CheckNo(); pNewLine->m_aYesNoButton.CheckNo();
} }
pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( (void*)nType ) );
} }
TypeHdl( &pNewLine->m_aTypeBox ); pNewLine->m_aType.SetText( sType );
pNewLine->m_aNameBox.GrabFocus(); pNewLine->m_aValueEdit.Show(( CMIS_TYPE_STRING == sType ) || ( CMIS_TYPE_NUMBER == sType ) );
pNewLine->m_aDateField.Show( CMIS_TYPE_DATETIME == sType );
pNewLine->m_aTimeField.Show( CMIS_TYPE_DATETIME == sType );
pNewLine->m_aYesNoButton.Show( CMIS_TYPE_BOOLEAN == sType );
if ( sType == CMIS_TYPE_DATETIME )
{
pNewLine->m_aDateField.SetPosSizePixel(pNewLine->m_aDatePos, pNewLine->m_aDateTimeSize );
pNewLine->m_aTimeField.SetPosSizePixel(pNewLine->m_aTimePos, pNewLine->m_aDateTimeSize );
}
pNewLine->m_aName.GrabFocus();
} }
bool CmisPropertiesWindow::AreAllLinesValid() const bool CmisPropertiesWindow::AreAllLinesValid() const
...@@ -2576,7 +2547,7 @@ void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos ) ...@@ -2576,7 +2547,7 @@ void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos )
{ {
CmisPropertyLine* pLine = *pIter; CmisPropertyLine* pLine = *pIter;
Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, Window* pWindows[] = { &pLine->m_aName, &pLine->m_aType, &pLine->m_aValueEdit, &pLine->m_aDateField,
&pLine->m_aTimeField, &pLine->m_aYesNoButton, NULL }; &pLine->m_aTimeField, &pLine->m_aYesNoButton, NULL };
Window** pCurrent = pWindows; Window** pCurrent = pWindows;
while ( *pCurrent ) while ( *pCurrent )
...@@ -2599,13 +2570,12 @@ Sequence< beans::PropertyValue > CmisPropertiesWindow::GetCmisProperties() const ...@@ -2599,13 +2570,12 @@ Sequence< beans::PropertyValue > CmisPropertiesWindow::GetCmisProperties() const
{ {
CmisPropertyLine* pLine = *pIter; CmisPropertyLine* pLine = *pIter;
String sPropertyName = pLine->m_aNameBox.GetText(); String sPropertyName = pLine->m_aName.GetText();
if ( sPropertyName.Len() > 0 ) if ( sPropertyName.Len() > 0 )
{ {
aPropertiesSeq[i].Name = sPropertyName; aPropertiesSeq[i].Name = sPropertyName;
sal_Int64 nType = sal_Int64( OUString sType = pLine->m_aType.GetText( );
(long)pLine->m_aTypeBox.GetEntryData( pLine->m_aTypeBox.GetSelectEntryPos() ) ); if ( CMIS_TYPE_NUMBER == sType )
if ( CMIS_TYPE_NUMBER == nType )
{ {
double nValue = 0; double nValue = 0;
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >( sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
...@@ -2615,12 +2585,12 @@ Sequence< beans::PropertyValue > CmisPropertiesWindow::GetCmisProperties() const ...@@ -2615,12 +2585,12 @@ Sequence< beans::PropertyValue > CmisPropertiesWindow::GetCmisProperties() const
if ( bIsNum ) if ( bIsNum )
aPropertiesSeq[i].Value <<= makeAny( nValue ); aPropertiesSeq[i].Value <<= makeAny( nValue );
} }
else if ( CMIS_TYPE_BOOLEAN == nType ) else if ( CMIS_TYPE_BOOLEAN == sType )
{ {
bool bValue = pLine->m_aYesNoButton.IsYesChecked(); bool bValue = pLine->m_aYesNoButton.IsYesChecked();
aPropertiesSeq[i].Value <<= makeAny( bValue ); aPropertiesSeq[i].Value <<= makeAny( bValue );
} }
else if ( CMIS_TYPE_DATETIME == nType ) else if ( CMIS_TYPE_DATETIME == sType )
{ {
Date aTmpDate = pLine->m_aDateField.GetDate(); Date aTmpDate = pLine->m_aDateField.GetDate();
Time aTmpTime = pLine->m_aTimeField.GetTime(); Time aTmpTime = pLine->m_aTimeField.GetTime();
...@@ -2733,9 +2703,9 @@ IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar ) ...@@ -2733,9 +2703,9 @@ IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
void CmisPropertiesControl::AddLine( const OUString& sName, Any& rAny, bool bInteractive ) void CmisPropertiesControl::AddLine( const OUString& sName, Any& rAny, bool bInteractive )
{ {
m_pPropertiesWin->AddLine( sName, rAny ); m_pPropertiesWin->AddLine( sName, rAny );
m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetVisibleLineCount() + 1 ); m_pVertScroll->SetRangeMax( m_pPropertiesWin->GetLineCount() + 1 );
if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() < m_pPropertiesWin->GetVisibleLineCount() * m_pPropertiesWin->GetLineHeight() ) if ( bInteractive && m_pPropertiesWin->GetOutputSizePixel().Height() < m_pPropertiesWin->GetLineCount() * m_pPropertiesWin->GetLineHeight() )
m_pVertScroll->DoScroll( m_pPropertiesWin->GetVisibleLineCount() + 1 ); m_pVertScroll->DoScroll( m_pPropertiesWin->GetLineCount() + 1 );
} }
// class SfxCmisPropertiesPage ----------------------------------------- // class SfxCmisPropertiesPage -----------------------------------------
......
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
#define CUSTOM_TYPE_DURATION 5 #define CUSTOM_TYPE_DURATION 5
#define CUSTOM_TYPE_DATETIME 6 #define CUSTOM_TYPE_DATETIME 6
#define CMIS_TYPE_ANY 0 #define CMIS_TYPE_ANY "Any"
#define CMIS_TYPE_STRING 1 #define CMIS_TYPE_STRING "String"
#define CMIS_TYPE_NUMBER 2 #define CMIS_TYPE_NUMBER "Number"
#define CMIS_TYPE_DATETIME 3 #define CMIS_TYPE_DATETIME "Datetime"
#define CMIS_TYPE_BOOLEAN 4 #define CMIS_TYPE_BOOLEAN "Boolean"
// defines --------------------------------------------------------------- // defines ---------------------------------------------------------------
......
...@@ -90,22 +90,6 @@ ListBox SFX_LB_PROPERTY_TYPE ...@@ -90,22 +90,6 @@ ListBox SFX_LB_PROPERTY_TYPE
< "Yes or no" ; CUSTOM_TYPE_BOOLEAN ; > ; < "Yes or no" ; CUSTOM_TYPE_BOOLEAN ; > ;
}; };
}; };
ListBox SFX_LB_CMIS_PROPERTY_TYPE
{
Pos = MAP_APPFONT ( 63 , 2 ) ;
Size = MAP_APPFONT ( 60 , 80 ) ;
DropDown = TRUE;
Border = TRUE;
CurPos = 0;
StringList [ en-US ] =
{
< "Text" ; CMIS_TYPE_STRING ; > ;
< "DateTime" ; CMIS_TYPE_DATETIME ; > ;
< "Integer" ; CMIS_TYPE_NUMBER ; > ;
< "Decimal" ; CMIS_TYPE_NUMBER ; > ;
< "Boolean" ; CMIS_TYPE_BOOLEAN ; > ;
};
};
Edit SFX_ED_PROPERTY_VALUE Edit SFX_ED_PROPERTY_VALUE
{ {
...@@ -379,9 +363,73 @@ ModalDialog RID_EDIT_DURATIONS ...@@ -379,9 +363,73 @@ ModalDialog RID_EDIT_DURATIONS
SpinSize = 1 ; SpinSize = 1 ;
Value = 0 ; Value = 0 ;
}; };
};
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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -49,7 +49,14 @@ ...@@ -49,7 +49,14 @@
#define SFX_FLD_TIME (RID_SFX_SFXLOCAL_START + 11) #define SFX_FLD_TIME (RID_SFX_SFXLOCAL_START + 11)
#define SFX_FLD_DURATION (RID_SFX_SFXLOCAL_START + 12) #define SFX_FLD_DURATION (RID_SFX_SFXLOCAL_START + 12)
#define SFX_ST_DURATION_FORMAT (RID_SFX_SFXLOCAL_START + 13) #define SFX_ST_DURATION_FORMAT (RID_SFX_SFXLOCAL_START + 13)
#define SFX_LB_CMIS_PROPERTY_TYPE (RID_SFX_SFXLOCAL_START + 14)
#define SFX_CMIS_PROPERTY_NAME (RID_SFX_SFXLOCAL_START + 14)
#define SFX_CMIS_ED_PROPERTY_VALUE (RID_SFX_SFXLOCAL_START + 15)
#define SFX_CMIS_PROPERTY_TYPE (RID_SFX_SFXLOCAL_START + 16)
#define SFX_CMIS_WIN_PROPERTY_YESNO (RID_SFX_SFXLOCAL_START + 17)
#define SFX_CMIS_QB_WRONG_TYPE (RID_SFX_SFXLOCAL_START + 18)
#define SFX_CMIS_FLD_DATE (RID_SFX_SFXLOCAL_START + 19)
#define SFX_CMIS_FLD_TIME (RID_SFX_SFXLOCAL_START + 20)
// Images ---------------------------------------------------------------- // Images ----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment