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

CMIS properties dialog: load CMIS properties into the dialog

Change-Id: I40561de3ce944f017a79995d1ef38584443fbf02
üst 41d498c8
......@@ -79,6 +79,7 @@ private:
sal_Bool m_bDeleteUserData;
sal_Bool m_bUseUserData;
std::vector< CustomProperty* > m_aCustomProperties;
std::vector< CustomProperty* > m_aCmisProperties;
public:
TYPEINFO();
......@@ -86,6 +87,8 @@ public:
SfxDocumentInfoItem( const OUString &rFileName,
const ::com::sun::star::uno::Reference<
::com::sun::star::document::XDocumentProperties> & i_xDocProps,
const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue> & i_cmisProps,
sal_Bool bUseUserData );
SfxDocumentInfoItem( const SfxDocumentInfoItem& );
virtual ~SfxDocumentInfoItem();
......@@ -158,6 +161,11 @@ public:
void AddCustomProperty( const OUString& sName,
const com::sun::star::uno::Any& rValue );
std::vector< CustomProperty* > GetCmisProperties() const;
void ClearCmisProperties();
void AddCmisProperty( const OUString& sName,
const com::sun::star::uno::Any& rValue );
virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
virtual int operator==( const SfxPoolItem& ) const;
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
......@@ -502,12 +510,191 @@ 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 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
{
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();
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
{
ComboBox m_aNameBox;
CmisPropertiesTypeBox m_aTypeBox;
CmisPropertiesEdit m_aValueEdit;
CmisPropertiesDateField m_aDateField;
CmisPropertiesTimeField m_aTimeField;
CmisPropertiesEditButton m_aEditButton;
CmisPropertiesYesNoButton m_aYesNoButton;
Point m_aDatePos;
Point m_aTimePos;
Size m_aDateTimeSize;
bool m_bTypeLostFocus;
CmisPropertyLine( Window* pParent );
void SetRemoved();
};
// class CmisPropertiesWindow ------------------------------------------
class CmisPropertiesWindow : public Window
{
private:
ComboBox m_aNameBox;
ListBox m_aTypeBox;
Edit m_aValueEdit;
DateField m_aDateField;
TimeField m_aTimeField;
PushButton m_aEditButton;
CmisPropertiesYesNoButton m_aYesNoButton;
sal_Int32 m_nLineHeight;
sal_Int32 m_nScrollPos;
SvtSysLocale m_aSysLocale;
std::vector< CmisPropertyLine* > m_aCmisPropertiesLines;
CmisPropertyLine* m_pCurrentLine;
SvNumberFormatter m_aNumberFormatter;
Timer m_aEditLoseFocusTimer;
Timer m_aBoxLoseFocusTimer;
DECL_LINK( TypeHdl, CmisPropertiesTypeBox* );
DECL_LINK( EditLoseFocusHdl, CmisPropertiesEdit* );
DECL_LINK( BoxLoseFocusHdl, CmisPropertiesTypeBox* );
bool IsLineValid( CmisPropertyLine* pLine ) const;
void ValidateLine( CmisPropertyLine* pLine, bool bIsFromTypeBox );
public:
CmisPropertiesWindow(Window* pParent,
const OUString &rHeaderAccName,
const OUString &rHeaderAccType,
const OUString &rHeaderAccValue);
~CmisPropertiesWindow();
void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
sal_uInt16 GetVisibleLineCount() const;
inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny );
bool AreAllLinesValid() const;
void ClearAllLines();
void DoScroll( sal_Int32 nNewPos );
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
GetCmisProperties() const;
void updateLineWidth();
};
// class CmisPropertiesControl -----------------------------------------
class CmisPropertiesControl : public VclVBox
{
private:
HeaderBar* m_pHeaderBar;
VclHBox* m_pBody;
CmisPropertiesWindow* m_pPropertiesWin;
ScrollBar* m_pVertScroll;
sal_Int32 m_nThumbPos;
DECL_LINK( ScrollHdl, ScrollBar* );
public:
CmisPropertiesControl(Window* pParent);
~CmisPropertiesControl();
void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
GetCmisProperties() const
{ return m_pPropertiesWin->GetCmisProperties(); }
void Init(VclBuilderContainer& rParent);
virtual void setAllocation(const Size &rAllocation);
};
// class SfxCmisPropertiesPage -------------------------------------------------
class SfxCmisPropertiesPage : public SfxTabPage
{
private:
CmisPropertiesControl* m_pPropertiesCtrl;
using TabPage::DeactivatePage;
protected:
......
This diff is collapsed.
......@@ -491,7 +491,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
aTitle = GetTitle();
}
SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(),
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues();
SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(), aCmisProperties,
IsUseUserData() );
if ( !GetSlotState( SID_DOCTEMPLATE ) )
// templates not supported
......@@ -516,10 +519,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// user has done some changes to DocumentInfo
pDocInfoItem->UpdateDocumentInfo(getDocProperties());
SetUseUserData( ((const SfxDocumentInfoItem *)pDocInfoItem)->IsUseUserData() );
// add data from dialog for possible recording purposes
// add data from dialog for possible recording purpose
rReq.AppendItem( SfxDocumentInfoItem( GetTitle(),
getDocProperties(), IsUseUserData() ) );
getDocProperties(), aCmisProperties, IsUseUserData() ) );
}
rReq.Done();
......@@ -921,7 +923,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
{
bool bShow = false;
Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues();
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
......
......@@ -23,6 +23,20 @@
<property name="height">1</property>
</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>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="can_focus">False</property>
......
......@@ -130,10 +130,10 @@
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="security">
<object class="GtkLabel" id="cmisprops">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Security</property>
<property name="label" translatable="yes">CMIS Properties</property>
</object>
<packing>
<property name="position">3</property>
......@@ -144,10 +144,10 @@
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="cmisprops">
<object class="GtkLabel" id="security">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">CMIS Properties</property>
<property name="label" translatable="yes">Security</property>
</object>
<packing>
<property name="position">4</property>
......
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